create-zudo-doc 3.1.0 → 3.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.
Files changed (127) hide show
  1. package/dist/claude-md-gen.d.ts +8 -0
  2. package/dist/claude-md-gen.js +43 -26
  3. package/dist/compose.d.ts +14 -20
  4. package/dist/compose.js +15 -25
  5. package/dist/features/body-foot-util.d.ts +8 -4
  6. package/dist/features/body-foot-util.js +8 -4
  7. package/dist/features/claude-resources.d.ts +12 -0
  8. package/dist/features/claude-resources.js +13 -6
  9. package/dist/features/design-token-panel.d.ts +0 -12
  10. package/dist/features/design-token-panel.js +32 -93
  11. package/dist/features/doc-history.d.ts +18 -3
  12. package/dist/features/doc-history.js +45 -60
  13. package/dist/features/doc-tags.d.ts +9 -13
  14. package/dist/features/doc-tags.js +10 -26
  15. package/dist/features/dynamic-page-transition.d.ts +19 -30
  16. package/dist/features/dynamic-page-transition.js +21 -209
  17. package/dist/features/footer-taglist.d.ts +1 -1
  18. package/dist/features/footer-taglist.js +1 -1
  19. package/dist/features/footer.d.ts +3 -2
  20. package/dist/features/footer.js +3 -2
  21. package/dist/features/i18n.d.ts +13 -8
  22. package/dist/features/i18n.js +14 -9
  23. package/dist/features/image-enlarge.d.ts +7 -26
  24. package/dist/features/image-enlarge.js +7 -26
  25. package/dist/features/llms-txt.d.ts +3 -5
  26. package/dist/features/llms-txt.js +3 -5
  27. package/dist/features/search.d.ts +7 -3
  28. package/dist/features/search.js +7 -3
  29. package/dist/features/sidebar-resizer.d.ts +4 -8
  30. package/dist/features/sidebar-resizer.js +4 -8
  31. package/dist/features/sidebar-toggle.d.ts +7 -7
  32. package/dist/features/sidebar-toggle.js +7 -7
  33. package/dist/features/tag-governance.d.ts +14 -7
  34. package/dist/features/tag-governance.js +52 -8
  35. package/dist/features/tauri.d.ts +13 -10
  36. package/dist/features/tauri.js +16 -52
  37. package/dist/features/versioning.d.ts +12 -24
  38. package/dist/features/versioning.js +13 -39
  39. package/dist/index.js +2 -3
  40. package/dist/preset.d.ts +1 -0
  41. package/dist/preset.js +5 -0
  42. package/dist/prompts.d.ts +2 -0
  43. package/dist/prompts.js +1 -0
  44. package/dist/scaffold.d.ts +13 -6
  45. package/dist/scaffold.js +78 -59
  46. package/dist/utils.d.ts +10 -0
  47. package/dist/utils.js +14 -0
  48. package/dist/zfb-config-gen.d.ts +32 -20
  49. package/dist/zfb-config-gen.js +400 -53
  50. package/package.json +2 -2
  51. package/templates/base/pages/docs/[[...slug]].tsx +59 -0
  52. package/templates/base/pages/index.tsx +6 -41
  53. package/templates/base/scripts/setup-doc-skill.sh +261 -0
  54. package/templates/base/src/styles/global.css +15 -340
  55. package/templates/base/tsconfig.json +3 -26
  56. package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +88 -0
  57. package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +3 -1
  58. package/dist/settings-gen.d.ts +0 -2
  59. package/dist/settings-gen.js +0 -319
  60. package/templates/base/.htmlvalidate.json +0 -5
  61. package/templates/base/.zfb/doc-history-meta.json +0 -1
  62. package/templates/base/pages/_data.ts +0 -160
  63. package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
  64. package/templates/base/pages/lib/_chrome.ts +0 -167
  65. package/templates/base/pages/lib/_details.tsx +0 -29
  66. package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
  67. package/templates/base/pages/lib/_extract-headings.ts +0 -37
  68. package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
  69. package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
  70. package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
  71. package/templates/base/pages/lib/_preset-generator.tsx +0 -81
  72. package/templates/base/pages/lib/_route-context.ts +0 -32
  73. package/templates/base/pages/lib/_search-widget.tsx +0 -17
  74. package/templates/base/pages/lib/doc-page-props.ts +0 -30
  75. package/templates/base/pages/lib/locale-merge.ts +0 -59
  76. package/templates/base/scripts/run-b4push.sh +0 -102
  77. package/templates/base/src/components/ai-chat-modal.tsx +0 -18
  78. package/templates/base/src/components/content/code-group.tsx +0 -3
  79. package/templates/base/src/components/content/content-admonition.tsx +0 -4
  80. package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
  81. package/templates/base/src/components/doc-history.tsx +0 -21
  82. package/templates/base/src/components/image-enlarge.tsx +0 -24
  83. package/templates/base/src/components/preset-generator.tsx +0 -14
  84. package/templates/base/src/components/sidebar-toggle.tsx +0 -6
  85. package/templates/base/src/components/sidebar-tree.tsx +0 -6
  86. package/templates/base/src/config/color-scheme-utils.ts +0 -69
  87. package/templates/base/src/config/color-schemes.ts +0 -165
  88. package/templates/base/src/config/docs-schema.ts +0 -95
  89. package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
  90. package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
  91. package/templates/base/src/config/i18n.ts +0 -239
  92. package/templates/base/src/config/settings-types.ts +0 -45
  93. package/templates/base/src/config/sidebars.ts +0 -66
  94. package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
  95. package/templates/base/src/config/tag-vocabulary.ts +0 -20
  96. package/templates/base/src/config/z-index-tokens.ts +0 -128
  97. package/templates/base/src/types/docs-entry.ts +0 -28
  98. package/templates/base/src/types/heading.ts +0 -5
  99. package/templates/base/src/types/locale.ts +0 -10
  100. package/templates/base/src/utils/base.ts +0 -164
  101. package/templates/base/src/utils/docs.ts +0 -446
  102. package/templates/base/src/utils/git-info.ts +0 -70
  103. package/templates/base/src/utils/github.ts +0 -22
  104. package/templates/base/src/utils/nav-scope.ts +0 -34
  105. package/templates/base/src/utils/sidebar.ts +0 -36
  106. package/templates/base/src/utils/slug.ts +0 -10
  107. package/templates/base/src/utils/smart-break.tsx +0 -12
  108. package/templates/base/src/utils/tags.ts +0 -83
  109. package/templates/base/zfb-shim.d.ts +0 -178
  110. package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
  111. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
  112. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
  113. package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
  114. package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
  115. package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
  116. package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
  117. package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
  118. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
  119. package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
  120. package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
  121. package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
  122. package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
  123. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
  124. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
  125. package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
  126. package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
  127. package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
@@ -1,15 +0,0 @@
1
- "use client";
2
-
3
- // Side-effect import — running this module in the browser triggers
4
- // configurePanel(designTokenPanelConfig) which mounts the zdtp panel
5
- // and registers the `toggle-design-token-panel` window listener.
6
- import "@/lib/design-token-panel-bootstrap";
7
-
8
- import type { JSX } from "preact";
9
-
10
- function DesignTokenPanelBootstrap(): JSX.Element | null {
11
- return null;
12
- }
13
- DesignTokenPanelBootstrap.displayName = "DesignTokenPanelBootstrap";
14
-
15
- export default DesignTokenPanelBootstrap;
@@ -1,435 +0,0 @@
1
- /**
2
- * zdtp (zudo-design-token-panel) PanelConfig for this project.
3
- *
4
- * Single source of truth passed to `bootstrapDesignTokenPanel(...)` in
5
- * `src/lib/design-token-panel-bootstrap.ts`.
6
- *
7
- * Ramp-native model (mirrors zudo-doc's Color Ramp Restructure —
8
- * zudolab/zudo-doc#2584 / #2592; mode-scoped Color tab — #2606 / #2610)
9
- * -------------------------------------------------------------------------
10
- * The color model is ramp-native (`ColorScheme = { ramps, map }`, see
11
- * `src/config/color-schemes.ts`). The panel surfaces it through two tabs:
12
- *
13
- * - **Palette tab** (reserved id `palette`): three `kind:'color'` OKLCH tiers —
14
- * `base` (5 stops → `--palette-base-0..4`), `accent` (3 stops →
15
- * `--palette-accent-0..2`), and `state` (4 roles → `--palette-state-{role}`).
16
- * zdtp's native L/C/H curve editor renders these. Per zdtp's palette-tab
17
- * contract, a tab carrying MULTIPLE `kind:'color'` tiers MUST omit
18
- * `colorExtras` (otherwise `resolveColorClusterFromTab` cannot pick a single
19
- * palette tier). The ramps are shared across light/dark, so token defaults
20
- * are read from the active scheme's `ramps` and stay in sync with
21
- * `color-schemes.ts`. The cssVars match the `--palette-*` custom properties
22
- * the ColorSchemeProvider emits (`schemeToCssPairs`).
23
- *
24
- * - **Color tab** (reserved id `color`): a single `semantic` tier holding the
25
- * 4 base roles (`--zd-bg`/`--zd-fg`/`--zd-selection-{bg,fg}`) + 23 `--zd-*`
26
- * semantic roles, each rendered as a grouped ramp dropdown. The tier declares
27
- * `referencesRamps` pointing at the Palette tab's `base`/`accent`/`state`
28
- * tiers, so each row's `default` is the encoded `tierId:itemId` ramp
29
- * reference (`buildSemanticTierItems` / `rampRefToPanelDefault`), the picker
30
- * renders grouped `<optgroup>` dropdowns, and editing emits live
31
- * `var(--palette-*)`. The tier carries NO `referencesTier` — that resolves
32
- * intra-tab only; the cross-tab wiring is `referencesRamps` + `semantic:true`.
33
- *
34
- * Mode-scoped defaults
35
- * --------------------
36
- * The Color tab's semantic defaults are MODE-SCOPED: `buildDesignTokenPanelConfig(mode)`
37
- * seeds the tier from the active mode's scheme (light map vs dark map). The
38
- * bootstrap (`@takazudo/zudo-doc/design-token-panel-bootstrap`) destroys +
39
- * reconfigures the panel on every `color-scheme-changed` toggle so its defaults
40
- * follow the live light/dark mode.
41
- *
42
- * Caveat: a *saved* color OVERRIDE is still mode-AGNOSTIC here — but this is
43
- * this project's config-shape choice, not a zdtp limitation. zdtp 0.4.5 ships
44
- * per-scheme/per-mode keyed color persistence (v4 envelope,
45
- * Takazudo/zudo-design-token-panel#500 / #509): the color slice is keyed by
46
- * the cluster's resolved scheme identity (`panelSettings.colorScheme` /
47
- * `colorMode`). This project's color cluster is scheme-less
48
- * (`colorExtras.colorSchemes = {}`, no `colorMode`) and switches modes
49
- * externally via the destroy+reconfigure dance above rather than zdtp's own
50
- * `colorMode` field, so zdtp always resolves the same single (stub) scheme
51
- * identity and an override repaints both modes until Reset. Only the
52
- * DEFAULTS are mode-faithful. Do NOT work around this by reaching into zdtp's
53
- * private storage keys.
54
- *
55
- * The color cluster is **scheme-less**: `colorExtras.colorSchemes = {}` (zdtp's
56
- * documented scheme-less cluster shape) — the ramps ARE the editable source of
57
- * truth, surfaced by the Palette tab, so a bundled scheme-preset registry no
58
- * longer applies.
59
- */
60
-
61
- import type {
62
- PanelConfig,
63
- TabConfig,
64
- TierConfig,
65
- TierItem,
66
- ColorClusterExtras,
67
- TokenDef,
68
- } from "@takazudo/zdtp";
69
- import {
70
- SPACING_TOKENS,
71
- FONT_TOKENS,
72
- SIZE_TOKENS,
73
- } from "./design-tokens-manifest";
74
- import {
75
- getActiveScheme,
76
- STATE_ROLES,
77
- type ColorScheme,
78
- } from "./color-scheme-utils";
79
- import { buildSemanticTierItems } from "@takazudo/zudo-doc/color-scheme-utils";
80
- import { colorSchemes } from "./color-schemes";
81
- import { settings } from "./settings";
82
-
83
- /**
84
- * Inert fallback for the still-REQUIRED `ColorClusterExtras.defaultShikiTheme`.
85
- * zdtp's Shiki integration is a no-op stub, so this value has no visible
86
- * effect if you highlight code some other way — but the field is typed
87
- * `string`, so a value is required.
88
- */
89
- const DEFAULT_SHIKI_THEME = "github-dark";
90
-
91
- // ---------------------------------------------------------------------------
92
- // Helpers — partition flat manifest arrays into TabConfig.tiers by group.
93
- // ---------------------------------------------------------------------------
94
-
95
- /**
96
- * Convert a flat `TokenDef` to a `TierItem` (the zdtp tier-model shape).
97
- *
98
- * The mapping rules:
99
- * - `control: "select"` → `type: { kind: 'select', options }`
100
- * - `control: "text"` → `type: { kind: 'text' }`
101
- * - (default slider) → `type: { kind: 'length', step, unit }`
102
- *
103
- * `pill` and `readonly` pass through unchanged.
104
- */
105
- function toTierItem(t: TokenDef): TierItem {
106
- let kind;
107
- if (t.control === "select") {
108
- kind = { kind: "select" as const, options: t.options ?? [] };
109
- } else if (t.control === "text") {
110
- kind = { kind: "text" as const };
111
- } else {
112
- kind = {
113
- kind: "length" as const,
114
- step: t.step,
115
- unit: t.unit,
116
- };
117
- }
118
- const item: TierItem = {
119
- id: t.id,
120
- cssVar: t.cssVar,
121
- label: t.label,
122
- default: t.default,
123
- type: kind,
124
- };
125
- if (t.pill) item.pill = t.pill;
126
- if (t.readonly) item.readonly = true;
127
- return item;
128
- }
129
-
130
- /**
131
- * Build a tier from the subset of `tokens` whose `group` matches `groupId`.
132
- * The tier's items share the same kind by construction (all items in a
133
- * group share the same slider/select/text shape in this project's manifest).
134
- * zdtp's `assertValidTabs` validator requires this.
135
- */
136
- function tierFromGroup(
137
- tokens: readonly TokenDef[],
138
- groupId: string,
139
- label: string,
140
- ): TierConfig {
141
- return {
142
- id: groupId,
143
- label,
144
- items: tokens
145
- .filter((t) => t.group === groupId)
146
- .map(toTierItem),
147
- };
148
- }
149
-
150
- // ---------------------------------------------------------------------------
151
- // Palette tab — three ramp tiers (base / accent / state), OKLCH curve editor.
152
- // ---------------------------------------------------------------------------
153
-
154
- /**
155
- * Build the three ramp tiers from the active scheme's shared `ramps`. Light
156
- * and dark schemes share the same Tier-1 ramps, so the active scheme's ramps
157
- * are the single source of truth — read from here rather than hardcoding a
158
- * second copy of the values.
159
- */
160
- function buildRampTiers(): TierConfig[] {
161
- const { ramps } = getActiveScheme();
162
-
163
- const baseTier: TierConfig = {
164
- id: "base",
165
- label: "Base",
166
- items: ramps.base.map((color, i): TierItem => ({
167
- id: `base-${i}`,
168
- cssVar: `--palette-base-${i}`,
169
- label: String(i),
170
- default: color,
171
- type: { kind: "color", format: "oklch" },
172
- })),
173
- };
174
-
175
- const accentTier: TierConfig = {
176
- id: "accent",
177
- label: "Accent",
178
- items: ramps.accent.map((color, i): TierItem => ({
179
- id: `accent-${i}`,
180
- cssVar: `--palette-accent-${i}`,
181
- label: String(i),
182
- default: color,
183
- type: { kind: "color", format: "oklch" },
184
- })),
185
- };
186
-
187
- const stateTier: TierConfig = {
188
- id: "state",
189
- label: "State",
190
- items: STATE_ROLES.map((role): TierItem => ({
191
- id: `state-${role}`,
192
- cssVar: `--palette-state-${role}`,
193
- label: role,
194
- default: ramps.state[role],
195
- type: { kind: "color", format: "oklch" },
196
- })),
197
- };
198
-
199
- return [baseTier, accentTier, stateTier];
200
- }
201
-
202
- const PALETTE_TAB: TabConfig = {
203
- id: "palette",
204
- label: "Palette",
205
- tiers: buildRampTiers(),
206
- // No colorExtras: a tab with multiple kind:'color' tiers MUST omit it so
207
- // resolveColorClusterFromTab is not invoked and zdtp renders the ramps with
208
- // its native curve editor (zdtp palette-tab contract).
209
- };
210
-
211
- // ---------------------------------------------------------------------------
212
- // Color tab — mode-scoped semantic tier (4 base roles + 23 --zd-* roles) as
213
- // grouped ramp dropdowns referencing the Palette tab.
214
- // ---------------------------------------------------------------------------
215
-
216
- type PanelMode = "light" | "dark";
217
-
218
- /**
219
- * Resolve the `ColorScheme` whose `map` seeds the semantic tier for `mode`.
220
- * With a light/dark pair configured, picks `colorMode.{light,dark}Scheme`; on
221
- * the single-scheme path (`settings.colorMode === false`) there is no pair, so
222
- * the active `settings.colorScheme` is used for both modes (no toggle wiring).
223
- */
224
- function schemeForMode(mode: PanelMode): ColorScheme {
225
- const cm = settings.colorMode;
226
- if (!cm) return getActiveScheme();
227
- const name = mode === "dark" ? cm.darkScheme : cm.lightScheme;
228
- return colorSchemes[name] ?? getActiveScheme();
229
- }
230
-
231
- /**
232
- * Semantic tier — 4 base roles + 23 `--zd-*` roles, each a grouped ramp
233
- * dropdown. `referencesRamps` names the Palette tab's ramp tiers this tier's
234
- * `{ref}` mappings resolve against (cross-tab, resolved at mount by
235
- * `resolveColorClusterFromTab`); `semantic: true` marks it so zdtp never
236
- * mistakes it for the palette tier. Items come from `buildSemanticTierItems`:
237
- * every `default` is an encoded `tierId:itemId` ramp reference, so a scheme
238
- * with no override round-trips to the exact ramp stop (no snapping to a
239
- * resolved color). Seeded from `schemeForMode(mode)` — this is the only
240
- * mode-varying tier.
241
- */
242
- function buildSemanticTier(mode: PanelMode): TierConfig {
243
- return {
244
- id: "semantic",
245
- label: "Semantic",
246
- semantic: true,
247
- referencesRamps: [
248
- { tab: "palette", tier: "base" },
249
- { tab: "palette", tier: "accent" },
250
- { tab: "palette", tier: "state" },
251
- ],
252
- items: buildSemanticTierItems(schemeForMode(mode)),
253
- };
254
- }
255
-
256
- /**
257
- * Color cluster extras. Scheme-less (`colorSchemes: {}`) with no base-role
258
- * editors (`baseRoles`/`baseDefaults` empty) — the Palette tab owns the ramps
259
- * and the semantic tier owns the roles.
260
- *
261
- * `panelSettings.colorMode` is an OBJECT (not `false`) with `defaultMode = mode`.
262
- * On this scheme-less cluster its only live effect is `getClusterDefaultMode()`,
263
- * which drives the per-mode literal collapse/preview side — pinning it to the
264
- * ACTIVE mode keeps that side following the live toggle (a bare `false` would
265
- * pin it to `light` and mis-collapse per-mode literals for a dark-mode user).
266
- * `colorScheme`/`lightScheme`/`darkScheme` only need to be non-empty strings
267
- * (the validator requires that even with `colorSchemes: {}`; the names are not
268
- * checked against the empty registry).
269
- */
270
- function buildColorExtras(mode: PanelMode): ColorClusterExtras {
271
- const cm = settings.colorMode;
272
- const lightScheme = cm ? cm.lightScheme : settings.colorScheme;
273
- const darkScheme = cm ? cm.darkScheme : settings.colorScheme;
274
- return {
275
- // Customize id/label to match your project name to avoid localStorage
276
- // collisions when multiple zudo-doc-based projects run in the same browser.
277
- id: "my-doc",
278
- label: "My Doc",
279
- baseRoles: {},
280
- baseDefaults: {},
281
- defaultShikiTheme: DEFAULT_SHIKI_THEME,
282
- colorSchemes: {},
283
- panelSettings: {
284
- colorScheme: settings.colorScheme,
285
- colorMode: { defaultMode: mode, lightScheme, darkScheme },
286
- },
287
- };
288
- }
289
-
290
- function buildColorTab(mode: PanelMode): TabConfig {
291
- return {
292
- id: "color",
293
- label: "Color",
294
- tiers: [buildSemanticTier(mode)],
295
- colorExtras: buildColorExtras(mode),
296
- };
297
- }
298
-
299
- // ---------------------------------------------------------------------------
300
- // Font tab — five tiers grouped by the manifest's `group` field.
301
- // ---------------------------------------------------------------------------
302
-
303
- const FONT_SCALE_TIER_ID = "font-scale";
304
-
305
- /**
306
- * Tier 2 semantic role → Tier 1 abstract scale item id. Mirrors the `var(--…)`
307
- * wiring in `global.css` (`--text-body: var(--text-scale-md)` etc.). The role
308
- * tier is a *reference* tier: each item's stored value is the id of a
309
- * `font-scale` item, exactly like the Color tab's semantic→palette tier. zdtp
310
- * renders these as dropdowns and emits `var(--text-scale-*)`, so editing a
311
- * scale step propagates to every role live.
312
- */
313
- const FONT_ROLE_TO_SCALE: Readonly<Record<string, string>> = {
314
- "text-micro": "text-scale-2xs",
315
- "text-caption": "text-scale-xs",
316
- "text-small": "text-scale-sm",
317
- "text-body": "text-scale-md",
318
- "text-title": "text-scale-lg",
319
- "text-heading": "text-scale-xl",
320
- "text-display": "text-scale-2xl",
321
- };
322
-
323
- /**
324
- * Build the semantic font-size tier as a reference tier pointing at the
325
- * `font-scale` tier. Defaults are overridden to the referenced scale id (the
326
- * manifest still records resolved rem values for serde / the flat-manifest
327
- * generator template, so the override happens here rather than in the
328
- * manifest to keep both consumers correct).
329
- */
330
- function buildFontRoleTier(): TierConfig {
331
- const base = tierFromGroup(FONT_TOKENS, "font-size", "Font size");
332
- return {
333
- ...base,
334
- items: base.items.map((item) => {
335
- const scaleId = FONT_ROLE_TO_SCALE[item.id];
336
- return scaleId ? { ...item, default: scaleId } : item;
337
- }),
338
- referencesTier: FONT_SCALE_TIER_ID,
339
- };
340
- }
341
-
342
- const FONT_TAB: TabConfig = {
343
- id: "font",
344
- label: "Font",
345
- tiers: [
346
- tierFromGroup(FONT_TOKENS, FONT_SCALE_TIER_ID, "Scale"),
347
- buildFontRoleTier(),
348
- tierFromGroup(FONT_TOKENS, "line-height", "Line height"),
349
- tierFromGroup(FONT_TOKENS, "font-weight", "Font weight"),
350
- tierFromGroup(FONT_TOKENS, "font-family", "Font family"),
351
- ],
352
- };
353
-
354
- // ---------------------------------------------------------------------------
355
- // Spacing tab — four tiers grouped by the manifest's `group` field.
356
- // ---------------------------------------------------------------------------
357
-
358
- const SPACING_TAB: TabConfig = {
359
- id: "spacing",
360
- label: "Spacing",
361
- tiers: [
362
- tierFromGroup(SPACING_TOKENS, "hsp", "Horizontal spacing"),
363
- tierFromGroup(SPACING_TOKENS, "vsp", "Vertical spacing"),
364
- tierFromGroup(SPACING_TOKENS, "icon", "Icons"),
365
- tierFromGroup(SPACING_TOKENS, "layout", "Layout"),
366
- ],
367
- };
368
-
369
- // ---------------------------------------------------------------------------
370
- // Size tab — two tiers grouped by the manifest's `group` field.
371
- // ---------------------------------------------------------------------------
372
-
373
- const SIZE_TAB: TabConfig = {
374
- id: "size",
375
- label: "Size",
376
- tiers: [
377
- tierFromGroup(SIZE_TOKENS, "radius", "Radius"),
378
- tierFromGroup(SIZE_TOKENS, "transition", "Transition"),
379
- ],
380
- };
381
-
382
- /**
383
- * Detect the initial color-scheme mode for the first `configurePanel` call. In
384
- * the browser, read `<html data-theme>` (set pre-paint by the
385
- * ColorSchemeProvider bootstrap); otherwise fall back to
386
- * `settings.colorMode.defaultMode` (or `light` on the single-scheme path).
387
- * SSR-safe: guards `document`.
388
- */
389
- function detectInitialMode(): PanelMode {
390
- if (typeof document !== "undefined") {
391
- const attr = document.documentElement.getAttribute("data-theme");
392
- if (attr === "light" || attr === "dark") return attr;
393
- }
394
- const cm = settings.colorMode;
395
- return cm ? cm.defaultMode : "light";
396
- }
397
-
398
- /**
399
- * Build the full PanelConfig for a given color-scheme `mode`. Only the Color
400
- * tab's semantic tier and `panelSettings.colorMode.defaultMode` vary by mode;
401
- * the Palette/Font/Spacing/Size tabs are mode-independent. The bootstrap calls
402
- * this per mode on every `color-scheme-changed` toggle (destroy + reconfigure).
403
- */
404
- export function buildDesignTokenPanelConfig(mode: PanelMode): PanelConfig {
405
- return {
406
- // Customize these values to match your project name to avoid localStorage
407
- // collisions when multiple zudo-doc-based projects run in the same browser.
408
- storagePrefix: "my-doc-tweak",
409
- consoleNamespace: "myDoc",
410
- modalClassPrefix: "my-doc-design-token-panel-modal",
411
- // DISPLAY-ONLY in zdtp 0.4.5: the panel's export hard-codes
412
- // `zudo-design-tokens/v2` and auto-upgrades to `.../v3` when object leaves
413
- // ({ref}/{literal}/per-mode) are present — which the semantic tier's ramp
414
- // refs always are, so real exports carry v3. `schemaId` does NOT gate
415
- // import; it only labels the Import-modal hint. zdtp DOES export its own
416
- // `SCHEMA_V1`/`SCHEMA_V2`/`SCHEMA_V3` constants (#498/#505), but those are
417
- // zdtp's fixed internal schema strings, unrelated to this field. Set to v3
418
- // (a literal, not one of those constants) so the hint matches what exports
419
- // actually carry.
420
- schemaId: "zudo-design-tokens/v3",
421
- exportFilenameBase: "my-doc-design-tokens",
422
- tabs: [PALETTE_TAB, buildColorTab(mode), FONT_TAB, SPACING_TAB, SIZE_TAB],
423
- };
424
- }
425
-
426
- /**
427
- * Back-compat / initial-call export: the config for the mode detected at module
428
- * load. Pass the `buildDesignTokenPanelConfig` BUILDER (not this plain object)
429
- * to the bootstrap for live mode-scoped rebuilds on light/dark toggle — see
430
- * `src/lib/design-token-panel-bootstrap.ts`. This plain-config export remains
431
- * for callers that only need a static config.
432
- */
433
- export const designTokenPanelConfig: PanelConfig = buildDesignTokenPanelConfig(
434
- detectInitialMode(),
435
- );
@@ -1,174 +0,0 @@
1
- /**
2
- * Design-token manifest data arrays — canonical source of truth for all
3
- * editable design tokens, lifted out of the legacy panel component directory
4
- * so they survive the W3-2 deletion of the panel component tree.
5
- *
6
- * Imported by:
7
- * - src/config/design-token-panel-config.ts (groups items into TabConfig.tiers)
8
- * - @takazudo/zudo-doc/theme (design-token-serde) — cssVar ↔ id lookup for JSON I/O
9
- *
10
- * Type strategy: arrays are typed `readonly TokenDef[]` for back-compat with
11
- * the consumer serde and tests. `design-token-panel-config.ts` partitions the
12
- * flat arrays by the `group` field into the new zdtp `TabConfig.tiers` shape.
13
- * `TokenDef.advanced` was dropped upstream (zdtp 8abb1e4) — items previously
14
- * gated behind an "Advanced" disclosure now live in their own tier ("Scale —
15
- * advanced") so the tier acts as the disclosure container.
16
- */
17
- import type { TokenDef } from "@takazudo/zdtp";
18
-
19
- // --- Font weight select options ---
20
- const FONT_WEIGHT_OPTIONS = [
21
- "100", "200", "300", "400", "500", "600", "700", "800", "900",
22
- ] as const;
23
-
24
- /**
25
- * Spacing tokens from `global.css`.
26
- *
27
- * Coverage (audit 2026-04): every `--spacing-*` declaration plus the
28
- * `--zd-sidebar-w` layout token. Read-only rows surface tokens whose value
29
- * can't be expressed on a single-axis slider (`clamp()`, structural `0`).
30
- */
31
- export const SPACING_TOKENS: readonly TokenDef[] = [
32
- // --- Horizontal spacing ---
33
- { id: "hsp-2xs", cssVar: "--spacing-hsp-2xs", label: "hsp-2xs", group: "hsp", default: "0.125rem", step: 0.025, unit: "rem" },
34
- { id: "hsp-xs", cssVar: "--spacing-hsp-xs", label: "hsp-xs", group: "hsp", default: "0.375rem", step: 0.025, unit: "rem" },
35
- { id: "hsp-sm", cssVar: "--spacing-hsp-sm", label: "hsp-sm", group: "hsp", default: "0.5rem", step: 0.025, unit: "rem" },
36
- { id: "hsp-md", cssVar: "--spacing-hsp-md", label: "hsp-md", group: "hsp", default: "0.75rem", step: 0.025, unit: "rem" },
37
- { id: "hsp-lg", cssVar: "--spacing-hsp-lg", label: "hsp-lg", group: "hsp", default: "1rem", step: 0.025, unit: "rem" },
38
- { id: "hsp-xl", cssVar: "--spacing-hsp-xl", label: "hsp-xl", group: "hsp", default: "1.5rem", step: 0.025, unit: "rem" },
39
- { id: "hsp-2xl", cssVar: "--spacing-hsp-2xl", label: "hsp-2xl", group: "hsp", default: "2rem", step: 0.025, unit: "rem" },
40
-
41
- // --- Vertical spacing ---
42
- { id: "vsp-3xs", cssVar: "--spacing-vsp-3xs", label: "vsp-3xs", group: "vsp", default: "0.25rem", step: 0.025, unit: "rem" },
43
- { id: "vsp-2xs", cssVar: "--spacing-vsp-2xs", label: "vsp-2xs", group: "vsp", default: "0.4375rem", step: 0.025, unit: "rem" },
44
- { id: "vsp-xs", cssVar: "--spacing-vsp-xs", label: "vsp-xs", group: "vsp", default: "0.875rem", step: 0.025, unit: "rem" },
45
- { id: "vsp-sm", cssVar: "--spacing-vsp-sm", label: "vsp-sm", group: "vsp", default: "1.25rem", step: 0.025, unit: "rem" },
46
- { id: "vsp-md", cssVar: "--spacing-vsp-md", label: "vsp-md", group: "vsp", default: "1.5rem", step: 0.025, unit: "rem" },
47
- { id: "vsp-lg", cssVar: "--spacing-vsp-lg", label: "vsp-lg", group: "vsp", default: "1.75rem", step: 0.025, unit: "rem" },
48
- { id: "vsp-xl", cssVar: "--spacing-vsp-xl", label: "vsp-xl", group: "vsp", default: "2.5rem", step: 0.025, unit: "rem" },
49
- { id: "vsp-2xl", cssVar: "--spacing-vsp-2xl", label: "vsp-2xl", group: "vsp", default: "3.5rem", step: 0.025, unit: "rem" },
50
-
51
- // --- Icons ---
52
- { id: "icon-xs", cssVar: "--spacing-icon-xs", label: "icon-xs", group: "icon", default: "0.75rem", step: 0.05, unit: "rem" },
53
- { id: "icon-sm", cssVar: "--spacing-icon-sm", label: "icon-sm", group: "icon", default: "1rem", step: 0.05, unit: "rem" },
54
- { id: "icon-md", cssVar: "--spacing-icon-md", label: "icon-md", group: "icon", default: "1.25rem", step: 0.05, unit: "rem" },
55
- { id: "icon-lg", cssVar: "--spacing-icon-lg", label: "icon-lg", group: "icon", default: "1.5rem", step: 0.05, unit: "rem" },
56
-
57
- // --- Layout ---
58
- { id: "image-overlay-inset", cssVar: "--spacing-image-overlay-inset", label: "image-overlay-inset", group: "layout", default: "0.5rem", step: 0.05, unit: "rem" },
59
- // Structural zero — surfaced as read-only so designers see it exists, but
60
- // editing it would break every utility that relies on "0 is 0".
61
- { id: "spacing-0", cssVar: "--spacing-0", label: "spacing-0", group: "layout", default: "0", step: 1, unit: "", readonly: true },
62
- // 1px hairline — also read-only by design.
63
- { id: "spacing-px", cssVar: "--spacing-px", label: "spacing-px", group: "layout", default: "1px", step: 1, unit: "px", readonly: true },
64
- // Responsive clamp() expression — can't be expressed on a single slider.
65
- { id: "sidebar-w", cssVar: "--zd-sidebar-w", label: "sidebar-w", group: "layout", default: "clamp(14rem, 20vw, 22rem)", step: 1, unit: "", readonly: true },
66
- ];
67
-
68
- /**
69
- * Font tokens from `global.css`.
70
- *
71
- * Tier 2 semantic tokens (sizes, line-heights, weights, families) are exposed
72
- * as primary tiers; Tier 1 abstract scale (`--text-scale-*`) lives in its own
73
- * `font-scale` tier so designers who tweak the scale see the tokens that the
74
- * semantic sizes resolve from.
75
- *
76
- * (Note: `TokenDef.advanced` was dropped upstream in zdtp 8abb1e4. The
77
- * progressive-disclosure container is now the tier itself; the
78
- * panel-config groups by `group` and presents each tier as a separate
79
- * section under the Font tab.)
80
- *
81
- * Defaults here mirror `global.css` resolved rem values (`--text-body` →
82
- * `1.2rem`) so serde and the flat-`TokenManifest` generator template have a
83
- * concrete number. The tier-based main panel (`design-token-panel-config.ts`)
84
- * promotes the `font-size` group to a *reference* tier pointing at
85
- * `font-scale`, overriding these defaults to the referenced scale id so the
86
- * panel reflects the `var(--text-scale-*)` wiring the CSS already encodes.
87
- */
88
- export const FONT_TOKENS: readonly TokenDef[] = [
89
- // --- Font sizes (Tier 2 semantic) ---
90
- { id: "text-micro", cssVar: "--text-micro", label: "text-micro", group: "font-size", default: "0.75rem", step: 0.05, unit: "rem" },
91
- { id: "text-caption", cssVar: "--text-caption", label: "text-caption", group: "font-size", default: "0.875rem", step: 0.05, unit: "rem" },
92
- { id: "text-small", cssVar: "--text-small", label: "text-small", group: "font-size", default: "1rem", step: 0.05, unit: "rem" },
93
- { id: "text-body", cssVar: "--text-body", label: "text-body", group: "font-size", default: "1.2rem", step: 0.05, unit: "rem" },
94
- { id: "text-title", cssVar: "--text-title", label: "text-title", group: "font-size", default: "1.4rem", step: 0.05, unit: "rem" },
95
- { id: "text-heading", cssVar: "--text-heading", label: "text-heading", group: "font-size", default: "3rem", step: 0.05, unit: "rem" },
96
- { id: "text-display", cssVar: "--text-display", label: "text-display", group: "font-size", default: "3.75rem", step: 0.05, unit: "rem" },
97
-
98
- // --- Line heights (unitless) ---
99
- { id: "leading-tight", cssVar: "--leading-tight", label: "leading-tight", group: "line-height", default: "1.25", step: 0.05, unit: "" },
100
- { id: "leading-snug", cssVar: "--leading-snug", label: "leading-snug", group: "line-height", default: "1.375", step: 0.05, unit: "" },
101
- { id: "leading-normal", cssVar: "--leading-normal", label: "leading-normal", group: "line-height", default: "1.5", step: 0.05, unit: "" },
102
- { id: "leading-relaxed", cssVar: "--leading-relaxed", label: "leading-relaxed", group: "line-height", default: "1.625", step: 0.05, unit: "" },
103
-
104
- // --- Font weights (select) ---
105
- { id: "font-weight-normal", cssVar: "--font-weight-normal", label: "font-weight-normal", group: "font-weight", default: "400", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
106
- { id: "font-weight-medium", cssVar: "--font-weight-medium", label: "font-weight-medium", group: "font-weight", default: "500", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
107
- { id: "font-weight-semibold", cssVar: "--font-weight-semibold", label: "font-weight-semibold", group: "font-weight", default: "600", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
108
- { id: "font-weight-bold", cssVar: "--font-weight-bold", label: "font-weight-bold", group: "font-weight", default: "700", step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
109
-
110
- // --- Font families (text input) ---
111
- { id: "font-sans", cssVar: "--font-sans", label: "font-sans", group: "font-family", default: "system-ui, sans-serif", step: 1, unit: "", control: "text" },
112
- { id: "font-mono", cssVar: "--font-mono", label: "font-mono", group: "font-family", default: "ui-monospace, monospace", step: 1, unit: "", control: "text" },
113
-
114
- // --- Tier 1 abstract scale (was "Advanced" disclosure in v1 of the panel;
115
- // now lives in its own font-scale tier). ---
116
- { id: "text-scale-2xs", cssVar: "--text-scale-2xs", label: "text-scale-2xs", group: "font-scale", default: "0.75rem", step: 0.05, unit: "rem" },
117
- { id: "text-scale-xs", cssVar: "--text-scale-xs", label: "text-scale-xs", group: "font-scale", default: "0.875rem", step: 0.05, unit: "rem" },
118
- { id: "text-scale-sm", cssVar: "--text-scale-sm", label: "text-scale-sm", group: "font-scale", default: "1rem", step: 0.05, unit: "rem" },
119
- { id: "text-scale-md", cssVar: "--text-scale-md", label: "text-scale-md", group: "font-scale", default: "1.2rem", step: 0.05, unit: "rem" },
120
- { id: "text-scale-lg", cssVar: "--text-scale-lg", label: "text-scale-lg", group: "font-scale", default: "1.4rem", step: 0.05, unit: "rem" },
121
- { id: "text-scale-xl", cssVar: "--text-scale-xl", label: "text-scale-xl", group: "font-scale", default: "3rem", step: 0.05, unit: "rem" },
122
- { id: "text-scale-2xl", cssVar: "--text-scale-2xl", label: "text-scale-2xl", group: "font-scale", default: "3.75rem", step: 0.05, unit: "rem" },
123
- ];
124
-
125
- /**
126
- * Size tokens from `global.css`.
127
- *
128
- * Coverage (audit 2026-04): every non-breakpoint size-category custom property.
129
- * Breakpoints (`--breakpoint-sm/lg/xl`) are intentionally omitted — live-
130
- * changing them causes layout thrash mid-drag and adds no real tweak value.
131
- *
132
- * Radius defaults use `px` (matches the 0–100 slider in the sub-issue spec),
133
- * even though `global.css` expresses them in `rem` — the browser accepts both.
134
- *
135
- * `--radius-full` is special: its design default (`9999px`) is an intentional
136
- * sentinel that a 0–100 slider can't reach, so it carries a `pill` toggle. The
137
- * checkbox reapplies the sentinel; unchecking drops back to a slider-editable
138
- * custom value.
139
- */
140
- export const SIZE_TOKENS: readonly TokenDef[] = [
141
- // --- Radius ---
142
- { id: "radius-DEFAULT", cssVar: "--radius-DEFAULT", label: "radius-DEFAULT", group: "radius", default: "4px", step: 1, unit: "px" },
143
- { id: "radius-lg", cssVar: "--radius-lg", label: "radius-lg", group: "radius", default: "8px", step: 1, unit: "px" },
144
- {
145
- id: "radius-full",
146
- cssVar: "--radius-full",
147
- label: "radius-full",
148
- group: "radius",
149
- default: "9999px",
150
- step: 1,
151
- unit: "px",
152
- pill: { value: "9999px", customDefault: "16px" },
153
- },
154
-
155
- // --- Transitions ---
156
- {
157
- id: "default-transition-duration",
158
- cssVar: "--default-transition-duration",
159
- label: "default-transition-duration",
160
- group: "transition",
161
- default: "150ms",
162
- step: 10,
163
- unit: "ms",
164
- },
165
- ];
166
-
167
- /**
168
- * Color tokens — kept as an empty array for back-compat with the consumer
169
- * serde, which historically iterated `COLOR_TOKENS` symmetric with the other
170
- * three arrays. Color is cluster-driven in zudo-doc and is constructed in
171
- * `design-token-panel-config.ts` from `colorSchemes` + `SEMANTIC_*` —
172
- * not from this array.
173
- */
174
- export const COLOR_TOKENS: readonly TokenDef[] = [];
@@ -1,30 +0,0 @@
1
- /**
2
- * Production bootstrap for @takazudo/zdtp (zdtp).
3
- *
4
- * Imported as a side-effect from the body-end islands helper when
5
- * settings.designTokenPanel is truthy. The dynamic import is gated there so
6
- * this module is only bundled when the feature is enabled.
7
- *
8
- * The wiring MECHANISM (configurePanel + setLifecycleAdapter + the mode-scoped
9
- * reconfigure) lives in the package at
10
- * `@takazudo/zudo-doc/design-token-panel-bootstrap`. This file passes the
11
- * project's PanelConfig DATA to that mechanism.
12
- *
13
- * We pass the `buildDesignTokenPanelConfig` BUILDER (not the plain
14
- * `designTokenPanelConfig` object) so the bootstrap rebuilds the panel per
15
- * light/dark mode on every `color-scheme-changed` toggle — keeping the Color
16
- * tab's semantic defaults mode-faithful. A plain-config caller also works (see
17
- * `bootstrapDesignTokenPanel`'s JSDoc) but gets no toggle listener.
18
- *
19
- * S9a package-first migration — zudolab/zudo-doc#2333.
20
- *
21
- * CSS is pulled via `@import "@takazudo/zdtp/styles.css"` in
22
- * src/styles/global.css so the panel chrome lands in the main page CSS bundle
23
- * (not a deferred chunk). Vite library mode strips the source CSS import from
24
- * the emitted JS, so the explicit CSS-side import is the required pull point.
25
- */
26
-
27
- import { bootstrapDesignTokenPanel } from "@takazudo/zudo-doc/design-token-panel-bootstrap";
28
- import { buildDesignTokenPanelConfig } from "@/config/design-token-panel-config";
29
-
30
- bootstrapDesignTokenPanel(buildDesignTokenPanelConfig);
@@ -1,10 +0,0 @@
1
- "use client";
2
-
3
- // Re-export stub for the DocHistory island.
4
- //
5
- // The real component now ships in the package at
6
- // @takazudo/zudo-doc/doc-history (epic #2344, S4).
7
- // pages/lib/_doc-history-area.tsx imports directly from there, so this
8
- // file is only kept as a stable re-export in case any project-local code
9
- // references the @/components/doc-history path.
10
- export { DocHistory } from "@takazudo/zudo-doc/doc-history";