@takazudo/zudo-sg 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,45 @@ All notable changes to `@takazudo/zudo-sg` are documented in this file.
4
4
 
5
5
  The format is based on Keep a Changelog, and release notes are generated from the changelog MDX pages.
6
6
 
7
+ ## [0.3.0] - 2026-09-21
8
+
9
+ The catalog chrome no longer borrows a host's bare `--color-*` tokens. It now
10
+ reads its own `--sg-*` namespace, so the code panel, workbench toolbar, and
11
+ segmented controls render correctly no matter where a host imports its
12
+ component theme relative to `@takazudo/zudo-doc/theme.css`.
13
+
14
+ ### Breaking Changes
15
+
16
+ - Chrome colors are read from `--sg-*`, not from bare `--color-*` theme keys.
17
+ A host that recolored the chrome by defining `--color-border`,
18
+ `--color-surface-2`, `--color-focus`, `--color-border-strong`, or
19
+ `--color-on-accent` must now override the matching `--sg-*` custom property
20
+ instead — for example `:root { --sg-border: oklch(0.86 0.006 65); }`. Hosts
21
+ that never themed the chrome need no change.
22
+
23
+ ### Features
24
+
25
+ - The engine declares eleven raw-tier chrome roles — `--sg-bg`, `--sg-fg`,
26
+ `--sg-surface`, `--sg-surface-2`, `--sg-border`, `--sg-border-strong`,
27
+ `--sg-muted`, `--sg-accent`, `--sg-on-accent`, `--sg-focus`, and
28
+ `--sg-success` — each derived from zudo-doc's scheme-aware `--zd-*` tier with
29
+ a literal fallback. They are declared at zero specificity, so a host's plain
30
+ `:root` override wins in any import order.
31
+ - A new `check:chrome-tokens` lint fails the build when engine chrome code
32
+ reintroduces a bare color utility, and the package safelist check now asserts
33
+ that real candidates were extracted rather than passing on an empty set.
34
+
35
+ ### Bug Fixes
36
+
37
+ - The chrome no longer half-renders when a host imports its own component color
38
+ tokens before `@takazudo/zudo-doc/theme.css`. That file's `--color-*: initial`
39
+ wipes every `--color-*` theme key declared before it, which previously erased
40
+ the borders and surfaces the chrome depended on with no build-time or runtime
41
+ signal.
42
+ - The code panel divider, workbench toolbar and toggle fills, and the tile-size
43
+ segmented control keep a visible border and a filled surface in both light and
44
+ dark schemes.
45
+
7
46
  ## [0.2.2] - 2026-09-20
8
47
 
9
48
  Minimal hosts now expose the engine's routes in their header without requiring
package/README.md CHANGED
@@ -157,6 +157,36 @@ your own token stylesheet as needed:
157
157
  @source "src/content/**/*.{mdx,md}";
158
158
  ```
159
159
 
160
+ ### Three token worlds and the engine override hook
161
+
162
+ The host contains three independent color-token worlds:
163
+
164
+ - zudo-doc's `--zd-*` roles style the documentation shell and doc chrome.
165
+ - zudo-sg's raw `--sg-*` roles style the catalog engine chrome.
166
+ - The host component library owns its own `@theme` color tokens, usually the
167
+ `--color-*` semantic roles used by previews.
168
+
169
+ The engine's eleven public chrome roles are `--sg-bg`, `--sg-fg`, `--sg-surface`,
170
+ `--sg-surface-2`, `--sg-border`, `--sg-border-strong`, `--sg-muted`, `--sg-accent`,
171
+ `--sg-on-accent`, `--sg-focus`, and `--sg-success`. They are plain properties in a
172
+ zero-specificity `:where(:root)` block, not an engine `@theme` color tier. zudo-doc's
173
+ `theme.css` resets `--color-*`, so these raw properties survive regardless of whether
174
+ the engine stylesheet is imported before or after that reset.
175
+
176
+ Override engine chrome from the host with an ordinary, unlayered root rule:
177
+
178
+ ```css
179
+ :root {
180
+ --sg-border: oklch(0.72 0.02 65);
181
+ }
182
+ ```
183
+
184
+ The zero-specificity defaults make this hook order-independent. Keep it unlayered when
185
+ using cascade layers. If the host used bare `--color-border` to theme engine chrome,
186
+ migrate that declaration to `--sg-border` (and use the matching `--sg-*` role for each
187
+ other chrome color). Bare `--color-border` remains a valid host component token, but it
188
+ no longer controls zudo-sg chrome.
189
+
160
190
  The zudo-doc theme supplies framework defaults, including the breakpoints
161
191
  needed by responsive sidebar utilities. Its color-token reset precedes your
162
192
  tokens so they survive. Use `theme-no-reset.css` instead to preserve
@@ -165,6 +195,13 @@ stylesheets still follow source order. Do not import both variants or add
165
195
  another preflight/full `tailwindcss` import. A host that already defines the
166
196
  full zudo-doc token contract can keep its own theme.
167
197
 
198
+ Those zudo-doc namespace and import-order rules still apply to the host's own `@theme`
199
+ colors: place
200
+ `@takazudo/zudo-doc/theme.css` before the host component token stylesheet, or use
201
+ `@takazudo/zudo-doc/theme-no-reset.css` when preserving consumer-only tokens declared
202
+ earlier is intentional. The order-proof `--sg-*` hook does not remove this requirement
203
+ for host-owned `--color-*` tokens.
204
+
168
205
  Keep utilities and engine styles unlayered. The `zd-flow` layer must beat
169
206
  preflight's margin reset while allowing utility margins to win, and catalog
170
207
  chrome overrides must compete with utilities. The zdtp dashboard stylesheet
@@ -27,7 +27,7 @@ function CodePanel({
27
27
  return /* @__PURE__ */ jsxs("div", { class: "flex h-full flex-col gap-vsp-md p-hsp-md", children: [
28
28
  /* @__PURE__ */ jsxs("div", { children: [
29
29
  /* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between gap-hsp-sm", children: [
30
- /* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-muted", children: "Source" }),
30
+ /* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-[color:var(--sg-muted)]", children: "Source" }),
31
31
  active && /* @__PURE__ */ jsx(CopyButton, { text: active.source, label: "Copy source" })
32
32
  ] }),
33
33
  variants.length > 1 && /* @__PURE__ */ jsx("div", { role: "tablist", class: "mt-vsp-2xs flex flex-wrap gap-hsp-3xs", children: variants.map((v) => /* @__PURE__ */ jsx(
@@ -37,7 +37,7 @@ function CodePanel({
37
37
  role: "tab",
38
38
  "aria-selected": v.exportName === activeVariant,
39
39
  onClick: () => setActiveVariant(v.exportName),
40
- class: "px-hsp-xs py-vsp-3xs text-xs rounded-sm border transition-colors " + (v.exportName === activeVariant ? "border-accent bg-accent text-on-accent" : "border-border text-muted hover:text-fg"),
40
+ class: "px-hsp-xs py-vsp-3xs text-xs rounded-sm border transition-colors " + (v.exportName === activeVariant ? "border-[color:var(--sg-accent)] bg-[var(--sg-accent)] text-[color:var(--sg-on-accent)]" : "border-[color:var(--sg-border)] text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)]"),
41
41
  children: v.name
42
42
  },
43
43
  v.exportName
@@ -53,8 +53,8 @@ function CodePanel({
53
53
  ) })
54
54
  ] }),
55
55
  /* @__PURE__ */ jsxs("div", { class: "flex min-h-0 flex-1 flex-col", children: [
56
- /* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-muted", children: "Live CSS" }),
57
- /* @__PURE__ */ jsxs("p", { class: "mt-vsp-3xs text-xs text-muted", children: [
56
+ /* @__PURE__ */ jsx("h2", { class: "text-small font-semibold uppercase tracking-wide text-[color:var(--sg-muted)]", children: "Live CSS" }),
57
+ /* @__PURE__ */ jsxs("p", { class: "mt-vsp-3xs text-xs text-[color:var(--sg-muted)]", children: [
58
58
  "Injected into the previews above. ",
59
59
  storyTitle
60
60
  ] }),
@@ -30,7 +30,7 @@ function SourceEditor({
30
30
  };
31
31
  }, []);
32
32
  return /* @__PURE__ */ jsxs("div", { class: "relative text-small", children: [
33
- !loaded && /* @__PURE__ */ jsx("pre", { class: "m-0 overflow-auto rounded-md bg-surface-2 p-hsp-sm text-xs text-muted", children: /* @__PURE__ */ jsx("code", { children: value }) }),
33
+ !loaded && /* @__PURE__ */ jsx("pre", { class: "m-0 overflow-auto rounded-md bg-[var(--sg-surface-2)] p-hsp-sm text-xs text-[color:var(--sg-muted)]", children: /* @__PURE__ */ jsx("code", { children: value }) }),
34
34
  /* @__PURE__ */ jsx("div", { ref: containerRef, class: loaded ? "" : "hidden" })
35
35
  ] });
36
36
  }
@@ -16,13 +16,13 @@ const LAYOUT_OPTIONS = [
16
16
  { id: "stacked", label: "Stacked" },
17
17
  { id: "grid", label: "Grid" }
18
18
  ];
19
- const TRACK_CLASS = "flex flex-wrap items-center gap-hsp-2xs rounded-md border border-border bg-surface-2 p-hsp-2xs";
19
+ const TRACK_CLASS = "flex flex-wrap items-center gap-hsp-2xs rounded-md border border-[color:var(--sg-border)] bg-[var(--sg-surface-2)] p-hsp-2xs";
20
20
  const SEGMENT_BASE_CLASS = "rounded-sm border px-hsp-sm py-vsp-3xs text-caption leading-normal transition-colors cursor-pointer ";
21
- const SEGMENT_ON_CLASS = "border-border-strong bg-surface text-fg";
22
- const SEGMENT_OFF_CLASS = "border-transparent text-muted hover:text-fg";
21
+ const SEGMENT_ON_CLASS = "border-[color:var(--sg-border-strong)] bg-[var(--sg-surface)] text-[color:var(--sg-fg)]";
22
+ const SEGMENT_OFF_CLASS = "border-transparent text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)]";
23
23
  const PILL_BASE_CLASS = "inline-flex items-center gap-hsp-2xs rounded-md border px-hsp-sm py-vsp-3xs text-caption leading-normal transition-colors cursor-pointer ";
24
- const PILL_ON_CLASS = "border-border-strong bg-surface-2 text-fg";
25
- const PILL_OFF_CLASS = "border-border bg-surface text-muted hover:text-fg";
24
+ const PILL_ON_CLASS = "border-[color:var(--sg-border-strong)] bg-[var(--sg-surface-2)] text-[color:var(--sg-fg)]";
25
+ const PILL_OFF_CLASS = "border-[color:var(--sg-border)] bg-[var(--sg-surface)] text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)]";
26
26
  const STACKED_GRID_CLASS = "grid items-start gap-x-hsp-xl gap-y-vsp-xl grid-cols-1";
27
27
  const COLUMNS_GRID_CLASS = "grid items-start gap-x-hsp-xl gap-y-vsp-xl grid-cols-[repeat(auto-fit,minmax(min(18rem,100%),1fr))]";
28
28
  function segmentClass(selected) {
@@ -65,7 +65,7 @@ function PreviewApp({ registry }) {
65
65
  };
66
66
  }, []);
67
67
  if (!entry || !variantEntry) {
68
- return /* @__PURE__ */ jsxs("div", { class: "p-hsp-md text-muted text-small", children: [
68
+ return /* @__PURE__ */ jsxs("div", { class: "p-hsp-md text-[color:var(--sg-muted)] text-small", children: [
69
69
  "Unknown preview: slug=",
70
70
  /* @__PURE__ */ jsx("code", { children: slug }),
71
71
  " variant=",
@@ -118,15 +118,15 @@ function VariantFrame(props) {
118
118
  "*"
119
119
  );
120
120
  }
121
- return /* @__PURE__ */ jsxs("section", { class: "border border-border rounded-md overflow-hidden bg-surface", children: [
122
- /* @__PURE__ */ jsx("div", { class: "px-hsp-md py-vsp-2xs border-b border-border bg-surface-2", children: /* @__PURE__ */ jsx("span", { class: "text-caption leading-normal font-medium text-fg", children: name }) }),
121
+ return /* @__PURE__ */ jsxs("section", { class: "border border-[color:var(--sg-border)] rounded-md overflow-hidden bg-[var(--sg-surface)]", children: [
122
+ /* @__PURE__ */ jsx("div", { class: "px-hsp-md py-vsp-2xs border-b border-[color:var(--sg-border)] bg-[var(--sg-surface-2)]", children: /* @__PURE__ */ jsx("span", { class: "text-caption leading-normal font-medium text-[color:var(--sg-fg)]", children: name }) }),
123
123
  /* @__PURE__ */ jsx(
124
124
  "div",
125
125
  {
126
126
  role: "region",
127
127
  "aria-label": "Preview viewport canvas",
128
128
  tabIndex: 0,
129
- class: "flex overflow-x-auto bg-bg p-hsp-md focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-focus",
129
+ class: "flex overflow-x-auto bg-[var(--sg-bg)] p-hsp-md focus-visible:outline focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[color:var(--sg-focus)]",
130
130
  children: /* @__PURE__ */ jsx("div", { class: "mx-auto shrink-0", style: { width: viewportWidth(viewportId) }, children: /* @__PURE__ */ jsx(
131
131
  "iframe",
132
132
  {
@@ -148,7 +148,7 @@ function VariantFrame(props) {
148
148
  ) })
149
149
  }
150
150
  ),
151
- controls && controls.length > 0 && /* @__PURE__ */ jsx("div", { class: "border-t border-border px-hsp-md py-vsp-xs", children: /* @__PURE__ */ jsx(ControlsPanel, { controls, onChange: sendProps }) })
151
+ controls && controls.length > 0 && /* @__PURE__ */ jsx("div", { class: "border-t border-[color:var(--sg-border)] px-hsp-md py-vsp-xs", children: /* @__PURE__ */ jsx(ControlsPanel, { controls, onChange: sendProps }) })
152
152
  ] });
153
153
  }
154
154
  function seedState(controls) {
@@ -190,7 +190,7 @@ function ControlsPanel({
190
190
  type: "button",
191
191
  onClick: () => setOpen((o) => !o),
192
192
  "aria-expanded": open,
193
- class: "flex items-center gap-hsp-2xs text-caption leading-normal uppercase tracking-wide text-muted hover:text-fg cursor-pointer",
193
+ class: "flex items-center gap-hsp-2xs text-caption leading-normal uppercase tracking-wide text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)] cursor-pointer",
194
194
  children: [
195
195
  /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: open ? "\u25BC" : "\u25B6" }),
196
196
  "Controls"
@@ -202,17 +202,17 @@ function ControlsPanel({
202
202
  {
203
203
  type: "button",
204
204
  onClick: reset,
205
- class: "text-caption leading-normal rounded-sm border border-border px-hsp-xs py-vsp-3xs text-muted hover:text-fg transition-colors cursor-pointer",
205
+ class: "text-caption leading-normal rounded-sm border border-[color:var(--sg-border)] px-hsp-xs py-vsp-3xs text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)] transition-colors cursor-pointer",
206
206
  children: "Reset"
207
207
  }
208
208
  )
209
209
  ] }),
210
- open && /* @__PURE__ */ jsx("div", { class: "flex flex-wrap gap-hsp-md", children: controls.map((control) => /* @__PURE__ */ jsxs("label", { class: "flex items-center gap-hsp-2xs text-small text-fg", children: [
211
- /* @__PURE__ */ jsx("span", { class: "text-muted", children: control.label }),
210
+ open && /* @__PURE__ */ jsx("div", { class: "flex flex-wrap gap-hsp-md", children: controls.map((control) => /* @__PURE__ */ jsxs("label", { class: "flex items-center gap-hsp-2xs text-small text-[color:var(--sg-fg)]", children: [
211
+ /* @__PURE__ */ jsx("span", { class: "text-[color:var(--sg-muted)]", children: control.label }),
212
212
  control.type === "select" && /* @__PURE__ */ jsx(
213
213
  "select",
214
214
  {
215
- class: "border border-border rounded-sm bg-surface px-hsp-2xs py-vsp-3xs text-small",
215
+ class: "border border-[color:var(--sg-border)] rounded-sm bg-[var(--sg-surface)] px-hsp-2xs py-vsp-3xs text-small",
216
216
  value: values[control.prop],
217
217
  onChange: (e) => set(control.prop, e.target.value),
218
218
  children: control.options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }))
@@ -231,7 +231,7 @@ function ControlsPanel({
231
231
  {
232
232
  type: "text",
233
233
  value: values[control.prop],
234
- class: "border border-border rounded-sm bg-surface px-hsp-2xs py-vsp-3xs text-small",
234
+ class: "border border-[color:var(--sg-border)] rounded-sm bg-[var(--sg-surface)] px-hsp-2xs py-vsp-3xs text-small",
235
235
  onInput: (e) => set(control.prop, e.target.value)
236
236
  }
237
237
  ),
@@ -243,7 +243,7 @@ function ControlsPanel({
243
243
  min: control.min,
244
244
  max: control.max,
245
245
  step: control.step,
246
- class: "w-[5rem] border border-border rounded-sm bg-surface px-hsp-2xs py-vsp-3xs text-small",
246
+ class: "w-[5rem] border border-[color:var(--sg-border)] rounded-sm bg-[var(--sg-surface)] px-hsp-2xs py-vsp-3xs text-small",
247
247
  onInput: (e) => set(
248
248
  control.prop,
249
249
  coerceNumber(e.target.value, control)
@@ -264,14 +264,14 @@ function ControlsPanel({
264
264
  )
265
265
  }
266
266
  ),
267
- /* @__PURE__ */ jsx("span", { class: "text-muted tabular-nums w-[2.5rem] text-right", children: String(values[control.prop]) })
267
+ /* @__PURE__ */ jsx("span", { class: "text-[color:var(--sg-muted)] tabular-nums w-[2.5rem] text-right", children: String(values[control.prop]) })
268
268
  ] })),
269
269
  control.type === "color" && /* @__PURE__ */ jsx(
270
270
  "input",
271
271
  {
272
272
  type: "color",
273
273
  value: values[control.prop],
274
- class: "h-[1.5rem] w-[2.5rem] border border-border rounded-sm bg-surface",
274
+ class: "h-[1.5rem] w-[2.5rem] border border-[color:var(--sg-border)] rounded-sm bg-[var(--sg-surface)]",
275
275
  onInput: (e) => set(control.prop, e.target.value)
276
276
  }
277
277
  )
package/dist/safelist.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /* generated by gen-safelist.mjs — do not edit by hand */
2
- @source inline("-components [--check] [--nested] [--skip-barrel] [data-sg-card] [data-sg-catalog] [data-sg-empty] [data-sg-section] [data-sg-tile] [options] [slug] [zudo-sg] a accent accent-0 accent-1 accent-2 accent-3 accent/state across add adjusted after alias allow-forms allow-same-origin allow-scripts alphabetical alphabetically already always among an and any anything appear application/json apply-css-vars are aria-activedescendant aria-controls aria-describedby aria-details aria-expanded aria-hidden aria-label aria-labelledby aria-live aria-orientation aria-owns aria-pressed aria-selected array as aside assumes at authored back bar barrel barrel-export base be because before below beneath bg bg-accent bg-bg bg-surface bg-surface-2 block body bogus boolean border border-accent border-b border-border border-border-strong border-t border-transparent both build builds but button by cache-control cannot canvas carries cascading catalog categories category caution change changing checkbox children circle clamp classes clear-css-vars clickable client code codegen collapsing collection color colors command commit compact compare compile compiled component components components2026 config configured confirm const contain content-type copy count counts css cursor-pointer custom-property cx danger dark dashboard dashboards data-category data-copied data-keywords data-name data-sg-card data-sg-catalog data-sg-catalog-intro data-sg-code-panel-hidden data-sg-code-panel-resizer data-sg-empty data-sg-injected-css data-sg-preview-css data-sg-preview-doc data-sg-preview-loading data-sg-preview-scope data-sg-section data-sg-stage-grid data-sg-tile data-sg-tile-size data-sg-variant-root data-theme data-zudo-sg-tokens-empty date declaration declarations declared default defaults demo derive derived describe description descriptors design design-token desktop detail dev different differs digit directories directory disabled discovered display div do doc doc-chrome drift driven dual-scheme each edit editing edits either el element else empty en endpoint engine entry entrypoint equivalent every exists expected export exported exports exposes expressions failed fails family fg file files filled find first first-authored fixed flag flex flex-1 flex-col flex-wrap focus-visible:-outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-focus focus-visible:outline-offset-2 follow follows font font-bold font-family font-medium font-semibold font-size font-size-lh font-weight for form found frame frames free-form from frost full function g gap-hsp-2xs gap-hsp-3xs gap-hsp-md gap-hsp-sm gap-hsp-xs gap-vsp-2xs gap-vsp-lg gap-vsp-md gap-x-hsp-xl gap-y-vsp-xl gate gen-registry gen-token-manifest gen:sg-registry generated give glob-relative grid grid-cols-1 grid-cols-[repeat(auto-fit,minmax(min(18rem,100%),1fr))] group guards h-[1.5rem] h-full h1 h2 h3 hand handle hands has have head header headers height here hex hidden hold host hover:text-fg hsp html human-friendly identifier identifiers if iframe iframes import important in include including inert info init inject inline-block inline-flex input inserting inserts inside installed instead interface into intro inventory is isolated it items-center items-start its itself justify-between kebab-case keeps key key-enumeration keyboard keydown keyed known label large layout lazy leading leading-normal left length lh light like line line-beauty-accent line-beauty-accent-dark line-beauty-hover line-beauty-hover-dark line-height line-laser-accent line-laser-accent-dark line-laser-hover line-laser-hover-dark line-meeting-accent line-meeting-accent-dark line-meeting-hover line-meeting-hover-dark line-process-accent line-process-accent-dark line-process-hover line-process-hover-dark line-vacuum-accent line-vacuum-accent-dark line-vacuum-hover line-vacuum-hover-dark link lint:tokens list listed lists live load loading m-0 m21 makes manifest marker markers match matching material max-w-[56rem] may mb-vsp-2xs mb-vsp-lg mb-vsp-sm mb-vsp-xl message meta metadata min-h-0 mirroring missing mobile mode mode-dependent mode-independent model module ms-auto mt-vsp-2xs mt-vsp-3xs mt-vsp-xl mt-vsp-xs must mx-auto name name/value named named-export namespace navigation needs neutral-0 neutral-1 neutral-2 neutral-3 never new new-component new:component no no-store node:crypto node:fs node:fs/promises node:module node:path node:url noindex non-empty none not note nowhere number object of off oklch on once one one-sentence only option options opts or order other out outline-none overflow-auto overflow-hidden overflow-x-auto overriding p p-hsp-2xs p-hsp-md p-hsp-sm pages pairs palette palette- panel panels parse parsed parser pass passes path per-element per-variant pick pill placeholders plain plugin plugins pnpm polite polyline postcss pre preact-render-to-string preact/hooks preact/jsx-runtime presentation preview previews primary property pt-vsp-xl pushes px px-hsp-2xs px-hsp-md px-hsp-sm px-hsp-xs py-vsp-2xs py-vsp-3xs py-vsp-xs radius rail ramp ramps range raw re-executed re-run read-only readonly ready real recover rect reference references regenerated region registration relative rem rem-aware rem-based rename renamed/removed render rendered renders replace required requires resolve resolved return returns rhythm robots root-absolute round rounded rounded-full rounded-md rounded-sm route router routes routes-src rows run runtime s same saved scaffold scaffolds screen scrim script search secondary section segment segments select semantic separator settings sg-catalog-tile-size sg-chip sg-chip-row sg-code-panel sg-code-panel-hidden sg-code-panel-resizer sg-code-panel-width sg-copy-btn sg-filter sg-filter-row sg-gallery-section sg-grid sg-injected- sg-preview-design-token-panel-modal sg-preview-design-tokens sg-preview-design-tokens/v1 sg-preview-tweak sg-registry sg-search-clear sg-search-field sg-search-input sg-seg sg-seg-btn sg-thumb sg-thumb-inner sg-thumb-note sg-tile sg-tile-count sg-tile-desc sg-tile-meta sg-tile-title sg-workbench-toolbar sg:height sg:ready sgt- shadow shape shared show shown shrink-0 sidebar sidebar- single-axis site size skipped skips slug so solid sorts source spacing span spec specimen stacked starting state state-danger state-danger-dark state-info state-info-dark state-success state-success-dark state-warning state-warning-dark stay step still story string strings stroke-linecap stroke-linejoin stroke-width style stylesheet supported surface surfaces svg swaps swatch tab tablet tablist tabs tabular-nums text text-2xl text-accent text-caption text-fg text-heading text-muted text-on-accent text-right text-sm text-small text-xl text-xs text/icons textarea that the their them theme then these this three-tier tier tile time tip title to toggle toggle-design-token-panel toggle-preview-token-panel token tokens total tracking-wide transition-colors true tsx tweaks twice two type typechecks ui- ui-color ui-defaults-dark ui-defaults-light ui-defaults-shared undefined under underline underline-offset-2 unknown unwired up uppercase us use used uses utf-8 utf8 valid value values var variant variants vertical via viewport views virtual:zudo-doc-chrome-bindings virtual:zudo-doc-route-context virtual:zudo-sg-context virtual:zudo-sg-preview-token-panel virtual:zudo-sg-registry virtual:zudo-sg-tokens visible visit vs vsp w-[2.5rem] w-[5rem] warning was weight were what when which while whole whose will window with without would written yield you your zd-content zdtp-preview-prehydrate zfb zudo-doc zudo-doc-sidebar-width zudo-sg zudo-sg-token-tweak-bridge");
2
+ @source inline("-components [--check] [--nested] [--skip-barrel] [data-sg-card] [data-sg-catalog] [data-sg-empty] [data-sg-section] [data-sg-tile] [options] [slug] [zudo-sg] a accent accent-0 accent-1 accent-2 accent-3 accent/state across add adjusted after alias allow-forms allow-same-origin allow-scripts alphabetical alphabetically already always among an and any anything appear application/json apply-css-vars are aria-activedescendant aria-controls aria-describedby aria-details aria-expanded aria-hidden aria-label aria-labelledby aria-live aria-orientation aria-owns aria-pressed aria-selected array as aside assumes at authored back bar barrel barrel-export base be because before below beneath bg bg-[var(--sg-accent)] bg-[var(--sg-bg)] bg-[var(--sg-surface)] bg-[var(--sg-surface-2)] bg-bg block body bogus boolean border border-[color:var(--sg-accent)] border-[color:var(--sg-border)] border-[color:var(--sg-border-strong)] border-b border-t border-transparent both build builds but button by cache-control cannot canvas carries cascading catalog categories category caution change changing checkbox children circle clamp classes clear-css-vars clickable client code codegen collapsing collection color colors command commit compact compare compile compiled component components components2026 config configured confirm const contain content-type copy count counts css cursor-pointer custom-property cx danger dark dashboard dashboards data-category data-copied data-keywords data-name data-sg-card data-sg-catalog data-sg-catalog-intro data-sg-code-panel-hidden data-sg-code-panel-resizer data-sg-empty data-sg-injected-css data-sg-preview-css data-sg-preview-doc data-sg-preview-loading data-sg-preview-scope data-sg-section data-sg-stage-grid data-sg-tile data-sg-tile-size data-sg-variant-root data-theme data-zudo-sg-tokens-empty date declaration declarations declared default defaults demo derive derived describe description descriptors design design-token desktop detail dev different differs digit directories directory disabled discovered display div do doc doc-chrome drift driven dual-scheme each edit editing edits either el element else empty en endpoint engine entry entrypoint equivalent every exists expected export exported exports exposes expressions failed fails family fg file files filled find first first-authored fixed flag flex flex-1 flex-col flex-wrap focus-visible:-outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[color:var(--sg-focus)] focus-visible:outline-offset-2 follow follows font font-bold font-family font-medium font-semibold font-size font-size-lh font-weight for form found frame frames free-form from frost full function g gap-hsp-2xs gap-hsp-3xs gap-hsp-md gap-hsp-sm gap-hsp-xs gap-vsp-2xs gap-vsp-lg gap-vsp-md gap-x-hsp-xl gap-y-vsp-xl gate gen-registry gen-token-manifest gen:sg-registry generated give glob-relative grid grid-cols-1 grid-cols-[repeat(auto-fit,minmax(min(18rem,100%),1fr))] group guards h-[1.5rem] h-full h1 h2 h3 hand handle hands has have head header headers height here hex hidden hold host hover:text-[color:var(--sg-fg)] hsp html human-friendly identifier identifiers if iframe iframes import important in include including inert info init inject inline-block inline-flex input inserting inserts inside installed instead interface into intro inventory is isolated it items-center items-start its itself justify-between kebab-case keeps key key-enumeration keyboard keydown keyed known label large layout lazy leading leading-normal left length lh light like line line-beauty-accent line-beauty-accent-dark line-beauty-hover line-beauty-hover-dark line-height line-laser-accent line-laser-accent-dark line-laser-hover line-laser-hover-dark line-meeting-accent line-meeting-accent-dark line-meeting-hover line-meeting-hover-dark line-process-accent line-process-accent-dark line-process-hover line-process-hover-dark line-vacuum-accent line-vacuum-accent-dark line-vacuum-hover line-vacuum-hover-dark link lint:tokens list listed lists live load loading m-0 m21 makes manifest marker markers match matching material max-w-[56rem] may mb-vsp-2xs mb-vsp-lg mb-vsp-sm mb-vsp-xl message meta metadata min-h-0 mirroring missing mobile mode mode-dependent mode-independent model module ms-auto mt-vsp-2xs mt-vsp-3xs mt-vsp-xl mt-vsp-xs must mx-auto name name/value named named-export namespace navigation needs neutral-0 neutral-1 neutral-2 neutral-3 never new new-component new:component no no-store node:crypto node:fs node:fs/promises node:module node:path node:url noindex non-empty none not note nowhere number object of off oklch on once one one-sentence only option options opts or order other out outline-none overflow-auto overflow-hidden overflow-x-auto overriding p p-hsp-2xs p-hsp-md p-hsp-sm pages pairs palette palette- panel panels parse parsed parser pass passes path per-element per-variant pick pill placeholders plain plugin plugins pnpm polite polyline postcss pre preact-render-to-string preact/hooks preact/jsx-runtime presentation preview previews primary property pt-vsp-xl pushes px px-hsp-2xs px-hsp-md px-hsp-sm px-hsp-xs py-vsp-2xs py-vsp-3xs py-vsp-xs radius rail ramp ramps range raw re-executed re-run read-only readonly ready real recover rect reference references regenerated region registration relative rem rem-aware rem-based rename renamed/removed render rendered renders replace required requires resolve resolved return returns rhythm robots root-absolute round rounded rounded-full rounded-md rounded-sm route router routes routes-src rows run runtime s same saved scaffold scaffolds screen scrim script search secondary section segment segments select semantic separator settings sg-catalog-tile-size sg-chip sg-chip-row sg-code-panel sg-code-panel-hidden sg-code-panel-resizer sg-code-panel-width sg-copy-btn sg-filter sg-filter-row sg-gallery-section sg-grid sg-injected- sg-preview-design-token-panel-modal sg-preview-design-tokens sg-preview-design-tokens/v1 sg-preview-tweak sg-registry sg-search-clear sg-search-field sg-search-input sg-seg sg-seg-btn sg-thumb sg-thumb-inner sg-thumb-note sg-tile sg-tile-count sg-tile-desc sg-tile-meta sg-tile-title sg-workbench-toolbar sg:height sg:ready sgt- shadow shape shared show shown shrink-0 sidebar sidebar- single-axis site size skipped skips slug so solid sorts source spacing span spec specimen stacked starting state state-danger state-danger-dark state-info state-info-dark state-success state-success-dark state-warning state-warning-dark stay step still story string strings stroke-linecap stroke-linejoin stroke-width style stylesheet supported surface surfaces svg swaps swatch tab tablet tablist tabs tabular-nums text text-2xl text-[color:var(--sg-accent)] text-[color:var(--sg-fg)] text-[color:var(--sg-muted)] text-[color:var(--sg-on-accent)] text-caption text-fg text-heading text-right text-sm text-small text-xl text-xs text/icons textarea that the their them theme then these this three-tier tier tile time tip title to toggle toggle-design-token-panel toggle-preview-token-panel token tokens total tracking-wide transition-colors true tsx tweaks twice two type typechecks ui- ui-color ui-defaults-dark ui-defaults-light ui-defaults-shared undefined under underline underline-offset-2 unknown unwired up uppercase us use used uses utf-8 utf8 valid value values var variant variants vertical via viewport views virtual:zudo-doc-chrome-bindings virtual:zudo-doc-route-context virtual:zudo-sg-context virtual:zudo-sg-preview-token-panel virtual:zudo-sg-registry virtual:zudo-sg-tokens visible visit vs vsp w-[2.5rem] w-[5rem] warning was weight were what when which while whole whose will window with without would written yield you your zd-content zdtp-preview-prehydrate zfb zudo-doc zudo-doc-sidebar-width zudo-sg zudo-sg-token-tweak-bridge");
@@ -90,7 +90,7 @@ function CatalogFilter({
90
90
  "stroke-linecap": "round",
91
91
  "stroke-linejoin": "round",
92
92
  "aria-hidden": "true",
93
- class: "text-muted",
93
+ class: "text-[color:var(--sg-muted)]",
94
94
  children: [
95
95
  /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
96
96
  /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
@@ -128,7 +128,7 @@ function CatalogFilter({
128
128
  }
129
129
  )
130
130
  ] }),
131
- /* @__PURE__ */ jsx("span", { class: "text-xs text-muted", "aria-live": "polite", children: summary }),
131
+ /* @__PURE__ */ jsx("span", { class: "text-xs text-[color:var(--sg-muted)]", "aria-live": "polite", children: summary }),
132
132
  /* @__PURE__ */ jsx("div", { class: "sg-seg", role: "group", "aria-label": "Tile size", children: TILE_SIZES.map((option) => /* @__PURE__ */ jsx(
133
133
  "button",
134
134
  {
@@ -5,8 +5,8 @@ function createTokenDashboards(manifest, tabs, options = {}) {
5
5
  const dashboardPreviewOverrides = buildDashboardPreviewOverrides(manifest);
6
6
  return /* @__PURE__ */ jsxs("section", { class: "mb-vsp-xl flex flex-col gap-vsp-lg", style: options.chromeStyle, children: [
7
7
  /* @__PURE__ */ jsxs("div", { class: "max-w-[56rem]", children: [
8
- /* @__PURE__ */ jsx("h2", { class: "mb-vsp-2xs text-xl font-semibold text-fg", children: "Declared defaults" }),
9
- /* @__PURE__ */ jsxs("p", { class: "text-muted", children: [
8
+ /* @__PURE__ */ jsx("h2", { class: "mb-vsp-2xs text-xl font-semibold text-[color:var(--sg-fg)]", children: "Declared defaults" }),
9
+ /* @__PURE__ */ jsxs("p", { class: "text-[color:var(--sg-muted)]", children: [
10
10
  "These are the declared defaults of the design-token manifest, shown as light, dark, and shared token references. The light and dark frames show only tokens whose declared value differs by mode (",
11
11
  /* @__PURE__ */ jsx("code", { children: "light-dark()" }),
12
12
  " pairs and rows that reference them); the shared frame lists every other token once and follows the site theme. Samples are isolated from the live panels and anything saved in them. Nothing here is clickable or editable."
@@ -5,7 +5,7 @@ function PreviewTokensButton() {
5
5
  "button",
6
6
  {
7
7
  type: "button",
8
- class: "inline-flex items-center gap-hsp-2xs px-hsp-xs py-vsp-3xs border border-border rounded text-small text-muted hover:text-fg transition-colors cursor-pointer",
8
+ class: "inline-flex items-center gap-hsp-2xs px-hsp-xs py-vsp-3xs border border-[color:var(--sg-border)] rounded text-small text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)] transition-colors cursor-pointer",
9
9
  onClick: () => window.dispatchEvent(new CustomEvent("toggle-preview-token-panel")),
10
10
  children: "Preview tokens \u2192"
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zudo-sg",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "zudo-sg styleguide engine — story registry, catalog routes and preview machinery for zfb + zudo-doc hosts.",
6
6
  "license": "MIT",
@@ -163,10 +163,11 @@
163
163
  "typecheck": "tsc --noEmit",
164
164
  "test": "vitest run --config vitest.config.ts",
165
165
  "check:no-host-alias": "node scripts/check-no-host-alias.mjs",
166
+ "check:chrome-tokens": "node scripts/check-chrome-tokens.mjs",
166
167
  "check:package-shape": "node scripts/check-package-shape.mjs",
167
168
  "check:routes-src": "node scripts/check-routes-src.mjs",
168
169
  "check:virtual-modules": "node scripts/check-virtual-modules.mjs",
169
170
  "check:package-safelist": "node scripts/check-package-safelist.mjs",
170
- "check": "pnpm run check:no-host-alias && pnpm run typecheck && pnpm run build && pnpm run check:package-shape && pnpm run check:routes-src && pnpm run check:virtual-modules && pnpm run check:package-safelist && pnpm run test"
171
+ "check": "pnpm run check:no-host-alias && pnpm run check:chrome-tokens && pnpm run typecheck && pnpm run build && pnpm run check:package-shape && pnpm run check:routes-src && pnpm run check:virtual-modules && pnpm run check:package-safelist && pnpm run test"
171
172
  }
172
173
  }
@@ -43,7 +43,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
43
43
  >
44
44
  <header class="mb-vsp-lg max-w-[56rem]">
45
45
  <h1 class="text-heading font-bold mb-vsp-2xs">{ctx.catalog.title}</h1>
46
- <p class="text-muted text-small" data-sg-catalog-intro>
46
+ <p class="text-[color:var(--sg-muted)] text-small" data-sg-catalog-intro>
47
47
  {ctx.catalog.intro ?? (
48
48
  <>
49
49
  {total} components{ctx.uiPackageName ? <> from <code>{ctx.uiPackageName}</code></> : null},
@@ -86,7 +86,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
86
86
  </div>
87
87
  </section>
88
88
  ))}
89
- <p class="text-muted text-small" data-sg-empty hidden>
89
+ <p class="text-[color:var(--sg-muted)] text-small" data-sg-empty hidden>
90
90
  No components match your search.
91
91
  </p>
92
92
  </div>
@@ -49,6 +49,7 @@ export default function ComponentsPreviewRoute(): JSX.Element {
49
49
  <link rel="stylesheet" href={withBase(ctx.previewCssUrl)} data-sg-preview-css />
50
50
  <script dangerouslySetInnerHTML={{ __html: LIVERELOAD_STUB }} />
51
51
  </head>
52
+ {/* The preview canvas follows host preview tokens, not engine chrome tokens. */}
52
53
  <body class="bg-bg">{app}</body>
53
54
  </html>
54
55
  );
@@ -57,7 +57,7 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
57
57
  if (!entry) {
58
58
  return (
59
59
  <StyleguideLayout {...chrome} activeSlug={slug} codePanel={null}>
60
- <p class="text-muted">Story not found: {slug}</p>
60
+ <p class="text-[color:var(--sg-muted)]">Story not found: {slug}</p>
61
61
  </StyleguideLayout>
62
62
  );
63
63
  }
@@ -111,19 +111,19 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
111
111
  <StyleguideLayout {...chrome} activeSlug={slug} codePanel={codePanel} contentWide>
112
112
  <div>
113
113
  <header class="mb-vsp-lg max-w-[56rem]">
114
- <h1 class="text-2xl font-bold text-fg">{entry.meta.title}</h1>
115
- <p class="mt-vsp-xs text-muted">{entry.meta.description}</p>
116
- <span class="mt-vsp-xs inline-block rounded-full border border-border px-hsp-sm py-vsp-3xs text-caption leading-normal text-muted">
114
+ <h1 class="text-2xl font-bold text-[color:var(--sg-fg)]">{entry.meta.title}</h1>
115
+ <p class="mt-vsp-xs text-[color:var(--sg-muted)]">{entry.meta.description}</p>
116
+ <span class="mt-vsp-xs inline-block rounded-full border border-[color:var(--sg-border)] px-hsp-sm py-vsp-3xs text-caption leading-normal text-[color:var(--sg-muted)]">
117
117
  {entry.meta.category}
118
118
  </span>
119
119
  </header>
120
120
 
121
121
  {entry.meta.previewRoute && (
122
- <section class="mb-vsp-xl max-w-[56rem] rounded-md border border-border bg-surface-2 p-hsp-md">
123
- <h2 class="mb-vsp-2xs text-small font-semibold uppercase tracking-wide text-muted">Live demo</h2>
122
+ <section class="mb-vsp-xl max-w-[56rem] rounded-md border border-[color:var(--sg-border)] bg-[var(--sg-surface-2)] p-hsp-md">
123
+ <h2 class="mb-vsp-2xs text-small font-semibold uppercase tracking-wide text-[color:var(--sg-muted)]">Live demo</h2>
124
124
  <a
125
125
  href={withBase(entry.meta.previewRoute)}
126
- class="text-sm font-medium text-accent underline underline-offset-2"
126
+ class="text-sm font-medium text-[color:var(--sg-accent)] underline underline-offset-2"
127
127
  >
128
128
  Open live demo →
129
129
  </a>
@@ -133,7 +133,7 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
133
133
  {workbench}
134
134
 
135
135
  {doc && (
136
- <section class="mt-vsp-xl border-t border-border pt-vsp-xl">
136
+ <section class="mt-vsp-xl border-t border-[color:var(--sg-border)] pt-vsp-xl">
137
137
  <div class="zd-content max-w-[56rem]">
138
138
  <doc.Content components={componentDocMdxComponents} />
139
139
  </div>
@@ -53,7 +53,7 @@ export default function TokensRoute(): JSX.Element {
53
53
  <div>
54
54
  <header class="mb-vsp-lg max-w-[56rem]">
55
55
  <h1 class="text-heading font-bold mb-vsp-2xs">Design tokens</h1>
56
- <p class="mt-vsp-xs mb-vsp-sm text-muted">
56
+ <p class="mt-vsp-xs mb-vsp-sm text-[color:var(--sg-muted)]">
57
57
  Declared defaults{ctx.uiPackageName ? <> for <code>{ctx.uiPackageName}</code></> : null}, shown as
58
58
  light, dark, and shared token references. Open Preview tokens to edit the component previews; these
59
59
  reference dashboards stay unchanged.
@@ -65,7 +65,7 @@ export default function TokensRoute(): JSX.Element {
65
65
  chromeStyle: buildDashboardChromeStyle(),
66
66
  })
67
67
  : (
68
- <p class="text-muted" data-zudo-sg-tokens-empty>
68
+ <p class="text-[color:var(--sg-muted)]" data-zudo-sg-tokens-empty>
69
69
  No design-token manifest is configured. Add <code>tokens</code> to <code>zudo-sg.config.mjs</code> and
70
70
  run <code>zudo-sg gen-token-manifest</code> to render the dashboards here.
71
71
  </p>
package/styles.css CHANGED
@@ -6,18 +6,14 @@
6
6
  * package-root `files` entry and exported as `@takazudo/zudo-sg/styles.css`
7
7
  * (a host imports the package specifier, never this relative path).
8
8
  *
9
- * CONSUMER IMPORT ORDER (locked by the ADR, decision 10 "Consumer CSS
10
- * order"): a host imports, in this order —
11
- * 1. @takazudo/zudo-doc/features.css
12
- * 2. @takazudo/zudo-sg/styles.css (this file)
13
- * 3. @takazudo/zudo-sg/safelist.css (generated `@source inline(...)`
14
- * from `dist/**\/*.js`, covers the
15
- * Tailwind utility classes this file
16
- * and the package's `.tsx` sources
17
- * reference — e.g. `bg-accent`,
18
- * `px-hsp-md` — for hosts that fall
19
- * back to explicit @source scanning)
20
- * 4. the host's own project `@theme {}` block
9
+ * CONSUMER CSS (ADR decisions 10 and 14): keep this stylesheet unlayered
10
+ * alongside Tailwind utilities, after zudo-doc's feature styles. Also import
11
+ * @takazudo/zudo-sg/safelist.css (generated `@source inline(...)` from
12
+ * `dist/**\/*.js`) for the engine's utility classes, e.g.
13
+ * `bg-[var(--sg-accent)]`, `px-hsp-md`.
14
+ * Chrome colors use raw --sg-* defaults and do not depend on the order of
15
+ * zudo-doc/theme.css or the host's color tokens. The host's OWN @theme color
16
+ * tokens still need to follow zudo-doc's color reset.
21
17
  * The host keeps its OWN `@source` directives for its own component package
22
18
  * (e.g. `@source "../../packages/demo-ui/src/**"`) — the engine's safelist only
23
19
  * covers the engine package's compiled output, never consumer code.
@@ -33,6 +29,39 @@
33
29
  * move.
34
30
  * ========================================================================== */
35
31
 
32
+ /* #797: plain properties survive the framework color reset; zero specificity
33
+ * lets an unlayered host :root override win in either import order. */
34
+ :where(:root) {
35
+ --sg-bg: var(--zd-bg, light-dark(oklch(.965 .004 65), oklch(.185 .005 65)));
36
+ --sg-fg: var(--zd-fg, light-dark(oklch(.185 .005 65), oklch(.965 .004 65)));
37
+ --sg-surface: var(--zd-surface, light-dark(oklch(.965 .004 65), oklch(.185 .005 65)));
38
+ --sg-surface-2: light-dark(
39
+ color-mix(in oklch, var(--zd-fg, oklch(.185 .005 65)) 10%, var(--zd-surface, oklch(.965 .004 65))),
40
+ color-mix(in oklch, var(--zd-fg, oklch(.965 .004 65)) 29%, var(--zd-surface, oklch(.185 .005 65)))
41
+ );
42
+ /* Ratios retain the root host's .855/.480 and .720/.705 border ladder. */
43
+ --sg-border: light-dark(
44
+ color-mix(in oklch, var(--zd-fg, oklch(.185 .005 65)) 14%, var(--zd-bg, oklch(.965 .004 65))),
45
+ color-mix(in oklch, var(--zd-fg, oklch(.965 .004 65)) 38%, var(--zd-bg, oklch(.185 .005 65)))
46
+ );
47
+ --sg-border-strong: light-dark(
48
+ color-mix(in oklch, var(--zd-fg, oklch(.185 .005 65)) 31.5%, var(--zd-bg, oklch(.965 .004 65))),
49
+ color-mix(in oklch, var(--zd-fg, oklch(.965 .004 65)) 66.7%, var(--zd-bg, oklch(.185 .005 65)))
50
+ );
51
+ --sg-muted: var(--zd-muted, light-dark(oklch(.480 .008 65), oklch(.705 .008 65)));
52
+ --sg-accent: var(--zd-accent, light-dark(oklch(.470 .120 56), oklch(.700 .158 62)));
53
+ --sg-on-accent: light-dark(
54
+ color-mix(in oklch, var(--zd-bg, oklch(.965 .004 65)) 99%, var(--zd-fg, oklch(.185 .005 65))),
55
+ color-mix(in oklch, var(--zd-bg, oklch(.185 .005 65)) 94%, var(--zd-fg, oklch(.965 .004 65)))
56
+ );
57
+ --sg-focus: color-mix(
58
+ in oklch,
59
+ var(--zd-accent, light-dark(oklch(.470 .120 56), oklch(.700 .158 62))) 95%,
60
+ var(--zd-fg, light-dark(oklch(.185 .005 65), oklch(.965 .004 65)))
61
+ );
62
+ --sg-success: var(--zd-success, light-dark(oklch(.470 .140 145), oklch(.680 .145 145)));
63
+ }
64
+
36
65
  :root {
37
66
  /* Header height — referenced by the native header and the code panel's sticky
38
67
  * offset. Matches DocLayout's fixed header offset (`top-[3.5rem]`).
@@ -57,8 +86,8 @@
57
86
  * render (the element carries no native border utility) — a 1px border-ladder
58
87
  * divider + hsp-lg left padding + vsp-md block margin match the reference's
59
88
  * right code-area frame (issue #60). Below the side-by-side breakpoint this
60
- * swaps for a top divider (see the max-width:1279px block). --color-border,
61
- * not --color-muted (a TEXT token), keeps structural dividers separate from
89
+ * swaps for a top divider (see the max-width:1279px block). --sg-border,
90
+ * not --sg-muted (a TEXT token), keeps structural dividers separate from
62
91
  * text roles. */
63
92
  #sg-code-panel {
64
93
  position: relative;
@@ -67,7 +96,7 @@
67
96
  align-self: stretch;
68
97
  margin-block: var(--spacing-vsp-md);
69
98
  padding-left: var(--spacing-hsp-lg);
70
- border-left: 1px solid var(--color-border);
99
+ border-left: 1px solid var(--sg-border);
71
100
  }
72
101
 
73
102
  /* Side-by-side only from 1280px (#541, raised from 1024): between the two the
@@ -102,10 +131,10 @@
102
131
  background: transparent;
103
132
  }
104
133
  #sg-code-panel [data-sg-code-panel-resizer]:hover {
105
- background: color-mix(in oklch, var(--color-border-strong) 50%, transparent);
134
+ background: color-mix(in oklch, var(--sg-border-strong) 50%, transparent);
106
135
  }
107
136
  #sg-code-panel [data-sg-code-panel-resizer][data-sg-dragging] {
108
- background: color-mix(in oklch, var(--color-accent) 30%, transparent);
137
+ background: color-mix(in oklch, var(--sg-accent) 30%, transparent);
109
138
  }
110
139
 
111
140
  /* Visibility toggle for the code panel. */
@@ -133,7 +162,7 @@
133
162
  min-height: 24rem;
134
163
  margin-block-start: 0; /* cancel base margin-block so the border-top divider sits flush */
135
164
  border-left: 0;
136
- border-top: 1px solid var(--color-border);
165
+ border-top: 1px solid var(--sg-border);
137
166
  /* CodePanel keeps its own p-hsp-md breathing room; subtract that inner
138
167
  * inset so the visible SOURCE content aligns with <main>'s 24px edge. */
139
168
  padding-inline: calc(var(--spacing-hsp-xl) - var(--spacing-hsp-md));
@@ -157,10 +186,10 @@
157
186
  align-items: center;
158
187
  gap: var(--spacing-hsp-2xs);
159
188
  padding: var(--spacing-vsp-3xs) var(--spacing-hsp-xs);
160
- border: 1px solid var(--color-border);
189
+ border: 1px solid var(--sg-border);
161
190
  border-radius: var(--radius-sm);
162
- background: var(--color-surface);
163
- color: var(--color-muted);
191
+ background: var(--sg-surface);
192
+ color: var(--sg-muted);
164
193
  font-size: var(--text-micro);
165
194
  line-height: 1;
166
195
  cursor: pointer;
@@ -171,17 +200,17 @@
171
200
  }
172
201
  @media (hover: hover) {
173
202
  .sg-copy-btn:hover {
174
- color: var(--color-fg);
175
- border-color: var(--color-border);
203
+ color: var(--sg-fg);
204
+ border-color: var(--sg-border);
176
205
  }
177
206
  }
178
207
  .sg-copy-btn:focus-visible {
179
- outline: 2px solid var(--color-focus);
208
+ outline: 2px solid var(--sg-focus);
180
209
  outline-offset: 2px;
181
210
  }
182
211
  .sg-copy-btn[data-copied] {
183
- color: var(--color-success);
184
- border-color: var(--color-success);
212
+ color: var(--sg-success);
213
+ border-color: var(--sg-success);
185
214
  }
186
215
 
187
216
  /* --- Landing search + tag filter ------------------------------------------ */
@@ -204,25 +233,25 @@
204
233
  align-items: center;
205
234
  gap: var(--spacing-hsp-sm);
206
235
  padding: var(--spacing-vsp-xs) var(--spacing-hsp-md);
207
- border: 1px solid var(--color-border);
236
+ border: 1px solid var(--sg-border);
208
237
  border-radius: var(--radius-lg);
209
- background: var(--color-surface);
238
+ background: var(--sg-surface);
210
239
  transition: border-color 0.15s ease;
211
240
  }
212
241
  .sg-search-field:focus-within {
213
- border-color: var(--color-accent);
242
+ border-color: var(--sg-accent);
214
243
  }
215
244
  .sg-search-input {
216
245
  flex: 1;
217
246
  min-width: 0;
218
247
  border: 0;
219
248
  background: transparent;
220
- color: var(--color-fg);
249
+ color: var(--sg-fg);
221
250
  font-size: var(--text-small);
222
251
  outline: none;
223
252
  }
224
253
  .sg-search-input::placeholder {
225
- color: var(--color-muted);
254
+ color: var(--sg-muted);
226
255
  }
227
256
  .sg-search-input::-webkit-search-cancel-button {
228
257
  appearance: none;
@@ -235,14 +264,14 @@
235
264
  height: var(--spacing-icon-md);
236
265
  border: 0;
237
266
  border-radius: var(--radius-full);
238
- background: var(--color-surface-2);
239
- color: var(--color-muted);
267
+ background: var(--sg-surface-2);
268
+ color: var(--sg-muted);
240
269
  font-size: var(--text-small);
241
270
  line-height: 1;
242
271
  cursor: pointer;
243
272
  }
244
273
  .sg-search-clear:hover {
245
- color: var(--color-fg);
274
+ color: var(--sg-fg);
246
275
  }
247
276
 
248
277
  /* --- Chips (category filter + token copy-mode) ---------------------------- */
@@ -253,10 +282,10 @@
253
282
  }
254
283
  .sg-chip {
255
284
  padding: var(--spacing-vsp-3xs) var(--spacing-hsp-md);
256
- border: 1px solid var(--color-border);
285
+ border: 1px solid var(--sg-border);
257
286
  border-radius: var(--radius-full);
258
- background: var(--color-surface);
259
- color: var(--color-muted);
287
+ background: var(--sg-surface);
288
+ color: var(--sg-muted);
260
289
  font-size: var(--text-caption);
261
290
  cursor: pointer;
262
291
  transition:
@@ -266,18 +295,18 @@
266
295
  }
267
296
  @media (hover: hover) {
268
297
  .sg-chip:hover {
269
- border-color: var(--color-border);
270
- color: var(--color-fg);
298
+ border-color: var(--sg-border);
299
+ color: var(--sg-fg);
271
300
  }
272
301
  }
273
302
  .sg-chip:focus-visible {
274
- outline: 2px solid var(--color-focus);
303
+ outline: 2px solid var(--sg-focus);
275
304
  outline-offset: 2px;
276
305
  }
277
306
  .sg-chip[aria-pressed="true"] {
278
- background: var(--color-accent);
279
- border-color: var(--color-accent);
280
- color: var(--color-on-accent);
307
+ background: var(--sg-accent);
308
+ border-color: var(--sg-accent);
309
+ color: var(--sg-on-accent);
281
310
  }
282
311
 
283
312
  /* --- Detail-page workbench toolbar ---------------------------------------- */
@@ -291,10 +320,10 @@
291
320
  gap: var(--spacing-hsp-md);
292
321
  margin-bottom: var(--spacing-vsp-md);
293
322
  padding: var(--spacing-vsp-2xs) var(--spacing-hsp-md);
294
- border: 1px solid var(--color-border);
323
+ border: 1px solid var(--sg-border);
295
324
  border-radius: var(--radius-lg);
296
325
  /* Opaque — the stages scroll underneath it when it is pinned below. */
297
- background: var(--color-surface);
326
+ background: var(--sg-surface);
298
327
  }
299
328
 
300
329
  /* Pinned only in the side-by-side desktop layout, where the strip is one or two
@@ -406,20 +435,20 @@
406
435
  flex-direction: column;
407
436
  min-width: 0;
408
437
  overflow: hidden;
409
- border: 1px solid var(--color-border);
438
+ border: 1px solid var(--sg-border);
410
439
  border-radius: var(--radius-md);
411
- background: var(--color-surface);
440
+ background: var(--sg-surface);
412
441
  transition: border-color 0.15s ease;
413
442
  }
414
443
  /* Resting hover is neutral (accent budget): the border ladder steps up rather
415
444
  * than spending accent on a pointer state. */
416
445
  @media (hover: hover) {
417
446
  .sg-tile:has(> [data-sg-card]:hover) {
418
- border-color: var(--color-border-strong);
447
+ border-color: var(--sg-border-strong);
419
448
  }
420
449
  }
421
450
  .sg-tile:has(> [data-sg-card]:focus-visible) {
422
- border-color: var(--color-border-strong);
451
+ border-color: var(--sg-border-strong);
423
452
  }
424
453
 
425
454
  /* --- Thumbnail slot ------------------------------------------------------- */
@@ -428,8 +457,8 @@
428
457
  position: relative;
429
458
  aspect-ratio: 16 / 10;
430
459
  overflow: hidden;
431
- border-bottom: 1px solid var(--color-border);
432
- background: var(--color-bg);
460
+ border-bottom: 1px solid var(--sg-border);
461
+ background: var(--sg-bg);
433
462
  /* Decorative: the tile's anchor is the only interactive element. `inert` on
434
463
  * the element itself removes the rendered component from the tab order and
435
464
  * the accessibility tree; this is the pointer half of the same guarantee. */
@@ -474,7 +503,7 @@
474
503
  inset-inline: 0;
475
504
  bottom: 0;
476
505
  height: var(--spacing-vsp-md);
477
- background: linear-gradient(to top, var(--color-bg), transparent);
506
+ background: linear-gradient(to top, var(--sg-bg), transparent);
478
507
  }
479
508
 
480
509
  .sg-thumb-inner {
@@ -504,7 +533,7 @@
504
533
  align-items: center;
505
534
  justify-content: center;
506
535
  padding: var(--spacing-hsp-lg);
507
- color: var(--color-muted);
536
+ color: var(--sg-muted);
508
537
  font-size: var(--text-caption);
509
538
  text-align: center;
510
539
  text-wrap: balance;
@@ -523,11 +552,11 @@
523
552
  text-decoration: none;
524
553
  }
525
554
  .sg-tile-meta:focus-visible {
526
- outline: 2px solid var(--color-focus);
555
+ outline: 2px solid var(--sg-focus);
527
556
  outline-offset: calc(-2 * var(--spacing-px));
528
557
  }
529
558
  .sg-tile-title {
530
- color: var(--color-fg);
559
+ color: var(--sg-fg);
531
560
  font-size: var(--text-caption);
532
561
  font-weight: 600;
533
562
  }
@@ -542,13 +571,13 @@
542
571
  overflow: hidden;
543
572
  -webkit-box-orient: vertical;
544
573
  -webkit-line-clamp: 2;
545
- color: var(--color-muted);
574
+ color: var(--sg-muted);
546
575
  font-size: var(--text-caption);
547
576
  line-height: var(--leading-snug);
548
577
  }
549
578
  .sg-tile-count {
550
579
  margin-top: auto;
551
- color: var(--color-muted);
580
+ color: var(--sg-muted);
552
581
  /* True metadata (a count) — the one role --text-micro is for. */
553
582
  font-size: var(--text-micro);
554
583
  }
@@ -559,9 +588,9 @@
559
588
  display: inline-flex;
560
589
  gap: var(--spacing-hsp-2xs);
561
590
  padding: var(--spacing-hsp-2xs);
562
- border: 1px solid var(--color-border);
591
+ border: 1px solid var(--sg-border);
563
592
  border-radius: var(--radius-md);
564
- background: var(--color-surface);
593
+ background: var(--sg-surface);
565
594
  }
566
595
  .sg-seg-btn {
567
596
  position: relative;
@@ -569,7 +598,7 @@
569
598
  border: 0;
570
599
  border-radius: var(--radius-sm);
571
600
  background: transparent;
572
- color: var(--color-muted);
601
+ color: var(--sg-muted);
573
602
  font-size: var(--text-caption);
574
603
  cursor: pointer;
575
604
  transition:
@@ -578,11 +607,11 @@
578
607
  }
579
608
  @media (hover: hover) {
580
609
  .sg-seg-btn:hover {
581
- color: var(--color-fg);
610
+ color: var(--sg-fg);
582
611
  }
583
612
  }
584
613
  .sg-seg-btn:focus-visible {
585
- outline: 2px solid var(--color-focus);
614
+ outline: 2px solid var(--sg-focus);
586
615
  outline-offset: 2px;
587
616
  }
588
617
  /* Selected = NEUTRAL raised fill. The house accent budget is one filled-accent
@@ -590,9 +619,9 @@
590
619
  * category chip, so selection here is carried by the raised surface plus the
591
620
  * accent UNDERLINE marker below — never an accent background. */
592
621
  .sg-seg-btn[aria-pressed="true"] {
593
- background: var(--color-surface-2);
622
+ background: var(--sg-surface-2);
594
623
  box-shadow: var(--shadow-card);
595
- color: var(--color-fg);
624
+ color: var(--sg-fg);
596
625
  }
597
626
  .sg-seg-btn[aria-pressed="true"]::after {
598
627
  content: "";
@@ -601,7 +630,7 @@
601
630
  bottom: var(--spacing-hsp-2xs);
602
631
  height: calc(2 * var(--spacing-px));
603
632
  border-radius: var(--radius-full);
604
- background: var(--color-accent);
633
+ background: var(--sg-accent);
605
634
  }
606
635
 
607
636
  @media (prefers-reduced-motion: reduce) {