@takazudo/zudo-sg 0.4.0 → 0.5.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +59 -61
  3. package/dist/catalog/catalog-thumb.d.ts +1 -6
  4. package/dist/catalog/catalog-thumb.js +1 -2
  5. package/dist/catalog/component-thumb.d.ts +1 -6
  6. package/dist/catalog/component-thumb.js +8 -7
  7. package/dist/catalog/descriptor-thumb.d.ts +1 -6
  8. package/dist/catalog/descriptor-thumb.js +1 -2
  9. package/dist/chrome/_styleguide-layout.d.ts +8 -9
  10. package/dist/chrome/_styleguide-layout.js +3 -6
  11. package/dist/chrome/panel-scripts.d.ts +1 -3
  12. package/dist/chrome/panel-scripts.js +3 -3
  13. package/dist/cli/scaffold/component-scaffold.js +35 -16
  14. package/dist/code-panel/code-panel.d.ts +2 -8
  15. package/dist/code-panel/code-panel.js +34 -35
  16. package/dist/code-panel/copy-button.d.ts +1 -7
  17. package/dist/code-panel/copy-button.js +31 -48
  18. package/dist/code-panel/copy-text.d.ts +1 -0
  19. package/dist/code-panel/copy-text.js +26 -0
  20. package/dist/code-panel/editor-setup.d.ts +3 -0
  21. package/dist/code-panel/editor-setup.js +15 -3
  22. package/dist/code-panel/editor-theme.d.ts +2 -0
  23. package/dist/code-panel/editor-theme.js +54 -0
  24. package/dist/code-panel/source-editor.d.ts +10 -2
  25. package/dist/code-panel/source-editor.js +20 -19
  26. package/dist/config/index.d.ts +2 -0
  27. package/dist/config/index.js +6 -1
  28. package/dist/config/wind.d.ts +265 -0
  29. package/dist/config/wind.js +133 -0
  30. package/dist/plugins/preview-css.d.ts +9 -7
  31. package/dist/plugins/preview-css.js +58 -37
  32. package/dist/preview/detail-workbench.d.ts +2 -6
  33. package/dist/preview/detail-workbench.js +100 -65
  34. package/dist/preview/index.d.ts +4 -2
  35. package/dist/preview/index.js +7 -7
  36. package/dist/preview/preview-app.d.ts +2 -5
  37. package/dist/preview/preview-app.js +76 -46
  38. package/dist/preview/variant-frame-config.d.ts +47 -0
  39. package/dist/preview/variant-frame-config.js +50 -0
  40. package/dist/preview/variant-frame.d.ts +9 -53
  41. package/dist/preview/variant-frame.js +158 -149
  42. package/dist/preview-css/compile.d.ts +15 -29
  43. package/dist/preview-css/compile.js +183 -31
  44. package/dist/search/catalog-filter.d.ts +2 -6
  45. package/dist/search/catalog-filter.js +50 -42
  46. package/dist/stories/types.d.ts +5 -3
  47. package/dist/token-dashboard/create-token-dashboards.d.ts +3 -5
  48. package/dist/token-dashboard/create-token-dashboards.js +14 -44
  49. package/dist/token-dashboard/dashboard-inventory.d.ts +1 -1
  50. package/dist/token-dashboard/token-dashboard-adapter.d.ts +2 -0
  51. package/dist/token-dashboard/token-dashboard-adapter.js +9 -0
  52. package/dist/token-dashboard/token-dashboard-mount.d.ts +6 -0
  53. package/dist/token-dashboard/token-dashboard-mount.js +33 -0
  54. package/dist/token-tweak/preview-token-panel-bootstrap.d.ts +1 -6
  55. package/dist/token-tweak/preview-token-panel-bootstrap.js +4 -2
  56. package/dist/token-tweak/preview-tokens-button.d.ts +1 -5
  57. package/dist/token-tweak/preview-tokens-button.js +5 -4
  58. package/dist/wind.json +119 -0
  59. package/package.json +16 -19
  60. package/routes-src/_chrome.tsx +1 -3
  61. package/routes-src/_preview-app.tsx +3 -8
  62. package/routes-src/components-index.tsx +5 -10
  63. package/routes-src/components-preview.tsx +3 -9
  64. package/routes-src/components-slug.tsx +21 -24
  65. package/routes-src/tokens.tsx +4 -9
  66. package/styles.css +36 -11
  67. package/dist/safelist.css +0 -2
@@ -1,17 +1,18 @@
1
1
  "use client";
2
- import { jsx } from "preact/jsx-runtime";
2
+ import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
3
3
  function PreviewTokensButton() {
4
4
  return /* @__PURE__ */ jsx(
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-[color:var(--sg-border)] rounded text-small text-[color:var(--sg-muted)] hover:text-[color:var(--sg-fg)] transition-colors cursor-pointer",
9
- onClick: () => window.dispatchEvent(new CustomEvent("toggle-preview-token-panel")),
8
+ class: "inline-flex items-center gap-hsp-2xs px-hsp-xs py-vsp-3xs border border-sg-border rounded text-small text-sg-muted hover:text-sg-fg transition-colors cursor-pointer",
9
+ "on:click": () => {
10
+ window.dispatchEvent(new CustomEvent("toggle-preview-token-panel"));
11
+ },
10
12
  children: "Preview tokens \u2192"
11
13
  }
12
14
  );
13
15
  }
14
- PreviewTokensButton.displayName = "PreviewTokensButton";
15
16
  export {
16
17
  PreviewTokensButton as default
17
18
  };
package/dist/wind.json ADDED
@@ -0,0 +1,119 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "specVersion": 1,
4
+ "producer": "zudo-sg",
5
+ "candidates": [
6
+ "-mb-px",
7
+ "bg-bg",
8
+ "bg-sg-accent",
9
+ "bg-sg-bg",
10
+ "bg-sg-surface",
11
+ "bg-sg-surface-2",
12
+ "block",
13
+ "border",
14
+ "border-b",
15
+ "border-b-2",
16
+ "border-sg-accent",
17
+ "border-sg-border",
18
+ "border-sg-border-strong",
19
+ "border-t",
20
+ "border-transparent",
21
+ "cursor-pointer",
22
+ "fixed",
23
+ "flex",
24
+ "flex-1",
25
+ "flex-col",
26
+ "flex-wrap",
27
+ "focus-visible:-outline-offset-2",
28
+ "focus-visible:outline-2",
29
+ "focus-visible:outline-offset-2",
30
+ "focus-visible:outline-sg-focus",
31
+ "font-bold",
32
+ "font-medium",
33
+ "font-semibold",
34
+ "gap-hsp-2xs",
35
+ "gap-hsp-md",
36
+ "gap-hsp-sm",
37
+ "gap-hsp-xs",
38
+ "gap-vsp-2xs",
39
+ "gap-vsp-lg",
40
+ "gap-vsp-md",
41
+ "gap-x-hsp-xl",
42
+ "gap-y-vsp-xl",
43
+ "grid",
44
+ "grid-cols-1",
45
+ "grid-cols-[repeat(auto-fit,minmax(min(18rem,100%),1fr))]",
46
+ "group",
47
+ "h-[1.5rem]",
48
+ "h-full",
49
+ "hidden",
50
+ "hover:text-fg",
51
+ "hover:text-sg-fg",
52
+ "inline-block",
53
+ "inline-flex",
54
+ "italic",
55
+ "items-center",
56
+ "items-start",
57
+ "justify-between",
58
+ "justify-center",
59
+ "leading-normal",
60
+ "m-0",
61
+ "max-w-[56rem]",
62
+ "mb-vsp-2xs",
63
+ "mb-vsp-lg",
64
+ "mb-vsp-sm",
65
+ "mb-vsp-xl",
66
+ "min-h-0",
67
+ "mt-vsp-2xs",
68
+ "mt-vsp-3xs",
69
+ "mt-vsp-xl",
70
+ "mt-vsp-xs",
71
+ "mx-auto",
72
+ "outline-none",
73
+ "overflow-auto",
74
+ "overflow-hidden",
75
+ "overflow-x-auto",
76
+ "p-hsp-2xs",
77
+ "p-hsp-md",
78
+ "p-hsp-sm",
79
+ "pt-vsp-xl",
80
+ "px-hsp-2xs",
81
+ "px-hsp-md",
82
+ "px-hsp-sm",
83
+ "px-hsp-xs",
84
+ "py-vsp-2xs",
85
+ "py-vsp-3xs",
86
+ "py-vsp-xs",
87
+ "relative",
88
+ "rounded",
89
+ "rounded-full",
90
+ "rounded-md",
91
+ "rounded-sm",
92
+ "rounded-t-sm",
93
+ "shrink-0",
94
+ "static",
95
+ "tabular-nums",
96
+ "text-2xl",
97
+ "text-caption",
98
+ "text-fg",
99
+ "text-heading",
100
+ "text-muted",
101
+ "text-right",
102
+ "text-sg-accent",
103
+ "text-sg-fg",
104
+ "text-sg-muted",
105
+ "text-sg-on-accent",
106
+ "text-sm",
107
+ "text-small",
108
+ "text-xl",
109
+ "text-xs",
110
+ "tracking-wide",
111
+ "transition-colors",
112
+ "underline",
113
+ "underline-offset-2",
114
+ "uppercase",
115
+ "visible",
116
+ "w-[2.5rem]",
117
+ "w-[5rem]"
118
+ ]
119
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takazudo/zudo-sg",
3
- "version": "0.4.0",
3
+ "version": "0.5.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",
@@ -110,8 +110,8 @@
110
110
  "default": "./dist/plugins/preview-css.js"
111
111
  },
112
112
  "./styles.css": "./styles.css",
113
- "./safelist.css": "./dist/safelist.css",
114
- "./package.json": "./package.json"
113
+ "./package.json": "./package.json",
114
+ "./wind.json": "./dist/wind.json"
115
115
  },
116
116
  "bin": {
117
117
  "zudo-sg": "./bin/zudo-sg.js"
@@ -131,37 +131,34 @@
131
131
  "README.md"
132
132
  ],
133
133
  "dependencies": {
134
- "preact-render-to-string": "^6.6.6",
135
134
  "@codemirror/commands": "^6.0.0",
136
135
  "@codemirror/lang-css": "^6.0.0",
137
136
  "@codemirror/lang-javascript": "^6.0.0",
137
+ "@codemirror/language": "^6.0.0",
138
138
  "@codemirror/state": "^6.0.0",
139
- "@codemirror/theme-one-dark": "^6.0.0",
140
139
  "@codemirror/view": "^6.0.0",
140
+ "@lezer/highlight": "^1.0.0",
141
141
  "postcss": "^8.5.28",
142
- "@tailwindcss/node": "^4.3.3",
143
- "@tailwindcss/oxide": "^4.3.3"
142
+ "preact": "^10.29.1"
144
143
  },
145
144
  "peerDependencies": {
146
- "@takazudo/zfb": "^2.20.3",
147
- "@takazudo/zdtp": "^0.8.5",
148
- "@takazudo/zudo-doc": "^5.27.0",
149
- "preact": "^10.29.8"
145
+ "@takazudo/zfb": "^4.3.1",
146
+ "@takazudo/zdtp": "^0.8.6",
147
+ "@takazudo/zudo-doc": "^6.0.0"
150
148
  },
151
149
  "devDependencies": {
152
- "@takazudo/zdtp": "0.8.5",
153
- "@takazudo/zfb": "2.21.1",
154
- "@takazudo/zudo-doc": "5.27.0",
150
+ "@takazudo/zdtp": "0.8.6",
151
+ "@takazudo/zfb": "4.3.1",
152
+ "@takazudo/zudo-doc": "6.0.0",
155
153
  "@testing-library/jest-dom": "^6.9.1",
156
- "@testing-library/preact": "^3.2.4",
157
154
  "@types/culori": "^4.0.1",
158
155
  "@types/node": "^22.0.0",
159
156
  "culori": "^4.0.2",
160
157
  "happy-dom": "^16.8.1",
161
- "preact": "^10.29.8",
162
158
  "tsup": "^8.5.0",
163
159
  "typescript": "^5.9.0",
164
- "vitest": "^4.1.9"
160
+ "vite": "7.3.5",
161
+ "vitest": "4.1.11"
165
162
  },
166
163
  "scripts": {
167
164
  "build": "tsup && tsc -p tsconfig.build.json",
@@ -172,7 +169,7 @@
172
169
  "check:package-shape": "node scripts/check-package-shape.mjs",
173
170
  "check:routes-src": "node scripts/check-routes-src.mjs",
174
171
  "check:virtual-modules": "node scripts/check-virtual-modules.mjs",
175
- "check:package-safelist": "node scripts/check-package-safelist.mjs",
176
- "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"
172
+ "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-wind-manifest && pnpm run test",
173
+ "check:package-wind-manifest": "node scripts/check-package-wind-manifest.mjs"
177
174
  }
178
175
  }
@@ -1,5 +1,3 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  // zudo-doc chrome reconstruction for the engine routes (ADR
4
2
  // docs/adr/styleguide-engine.md decision 10). Model: zudo-doc's
5
3
  // routes/_chrome.tsx. Sole importer of `virtual:zudo-doc-route-context` and
@@ -10,7 +8,7 @@
10
8
  // override (doc-chrome token panel, preview token panel, enlarge islands)
11
9
  // mounts on the engine routes exactly as on the zudo-doc doc routes.
12
10
 
13
- import type { JSX } from "preact";
11
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
14
12
  import { routeContext } from "virtual:zudo-doc-route-context";
15
13
  import { chromeBindings } from "virtual:zudo-doc-chrome-bindings";
16
14
  import { createRouteContext, type RouteContextPayload } from "@takazudo/zudo-doc/route-context";
@@ -1,6 +1,4 @@
1
1
  "use client";
2
- /** @jsxRuntime automatic */
3
- /** @jsxImportSource preact */
4
2
  // No-props island wrapper for the engine's preview app (ADR
5
3
  // docs/adr/styleguide-engine.md decision 10 "Preview island").
6
4
  //
@@ -19,15 +17,12 @@
19
17
  // Keep the combined `export default function Name() {}` form: zfb's island
20
18
  // scanner matches the SSR marker against the exported function name.
21
19
 
22
- import type { JSX } from "preact";
23
- import { useEffect } from "preact/hooks";
20
+ import { getScope, type Description } from "@takazudo/zfb/zudo-react";
24
21
  import { PreviewApp } from "@takazudo/zudo-sg/preview";
25
22
  import { installIframeReceiver } from "@takazudo/zudo-sg/token-tweak";
26
23
  import { storyRegistry } from "./_registry.js";
27
24
 
28
- export default function ConfiguredPreviewApp(): JSX.Element {
29
- useEffect(() => installIframeReceiver(window), []);
25
+ export default function ConfiguredPreviewApp(): Description {
26
+ getScope().onActivate(() => installIframeReceiver(window));
30
27
  return <PreviewApp registry={storyRegistry} />;
31
28
  }
32
-
33
- ConfiguredPreviewApp.displayName = "ConfiguredPreviewApp";
@@ -1,5 +1,3 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  // Injected at `sgContext.routes.componentsIndex` — the component catalog
4
2
  // landing: category-grouped tiles, each carrying its component rendered
5
3
  // INLINE server-side (no preview iframes), filtered client-side by the
@@ -7,7 +5,7 @@
7
5
  // Reads the mode-neutral `CatalogEntry` fields, so module and descriptor
8
6
  // registries render through the same markup.
9
7
 
10
- import type { JSX, VNode } from "preact";
8
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
11
9
  import { Island } from "@takazudo/zfb";
12
10
  import { CatalogThumb, TILE_SIZE_RESTORE_SCRIPT } from "@takazudo/zudo-sg/catalog";
13
11
  import { StyleguideLayout } from "@takazudo/zudo-sg/chrome";
@@ -25,10 +23,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
25
23
  const total = groups.reduce((n, g) => n + g.stories.length, 0);
26
24
  const categories = groups.map((g) => g.category);
27
25
 
28
- const filterIsland = Island({
29
- when: "load",
30
- children: <CatalogFilter categories={categories} total={total} />,
31
- }) as unknown as VNode;
26
+ const filterIsland = <Island when="load"><CatalogFilter categories={categories} total={total} /></Island>;
32
27
 
33
28
  return (
34
29
  <StyleguideLayout
@@ -37,7 +32,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
37
32
  path: ctx.routes.componentsIndex,
38
33
  // Restore the persisted tile size before first paint so the grid does
39
34
  // not re-flow when the island mounts.
40
- extraHead: <script dangerouslySetInnerHTML={{ __html: TILE_SIZE_RESTORE_SCRIPT }} />,
35
+ extraHead: <script rawHtml={TILE_SIZE_RESTORE_SCRIPT} />,
41
36
  activeSlug: OVERVIEW_SLUG,
42
37
  })}
43
38
  activeSlug={OVERVIEW_SLUG}
@@ -45,7 +40,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
45
40
  >
46
41
  <header class="mb-vsp-lg max-w-[56rem]">
47
42
  <h1 class="text-heading font-bold mb-vsp-2xs">{ctx.catalog.title}</h1>
48
- <p class="text-[color:var(--sg-muted)] text-small" data-sg-catalog-intro>
43
+ <p class="text-sg-muted text-small" data-sg-catalog-intro>
49
44
  {ctx.catalog.intro ?? (ctx.registryMode === "descriptor" ? (
50
45
  <>
51
46
  {total} components{ctx.uiPackageName ? <> from <code>{ctx.uiPackageName}</code></> : null}, listed from
@@ -93,7 +88,7 @@ export default function ComponentsIndexRoute(): JSX.Element {
93
88
  </div>
94
89
  </section>
95
90
  ))}
96
- <p class="text-[color:var(--sg-muted)] text-small" data-sg-empty hidden>
91
+ <p class="text-sg-muted text-small" data-sg-empty hidden>
97
92
  No components match your search.
98
93
  </p>
99
94
  </div>
@@ -1,5 +1,3 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  // Injected at `sgContext.routes.componentsPreview` — the isolated variant
4
2
  // preview document loaded as the `src` of every VariantFrame iframe.
5
3
  //
@@ -20,7 +18,7 @@
20
18
  // implies `componentsPreview` disabled — the route plugin never injects this
21
19
  // entrypoint there, so it needs no descriptor-mode branch of its own.
22
20
 
23
- import type { JSX, VNode } from "preact";
21
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
24
22
  import { Island } from "@takazudo/zfb";
25
23
  import ConfiguredPreviewApp from "./_preview-app.js";
26
24
  import { ctx, withBase } from "./_context.js";
@@ -38,11 +36,7 @@ const LIVERELOAD_STUB =
38
36
  export default function ComponentsPreviewRoute(): JSX.Element {
39
37
  // SSR-skip island: the variant depends on `location.search`, so nothing
40
38
  // renders server-side and the runtime mounts ConfiguredPreviewApp on load.
41
- const app = Island({
42
- when: "load",
43
- ssrFallback: <div data-sg-preview-loading />,
44
- children: <ConfiguredPreviewApp />,
45
- }) as unknown as VNode;
39
+ const app = <Island when="load" ssrFallback={<div data-sg-preview-loading />}><ConfiguredPreviewApp /></Island>;
46
40
 
47
41
  return (
48
42
  // Chrome-free document (no header, no client router), so the persisted-vs-
@@ -55,7 +49,7 @@ export default function ComponentsPreviewRoute(): JSX.Element {
55
49
  <meta name="robots" content="noindex" />
56
50
  <title>Preview</title>
57
51
  <link rel="stylesheet" href={withBase(ctx.previewCssUrl)} data-sg-preview-css />
58
- <script dangerouslySetInnerHTML={{ __html: LIVERELOAD_STUB }} />
52
+ <script rawHtml={LIVERELOAD_STUB} />
59
53
  </head>
60
54
  {/* The preview canvas follows host preview tokens, not engine chrome tokens. */}
61
55
  <body class="bg-bg">{app}</body>
@@ -1,5 +1,3 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  // Injected at `sgContext.routes.componentsSlug` — the component detail page.
4
2
  // zfb extracts `paths()` from this `.tsx` source by AST (one route per story).
5
3
  //
@@ -14,7 +12,8 @@
14
12
  // island, no component doc and no live-demo link — only the header and the
15
13
  // workbench, built from the mode-neutral `CatalogEntry` fields.
16
14
 
17
- import type { JSX, VNode } from "preact";
15
+ import type { Description } from "@takazudo/zfb/zudo-react";
16
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
18
17
  import { Island } from "@takazudo/zfb";
19
18
  import { getEntry } from "@takazudo/zfb/content";
20
19
  import { makeAdmonition } from "@takazudo/zudo-doc/content-admonition";
@@ -64,31 +63,30 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
64
63
  if (!entry) {
65
64
  return (
66
65
  <StyleguideLayout {...chrome} activeSlug={slug} codePanel={null}>
67
- <p class="text-[color:var(--sg-muted)]">Story not found: {slug}</p>
66
+ <p class="text-sg-muted">Story not found: {slug}</p>
68
67
  </StyleguideLayout>
69
68
  );
70
69
  }
71
70
 
72
71
  const storyEntry = entry.source === "module" ? entry.storyEntry : undefined;
73
72
 
74
- let codePanel: VNode | null = null;
73
+ let codePanel: Description | null = null;
75
74
  if (storyEntry) {
76
75
  const panelVariants: CodePanelVariant[] = storyEntry.variants.map((v) => ({
77
76
  exportName: v.exportName,
78
77
  name: v.name,
79
78
  source: v.story.source ?? storyEntry.meta.usage,
80
79
  }));
81
- const codePanelIsland = Island({
82
- when: "load",
83
- children: (
80
+ const codePanelIsland = (
81
+ <Island when="load">
84
82
  <CodePanel
85
83
  storyTitle={entry.title}
86
84
  variants={panelVariants}
87
85
  previewUrl={previewUrl}
88
86
  slug={slug}
89
87
  />
90
- ),
91
- }) as unknown as VNode;
88
+ </Island>
89
+ );
92
90
  codePanel = (
93
91
  <aside id="sg-code-panel" class="sg-code-panel" aria-label="Code panel">
94
92
  <div
@@ -101,7 +99,7 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
101
99
  />
102
100
  {codePanelIsland}
103
101
  </aside>
104
- ) as unknown as VNode;
102
+ );
105
103
  }
106
104
 
107
105
  // The collection of the components root this story's registry key belongs to
@@ -121,41 +119,40 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
121
119
  // rather than dead when no `zdtpApplyProxy.tabsModule` is wired.
122
120
  // `selection`/`theme` are passed at their pre-#883 defaults, unconditionally,
123
121
  // to keep this route's behavior spelled out rather than implicit.
124
- const workbench = Island({
125
- when: "load",
126
- children: (
122
+ const workbench = (
123
+ <Island when="load">
127
124
  <DetailWorkbench
128
125
  slug={slug}
129
126
  previewUrl={previewUrl}
130
127
  variants={entry.variants.map((v) => ({
131
128
  exportName: v.exportName,
132
129
  name: v.name,
133
- controls: v.controls,
130
+ ...(v.controls ? { controls: v.controls } : {}),
134
131
  }))}
135
132
  selection={{ mode: "all" }}
136
133
  theme={{ mode: "toolbar" }}
137
134
  toolbar={{ codePanel: Boolean(storyEntry), tokenPanel: ctx.previewTokenPanel }}
138
135
  />
139
- ),
140
- }) as unknown as VNode;
136
+ </Island>
137
+ );
141
138
 
142
139
  return (
143
140
  <StyleguideLayout {...chrome} activeSlug={slug} codePanel={codePanel} contentWide>
144
141
  <div>
145
142
  <header class="mb-vsp-lg max-w-[56rem]">
146
- <h1 class="text-2xl font-bold text-[color:var(--sg-fg)]">{entry.title}</h1>
147
- <p class="mt-vsp-xs text-[color:var(--sg-muted)]">{entry.description}</p>
148
- <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)]">
143
+ <h1 class="text-2xl font-bold text-sg-fg">{entry.title}</h1>
144
+ <p class="mt-vsp-xs text-sg-muted">{entry.description}</p>
145
+ <span class="mt-vsp-xs inline-block rounded-full border border-sg-border px-hsp-sm py-vsp-3xs text-caption leading-normal text-sg-muted">
149
146
  {entry.category}
150
147
  </span>
151
148
  </header>
152
149
 
153
150
  {previewRoute && (
154
- <section class="mb-vsp-xl max-w-[56rem] rounded-md border border-[color:var(--sg-border)] bg-[var(--sg-surface-2)] p-hsp-md">
155
- <h2 class="mb-vsp-2xs text-small font-semibold uppercase tracking-wide text-[color:var(--sg-muted)]">Live demo</h2>
151
+ <section class="mb-vsp-xl max-w-[56rem] rounded-md border border-sg-border bg-sg-surface-2 p-hsp-md">
152
+ <h2 class="mb-vsp-2xs text-small font-semibold uppercase tracking-wide text-sg-muted">Live demo</h2>
156
153
  <a
157
154
  href={withBase(previewRoute)}
158
- class="text-sm font-medium text-[color:var(--sg-accent)] underline underline-offset-2"
155
+ class="text-sm font-medium text-sg-accent underline underline-offset-2"
159
156
  >
160
157
  Open live demo →
161
158
  </a>
@@ -165,7 +162,7 @@ export default function ComponentsSlugRoute(props: SlugProps & { params: { slug:
165
162
  {workbench}
166
163
 
167
164
  {doc && (
168
- <section class="mt-vsp-xl border-t border-[color:var(--sg-border)] pt-vsp-xl">
165
+ <section class="mt-vsp-xl border-t border-sg-border pt-vsp-xl">
169
166
  <div class="zd-content max-w-[56rem]">
170
167
  <doc.Content components={componentDocMdxComponents} />
171
168
  </div>
@@ -1,11 +1,9 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  // Injected at `sgContext.routes.tokens` — the declared-defaults design-token
4
2
  // dashboards. The manifest arrives through `virtual:zudo-sg-tokens` (routes
5
3
  // plugin `tokensManifestModule` = `zudo-sg.config.mjs` `tokens.manifestOut`);
6
4
  // without one (no `tokens` config) the page renders its header and an empty-state note.
7
5
 
8
- import type { JSX, VNode } from "preact";
6
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
9
7
  import { Island } from "@takazudo/zfb";
10
8
  import { resolveRampRef } from "@takazudo/zudo-doc/color-scheme-utils";
11
9
  import { tokensManifest } from "virtual:zudo-sg-tokens";
@@ -43,10 +41,7 @@ export default function TokensRoute(): JSX.Element {
43
41
  // wired, `PreviewTokenPanelBootstrap` no-ops and this button would dispatch to
44
42
  // nothing.
45
43
  const previewTokensButton = ctx.previewTokenPanel
46
- ? (Island({
47
- when: "load",
48
- children: <PreviewTokensButton />,
49
- }) as unknown as VNode)
44
+ ? <Island when="load"><PreviewTokensButton /></Island>
50
45
  : null;
51
46
 
52
47
  return (
@@ -58,7 +53,7 @@ export default function TokensRoute(): JSX.Element {
58
53
  <div>
59
54
  <header class="mb-vsp-lg max-w-[56rem]">
60
55
  <h1 class="text-heading font-bold mb-vsp-2xs">Design tokens</h1>
61
- <p class="mt-vsp-xs mb-vsp-sm text-[color:var(--sg-muted)]">
56
+ <p class="mt-vsp-xs mb-vsp-sm text-sg-muted">
62
57
  Declared defaults{ctx.uiPackageName ? <> for <code>{ctx.uiPackageName}</code></> : null}, shown as
63
58
  light, dark, and shared token references. Open Preview tokens to edit the component previews; these
64
59
  reference dashboards stay unchanged.
@@ -70,7 +65,7 @@ export default function TokensRoute(): JSX.Element {
70
65
  chromeStyle: buildDashboardChromeStyle(),
71
66
  })
72
67
  : (
73
- <p class="text-[color:var(--sg-muted)]" data-zudo-sg-tokens-empty>
68
+ <p class="text-sg-muted" data-zudo-sg-tokens-empty>
74
69
  No design-token manifest is configured. Add <code>tokens</code> to <code>zudo-sg.config.mjs</code> and
75
70
  run <code>zudo-sg gen-token-manifest</code> to render the dashboards here.
76
71
  </p>
package/styles.css CHANGED
@@ -6,17 +6,11 @@
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 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.
17
- * The host keeps its OWN `@source` directives for its own component package
18
- * (e.g. `@source "../../packages/demo-ui/src/**"`) — the engine's safelist only
19
- * covers the engine package's compiled output, never consumer code.
9
+ * CONSUMER CSS: keep this stylesheet unlayered, after zudo-doc feature
10
+ * styles. withZudoSg() registers wind.json and merges the engine's utility
11
+ * tokens automatically. Host wind.sources cover consumer component code.
12
+ * Chrome colors use raw --sg-* defaults; override them with ordinary :root
13
+ * declarations. Utilities are placed before authored CSS by the wind policy.
20
14
  *
21
15
  * Combines what used to be two host files:
22
16
  * - src/features/styleguide/styles.css (#sg-code-panel layout / sticky /
@@ -29,6 +23,14 @@
29
23
  * move.
30
24
  * ========================================================================== */
31
25
 
26
+ /* Engine visibility hooks must beat utility display rules in every host. */
27
+ [data-sg-tile][hidden],
28
+ [data-sg-section][hidden],
29
+ [data-sg-empty][hidden],
30
+ #sg-preview-tokens-trigger[hidden] {
31
+ display: none;
32
+ }
33
+
32
34
  /* #797: plain properties survive the framework color reset; zero specificity
33
35
  * lets an unlayered host :root override win in either import order. */
34
36
  :where(:root) {
@@ -60,6 +62,25 @@
60
62
  var(--zd-fg, light-dark(oklch(.185 .005 65), oklch(.965 .004 65)))
61
63
  );
62
64
  --sg-success: var(--zd-success, light-dark(oklch(.470 .140 145), oklch(.680 .145 145)));
65
+ /* Code editor (#910): fixed literals, not chained to --zd-*, so the WCAG AA
66
+ * contrast asserted by src/code-panel/__tests__/editor-theme-contrast.test.ts
67
+ * holds regardless of host palette. Override any of them on :root. */
68
+ --sg-code-bg: light-dark(#ffffff, #161b22);
69
+ --sg-code-fg: light-dark(#1f2328, #e6edf3);
70
+ --sg-code-gutter-bg: light-dark(#f6f8fa, #0d1117);
71
+ --sg-code-gutter-fg: light-dark(#57606a, #8b949e);
72
+ --sg-code-active-line-bg: light-dark(#eaeef2, #212830);
73
+ --sg-code-selection-bg: light-dark(#c8ddf7, #264f78);
74
+ --sg-code-cursor: light-dark(#1f2328, #e6edf3);
75
+ --sg-code-keyword: light-dark(#b3261e, #ff7b72);
76
+ --sg-code-string: light-dark(#0a3069, #a5d6ff);
77
+ --sg-code-number: light-dark(#0550ae, #79c0ff);
78
+ --sg-code-comment: light-dark(#57606a, #8b949e);
79
+ --sg-code-function: light-dark(#6639ba, #d2a8ff);
80
+ --sg-code-property: light-dark(#0550ae, #79c0ff);
81
+ --sg-code-type: light-dark(#8a3700, #ffa657);
82
+ --sg-code-tag: light-dark(#116329, #7ee787);
83
+ --sg-code-attribute: light-dark(#0550ae, #79c0ff);
63
84
  }
64
85
 
65
86
  :root {
@@ -313,6 +334,10 @@
313
334
  /* One page-level toolbar owns theme / viewport / layout / code-panel /
314
335
  * preview-tokens for every stage below it (see preview/detail-workbench.tsx).
315
336
  */
337
+ .sg-workbench-toolbar-actions {
338
+ margin-inline-start: auto;
339
+ }
340
+
316
341
  .sg-workbench-toolbar {
317
342
  display: flex;
318
343
  flex-wrap: wrap;
package/dist/safelist.css DELETED
@@ -1,2 +0,0 @@
1
- /* generated by gen-safelist.mjs — do not edit by hand */
2
- @source inline("-components -mb-px -panel -tab- [--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 accept across add adjusted after alias all allow-forms allow-same-origin allow-scripts alphabetical alphabetically already always among an and any anything appear application/json apply-css-vars are arguments 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 arrays as aside assumes async at authored auto await 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-b-2 border-t border-transparent both break build builds but button by cache-control cannot canvas carries cascading case catalog catch categories category caution change changing checkbox children circle clamp class classes clear-css-vars clickable client code codegen collapsing collection collides color colors command commit compact compare compile compiled component components components2026 config configured confirm const contain content-type continue control controls copy count counts css cursor-pointer custom custom-property danger dark dashboard dashboards data 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-code-region 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-thumb-image data-sg-thumb-note data-sg-tile data-sg-tile-size data-sg-variant-root data-theme data-zudo-sg-tokens-empty date dead debugger declaration declarations declare declared default defaults delete demo derived describe description descriptor descriptors design design-token desktop detail detect dev different differs digit directory disabled discovered display distinct div do doc doc-chrome does drift driven dual-scheme duplicate duration each edit editing edits either el element else empty en enabled endpoint engine entries entry entrypoint enum equivalent eval every exactly exists expected explicit explicitly export exported exports exposes expressions extends extension failed fails false family fg field file files filled finally find finite first first-authored five 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 followed 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 get give glob-relative grid grid-cols-1 grid-cols-[repeat(auto-fit,minmax(min(18rem,100%),1fr))] group groups 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 id if iframe iframes image img implements import important in in-engine include including inert info init inject inline-block inline-flex input inserting inserts inside installed instanceof instead interface into intro invalid inventory is isolated it items-center items-start its itself justify-between justify-center kebab-case keeps key key-enumeration keyboard keydown keyed kind known label large layout lazy leading leading-normal left length let 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 live-css load loading m-0 m21 makes malformed manifest map 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 ms-auto mt-vsp-2xs mt-vsp-3xs mt-vsp-xl mt-vsp-xs must mx-auto name name/value named named-export names 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 null number object of off oklch omit omitted on once one one-sentence only option options opts or order ordered other out outline-none outside overflow-auto overflow-hidden overflow-x-auto overriding p p-hsp-2xs p-hsp-md p-hsp-sm package pages pairs palette palette- panel panels parse parsed parser pass passes path per-element per-variant pick pill placeholder placeholders plain plugin plugins pnpm point polite polyline portable positive postcss pre preact-render-to-string preact/hooks preact/jsx-runtime presentation preserve preview previews primary private property protected provided pt-vsp-xl public 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 registry relative rem rem-aware rem-based renamed/removed render rendered renders replace replaces require required requires reserved resolve resolved return returns rhythm robots root-absolute round rounded rounded-full rounded-md rounded-sm rounded-t-sm route router routes routes-src row rows run runtime s same saved scaffold scaffolds screen scrim script search secondary section segment segments select semantic separator set settings sg-catalog-tile-size sg-chip sg-chip-row sg-code-live-css sg-code-panel sg-code-panel- sg-code-panel-hidden sg-code-panel-resizer sg-code-panel-width sg-code-source 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-single-stage sg-thumb sg-thumb-img sg-thumb-inner sg-thumb-note sg-tile sg-tile-count sg-tile-desc sg-tile-meta sg-tile-title sg-workbench- sg-workbench-toolbar sg:height sg:ready sgt- shadow shape shared show shown shrink-0 sidebar sidebar- single single-axis site size skipped skips slider 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 static stay step still stories story string strings stroke-linecap stroke-linejoin stroke-width style styleguide stylesheet super supplies supply support supported surface surfaces svg swaps swatch switch tab tablet tablist tabpanel 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 throw thumbnail tier tier-model tile time tip title to together toggle toggle-design-token-panel toggle-preview-token-panel token tokens toolbar total tracking-wide transition-colors trigger true try tsx tweaks twice two type typechecks typeof ui- ui-color ui-defaults-dark ui-defaults-light ui-defaults-shared undefined under underline underline-offset-2 unique unit unitless units unknown unsupported until unwired up uppercase url 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 void vs vsp w-[2.5rem] w-[5rem] warning was weight were what when which while whole whose width 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");