@takazudo/zudo-sg 0.3.0 → 0.3.1

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,28 @@ 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.1] - 2026-09-21
8
+
9
+ The preview token panel is now reachable from the doc header, not just from the
10
+ workbench button and the `/tokens` dashboard. The engine injects that trigger
11
+ itself, so adopting hosts get it without wiring anything.
12
+
13
+ ### Features
14
+
15
+ - `withZudoSg()` appends a preview-token-panel trigger to the doc header's right
16
+ side, revealed only on engine routes. Gated by the new `headerTokenTrigger`
17
+ option, which defaults to `true`.
18
+ - Export `HEADER_TOKEN_TRIGGER_ITEM` so a host that renders its own zudo-doc
19
+ header can list the trigger alongside its own items.
20
+ - Emit a `data-sg-engine-route` marker from `bodyEnd` on every chrome-rendered
21
+ engine route, and on the preview iframe document's own `html` tag, so client
22
+ code can detect "this page can use the preview token panel" after each
23
+ navigation.
24
+ - `ZdtpApplyProxyOptions` now accepts `tabsModule` on its own: `routingFile` and
25
+ `writeRoot` became optional together, so a host can wire the panel's tabs
26
+ without opting into the dev-only Apply endpoint. Supplying exactly one of the
27
+ pair still fails at both the type level and at runtime.
28
+
7
29
  ## [0.3.0] - 2026-09-21
8
30
 
9
31
  The catalog chrome no longer borrows a host's bare `--color-*` tokens. It now
@@ -49,13 +49,26 @@ export interface ZudoSgComposeOptions {
49
49
  * `@takazudo/zudo-sg/plugins/zdtp-apply-proxy` options
50
50
  * (`{ routingFile, writeRoot, tabsModule? }`). Omitted → the plugin is still
51
51
  * listed (the engine's preview token panel island imports its virtual
52
- * module) but runs disabled: no tabs, no Apply endpoint.
52
+ * module) but runs disabled: no tabs, no Apply endpoint. `routingFile` and
53
+ * `writeRoot` are optional TOGETHER — `{ tabsModule }` alone is valid (tabs
54
+ * without the dev-only Apply write sandbox); exactly one of the two is not.
53
55
  */
54
56
  zdtpApplyProxy?: {
55
57
  routingFile: string;
56
58
  writeRoot: string;
57
59
  tabsModule?: string;
60
+ } | {
61
+ routingFile?: undefined;
62
+ writeRoot?: undefined;
63
+ tabsModule?: string;
58
64
  };
65
+ /**
66
+ * Append the engine's header trigger for the preview token panel to the
67
+ * zudo-doc routes plugin's `headerRightItems`. Defaults to true. Unlike
68
+ * `chromeDefaults` this is unconditional: a host with its own `headerNav`
69
+ * still gets the trigger.
70
+ */
71
+ headerTokenTrigger?: boolean;
59
72
  /** Extra keys of `zudo-sg.config.mjs` (e.g. `barrelIndex`) are CLI-only and ignored here. */
60
73
  [key: string]: unknown;
61
74
  }
@@ -63,6 +76,22 @@ export interface ZudoSgFragment {
63
76
  plugins: ZudoSgPluginDescriptor[];
64
77
  collections: ZudoSgCollection[];
65
78
  }
79
+ /**
80
+ * The header-right item `withZudoSg()` appends to the zudo-doc routes plugin.
81
+ *
82
+ * Exported because a host that renders its OWN `<header>` (a host-owned
83
+ * `pages/index.tsx` calling `HeaderWithDefaults` with `settings.headerRightItems`)
84
+ * must add this item to those settings itself. zfb's client router PERSISTS the
85
+ * `<header>` node across a swap — the live header replaces the incoming one — so
86
+ * a session that starts on a trigger-less host page keeps that header for every
87
+ * subsequent SPA navigation, and the trigger never appears on the engine routes.
88
+ * `withZudoSg()` detects an item already carrying the button id and does not
89
+ * append a second one.
90
+ */
91
+ export declare const HEADER_TOKEN_TRIGGER_ITEM: {
92
+ type: "html";
93
+ html: string;
94
+ };
66
95
  /** Returns the engine's zfb plugin descriptors and content collections. */
67
96
  export declare function zudoSg(options: ZudoSgComposeOptions): ZudoSgFragment;
68
97
  /**
@@ -9,6 +9,7 @@ const ROUTES_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/routes";
9
9
  const PREVIEW_CSS_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/preview-css";
10
10
  const ZDTP_APPLY_PROXY_PLUGIN_NAME = "@takazudo/zudo-sg/plugins/zdtp-apply-proxy";
11
11
  const ZUDO_DOC_ROUTES_PLUGIN_NAME = "@takazudo/zudo-doc/plugins/routes";
12
+ const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
12
13
  const COMPONENT_DOCS_COLLECTION_BASE = COMPONENT_DOCS_COLLECTION;
13
14
  function definedOnly(record) {
14
15
  return Object.fromEntries(Object.entries(record).filter(([, value]) => value !== void 0));
@@ -46,6 +47,36 @@ function withStyleguideChromeDefaults(plugin, routes) {
46
47
  }
47
48
  };
48
49
  }
50
+ const HEADER_TOKEN_TRIGGER_ID = "sg-preview-tokens-trigger";
51
+ const PREVIEW_TOKEN_PANEL_EVENT = "toggle-preview-token-panel";
52
+ const ENGINE_ROUTE_ATTR = "data-sg-engine-route";
53
+ const TRIGGER_INSTALLED_FLAG = "__sgPreviewTokensTriggerInstalled";
54
+ const SLIDERS_GLYPH = '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="6" x2="20" y2="6"></line><line x1="4" y1="12" x2="20" y2="12"></line><line x1="4" y1="18" x2="20" y2="18"></line><circle cx="9" cy="6" r="2.4" fill="currentColor" stroke="none"></circle><circle cx="15" cy="12" r="2.4" fill="currentColor" stroke="none"></circle><circle cx="8" cy="18" r="2.4" fill="currentColor" stroke="none"></circle></svg>';
55
+ const HEADER_TOKEN_TRIGGER_HTML = `<button id="${HEADER_TOKEN_TRIGGER_ID}" type="button" hidden class="flex items-center justify-center text-muted transition-colors hover:text-fg cursor-pointer" aria-label="Open component tokens panel" title="Component tokens" onclick="window.dispatchEvent(new CustomEvent('${PREVIEW_TOKEN_PANEL_EVENT}'))">` + SLIDERS_GLYPH + `</button><script>(function(){if(window.${TRIGGER_INSTALLED_FLAG})return;window.${TRIGGER_INSTALLED_FLAG}=true;function sync(){var btn=document.getElementById(${JSON.stringify(HEADER_TOKEN_TRIGGER_ID)});if(!btn)return;btn.hidden=!document.querySelector(${JSON.stringify(`[${ENGINE_ROUTE_ATTR}]`)});}sync();if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",sync);document.addEventListener(${JSON.stringify(AFTER_NAVIGATE_EVENT)},sync);})();</script>`;
56
+ const HEADER_TOKEN_TRIGGER_ITEM = {
57
+ type: "html",
58
+ html: HEADER_TOKEN_TRIGGER_HTML
59
+ };
60
+ function withHeaderTokenTrigger(plugin) {
61
+ if (!isRecord(plugin) || plugin.name !== ZUDO_DOC_ROUTES_PLUGIN_NAME) return plugin;
62
+ const options = isRecord(plugin.options) ? plugin.options : {};
63
+ const settings = isRecord(options.settings) ? options.settings : {};
64
+ const headerRightItems = Array.isArray(settings.headerRightItems) ? settings.headerRightItems : [];
65
+ const alreadyInstalled = headerRightItems.some(
66
+ (item) => isRecord(item) && item.type === "html" && typeof item.html === "string" && item.html.includes(HEADER_TOKEN_TRIGGER_ID)
67
+ );
68
+ if (alreadyInstalled) return plugin;
69
+ return {
70
+ ...plugin,
71
+ options: {
72
+ ...options,
73
+ settings: {
74
+ ...settings,
75
+ headerRightItems: [...headerRightItems, HEADER_TOKEN_TRIGGER_ITEM]
76
+ }
77
+ }
78
+ };
79
+ }
49
80
  function zudoSg(options) {
50
81
  if (!options || typeof options !== "object") {
51
82
  throw new Error("[zudo-sg] zudoSg(options) requires an options object (the zudo-sg.config.mjs shape)");
@@ -88,14 +119,16 @@ function withZudoSg(presetFragment, options) {
88
119
  const sg = zudoSg(options);
89
120
  const presetPlugins = [...presetFragment.plugins ?? []];
90
121
  const pluginsWithChrome = options.chromeDefaults === false ? presetPlugins : presetPlugins.map((plugin) => withStyleguideChromeDefaults(plugin, resolveSgRoutes(options.routes)));
122
+ const pluginsWithTrigger = options.headerTokenTrigger === false ? pluginsWithChrome : pluginsWithChrome.map(withHeaderTokenTrigger);
91
123
  return {
92
124
  ...presetFragment,
93
- plugins: [...pluginsWithChrome, ...sg.plugins],
125
+ plugins: [...pluginsWithTrigger, ...sg.plugins],
94
126
  collections: [...presetFragment.collections ?? [], ...sg.collections]
95
127
  };
96
128
  }
97
129
  export {
98
130
  COMPONENT_DOCS_COLLECTION_BASE,
131
+ HEADER_TOKEN_TRIGGER_ITEM,
99
132
  PREVIEW_CSS_PLUGIN_NAME,
100
133
  ROUTES_PLUGIN_NAME,
101
134
  ZDTP_APPLY_PROXY_PLUGIN_NAME,
@@ -7,14 +7,19 @@ export declare const PLUGIN_NAME = "@takazudo/zudo-sg/plugins/zdtp-apply-proxy";
7
7
  export declare const VIRTUAL_MODULE_ID = "virtual:zudo-sg-preview-token-panel";
8
8
  /** Same-origin path the preview panel POSTs its apply diff to. */
9
9
  export declare const APPLY_PATH = "/__zdtp/apply";
10
- export interface ZdtpApplyProxyOptions {
10
+ export type ZdtpApplyProxyOptions = {
11
11
  /** Project-root-relative routing JSON (e.g. `./zdtp-panel-routing.json`). */
12
12
  routingFile: string;
13
13
  /** Project-root-relative write sandbox directory (e.g. `./packages/demo-ui/styles`). */
14
14
  writeRoot: string;
15
15
  /** Project-root-relative module exporting `tabs` (the manifest-derived zdtp tab set). */
16
16
  tabsModule?: string;
17
- }
17
+ } | {
18
+ routingFile?: undefined;
19
+ writeRoot?: undefined;
20
+ /** Project-root-relative module exporting `tabs` (the manifest-derived zdtp tab set). */
21
+ tabsModule?: string;
22
+ };
18
23
  export type ResolvedZdtpApplyProxyOptions = {
19
24
  enabled: true;
20
25
  routingFile: string;
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-[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");
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-engine-route 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)] 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 justify-center 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-tokens-trigger 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-muted 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 zfb:after-swap zudo-doc zudo-doc-sidebar-width zudo-sg zudo-sg-token-tweak-bridge");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zudo-sg",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
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",
@@ -75,7 +75,19 @@ export function chromeProps({ pageTitle, path, extraHead, activeSlug, hideSideba
75
75
  ),
76
76
  header: <HeaderWithDefaults {...headerProps} />,
77
77
  footer: <FooterWithDefaults lang={locale} />,
78
- bodyEnd: <BodyEndIslands basePath={ctx.base} />,
78
+ // Marker for the header trigger's visibility script (sibling issue #814):
79
+ // `document.querySelector("[data-sg-engine-route]")` after every
80
+ // navigation. It sits in bodyEnd, not the header, because the header
81
+ // carries `data-zfb-transition-persist` — the client router lifts it
82
+ // whole across a swap, so a marker there would go stale after navigating
83
+ // to a docs page. bodyEnd has no persist key, so it is discarded and
84
+ // freshly re-rendered per route like the rest of the body.
85
+ bodyEnd: (
86
+ <>
87
+ <BodyEndIslands basePath={ctx.base} />
88
+ <div hidden data-sg-engine-route />
89
+ </>
90
+ ),
79
91
  navNodes,
80
92
  sidebarToggle: Boolean(settings.sidebarToggle),
81
93
  enableClientRouter: Boolean(settings.dynamicPageTransition),
@@ -40,7 +40,10 @@ export default function ComponentsPreviewRoute(): JSX.Element {
40
40
  }) as unknown as VNode;
41
41
 
42
42
  return (
43
- <html lang="en" data-sg-preview-doc>
43
+ // Chrome-free document (no header, no client router), so the persisted-vs-
44
+ // swapped distinction in ./_chrome.tsx doesn't apply here — the marker is
45
+ // still emitted for route-family completeness (issue #815 AC).
46
+ <html lang="en" data-sg-preview-doc data-sg-engine-route>
44
47
  <head>
45
48
  <meta charset="utf-8" />
46
49
  <meta name="viewport" content="width=device-width, initial-scale=1" />