@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
package/dist/theme.css CHANGED
@@ -1,85 +1,5 @@
1
- /* ============================================================================
2
- * @takazudo/zudo-doc — default design tokens + project-agnostic base rules
3
- *
4
- * Shipped to consumers as `@takazudo/zudo-doc/theme.css` (copied to
5
- * `dist/theme.css` by scripts/copy-theme-css.mjs on build). Single source of
6
- * truth for the default `@theme` token block (colors, spacing, icon sizes,
7
- * elevation, typography, radius, breakpoints, z-index) plus the small set of
8
- * project-agnostic base rules (scroll-margin, selection color, focus ring,
9
- * search / find-in-page highlight, version-switcher visibility) every
10
- * zudo-doc project needs. See zudolab/zudo-doc#2655.
11
- *
12
- * ── @import order (load-bearing) ────────────────────────────────────────────
13
- * The consumer's global.css MUST import this file:
14
- * 1. AFTER `@layer zd-preflight, zd-flow;` and the two Tailwind imports
15
- * (`tailwindcss/preflight` layer(zd-preflight), `tailwindcss/utilities`).
16
- * Those three lines stay project-side — path-relative `@source`/`@layer`
17
- * resolution requires them to live in the consumer's own CSS file (see
18
- * packages/create-zudo-doc/templates/base/src/styles/global.css).
19
- * 2. BEFORE `@takazudo/zudo-doc/safelist.css`, `content.css`,
20
- * `page-loading.css`, and `features.css` — all four consume the
21
- * `@theme` tokens defined here (colors, spacing, typography, z-index),
22
- * and `content.css`'s `@layer zd-flow` rule depends on the cascade
23
- * layer order already being established by the time it loads.
24
- * 3. BEFORE the project's own token-override `@theme { … }` block — Tailwind
25
- * v4 `@theme` resolution is last-declaration-wins per custom property,
26
- * so a later project block can redefine any default declared here.
27
- *
28
- * ── Consumer contract ────────────────────────────────────────────────────────
29
- * The consumer must inject the `--zd-*` ramp/role custom properties this file
30
- * aliases into `--color-*` tokens (`ColorSchemeProvider`, see
31
- * `@takazudo/zudo-doc/theme`). Without them every `--color-*` token below
32
- * resolves to nothing (the tight-token guardrail below wipes Tailwind's
33
- * default palette; only `--zd-*`-backed aliases repopulate it).
34
- *
35
- * Namespace contract: zudo-doc reserves the 23 bare `--color-*` alias names
36
- * declared in the first block plus the `--color-zd-*` prefix. Every other
37
- * `--color-*` name, such as `--color-acme-*`, belongs to the embedder. A
38
- * second `@theme` block that defines any reserved bare name in the same
39
- * document is unsupported: Tailwind merges every `@theme` block reached from
40
- * the entry, last declaration wins, and no error is reported. Embedders must
41
- * namespace their own tokens (`--color-<theirs>-*`), import this file before
42
- * their own `@theme` block so this reset cannot reach their tokens, or import
43
- * `@takazudo/zudo-doc/theme-no-reset.css` (#4055) when import order is outside
44
- * their control. Consume zudo-doc colors through `--color-zd-*` / `bg-zd-*`.
45
- *
46
- * Deliberately NOT shipped here: `--color-page-loading-overlay`. That scrim
47
- * token stays feature-injected by a project's `dynamicPageTransition` wiring
48
- * (its default depends on `--color-overlay`, which IS defined below) — do
49
- * not add it to this base block.
50
- *
51
- * ── Z-index defaults ─────────────────────────────────────────────────────────
52
- * The 13 `--z-index-*` entries below are the package DEFAULT tiers (mirrors
53
- * `defaultZIndexTiers` from `@takazudo/zudo-doc/z-index-defaults`, #2654).
54
- * A project only needs its own `src/config/z-index-tokens.ts` +
55
- * `gen:z-index`/`check:z-index` codegen wiring if it OVERRIDES a tier — its
56
- * own `@theme` block (declared after this file's import) simply redefines
57
- * the specific `--z-index-<name>` it wants to change.
58
- * ============================================================================ */
59
-
60
- @theme {
61
- /* ========================================
62
- * Tight-token color reset
63
- *
64
- * Wipes all Tailwind default color tokens (`--color-*`) so only
65
- * project-defined palette and semantic tokens remain. This enforces
66
- * zudo-doc's tight-token policy: "NEVER use Tailwind default colors"
67
- * (documented per-project in src/CLAUDE.md's Color Rules). Semantic color
68
- * tokens (defined below) are added back after this reset.
69
- *
70
- * The upstream split-import fix (zfb#159 / 9e37551, shipped in f68a9ba)
71
- * eliminated the original leak cause (zfb no longer prepends the full
72
- * @import "tailwindcss" bundle). The reset is retained as an explicit
73
- * design guardrail — it prevents accidental default palette bleed from any
74
- * future upstream change and keeps the color surface intentional.
75
- *
76
- * NOT reset: `--spacing` (the base spacing scale, default 0.25rem).
77
- * Tailwind spacing utilities compute as calc(var(--spacing) * N); wiping
78
- * `--spacing` collapses them to zero (observed in Wave 4 Sub-7 #1403).
79
- * This guardrail resets ONLY the color namespace — never widen it.
80
- * ======================================== */
81
- --color-*: initial;
82
-
1
+ /* Authored design properties backing zudo-wind tokens. */
2
+ :root {
83
3
  /* ========================================
84
4
  * Colors — Three-tier token system
85
5
  * ======================================== */
@@ -148,14 +68,7 @@
148
68
  /* Image overlay button chrome */
149
69
  --spacing-image-overlay-inset: 0.5rem; /* 8px — overlay button corner inset + internal padding */
150
70
 
151
- /* ========================================
152
- * Elevation — the tight `@import "tailwindcss/utilities"` (no default
153
- * @theme) drops Tailwind's default shadow scale, so `shadow-*` utilities
154
- * generate nothing. Re-add the one elevation the components use: header
155
- * and version-switcher dropdown panels apply `shadow-lg`. Value is
156
- * Tailwind v4's default shadow-lg; the black is intentionally
157
- * theme-independent (a drop shadow is absence of light, not a themed color).
158
- * ======================================== */
71
+ /* Package elevation used by the header and dropdown panels. */
159
72
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
160
73
 
161
74
  /* ========================================
@@ -186,6 +99,7 @@
186
99
  --leading-snug: 1.375;
187
100
  --leading-normal: 1.5;
188
101
  --leading-relaxed: 1.625;
102
+ --leading-none: 1;
189
103
 
190
104
  /* Letter spacing / tracking (4 steps) */
191
105
  --tracking-tight: -0.025em; /* headings, display text */
@@ -198,7 +112,8 @@
198
112
  * ======================================== */
199
113
  --radius-DEFAULT: 0.25rem; /* 4px — rounded */
200
114
  --radius-lg: 0.5rem; /* 8px — rounded-lg */
201
- --radius-full: 9999px; /* rounded-full */
115
+ --radius-full: 9999px;
116
+ --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1); /* rounded-full */
202
117
 
203
118
  /* ========================================
204
119
  * Breakpoints (3 steps)
@@ -208,30 +123,8 @@
208
123
  --breakpoint-xl: 1280px;
209
124
  }
210
125
 
211
- /* ==========================================================================
212
- * Tailwind-facing zudo-doc namespace aliases
213
- *
214
- * zudolab/zudo-doc#4051 needs a collision-free surface for code outside
215
- * zudo-doc. An embedder's own components can use `bg-zd-*` / `var(--color-zd-*)`
216
- * without touching the bare tier consumed by the package chrome.
217
- *
218
- * This block is `static` because Tailwind v4 emits a plain `@theme` token into
219
- * `:root` only when something in its own scan consumes it. zudo-doc never
220
- * scans the code that consumes these aliases, so the variables must always be
221
- * emitted. `static` guarantees the variables; `bg-zd-*` utilities are still
222
- * generated only when the consumer's own Tailwind scan sees those classes.
223
- *
224
- * Keep this block after the reset: `--color-*: initial` clears every
225
- * `--color-*` declared before it in the merged theme, regardless of the file
226
- * that declared it. The package chrome deliberately continues consuming the
227
- * bare tier; do not migrate call sites ad hoc.
228
- *
229
- * The raw tier is prefix-first (`--zd-*`) outside `@theme`; this semantic tier
230
- * is category-first (`--color-zd-*`) inside `@theme`. A third ordering that
231
- * puts the namespace before the category is disconnected from both tiers and
232
- * must never be introduced.
233
- * ========================================================================== */
234
- @theme static {
126
+ /* Namespaced color aliases remain available to external consumers. */
127
+ :root {
235
128
  --color-zd-bg: var(--zd-bg);
236
129
  --color-zd-fg: var(--zd-fg);
237
130
  --color-zd-sel-bg: var(--zd-selection-bg);
@@ -261,9 +154,8 @@
261
154
  * Z-index tiers — semantic, single-namespace default scale.
262
155
  *
263
156
  * The 13 tokens below are the package DEFAULTS (mirrors defaultZIndexTiers
264
- * from @takazudo/zudo-doc/z-index-defaults, #2654). Tailwind v4 reads each
265
- * --z-index-<name> theme key and generates a `z-<name>` utility, so e.g.
266
- * --z-index-toolbar: 20 produces `.z-toolbar { z-index: 20 }`; raw CSS can
157
+ * from @takazudo/zudo-doc/z-index-defaults, #2654). The wind config points at each
158
+ * --z-index-<name> property and generates a `z-<name>` utility. Raw CSS can
267
159
  * also reference `z-index: var(--z-index-<name>)`.
268
160
  *
269
161
  * A project only needs its own src/config/z-index-tokens.ts +
@@ -271,7 +163,7 @@
271
163
  * GENERATED:Z_INDEX block that used to live in every project's global.css is
272
164
  * now opt-in customization only, not a mandatory per-project artifact.
273
165
  * ======================================== */
274
- @theme inline {
166
+ :root {
275
167
  --z-index-content: 0;
276
168
  --z-index-local-1: 1;
277
169
  --z-index-local-2: 2;
@@ -301,7 +193,7 @@
301
193
  --text-scale-xl: 3rem; /* 48px */
302
194
  --text-scale-2xl: 3.75rem; /* 60px */
303
195
 
304
- --default-transition-duration: 150ms; /* consumed by image-enlarge and hash-link opacity fade */
196
+ --default-transition-duration: 150ms; /* consumed by image-enlarge transitions */
305
197
  --zd-transition-slow: 200ms; /* sidebar transform/visibility and content-band max-width */
306
198
  --zd-transition-slower: 300ms; /* view-transition fade-in (contentFadeIn animation) */
307
199
  --zd-header-h: 80px; /* sticky header height; consumed by scroll-margin-top on [id] anchors */
@@ -326,6 +218,40 @@ body {
326
218
  }
327
219
 
328
220
  @layer base {
221
+ /* zudo-wind preflight parity missing from zudo-wind owned-v1. */
222
+ ::backdrop, ::file-selector-button {
223
+ box-sizing: border-box;
224
+ margin: 0;
225
+ padding: 0;
226
+ border: 0 solid;
227
+ }
228
+ [hidden]:where(:not([hidden="until-found"])) { display: none !important; }
229
+ html { font-family: var(--font-sans); -webkit-tap-highlight-color: transparent; }
230
+ code, kbd, samp, pre { font-family: var(--font-mono); }
231
+ button, input, select, optgroup, textarea, ::file-selector-button {
232
+ background-color: transparent;
233
+ border-radius: 0;
234
+ }
235
+ button, ::file-selector-button { appearance: button; }
236
+ :disabled { opacity: 1; }
237
+ ::placeholder { opacity: 1; color: color-mix(in oklab, currentColor 50%, transparent); }
238
+ ::file-selector-button {
239
+ font: inherit;
240
+ font-feature-settings: inherit;
241
+ font-variation-settings: inherit;
242
+ letter-spacing: inherit;
243
+ color: inherit;
244
+ opacity: 1;
245
+ margin-inline-end: 4px;
246
+ }
247
+ hr { color: inherit; }
248
+ abbr:where([title]) { text-decoration: underline dotted; }
249
+ small { font-size: 80%; }
250
+ sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; }
251
+ sub { bottom: -0.25em; }
252
+ sup { top: -0.5em; }
253
+ /* Keep emoji fallback after the authored font stack. */
254
+ html { font-family: var(--font-sans), "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; }
329
255
  a {
330
256
  text-underline-offset: 4px;
331
257
  }
@@ -351,7 +277,7 @@ body {
351
277
  * <style>-inside-<div> HTML5 content-model violation flagged by
352
278
  * html-validate — see zudolab/zudo-doc#1505).
353
279
  *
354
- * Pins onto the `.hidden` baseline that Tailwind always generates so
280
+ * Pins onto the generated `.hidden` utility so
355
281
  * consumers wrapping <VersionSwitcher> in `<div class="hidden lg:block">`
356
282
  * still get the desktop override even when the content scanner did not
357
283
  * generate `.lg:block`. Mobile (<64rem) falls through to `.hidden`'s
@@ -1,13 +1,11 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- import type { VNode } from "preact";
1
+ import type { Child } from "@takazudo/zfb/zudo-react";
4
2
  import type { HeadingItem } from "./types.js";
5
3
  export interface MobileTocProps {
6
4
  headings: readonly HeadingItem[];
7
5
  title?: string;
8
6
  }
9
7
  /**
10
- * Collapsible TOC for narrow viewports (`xl:hidden`) — a Preact island
8
+ * Collapsible TOC for narrow viewports (`xl:hidden`) — a zudo-react island
11
9
  * component. Closed by default; tapping the header toggles, and tapping
12
10
  * any entry closes the panel after navigation.
13
11
  *
@@ -36,7 +34,7 @@ export interface MobileTocProps {
36
34
  * crawlers can still find the locale label in the static markup. When
37
35
  * headings are present the full interactive toggle UI is rendered.
38
36
  */
39
- export declare function MobileToc({ headings, title, }: MobileTocProps): VNode;
37
+ export declare function MobileToc({ headings, title, }: MobileTocProps): Child;
40
38
  export declare namespace MobileToc {
41
39
  var displayName: string;
42
40
  }
@@ -1,48 +1,51 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "preact/jsx-runtime";
3
- import { useMemo, useState } from "preact/hooks";
2
+ import { jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
3
+ import { computed, signal } from "@takazudo/zfb/zudo-react";
4
4
  import { SmartBreak } from "../smart-break/index.js";
5
5
  import { cx } from "./cx.js";
6
6
  function MobileToc({
7
7
  headings,
8
8
  title = "On this page"
9
9
  }) {
10
- const filtered = useMemo(
11
- () => headings.filter((h) => h.depth >= 2 && h.depth <= 4),
12
- [headings]
13
- );
14
- const [open, setOpen] = useState(false);
10
+ const filtered = headings.filter((h) => h.depth >= 2 && h.depth <= 4);
11
+ const open = signal(false);
12
+ const chevronClass = computed(() => cx(
13
+ "h-icon-sm w-icon-sm text-muted transition-transform duration-150",
14
+ open.value && "rotate-180"
15
+ ));
16
+ const itemsClass = computed(() => cx(
17
+ "border-t border-muted px-hsp-lg py-vsp-xs space-y-vsp-2xs",
18
+ !open.value && "hidden"
19
+ ));
15
20
  if (filtered.length === 0) {
16
- return /* @__PURE__ */ jsx("div", { className: "hidden", "aria-hidden": "true", children: title });
21
+ return /* @__PURE__ */ jsx("div", { class: "hidden", "aria-hidden": "true", children: title });
17
22
  }
18
- return /* @__PURE__ */ jsxs("div", { "data-zd-mobile-toc": true, className: "xl:hidden border border-muted mb-vsp-lg", children: [
23
+ return /* @__PURE__ */ jsxs("div", { "data-zd-mobile-toc": true, class: "xl:hidden border border-muted mb-vsp-lg", children: [
19
24
  /* @__PURE__ */ jsxs(
20
25
  "button",
21
26
  {
22
27
  type: "button",
23
- onClick: () => setOpen((prev) => !prev),
28
+ "on:click": () => {
29
+ open.value = !open.value;
30
+ },
24
31
  "aria-expanded": open,
25
- className: "flex w-full items-center justify-between px-hsp-lg py-vsp-xs text-small font-medium text-fg",
32
+ class: "flex w-full items-center justify-between px-hsp-lg py-vsp-xs text-small font-medium text-fg",
26
33
  children: [
27
34
  /* @__PURE__ */ jsx("span", { children: title }),
28
35
  /* @__PURE__ */ jsx(
29
36
  "svg",
30
37
  {
31
- xmlns: "http://www.w3.org/2000/svg",
32
38
  "aria-hidden": "true",
33
- className: cx(
34
- "h-icon-sm w-icon-sm text-muted transition-transform duration-150",
35
- open && "rotate-180"
36
- ),
39
+ class: chevronClass,
37
40
  fill: "none",
38
41
  viewBox: "0 0 24 24",
39
42
  stroke: "currentColor",
40
- strokeWidth: 2,
43
+ "stroke-width": 2,
41
44
  children: /* @__PURE__ */ jsx(
42
45
  "path",
43
46
  {
44
- strokeLinecap: "round",
45
- strokeLinejoin: "round",
47
+ "stroke-linecap": "round",
48
+ "stroke-linejoin": "round",
46
49
  d: "M19 9l-7 7-7-7"
47
50
  }
48
51
  )
@@ -54,15 +57,12 @@ function MobileToc({
54
57
  /* @__PURE__ */ jsx(
55
58
  "ul",
56
59
  {
57
- className: cx(
58
- "border-t border-muted px-hsp-lg py-vsp-xs space-y-vsp-2xs",
59
- !open && "hidden"
60
- ),
61
- "aria-hidden": !open,
60
+ class: itemsClass,
61
+ "aria-hidden": computed(() => !open.value),
62
62
  children: filtered.map((heading, index) => /* @__PURE__ */ jsx(
63
63
  "li",
64
64
  {
65
- className: cx(
65
+ class: cx(
66
66
  heading.depth === 3 && "ml-hsp-lg",
67
67
  heading.depth === 4 && "ml-hsp-2xl"
68
68
  ),
@@ -70,8 +70,10 @@ function MobileToc({
70
70
  "a",
71
71
  {
72
72
  href: `#${heading.slug}`,
73
- onClick: () => setOpen(false),
74
- className: "block py-vsp-2xs text-small text-muted hover:text-fg hover:underline focus-visible:underline",
73
+ "on:click": () => {
74
+ open.value = false;
75
+ },
76
+ class: "block py-vsp-2xs text-small text-muted hover:text-fg hover:underline focus-visible:underline",
75
77
  children: /* @__PURE__ */ jsx(SmartBreak, { children: heading.text })
76
78
  }
77
79
  )
package/dist/toc/toc.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- import type { VNode } from "preact";
2
+ import { type Child } from "@takazudo/zfb/zudo-react";
4
3
  import type { HeadingItem } from "./types.js";
5
4
  export interface TocProps {
6
5
  headings: readonly HeadingItem[];
@@ -13,7 +12,7 @@ export interface TocProps {
13
12
  title?: string;
14
13
  }
15
14
  /**
16
- * Desktop right-rail Table of Contents — a Preact island component.
15
+ * Desktop right-rail Table of Contents — a zudo-react island component.
17
16
  *
18
17
  * Renders the `<nav aria-label="Table of contents">` directly. **The
19
18
  * caller is responsible for wrapping this in `<Island when="load">`**
@@ -50,7 +49,7 @@ export interface TocProps {
50
49
  * `<nav aria-label="Table of contents">` landmark provides the section
51
50
  * semantics for screen readers. Issue #1655 / T1.
52
51
  */
53
- export declare function Toc({ headings, title }: TocProps): VNode;
52
+ export declare function Toc({ headings, title }: TocProps): Child;
54
53
  export declare namespace Toc {
55
54
  var displayName: string;
56
55
  }
package/dist/toc/toc.js CHANGED
@@ -1,33 +1,36 @@
1
1
  "use client";
2
- import { jsx } from "preact/jsx-runtime";
3
- import { useMemo } from "preact/hooks";
2
+ import { jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
3
+ import { computed, getScope } from "@takazudo/zfb/zudo-react";
4
4
  import { useActiveHeading } from "./use-active-heading.js";
5
5
  import { SmartBreak } from "../smart-break/index.js";
6
6
  import { cx } from "./cx.js";
7
7
  function Toc({ headings, title = "On this page" }) {
8
- const filtered = useMemo(
9
- () => headings.filter((h) => h.depth >= 2 && h.depth <= 4),
10
- [headings]
11
- );
12
- const { activeId, activate } = useActiveHeading(filtered);
8
+ const filtered = headings.filter((h) => h.depth >= 2 && h.depth <= 4);
9
+ const { activeId, activate } = useActiveHeading(getScope(), filtered);
13
10
  return /* @__PURE__ */ jsx(
14
11
  "nav",
15
12
  {
16
13
  "aria-label": "Table of contents",
17
14
  "data-zd-toc": true,
18
- className: cx(
15
+ class: cx(
19
16
  "hidden xl:flex flex-col",
20
17
  "w-[280px] shrink-0",
21
18
  "sticky top-[3.5rem] self-start z-sidebar",
22
19
  "pt-vsp-xl lg:pt-vsp-2xl",
23
- "h-[calc(100vh-3.5rem)]"
20
+ "h-[calc(100vh_-_3.5rem)]"
24
21
  ),
25
- children: filtered.length > 0 && /* @__PURE__ */ jsx("ul", { className: "border-l border-muted pl-hsp-lg overflow-y-auto", children: filtered.map((heading, index) => {
26
- const isActive = heading.slug === activeId;
22
+ children: filtered.length > 0 && /* @__PURE__ */ jsx("ul", { class: "border-l border-muted pl-hsp-lg overflow-y-auto", children: filtered.map((heading, index) => {
23
+ const isActive = computed(() => heading.slug === activeId.value);
24
+ const linkClass = computed(
25
+ () => cx(
26
+ "block py-vsp-2xs text-small leading-snug transition-colors duration-0",
27
+ isActive.value ? "bg-fg text-bg font-medium" : "text-muted hover:underline focus:underline"
28
+ )
29
+ );
27
30
  return /* @__PURE__ */ jsx(
28
31
  "li",
29
32
  {
30
- className: cx(
33
+ class: cx(
31
34
  heading.depth === 3 && "ml-hsp-lg",
32
35
  heading.depth === 4 && "ml-hsp-2xl"
33
36
  ),
@@ -35,12 +38,9 @@ function Toc({ headings, title = "On this page" }) {
35
38
  "a",
36
39
  {
37
40
  href: `#${heading.slug}`,
38
- onClick: () => activate(heading.slug),
39
- "aria-current": isActive ? "true" : void 0,
40
- className: cx(
41
- "block py-vsp-2xs text-small leading-snug transition-colors",
42
- isActive ? "bg-fg text-bg font-medium" : "text-muted hover:underline focus:underline"
43
- ),
41
+ "on:click": () => activate(heading.slug),
42
+ "aria-current": computed(() => isActive.value ? "true" : void 0),
43
+ class: linkClass,
44
44
  children: /* @__PURE__ */ jsx(SmartBreak, { children: heading.text })
45
45
  }
46
46
  )
@@ -1,7 +1,8 @@
1
+ import type { Scope, Signal } from "@takazudo/zfb/zudo-react";
1
2
  import type { HeadingItem } from "./types.js";
2
3
  /**
3
4
  * Pure helper that picks the active heading id given the heading slug
4
- * order and a slug→element map. Extracted from the hook so it is unit-
5
+ * order and a slug→element map. Extracted from the setup helper so it is unit-
5
6
  * testable without DOM event plumbing.
6
7
  *
7
8
  * Algorithm: find the first heading whose top is at or below the
@@ -13,15 +14,15 @@ import type { HeadingItem } from "./types.js";
13
14
  */
14
15
  export declare function getActiveHeadingId(headingIds: readonly string[], elementMap: ReadonlyMap<string, HTMLElement>, viewportHeight: number): string | null;
15
16
  export interface UseActiveHeadingResult {
16
- activeId: string | null;
17
+ activeId: Signal<string | null>;
17
18
  activate: (id: string) => void;
18
19
  }
19
20
  /**
20
- * Scroll-spy hook. Tracks which heading slug should be highlighted
21
+ * Scroll-spy setup helper. Tracks which heading slug should be highlighted
21
22
  * based on the current scroll position. Provides an `activate(id)`
22
23
  * imperatively-callable helper used by click handlers — sets the
23
24
  * active id immediately and suppresses the scroll-driven update until
24
25
  * the smooth-scroll completes (`scrollend`, with a timeout fallback
25
26
  * for older Safari).
26
27
  */
27
- export declare function useActiveHeading(headings: readonly HeadingItem[]): UseActiveHeadingResult;
28
+ export declare function useActiveHeading(scope: Scope, headings: readonly HeadingItem[]): UseActiveHeadingResult;
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useRef, useState } from "preact/hooks";
1
+ import { signal } from "@takazudo/zfb/zudo-react";
2
2
  const SCROLL_MARGIN_TOP = 80;
3
3
  const DEBOUNCE_MS = 200;
4
4
  function getActiveHeadingId(headingIds, elementMap, viewportHeight) {
@@ -35,41 +35,37 @@ function getActiveHeadingId(headingIds, elementMap, viewportHeight) {
35
35
  }
36
36
  return headingIds[firstVisibleIndex - 1] ?? null;
37
37
  }
38
- function useActiveHeading(headings) {
39
- const [activeId, setActiveId] = useState(null);
40
- const headingIdsRef = useRef([]);
41
- const elementMapRef = useRef(/* @__PURE__ */ new Map());
42
- const suppressedRef = useRef(false);
43
- const activate = useCallback((id) => {
44
- setActiveId(id);
45
- suppressedRef.current = true;
46
- setTimeout(() => {
47
- suppressedRef.current = false;
48
- }, 2e3);
49
- }, []);
50
- useEffect(() => {
51
- const ids = headings.map((h) => h.slug);
52
- headingIdsRef.current = ids;
38
+ function useActiveHeading(scope, headings) {
39
+ const activeId = signal(null);
40
+ const headingIds = headings.map((heading) => heading.slug);
41
+ let activateInScope = () => {
42
+ };
43
+ const activate = (id) => activateInScope(id);
44
+ scope.onActivate(() => {
45
+ let suppressed = false;
46
+ let timerId = null;
47
+ let fallbackTimerId = null;
48
+ let suppressionTimerId = null;
49
+ activateInScope = (id) => {
50
+ activeId.value = id;
51
+ suppressed = true;
52
+ if (suppressionTimerId !== null) clearTimeout(suppressionTimerId);
53
+ suppressionTimerId = setTimeout(() => {
54
+ suppressionTimerId = null;
55
+ suppressed = false;
56
+ }, 2e3);
57
+ };
53
58
  const map = /* @__PURE__ */ new Map();
54
- for (const id of ids) {
59
+ for (const id of headingIds) {
55
60
  const el = document.getElementById(id);
56
61
  if (el) map.set(id, el);
57
62
  }
58
- elementMapRef.current = map;
59
- let timerId = null;
60
63
  function update() {
61
64
  timerId = null;
62
- setActiveId(
63
- getActiveHeadingId(
64
- headingIdsRef.current,
65
- elementMapRef.current,
66
- window.innerHeight
67
- )
68
- );
65
+ activeId.value = getActiveHeadingId(headingIds, map, window.innerHeight);
69
66
  }
70
- let fallbackTimerId = null;
71
67
  function onScroll() {
72
- if (suppressedRef.current) {
68
+ if (suppressed) {
73
69
  if (fallbackTimerId !== null) clearTimeout(fallbackTimerId);
74
70
  fallbackTimerId = setTimeout(onScrollEnd, 1500);
75
71
  return;
@@ -78,7 +74,11 @@ function useActiveHeading(headings) {
78
74
  timerId = setTimeout(update, DEBOUNCE_MS);
79
75
  }
80
76
  function onScrollEnd() {
81
- suppressedRef.current = false;
77
+ suppressed = false;
78
+ if (suppressionTimerId !== null) {
79
+ clearTimeout(suppressionTimerId);
80
+ suppressionTimerId = null;
81
+ }
82
82
  if (fallbackTimerId !== null) {
83
83
  clearTimeout(fallbackTimerId);
84
84
  fallbackTimerId = null;
@@ -91,13 +91,19 @@ function useActiveHeading(headings) {
91
91
  window.addEventListener("resize", onScroll, { passive: true });
92
92
  window.addEventListener("scrollend", onScrollEnd, { passive: true });
93
93
  return () => {
94
+ activateInScope = () => {
95
+ };
94
96
  window.removeEventListener("scroll", onScroll);
95
97
  window.removeEventListener("resize", onScroll);
96
98
  window.removeEventListener("scrollend", onScrollEnd);
97
99
  if (timerId !== null) clearTimeout(timerId);
100
+ timerId = null;
98
101
  if (fallbackTimerId !== null) clearTimeout(fallbackTimerId);
102
+ fallbackTimerId = null;
103
+ if (suppressionTimerId !== null) clearTimeout(suppressionTimerId);
104
+ suppressionTimerId = null;
99
105
  };
100
- }, [headings]);
106
+ });
101
107
  return { activeId, activate };
102
108
  }
103
109
  export {
@@ -1,6 +1,5 @@
1
1
  /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- import type { JSX } from "preact";
2
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
4
3
  export interface TocPrepaintProps {
5
4
  /**
6
5
  * Whether the page actually renders the package's own default TOC (i.e.
@@ -1,9 +1,7 @@
1
- import { Fragment, jsx } from "preact/jsx-runtime";
1
+ import { Fragment, jsx } from "@takazudo/zfb/zudo-react/jsx-runtime";
2
2
  import { Island } from "@takazudo/zfb";
3
- import {
4
- DesktopTocToggle,
5
- TOC_STORAGE_KEY
6
- } from "../desktop-toc-toggle-island/index.js";
3
+ import { DesktopTocToggle } from "../desktop-toc-toggle-island/index.js";
4
+ import { TOC_STORAGE_KEY } from "../desktop-toc-toggle-island/storage.js";
7
5
  function tocPrepaintActive(settings, shouldRenderDefaultToc) {
8
6
  return Boolean(settings.tocToggle) && Boolean(shouldRenderDefaultToc);
9
7
  }
@@ -18,7 +16,7 @@ function createTocVisibilityPrepaint(settings) {
18
16
  return /* @__PURE__ */ jsx(
19
17
  "script",
20
18
  {
21
- dangerouslySetInnerHTML: { __html: TOC_VISIBILITY_PREPAINT_SCRIPT }
19
+ rawHtml: TOC_VISIBILITY_PREPAINT_SCRIPT
22
20
  }
23
21
  );
24
22
  }
@@ -1,21 +1,8 @@
1
- interface NestedIslandPropsRefreshOptions {
1
+ interface Options {
2
2
  document: Document;
3
- /** Explicit error seam for hosts/tests; omitted errors surface in a microtask. */
4
3
  reportError?: (error: unknown) => void;
5
4
  }
6
- /**
7
- * Install the before-swap props-refresh listener on a document.
8
- *
9
- * This low-level entrypoint owns an explicit cleanup for focused tests and
10
- * non-singleton hosts. Browser modules use the durable, duplicate-safe
11
- * `ensureNestedIslandPropsRefresh` wrapper below instead.
12
- */
13
- export declare function installNestedIslandPropsRefresh({ document, reportError, }: NestedIslandPropsRefreshOptions): () => void;
14
- /**
15
- * Install exactly one document-lifetime controller for a browser document.
16
- * Repeated calls from component renders or duplicate boot paths are no-ops.
17
- */
18
- export declare function ensureNestedIslandPropsRefresh(options?: NestedIslandPropsRefreshOptions): void;
19
- /** Test/HMR teardown for a controller installed through the singleton wrapper. */
5
+ export declare function installNestedIslandPropsRefresh({ document, reportError }: Options): () => void;
6
+ export declare function ensureNestedIslandPropsRefresh(options?: Options): void;
20
7
  export declare function disposeNestedIslandPropsRefresh(document: Document): void;
21
8
  export {};