create-zudo-doc 0.1.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 (212) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +146 -0
  3. package/bin/create-zudo-doc.js +2 -0
  4. package/dist/api.d.ts +20 -0
  5. package/dist/api.js +13 -0
  6. package/dist/claude-md-gen.d.ts +2 -0
  7. package/dist/claude-md-gen.js +113 -0
  8. package/dist/cli.d.ts +39 -0
  9. package/dist/cli.js +157 -0
  10. package/dist/compose.d.ts +95 -0
  11. package/dist/compose.js +206 -0
  12. package/dist/constants.d.ts +20 -0
  13. package/dist/constants.js +224 -0
  14. package/dist/features/body-foot-util.d.ts +10 -0
  15. package/dist/features/body-foot-util.js +12 -0
  16. package/dist/features/claude-resources.d.ts +2 -0
  17. package/dist/features/claude-resources.js +6 -0
  18. package/dist/features/design-token-panel.d.ts +14 -0
  19. package/dist/features/design-token-panel.js +27 -0
  20. package/dist/features/doc-history.d.ts +9 -0
  21. package/dist/features/doc-history.js +11 -0
  22. package/dist/features/doc-tags.d.ts +19 -0
  23. package/dist/features/doc-tags.js +33 -0
  24. package/dist/features/footer-taglist.d.ts +14 -0
  25. package/dist/features/footer-taglist.js +17 -0
  26. package/dist/features/footer.d.ts +8 -0
  27. package/dist/features/footer.js +10 -0
  28. package/dist/features/i18n.d.ts +22 -0
  29. package/dist/features/i18n.js +41 -0
  30. package/dist/features/image-enlarge.d.ts +11 -0
  31. package/dist/features/image-enlarge.js +13 -0
  32. package/dist/features/index.d.ts +15 -0
  33. package/dist/features/index.js +53 -0
  34. package/dist/features/llms-txt.d.ts +11 -0
  35. package/dist/features/llms-txt.js +13 -0
  36. package/dist/features/search.d.ts +9 -0
  37. package/dist/features/search.js +11 -0
  38. package/dist/features/sidebar-resizer.d.ts +14 -0
  39. package/dist/features/sidebar-resizer.js +16 -0
  40. package/dist/features/sidebar-toggle.d.ts +13 -0
  41. package/dist/features/sidebar-toggle.js +15 -0
  42. package/dist/features/tag-governance.d.ts +14 -0
  43. package/dist/features/tag-governance.js +16 -0
  44. package/dist/features/tauri-dev.d.ts +2 -0
  45. package/dist/features/tauri-dev.js +25 -0
  46. package/dist/features/tauri.d.ts +11 -0
  47. package/dist/features/tauri.js +52 -0
  48. package/dist/features/versioning.d.ts +27 -0
  49. package/dist/features/versioning.js +43 -0
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +150 -0
  52. package/dist/preset.d.ts +37 -0
  53. package/dist/preset.js +156 -0
  54. package/dist/prompts.d.ts +32 -0
  55. package/dist/prompts.js +248 -0
  56. package/dist/scaffold.d.ts +4 -0
  57. package/dist/scaffold.js +344 -0
  58. package/dist/settings-gen.d.ts +2 -0
  59. package/dist/settings-gen.js +237 -0
  60. package/dist/utils.d.ts +8 -0
  61. package/dist/utils.js +34 -0
  62. package/dist/zfb-config-gen.d.ts +19 -0
  63. package/dist/zfb-config-gen.js +222 -0
  64. package/package.json +65 -0
  65. package/templates/base/.htmlvalidate.json +5 -0
  66. package/templates/base/.zfb/doc-history-meta.json +1 -0
  67. package/templates/base/pages/404.tsx +55 -0
  68. package/templates/base/pages/_data.ts +179 -0
  69. package/templates/base/pages/_mdx-components.ts +249 -0
  70. package/templates/base/pages/docs/[...slug].tsx +448 -0
  71. package/templates/base/pages/index.tsx +158 -0
  72. package/templates/base/pages/lib/_body-end-islands.tsx +201 -0
  73. package/templates/base/pages/lib/_category-nav.tsx +148 -0
  74. package/templates/base/pages/lib/_category-tree-nav.tsx +104 -0
  75. package/templates/base/pages/lib/_compose-meta-title.ts +29 -0
  76. package/templates/base/pages/lib/_details.tsx +30 -0
  77. package/templates/base/pages/lib/_doc-history-area.tsx +178 -0
  78. package/templates/base/pages/lib/_doc-metainfo-area.tsx +100 -0
  79. package/templates/base/pages/lib/_doc-tags-area.tsx +89 -0
  80. package/templates/base/pages/lib/_extract-headings.ts +81 -0
  81. package/templates/base/pages/lib/_footer-with-defaults.tsx +234 -0
  82. package/templates/base/pages/lib/_frontmatter-preview-data.ts +53 -0
  83. package/templates/base/pages/lib/_head-with-defaults.tsx +113 -0
  84. package/templates/base/pages/lib/_header-with-defaults.tsx +386 -0
  85. package/templates/base/pages/lib/_inline-version-switcher.tsx +84 -0
  86. package/templates/base/pages/lib/_math-block.tsx +63 -0
  87. package/templates/base/pages/lib/_nav-source-docs.ts +68 -0
  88. package/templates/base/pages/lib/_preset-generator.tsx +81 -0
  89. package/templates/base/pages/lib/_search-widget-script.ts +388 -0
  90. package/templates/base/pages/lib/_search-widget.tsx +196 -0
  91. package/templates/base/pages/lib/_sidebar-with-defaults.tsx +176 -0
  92. package/templates/base/pages/lib/_site-tree-nav.tsx +128 -0
  93. package/templates/base/pages/lib/locale-merge.ts +58 -0
  94. package/templates/base/pages/lib/route-enumerators.ts +302 -0
  95. package/templates/base/pages/sitemap.xml.tsx +51 -0
  96. package/templates/base/plugins/connect-adapter.mjs +144 -0
  97. package/templates/base/plugins/copy-public-plugin.mjs +50 -0
  98. package/templates/base/plugins/search-index-plugin.mjs +54 -0
  99. package/templates/base/scripts/run-b4push.sh +102 -0
  100. package/templates/base/src/components/ai-chat-modal.tsx +15 -0
  101. package/templates/base/src/components/client-router-bootstrap.tsx +14 -0
  102. package/templates/base/src/components/content/component-map.ts +25 -0
  103. package/templates/base/src/components/content/content-blockquote.tsx +16 -0
  104. package/templates/base/src/components/content/content-code.tsx +117 -0
  105. package/templates/base/src/components/content/content-link.tsx +83 -0
  106. package/templates/base/src/components/content/content-ol.tsx +19 -0
  107. package/templates/base/src/components/content/content-paragraph.tsx +10 -0
  108. package/templates/base/src/components/content/content-strong.tsx +16 -0
  109. package/templates/base/src/components/content/content-table.tsx +18 -0
  110. package/templates/base/src/components/content/content-ul.tsx +18 -0
  111. package/templates/base/src/components/content/heading-h2.tsx +26 -0
  112. package/templates/base/src/components/content/heading-h3.tsx +26 -0
  113. package/templates/base/src/components/content/heading-h4.tsx +26 -0
  114. package/templates/base/src/components/design-token-panel-bootstrap.tsx +15 -0
  115. package/templates/base/src/components/desktop-sidebar-toggle.tsx +15 -0
  116. package/templates/base/src/components/doc-history.tsx +18 -0
  117. package/templates/base/src/components/html-preview/highlighted-code.tsx +74 -0
  118. package/templates/base/src/components/html-preview/html-preview.tsx +108 -0
  119. package/templates/base/src/components/html-preview/preflight.ts +112 -0
  120. package/templates/base/src/components/html-preview/preview-base.tsx +159 -0
  121. package/templates/base/src/components/image-enlarge.tsx +19 -0
  122. package/templates/base/src/components/mobile-toc.tsx +94 -0
  123. package/templates/base/src/components/preset-generator.tsx +14 -0
  124. package/templates/base/src/components/sidebar-toggle.tsx +98 -0
  125. package/templates/base/src/components/sidebar-tree.tsx +543 -0
  126. package/templates/base/src/components/site-tree-nav.tsx +233 -0
  127. package/templates/base/src/components/theme-toggle.tsx +93 -0
  128. package/templates/base/src/components/toc.tsx +63 -0
  129. package/templates/base/src/components/tree-nav-shared.tsx +71 -0
  130. package/templates/base/src/config/color-scheme-utils.ts +182 -0
  131. package/templates/base/src/config/color-schemes.ts +128 -0
  132. package/templates/base/src/config/frontmatter-preview-defaults.ts +24 -0
  133. package/templates/base/src/config/frontmatter-preview-renderers.tsx +46 -0
  134. package/templates/base/src/config/i18n.ts +225 -0
  135. package/templates/base/src/config/settings-types.ts +162 -0
  136. package/templates/base/src/config/sidebars.ts +66 -0
  137. package/templates/base/src/config/tag-vocabulary-types.ts +39 -0
  138. package/templates/base/src/config/tag-vocabulary.ts +20 -0
  139. package/templates/base/src/hooks/use-active-heading.ts +133 -0
  140. package/templates/base/src/plugins/docs-source-map.ts +103 -0
  141. package/templates/base/src/plugins/hast-utils.ts +10 -0
  142. package/templates/base/src/plugins/rehype-code-title.ts +50 -0
  143. package/templates/base/src/plugins/rehype-heading-links.ts +53 -0
  144. package/templates/base/src/plugins/rehype-image-enlarge.ts +113 -0
  145. package/templates/base/src/plugins/rehype-mermaid.ts +41 -0
  146. package/templates/base/src/plugins/rehype-strip-md-extension.ts +58 -0
  147. package/templates/base/src/plugins/remark-admonitions.ts +99 -0
  148. package/templates/base/src/plugins/remark-resolve-markdown-links.ts +127 -0
  149. package/templates/base/src/plugins/url-utils.ts +4 -0
  150. package/templates/base/src/styles/global.css +1066 -0
  151. package/templates/base/src/types/docs-entry.ts +39 -0
  152. package/templates/base/src/types/heading.ts +5 -0
  153. package/templates/base/src/types/locale.ts +10 -0
  154. package/templates/base/src/utils/base.ts +139 -0
  155. package/templates/base/src/utils/content-files.ts +106 -0
  156. package/templates/base/src/utils/dedent.ts +24 -0
  157. package/templates/base/src/utils/docs.ts +335 -0
  158. package/templates/base/src/utils/git-info.ts +70 -0
  159. package/templates/base/src/utils/github.ts +19 -0
  160. package/templates/base/src/utils/header-right-items.ts +38 -0
  161. package/templates/base/src/utils/nav-scope.ts +63 -0
  162. package/templates/base/src/utils/sidebar.ts +104 -0
  163. package/templates/base/src/utils/slug.ts +10 -0
  164. package/templates/base/src/utils/smart-break.tsx +126 -0
  165. package/templates/base/src/utils/tags.ts +126 -0
  166. package/templates/base/tsconfig.json +36 -0
  167. package/templates/features/bodyFootUtil/files/src/utils/github.ts +19 -0
  168. package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +137 -0
  169. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +34 -0
  170. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +376 -0
  171. package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +93 -0
  172. package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +586 -0
  173. package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +15 -0
  174. package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +99 -0
  175. package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +177 -0
  176. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +50 -0
  177. package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +99 -0
  178. package/templates/features/docHistory/files/src/components/doc-history.tsx +598 -0
  179. package/templates/features/docHistory/files/src/types/doc-history.ts +23 -0
  180. package/templates/features/docHistory/files/src/utils/doc-history.ts +180 -0
  181. package/templates/features/docTags/files/pages/[locale]/docs/tags/[tag].tsx +116 -0
  182. package/templates/features/docTags/files/pages/[locale]/docs/tags/index.tsx +99 -0
  183. package/templates/features/docTags/files/pages/docs/tags/[tag].tsx +101 -0
  184. package/templates/features/docTags/files/pages/docs/tags/index.tsx +86 -0
  185. package/templates/features/i18n/files/pages/[locale]/docs/[...slug].tsx +467 -0
  186. package/templates/features/i18n/files/pages/[locale]/index.tsx +213 -0
  187. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +248 -0
  188. package/templates/features/llmsTxt/files/plugins/llms-txt-plugin.mjs +74 -0
  189. package/templates/features/sidebarResizer/files/src/scripts/sidebar-resizer.ts +185 -0
  190. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +126 -0
  191. package/templates/features/tagGovernance/files/scripts/tags-audit.ts +576 -0
  192. package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +428 -0
  193. package/templates/features/tauri/files/src/components/find-bar.tsx +122 -0
  194. package/templates/features/tauri/files/src/components/find-in-page-init.tsx +53 -0
  195. package/templates/features/tauri/files/src/utils/find-in-page.ts +175 -0
  196. package/templates/features/tauri/files/src-tauri/Cargo.toml +14 -0
  197. package/templates/features/tauri/files/src-tauri/build.rs +3 -0
  198. package/templates/features/tauri/files/src-tauri/capabilities/default.json +11 -0
  199. package/templates/features/tauri/files/src-tauri/src/main.rs +250 -0
  200. package/templates/features/tauri/files/src-tauri/tauri.conf.json +25 -0
  201. package/templates/features/tauriDev/files/src-tauri-dev/Cargo.toml +15 -0
  202. package/templates/features/tauriDev/files/src-tauri-dev/build.rs +3 -0
  203. package/templates/features/tauriDev/files/src-tauri-dev/capabilities/default.json +7 -0
  204. package/templates/features/tauriDev/files/src-tauri-dev/frontend/index.html +187 -0
  205. package/templates/features/tauriDev/files/src-tauri-dev/icons/icon.png +0 -0
  206. package/templates/features/tauriDev/files/src-tauri-dev/src/main.rs +995 -0
  207. package/templates/features/tauriDev/files/src-tauri-dev/tauri.conf.json +22 -0
  208. package/templates/features/tauriDev/files/src-tauri-dev/test-launch.sh +65 -0
  209. package/templates/features/versioning/files/pages/[locale]/docs/versions.tsx +100 -0
  210. package/templates/features/versioning/files/pages/docs/versions.tsx +78 -0
  211. package/templates/features/versioning/files/pages/v/[version]/docs/[...slug].tsx +451 -0
  212. package/templates/features/versioning/files/pages/v/[version]/ja/docs/[...slug].tsx +490 -0
@@ -0,0 +1,177 @@
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", min: 0, max: 3, step: 0.025, unit: "rem" },
34
+ { id: "hsp-xs", cssVar: "--spacing-hsp-xs", label: "hsp-xs", group: "hsp", default: "0.375rem", min: 0, max: 3, step: 0.025, unit: "rem" },
35
+ { id: "hsp-sm", cssVar: "--spacing-hsp-sm", label: "hsp-sm", group: "hsp", default: "0.5rem", min: 0, max: 3, step: 0.025, unit: "rem" },
36
+ { id: "hsp-md", cssVar: "--spacing-hsp-md", label: "hsp-md", group: "hsp", default: "0.75rem", min: 0, max: 3, step: 0.025, unit: "rem" },
37
+ { id: "hsp-lg", cssVar: "--spacing-hsp-lg", label: "hsp-lg", group: "hsp", default: "1rem", min: 0, max: 3, step: 0.025, unit: "rem" },
38
+ { id: "hsp-xl", cssVar: "--spacing-hsp-xl", label: "hsp-xl", group: "hsp", default: "1.5rem", min: 0, max: 3, step: 0.025, unit: "rem" },
39
+ { id: "hsp-2xl", cssVar: "--spacing-hsp-2xl", label: "hsp-2xl", group: "hsp", default: "2rem", min: 0, max: 3, step: 0.025, unit: "rem" },
40
+
41
+ // --- Vertical spacing ---
42
+ { id: "vsp-2xs", cssVar: "--spacing-vsp-2xs", label: "vsp-2xs", group: "vsp", default: "0.4375rem", min: 0, max: 4, step: 0.025, unit: "rem" },
43
+ { id: "vsp-xs", cssVar: "--spacing-vsp-xs", label: "vsp-xs", group: "vsp", default: "0.875rem", min: 0, max: 4, step: 0.025, unit: "rem" },
44
+ { id: "vsp-sm", cssVar: "--spacing-vsp-sm", label: "vsp-sm", group: "vsp", default: "1.25rem", min: 0, max: 4, step: 0.025, unit: "rem" },
45
+ { id: "vsp-md", cssVar: "--spacing-vsp-md", label: "vsp-md", group: "vsp", default: "1.5rem", min: 0, max: 4, step: 0.025, unit: "rem" },
46
+ { id: "vsp-lg", cssVar: "--spacing-vsp-lg", label: "vsp-lg", group: "vsp", default: "1.75rem", min: 0, max: 4, step: 0.025, unit: "rem" },
47
+ { id: "vsp-xl", cssVar: "--spacing-vsp-xl", label: "vsp-xl", group: "vsp", default: "2.5rem", min: 0, max: 4, step: 0.025, unit: "rem" },
48
+ { id: "vsp-2xl", cssVar: "--spacing-vsp-2xl", label: "vsp-2xl", group: "vsp", default: "3.5rem", min: 0, max: 4, step: 0.025, unit: "rem" },
49
+
50
+ // --- Icons ---
51
+ { id: "icon-xs", cssVar: "--spacing-icon-xs", label: "icon-xs", group: "icon", default: "0.75rem", min: 0, max: 2, step: 0.05, unit: "rem" },
52
+ { id: "icon-sm", cssVar: "--spacing-icon-sm", label: "icon-sm", group: "icon", default: "1rem", min: 0, max: 2, step: 0.05, unit: "rem" },
53
+ { id: "icon-md", cssVar: "--spacing-icon-md", label: "icon-md", group: "icon", default: "1.25rem", min: 0, max: 2, step: 0.05, unit: "rem" },
54
+ { id: "icon-lg", cssVar: "--spacing-icon-lg", label: "icon-lg", group: "icon", default: "1.5rem", min: 0, max: 2, step: 0.05, unit: "rem" },
55
+
56
+ // --- Layout ---
57
+ { id: "image-overlay-inset", cssVar: "--spacing-image-overlay-inset", label: "image-overlay-inset", group: "layout", default: "0.5rem", min: 0, max: 2, step: 0.05, unit: "rem" },
58
+ // Structural zero — surfaced as read-only so designers see it exists, but
59
+ // editing it would break every utility that relies on "0 is 0".
60
+ { id: "spacing-0", cssVar: "--spacing-0", label: "spacing-0", group: "layout", default: "0", min: 0, max: 0, step: 1, unit: "", readonly: true },
61
+ // 1px hairline — also read-only by design.
62
+ { id: "spacing-px", cssVar: "--spacing-px", label: "spacing-px", group: "layout", default: "1px", min: 0, max: 0, step: 1, unit: "px", readonly: true },
63
+ // Responsive clamp() expression — can't be expressed on a single slider.
64
+ { id: "sidebar-w", cssVar: "--zd-sidebar-w", label: "sidebar-w", group: "layout", default: "clamp(14rem, 20vw, 22rem)", min: 0, max: 0, step: 1, unit: "", readonly: true },
65
+ ];
66
+
67
+ /**
68
+ * Font tokens from `global.css`.
69
+ *
70
+ * Tier 2 semantic tokens (sizes, line-heights, weights, families) are exposed
71
+ * as primary tiers; Tier 1 abstract scale (`--text-scale-*`) lives in its own
72
+ * `font-scale` tier so designers who tweak the scale see the tokens that the
73
+ * semantic sizes resolve from.
74
+ *
75
+ * (Note: `TokenDef.advanced` was dropped upstream in zdtp 8abb1e4. The
76
+ * progressive-disclosure container is now the tier itself; the
77
+ * panel-config groups by `group` and presents each tier as a separate
78
+ * section under the Font tab.)
79
+ *
80
+ * Defaults here mirror `global.css` resolved rem values (`--text-body` →
81
+ * `1.2rem`) so serde and the flat-`TokenManifest` generator template have a
82
+ * concrete number. The tier-based main panel (`design-token-panel-config.ts`)
83
+ * promotes the `font-size` group to a *reference* tier pointing at
84
+ * `font-scale`, overriding these defaults to the referenced scale id so the
85
+ * panel reflects the `var(--text-scale-*)` wiring the CSS already encodes.
86
+ */
87
+ export const FONT_TOKENS: readonly TokenDef[] = [
88
+ // --- Font sizes (Tier 2 semantic) ---
89
+ { id: "text-micro", cssVar: "--text-micro", label: "text-micro", group: "font-size", default: "0.75rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
90
+ { id: "text-caption", cssVar: "--text-caption", label: "text-caption", group: "font-size", default: "0.875rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
91
+ { id: "text-small", cssVar: "--text-small", label: "text-small", group: "font-size", default: "1rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
92
+ { id: "text-body", cssVar: "--text-body", label: "text-body", group: "font-size", default: "1.2rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
93
+ { id: "text-title", cssVar: "--text-title", label: "text-title", group: "font-size", default: "1.4rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
94
+ { id: "text-heading", cssVar: "--text-heading", label: "text-heading", group: "font-size", default: "3rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
95
+ { id: "text-display", cssVar: "--text-display", label: "text-display", group: "font-size", default: "3.75rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
96
+
97
+ // --- Line heights (unitless) ---
98
+ { id: "leading-tight", cssVar: "--leading-tight", label: "leading-tight", group: "line-height", default: "1.25", min: 1, max: 3, step: 0.05, unit: "" },
99
+ { id: "leading-snug", cssVar: "--leading-snug", label: "leading-snug", group: "line-height", default: "1.375", min: 1, max: 3, step: 0.05, unit: "" },
100
+ { id: "leading-normal", cssVar: "--leading-normal", label: "leading-normal", group: "line-height", default: "1.5", min: 1, max: 3, step: 0.05, unit: "" },
101
+ { id: "leading-relaxed", cssVar: "--leading-relaxed", label: "leading-relaxed", group: "line-height", default: "1.625", min: 1, max: 3, step: 0.05, unit: "" },
102
+
103
+ // --- Font weights (select) ---
104
+ { id: "font-weight-normal", cssVar: "--font-weight-normal", label: "font-weight-normal", group: "font-weight", default: "400", min: 0, max: 0, step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
105
+ { id: "font-weight-medium", cssVar: "--font-weight-medium", label: "font-weight-medium", group: "font-weight", default: "500", min: 0, max: 0, step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
106
+ { id: "font-weight-semibold", cssVar: "--font-weight-semibold", label: "font-weight-semibold", group: "font-weight", default: "600", min: 0, max: 0, step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
107
+ { id: "font-weight-bold", cssVar: "--font-weight-bold", label: "font-weight-bold", group: "font-weight", default: "700", min: 0, max: 0, step: 1, unit: "", control: "select", options: FONT_WEIGHT_OPTIONS },
108
+
109
+ // --- Font families (text input) ---
110
+ { id: "font-sans", cssVar: "--font-sans", label: "font-sans", group: "font-family", default: "system-ui, sans-serif", min: 0, max: 0, step: 1, unit: "", control: "text" },
111
+ { id: "font-mono", cssVar: "--font-mono", label: "font-mono", group: "font-family", default: "ui-monospace, monospace", min: 0, max: 0, step: 1, unit: "", control: "text" },
112
+
113
+ // --- Tier 1 abstract scale (was "Advanced" disclosure in v1 of the panel;
114
+ // now lives in its own font-scale tier). ---
115
+ { id: "text-scale-2xs", cssVar: "--text-scale-2xs", label: "text-scale-2xs", group: "font-scale", default: "0.75rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
116
+ { id: "text-scale-xs", cssVar: "--text-scale-xs", label: "text-scale-xs", group: "font-scale", default: "0.875rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
117
+ { id: "text-scale-sm", cssVar: "--text-scale-sm", label: "text-scale-sm", group: "font-scale", default: "1rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
118
+ { id: "text-scale-md", cssVar: "--text-scale-md", label: "text-scale-md", group: "font-scale", default: "1.2rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
119
+ { id: "text-scale-lg", cssVar: "--text-scale-lg", label: "text-scale-lg", group: "font-scale", default: "1.4rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
120
+ { id: "text-scale-xl", cssVar: "--text-scale-xl", label: "text-scale-xl", group: "font-scale", default: "3rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
121
+ { id: "text-scale-2xl", cssVar: "--text-scale-2xl", label: "text-scale-2xl", group: "font-scale", default: "3.75rem", min: 0.5, max: 5, step: 0.05, unit: "rem" },
122
+ ];
123
+
124
+ /**
125
+ * Size tokens from `global.css`.
126
+ *
127
+ * Coverage (audit 2026-04): every non-breakpoint size-category custom property.
128
+ * Breakpoints (`--breakpoint-sm/lg/xl`) are intentionally omitted — live-
129
+ * changing them causes layout thrash mid-drag and adds no real tweak value.
130
+ *
131
+ * Radius defaults use `px` (matches the 0–100 slider in the sub-issue spec),
132
+ * even though `global.css` expresses them in `rem` — the browser accepts both.
133
+ *
134
+ * `--radius-full` is special: its design default (`9999px`) is an intentional
135
+ * sentinel that a 0–100 slider can't reach, so it carries a `pill` toggle. The
136
+ * checkbox reapplies the sentinel; unchecking drops back to a slider-editable
137
+ * custom value.
138
+ */
139
+ export const SIZE_TOKENS: readonly TokenDef[] = [
140
+ // --- Radius ---
141
+ { id: "radius-DEFAULT", cssVar: "--radius-DEFAULT", label: "radius-DEFAULT", group: "radius", default: "4px", min: 0, max: 100, step: 1, unit: "px" },
142
+ { id: "radius-lg", cssVar: "--radius-lg", label: "radius-lg", group: "radius", default: "8px", min: 0, max: 100, step: 1, unit: "px" },
143
+ {
144
+ id: "radius-full",
145
+ cssVar: "--radius-full",
146
+ label: "radius-full",
147
+ group: "radius",
148
+ default: "9999px",
149
+ min: 0,
150
+ max: 100,
151
+ step: 1,
152
+ unit: "px",
153
+ pill: { value: "9999px", customDefault: "16px" },
154
+ },
155
+
156
+ // --- Transitions ---
157
+ {
158
+ id: "default-transition-duration",
159
+ cssVar: "--default-transition-duration",
160
+ label: "default-transition-duration",
161
+ group: "transition",
162
+ default: "150ms",
163
+ min: 0,
164
+ max: 1000,
165
+ step: 10,
166
+ unit: "ms",
167
+ },
168
+ ];
169
+
170
+ /**
171
+ * Color tokens — kept as an empty array for back-compat with the consumer
172
+ * serde, which historically iterated `COLOR_TOKENS` symmetric with the other
173
+ * three arrays. Color is cluster-driven in zudo-doc and is constructed in
174
+ * `design-token-panel-config.ts` from `colorSchemes` + `SEMANTIC_*` —
175
+ * not from this array.
176
+ */
177
+ export const COLOR_TOKENS: readonly TokenDef[] = [];
@@ -0,0 +1,50 @@
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 (or the deprecated alias colorTweakPanel) is
6
+ * truthy. The dynamic import is gated there so this module is only bundled
7
+ * when the feature is enabled.
8
+ *
9
+ * Lifecycle bridge: zdtp hard-codes astro:before-swap / astro:page-load
10
+ * event names (upstream issue Takazudo/zudo-design-token-panel#50). We
11
+ * re-dispatch those Astro event names whenever the zfb equivalents fire so
12
+ * zdtp's internal listeners receive the signal they expect. Replace this
13
+ * bridge with setLifecycleAdapter() once upstream issue #50 ships.
14
+ */
15
+
16
+ import { configurePanel } from "@takazudo/zdtp";
17
+ // CSS is pulled via `@import "@takazudo/zdtp/styles.css"` in
18
+ // src/styles/global.css so the panel chrome lands in the main page CSS bundle
19
+ // (not a deferred chunk). Vite library mode strips the source CSS import from
20
+ // the emitted JS, so the explicit CSS-side import is the required pull point.
21
+ import { designTokenPanelConfig } from "@/config/design-token-panel-config";
22
+
23
+ configurePanel(designTokenPanelConfig);
24
+
25
+ // Drain the pre-hydration click queue. If the user clicked the palette button
26
+ // before this module evaluated, a pre-hydration shim captured the event as a
27
+ // single boolean flag. Calling __zdtpReadyClicks() here removes the shim
28
+ // listener and re-dispatches once (at most) so the now-registered zdtp
29
+ // listener picks it up and mounts the panel.
30
+ if (typeof window !== "undefined") {
31
+ (window as { __zdtpReadyClicks?: () => void }).__zdtpReadyClicks?.();
32
+ }
33
+
34
+ // Idempotency guard: the two document.addEventListener calls below must be
35
+ // installed at most once per page lifecycle. Module caching usually guarantees
36
+ // this, but a future refactor could re-evaluate the module. The flag makes it
37
+ // provably one-shot.
38
+ // zfb fires "zfb:before-preparation" (before nav) and "zfb:after-swap" (after nav).
39
+ // Adjust these event names if your zfb version uses different names.
40
+ if (typeof document !== "undefined") {
41
+ if (!(document as Document & { __zdtpAstroBridgeInstalled?: boolean }).__zdtpAstroBridgeInstalled) {
42
+ (document as Document & { __zdtpAstroBridgeInstalled?: boolean }).__zdtpAstroBridgeInstalled = true;
43
+ document.addEventListener("zfb:before-preparation", () => {
44
+ document.dispatchEvent(new Event("astro:before-swap"));
45
+ });
46
+ document.addEventListener("zfb:after-swap", () => {
47
+ document.dispatchEvent(new Event("astro:page-load"));
48
+ });
49
+ }
50
+ }
@@ -0,0 +1,99 @@
1
+ // zfb plugin module: doc-history.
2
+ //
3
+ // Wires three lifecycle hooks for the doc-history integration:
4
+ //
5
+ // preBuild — emits `.zfb/doc-history-meta.json` (per-page git metadata
6
+ // consumed at bundle time). Uses the tsx-e shim because the
7
+ // runner imports Node-only modules (`fs`, `child_process`) and
8
+ // TypeScript source that the plain-Node plugin host cannot load
9
+ // directly. Honours `SKIP_DOC_HISTORY=1` via `env: process.env`.
10
+ //
11
+ // postBuild — invokes `runDocHistoryPostBuild` to write
12
+ // `<outDir>/doc-history/<slug>.json` files. Also honours
13
+ // `SKIP_DOC_HISTORY=1` (the runner returns early when set).
14
+ //
15
+ // devMiddleware — reverse-proxies `/doc-history/*` requests to the
16
+ // standalone `@takazudo/zudo-doc-history-server` on port 4322.
17
+ //
18
+ // Inline functions are not supported by zfb's plugin runtime — see
19
+ // `@takazudo/zfb/plugins` source comment. Plugins must be authored as
20
+ // standalone modules and referenced from `zfb.config.ts` by `name`.
21
+ //
22
+ // The legacy `scripts/zfb-{pre,post}build.mjs` npm-script glue and
23
+ // `scripts/dev-sidecar.mjs` stay in place during the merge window;
24
+ // T6 retires them once all lifecycle epics land.
25
+
26
+ import { spawnSync } from "node:child_process";
27
+ import { fileURLToPath } from "node:url";
28
+ import { dirname, resolve } from "node:path";
29
+
30
+ import { runDocHistoryPostBuild } from "@takazudo/zudo-doc/integrations/doc-history";
31
+ import { createDocHistoryDevMiddleware } from "@takazudo/zudo-doc/integrations/doc-history";
32
+ import { connectToZfbHandler } from "./connect-adapter.mjs";
33
+
34
+ const HERE = dirname(fileURLToPath(import.meta.url));
35
+ // tsx is a workspace dep; resolving the binary explicitly avoids PATH
36
+ // dependency — the plugin host is spawned by zfb without the user's shell profile.
37
+ const TSX_BIN = resolve(HERE, "..", "node_modules", ".bin", "tsx");
38
+
39
+ export default {
40
+ name: "doc-history",
41
+
42
+ async preBuild(ctx) {
43
+ const { docsDir, locales } = ctx.options;
44
+ // Serialize options as JSON for the tsx-e inline script. The runner
45
+ // (`runDocHistoryMetaStep`) honours SKIP_DOC_HISTORY=1 internally;
46
+ // passing `env: process.env` propagates the flag to the child process.
47
+ const optsJson = JSON.stringify({
48
+ projectRoot: ctx.projectRoot,
49
+ docsDir: typeof docsDir === "string" ? docsDir : "src/content/docs",
50
+ locales: locales ?? {},
51
+ });
52
+ const script = `
53
+ (async () => {
54
+ const { runDocHistoryMetaStep } = await import("@takazudo/zudo-doc/integrations/doc-history");
55
+ const opts = ${optsJson};
56
+ await runDocHistoryMetaStep(opts);
57
+ })().catch((err) => {
58
+ process.stderr.write(err && err.stack ? err.stack : String(err));
59
+ process.exit(1);
60
+ });
61
+ `;
62
+ const result = spawnSync(TSX_BIN, ["-e", script], {
63
+ cwd: ctx.projectRoot,
64
+ stdio: "inherit",
65
+ env: process.env,
66
+ });
67
+ if (result.status !== 0) {
68
+ throw new Error(
69
+ `doc-history-meta preBuild failed (exit ${result.status})`,
70
+ );
71
+ }
72
+ },
73
+
74
+ async postBuild(ctx) {
75
+ const { docsDir, locales } = ctx.options;
76
+ await runDocHistoryPostBuild(
77
+ { docsDir, locales },
78
+ { outDir: ctx.outDir, logger: ctx.logger },
79
+ );
80
+ },
81
+
82
+ devMiddleware(ctx) {
83
+ const middleware = createDocHistoryDevMiddleware(ctx.options, ctx.logger);
84
+ // zfb's `register(path, handler)` matches against the FULL request
85
+ // URL (no base-stripping). For a non-root base (e.g. "/my-docs/"),
86
+ // requests arrive as `/my-docs/doc-history/foo.json`, so we register
87
+ // at the full base-prefixed route. For base="/", the prefix is empty
88
+ // and the route is `/doc-history` as expected. The v2 middleware
89
+ // itself is base-tolerant (matches via `url.includes("/doc-history/")`)
90
+ // and slices from `/doc-history/` onward when proxying upstream.
91
+ const basePrefix = stripTrailingSlash(ctx.options.base ?? "");
92
+ ctx.register(`${basePrefix}/doc-history`, connectToZfbHandler(middleware));
93
+ },
94
+ };
95
+
96
+ function stripTrailingSlash(s) {
97
+ if (typeof s !== "string" || s.length === 0) return "";
98
+ return s.endsWith("/") ? s.slice(0, -1) : s;
99
+ }