@takazudo/zudo-doc 3.3.0 → 4.0.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 (417) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/README.md +2 -2
  3. package/bin/tag-cli-config.ts +126 -0
  4. package/bin/tags-audit-runner.ts +60 -76
  5. package/bin/tags-audit.mjs +17 -36
  6. package/bin/tags-suggest-runner.ts +429 -0
  7. package/bin/tags-suggest.mjs +30 -0
  8. package/bin/zudo-doc.mjs +78 -25
  9. package/dist/breadcrumb/breadcrumb.d.ts +4 -4
  10. package/dist/breadcrumb/find-path.d.ts +2 -2
  11. package/dist/breadcrumb/index.d.ts +1 -1
  12. package/dist/breadcrumb/types.d.ts +0 -5
  13. package/dist/chrome/derive.d.ts +16 -10
  14. package/dist/chrome/derive.js +53 -4
  15. package/dist/chrome/index.d.ts +13 -10
  16. package/dist/chrome/index.js +12 -6
  17. package/dist/chrome/primary-slots.d.ts +21 -0
  18. package/dist/chrome/primary-slots.js +59 -0
  19. package/dist/chrome-bindings.d.ts +68 -0
  20. package/dist/code-syntax/code-block-enhancer-script.d.ts +4 -0
  21. package/dist/code-syntax/code-block-enhancer-script.js +7 -4
  22. package/dist/code-syntax/code-block-enhancer.d.ts +2 -2
  23. package/dist/code-syntax/code-block-enhancer.js +1 -3
  24. package/dist/code-syntax/index.d.ts +5 -5
  25. package/dist/code-syntax/index.js +4 -13
  26. package/dist/code-syntax/mermaid-init-script.d.ts +1 -22
  27. package/dist/code-syntax/mermaid-init-script.js +0 -2
  28. package/dist/code-syntax/mermaid-init.d.ts +0 -1
  29. package/dist/code-syntax/mermaid-init.js +3 -4
  30. package/dist/code-syntax/tabs-init.d.ts +0 -1
  31. package/dist/code-syntax/tabs-init.js +1 -3
  32. package/dist/code-syntax/tabs.d.ts +0 -1
  33. package/dist/code-syntax/tabs.js +1 -3
  34. package/dist/color-scheme-utils.d.ts +71 -3
  35. package/dist/color-scheme-utils.js +137 -0
  36. package/dist/color-schemes-defaults/index.js +13 -0
  37. package/dist/config.d.ts +28 -12
  38. package/dist/config.js +11 -2
  39. package/dist/content/component-map.d.ts +0 -16
  40. package/dist/content/component-map.js +2 -4
  41. package/dist/content/index.d.ts +1 -1
  42. package/dist/content/index.js +2 -3
  43. package/dist/content.css +1 -1
  44. package/dist/design-token-panel-bootstrap.d.ts +45 -40
  45. package/dist/design-token-panel-bootstrap.js +98 -21
  46. package/dist/design-token-panel-config/index.js +1 -4
  47. package/dist/doc-body-end-islands/design-token-panel-island.d.ts +15 -0
  48. package/dist/doc-body-end-islands/design-token-panel-island.js +31 -0
  49. package/dist/doc-body-end-islands/index.d.ts +39 -17
  50. package/dist/doc-body-end-islands/index.js +13 -21
  51. package/dist/doc-body-end-islands/theme-pack-switcher-island.d.ts +37 -0
  52. package/dist/doc-body-end-islands/theme-pack-switcher-island.js +18 -0
  53. package/dist/doc-content-header/index.js +1 -1
  54. package/dist/doc-history-area/index.d.ts +10 -4
  55. package/dist/doc-history-area/index.js +3 -2
  56. package/dist/doc-metainfo-area/index.d.ts +1 -0
  57. package/dist/doc-page-props/index.d.ts +7 -23
  58. package/dist/doc-page-renderer/index.d.ts +1 -0
  59. package/dist/doc-page-renderer/index.js +1 -0
  60. package/dist/doc-page-shell/index.js +19 -12
  61. package/dist/doc-pager/index.js +1 -1
  62. package/dist/doc-route-entries/index.d.ts +2 -2
  63. package/dist/doclayout/doc-layout-with-defaults.js +4 -4
  64. package/dist/doclayout/doc-layout.d.ts +8 -0
  65. package/dist/doclayout/doc-layout.js +10 -1
  66. package/dist/docs-schema/index.js +1 -5
  67. package/dist/eject/index.d.ts +16 -0
  68. package/dist/eject/index.js +122 -28
  69. package/dist/extract-headings/index.d.ts +5 -8
  70. package/dist/extract-headings/index.js +2 -9
  71. package/dist/factory-context/index.d.ts +42 -4
  72. package/dist/features.css +55 -43
  73. package/dist/footer/footer.js +1 -0
  74. package/dist/head-with-defaults/index.d.ts +2 -0
  75. package/dist/head-with-defaults/index.js +16 -0
  76. package/dist/header/header.d.ts +10 -5
  77. package/dist/header/header.js +45 -5
  78. package/dist/header/index.d.ts +1 -1
  79. package/dist/header/types.d.ts +30 -1
  80. package/dist/header-with-defaults/index.js +1 -0
  81. package/dist/home-page/index.d.ts +2 -0
  82. package/dist/home-page/index.js +11 -5
  83. package/dist/home-page/prepare-home-data.js +1 -1
  84. package/dist/locale-merge/index.d.ts +9 -14
  85. package/dist/locale-merge/index.js +6 -4
  86. package/dist/mdx-components/index.js +4 -4
  87. package/dist/plugins/claude-resources.d.ts +1 -0
  88. package/dist/plugins/claude-resources.js +4 -2
  89. package/dist/plugins/doc-history.js +1 -1
  90. package/dist/{integrations → plugins/internal}/claude-resources/index.d.ts +1 -16
  91. package/dist/{integrations → plugins/internal}/claude-resources/index.js +0 -9
  92. package/dist/{integrations → plugins/internal}/doc-history/index.d.ts +0 -17
  93. package/dist/{integrations → plugins/internal}/doc-history/index.js +0 -4
  94. package/dist/{integrations → plugins/internal}/doc-history/pre-build.d.ts +2 -4
  95. package/dist/plugins/internal/llms-txt/index.d.ts +7 -0
  96. package/dist/{integrations → plugins/internal}/llms-txt/load.d.ts +1 -1
  97. package/dist/{integrations → plugins/internal}/llms-txt/load.js +2 -2
  98. package/dist/{integrations → plugins/internal}/llms-txt/strip.d.ts +2 -3
  99. package/dist/{integrations → plugins/internal}/llms-txt/strip.js +1 -1
  100. package/dist/{integrations → plugins/internal}/llms-txt/types.d.ts +13 -22
  101. package/dist/{integrations → plugins/internal}/search-index/collect.js +1 -1
  102. package/dist/plugins/internal/theme-packs/copy.d.ts +32 -0
  103. package/dist/plugins/internal/theme-packs/copy.js +45 -0
  104. package/dist/plugins/internal/theme-packs/dev-middleware.d.ts +22 -0
  105. package/dist/plugins/internal/theme-packs/dev-middleware.js +80 -0
  106. package/dist/plugins/internal/theme-packs/index.d.ts +6 -0
  107. package/dist/plugins/internal/theme-packs/index.js +9 -0
  108. package/dist/plugins/internal/theme-packs/resolve.d.ts +17 -0
  109. package/dist/plugins/internal/theme-packs/resolve.js +17 -0
  110. package/dist/plugins/internal/theme-packs/types.d.ts +22 -0
  111. package/dist/plugins/internal/theme-packs/types.js +0 -0
  112. package/dist/plugins/llms-txt.js +1 -1
  113. package/dist/plugins/routes.js +11 -1
  114. package/dist/plugins/search-index.js +1 -1
  115. package/dist/plugins/theme-packs.d.ts +3 -0
  116. package/dist/plugins/theme-packs.js +40 -0
  117. package/dist/preset.d.ts +19 -14
  118. package/dist/preset.js +24 -9
  119. package/dist/route-context/index.js +4 -6
  120. package/dist/route-enumerators/index.d.ts +6 -18
  121. package/dist/route-enumerators/index.js +8 -6
  122. package/dist/routes/404.js +3 -1
  123. package/dist/routes/_chrome.js +2 -2
  124. package/dist/routes/_context.d.ts +7 -3
  125. package/dist/routes/_context.js +2 -0
  126. package/dist/routes/_docs-helpers.js +9 -21
  127. package/dist/safelist.css +1 -1
  128. package/dist/settings.d.ts +27 -12
  129. package/dist/sidebar-tree/build-tree.d.ts +3 -4
  130. package/dist/sidebar-tree/build-tree.js +4 -3
  131. package/dist/sidebar-tree/index.d.ts +2 -2
  132. package/dist/sidebar-tree/types.d.ts +6 -17
  133. package/dist/site-tree-nav-island/index.d.ts +3 -1
  134. package/dist/site-tree-nav-island/index.js +17 -5
  135. package/dist/site-tree-nav-island/state.d.ts +4 -0
  136. package/dist/site-tree-nav-island/state.js +10 -0
  137. package/dist/tag-helpers/index.d.ts +6 -13
  138. package/dist/tag-helpers/index.js +5 -23
  139. package/dist/tag-pages/index.d.ts +8 -21
  140. package/dist/tag-pages/index.js +14 -10
  141. package/dist/tags-audit.d.ts +16 -44
  142. package/dist/tags-audit.js +9 -172
  143. package/dist/theme/color-scheme-provider.d.ts +2 -3
  144. package/dist/theme/color-scheme-provider.js +2 -10
  145. package/dist/theme/index.d.ts +1 -4
  146. package/dist/theme/index.js +2 -30
  147. package/dist/theme/theme-pack-provider.d.ts +42 -0
  148. package/dist/theme/theme-pack-provider.js +75 -0
  149. package/dist/theme-cli/apply.d.ts +16 -0
  150. package/dist/theme-cli/apply.js +61 -0
  151. package/dist/theme-cli/config-io.d.ts +15 -0
  152. package/dist/theme-cli/config-io.js +51 -0
  153. package/dist/theme-cli/config-rewriter.d.ts +21 -0
  154. package/dist/theme-cli/config-rewriter.js +141 -0
  155. package/dist/theme-cli/config-scanner.d.ts +63 -0
  156. package/dist/theme-cli/config-scanner.js +288 -0
  157. package/dist/theme-cli/index.d.ts +7 -0
  158. package/dist/theme-cli/index.js +38 -0
  159. package/dist/theme-cli/list.d.ts +27 -0
  160. package/dist/theme-cli/list.js +64 -0
  161. package/dist/theme-cli/provenance.d.ts +17 -0
  162. package/dist/theme-cli/provenance.js +35 -0
  163. package/dist/theme-cli/registry.d.ts +14 -0
  164. package/dist/theme-cli/registry.js +13 -0
  165. package/dist/theme-pack-dialog/dialog-state.d.ts +25 -0
  166. package/dist/theme-pack-dialog/dialog-state.js +40 -0
  167. package/dist/theme-pack-dialog/index.d.ts +5 -0
  168. package/dist/theme-pack-dialog/index.js +152 -0
  169. package/dist/theme-pack-dialog/theme-pack-card.d.ts +25 -0
  170. package/dist/theme-pack-dialog/theme-pack-card.js +72 -0
  171. package/dist/theme-pack-switcher/index.d.ts +49 -0
  172. package/dist/theme-pack-switcher/index.js +205 -0
  173. package/dist/theme-pack-switcher/switcher-state.d.ts +56 -0
  174. package/dist/theme-pack-switcher/switcher-state.js +43 -0
  175. package/dist/theme-pack-switcher/theme-pack-sync.d.ts +85 -0
  176. package/dist/theme-pack-switcher/theme-pack-sync.js +121 -0
  177. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-400-latin.woff2 +0 -0
  178. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-700-latin.woff2 +0 -0
  179. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-italic-400-latin.woff2 +0 -0
  180. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegible-italic-700-latin.woff2 +0 -0
  181. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegibleMono-italic-latin.woff2 +0 -0
  182. package/dist/theme-packs/beacon/fonts/AtkinsonHyperlegibleMono-latin.woff2 +0 -0
  183. package/dist/theme-packs/beacon/fonts/OFL.txt +94 -0
  184. package/dist/theme-packs/beacon/meta.json +37 -0
  185. package/dist/theme-packs/beacon/pack.css +442 -0
  186. package/dist/theme-packs/broadsheet/fonts/CourierPrime-400-latin.woff2 +0 -0
  187. package/dist/theme-packs/broadsheet/fonts/CourierPrime-700-latin.woff2 +0 -0
  188. package/dist/theme-packs/broadsheet/fonts/OFL.txt +95 -0
  189. package/dist/theme-packs/broadsheet/fonts/PlayfairDisplay-italic-latin.woff2 +0 -0
  190. package/dist/theme-packs/broadsheet/fonts/PlayfairDisplay-latin.woff2 +0 -0
  191. package/dist/theme-packs/broadsheet/fonts/SourceSerif4-italic-latin.woff2 +0 -0
  192. package/dist/theme-packs/broadsheet/fonts/SourceSerif4-latin.woff2 +0 -0
  193. package/dist/theme-packs/broadsheet/meta.json +38 -0
  194. package/dist/theme-packs/broadsheet/pack.css +448 -0
  195. package/dist/theme-packs/brutalist/fonts/ArchivoBlack-latin.woff2 +0 -0
  196. package/dist/theme-packs/brutalist/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  197. package/dist/theme-packs/brutalist/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  198. package/dist/theme-packs/brutalist/fonts/IBMPlexMono-700-latin.woff2 +0 -0
  199. package/dist/theme-packs/brutalist/fonts/OFL.txt +95 -0
  200. package/dist/theme-packs/brutalist/fonts/SpaceGrotesk-latin.woff2 +0 -0
  201. package/dist/theme-packs/brutalist/meta.json +38 -0
  202. package/dist/theme-packs/brutalist/pack.css +546 -0
  203. package/dist/theme-packs/default/meta.json +37 -0
  204. package/dist/theme-packs/drift/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  205. package/dist/theme-packs/drift/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  206. package/dist/theme-packs/drift/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  207. package/dist/theme-packs/drift/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  208. package/dist/theme-packs/drift/fonts/IBMPlexSans-italic-latin.woff2 +0 -0
  209. package/dist/theme-packs/drift/fonts/IBMPlexSans-latin-ext.woff2 +0 -0
  210. package/dist/theme-packs/drift/fonts/IBMPlexSans-latin.woff2 +0 -0
  211. package/dist/theme-packs/drift/fonts/OFL.txt +93 -0
  212. package/dist/theme-packs/drift/meta.json +37 -0
  213. package/dist/theme-packs/drift/pack.css +478 -0
  214. package/dist/theme-packs/fjord/fonts/Inter-latin-ext.woff2 +0 -0
  215. package/dist/theme-packs/fjord/fonts/Inter-latin.woff2 +0 -0
  216. package/dist/theme-packs/fjord/fonts/JetBrainsMono-latin-ext.woff2 +0 -0
  217. package/dist/theme-packs/fjord/fonts/JetBrainsMono-latin.woff2 +0 -0
  218. package/dist/theme-packs/fjord/fonts/OFL.txt +94 -0
  219. package/dist/theme-packs/fjord/meta.json +37 -0
  220. package/dist/theme-packs/fjord/pack.css +375 -0
  221. package/dist/theme-packs/foundry/fonts/Inter-latin-ext.woff2 +0 -0
  222. package/dist/theme-packs/foundry/fonts/Inter-latin.woff2 +0 -0
  223. package/dist/theme-packs/foundry/fonts/OFL.txt +93 -0
  224. package/dist/theme-packs/foundry/meta.json +37 -0
  225. package/dist/theme-packs/foundry/pack.css +202 -0
  226. package/dist/theme-packs/futura-editorial/fonts/Jost-latin.woff2 +0 -0
  227. package/dist/theme-packs/futura-editorial/fonts/NotoSans-italic-latin.woff2 +0 -0
  228. package/dist/theme-packs/futura-editorial/fonts/NotoSans-latin.woff2 +0 -0
  229. package/dist/theme-packs/futura-editorial/fonts/OFL.txt +95 -0
  230. package/dist/theme-packs/futura-editorial/fonts/SpaceMono-400-latin.woff2 +0 -0
  231. package/dist/theme-packs/futura-editorial/fonts/SpaceMono-700-latin.woff2 +0 -0
  232. package/dist/theme-packs/futura-editorial/meta.json +38 -0
  233. package/dist/theme-packs/futura-editorial/pack.css +313 -0
  234. package/dist/theme-packs/hearth/fonts/Fraunces-italic-latin.woff2 +0 -0
  235. package/dist/theme-packs/hearth/fonts/Fraunces-latin.woff2 +0 -0
  236. package/dist/theme-packs/hearth/fonts/Nunito-latin.woff2 +0 -0
  237. package/dist/theme-packs/hearth/fonts/OFL.txt +95 -0
  238. package/dist/theme-packs/hearth/fonts/SplineSansMono-latin.woff2 +0 -0
  239. package/dist/theme-packs/hearth/meta.json +38 -0
  240. package/dist/theme-packs/hearth/pack.css +385 -0
  241. package/dist/theme-packs/hollow/fonts/OFL.txt +94 -0
  242. package/dist/theme-packs/hollow/fonts/SpaceGrotesk-latin.woff2 +0 -0
  243. package/dist/theme-packs/hollow/fonts/SpaceMono-400-italic-latin.woff2 +0 -0
  244. package/dist/theme-packs/hollow/fonts/SpaceMono-400-latin.woff2 +0 -0
  245. package/dist/theme-packs/hollow/fonts/SpaceMono-700-latin.woff2 +0 -0
  246. package/dist/theme-packs/hollow/meta.json +37 -0
  247. package/dist/theme-packs/hollow/pack.css +428 -0
  248. package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-ext-italic.woff2 +0 -0
  249. package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-ext.woff2 +0 -0
  250. package/dist/theme-packs/ledger/fonts/CrimsonPro-latin-italic.woff2 +0 -0
  251. package/dist/theme-packs/ledger/fonts/CrimsonPro-latin.woff2 +0 -0
  252. package/dist/theme-packs/ledger/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  253. package/dist/theme-packs/ledger/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  254. package/dist/theme-packs/ledger/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  255. package/dist/theme-packs/ledger/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  256. package/dist/theme-packs/ledger/fonts/OFL.txt +94 -0
  257. package/dist/theme-packs/ledger/meta.json +37 -0
  258. package/dist/theme-packs/ledger/pack.css +463 -0
  259. package/dist/theme-packs/manuscript/fonts/CourierPrime-400-latin-ext.woff2 +0 -0
  260. package/dist/theme-packs/manuscript/fonts/CourierPrime-400-latin.woff2 +0 -0
  261. package/dist/theme-packs/manuscript/fonts/CourierPrime-700-latin-ext.woff2 +0 -0
  262. package/dist/theme-packs/manuscript/fonts/CourierPrime-700-latin.woff2 +0 -0
  263. package/dist/theme-packs/manuscript/fonts/EBGaramond-latin-italic.woff2 +0 -0
  264. package/dist/theme-packs/manuscript/fonts/EBGaramond-latin.woff2 +0 -0
  265. package/dist/theme-packs/manuscript/fonts/OFL.txt +94 -0
  266. package/dist/theme-packs/manuscript/meta.json +37 -0
  267. package/dist/theme-packs/manuscript/pack.css +376 -0
  268. package/dist/theme-packs/matcha/fonts/MPLUS1Code-latin.woff2 +0 -0
  269. package/dist/theme-packs/matcha/fonts/OFL.txt +95 -0
  270. package/dist/theme-packs/matcha/fonts/ShipporiMincho-500-latin.woff2 +0 -0
  271. package/dist/theme-packs/matcha/fonts/ShipporiMincho-700-latin.woff2 +0 -0
  272. package/dist/theme-packs/matcha/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
  273. package/dist/theme-packs/matcha/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
  274. package/dist/theme-packs/matcha/meta.json +38 -0
  275. package/dist/theme-packs/matcha/pack.css +409 -0
  276. package/dist/theme-packs/nocturne/fonts/CormorantGaramond-italic-latin.woff2 +0 -0
  277. package/dist/theme-packs/nocturne/fonts/CormorantGaramond-latin.woff2 +0 -0
  278. package/dist/theme-packs/nocturne/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  279. package/dist/theme-packs/nocturne/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  280. package/dist/theme-packs/nocturne/fonts/IBMPlexMono-italic-latin.woff2 +0 -0
  281. package/dist/theme-packs/nocturne/fonts/Manrope-latin.woff2 +0 -0
  282. package/dist/theme-packs/nocturne/fonts/OFL.txt +95 -0
  283. package/dist/theme-packs/nocturne/meta.json +38 -0
  284. package/dist/theme-packs/nocturne/pack.css +502 -0
  285. package/dist/theme-packs/observatory/fonts/JosefinSans-latin.woff2 +0 -0
  286. package/dist/theme-packs/observatory/fonts/Jost-italic-latin.woff2 +0 -0
  287. package/dist/theme-packs/observatory/fonts/Jost-latin.woff2 +0 -0
  288. package/dist/theme-packs/observatory/fonts/OFL.txt +95 -0
  289. package/dist/theme-packs/observatory/fonts/SpaceMono-400-latin.woff2 +0 -0
  290. package/dist/theme-packs/observatory/fonts/SpaceMono-700-latin.woff2 +0 -0
  291. package/dist/theme-packs/observatory/fonts/SpaceMono-italic-latin.woff2 +0 -0
  292. package/dist/theme-packs/observatory/meta.json +38 -0
  293. package/dist/theme-packs/observatory/pack.css +728 -0
  294. package/dist/theme-packs/onyx/fonts/CormorantGaramond-italic-latin.woff2 +0 -0
  295. package/dist/theme-packs/onyx/fonts/CormorantGaramond-latin.woff2 +0 -0
  296. package/dist/theme-packs/onyx/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  297. package/dist/theme-packs/onyx/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  298. package/dist/theme-packs/onyx/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  299. package/dist/theme-packs/onyx/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  300. package/dist/theme-packs/onyx/fonts/Jost-latin.woff2 +0 -0
  301. package/dist/theme-packs/onyx/fonts/OFL.txt +95 -0
  302. package/dist/theme-packs/onyx/meta.json +38 -0
  303. package/dist/theme-packs/onyx/pack.css +497 -0
  304. package/dist/theme-packs/phosphor/fonts/JetBrainsMono-latin-ext.woff2 +0 -0
  305. package/dist/theme-packs/phosphor/fonts/JetBrainsMono-latin.woff2 +0 -0
  306. package/dist/theme-packs/phosphor/fonts/OFL.txt +94 -0
  307. package/dist/theme-packs/phosphor/fonts/VT323-latin-ext.woff2 +0 -0
  308. package/dist/theme-packs/phosphor/fonts/VT323-latin.woff2 +0 -0
  309. package/dist/theme-packs/phosphor/meta.json +38 -0
  310. package/dist/theme-packs/phosphor/pack.css +493 -0
  311. package/dist/theme-packs/solar/fonts/OFL.txt +94 -0
  312. package/dist/theme-packs/solar/fonts/SourceCodePro-italic-latin.woff2 +0 -0
  313. package/dist/theme-packs/solar/fonts/SourceCodePro-latin.woff2 +0 -0
  314. package/dist/theme-packs/solar/fonts/SourceSans3-italic-latin.woff2 +0 -0
  315. package/dist/theme-packs/solar/fonts/SourceSans3-latin.woff2 +0 -0
  316. package/dist/theme-packs/solar/meta.json +37 -0
  317. package/dist/theme-packs/solar/pack.css +380 -0
  318. package/dist/theme-packs/sumi/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  319. package/dist/theme-packs/sumi/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  320. package/dist/theme-packs/sumi/fonts/IBMPlexMono-500-latin-ext.woff2 +0 -0
  321. package/dist/theme-packs/sumi/fonts/IBMPlexMono-500-latin.woff2 +0 -0
  322. package/dist/theme-packs/sumi/fonts/OFL.txt +95 -0
  323. package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-600-latin.woff2 +0 -0
  324. package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-700-latin.woff2 +0 -0
  325. package/dist/theme-packs/sumi/fonts/ShipporiMinchoB1-800-latin.woff2 +0 -0
  326. package/dist/theme-packs/sumi/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
  327. package/dist/theme-packs/sumi/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
  328. package/dist/theme-packs/sumi/meta.json +38 -0
  329. package/dist/theme-packs/sumi/pack.css +502 -0
  330. package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-400-latin-ext.woff2 +0 -0
  331. package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-400-latin.woff2 +0 -0
  332. package/dist/theme-packs/swissgrid/fonts/IBMPlexMono-600-latin.woff2 +0 -0
  333. package/dist/theme-packs/swissgrid/fonts/Inter-latin-ext.woff2 +0 -0
  334. package/dist/theme-packs/swissgrid/fonts/Inter-latin.woff2 +0 -0
  335. package/dist/theme-packs/swissgrid/fonts/InterTight-latin.woff2 +0 -0
  336. package/dist/theme-packs/swissgrid/fonts/OFL.txt +95 -0
  337. package/dist/theme-packs/swissgrid/meta.json +38 -0
  338. package/dist/theme-packs/swissgrid/pack.css +518 -0
  339. package/dist/theme-packs/washi/fonts/MPlus1Code-400-latin.woff2 +0 -0
  340. package/dist/theme-packs/washi/fonts/MPlus1Code-500-latin.woff2 +0 -0
  341. package/dist/theme-packs/washi/fonts/OFL.txt +95 -0
  342. package/dist/theme-packs/washi/fonts/ShipporiMincho-500-latin.woff2 +0 -0
  343. package/dist/theme-packs/washi/fonts/ShipporiMincho-600-latin.woff2 +0 -0
  344. package/dist/theme-packs/washi/fonts/ShipporiMincho-700-latin.woff2 +0 -0
  345. package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-400-latin.woff2 +0 -0
  346. package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-500-latin.woff2 +0 -0
  347. package/dist/theme-packs/washi/fonts/ZenKakuGothicNew-700-latin.woff2 +0 -0
  348. package/dist/theme-packs/washi/meta.json +38 -0
  349. package/dist/theme-packs/washi/pack.css +479 -0
  350. package/dist/theme-packs-registry/index.d.ts +5 -0
  351. package/dist/theme-packs-registry/index.js +30 -0
  352. package/dist/theme-packs-registry/load-registry.d.ts +23 -0
  353. package/dist/theme-packs-registry/load-registry.js +64 -0
  354. package/dist/theme-packs-registry/meta-schema.d.ts +70 -0
  355. package/dist/theme-packs-registry/meta-schema.js +38 -0
  356. package/dist/theme-packs-registry/resolve-enabled-packs.d.ts +25 -0
  357. package/dist/theme-packs-registry/resolve-enabled-packs.js +43 -0
  358. package/dist/theme-packs-registry/token-manifest.d.ts +19 -0
  359. package/dist/theme-packs-registry/token-manifest.js +57 -0
  360. package/dist/theme-packs-registry/validator.d.ts +35 -0
  361. package/dist/theme-packs-registry/validator.js +284 -0
  362. package/dist/theme-toggle/color-scheme-sync.d.ts +2 -4
  363. package/dist/versions-page/index.d.ts +2 -2
  364. package/dist/versions-page/index.js +8 -8
  365. package/eject/breadcrumb/breadcrumb.tsx +4 -4
  366. package/eject/breadcrumb/find-path.ts +2 -2
  367. package/eject/breadcrumb/index.ts +1 -1
  368. package/eject/breadcrumb/types.ts +0 -6
  369. package/eject/code-group/index.tsx +2 -2
  370. package/eject/doc-history/index.tsx +1 -1
  371. package/eject/doc-pager/index.tsx +1 -1
  372. package/eject/footer/footer.tsx +1 -0
  373. package/eject/header/header.tsx +86 -21
  374. package/eject/header/index.ts +3 -0
  375. package/eject/header/types.ts +39 -1
  376. package/eject/site-tree-nav-island/index.tsx +15 -3
  377. package/eject/site-tree-nav-island/state.ts +9 -0
  378. package/eject/theme-toggle/color-scheme-sync.ts +2 -4
  379. package/package.json +35 -29
  380. package/routes-src/404.tsx +4 -1
  381. package/routes-src/_chrome.tsx +6 -5
  382. package/routes-src/_context.ts +4 -0
  383. package/routes-src/_docs-helpers.ts +9 -29
  384. package/routes-src/_virtual.d.ts +4 -0
  385. package/virtual-modules.d.ts +4 -0
  386. package/zfb-config-shim.d.ts +40 -18
  387. package/dist/integrations/llms-txt/index.d.ts +0 -33
  388. package/dist/theme/color-tweak-export-modal.d.ts +0 -16
  389. package/dist/theme/color-tweak-export-modal.js +0 -138
  390. package/dist/theme/design-token-serde.d.ts +0 -183
  391. package/dist/theme/design-token-serde.js +0 -346
  392. package/dist/theme/design-token-types.d.ts +0 -13
  393. package/dist/theme/design-token-types.js +0 -6
  394. package/dist/theme/iframe-bridge.d.ts +0 -42
  395. package/dist/theme/iframe-bridge.js +0 -72
  396. /package/dist/{integrations → plugins/internal}/claude-resources/escape-for-mdx.d.ts +0 -0
  397. /package/dist/{integrations → plugins/internal}/claude-resources/escape-for-mdx.js +0 -0
  398. /package/dist/{integrations → plugins/internal}/claude-resources/generate.d.ts +0 -0
  399. /package/dist/{integrations → plugins/internal}/claude-resources/generate.js +0 -0
  400. /package/dist/{integrations → plugins/internal}/doc-history/pre-build.js +0 -0
  401. /package/dist/{integrations → plugins/internal}/llms-txt/dev-middleware.d.ts +0 -0
  402. /package/dist/{integrations → plugins/internal}/llms-txt/dev-middleware.js +0 -0
  403. /package/dist/{integrations → plugins/internal}/llms-txt/emit.d.ts +0 -0
  404. /package/dist/{integrations → plugins/internal}/llms-txt/emit.js +0 -0
  405. /package/dist/{integrations → plugins/internal}/llms-txt/generate.d.ts +0 -0
  406. /package/dist/{integrations → plugins/internal}/llms-txt/generate.js +0 -0
  407. /package/dist/{integrations → plugins/internal}/llms-txt/index.js +0 -0
  408. /package/dist/{integrations → plugins/internal}/llms-txt/types.js +0 -0
  409. /package/dist/{integrations → plugins/internal}/search-index/build-emitter.d.ts +0 -0
  410. /package/dist/{integrations → plugins/internal}/search-index/build-emitter.js +0 -0
  411. /package/dist/{integrations → plugins/internal}/search-index/collect.d.ts +0 -0
  412. /package/dist/{integrations → plugins/internal}/search-index/dev-middleware.d.ts +0 -0
  413. /package/dist/{integrations → plugins/internal}/search-index/dev-middleware.js +0 -0
  414. /package/dist/{integrations → plugins/internal}/search-index/index.d.ts +0 -0
  415. /package/dist/{integrations → plugins/internal}/search-index/index.js +0 -0
  416. /package/dist/{integrations → plugins/internal}/search-index/types.d.ts +0 -0
  417. /package/dist/{integrations → plugins/internal}/search-index/types.js +0 -0
@@ -29,6 +29,10 @@ declare module "virtual:zudo-doc-route-context" {
29
29
  * `colorSchemes` to `zudoDocPreset` — `_chrome.tsx` falls back to
30
30
  * `DEFAULT_SCHEME` in that case. */
31
31
  colorSchemes: Record<string, unknown> | null;
32
+ /** Resolved, enabled, ordered theme-pack registry (ADR
33
+ * `docs/adr/theme-packs.md`, Decision 2). `null` when the routes plugin
34
+ * did not thread one. */
35
+ themePackRegistry: Array<Record<string, unknown>> | null;
32
36
  };
33
37
  }
34
38
 
@@ -42,6 +42,10 @@ declare module "virtual:zudo-doc-route-context" {
42
42
  * `colorSchemes` to `zudoDocPreset` — `_chrome.tsx` falls back to
43
43
  * `DEFAULT_SCHEME` in that case. */
44
44
  colorSchemes: Record<string, unknown> | null;
45
+ /** Resolved, enabled, ordered theme-pack registry (ADR
46
+ * `docs/adr/theme-packs.md`, Decision 2). `null` when the routes plugin
47
+ * did not thread one. */
48
+ themePackRegistry: Array<Record<string, unknown>> | null;
45
49
  };
46
50
  }
47
51
 
@@ -52,6 +52,42 @@ declare module "zfb/config" {
52
52
  options?: Record<string, unknown>;
53
53
  }
54
54
 
55
+ /** Output mode for zfb fenced-code highlighting. */
56
+ export type CodeHighlightMode = "inline" | "class";
57
+
58
+ /** Fixed semantic taxonomy accepted by class-mode `roleClasses`. */
59
+ export type CodeHighlightRole =
60
+ | "escape"
61
+ | "operator"
62
+ | "comment"
63
+ | "string"
64
+ | "number"
65
+ | "constant"
66
+ | "keyword"
67
+ | "function"
68
+ | "type"
69
+ | "namespace"
70
+ | "property"
71
+ | "variable"
72
+ | "tag"
73
+ | "attribute"
74
+ | "punctuation"
75
+ | "inserted"
76
+ | "deleted"
77
+ | "heading";
78
+
79
+ /** zfb inline-theme or semantic class-mode configuration. */
80
+ export type CodeHighlightConfig = {
81
+ theme?: string;
82
+ themesDir?: string;
83
+ themeLight?: string;
84
+ themeDark?: string;
85
+ mode?: CodeHighlightMode;
86
+ classPrefix?: string;
87
+ roleClasses?: Partial<Record<CodeHighlightRole, string>>;
88
+ defaultStylesheet?: boolean;
89
+ };
90
+
55
91
  /**
56
92
  * Bundler options. Mirrors `BundleConfig` in crates/zfb/src/config.rs
57
93
  * and the published `@takazudo/zfb/config` (`dist/config.d.ts`). Added
@@ -113,25 +149,11 @@ declare module "zfb/config" {
113
149
  */
114
150
  base?: string;
115
151
  /**
116
- * Configures the syntect-based syntax highlighter shipped with zfb.
117
- * Mirrors `CodeHighlightConfig` / `code_highlight` in crates/zfb/src/config.rs
118
- * (single-theme: Takazudo/zudo-front-builder#188 / sub #194, commit 339e30f;
119
- * dual-theme themeLight/themeDark added in the follow-up shipped in
120
- * zfb 0.1.0-next.45+).
121
- * When omitted, the engine falls back to the hardcoded default theme `base16-ocean.dark`.
122
- *
123
- * Single-theme mode: set `theme` — tokens get inline `style="color:#hex"`.
124
- * Dual-theme mode: set BOTH `themeLight` and `themeDark` (mutually exclusive
125
- * with `theme`) — tokens get `--shiki-light`/`--shiki-dark` CSS custom
126
- * properties and the `<pre>` gains `class="syntect-dual"` + `--shiki-*-bg`.
127
- * All names are SYNTECT theme names, not Shiki names.
152
+ * Configures zfb's code highlighter. Class mode is mutually exclusive
153
+ * with every theme field and emits semantic role classes; inline mode
154
+ * retains the single/dual theme fields for general zfb consumers.
128
155
  */
129
- codeHighlight?: {
130
- theme?: string;
131
- themesDir?: string;
132
- themeLight?: string;
133
- themeDark?: string;
134
- };
156
+ codeHighlight?: CodeHighlightConfig;
135
157
  /**
136
158
  * Markdown link resolver (port of `remarkResolveMarkdownLinks`).
137
159
  * Mirrors `Config::resolve_markdown_links` in crates/zfb/src/config.rs
@@ -1,33 +0,0 @@
1
- /**
2
- * Public entry for `@takazudo/zudo-doc/integrations/llms-txt`.
3
- *
4
- * Framework-agnostic build emitter that produces `dist/llms.txt` and
5
- * `dist/llms-full.txt` (plus per-locale variants) with byte-identical
6
- * format vs the legacy Astro integration in
7
- * `src/integrations/llms-txt.ts`.
8
- *
9
- * Typical zfb registration (see ./README.md for the full snippet):
10
- *
11
- * import { emitLlmsTxt } from "@takazudo/zudo-doc/integrations/llms-txt";
12
- *
13
- * // inside a zfb plugin's onBuildDone hook
14
- * emitLlmsTxt({
15
- * outDir,
16
- * siteName: "...",
17
- * siteDescription: "...",
18
- * base: "/",
19
- * defaultLocaleDir: "src/content/docs",
20
- * locales: [{ code: "ja", dir: "src/content/docs-ja" }],
21
- * });
22
- *
23
- * The pure `generate*` and `loadDocEntries` helpers are exported as well
24
- * so a zfb non-HTML page (`pages/llms.txt.tsx`) or a unit test can build
25
- * the strings directly without touching the filesystem twice.
26
- */
27
- export { createLlmsTxtDevMiddleware } from "./dev-middleware.js";
28
- export type { LlmsTxtDevMiddlewareOptions, LlmsTxtMiddleware, LlmsTxtMiddlewareLogger, LlmsTxtNextFn, } from "./dev-middleware.js";
29
- export { emitLlmsTxt } from "./emit.js";
30
- export { generateLlmsFullTxt, generateLlmsTxt, } from "./generate.js";
31
- export { collectMdFiles, isExcluded, loadDocEntries, parseMarkdownFile, slugToUrl, } from "./load.js";
32
- export { stripImportsAndJsx, stripMarkdown } from "./strip.js";
33
- export type { LlmsDocEntry, LlmsTxtEmitOptions, LlmsTxtEmitResult, LlmsTxtFrontmatter, LlmsTxtLoadOptions, LlmsTxtLocaleConfig, LlmsTxtLogger, LlmsTxtSiteMeta, } from "./types.js";
@@ -1,16 +0,0 @@
1
- import { type DesignTokenManifest } from "./design-token-serde.js";
2
- import { type ColorTweakState, type TweakState } from "./design-token-types.js";
3
- interface DesignTokenExportModalProps {
4
- onClose: () => void;
5
- /** Full unified tweak state — the modal serializes all four categories. */
6
- state: TweakState;
7
- /** Token manifest (spacing / font / size arrays) used by serialize() to
8
- * compute diff-only output. The caller is expected to forward the same
9
- * manifest the panel was configured with. */
10
- manifest: DesignTokenManifest;
11
- /** Color baseline used for diff-only output. Optional: callers without DOM
12
- * access (tests) can omit and we'll treat the entire color block as changed. */
13
- colorDefaults?: ColorTweakState;
14
- }
15
- export default function ColorTweakExportModal({ onClose, state, manifest, colorDefaults, }: DesignTokenExportModalProps): import("preact").JSX.Element;
16
- export {};
@@ -1,138 +0,0 @@
1
- import { jsx, jsxs } from "preact/jsx-runtime";
2
- import { useState, useEffect, useMemo, useRef } from "preact/hooks";
3
- import { serialize } from "./design-token-serde.js";
4
- import {
5
- } from "./design-token-types.js";
6
- const EXPORT_FILENAME_HINT = "zudo-doc-tokens.json";
7
- function resolveColorDefaults(fallback, explicit) {
8
- return explicit ?? fallback;
9
- }
10
- function ColorTweakExportModal({
11
- onClose,
12
- state,
13
- manifest,
14
- colorDefaults
15
- }) {
16
- const [copyLabel, setCopyLabel] = useState("Copy");
17
- const [includeDefaults, setIncludeDefaults] = useState(false);
18
- const dialogRef = useRef(null);
19
- const copyTimerRef = useRef(null);
20
- const code = useMemo(() => {
21
- const baseline = resolveColorDefaults(state.color, colorDefaults);
22
- const json = serialize(state, {
23
- manifest,
24
- includeDefaults,
25
- colorDefaults: baseline
26
- });
27
- return JSON.stringify(json, null, 2);
28
- }, [state, manifest, colorDefaults, includeDefaults]);
29
- useEffect(() => {
30
- const dialog = dialogRef.current;
31
- if (!dialog) return;
32
- dialog.showModal();
33
- return () => {
34
- if (dialog.open) dialog.close();
35
- };
36
- }, []);
37
- useEffect(() => {
38
- const dialog = dialogRef.current;
39
- if (!dialog) return;
40
- function handleClose() {
41
- onClose();
42
- }
43
- dialog.addEventListener("close", handleClose);
44
- return () => dialog.removeEventListener("close", handleClose);
45
- }, [onClose]);
46
- useEffect(() => {
47
- return () => {
48
- if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
49
- };
50
- }, []);
51
- function handleBackdropClick(e) {
52
- const dialog = dialogRef.current;
53
- if (!dialog) return;
54
- const rect = dialog.getBoundingClientRect();
55
- if (e.clientX < rect.left || e.clientX > rect.right || e.clientY < rect.top || e.clientY > rect.bottom) {
56
- dialog.close();
57
- }
58
- }
59
- async function handleCopy() {
60
- let ok = false;
61
- const dialog = dialogRef.current;
62
- if (dialog) {
63
- try {
64
- const textarea = document.createElement("textarea");
65
- textarea.value = code;
66
- textarea.style.cssText = "position:fixed;opacity:0;left:-9999px";
67
- dialog.appendChild(textarea);
68
- textarea.focus();
69
- textarea.select();
70
- ok = document.execCommand("copy");
71
- dialog.removeChild(textarea);
72
- } catch {
73
- }
74
- }
75
- if (!ok) {
76
- try {
77
- await navigator.clipboard.writeText(code);
78
- ok = true;
79
- } catch {
80
- }
81
- }
82
- setCopyLabel(ok ? "Copied!" : "Failed");
83
- if (copyTimerRef.current) clearTimeout(copyTimerRef.current);
84
- copyTimerRef.current = setTimeout(() => setCopyLabel("Copy"), 2e3);
85
- }
86
- return /* @__PURE__ */ jsxs(
87
- "dialog",
88
- {
89
- ref: dialogRef,
90
- onClick: handleBackdropClick,
91
- className: "mx-auto max-h-[80vh] w-full max-w-[46rem] overflow-y-auto border border-muted bg-surface p-hsp-xl backdrop:bg-bg/80",
92
- style: { color: "var(--color-fg)", position: "fixed", top: "50%", left: "50%", transform: "translate(-50%, -50%)", userSelect: "text" },
93
- children: [
94
- /* @__PURE__ */ jsx("h2", { className: "mb-vsp-sm text-title font-bold text-fg", children: "Export Design Tokens" }),
95
- /* @__PURE__ */ jsxs("p", { className: "mb-vsp-xs text-small text-muted", children: [
96
- "Save as ",
97
- /* @__PURE__ */ jsx("code", { className: "text-fg", children: EXPORT_FILENAME_HINT }),
98
- " to feed this blob back into the panel (or hand to an AI assistant)."
99
- ] }),
100
- /* @__PURE__ */ jsxs("label", { className: "mb-vsp-xs flex items-center gap-x-hsp-sm text-small text-fg", children: [
101
- /* @__PURE__ */ jsx(
102
- "input",
103
- {
104
- type: "checkbox",
105
- checked: includeDefaults,
106
- onChange: (e) => setIncludeDefaults(e.currentTarget.checked)
107
- }
108
- ),
109
- "Show defaults too"
110
- ] }),
111
- /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto border border-muted bg-code-bg p-hsp-lg text-small text-code-fg", children: /* @__PURE__ */ jsx("code", { children: code }) }),
112
- /* @__PURE__ */ jsxs("div", { className: "mt-vsp-sm flex items-center gap-x-hsp-md", children: [
113
- /* @__PURE__ */ jsx(
114
- "button",
115
- {
116
- type: "button",
117
- onClick: handleCopy,
118
- className: "border border-muted bg-surface px-hsp-lg py-vsp-2xs text-small text-fg transition-colors hover:border-accent hover:text-accent",
119
- children: copyLabel
120
- }
121
- ),
122
- /* @__PURE__ */ jsx(
123
- "button",
124
- {
125
- type: "button",
126
- onClick: () => dialogRef.current?.close(),
127
- className: "border border-muted bg-surface px-hsp-lg py-vsp-2xs text-small text-muted transition-colors hover:border-fg hover:text-fg",
128
- children: "Close"
129
- }
130
- )
131
- ] })
132
- ]
133
- }
134
- );
135
- }
136
- export {
137
- ColorTweakExportModal as default
138
- };
@@ -1,183 +0,0 @@
1
- /**
2
- * Design-token SerDe — unified JSON export / import for the design-token panel.
3
- *
4
- * Supersedes the legacy TypeScript-object export in `export-code.ts`. The JSON
5
- * format is a single document covering all four token categories (color,
6
- * spacing, font, size) so an AI assistant can consume or emit a whole
7
- * design-token tweak in one round-trip.
8
- *
9
- * Format: `$schema = "zudo-doc-design-tokens/v3"`.
10
- *
11
- * v3 color slice — ramp-native, minimized (Color Ramp Restructure,
12
- * zudolab/zudo-doc#2584 / #2591; minimized to 5/3 in #2602)
13
- * -----------------------------------------------------------------------------------
14
- * The color block is the ramp-native `ColorScheme` from `color-scheme-utils.ts`:
15
- * - `ramps` — the shared Tier-1 source of truth (`base[5]`, `accent[3]`,
16
- * `state{danger,success,warning,info}`), emitted verbatim as OKLCH strings.
17
- * - `map` — the per-mode Tier-2 wiring (`bg`/`fg`/`selectionBg`/`selectionFg`
18
- * + 23 `semantic` roles), each a `RampRef` (`{base:n}` / `{accent:n}` /
19
- * `{state:role}` / a literal OKLCH string).
20
- *
21
- * The legacy v1 color slice (`palette: string[16]`, numeric `base`, `cursor`,
22
- * `semanticMappings`) is gone. Both `ramps` and `map` are plain JSON data, so
23
- * the color block is essentially a serialized `ColorScheme`.
24
- *
25
- * v1 → v3 migration (RESET, not remap)
26
- * ------------------------------------
27
- * A persisted v1 payload (detected by `$schema === "…/v1"`, a `palette` array,
28
- * or a numeric `base` block) has NO faithful mapping to the new model: the old
29
- * 16-slot ghostty palette + numeric semantic indices do not correspond to the
30
- * 5-base / 3-accent / 4-state ramps + `RampRef` wiring. Any remap would invent
31
- * colors and mislead the user, so `deserialize` RESETS the color slice to the
32
- * caller-supplied baseline (the current default scheme) and emits a
33
- * `console.warn` + a `warnings[]` entry — no throw, no blank screen. The
34
- * spacing/font/size slices are format-compatible across v1/v3 and are preserved.
35
- *
36
- * v2 → v3 migration (RESET, schema-label-only — zudolab/zudo-doc#2599)
37
- * ---------------------------------------------------------------------
38
- * `v2` was the ramp-native label BEFORE the base-12/accent-7 → base-5/accent-3
39
- * minimize (#2602); the shape (`ramps` + `map` of `RampRef`s) never changed, only
40
- * the ramp lengths did. That means a `v2`-labeled payload is ambiguous in a way
41
- * `v1` never was: `parseRamps` catches a wrong-length `ramps.base`/`ramps.accent`
42
- * array and falls back to baseline, but `parseMap`'s `RampRef` parser only
43
- * shape-checks a numeric index (`{base:11}`) — it does NOT range-check it against
44
- * the ramp length, because that tolerance is also relied on by legitimate
45
- * already-5/3 round-trip exports (see the `{accent:5}`-style fixtures in the test
46
- * file). So an out-of-range ref alone can't tell a genuinely-stale pre-5/3 export
47
- * apart from an intentionally-tolerated current-shape ref — both look identical
48
- * once parsed. Rather than guess from ref values, `v2` is retired as a whole:
49
- * ANY payload still carrying the `v2` label (regardless of whether its arrays
50
- * happen to already be 5/3-shaped) is treated as legacy and RESET to baseline,
51
- * exactly like v1. Only payloads relabeled `v3` are trusted to resolve cleanly
52
- * against the current ramp lengths.
53
- *
54
- * Diff-only by default
55
- * --------------------
56
- * `serialize()` only emits tokens the user has actually changed relative to
57
- * the provided `colorDefaults` (for the color block) and the manifest defaults
58
- * (for spacing / font / size). Pass `includeDefaults: true` to dump the full
59
- * state instead. The whole-category keys (`color`, `spacing`, `font`, `size`)
60
- * are omitted entirely when nothing in them differs. For the color block the
61
- * `ramps` and `map` sub-blocks are each emitted whole (not per-stop / per-role
62
- * diffed) when they differ from the baseline — the ramp-native shape has no
63
- * stable per-slot index to diff against, and a whole-block emit round-trips
64
- * cleanly against the same baseline.
65
- *
66
- * Spacing / font / size keys use CSS variable names (`"--spacing-hsp-md"`) —
67
- * the external schema — rather than the internal token id (`"hsp-md"`). This
68
- * keeps the file human-readable and agnostic of our internal manifest.
69
- * `deserialize()` maps them back; unknown CSS vars are reported via
70
- * `unknownTokens` so the UI can surface them.
71
- *
72
- * Read-only manifest tokens (e.g. `--spacing-0`, `--zd-sidebar-w` with
73
- * `clamp()`) are skipped in both directions.
74
- *
75
- * W3B (#1730 — Generator Pages Migration): moved from
76
- * `src/utils/design-token-serde.ts` into v2. The manifest tokens
77
- * (`SPACING_TOKENS` / `FONT_TOKENS` / `SIZE_TOKENS`) are no longer
78
- * imported from the host's `@/config/design-tokens-manifest` — the
79
- * caller now passes them through `SerializeOptions.manifest` /
80
- * `DeserializeOptions.manifest`, preserving consumer override hooks.
81
- */
82
- interface TokenDef {
83
- /** Stable id used as the Record key in persisted state (e.g. `hsp-2xs`). */
84
- id: string;
85
- /** CSS custom property name written to `:root` (e.g. `--zd-spacing-hgap-2xs`). */
86
- cssVar: string;
87
- /** Default value as a CSS length string (e.g. `0.125rem`). */
88
- default: string;
89
- /** Read-only tokens are displayed but not editable. */
90
- readonly?: true;
91
- }
92
- import { type TweakState } from "./design-token-types.js";
93
- import { type ColorScheme, type ModeMap, type Ramps } from "../color-scheme-utils.js";
94
- export declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v3";
95
- /** External JSON color block — a (possibly diff-only) serialized `ColorScheme`.
96
- * Both sub-blocks are optional: in diff-only output an unchanged `ramps` or
97
- * `map` is omitted and filled from the baseline on deserialize. */
98
- export interface DesignTokenJsonColor {
99
- ramps?: Ramps;
100
- map?: ModeMap;
101
- }
102
- /** External token map keyed by CSS var name. */
103
- export type DesignTokenJsonOverrides = Record<string, string>;
104
- export interface DesignTokenJson {
105
- $schema: typeof DESIGN_TOKEN_SCHEMA;
106
- exportedAt: string;
107
- color?: DesignTokenJsonColor;
108
- spacing?: DesignTokenJsonOverrides;
109
- font?: DesignTokenJsonOverrides;
110
- size?: DesignTokenJsonOverrides;
111
- }
112
- /**
113
- * Token manifest the caller hands in — the consumer's
114
- * `src/config/design-tokens-manifest.ts` (or generator override). v2
115
- * doesn't ship its own manifest; this is intentionally a caller concern
116
- * so each consumer keeps full control over the editable token set.
117
- */
118
- export interface DesignTokenManifest {
119
- spacing: readonly TokenDef[];
120
- font: readonly TokenDef[];
121
- size: readonly TokenDef[];
122
- }
123
- export interface SerializeOptions {
124
- /** Token manifest (spacing / font / size arrays) used to compute
125
- * diff-only output and resolve CSS-var names. Required. */
126
- manifest: DesignTokenManifest;
127
- /** When true, dump full state (whole `ramps` + `map`, all token manifest
128
- * defaults merged in). Default: diff-only. */
129
- includeDefaults?: boolean;
130
- /** Color baseline to diff against — typically the active scheme's initial
131
- * `ColorScheme`. Required for meaningful color-diff output; callers that
132
- * don't have it available (e.g. tests without DOM) can omit it and we'll
133
- * treat the whole color block as changed. */
134
- colorDefaults?: ColorScheme;
135
- /** Override the `exportedAt` stamp (test-only). */
136
- now?: () => Date;
137
- }
138
- export interface DeserializeResult {
139
- /** The reconstructed tweak state, with unknown-token values dropped. */
140
- state: TweakState;
141
- /** CSS var names present in the payload that don't match any known token. */
142
- unknownTokens: string[];
143
- /** Human-readable errors that did not prevent a state from being produced
144
- * (e.g. "v1 payload detected; color reset to default"). */
145
- warnings: string[];
146
- }
147
- export interface DeserializeOptions {
148
- /** Token manifest (spacing / font / size arrays) used to resolve CSS-var
149
- * names back to internal token ids. Required. */
150
- manifest: DesignTokenManifest;
151
- /** Color baseline used to fill in fields absent from the payload (diff-only
152
- * exports are missing most fields by design) and as the reset target for a
153
- * v1 migration. Typically the active scheme's initial `ColorScheme`. */
154
- colorDefaults?: ColorScheme;
155
- }
156
- /** Thrown when the payload is not a recognized schema object. The error
157
- * `.reason` helps the UI render a precise inline message. A v1 payload is NOT
158
- * thrown for — it is migrated (see `deserialize`). */
159
- export declare class DesignTokenSchemaError extends Error {
160
- readonly reason: "not-object" | "schema-missing" | "schema-mismatch";
161
- readonly actualSchema?: unknown;
162
- constructor(reason: "not-object" | "schema-missing" | "schema-mismatch", message: string, actualSchema?: unknown);
163
- }
164
- /**
165
- * Produce the external JSON document for a given tweak state.
166
- *
167
- * By default this is diff-only against `opts.colorDefaults` + manifest
168
- * defaults; set `opts.includeDefaults = true` to dump everything.
169
- */
170
- export declare function serialize(state: TweakState, opts: SerializeOptions): DesignTokenJson;
171
- /**
172
- * Parse a design-token JSON document and lift it back into a tweak state.
173
- *
174
- * Throws `DesignTokenSchemaError` on schema mismatch / non-object input. A v1
175
- * (palette-based) payload is NOT thrown for — its color slice is reset to the
176
- * baseline default (see the v1→v2 migration note at the top). Any CSS var name
177
- * that doesn't match a known manifest entry is collected into `unknownTokens`.
178
- *
179
- * Missing fields fall back to `opts.colorDefaults` (or, absent that, a
180
- * minimal neutral default) so the result is always a valid `TweakState`.
181
- */
182
- export declare function deserialize(input: unknown, opts: DeserializeOptions): DeserializeResult;
183
- export {};