@takazudo/zudo-doc 5.28.2 → 6.0.1

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 (511) hide show
  1. package/CHANGELOG.md +33 -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/catalog.js +1 -1
  43. package/dist/category-nav/index.d.ts +1 -2
  44. package/dist/category-nav/index.js +11 -5
  45. package/dist/category-tree-nav/index.d.ts +1 -2
  46. package/dist/category-tree-nav/index.js +3 -3
  47. package/dist/chrome/derive.d.ts +18 -27
  48. package/dist/chrome/derive.js +47 -29
  49. package/dist/chrome/index.d.ts +5 -5
  50. package/dist/chrome/index.js +1 -1
  51. package/dist/chrome/island-data.d.ts +4 -0
  52. package/dist/chrome/island-data.js +52 -0
  53. package/dist/chrome/primary-slots.d.ts +2 -3
  54. package/dist/chrome-bindings.d.ts +30 -22
  55. package/dist/code-group/index.d.ts +3 -4
  56. package/dist/code-group/index.js +3 -7
  57. package/dist/code-syntax/code-block-enhancer.d.ts +1 -2
  58. package/dist/code-syntax/code-block-enhancer.js +2 -2
  59. package/dist/code-syntax/mermaid-init.d.ts +1 -2
  60. package/dist/code-syntax/mermaid-init.js +5 -2
  61. package/dist/code-syntax/tabs-init-script.js +1 -1
  62. package/dist/code-syntax/tabs-init.d.ts +1 -2
  63. package/dist/code-syntax/tabs-init.js +2 -2
  64. package/dist/code-syntax/tabs.d.ts +6 -6
  65. package/dist/code-syntax/tabs.js +8 -8
  66. package/dist/compiled.css +2937 -2942
  67. package/dist/config/component-tokens.d.ts +1 -1
  68. package/dist/config/component-tokens.js +22 -0
  69. package/dist/config-assertions/index.d.ts +13 -0
  70. package/dist/config-assertions/index.js +14 -0
  71. package/dist/config.d.ts +36 -17
  72. package/dist/config.js +23 -95
  73. package/dist/content/content-blockquote.d.ts +2 -3
  74. package/dist/content/content-blockquote.js +3 -3
  75. package/dist/content/content-code.d.ts +3 -4
  76. package/dist/content/content-code.js +5 -5
  77. package/dist/content/content-link.d.ts +3 -4
  78. package/dist/content/content-link.js +10 -10
  79. package/dist/content/content-ol.d.ts +2 -3
  80. package/dist/content/content-ol.js +5 -4
  81. package/dist/content/content-paragraph.d.ts +2 -3
  82. package/dist/content/content-paragraph.js +1 -1
  83. package/dist/content/content-strong.d.ts +2 -3
  84. package/dist/content/content-strong.js +3 -3
  85. package/dist/content/content-table.d.ts +2 -3
  86. package/dist/content/content-table.js +4 -4
  87. package/dist/content/content-ul.d.ts +2 -3
  88. package/dist/content/content-ul.js +4 -4
  89. package/dist/content/heading-h2.d.ts +2 -3
  90. package/dist/content/heading-h2.js +4 -4
  91. package/dist/content/heading-h3.d.ts +2 -3
  92. package/dist/content/heading-h3.js +4 -4
  93. package/dist/content/heading-h4.d.ts +2 -3
  94. package/dist/content/heading-h4.js +4 -4
  95. package/dist/content-admonition/index.d.ts +3 -4
  96. package/dist/content-admonition/index.js +2 -2
  97. package/dist/content.css +35 -33
  98. package/dist/design-token-panel-bootstrap-controller.d.ts +178 -0
  99. package/dist/design-token-panel-bootstrap-controller.js +359 -0
  100. package/dist/design-token-panel-bootstrap-island.d.ts +5 -0
  101. package/dist/design-token-panel-bootstrap-island.js +19 -0
  102. package/dist/design-token-panel-bootstrap.d.ts +5 -195
  103. package/dist/design-token-panel-bootstrap.js +3 -288
  104. package/dist/desktop-sidebar-toggle-island/index.d.ts +2 -7
  105. package/dist/desktop-sidebar-toggle-island/index.js +2 -58
  106. package/dist/desktop-sidebar-toggle-island/island.d.ts +4 -0
  107. package/dist/desktop-sidebar-toggle-island/island.js +43 -0
  108. package/dist/desktop-sidebar-toggle-island/storage.d.ts +4 -0
  109. package/dist/desktop-sidebar-toggle-island/storage.js +29 -0
  110. package/dist/desktop-toc-toggle-island/index.d.ts +2 -7
  111. package/dist/desktop-toc-toggle-island/index.js +2 -58
  112. package/dist/desktop-toc-toggle-island/island.d.ts +4 -0
  113. package/dist/desktop-toc-toggle-island/island.js +43 -0
  114. package/dist/desktop-toc-toggle-island/storage.d.ts +4 -0
  115. package/dist/desktop-toc-toggle-island/storage.js +29 -0
  116. package/dist/details/details.d.ts +3 -4
  117. package/dist/details/details.js +1 -1
  118. package/dist/doc-body-end/index.d.ts +1 -2
  119. package/dist/doc-body-end/index.js +1 -1
  120. package/dist/doc-body-end-islands/design-token-panel-island.d.ts +2 -2
  121. package/dist/doc-body-end-islands/design-token-panel-island.js +3 -7
  122. package/dist/doc-body-end-islands/index.d.ts +4 -21
  123. package/dist/doc-body-end-islands/index.js +5 -3
  124. package/dist/doc-body-end-islands/theme-pack-switcher-island.d.ts +3 -13
  125. package/dist/doc-body-end-islands/theme-pack-switcher-island.js +11 -13
  126. package/dist/doc-content-header/index.d.ts +1 -2
  127. package/dist/doc-content-header/index.js +1 -1
  128. package/dist/doc-history/index.d.ts +1 -1
  129. package/dist/doc-history/index.js +166 -141
  130. package/dist/doc-history-area/index.d.ts +6 -4
  131. package/dist/doc-history-area/index.js +17 -16
  132. package/dist/doc-metainfo-area/index.d.ts +2 -3
  133. package/dist/doc-metainfo-area/index.js +1 -1
  134. package/dist/doc-page-renderer/index.d.ts +13 -7
  135. package/dist/doc-page-renderer/index.js +10 -1
  136. package/dist/doc-page-shell/index.d.ts +20 -7
  137. package/dist/doc-page-shell/index.js +17 -6
  138. package/dist/doc-pager/index.d.ts +1 -2
  139. package/dist/doc-pager/index.js +3 -3
  140. package/dist/doc-tags-area/index.d.ts +2 -3
  141. package/dist/doc-tags-area/index.js +1 -1
  142. package/dist/doclayout/doc-layout-with-defaults.d.ts +9 -9
  143. package/dist/doclayout/doc-layout-with-defaults.js +5 -15
  144. package/dist/doclayout/doc-layout.d.ts +26 -27
  145. package/dist/doclayout/doc-layout.js +23 -14
  146. package/dist/docs-schema/index.d.ts +4 -0
  147. package/dist/docs-schema/index.js +1 -0
  148. package/dist/extract-headings/index.js +43 -12
  149. package/dist/factory-context/index.d.ts +22 -19
  150. package/dist/features.css +75 -8
  151. package/dist/find-in-page/find-bar.d.ts +4 -2
  152. package/dist/find-in-page/find-bar.js +58 -69
  153. package/dist/find-in-page/index.d.ts +2 -8
  154. package/dist/find-in-page/index.js +33 -30
  155. package/dist/footer/footer.d.ts +3 -4
  156. package/dist/footer/footer.js +3 -3
  157. package/dist/footer-with-defaults/index.d.ts +2 -3
  158. package/dist/footer-with-defaults/index.js +1 -1
  159. package/dist/frontmatter-preview-defaults/index.js +1 -0
  160. package/dist/head/doc-head.d.ts +1 -1
  161. package/dist/head/doc-head.js +24 -32
  162. package/dist/head/og-tags.d.ts +1 -1
  163. package/dist/head/og-tags.js +8 -7
  164. package/dist/head/twitter-card.d.ts +1 -1
  165. package/dist/head/twitter-card.js +1 -1
  166. package/dist/head-with-defaults/index.d.ts +7 -2
  167. package/dist/head-with-defaults/index.js +46 -32
  168. package/dist/header/header.d.ts +8 -8
  169. package/dist/header/header.js +9 -11
  170. package/dist/header/types.d.ts +7 -7
  171. package/dist/header-with-defaults/index.d.ts +3 -4
  172. package/dist/header-with-defaults/index.js +27 -14
  173. package/dist/home-intro/index.d.ts +2 -5
  174. package/dist/home-intro/index.js +7 -5
  175. package/dist/home-intro/prepare.js +4 -3
  176. package/dist/home-page/index.d.ts +3 -3
  177. package/dist/home-page/index.js +19 -17
  178. package/dist/html-preview-wrapper/highlighted-code.d.ts +3 -4
  179. package/dist/html-preview-wrapper/highlighted-code.js +19 -17
  180. package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +4 -25
  181. package/dist/html-preview-wrapper/html-preview-wrapper.js +2 -87
  182. package/dist/html-preview-wrapper/html-preview.d.ts +3 -10
  183. package/dist/html-preview-wrapper/html-preview.js +13 -37
  184. package/dist/html-preview-wrapper/index.d.ts +2 -1
  185. package/dist/html-preview-wrapper/index.js +1 -1
  186. package/dist/html-preview-wrapper/preview-base.d.ts +3 -5
  187. package/dist/html-preview-wrapper/preview-base.js +56 -59
  188. package/dist/html-preview-wrapper/wrapper.d.ts +20 -0
  189. package/dist/html-preview-wrapper/wrapper.js +37 -0
  190. package/dist/hydration-pending.d.ts +3 -5
  191. package/dist/hydration-pending.js +7 -5
  192. package/dist/i18n-version/language-switcher.d.ts +5 -32
  193. package/dist/i18n-version/language-switcher.js +5 -106
  194. package/dist/i18n-version/switcher-generated-scripts.d.ts +2 -0
  195. package/dist/i18n-version/switcher-generated-scripts.js +107 -0
  196. package/dist/i18n-version/switcher-url-state.d.ts +76 -0
  197. package/dist/i18n-version/switcher-url-state.js +103 -0
  198. package/dist/i18n-version/version-banner.d.ts +2 -3
  199. package/dist/i18n-version/version-banner.js +1 -1
  200. package/dist/i18n-version/version-switcher.d.ts +5 -50
  201. package/dist/i18n-version/version-switcher.js +5 -157
  202. package/dist/icons/index.d.ts +18 -19
  203. package/dist/icons/index.js +17 -33
  204. package/dist/image-enlarge/index.d.ts +1 -10
  205. package/dist/image-enlarge/index.js +80 -55
  206. package/dist/image-enlarge/public.d.ts +2 -0
  207. package/dist/image-enlarge/public.js +6 -0
  208. package/dist/image-enlarge/ssr-fallback.d.ts +2 -0
  209. package/dist/image-enlarge/ssr-fallback.js +8 -0
  210. package/dist/index.d.ts +11 -4
  211. package/dist/inline-version-switcher/index.d.ts +1 -2
  212. package/dist/inline-version-switcher/index.js +1 -1
  213. package/dist/island-types/index.d.ts +2 -2
  214. package/dist/island-types/index.js +1 -5
  215. package/dist/math-block/index.d.ts +4 -7
  216. package/dist/math-block/index.js +5 -5
  217. package/dist/mcp/handler.d.ts +8 -0
  218. package/dist/mcp/handler.js +129 -0
  219. package/dist/mcp/index.d.ts +4 -0
  220. package/dist/mcp/index.js +7 -0
  221. package/dist/mcp/loader.d.ts +19 -0
  222. package/dist/mcp/loader.js +202 -0
  223. package/dist/mdx-components/index.js +40 -108
  224. package/dist/mermaid-enlarge/index.d.ts +1 -8
  225. package/dist/mermaid-enlarge/index.js +174 -158
  226. package/dist/mermaid-enlarge/public.d.ts +2 -0
  227. package/dist/mermaid-enlarge/public.js +6 -0
  228. package/dist/mermaid-enlarge/ssr-fallback.d.ts +2 -0
  229. package/dist/mermaid-enlarge/ssr-fallback.js +8 -0
  230. package/dist/metainfo/doc-metainfo.d.ts +2 -3
  231. package/dist/metainfo/doc-metainfo.js +1 -4
  232. package/dist/metainfo/doc-tags.d.ts +2 -3
  233. package/dist/metainfo/doc-tags.js +1 -1
  234. package/dist/metainfo/frontmatter-preview.d.ts +3 -4
  235. package/dist/metainfo/frontmatter-preview.js +1 -1
  236. package/dist/nav-data-prep/index.js +6 -4
  237. package/dist/nav-indexing/category-nav.d.ts +2 -3
  238. package/dist/nav-indexing/category-nav.js +1 -2
  239. package/dist/nav-indexing/category-tree-nav.d.ts +2 -3
  240. package/dist/nav-indexing/category-tree-nav.js +1 -1
  241. package/dist/nav-indexing/doc-card-grid.d.ts +2 -3
  242. package/dist/nav-indexing/doc-card-grid.js +1 -2
  243. package/dist/nav-indexing/docs-sitemap.d.ts +2 -3
  244. package/dist/nav-indexing/docs-sitemap.js +2 -2
  245. package/dist/nav-indexing/index.d.ts +1 -1
  246. package/dist/nav-indexing/nav-card-grid.d.ts +2 -3
  247. package/dist/nav-indexing/nav-card-grid.js +1 -2
  248. package/dist/nav-indexing/note-tray-index-parts/card-list.d.ts +1 -2
  249. package/dist/nav-indexing/note-tray-index-parts/card-list.js +4 -4
  250. package/dist/nav-indexing/note-tray-index-parts/date-line.d.ts +2 -3
  251. package/dist/nav-indexing/note-tray-index-parts/date-line.js +1 -1
  252. package/dist/nav-indexing/note-tray-index-parts/index-list.d.ts +1 -2
  253. package/dist/nav-indexing/note-tray-index-parts/index-list.js +2 -2
  254. package/dist/nav-indexing/note-tray-index-parts/timeline.d.ts +1 -2
  255. package/dist/nav-indexing/note-tray-index-parts/timeline.js +2 -2
  256. package/dist/nav-indexing/note-tray-index.d.ts +1 -2
  257. package/dist/nav-indexing/note-tray-index.js +1 -1
  258. package/dist/nav-indexing/site-tree-nav-demo.d.ts +2 -3
  259. package/dist/nav-indexing/site-tree-nav-demo.js +2 -2
  260. package/dist/nav-indexing/tag-nav.d.ts +1 -2
  261. package/dist/nav-indexing/tag-nav.js +1 -1
  262. package/dist/nav-indexing/types.d.ts +2 -2
  263. package/dist/nav-indexing/versions-page-content.d.ts +2 -3
  264. package/dist/nav-indexing/versions-page-content.js +8 -8
  265. package/dist/note-tray-index/index.d.ts +1 -2
  266. package/dist/note-tray-index/index.js +1 -1
  267. package/dist/page-loading/page-loading-overlay.d.ts +1 -2
  268. package/dist/page-loading/page-loading-overlay.js +3 -5
  269. package/dist/plugins/agent-export.d.ts +3 -0
  270. package/dist/plugins/agent-export.js +34 -0
  271. package/dist/plugins/internal/agent-export/chunk.d.ts +5 -0
  272. package/dist/plugins/internal/agent-export/chunk.js +90 -0
  273. package/dist/plugins/internal/agent-export/index.d.ts +24 -0
  274. package/dist/plugins/internal/agent-export/index.js +123 -0
  275. package/dist/plugins/internal/agent-export/normalize.d.ts +5 -0
  276. package/dist/plugins/internal/agent-export/normalize.js +73 -0
  277. package/dist/plugins/internal/llms-txt/dev-middleware.d.ts +6 -0
  278. package/dist/plugins/internal/llms-txt/dev-middleware.js +8 -3
  279. package/dist/plugins/internal/llms-txt/emit.js +23 -6
  280. package/dist/plugins/internal/llms-txt/generate.d.ts +7 -1
  281. package/dist/plugins/internal/llms-txt/generate.js +9 -2
  282. package/dist/plugins/internal/llms-txt/load.d.ts +2 -0
  283. package/dist/plugins/internal/llms-txt/load.js +20 -4
  284. package/dist/plugins/internal/llms-txt/types.d.ts +10 -0
  285. package/dist/plugins/routes.js +4 -0
  286. package/dist/preset.d.ts +19 -9
  287. package/dist/preset.js +20 -1
  288. package/dist/route-context-payload/index.js +1 -1
  289. package/dist/routes/404.d.ts +2 -3
  290. package/dist/routes/404.js +1 -1
  291. package/dist/routes/_chrome.d.ts +5 -5
  292. package/dist/routes/_chrome.js +7 -2
  293. package/dist/routes/_context.d.ts +4 -4
  294. package/dist/routes/_design-token-panel-bootstrap.d.ts +1 -4
  295. package/dist/routes/_design-token-panel-bootstrap.js +9 -1
  296. package/dist/routes/docs-slug.d.ts +2 -3
  297. package/dist/routes/docs-tags-index.d.ts +2 -3
  298. package/dist/routes/docs-tags-index.js +1 -1
  299. package/dist/routes/docs-tags-tag.d.ts +2 -3
  300. package/dist/routes/docs-tags-tag.js +1 -1
  301. package/dist/routes/docs-versions.d.ts +2 -3
  302. package/dist/routes/docs-versions.js +1 -1
  303. package/dist/routes/files-path.d.ts +2 -3
  304. package/dist/routes/files-path.js +1 -1
  305. package/dist/routes/index.d.ts +2 -3
  306. package/dist/routes/index.js +1 -1
  307. package/dist/routes/locale-docs-slug.d.ts +2 -3
  308. package/dist/routes/locale-docs-tags-index.d.ts +2 -3
  309. package/dist/routes/locale-docs-tags-index.js +1 -1
  310. package/dist/routes/locale-docs-tags-tag.d.ts +2 -3
  311. package/dist/routes/locale-docs-tags-tag.js +1 -1
  312. package/dist/routes/locale-docs-versions.d.ts +2 -3
  313. package/dist/routes/locale-docs-versions.js +1 -1
  314. package/dist/routes/locale-files-path.d.ts +2 -3
  315. package/dist/routes/locale-files-path.js +1 -1
  316. package/dist/routes/locale-index.d.ts +2 -3
  317. package/dist/routes/locale-index.js +1 -1
  318. package/dist/routes/mcp.d.ts +5 -0
  319. package/dist/routes/mcp.js +25 -0
  320. package/dist/routes/v-docs-slug.d.ts +2 -3
  321. package/dist/routes/v-locale-docs-slug.d.ts +2 -3
  322. package/dist/search-widget/index.d.ts +1 -2
  323. package/dist/search-widget/index.js +4 -7
  324. package/dist/search-widget-script/generated-script.js +12 -5
  325. package/dist/settings-defaults.d.ts +2 -0
  326. package/dist/settings-defaults.js +93 -0
  327. package/dist/settings.d.ts +8 -2
  328. package/dist/sidebar/client-data.d.ts +18 -0
  329. package/dist/sidebar/client-data.js +47 -0
  330. package/dist/sidebar/index.d.ts +3 -1
  331. package/dist/sidebar/index.js +3 -1
  332. package/dist/sidebar/sidebar.d.ts +12 -44
  333. package/dist/sidebar/sidebar.js +4 -3
  334. package/dist/sidebar/types.d.ts +14 -0
  335. package/dist/sidebar-prepaint/index.d.ts +1 -2
  336. package/dist/sidebar-prepaint/index.js +4 -6
  337. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +2 -3
  338. package/dist/sidebar-resizer/sidebar-resizer-init.js +3 -3
  339. package/dist/sidebar-toggle-island/index.d.ts +8 -11
  340. package/dist/sidebar-toggle-island/index.js +75 -62
  341. package/dist/sidebar-tree/build-tree.js +5 -6
  342. package/dist/sidebar-tree/types.d.ts +2 -0
  343. package/dist/sidebar-tree-island/index.d.ts +4 -19
  344. package/dist/sidebar-tree-island/index.js +782 -436
  345. package/dist/sidebar-tree-island/scope-state.d.ts +38 -0
  346. package/dist/sidebar-tree-island/scope-state.js +151 -0
  347. package/dist/sidebar-tree-island/sidebar-scroll-preserve.js +6 -2
  348. package/dist/sidebar-utils/index.d.ts +17 -19
  349. package/dist/sidebar-utils/index.js +100 -3
  350. package/dist/sidebar-utils/scope.d.ts +11 -0
  351. package/dist/sidebar-utils/scope.js +67 -0
  352. package/dist/sidebar-with-defaults/index.d.ts +1 -2
  353. package/dist/sidebar-with-defaults/index.js +19 -18
  354. package/dist/site-schema/nav-tree.js +15 -15
  355. package/dist/site-schema/types.d.ts +1 -0
  356. package/dist/site-tree-nav/index.d.ts +2 -3
  357. package/dist/site-tree-nav/index.js +11 -12
  358. package/dist/site-tree-nav/normalize-island-props.d.ts +16 -0
  359. package/dist/site-tree-nav/normalize-island-props.js +122 -0
  360. package/dist/site-tree-nav-island/index.d.ts +3 -3
  361. package/dist/site-tree-nav-island/index.js +243 -144
  362. package/dist/smart-break/index.d.ts +3 -4
  363. package/dist/smart-break/index.js +1 -1
  364. package/dist/tab-item/tab-item.d.ts +3 -4
  365. package/dist/tab-item/tab-item.js +1 -1
  366. package/dist/tag-pages/index.d.ts +3 -3
  367. package/dist/tag-pages/index.js +10 -10
  368. package/dist/theme/color-scheme-provider.d.ts +3 -3
  369. package/dist/theme/color-scheme-provider.js +3 -3
  370. package/dist/theme/theme-pack-provider.d.ts +1 -1
  371. package/dist/theme/theme-pack-provider.js +3 -3
  372. package/dist/theme/theme-toggle.d.ts +2 -3
  373. package/dist/theme/theme-toggle.js +1 -1
  374. package/dist/theme-pack-dialog/index.d.ts +1 -1
  375. package/dist/theme-pack-dialog/index.js +69 -75
  376. package/dist/theme-pack-dialog/theme-pack-card.d.ts +3 -4
  377. package/dist/theme-pack-dialog/theme-pack-card.js +19 -17
  378. package/dist/theme-pack-switcher/index.d.ts +4 -5
  379. package/dist/theme-pack-switcher/index.js +52 -49
  380. package/dist/theme-packs/academia/meta.json +1 -1
  381. package/dist/theme-packs/academia/pack.css +1 -1
  382. package/dist/theme-packs/bauhaus/meta.json +1 -1
  383. package/dist/theme-packs/bauhaus/pack.css +2 -2
  384. package/dist/theme-packs/blueprint/meta.json +1 -1
  385. package/dist/theme-packs/blueprint/pack.css +2 -2
  386. package/dist/theme-packs/botanica/meta.json +1 -1
  387. package/dist/theme-packs/botanica/pack.css +2 -2
  388. package/dist/theme-packs/broadsheet/meta.json +1 -1
  389. package/dist/theme-packs/broadsheet/pack.css +2 -2
  390. package/dist/theme-packs/brutalist/meta.json +1 -1
  391. package/dist/theme-packs/brutalist/pack.css +2 -2
  392. package/dist/theme-packs/eink/meta.json +1 -1
  393. package/dist/theme-packs/eink/pack.css +1 -1
  394. package/dist/theme-packs/futura-editorial/meta.json +1 -1
  395. package/dist/theme-packs/futura-editorial/pack.css +2 -2
  396. package/dist/theme-packs/hearth/meta.json +1 -1
  397. package/dist/theme-packs/hearth/pack.css +2 -2
  398. package/dist/theme-packs/ledger/meta.json +1 -1
  399. package/dist/theme-packs/ledger/pack.css +1 -1
  400. package/dist/theme-packs/manuscript/meta.json +1 -1
  401. package/dist/theme-packs/manuscript/pack.css +1 -1
  402. package/dist/theme-packs/matcha/meta.json +1 -1
  403. package/dist/theme-packs/matcha/pack.css +2 -2
  404. package/dist/theme-packs/nocturne/meta.json +1 -1
  405. package/dist/theme-packs/nocturne/pack.css +2 -2
  406. package/dist/theme-packs/observatory/meta.json +1 -1
  407. package/dist/theme-packs/observatory/pack.css +2 -2
  408. package/dist/theme-packs/onyx/meta.json +1 -1
  409. package/dist/theme-packs/onyx/pack.css +2 -2
  410. package/dist/theme-packs/phosphor/meta.json +1 -1
  411. package/dist/theme-packs/phosphor/pack.css +2 -2
  412. package/dist/theme-packs/riso/meta.json +1 -1
  413. package/dist/theme-packs/riso/pack.css +2 -2
  414. package/dist/theme-packs/sakura/meta.json +1 -1
  415. package/dist/theme-packs/sakura/pack.css +2 -2
  416. package/dist/theme-packs/scandi/meta.json +1 -1
  417. package/dist/theme-packs/scandi/pack.css +1 -1
  418. package/dist/theme-packs/solar/meta.json +1 -1
  419. package/dist/theme-packs/solar/pack.css +1 -1
  420. package/dist/theme-packs/sumi/meta.json +1 -1
  421. package/dist/theme-packs/sumi/pack.css +2 -2
  422. package/dist/theme-packs/swissgrid/meta.json +1 -1
  423. package/dist/theme-packs/swissgrid/pack.css +1 -1
  424. package/dist/theme-packs/timberline/meta.json +1 -1
  425. package/dist/theme-packs/timberline/pack.css +2 -2
  426. package/dist/theme-packs/washi/meta.json +1 -1
  427. package/dist/theme-packs/washi/pack.css +2 -2
  428. package/dist/theme-toggle/index.d.ts +1 -1
  429. package/dist/theme-toggle/index.js +154 -167
  430. package/dist/theme.css +47 -121
  431. package/dist/toc/mobile-toc.d.ts +3 -5
  432. package/dist/toc/mobile-toc.js +29 -27
  433. package/dist/toc/toc.d.ts +3 -4
  434. package/dist/toc/toc.js +18 -18
  435. package/dist/toc/use-active-heading.d.ts +5 -4
  436. package/dist/toc/use-active-heading.js +36 -30
  437. package/dist/toc-prepaint/index.d.ts +1 -2
  438. package/dist/toc-prepaint/index.js +4 -6
  439. package/dist/transitions/nested-island-props-refresh.d.ts +3 -16
  440. package/dist/transitions/nested-island-props-refresh.js +133 -151
  441. package/dist/transitions/page-events.d.ts +8 -13
  442. package/dist/tree-nav-shared/index.d.ts +4 -5
  443. package/dist/tree-nav-shared/index.js +6 -7
  444. package/dist/use-modal-dialog/index.d.ts +9 -63
  445. package/dist/use-modal-dialog/index.js +41 -59
  446. package/dist/versions-page/index.d.ts +3 -3
  447. package/dist/versions-page/index.js +5 -5
  448. package/dist/wind/index.d.ts +5 -0
  449. package/dist/wind/index.js +169 -0
  450. package/dist/wind.json +498 -0
  451. package/dist/z-index-defaults/index.d.ts +4 -4
  452. package/dist/zdtp-loader.d.ts +7 -0
  453. package/dist/zdtp-loader.js +8 -0
  454. package/eject/asset-components/asset-card.tsx +14 -16
  455. package/eject/asset-components/asset-code.tsx +10 -12
  456. package/eject/asset-components/shared.tsx +5 -7
  457. package/eject/breadcrumb/breadcrumb.tsx +15 -16
  458. package/eject/code-group/index.tsx +4 -10
  459. package/eject/content-admonition/index.tsx +5 -6
  460. package/eject/desktop-sidebar-toggle-island/index.ts +4 -0
  461. package/eject/desktop-sidebar-toggle-island/island.tsx +50 -0
  462. package/eject/desktop-sidebar-toggle-island/storage.ts +27 -0
  463. package/eject/details/details.tsx +3 -5
  464. package/eject/doc-history/index.tsx +193 -179
  465. package/eject/doc-pager/index.tsx +3 -4
  466. package/eject/footer/footer.tsx +7 -9
  467. package/eject/header/header.tsx +42 -54
  468. package/eject/header/nav-overflow-script.ts +1 -1
  469. package/eject/header/types.ts +12 -13
  470. package/eject/image-enlarge/index.tsx +84 -69
  471. package/eject/image-enlarge/public.ts +2 -0
  472. package/eject/image-enlarge/ssr-fallback.tsx +7 -0
  473. package/eject/page-loading/page-loading-overlay.tsx +8 -15
  474. package/eject/sidebar/client-data.ts +68 -0
  475. package/eject/sidebar/index.ts +3 -0
  476. package/eject/sidebar/sidebar.tsx +16 -97
  477. package/eject/sidebar/types.ts +15 -0
  478. package/eject/sidebar-toggle-island/index.tsx +103 -102
  479. package/eject/sidebar-tree-island/index.tsx +827 -615
  480. package/eject/sidebar-tree-island/scope-state.ts +154 -0
  481. package/eject/sidebar-tree-island/sidebar-scroll-preserve.ts +8 -2
  482. package/eject/site-tree-nav-island/index.tsx +349 -222
  483. package/eject/tab-item/tab-item.tsx +2 -4
  484. package/eject/theme-toggle/hydration-pending.ts +6 -10
  485. package/eject/theme-toggle/index.tsx +133 -173
  486. package/eject/toc/mobile-toc.tsx +27 -31
  487. package/eject/toc/toc.tsx +21 -24
  488. package/eject/toc/use-active-heading.ts +43 -38
  489. package/package.json +40 -22
  490. package/routes-src/404.tsx +2 -3
  491. package/routes-src/_chrome.tsx +7 -2
  492. package/routes-src/_design-token-panel-bootstrap.tsx +1 -63
  493. package/routes-src/docs-slug.tsx +2 -3
  494. package/routes-src/docs-tags-index.tsx +2 -3
  495. package/routes-src/docs-tags-tag.tsx +2 -3
  496. package/routes-src/docs-versions.tsx +2 -3
  497. package/routes-src/files-path.tsx +2 -4
  498. package/routes-src/index.tsx +2 -3
  499. package/routes-src/locale-docs-slug.tsx +2 -3
  500. package/routes-src/locale-docs-tags-index.tsx +2 -3
  501. package/routes-src/locale-docs-tags-tag.tsx +2 -3
  502. package/routes-src/locale-docs-versions.tsx +2 -3
  503. package/routes-src/locale-files-path.tsx +2 -4
  504. package/routes-src/locale-index.tsx +2 -3
  505. package/routes-src/mcp.tsx +25 -0
  506. package/routes-src/v-docs-slug.tsx +2 -3
  507. package/routes-src/v-locale-docs-slug.tsx +2 -3
  508. package/tsconfig.base.json +1 -1
  509. package/dist/safelist.css +0 -2
  510. package/dist/theme-no-reset.css +0 -379
  511. package/eject/desktop-sidebar-toggle-island/index.tsx +0 -110
@@ -1,183 +1,165 @@
1
1
  import { BEFORE_SWAP_EVENT } from "./page-events.js";
2
- const PERSIST_ATTR = "data-zfb-transition-persist";
3
- const ISLAND_ATTR = "data-zfb-island";
4
- const PROPS_ATTR = "data-props";
5
- const PROPS_PRESERVE_ATTR = "data-zd-props-preserve";
6
- const ISLAND_REMOUNT_ATTR = "data-zfb-island-remount";
7
- const DOCUMENT_NODE = 9;
8
- const installedControllers = /* @__PURE__ */ new WeakMap();
9
- function installNestedIslandPropsRefresh({
10
- document: document2,
11
- reportError
12
- }) {
13
- const onBeforeSwap = (event) => {
14
- const swapEvent = event;
15
- const incoming = swapEvent.newDocument;
16
- if (!isDocument(incoming) || incoming === document2 || typeof swapEvent.swap !== "function") {
17
- return;
2
+ const PERSIST = "data-zfb-transition-persist";
3
+ const PRESERVE = "data-zd-props-preserve";
4
+ const PROPS = "data-props";
5
+ const MARKERS = ["data-zfb-island", "data-zfb-island-skip-ssr"];
6
+ const IDENTITY = [
7
+ ...MARKERS,
8
+ "data-zfb-transport",
9
+ "data-zfb-protocol",
10
+ "data-zfb-build"
11
+ ];
12
+ const SCHEDULE = ["data-when", "data-media"];
13
+ const ISLAND_SELECTOR = MARKERS.map((attr) => `[${attr}]`).join(",");
14
+ const installed = /* @__PURE__ */ new WeakMap();
15
+ function installNestedIslandPropsRefresh({ document: document2, reportError }) {
16
+ const listener = (event) => {
17
+ const navigation = event;
18
+ const incoming = navigation.newDocument;
19
+ if (!isDocument(incoming) || incoming === document2 || typeof navigation.swap !== "function") return;
20
+ try {
21
+ prepareIncoming(document2, incoming);
22
+ } catch (error) {
23
+ for (const root of incoming.querySelectorAll(`[${PERSIST}]`)) root.removeAttribute(PERSIST);
24
+ try {
25
+ if (reportError) reportError(error);
26
+ else queueMicrotask(() => {
27
+ throw error;
28
+ });
29
+ } catch (reporterError) {
30
+ queueMicrotask(() => {
31
+ throw reporterError;
32
+ });
33
+ }
18
34
  }
19
- const capturedSwap = swapEvent.swap;
20
- const plan = buildNestedIslandPropsMutationPlan(document2, incoming);
21
- let commitStarted = false;
22
- let commitOutcome;
23
- const composedSwap = function(...args) {
24
- if (commitStarted) {
25
- if (!commitOutcome) return void 0;
26
- if (!commitOutcome.ok) throw commitOutcome.error;
27
- return commitOutcome.value;
35
+ const delegate = navigation.swap;
36
+ let started = false;
37
+ let outcome;
38
+ const composed = function(...args) {
39
+ if (started) {
40
+ if (!outcome) return void 0;
41
+ if (!outcome.ok) throw outcome.error;
42
+ return outcome.value;
28
43
  }
29
- commitStarted = true;
44
+ started = true;
30
45
  try {
31
- const value = commitMutationPlanAndDelegate(
32
- plan,
33
- capturedSwap,
34
- this,
35
- args,
36
- reportError
37
- );
38
- commitOutcome = { ok: true, value };
46
+ const value = delegate.apply(this, args);
47
+ outcome = { ok: true, value };
39
48
  return value;
40
49
  } catch (error) {
41
- commitOutcome = { ok: false, error };
50
+ outcome = { ok: false, error };
42
51
  throw error;
43
52
  }
44
53
  };
45
54
  try {
46
- swapEvent.swap = composedSwap;
55
+ navigation.swap = composed;
47
56
  } catch {
48
- return;
49
57
  }
50
- if (swapEvent.swap !== composedSwap) return;
51
58
  };
52
- document2.addEventListener(BEFORE_SWAP_EVENT, onBeforeSwap);
53
- return () => document2.removeEventListener(BEFORE_SWAP_EVENT, onBeforeSwap);
59
+ document2.addEventListener(BEFORE_SWAP_EVENT, listener);
60
+ return () => document2.removeEventListener(BEFORE_SWAP_EVENT, listener);
54
61
  }
55
62
  function ensureNestedIslandPropsRefresh(options) {
56
- const resolved = options ?? resolveBrowserOptions();
57
- if (!resolved || installedControllers.has(resolved.document)) return;
58
- installedControllers.set(
59
- resolved.document,
60
- installNestedIslandPropsRefresh(resolved)
61
- );
63
+ const resolved = options ?? (typeof document === "undefined" ? void 0 : { document });
64
+ if (!resolved || installed.has(resolved.document)) return;
65
+ installed.set(resolved.document, installNestedIslandPropsRefresh(resolved));
62
66
  }
63
67
  function disposeNestedIslandPropsRefresh(document2) {
64
- installedControllers.get(document2)?.();
65
- installedControllers.delete(document2);
68
+ installed.get(document2)?.();
69
+ installed.delete(document2);
66
70
  }
67
- function buildNestedIslandPropsMutationPlan(liveDocument, incomingDocument) {
68
- const plan = [];
69
- const liveRoots = collectRefreshableRoots(liveDocument);
70
- if (liveRoots.size === 0) return Object.freeze(plan);
71
- const incomingRoots = collectRefreshableRoots(incomingDocument);
72
- for (const [persistKey, liveRoot] of liveRoots) {
73
- const incomingRoot = incomingRoots.get(persistKey);
74
- if (!incomingRoot) continue;
75
- const incomingIslands = collectUniqueOwnedIslands(incomingRoot);
76
- if (incomingIslands.size === 0) continue;
77
- for (const [name, liveIsland] of collectUniqueOwnedIslands(liveRoot, true)) {
78
- const incomingIsland = incomingIslands.get(name);
79
- if (!incomingIsland) continue;
80
- const incomingProps = incomingIsland.getAttribute(PROPS_ATTR);
81
- if (incomingProps === liveIsland.getAttribute(PROPS_ATTR)) continue;
82
- plan.push(Object.freeze({ liveIsland, incomingProps }));
83
- }
84
- }
85
- return Object.freeze(plan);
71
+ function isDocument(value) {
72
+ return typeof value === "object" && value !== null && value.nodeType === 9 && typeof value.querySelectorAll === "function";
86
73
  }
87
- function commitMutationPlanAndDelegate(plan, delegate, receiver, args, reportError) {
88
- const helperErrors = [];
89
- for (const mutation of plan) {
90
- try {
91
- applyPropsMutation(mutation);
92
- } catch (error) {
93
- helperErrors.push(error);
94
- }
95
- }
96
- let delegateResult;
97
- try {
98
- delegateResult = delegate.apply(receiver, args);
99
- } catch (delegateError) {
100
- reportRefreshErrors(helperErrors, reportError);
101
- throw delegateError;
74
+ function uniqueRoots(doc) {
75
+ const roots = /* @__PURE__ */ new Map();
76
+ const duplicates = /* @__PURE__ */ new Set();
77
+ for (const root of doc.querySelectorAll(`[${PERSIST}]`)) {
78
+ if (root.parentElement?.closest(`[${PERSIST}]`)) continue;
79
+ const key = root.getAttribute(PERSIST);
80
+ if (!key) continue;
81
+ if (roots.has(key)) duplicates.add(key);
82
+ else roots.set(key, root);
102
83
  }
103
- reportRefreshErrors(helperErrors, reportError);
104
- return delegateResult;
84
+ for (const key of duplicates) roots.delete(key);
85
+ return roots;
105
86
  }
106
- function collectRefreshableRoots(doc) {
107
- const roots = indexUniquely(
108
- doc.querySelectorAll(`[${PERSIST_ATTR}]`),
109
- PERSIST_ATTR
110
- );
111
- for (const [persistKey, element] of roots) {
112
- if (element.parentElement?.closest(`[${PERSIST_ATTR}]`)) {
113
- roots.delete(persistKey);
114
- }
87
+ function ownedIslands(root) {
88
+ const islands = /* @__PURE__ */ new Map();
89
+ for (const element of root.querySelectorAll(ISLAND_SELECTOR)) {
90
+ if (element.closest(`[${PERSIST}]`) !== root) continue;
91
+ const name = element.getAttribute(MARKERS[0]) ?? element.getAttribute(MARKERS[1]);
92
+ if (!name || islands.has(name)) return void 0;
93
+ islands.set(name, element);
115
94
  }
116
- return roots;
95
+ return islands;
117
96
  }
118
- function collectUniqueOwnedIslands(root, excludePreserved = false) {
119
- const owned = Array.from(root.querySelectorAll(`[${ISLAND_ATTR}]`)).filter(
120
- (island) => {
121
- if (island.closest(`[${PERSIST_ATTR}]`) !== root) return false;
122
- if (!excludePreserved) return true;
123
- const preserveBoundary = island.closest(`[${PROPS_PRESERVE_ATTR}]`);
124
- return preserveBoundary === null || !root.contains(preserveBoundary);
125
- }
126
- );
127
- return indexUniquely(owned, ISLAND_ATTR);
97
+ function sameAttributes(a, b, names) {
98
+ return names.every((name) => a.getAttribute(name) === b.getAttribute(name));
128
99
  }
129
- function indexUniquely(elements, attribute) {
130
- const byValue = /* @__PURE__ */ new Map();
131
- const duplicated = /* @__PURE__ */ new Set();
132
- for (const element of elements) {
133
- const value = element.getAttribute(attribute);
134
- if (!value) continue;
135
- if (byValue.has(value)) {
136
- duplicated.add(value);
137
- continue;
138
- }
139
- byValue.set(value, element);
140
- }
141
- for (const value of duplicated) byValue.delete(value);
142
- return byValue;
100
+ function sameStructure(a, b) {
101
+ if (a.tagName !== b.tagName || a.getAttribute(PERSIST) !== b.getAttribute(PERSIST) || a.id !== b.id) return false;
102
+ if (a !== b && (MARKERS.some((attr) => a.hasAttribute(attr)) || MARKERS.some((attr) => b.hasAttribute(attr)))) return true;
103
+ const left = Array.from(a.children);
104
+ const right = Array.from(b.children);
105
+ return left.length === right.length && left.every((child, index) => right[index] !== void 0 && sameStructure(child, right[index]));
143
106
  }
144
- function applyPropsMutation({
145
- liveIsland,
146
- incomingProps
147
- }) {
148
- if (incomingProps === null) {
149
- liveIsland.removeAttribute(PROPS_ATTR);
150
- } else {
151
- liveIsland.setAttribute(PROPS_ATTR, incomingProps);
152
- }
153
- liveIsland.setAttribute(ISLAND_REMOUNT_ATTR, "");
107
+ function preserved(island, root) {
108
+ const boundary = island.closest(`[${PRESERVE}]`);
109
+ return boundary !== null && (boundary === root || root.contains(boundary));
154
110
  }
155
- function reportRefreshErrors(errors, reportError) {
156
- if (errors.length === 0) return;
157
- const error = errors.length === 1 ? errors[0] : new AggregateError(errors, "Nested-island props refresh failed");
158
- if (reportError) {
159
- try {
160
- reportError(error);
161
- } catch (reporterError) {
162
- surfaceAsynchronously(reporterError);
111
+ function prepareIncoming(live, incoming) {
112
+ const liveRoots = uniqueRoots(live);
113
+ const incomingRoots = uniqueRoots(incoming);
114
+ const liveCounts = countKeys(live);
115
+ const incomingCounts = countKeys(incoming);
116
+ for (const root of incoming.querySelectorAll(`[${PERSIST}]`)) {
117
+ if (root.parentElement?.closest(`[${PERSIST}]`)) continue;
118
+ const key = root.getAttribute(PERSIST);
119
+ if (!key || incomingCounts.get(key) !== 1) {
120
+ root.removeAttribute(PERSIST);
121
+ continue;
122
+ }
123
+ const liveCount = liveCounts.get(key) ?? 0;
124
+ if (liveCount === 0) {
125
+ continue;
126
+ }
127
+ if (liveCount !== 1) {
128
+ root.removeAttribute(PERSIST);
129
+ continue;
130
+ }
131
+ const oldRoot = liveRoots.get(key);
132
+ const newRoot = incomingRoots.get(key);
133
+ if (!oldRoot || newRoot !== root || !sameStructure(oldRoot, root)) {
134
+ root.removeAttribute(PERSIST);
135
+ continue;
136
+ }
137
+ const oldIslands = ownedIslands(oldRoot);
138
+ const newIslands = ownedIslands(root);
139
+ if (!oldIslands || !newIslands || oldIslands.size !== newIslands.size || [...oldIslands.keys()].some((name) => !newIslands.has(name))) {
140
+ root.removeAttribute(PERSIST);
141
+ continue;
142
+ }
143
+ if ([...oldIslands].some(([name, oldIsland]) => !sameAttributes(oldIsland, newIslands.get(name), SCHEDULE))) {
144
+ root.removeAttribute(PERSIST);
145
+ continue;
146
+ }
147
+ for (const [name, oldIsland] of oldIslands) {
148
+ const newIsland = newIslands.get(name);
149
+ if (!preserved(oldIsland, oldRoot) || !sameAttributes(oldIsland, newIsland, IDENTITY)) continue;
150
+ const value = oldIsland.getAttribute(PROPS);
151
+ if (value === null) newIsland.removeAttribute(PROPS);
152
+ else newIsland.setAttribute(PROPS, value);
163
153
  }
164
- return;
165
154
  }
166
- surfaceAsynchronously(error);
167
155
  }
168
- function surfaceAsynchronously(error) {
169
- queueMicrotask(() => {
170
- throw error;
171
- });
172
- }
173
- function isDocument(value) {
174
- if (typeof value !== "object" || value === null) return false;
175
- const candidate = value;
176
- return candidate.nodeType === DOCUMENT_NODE && typeof candidate.querySelectorAll === "function";
177
- }
178
- function resolveBrowserOptions() {
179
- if (typeof document === "undefined") return void 0;
180
- return { document };
156
+ function countKeys(doc) {
157
+ const counts = /* @__PURE__ */ new Map();
158
+ for (const root of doc.querySelectorAll(`[${PERSIST}]`)) {
159
+ const key = root.getAttribute(PERSIST);
160
+ if (key) counts.set(key, (counts.get(key) ?? 0) + 1);
161
+ }
162
+ return counts;
181
163
  }
182
164
  export {
183
165
  disposeNestedIslandPropsRefresh,
@@ -8,12 +8,9 @@
8
8
  */
9
9
  export declare const BEFORE_NAVIGATE_EVENT = "zfb:before-preparation";
10
10
  /**
11
- * Event name fired once the new page's `<body>` has been swapped in.
12
- * Today resolves to `"zfb:after-swap"` — dispatched by zfb's
13
- * client-router after a Strategy B SPA navigation completes (and on
14
- * the initial page load, so consumers register one listener and get
15
- * both first-paint and post-swap behavior). Direct successor to
16
- * Astro's `astro:page-load`.
11
+ * Event name fired after a SPA body swap. Today resolves to
12
+ * `"zfb:after-swap"`. The initial page load uses `zfb:page-load` instead;
13
+ * callers needing both paths initialize on first paint as well.
17
14
  */
18
15
  export declare const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
19
16
  /**
@@ -22,15 +19,14 @@ export declare const AFTER_NAVIGATE_EVENT = "zfb:after-swap";
22
19
  * dispatched by zfb's client-router with a mutable `event.newDocument`
23
20
  * carrying the incoming document that is about to replace the live one
24
21
  * (zudolab/zudo-doc#3136 / #3137). Consumers that need to influence the
25
- * incoming document BEFORE zfb's head-swap persistence logic runs (e.g.
22
+ * incoming document BEFORE zfb's island teardown and head/body swap run (e.g.
26
23
  * injecting a `<link>` so an href-matching stylesheet survives the swap
27
24
  * instead of being removed and re-fetched) must mutate `event.newDocument`
28
25
  * synchronously from a handler registered on this event — by the time
29
26
  * `AFTER_NAVIGATE_EVENT` fires the swap has already completed. This module
30
27
  * does not export a subscribe helper for it (unlike `onBeforeNavigate` /
31
- * `onAfterNavigate`) because the one current consumer
32
- * (`theme-pack-provider.tsx`) needs the raw event object's `newDocument`,
33
- * not just a bare notification.
28
+ * `onAfterNavigate`) because its consumers need the raw event object's
29
+ * `newDocument`, not just a bare notification.
34
30
  */
35
31
  export declare const BEFORE_SWAP_EVENT = "zfb:before-swap";
36
32
  /**
@@ -46,9 +42,8 @@ export declare const BEFORE_SWAP_EVENT = "zfb:before-swap";
46
42
  export declare function onBeforeNavigate(handler: () => void): () => void;
47
43
  /**
48
44
  * Subscribe to "navigation end" — runs `handler` after each page-body
49
- * swap. Mirrors Astro's `astro:page-load`: fires once on first load,
50
- * and again on every SPA navigation (zfb's Strategy B client-router
51
- * dispatches `zfb:after-swap` on the document for both cases).
45
+ * swap. The first page load is signaled separately by `zfb:page-load`;
46
+ * callers that need initial setup must also initialize on first paint.
52
47
  *
53
48
  * Returns an unsubscribe function. SSR-safe: returns a no-op when
54
49
  * called outside a browser.
@@ -1,13 +1,12 @@
1
1
  /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
2
  export declare const INDENT = "clamp(0.8rem, 1.2vw, 1.625rem)";
4
3
  export declare const CONNECTOR_OFFSET = "clamp(0.2rem, 0.3vw, 0.5rem)";
5
4
  export declare const CONNECTOR_WIDTH = "clamp(0.4rem, 0.6vw, 1rem)";
6
5
  export declare const BASE_PAD = "clamp(0.4rem, 0.8vw, 1.3rem)";
7
6
  export declare function connectorLeft(depth: number): string;
8
- export declare function CategoryLinkIcon({ className }: {
9
- className?: string;
10
- }): import("preact").JSX.Element;
7
+ export declare function CategoryLinkIcon({ class: className }: {
8
+ class?: string;
9
+ }): import("@takazudo/zfb").Description;
11
10
  export declare function ConnectorLines({ depth, isLast, widthScale, topPad, }: {
12
11
  depth: number;
13
12
  isLast: boolean;
@@ -19,4 +18,4 @@ export declare function ConnectorLines({ depth, isLast, widthScale, topPad, }: {
19
18
  * aligned with the first line instead of the row's vertical center.
20
19
  */
21
20
  topPad?: string;
22
- }): import("preact").JSX.Element | null;
21
+ }): import("@takazudo/zfb").Description | null;
@@ -1,4 +1,4 @@
1
- import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "@takazudo/zfb/zudo-react/jsx-runtime";
2
2
  const INDENT = "clamp(0.8rem, 1.2vw, 1.625rem)";
3
3
  const CONNECTOR_OFFSET = "clamp(0.2rem, 0.3vw, 0.5rem)";
4
4
  const CONNECTOR_WIDTH = "clamp(0.4rem, 0.6vw, 1rem)";
@@ -7,15 +7,14 @@ function connectorLeft(depth) {
7
7
  return `calc(${depth} * ${INDENT} + ${CONNECTOR_OFFSET})`;
8
8
  }
9
9
  const CATEGORY_LINK_PATH = "M5.746 5.74 0 11.49l20.987 20.96C34.126 45.572 41.963 53.45 41.948 53.523c-.012.062-9.456 9.544-20.986 21.07L0 95.55l5.714 5.715c3.142 3.143 5.748 5.715 5.79 5.715s2.63-2.563 5.75-5.696l17.939-18.001c21.867-21.94 29.443-29.599 29.443-29.768 0-.114-.665-.804-5.084-5.275C51.872 40.47 11.71.125 11.565.036 11.525.01 8.906 2.578 5.746 5.74m38.345-.066c-3.132 3.13-5.696 5.71-5.696 5.732-.001.022 2.16 2.185 4.8 4.807 2.641 2.623 8.382 8.338 12.758 12.702 15.38 15.337 23.763 23.641 24.314 24.086.19.153.346.336.346.405 0 .07-1.738 1.847-3.887 3.976a17515 17515 0 0 0-20.35 20.264 19555 19555 0 0 1-17.223 17.158c-.416.409-.757.77-.757.8 0 .083 11.415 11.485 11.457 11.445.235-.22 53.542-53.528 53.542-53.543C103.395 53.472 49.891.02 49.837 0c-.028-.01-2.613 2.543-5.746 5.674";
10
- function CategoryLinkIcon({ className }) {
10
+ function CategoryLinkIcon({ class: className }) {
11
11
  return /* @__PURE__ */ jsx(
12
12
  "svg",
13
13
  {
14
- xmlns: "http://www.w3.org/2000/svg",
15
14
  fill: "currentColor",
16
15
  viewBox: "0 0 103.395 107.049",
17
16
  "aria-hidden": "true",
18
- className: `shrink-0 ${className ?? ""}`,
17
+ class: `shrink-0 ${className ?? ""}`,
19
18
  children: /* @__PURE__ */ jsx("path", { d: CATEGORY_LINK_PATH })
20
19
  }
21
20
  );
@@ -34,10 +33,10 @@ function ConnectorLines({
34
33
  /* @__PURE__ */ jsx(
35
34
  "div",
36
35
  {
37
- className: "absolute border-l border-dashed border-muted",
36
+ class: "absolute border-l border-dashed border-muted",
38
37
  style: {
39
38
  left,
40
- top: 0,
39
+ top: "0px",
41
40
  bottom: isLast ? `calc(100% - ${firstLineMid})` : 0
42
41
  }
43
42
  }
@@ -45,7 +44,7 @@ function ConnectorLines({
45
44
  /* @__PURE__ */ jsx(
46
45
  "div",
47
46
  {
48
- className: "absolute border-t border-dashed border-muted",
47
+ class: "absolute border-t border-dashed border-muted",
49
48
  style: {
50
49
  left,
51
50
  width,
@@ -1,70 +1,16 @@
1
- interface UseModalDialogOptions {
2
- /** True when the dialog should be open. */
3
- isOpen: boolean;
4
- /** Called when the dialog is closed for any reason (Escape, backdrop, navigation). */
1
+ import type { Listener, ReadonlySignal, Ref, Scope } from "@takazudo/zfb/zudo-react";
2
+ export interface ModalDialogOptions {
3
+ isOpen: ReadonlySignal<boolean>;
5
4
  onClose: () => void;
6
- /**
7
- * DOM event name that triggers a close-and-reset. Pass the host's SPA
8
- * after-navigate event name (e.g. `AFTER_NAVIGATE_EVENT`); pass `undefined`
9
- * to skip navigation-close wiring entirely.
10
- */
11
5
  navigateEvent?: string;
12
- /**
13
- * When `true`, enable backdrop-click-to-close. The caller must forward the
14
- * click handler returned by this hook to the `<dialog>` element's `onClick`.
15
- * Defaults to `false` so opt-in only.
16
- */
17
6
  backdropClickClose?: boolean;
18
- /**
19
- * When `true`, enable focus management:
20
- * - On open: capture `document.activeElement` as the return target (unless
21
- * `returnFocusRef` is provided), then move focus to the first focusable
22
- * element inside the dialog (or the dialog itself as a fallback).
23
- * - On close: restore focus to the captured element.
24
- *
25
- * When a caller already manages focus internally (e.g. ai-chat-modal focuses
26
- * its input in its own effect), pass `restoreFocusOnly: true` instead to get
27
- * trigger-capture + restore without the "move into dialog" step.
28
- */
29
7
  manageFocus?: boolean;
30
- /**
31
- * Like `manageFocus` but skips the "focus first element in dialog" step —
32
- * use when the caller has its own focus-on-open logic and only needs
33
- * trigger-capture + focus restore on close.
34
- */
35
8
  restoreFocusOnly?: boolean;
36
- /**
37
- * Optional ref holding the element to return focus to on close. When
38
- * provided and non-null, this takes precedence over the internally captured
39
- * `document.activeElement`. Useful when the trigger element is conditionally
40
- * rendered and therefore removed from the DOM before the open effect fires
41
- * (e.g. the doc-history trigger button, which is unmounted when `isOpen`
42
- * is true). The caller should set `returnFocusRef.current` to the trigger
43
- * element in its click handler, before calling `setState`.
44
- */
45
- returnFocusRef?: React.RefObject<HTMLElement | null>;
9
+ returnFocusRef?: Ref<HTMLElement>;
46
10
  }
47
- interface UseModalDialogResult {
48
- dialogRef: React.RefObject<HTMLDialogElement>;
49
- /**
50
- * Pass this to `<dialog onClick={handleBackdropClick}>`.
51
- * Only wired when `backdropClickClose` is true; otherwise a no-op.
52
- */
53
- handleBackdropClick: (e: React.MouseEvent<HTMLDialogElement>) => void;
11
+ export interface ModalDialogResult {
12
+ dialogRef: Ref<HTMLDialogElement>;
13
+ handleBackdropClick: Listener<Event>;
54
14
  }
55
- /**
56
- * Shared hook for `<dialog>`-based modal components.
57
- *
58
- * Usage:
59
- * ```tsx
60
- * const { dialogRef, handleBackdropClick } = useModalDialog({
61
- * isOpen,
62
- * onClose: handleClose,
63
- * navigateEvent: AFTER_NAVIGATE_EVENT,
64
- * backdropClickClose: true,
65
- * });
66
- * return <dialog ref={dialogRef} onClick={handleBackdropClick} ... />;
67
- * ```
68
- */
69
- export declare function useModalDialog({ isOpen, onClose, navigateEvent, backdropClickClose, manageFocus, restoreFocusOnly, returnFocusRef, }: UseModalDialogOptions): UseModalDialogResult;
70
- export {};
15
+ /** Call during setup in the scope that owns the dialog element. */
16
+ export declare function modalDialog(scope: Scope, options: ModalDialogOptions): ModalDialogResult;
@@ -1,73 +1,55 @@
1
- "use client";
2
- import { useEffect, useRef } from "preact/compat";
3
- function useModalDialog({
4
- isOpen,
5
- onClose,
6
- navigateEvent,
7
- backdropClickClose = false,
8
- manageFocus = false,
9
- restoreFocusOnly = false,
10
- returnFocusRef
11
- }) {
12
- const dialogRef = useRef(null);
13
- const internalTriggerRef = useRef(null);
14
- useEffect(() => {
1
+ function modalDialog(scope, options) {
2
+ const dialogRef = { current: null };
3
+ let capturedTrigger = null;
4
+ let closingFromNavigation = false;
5
+ const ownsFocus = options.manageFocus || options.restoreFocusOnly;
6
+ scope.effect(() => {
15
7
  const dialog = dialogRef.current;
16
8
  if (!dialog) return;
17
- if (isOpen && !dialog.open) {
18
- if ((manageFocus || restoreFocusOnly) && !returnFocusRef) {
19
- internalTriggerRef.current = document.activeElement;
20
- }
9
+ if (options.isOpen.value && !dialog.open) {
10
+ closingFromNavigation = false;
11
+ if (ownsFocus && !options.returnFocusRef) capturedTrigger = document.activeElement;
21
12
  dialog.showModal();
22
- if (manageFocus && !restoreFocusOnly) {
23
- const FOCUSABLE = 'button:not([disabled]),a[href],[tabindex]:not([tabindex="-1"]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])';
24
- const first = dialog.querySelector(FOCUSABLE);
25
- if (first) {
26
- first.focus();
27
- } else {
28
- dialog.focus();
29
- }
13
+ if (options.manageFocus && !options.restoreFocusOnly) {
14
+ const focusable = dialog.querySelector(
15
+ 'button:not([disabled]),a[href],[tabindex]:not([tabindex="-1"]),input:not([disabled]),select:not([disabled]),textarea:not([disabled])'
16
+ );
17
+ (focusable ?? dialog).focus();
30
18
  }
31
- } else if (!isOpen && dialog.open) {
19
+ } else if (!options.isOpen.value && dialog.open) {
32
20
  dialog.close();
33
21
  }
34
- }, [isOpen, manageFocus, restoreFocusOnly, returnFocusRef]);
35
- useEffect(() => {
22
+ });
23
+ scope.onActivate(() => {
36
24
  const dialog = dialogRef.current;
37
25
  if (!dialog) return;
38
- function onDialogClose() {
39
- if (manageFocus || restoreFocusOnly) {
40
- const trigger = returnFocusRef ? returnFocusRef.current : internalTriggerRef.current;
41
- if (trigger instanceof HTMLElement) {
42
- trigger.focus();
43
- }
44
- internalTriggerRef.current = null;
26
+ const onDialogClose = () => {
27
+ if (ownsFocus) {
28
+ const trigger = options.returnFocusRef?.current ?? capturedTrigger;
29
+ if (trigger instanceof HTMLElement) trigger.focus();
30
+ capturedTrigger = null;
45
31
  }
46
- if (isOpen) onClose();
47
- }
32
+ if (options.isOpen.value && !closingFromNavigation) options.onClose();
33
+ closingFromNavigation = false;
34
+ };
35
+ const onNavigation = () => {
36
+ if (!dialog.open) return;
37
+ closingFromNavigation = true;
38
+ dialog.close();
39
+ options.onClose();
40
+ };
48
41
  dialog.addEventListener("close", onDialogClose);
49
- return () => dialog.removeEventListener("close", onDialogClose);
50
- }, [isOpen, onClose, manageFocus, restoreFocusOnly, returnFocusRef]);
51
- useEffect(() => {
52
- if (!navigateEvent) return;
53
- function handleNavigation() {
54
- const dialog = dialogRef.current;
55
- if (dialog?.open) {
56
- dialog.close();
57
- onClose();
58
- }
59
- }
60
- document.addEventListener(navigateEvent, handleNavigation);
61
- return () => document.removeEventListener(navigateEvent, handleNavigation);
62
- }, [navigateEvent, onClose]);
63
- function handleBackdropClick(e) {
64
- if (!backdropClickClose) return;
65
- const dialog = dialogRef.current;
66
- if (!dialog) return;
67
- if (e.target === dialog) dialog.close();
68
- }
42
+ if (options.navigateEvent) document.addEventListener(options.navigateEvent, onNavigation);
43
+ return () => {
44
+ dialog.removeEventListener("close", onDialogClose);
45
+ if (options.navigateEvent) document.removeEventListener(options.navigateEvent, onNavigation);
46
+ };
47
+ });
48
+ const handleBackdropClick = (event) => {
49
+ if (options.backdropClickClose && event.target === dialogRef.current) dialogRef.current?.close();
50
+ };
69
51
  return { dialogRef, handleBackdropClick };
70
52
  }
71
53
  export {
72
- useModalDialog
54
+ modalDialog
73
55
  };
@@ -1,6 +1,6 @@
1
1
  /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- import type { ComponentChildren, JSX } from "preact";
2
+ import type { Child } from "@takazudo/zfb/zudo-react";
3
+ import type { JSX } from "@takazudo/zfb/zudo-react/jsx-runtime";
4
4
  import type { ChromeContext } from "../factory-context/index.js";
5
5
  import type { Settings } from "../settings.js";
6
6
  /** Minimal version config entry needed by the versions page. */
@@ -56,7 +56,7 @@ export interface VersionsPageDeps {
56
56
  /** Props for the VersionsPageView component. */
57
57
  export interface VersionsPageViewProps {
58
58
  locale: string;
59
- children?: ComponentChildren;
59
+ children?: Child;
60
60
  }
61
61
  /**
62
62
  * Create a `VersionsPageView` component from the unified {@link ChromeContext}