diff --git a/src/CommerceAdmin.php b/src/CommerceAdmin.php index 9d6c4f9..32d7034 100644 --- a/src/CommerceAdmin.php +++ b/src/CommerceAdmin.php @@ -15,6 +15,11 @@ * escaped before it reaches the page. Status "pills" use the admin theme's * semantic tokens (which redefine per theme) rather than hard-coded colours, so * they stay legible in dark and every selectable theme. + * + * The admin CSP is nonce-only for `style-src` (no `'unsafe-inline'`), so inline + * `style=` attributes are dropped by the browser. All styling therefore lives in + * ONE nonce-carrying `'; + } + private function notice(?string $notice): string { if ($notice === null || !isset(self::NOTICES[$notice])) { @@ -199,13 +231,11 @@ private function statusLabel(string $status): string }; } - /** A coloured status pill using theme tokens (dark-safe). */ + /** A coloured status pill (dark-safe via the nonce'd tone classes in {@see styles}). */ private function pill(string $status): string { - [$bg, $fg] = self::STATUS_TONE[$status] ?? ['--nb-surface-2', '--nb-muted']; - - return '' . $this->e($status) . ''; + $mod = isset(self::STATUS_TONE[$status]) ? ' cx-pill--' . $status : ''; + return '' . $this->e($status) . ''; } /** The lifecycle buttons valid for this order's status; each is a CSRF-protected POST. */ @@ -220,13 +250,13 @@ private function actions(string $reference, string $status, string $csrf): strin return '—'; } - $out = '