@takazudo/zudo-doc 5.28.2 → 6.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 (456) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +49 -16
  3. package/bin/gen-z-index.mjs +18 -18
  4. package/dist/agent-docs/identity.d.ts +4 -0
  5. package/dist/agent-docs/identity.js +24 -0
  6. package/dist/agent-docs/index.d.ts +5 -0
  7. package/dist/agent-docs/index.js +5 -0
  8. package/dist/agent-docs/limits.d.ts +11 -0
  9. package/dist/agent-docs/limits.js +24 -0
  10. package/dist/agent-docs/search.d.ts +14 -0
  11. package/dist/agent-docs/search.js +82 -0
  12. package/dist/agent-docs/tokenize.d.ts +2 -0
  13. package/dist/agent-docs/tokenize.js +22 -0
  14. package/dist/agent-docs/types.d.ts +68 -0
  15. package/dist/agent-docs/types.js +0 -0
  16. package/dist/ai-chat-modal/index.d.ts +1 -4
  17. package/dist/ai-chat-modal/index.js +183 -123
  18. package/dist/asset-components/asset-card.d.ts +1 -2
  19. package/dist/asset-components/asset-card.js +12 -12
  20. package/dist/asset-components/asset-code.d.ts +1 -2
  21. package/dist/asset-components/asset-code.js +10 -10
  22. package/dist/asset-components/shared.d.ts +3 -4
  23. package/dist/asset-components/shared.js +4 -4
  24. package/dist/asset-index-page/body.d.ts +5 -6
  25. package/dist/asset-index-page/body.js +6 -6
  26. package/dist/asset-index-page/index.d.ts +1 -2
  27. package/dist/asset-index-page/index.js +1 -1
  28. package/dist/asset-page/body.d.ts +5 -9
  29. package/dist/asset-page/body.js +3 -3
  30. package/dist/asset-page/components.d.ts +16 -17
  31. package/dist/asset-page/components.js +10 -9
  32. package/dist/asset-page/index.d.ts +1 -2
  33. package/dist/asset-page/index.js +1 -1
  34. package/dist/auto-logo/index.d.ts +1 -2
  35. package/dist/auto-logo/index.js +2 -2
  36. package/dist/body-foot-util/body-foot-util-area.d.ts +3 -4
  37. package/dist/body-foot-util/body-foot-util-area.js +1 -2
  38. package/dist/body-foot-util/edit-link.d.ts +2 -3
  39. package/dist/body-foot-util/edit-link.js +1 -2
  40. package/dist/breadcrumb/breadcrumb.d.ts +6 -6
  41. package/dist/breadcrumb/breadcrumb.js +3 -4
  42. package/dist/category-nav/index.d.ts +1 -2
  43. package/dist/category-nav/index.js +11 -5
  44. package/dist/category-tree-nav/index.d.ts +1 -2
  45. package/dist/category-tree-nav/index.js +3 -3
  46. package/dist/chrome/derive.d.ts +18 -27
  47. package/dist/chrome/derive.js +47 -29
  48. package/dist/chrome/index.d.ts +5 -5
  49. package/dist/chrome/index.js +1 -1
  50. package/dist/chrome/island-data.d.ts +4 -0
  51. package/dist/chrome/island-data.js +52 -0
  52. package/dist/chrome/primary-slots.d.ts +2 -3
  53. package/dist/chrome-bindings.d.ts +28 -22
  54. package/dist/code-group/index.d.ts +3 -4
  55. package/dist/code-group/index.js +3 -7
  56. package/dist/code-syntax/code-block-enhancer.d.ts +1 -2
  57. package/dist/code-syntax/code-block-enhancer.js +2 -2
  58. package/dist/code-syntax/mermaid-init.d.ts +1 -2
  59. package/dist/code-syntax/mermaid-init.js +5 -2
  60. package/dist/code-syntax/tabs-init-script.js +1 -1
  61. package/dist/code-syntax/tabs-init.d.ts +1 -2
  62. package/dist/code-syntax/tabs-init.js +2 -2
  63. package/dist/code-syntax/tabs.d.ts +6 -6
  64. package/dist/code-syntax/tabs.js +8 -8
  65. package/dist/compiled.css +2933 -2943
  66. package/dist/config-assertions/index.d.ts +13 -0
  67. package/dist/config-assertions/index.js +14 -0
  68. package/dist/config.d.ts +36 -17
  69. package/dist/config.js +23 -95
  70. package/dist/content/content-blockquote.d.ts +2 -3
  71. package/dist/content/content-blockquote.js +3 -3
  72. package/dist/content/content-code.d.ts +3 -4
  73. package/dist/content/content-code.js +5 -5
  74. package/dist/content/content-link.d.ts +3 -4
  75. package/dist/content/content-link.js +10 -10
  76. package/dist/content/content-ol.d.ts +2 -3
  77. package/dist/content/content-ol.js +5 -4
  78. package/dist/content/content-paragraph.d.ts +2 -3
  79. package/dist/content/content-paragraph.js +1 -1
  80. package/dist/content/content-strong.d.ts +2 -3
  81. package/dist/content/content-strong.js +3 -3
  82. package/dist/content/content-table.d.ts +2 -3
  83. package/dist/content/content-table.js +4 -4
  84. package/dist/content/content-ul.d.ts +2 -3
  85. package/dist/content/content-ul.js +4 -4
  86. package/dist/content/heading-h2.d.ts +2 -3
  87. package/dist/content/heading-h2.js +4 -4
  88. package/dist/content/heading-h3.d.ts +2 -3
  89. package/dist/content/heading-h3.js +4 -4
  90. package/dist/content/heading-h4.d.ts +2 -3
  91. package/dist/content/heading-h4.js +4 -4
  92. package/dist/content-admonition/index.d.ts +3 -4
  93. package/dist/content-admonition/index.js +2 -2
  94. package/dist/content.css +35 -33
  95. package/dist/design-token-panel-bootstrap-controller.d.ts +178 -0
  96. package/dist/design-token-panel-bootstrap-controller.js +359 -0
  97. package/dist/design-token-panel-bootstrap-island.d.ts +5 -0
  98. package/dist/design-token-panel-bootstrap-island.js +19 -0
  99. package/dist/design-token-panel-bootstrap.d.ts +5 -195
  100. package/dist/design-token-panel-bootstrap.js +3 -288
  101. package/dist/desktop-sidebar-toggle-island/index.d.ts +2 -7
  102. package/dist/desktop-sidebar-toggle-island/index.js +2 -58
  103. package/dist/desktop-sidebar-toggle-island/island.d.ts +4 -0
  104. package/dist/desktop-sidebar-toggle-island/island.js +43 -0
  105. package/dist/desktop-sidebar-toggle-island/storage.d.ts +4 -0
  106. package/dist/desktop-sidebar-toggle-island/storage.js +29 -0
  107. package/dist/desktop-toc-toggle-island/index.d.ts +2 -7
  108. package/dist/desktop-toc-toggle-island/index.js +2 -58
  109. package/dist/desktop-toc-toggle-island/island.d.ts +4 -0
  110. package/dist/desktop-toc-toggle-island/island.js +43 -0
  111. package/dist/desktop-toc-toggle-island/storage.d.ts +4 -0
  112. package/dist/desktop-toc-toggle-island/storage.js +29 -0
  113. package/dist/details/details.d.ts +3 -4
  114. package/dist/details/details.js +1 -1
  115. package/dist/doc-body-end/index.d.ts +1 -2
  116. package/dist/doc-body-end/index.js +1 -1
  117. package/dist/doc-body-end-islands/design-token-panel-island.d.ts +2 -2
  118. package/dist/doc-body-end-islands/design-token-panel-island.js +3 -7
  119. package/dist/doc-body-end-islands/index.d.ts +4 -21
  120. package/dist/doc-body-end-islands/index.js +5 -3
  121. package/dist/doc-body-end-islands/theme-pack-switcher-island.d.ts +3 -13
  122. package/dist/doc-body-end-islands/theme-pack-switcher-island.js +11 -13
  123. package/dist/doc-content-header/index.d.ts +1 -2
  124. package/dist/doc-content-header/index.js +1 -1
  125. package/dist/doc-history/index.d.ts +1 -1
  126. package/dist/doc-history/index.js +166 -141
  127. package/dist/doc-history-area/index.d.ts +6 -4
  128. package/dist/doc-history-area/index.js +17 -16
  129. package/dist/doc-metainfo-area/index.d.ts +2 -3
  130. package/dist/doc-metainfo-area/index.js +1 -1
  131. package/dist/doc-page-renderer/index.d.ts +13 -7
  132. package/dist/doc-page-renderer/index.js +10 -1
  133. package/dist/doc-page-shell/index.d.ts +20 -7
  134. package/dist/doc-page-shell/index.js +17 -6
  135. package/dist/doc-pager/index.d.ts +1 -2
  136. package/dist/doc-pager/index.js +3 -3
  137. package/dist/doc-tags-area/index.d.ts +2 -3
  138. package/dist/doc-tags-area/index.js +1 -1
  139. package/dist/doclayout/doc-layout-with-defaults.d.ts +9 -9
  140. package/dist/doclayout/doc-layout-with-defaults.js +5 -15
  141. package/dist/doclayout/doc-layout.d.ts +26 -27
  142. package/dist/doclayout/doc-layout.js +23 -14
  143. package/dist/docs-schema/index.d.ts +4 -0
  144. package/dist/docs-schema/index.js +1 -0
  145. package/dist/extract-headings/index.js +43 -12
  146. package/dist/factory-context/index.d.ts +22 -19
  147. package/dist/features.css +70 -8
  148. package/dist/find-in-page/find-bar.d.ts +4 -2
  149. package/dist/find-in-page/find-bar.js +58 -69
  150. package/dist/find-in-page/index.d.ts +2 -8
  151. package/dist/find-in-page/index.js +33 -30
  152. package/dist/footer/footer.d.ts +3 -4
  153. package/dist/footer/footer.js +3 -3
  154. package/dist/footer-with-defaults/index.d.ts +2 -3
  155. package/dist/footer-with-defaults/index.js +1 -1
  156. package/dist/frontmatter-preview-defaults/index.js +1 -0
  157. package/dist/head/doc-head.d.ts +1 -1
  158. package/dist/head/doc-head.js +24 -32
  159. package/dist/head/og-tags.d.ts +1 -1
  160. package/dist/head/og-tags.js +8 -7
  161. package/dist/head/twitter-card.d.ts +1 -1
  162. package/dist/head/twitter-card.js +1 -1
  163. package/dist/head-with-defaults/index.d.ts +7 -2
  164. package/dist/head-with-defaults/index.js +46 -32
  165. package/dist/header/header.d.ts +8 -8
  166. package/dist/header/header.js +9 -11
  167. package/dist/header/types.d.ts +7 -7
  168. package/dist/header-with-defaults/index.d.ts +1 -2
  169. package/dist/header-with-defaults/index.js +18 -8
  170. package/dist/home-intro/index.d.ts +2 -5
  171. package/dist/home-intro/index.js +7 -5
  172. package/dist/home-intro/prepare.js +4 -3
  173. package/dist/home-page/index.d.ts +3 -3
  174. package/dist/home-page/index.js +19 -17
  175. package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -4
  176. package/dist/html-preview-wrapper/highlighted-code.js +19 -17
  177. package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +4 -25
  178. package/dist/html-preview-wrapper/html-preview-wrapper.js +2 -87
  179. package/dist/html-preview-wrapper/html-preview.d.ts +3 -10
  180. package/dist/html-preview-wrapper/html-preview.js +13 -37
  181. package/dist/html-preview-wrapper/index.d.ts +2 -1
  182. package/dist/html-preview-wrapper/index.js +1 -1
  183. package/dist/html-preview-wrapper/preview-base.d.ts +3 -5
  184. package/dist/html-preview-wrapper/preview-base.js +56 -59
  185. package/dist/html-preview-wrapper/wrapper.d.ts +20 -0
  186. package/dist/html-preview-wrapper/wrapper.js +37 -0
  187. package/dist/hydration-pending.d.ts +3 -5
  188. package/dist/hydration-pending.js +7 -5
  189. package/dist/i18n-version/language-switcher.d.ts +5 -32
  190. package/dist/i18n-version/language-switcher.js +5 -106
  191. package/dist/i18n-version/switcher-generated-scripts.d.ts +2 -0
  192. package/dist/i18n-version/switcher-generated-scripts.js +107 -0
  193. package/dist/i18n-version/switcher-url-state.d.ts +76 -0
  194. package/dist/i18n-version/switcher-url-state.js +103 -0
  195. package/dist/i18n-version/version-banner.d.ts +2 -3
  196. package/dist/i18n-version/version-banner.js +1 -1
  197. package/dist/i18n-version/version-switcher.d.ts +5 -50
  198. package/dist/i18n-version/version-switcher.js +5 -157
  199. package/dist/icons/index.d.ts +18 -19
  200. package/dist/icons/index.js +17 -33
  201. package/dist/image-enlarge/index.d.ts +1 -10
  202. package/dist/image-enlarge/index.js +80 -55
  203. package/dist/image-enlarge/public.d.ts +2 -0
  204. package/dist/image-enlarge/public.js +6 -0
  205. package/dist/image-enlarge/ssr-fallback.d.ts +2 -0
  206. package/dist/image-enlarge/ssr-fallback.js +8 -0
  207. package/dist/index.d.ts +11 -4
  208. package/dist/inline-version-switcher/index.d.ts +1 -2
  209. package/dist/inline-version-switcher/index.js +1 -1
  210. package/dist/island-types/index.d.ts +2 -2
  211. package/dist/island-types/index.js +1 -5
  212. package/dist/math-block/index.d.ts +4 -7
  213. package/dist/math-block/index.js +5 -5
  214. package/dist/mcp/handler.d.ts +8 -0
  215. package/dist/mcp/handler.js +129 -0
  216. package/dist/mcp/index.d.ts +4 -0
  217. package/dist/mcp/index.js +7 -0
  218. package/dist/mcp/loader.d.ts +19 -0
  219. package/dist/mcp/loader.js +202 -0
  220. package/dist/mdx-components/index.js +40 -108
  221. package/dist/mermaid-enlarge/index.d.ts +1 -8
  222. package/dist/mermaid-enlarge/index.js +174 -158
  223. package/dist/mermaid-enlarge/public.d.ts +2 -0
  224. package/dist/mermaid-enlarge/public.js +6 -0
  225. package/dist/mermaid-enlarge/ssr-fallback.d.ts +2 -0
  226. package/dist/mermaid-enlarge/ssr-fallback.js +8 -0
  227. package/dist/metainfo/doc-metainfo.d.ts +2 -3
  228. package/dist/metainfo/doc-metainfo.js +1 -4
  229. package/dist/metainfo/doc-tags.d.ts +2 -3
  230. package/dist/metainfo/doc-tags.js +1 -1
  231. package/dist/metainfo/frontmatter-preview.d.ts +3 -4
  232. package/dist/metainfo/frontmatter-preview.js +1 -1
  233. package/dist/nav-data-prep/index.js +6 -4
  234. package/dist/nav-indexing/category-nav.d.ts +2 -3
  235. package/dist/nav-indexing/category-nav.js +1 -2
  236. package/dist/nav-indexing/category-tree-nav.d.ts +2 -3
  237. package/dist/nav-indexing/category-tree-nav.js +1 -1
  238. package/dist/nav-indexing/doc-card-grid.d.ts +2 -3
  239. package/dist/nav-indexing/doc-card-grid.js +1 -2
  240. package/dist/nav-indexing/docs-sitemap.d.ts +2 -3
  241. package/dist/nav-indexing/docs-sitemap.js +2 -2
  242. package/dist/nav-indexing/index.d.ts +1 -1
  243. package/dist/nav-indexing/nav-card-grid.d.ts +2 -3
  244. package/dist/nav-indexing/nav-card-grid.js +1 -2
  245. package/dist/nav-indexing/note-tray-index-parts/card-list.d.ts +1 -2
  246. package/dist/nav-indexing/note-tray-index-parts/card-list.js +4 -4
  247. package/dist/nav-indexing/note-tray-index-parts/date-line.d.ts +2 -3
  248. package/dist/nav-indexing/note-tray-index-parts/date-line.js +1 -1
  249. package/dist/nav-indexing/note-tray-index-parts/index-list.d.ts +1 -2
  250. package/dist/nav-indexing/note-tray-index-parts/index-list.js +2 -2
  251. package/dist/nav-indexing/note-tray-index-parts/timeline.d.ts +1 -2
  252. package/dist/nav-indexing/note-tray-index-parts/timeline.js +2 -2
  253. package/dist/nav-indexing/note-tray-index.d.ts +1 -2
  254. package/dist/nav-indexing/note-tray-index.js +1 -1
  255. package/dist/nav-indexing/site-tree-nav-demo.d.ts +2 -3
  256. package/dist/nav-indexing/site-tree-nav-demo.js +2 -2
  257. package/dist/nav-indexing/tag-nav.d.ts +1 -2
  258. package/dist/nav-indexing/tag-nav.js +1 -1
  259. package/dist/nav-indexing/types.d.ts +2 -2
  260. package/dist/nav-indexing/versions-page-content.d.ts +2 -3
  261. package/dist/nav-indexing/versions-page-content.js +8 -8
  262. package/dist/note-tray-index/index.d.ts +1 -2
  263. package/dist/note-tray-index/index.js +1 -1
  264. package/dist/page-loading/page-loading-overlay.d.ts +1 -2
  265. package/dist/page-loading/page-loading-overlay.js +3 -5
  266. package/dist/plugins/agent-export.d.ts +3 -0
  267. package/dist/plugins/agent-export.js +34 -0
  268. package/dist/plugins/internal/agent-export/chunk.d.ts +5 -0
  269. package/dist/plugins/internal/agent-export/chunk.js +90 -0
  270. package/dist/plugins/internal/agent-export/index.d.ts +24 -0
  271. package/dist/plugins/internal/agent-export/index.js +123 -0
  272. package/dist/plugins/internal/agent-export/normalize.d.ts +5 -0
  273. package/dist/plugins/internal/agent-export/normalize.js +73 -0
  274. package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +6 -0
  275. package/dist/plugins/internal/llms-txt/dev-middleware.js +8 -3
  276. package/dist/plugins/internal/llms-txt/emit.js +23 -6
  277. package/dist/plugins/internal/llms-txt/generate.d.ts +7 -1
  278. package/dist/plugins/internal/llms-txt/generate.js +9 -2
  279. package/dist/plugins/internal/llms-txt/load.d.ts +2 -0
  280. package/dist/plugins/internal/llms-txt/load.js +20 -4
  281. package/dist/plugins/internal/llms-txt/types.d.ts +10 -0
  282. package/dist/plugins/routes.js +4 -0
  283. package/dist/preset.d.ts +19 -9
  284. package/dist/preset.js +20 -1
  285. package/dist/route-context-payload/index.js +1 -1
  286. package/dist/routes/404.d.ts +2 -3
  287. package/dist/routes/404.js +1 -1
  288. package/dist/routes/_chrome.d.ts +5 -5
  289. package/dist/routes/_chrome.js +7 -2
  290. package/dist/routes/_context.d.ts +4 -4
  291. package/dist/routes/_design-token-panel-bootstrap.d.ts +1 -4
  292. package/dist/routes/_design-token-panel-bootstrap.js +9 -1
  293. package/dist/routes/docs-slug.d.ts +2 -3
  294. package/dist/routes/docs-tags-index.d.ts +2 -3
  295. package/dist/routes/docs-tags-index.js +1 -1
  296. package/dist/routes/docs-tags-tag.d.ts +2 -3
  297. package/dist/routes/docs-tags-tag.js +1 -1
  298. package/dist/routes/docs-versions.d.ts +2 -3
  299. package/dist/routes/docs-versions.js +1 -1
  300. package/dist/routes/files-path.d.ts +2 -3
  301. package/dist/routes/files-path.js +1 -1
  302. package/dist/routes/index.d.ts +2 -3
  303. package/dist/routes/index.js +1 -1
  304. package/dist/routes/locale-docs-slug.d.ts +2 -3
  305. package/dist/routes/locale-docs-tags-index.d.ts +2 -3
  306. package/dist/routes/locale-docs-tags-index.js +1 -1
  307. package/dist/routes/locale-docs-tags-tag.d.ts +2 -3
  308. package/dist/routes/locale-docs-tags-tag.js +1 -1
  309. package/dist/routes/locale-docs-versions.d.ts +2 -3
  310. package/dist/routes/locale-docs-versions.js +1 -1
  311. package/dist/routes/locale-files-path.d.ts +2 -3
  312. package/dist/routes/locale-files-path.js +1 -1
  313. package/dist/routes/locale-index.d.ts +2 -3
  314. package/dist/routes/locale-index.js +1 -1
  315. package/dist/routes/mcp.d.ts +5 -0
  316. package/dist/routes/mcp.js +25 -0
  317. package/dist/routes/v-docs-slug.d.ts +2 -3
  318. package/dist/routes/v-locale-docs-slug.d.ts +2 -3
  319. package/dist/search-widget/index.d.ts +1 -2
  320. package/dist/search-widget/index.js +4 -7
  321. package/dist/search-widget-script/generated-script.js +12 -5
  322. package/dist/settings-defaults.d.ts +2 -0
  323. package/dist/settings-defaults.js +93 -0
  324. package/dist/settings.d.ts +8 -2
  325. package/dist/sidebar/index.d.ts +1 -1
  326. package/dist/sidebar/sidebar.d.ts +12 -44
  327. package/dist/sidebar/sidebar.js +4 -3
  328. package/dist/sidebar/types.d.ts +14 -0
  329. package/dist/sidebar-prepaint/index.d.ts +1 -2
  330. package/dist/sidebar-prepaint/index.js +4 -6
  331. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +2 -3
  332. package/dist/sidebar-resizer/sidebar-resizer-init.js +3 -3
  333. package/dist/sidebar-toggle-island/index.d.ts +8 -11
  334. package/dist/sidebar-toggle-island/index.js +75 -62
  335. package/dist/sidebar-tree/build-tree.js +5 -6
  336. package/dist/sidebar-tree/types.d.ts +2 -0
  337. package/dist/sidebar-tree-island/index.d.ts +4 -19
  338. package/dist/sidebar-tree-island/index.js +782 -436
  339. package/dist/sidebar-tree-island/scope-state.d.ts +38 -0
  340. package/dist/sidebar-tree-island/scope-state.js +151 -0
  341. package/dist/sidebar-tree-island/sidebar-scroll-preserve.js +6 -2
  342. package/dist/sidebar-utils/index.d.ts +17 -19
  343. package/dist/sidebar-utils/index.js +100 -3
  344. package/dist/sidebar-utils/scope.d.ts +11 -0
  345. package/dist/sidebar-utils/scope.js +67 -0
  346. package/dist/sidebar-with-defaults/index.d.ts +1 -2
  347. package/dist/sidebar-with-defaults/index.js +19 -18
  348. package/dist/site-schema/nav-tree.js +15 -15
  349. package/dist/site-schema/types.d.ts +1 -0
  350. package/dist/site-tree-nav/index.d.ts +2 -3
  351. package/dist/site-tree-nav/index.js +11 -12
  352. package/dist/site-tree-nav/normalize-island-props.d.ts +16 -0
  353. package/dist/site-tree-nav/normalize-island-props.js +122 -0
  354. package/dist/site-tree-nav-island/index.d.ts +3 -3
  355. package/dist/site-tree-nav-island/index.js +243 -144
  356. package/dist/smart-break/index.d.ts +3 -4
  357. package/dist/smart-break/index.js +1 -1
  358. package/dist/tab-item/tab-item.d.ts +3 -4
  359. package/dist/tab-item/tab-item.js +1 -1
  360. package/dist/tag-pages/index.d.ts +3 -3
  361. package/dist/tag-pages/index.js +10 -10
  362. package/dist/theme/color-scheme-provider.d.ts +3 -3
  363. package/dist/theme/color-scheme-provider.js +3 -3
  364. package/dist/theme/theme-pack-provider.d.ts +1 -1
  365. package/dist/theme/theme-pack-provider.js +3 -3
  366. package/dist/theme/theme-toggle.d.ts +2 -3
  367. package/dist/theme/theme-toggle.js +1 -1
  368. package/dist/theme-pack-dialog/index.d.ts +1 -1
  369. package/dist/theme-pack-dialog/index.js +69 -75
  370. package/dist/theme-pack-dialog/theme-pack-card.d.ts +3 -4
  371. package/dist/theme-pack-dialog/theme-pack-card.js +19 -17
  372. package/dist/theme-pack-switcher/index.d.ts +4 -5
  373. package/dist/theme-pack-switcher/index.js +52 -49
  374. package/dist/theme-toggle/index.d.ts +1 -1
  375. package/dist/theme-toggle/index.js +154 -167
  376. package/dist/theme.css +47 -121
  377. package/dist/toc/mobile-toc.d.ts +3 -5
  378. package/dist/toc/mobile-toc.js +29 -27
  379. package/dist/toc/toc.d.ts +3 -4
  380. package/dist/toc/toc.js +18 -18
  381. package/dist/toc/use-active-heading.d.ts +5 -4
  382. package/dist/toc/use-active-heading.js +36 -30
  383. package/dist/toc-prepaint/index.d.ts +1 -2
  384. package/dist/toc-prepaint/index.js +4 -6
  385. package/dist/transitions/nested-island-props-refresh.d.ts +3 -16
  386. package/dist/transitions/nested-island-props-refresh.js +133 -151
  387. package/dist/transitions/page-events.d.ts +8 -13
  388. package/dist/tree-nav-shared/index.d.ts +4 -5
  389. package/dist/tree-nav-shared/index.js +6 -7
  390. package/dist/use-modal-dialog/index.d.ts +9 -63
  391. package/dist/use-modal-dialog/index.js +41 -59
  392. package/dist/versions-page/index.d.ts +3 -3
  393. package/dist/versions-page/index.js +5 -5
  394. package/dist/wind/index.d.ts +5 -0
  395. package/dist/wind/index.js +169 -0
  396. package/dist/wind.json +498 -0
  397. package/dist/z-index-defaults/index.d.ts +4 -4
  398. package/dist/zdtp-loader.d.ts +7 -0
  399. package/dist/zdtp-loader.js +8 -0
  400. package/eject/asset-components/asset-card.tsx +14 -16
  401. package/eject/asset-components/asset-code.tsx +10 -12
  402. package/eject/asset-components/shared.tsx +5 -7
  403. package/eject/breadcrumb/breadcrumb.tsx +15 -16
  404. package/eject/code-group/index.tsx +4 -10
  405. package/eject/content-admonition/index.tsx +5 -6
  406. package/eject/desktop-sidebar-toggle-island/index.ts +4 -0
  407. package/eject/desktop-sidebar-toggle-island/island.tsx +50 -0
  408. package/eject/desktop-sidebar-toggle-island/storage.ts +27 -0
  409. package/eject/details/details.tsx +3 -5
  410. package/eject/doc-history/index.tsx +193 -179
  411. package/eject/doc-pager/index.tsx +3 -4
  412. package/eject/footer/footer.tsx +7 -9
  413. package/eject/header/header.tsx +42 -54
  414. package/eject/header/nav-overflow-script.ts +1 -1
  415. package/eject/header/types.ts +12 -13
  416. package/eject/image-enlarge/index.tsx +84 -69
  417. package/eject/image-enlarge/public.ts +2 -0
  418. package/eject/image-enlarge/ssr-fallback.tsx +7 -0
  419. package/eject/page-loading/page-loading-overlay.tsx +8 -15
  420. package/eject/sidebar/index.ts +1 -0
  421. package/eject/sidebar/sidebar.tsx +16 -97
  422. package/eject/sidebar/types.ts +15 -0
  423. package/eject/sidebar-toggle-island/index.tsx +103 -102
  424. package/eject/sidebar-tree-island/index.tsx +827 -615
  425. package/eject/sidebar-tree-island/scope-state.ts +154 -0
  426. package/eject/sidebar-tree-island/sidebar-scroll-preserve.ts +8 -2
  427. package/eject/site-tree-nav-island/index.tsx +349 -222
  428. package/eject/tab-item/tab-item.tsx +2 -4
  429. package/eject/theme-toggle/hydration-pending.ts +6 -10
  430. package/eject/theme-toggle/index.tsx +133 -173
  431. package/eject/toc/mobile-toc.tsx +27 -31
  432. package/eject/toc/toc.tsx +21 -24
  433. package/eject/toc/use-active-heading.ts +43 -38
  434. package/package.json +40 -22
  435. package/routes-src/404.tsx +2 -3
  436. package/routes-src/_chrome.tsx +7 -2
  437. package/routes-src/_design-token-panel-bootstrap.tsx +1 -63
  438. package/routes-src/docs-slug.tsx +2 -3
  439. package/routes-src/docs-tags-index.tsx +2 -3
  440. package/routes-src/docs-tags-tag.tsx +2 -3
  441. package/routes-src/docs-versions.tsx +2 -3
  442. package/routes-src/files-path.tsx +2 -4
  443. package/routes-src/index.tsx +2 -3
  444. package/routes-src/locale-docs-slug.tsx +2 -3
  445. package/routes-src/locale-docs-tags-index.tsx +2 -3
  446. package/routes-src/locale-docs-tags-tag.tsx +2 -3
  447. package/routes-src/locale-docs-versions.tsx +2 -3
  448. package/routes-src/locale-files-path.tsx +2 -4
  449. package/routes-src/locale-index.tsx +2 -3
  450. package/routes-src/mcp.tsx +25 -0
  451. package/routes-src/v-docs-slug.tsx +2 -3
  452. package/routes-src/v-locale-docs-slug.tsx +2 -3
  453. package/tsconfig.base.json +1 -1
  454. package/dist/safelist.css +0 -2
  455. package/dist/theme-no-reset.css +0 -379
  456. package/eject/desktop-sidebar-toggle-island/index.tsx +0 -110
@@ -0,0 +1,359 @@
1
+ import {
2
+ DEFAULT_STORAGE_PREFIX,
3
+ DEFAULT_TOGGLE_EVENT,
4
+ EAGER_LOAD_GATE_KEY_SUFFIXES,
5
+ EAGER_LOAD_GATE_STATE_FAMILY,
6
+ resolveToggleEventName
7
+ } from "./design-token-panel-constants.js";
8
+ import {
9
+ BEFORE_NAVIGATE_EVENT,
10
+ AFTER_NAVIGATE_EVENT
11
+ } from "./transitions/page-events.js";
12
+ import {
13
+ DEFAULT_THEME_PACK_SLUG,
14
+ THEME_PACK_CHANGED_EVENT,
15
+ readThemePackFromDom
16
+ } from "./theme-pack-switcher/theme-pack-sync.js";
17
+ const COLOR_SCHEME_CHANGED_EVENT = "color-scheme-changed";
18
+ function openStateKey(instancePrefix) {
19
+ return `${instancePrefix}-open`;
20
+ }
21
+ function readOpenState(instancePrefix) {
22
+ try {
23
+ return localStorage.getItem(openStateKey(instancePrefix)) === "1";
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
28
+ function isEmptyEnvelope(raw) {
29
+ if (raw === null || raw === "") return true;
30
+ let parsed;
31
+ try {
32
+ parsed = JSON.parse(raw);
33
+ } catch {
34
+ return false;
35
+ }
36
+ if (parsed === null) return true;
37
+ if (Array.isArray(parsed)) return parsed.length === 0;
38
+ if (typeof parsed === "object") return Object.keys(parsed).length === 0;
39
+ return false;
40
+ }
41
+ function hasPersistedPanelState(config) {
42
+ const instancePrefix = config.storagePrefix ?? DEFAULT_STORAGE_PREFIX;
43
+ try {
44
+ for (const [suffix, gate] of Object.entries(EAGER_LOAD_GATE_KEY_SUFFIXES)) {
45
+ if (gate.requiredConfig !== null && config[gate.requiredConfig] === void 0) {
46
+ continue;
47
+ }
48
+ const value = localStorage.getItem(`${instancePrefix}${suffix}`);
49
+ if (suffix === ":autoload" && value !== "1") continue;
50
+ if (gate.acceptedValues.some((accepted) => accepted === value)) return true;
51
+ }
52
+ for (let i = 0; i < localStorage.length; i++) {
53
+ const key = localStorage.key(i);
54
+ if (key === null || !EAGER_LOAD_GATE_STATE_FAMILY.matchesKey(instancePrefix, key)) {
55
+ continue;
56
+ }
57
+ if (!isEmptyEnvelope(localStorage.getItem(key))) return true;
58
+ }
59
+ } catch {
60
+ }
61
+ return false;
62
+ }
63
+ function readMode() {
64
+ return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
65
+ }
66
+ function withPackScopedStoragePrefix(config, activePack) {
67
+ if (activePack === DEFAULT_THEME_PACK_SLUG) return config;
68
+ return { ...config, storagePrefix: `${config.storagePrefix}--${activePack}` };
69
+ }
70
+ function collectDeclaredTokenNames(config) {
71
+ const names = [];
72
+ for (const tab of config.tabs ?? []) {
73
+ for (const tier of tab.tiers ?? []) {
74
+ for (const item of tier.items ?? []) {
75
+ names.push(item.cssVar);
76
+ }
77
+ }
78
+ const baseRoles = tab.colorExtras?.baseRoles;
79
+ if (baseRoles) {
80
+ for (const cssVar of Object.values(baseRoles)) {
81
+ if (typeof cssVar === "string" && cssVar.length > 0) {
82
+ names.push(cssVar);
83
+ }
84
+ }
85
+ }
86
+ }
87
+ return names;
88
+ }
89
+ function clearAppliedTokenOverrides(config) {
90
+ const names = collectDeclaredTokenNames(config);
91
+ if (config.applySink) {
92
+ try {
93
+ config.applySink.clear(names);
94
+ } catch (err) {
95
+ console.warn(
96
+ "[zudo-doc] applySink.clear threw during theme-pack switch; outgoing overrides may linger.",
97
+ err
98
+ );
99
+ }
100
+ return;
101
+ }
102
+ const style = document.documentElement.style;
103
+ for (const name of names) {
104
+ style.removeProperty(name);
105
+ }
106
+ }
107
+ function bootstrapDesignTokenPanel(buildConfig) {
108
+ bootstrapDesignTokenPanelForScope(buildConfig);
109
+ }
110
+ function bootstrapDesignTokenPanelForScope(buildConfig, activationSignal, onConfigured) {
111
+ if (activationSignal?.aborted) return;
112
+ if (typeof window === "undefined" || typeof document === "undefined") {
113
+ return;
114
+ }
115
+ let zdtpImport = null;
116
+ let activationInFlight = false;
117
+ let configurePhase = "pending";
118
+ const pendingListenerCleanups = [];
119
+ let pendingListenersRetained = false;
120
+ function removePendingListeners() {
121
+ if (pendingListenersRetained) return;
122
+ pendingListenersRetained = true;
123
+ for (const cleanup of pendingListenerCleanups.splice(0).reverse()) cleanup();
124
+ activationSignal?.removeEventListener("abort", onActivationAbort);
125
+ }
126
+ function retainDocumentListeners() {
127
+ pendingListenersRetained = true;
128
+ pendingListenerCleanups.length = 0;
129
+ activationSignal?.removeEventListener("abort", onActivationAbort);
130
+ }
131
+ function addPendingListener(target, type, listener) {
132
+ target.addEventListener(type, listener);
133
+ pendingListenerCleanups.push(() => target.removeEventListener(type, listener));
134
+ }
135
+ function onActivationAbort() {
136
+ if (configurePhase !== "pending") return;
137
+ removePendingListeners();
138
+ activationInFlight = false;
139
+ }
140
+ activationSignal?.addEventListener("abort", onActivationAbort, { once: true });
141
+ let pendingToggles = 0;
142
+ function loadZdtp() {
143
+ if (zdtpImport === null) {
144
+ zdtpImport = import("@takazudo/zudo-doc/zdtp-loader").catch((err) => {
145
+ zdtpImport = null;
146
+ throw err;
147
+ });
148
+ }
149
+ return zdtpImport;
150
+ }
151
+ function configureAndWire(zdtp) {
152
+ const {
153
+ configurePanelIfActive,
154
+ configurePanel,
155
+ reapplyPersistedOverrides,
156
+ setLifecycleAdapter,
157
+ showDesignTokenPanel
158
+ } = zdtp;
159
+ let currentConfig = withPackScopedStoragePrefix(
160
+ buildConfig(readMode()),
161
+ readThemePackFromDom()
162
+ );
163
+ const initialHandle = configurePanelIfActive(
164
+ activationSignal,
165
+ currentConfig
166
+ );
167
+ if (!initialHandle) return false;
168
+ let handle = initialHandle;
169
+ if (activationSignal?.aborted) {
170
+ handle.destroy();
171
+ return false;
172
+ }
173
+ let pendingMode = readMode();
174
+ let timer = null;
175
+ addPendingListener(window, COLOR_SCHEME_CHANGED_EVENT, () => {
176
+ pendingMode = readMode();
177
+ if (timer !== null) return;
178
+ timer = setTimeout(() => {
179
+ timer = null;
180
+ const mode = pendingMode;
181
+ const wasOpen = readOpenState(handle.instanceId);
182
+ handle.destroy();
183
+ currentConfig = withPackScopedStoragePrefix(
184
+ buildConfig(mode),
185
+ readThemePackFromDom()
186
+ );
187
+ handle = configurePanel(currentConfig);
188
+ if (wasOpen) showDesignTokenPanel();
189
+ }, 0);
190
+ });
191
+ let pendingPack = readThemePackFromDom();
192
+ let packTimer = null;
193
+ pendingListenerCleanups.push(() => {
194
+ if (timer !== null) clearTimeout(timer);
195
+ if (packTimer !== null) clearTimeout(packTimer);
196
+ });
197
+ addPendingListener(window, THEME_PACK_CHANGED_EVENT, () => {
198
+ pendingPack = readThemePackFromDom();
199
+ if (packTimer !== null) return;
200
+ packTimer = setTimeout(() => {
201
+ packTimer = null;
202
+ const pack = pendingPack;
203
+ const wasOpen = readOpenState(handle.instanceId);
204
+ const outgoingConfig = currentConfig;
205
+ handle.destroy();
206
+ clearAppliedTokenOverrides(outgoingConfig);
207
+ currentConfig = withPackScopedStoragePrefix(buildConfig(readMode()), pack);
208
+ handle = configurePanel(currentConfig);
209
+ reapplyPersistedOverrides();
210
+ if (wasOpen) showDesignTokenPanel();
211
+ }, 0);
212
+ });
213
+ if (activationSignal?.aborted) {
214
+ handle.destroy();
215
+ return false;
216
+ }
217
+ reapplyPersistedOverrides();
218
+ const adapter = {
219
+ onBeforeSwap(cb) {
220
+ const handler = () => cb();
221
+ document.addEventListener(BEFORE_NAVIGATE_EVENT, handler);
222
+ return () => document.removeEventListener(BEFORE_NAVIGATE_EVENT, handler);
223
+ },
224
+ onPageLoad(cb) {
225
+ const handler = () => cb();
226
+ document.addEventListener(AFTER_NAVIGATE_EVENT, handler);
227
+ return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handler);
228
+ }
229
+ };
230
+ if (activationSignal?.aborted) {
231
+ handle.destroy();
232
+ return false;
233
+ }
234
+ setLifecycleAdapter(adapter);
235
+ return true;
236
+ }
237
+ async function activate() {
238
+ if (activationSignal?.aborted) {
239
+ removePendingListeners();
240
+ return;
241
+ }
242
+ if (activationInFlight || configurePhase !== "pending") return;
243
+ activationInFlight = true;
244
+ let zdtp;
245
+ try {
246
+ zdtp = await loadZdtp();
247
+ } catch (err) {
248
+ activationInFlight = false;
249
+ if (activationSignal?.aborted) return;
250
+ pendingToggles = 0;
251
+ console.error(
252
+ "[zudo-doc] design-token-panel: loading @takazudo/zdtp failed; the next toggle retries.",
253
+ err
254
+ );
255
+ return;
256
+ }
257
+ if (activationSignal?.aborted) {
258
+ activationInFlight = false;
259
+ removePendingListeners();
260
+ return;
261
+ }
262
+ try {
263
+ if (!configureAndWire(zdtp)) {
264
+ if (activationSignal?.aborted) removePendingListeners();
265
+ return;
266
+ }
267
+ configurePhase = "configured";
268
+ onConfigured?.();
269
+ retainDocumentListeners();
270
+ } catch (err) {
271
+ configurePhase = "failed";
272
+ removePendingListeners();
273
+ console.error(
274
+ "[zudo-doc] design-token-panel: configure failed; the panel is disabled until the next full page load.",
275
+ err
276
+ );
277
+ return;
278
+ } finally {
279
+ activationInFlight = false;
280
+ }
281
+ if (!activationSignal?.aborted && pendingToggles % 2 === 1) {
282
+ zdtp.showDesignTokenPanel();
283
+ }
284
+ pendingToggles = 0;
285
+ }
286
+ function readActiveConfig() {
287
+ return withPackScopedStoragePrefix(
288
+ buildConfig(readMode()),
289
+ readThemePackFromDom()
290
+ );
291
+ }
292
+ const onInterimToggle = () => {
293
+ if (configurePhase !== "pending") return;
294
+ pendingToggles += 1;
295
+ void activate();
296
+ };
297
+ const boundToggleChannels = /* @__PURE__ */ new Set();
298
+ let instanceToggleChannel = null;
299
+ function bindToggleChannel(name) {
300
+ if (boundToggleChannels.has(name)) return;
301
+ boundToggleChannels.add(name);
302
+ addPendingListener(window, name, onInterimToggle);
303
+ }
304
+ function refreshInstanceToggleChannel(config) {
305
+ const resolved = resolveToggleEventName(config);
306
+ if (resolved === instanceToggleChannel) return;
307
+ if (instanceToggleChannel !== null && instanceToggleChannel !== DEFAULT_TOGGLE_EVENT) {
308
+ window.removeEventListener(instanceToggleChannel, onInterimToggle);
309
+ boundToggleChannels.delete(instanceToggleChannel);
310
+ }
311
+ instanceToggleChannel = resolved;
312
+ bindToggleChannel(resolved);
313
+ }
314
+ const bootConfig = readActiveConfig();
315
+ bindToggleChannel(DEFAULT_TOGGLE_EVENT);
316
+ refreshInstanceToggleChannel(bootConfig);
317
+ window.__zdtpReadyClicks?.();
318
+ if (hasPersistedPanelState(bootConfig)) void activate();
319
+ addPendingListener(window, THEME_PACK_CHANGED_EVENT, () => {
320
+ if (configurePhase !== "pending") return;
321
+ const activeConfig = readActiveConfig();
322
+ refreshInstanceToggleChannel(activeConfig);
323
+ if (hasPersistedPanelState(activeConfig)) void activate();
324
+ });
325
+ addPendingListener(window, COLOR_SCHEME_CHANGED_EVENT, () => {
326
+ if (configurePhase !== "pending") return;
327
+ refreshInstanceToggleChannel(readActiveConfig());
328
+ });
329
+ }
330
+ let bootstrapWinner = null;
331
+ let warnedLostRace = false;
332
+ function warnLostBootstrapRace(winnerOrigin, loserOrigin) {
333
+ if (typeof window === "undefined" || warnedLostRace) return;
334
+ warnedLostRace = true;
335
+ const detail = loserOrigin === "configured" && winnerOrigin === "default" ? "The package-default island configured the panel earlier in this browser session, so `designTokenPanelConfigModule` did not apply on this page. This happens when the session first hard-loaded a page rendered by a self-contained `pages/` stub, which reaches the package default instead of the package-injected route. Thread your builder through `chromeBindings.DesignTokenPanelBootstrap` to make it apply on every page regardless of entry point." : `The ${winnerOrigin} island configured the panel first; this ${loserOrigin} island's builder was ignored. zdtp is configured once per session \u2014 mount exactly one design-token-panel bootstrap, e.g. via \`chromeBindings.DesignTokenPanelBootstrap\`.`;
336
+ console.warn(`[zudo-doc] design-token panel already configured. ${detail}`);
337
+ }
338
+ function runDesignTokenPanelBootstrapOnce(build, origin = "default", activationSignal) {
339
+ if (activationSignal?.aborted) return;
340
+ if (bootstrapWinner) {
341
+ if (bootstrapWinner.build !== build) warnLostBootstrapRace(bootstrapWinner.origin, origin);
342
+ return;
343
+ }
344
+ const winner = { origin, build, configured: false };
345
+ bootstrapWinner = winner;
346
+ const releasePendingClaim = () => {
347
+ if (!winner.configured && bootstrapWinner === winner) bootstrapWinner = null;
348
+ };
349
+ activationSignal?.addEventListener("abort", releasePendingClaim, { once: true });
350
+ bootstrapDesignTokenPanelForScope(build, activationSignal, () => {
351
+ winner.configured = true;
352
+ activationSignal?.removeEventListener("abort", releasePendingClaim);
353
+ });
354
+ }
355
+ export {
356
+ bootstrapDesignTokenPanel,
357
+ runDesignTokenPanelBootstrapOnce,
358
+ withPackScopedStoragePrefix
359
+ };
@@ -0,0 +1,5 @@
1
+ /** Package-default island; zdtp owns the opaque Preact UI it mounts. */
2
+ export declare function DesignTokenPanelBootstrap(): null;
3
+ export declare namespace DesignTokenPanelBootstrap {
4
+ var displayName: string;
5
+ }
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ import { getScope } from "@takazudo/zfb/zudo-react";
3
+ import { buildDesignTokenPanelConfig } from "./design-token-panel-config/index.js";
4
+ import { runDesignTokenPanelBootstrapOnce } from "./design-token-panel-bootstrap-controller.js";
5
+ function DesignTokenPanelBootstrap() {
6
+ const scope = getScope();
7
+ scope.onActivate(() => {
8
+ runDesignTokenPanelBootstrapOnce(
9
+ buildDesignTokenPanelConfig,
10
+ "default",
11
+ scope.abortSignal
12
+ );
13
+ });
14
+ return null;
15
+ }
16
+ DesignTokenPanelBootstrap.displayName = "DesignTokenPanelBootstrap";
17
+ export {
18
+ DesignTokenPanelBootstrap
19
+ };
@@ -1,197 +1,7 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
1
  /**
4
- * Design-token panel (zdtp) WIRING MECHANISM + PACKAGE-DEFAULT ISLAND (#2658,
5
- * epic Minimal Scaffold #2651). zdtp itself is LAZY-LOADED (#3282, epic
6
- * #3261): this module carries NO top-level value import of `@takazudo/zdtp`
7
- * whatsoever. It used to eagerly import the side-effect-free `/constants` leaf;
8
- * since #4018 those constants come from the in-package mirror
9
- * `./design-token-panel-constants.js`, because that one static edge made an
10
- * OPTIONAL peer a hard build-time requirement for every chrome consumer
11
- * (#4009 — see that module's header).
12
- * The root package is `import()`ed on the first dispatch on either resolved
13
- * toggle channel (the shared `toggle-design-token-panel`, or this instance's own —
14
- * see the public 0.5 {@link resolveToggleEventName}), or eagerly when the
15
- * persisted-state probe finds saved tweaks / a previously-open panel, so zdtp's bundle stays
16
- * out of the initial page load.
17
- *
18
- * `bootstrapDesignTokenPanel` is a callable that configures zdtp's panel and
19
- * wires its lifecycle hooks to zfb's navigation events via
20
- * `setLifecycleAdapter()`. It receives a mode-scoped PanelConfig builder —
21
- * either a project override or the package default from
22
- * `@takazudo/zudo-doc/design-token-panel-config`. The builder module is
23
- * zdtp-runtime-free (type-only zdtp imports), which is what lets it stay a
24
- * STATIC import here without defeating the lazy load — and lets the probe
25
- * compute the exact active storage prefix before zdtp exists.
26
- *
27
- * The current call shape is a mode-scoped builder. It rebuilds the panel per
28
- * light/dark mode on every `color-scheme-changed` toggle:
29
- *
30
- * import { bootstrapDesignTokenPanel } from "@takazudo/zudo-doc/design-token-panel-bootstrap";
31
- * import { buildDesignTokenPanelConfig } from "@/config/design-token-panel-config";
32
- * bootstrapDesignTokenPanel(buildDesignTokenPanelConfig);
33
- *
34
- * `DesignTokenPanelBootstrap` (below) is the PACKAGE-OWNED island component
35
- * that wires the mode-scoped builder for every `createChrome` consumer with no
36
- * host config file — the #2658 "Approach (a)" package default. Since #3396 it
37
- * binds the package-default builder DIRECTLY
38
- * (`./design-token-panel-config/index.js`), not the routes plugin's
39
- * `virtual:zudo-doc-design-token-panel-config` module.
40
- * `packages/zudo-doc/src/chrome/derive.tsx` statically imports it so zfb's
41
- * island scanner walks route → chrome → derive → here (mirrors the DocHistory
42
- * #2480 static-import contract). A host that ejects entirely can call
43
- * `bootstrapDesignTokenPanel` with its own builder. Package-owned INJECTED
44
- * routes do not render this component — they render the configured wrapper
45
- * described below — but every other `createChrome` caller does.
46
- *
47
- * COUPLING REMOVED (#3396, epic #3394): this module no longer imports any
48
- * `virtual:` specifier, so `@takazudo/zudo-doc/chrome` (which reaches here via
49
- * `chrome/derive.tsx`) bundles OUTSIDE a zfb build with zero shims, and a
50
- * `packageOwnedRoutes: false` host needs no alias for the config specifier.
51
- *
52
- * WHERE THE HOST OVERRIDE ENTERS NOW: `settings.designTokenPanelConfigModule`
53
- * still travels through `virtual:zudo-doc-design-token-panel-config`, but the
54
- * ONLY module that imports that specifier is the routes-only wrapper
55
- * `routes/_design-token-panel-bootstrap.tsx`. It calls
56
- * {@link runDesignTokenPanelBootstrapOnce} with the resolved builder and is
57
- * threaded into `hostBindings.DesignTokenPanelBootstrap` by `routes/_chrome.tsx`,
58
- * so `deriveBodyEndIslands` renders it instead of the package default on
59
- * injected routes. The wrapper is a component-level seam INSIDE the client
60
- * island bundle — deliberately NOT a module-level setter: the route/SSR graph
61
- * and the hydrated island bundle are separate module graphs, so a setter called
62
- * during route evaluation would configure only the server instance while the
63
- * client re-evaluated this module and kept the default.
64
- *
65
- * SELF-CONTAINED `pages/` STUBS (was a KNOWN GAP in #3396; closed by #3414).
66
- * A host that renders docs through a self-contained `pages/` stub (the
67
- * locked-manifest shape, #2653 — it calls `createChrome` directly rather than
68
- * going through `routes/_chrome.tsx`) reaches the package default here, so
69
- * `designTokenPanelConfigModule` does not apply to those pages. Because
70
- * {@link runDesignTokenPanelBootstrapOnce}'s latch is per SESSION, not per
71
- * page, that used to make the whole SPA session's panel config depend on which
72
- * page was hard-loaded first (#3406). Two things now bound it:
73
- *
74
- * - `chrome/derive.tsx` SKIPS this package default as the slot default when
75
- * `settings.designTokenPanelConfigModule` is set and the host supplied no
76
- * explicit `chromeBindings.DesignTokenPanelBootstrap` (and
77
- * `packageOwnedRoutes` is on). Stub-rendered pages then mount NO panel island
78
- * at all, so they can no longer win the latch with the wrong builder — the
79
- * configured island is the genuine first caller whatever the entry page. The
80
- * absence on stub pages is deliberate; such a host threads its own builder
81
- * via `chromeBindings.DesignTokenPanelBootstrap` to get a panel there too.
82
- * - Any residual default-then-configured race that skip does not close warns at
83
- * runtime, naming both the setting and that workaround — see
84
- * {@link runDesignTokenPanelBootstrapOnce}.
85
- *
86
- * Package-first wiring landed in S9a zudolab/zudo-doc#2333; mode-scoped rebuild
87
- * wiring was added in zudolab/zudo-doc#2610 and the package-default island in
88
- * #2658.
89
- *
90
- * CSS is pulled via `@import "@takazudo/zdtp/styles.css"` in the project's
91
- * `src/styles/global.css` so the panel chrome lands in the main page CSS
92
- * bundle (not a deferred chunk). Vite library mode strips the source CSS
93
- * import from the emitted JS, so the explicit CSS-side import is the
94
- * required pull point. See @takazudo/zdtp PORTABLE-CONTRACT.md §7.
2
+ * Public facade for the design-token-panel bootstrap subpath. Callable setup
3
+ * helpers live in the ordinary controller module; the sole island marker is
4
+ * defined in its own `use client` entry.
95
5
  */
96
- import type { JSX } from "preact";
97
- import type { PanelConfig } from "@takazudo/zdtp";
98
- /** Active color-scheme mode, read from `<html data-theme>`. */
99
- type ColorSchemeMode = "light" | "dark";
100
- /**
101
- * A per-mode PanelConfig factory. The package default and host overrides use
102
- * this same shape so panel defaults follow the live light/dark mode.
103
- */
104
- export type PanelConfigBuilder = (mode: ColorSchemeMode) => PanelConfig;
105
- /**
106
- * Theme-pack storage-prefix rule (ADR theme-packs.md Decision 4), enforced
107
- * CENTRALLY here — never per-builder, so host builders supplied via
108
- * `designTokenPanelConfigModule` cannot cross-contaminate namespaces even if
109
- * unaware of packs:
110
- *
111
- * - active pack `default` → the builder's `storagePrefix` stays BYTE-UNCHANGED
112
- * (the existing-user carry-over guarantee: `zudo-doc-tweak` keys keep
113
- * working on the stock look).
114
- * - any other pack → `${storagePrefix}--<slug>` (double hyphen avoids
115
- * colliding with zdtp's own `-open`/version suffixes). zdtp derives every
116
- * key — including the `${prefix}-open` open-state mirror — from the prefix,
117
- * so tweaks saved under pack A are invisible under pack B and restored
118
- * verbatim on switch-back.
119
- *
120
- * The `PanelConfigBuilder` signature stays `(mode) => PanelConfig` — this is a
121
- * post-process of the RETURNED config, not a builder-contract change.
122
- */
123
- export declare function withPackScopedStoragePrefix(config: PanelConfig, activePack: string): PanelConfig;
124
- /**
125
- * Bootstrap zdtp for a project — LAZILY (#3282). At mount this registers the
126
- * interim toggle listener on both resolved channels (#3315), drains the
127
- * pre-hydration click queue, and probes localStorage for persisted panel
128
- * state; the actual
129
- * `import("@takazudo/zudo-doc/zdtp-loader")` (zdtp's package-owned
130
- * re-export, #4201) + configure happen on the first toggle (or
131
- * immediately on a probe hit). The configure body then wires everything the
132
- * pre-lazy version wired eagerly: `configurePanel` with the pack-scoped
133
- * mode-config, the `color-scheme-changed` / `theme-pack-changed` rebuild
134
- * listeners, `reapplyPersistedOverrides`, and the zfb lifecycle adapter via
135
- * `setLifecycleAdapter`.
136
- *
137
- * @param buildConfig - The project's `(mode) => PanelConfig` builder for
138
- * mode-scoped rebuilds.
139
- */
140
- export declare function bootstrapDesignTokenPanel(buildConfig: PanelConfigBuilder): void;
141
- /**
142
- * Which island won the once-latch below (#3414).
143
- *
144
- * - `"default"` — the package-default {@link DesignTokenPanelBootstrap}, bound
145
- * to the package-default builder.
146
- * - `"configured"` — the routes-only wrapper
147
- * (`routes/_design-token-panel-bootstrap.tsx`), bound to whatever
148
- * `virtual:zudo-doc-design-token-panel-config` resolved to (a host's
149
- * `settings.designTokenPanelConfigModule` when set, the package default
150
- * otherwise).
151
- */
152
- export type DesignTokenPanelBootstrapOrigin = "default" | "configured";
153
- /**
154
- * Run {@link bootstrapDesignTokenPanel} at most once per module instance, with
155
- * whichever mode-scoped builder the caller supplies.
156
- *
157
- * Exists so the routes-only configured wrapper
158
- * (`routes/_design-token-panel-bootstrap.tsx`, #3396) gets the same one-shot
159
- * semantics as {@link DesignTokenPanelBootstrap} while supplying the
160
- * host-overridable builder from `virtual:zudo-doc-design-token-panel-config`.
161
- * The guard is deliberately shared across both callers: `deriveBodyEndIslands`
162
- * renders exactly ONE of them, and if a host ever mounted both, configuring the
163
- * panel twice would re-mount it rather than layer the two configs.
164
- *
165
- * `origin` tags WHICH island is calling (#3414). It is optional, defaulting to
166
- * `"default"`, because this function is reachable from the frozen
167
- * `./design-token-panel-bootstrap` subpath (API.md) — an added required
168
- * parameter would break an ejected host that calls it. Both in-package callers
169
- * pass it explicitly.
170
- *
171
- * This is a CALL, not a module-level setter — the builder is passed in at
172
- * render time inside whichever bundle the island actually hydrates in, so it
173
- * never has to cross the route-graph → island-bundle boundary.
174
- */
175
- export declare function runDesignTokenPanelBootstrapOnce(build: PanelConfigBuilder, origin?: DesignTokenPanelBootstrapOrigin): void;
176
- /**
177
- * The package-default `<DesignTokenPanelBootstrap/>` island: mounted (via
178
- * `Island({ when: "load" })`, no `ssrFallback` — it renders nothing on either
179
- * side) by `../doc-body-end-islands/index.tsx` when `settings.designTokenPanel`
180
- * is on, gated the same way `AiChatModal`/`ImageEnlarge`/`MermaidEnlarge` are.
181
- * On first render, calls `bootstrapDesignTokenPanel` with the PACKAGE-DEFAULT
182
- * mode-scoped `buildDesignTokenPanelConfig` builder. A host's
183
- * `designTokenPanelConfigModule` override does not reach this component — it
184
- * arrives through the routes-only wrapper described in the module docblock.
185
- *
186
- * `displayName` pinned explicitly (belt-and-braces, matching
187
- * `AiChatModal`/`ImageEnlarge`/`MermaidEnlarge`/`DocHistory`) so zfb's
188
- * `captureComponentName` emits a stable `data-zfb-island="DesignTokenPanelBootstrap"`
189
- * marker independent of minification. It MUST keep matching the exported
190
- * binding identifier — zfb's island scanner registers by the scanner-visible
191
- * export name and warns when a `displayName` diverges from it.
192
- */
193
- export declare function DesignTokenPanelBootstrap(): JSX.Element | null;
194
- export declare namespace DesignTokenPanelBootstrap {
195
- var displayName: string;
196
- }
197
- export {};
6
+ export * from "./design-token-panel-bootstrap-controller.js";
7
+ export { DesignTokenPanelBootstrap } from "./design-token-panel-bootstrap-island.js";