@takazudo/zudo-doc 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -0
  3. package/dist/body-foot-util/body-foot-util-area.d.ts +55 -0
  4. package/dist/body-foot-util/body-foot-util-area.js +71 -0
  5. package/dist/body-foot-util/edit-link.d.ts +45 -0
  6. package/dist/body-foot-util/edit-link.js +42 -0
  7. package/dist/body-foot-util/index.d.ts +3 -0
  8. package/dist/body-foot-util/index.js +11 -0
  9. package/dist/breadcrumb/breadcrumb.d.ts +57 -0
  10. package/dist/breadcrumb/breadcrumb.js +113 -0
  11. package/dist/breadcrumb/find-path.d.ts +16 -0
  12. package/dist/breadcrumb/find-path.js +13 -0
  13. package/dist/breadcrumb/index.d.ts +4 -0
  14. package/dist/breadcrumb/index.js +7 -0
  15. package/dist/breadcrumb/types.d.ts +32 -0
  16. package/dist/breadcrumb/types.js +0 -0
  17. package/dist/code-syntax/code-block-enhancer-script.d.ts +3 -0
  18. package/dist/code-syntax/code-block-enhancer-script.js +165 -0
  19. package/dist/code-syntax/code-block-enhancer.d.ts +22 -0
  20. package/dist/code-syntax/code-block-enhancer.js +13 -0
  21. package/dist/code-syntax/index.d.ts +8 -0
  22. package/dist/code-syntax/index.js +29 -0
  23. package/dist/code-syntax/mermaid-init-script.d.ts +51 -0
  24. package/dist/code-syntax/mermaid-init-script.js +225 -0
  25. package/dist/code-syntax/mermaid-init.d.ts +48 -0
  26. package/dist/code-syntax/mermaid-init.js +14 -0
  27. package/dist/code-syntax/tabs-init-script.d.ts +3 -0
  28. package/dist/code-syntax/tabs-init-script.js +106 -0
  29. package/dist/code-syntax/tabs-init.d.ts +24 -0
  30. package/dist/code-syntax/tabs-init.js +10 -0
  31. package/dist/code-syntax/tabs.d.ts +36 -0
  32. package/dist/code-syntax/tabs.js +62 -0
  33. package/dist/content/component-map.d.ts +51 -0
  34. package/dist/content/component-map.js +29 -0
  35. package/dist/content/content-blockquote.d.ts +11 -0
  36. package/dist/content/content-blockquote.js +14 -0
  37. package/dist/content/content-code.d.ts +26 -0
  38. package/dist/content/content-code.js +39 -0
  39. package/dist/content/content-link.d.ts +12 -0
  40. package/dist/content/content-link.js +43 -0
  41. package/dist/content/content-ol.d.ts +11 -0
  42. package/dist/content/content-ol.js +15 -0
  43. package/dist/content/content-paragraph.d.ts +10 -0
  44. package/dist/content/content-paragraph.js +7 -0
  45. package/dist/content/content-strong.d.ts +11 -0
  46. package/dist/content/content-strong.js +14 -0
  47. package/dist/content/content-table.d.ts +11 -0
  48. package/dist/content/content-table.js +14 -0
  49. package/dist/content/content-ul.d.ts +11 -0
  50. package/dist/content/content-ul.js +15 -0
  51. package/dist/content/heading-h2.d.ts +14 -0
  52. package/dist/content/heading-h2.js +18 -0
  53. package/dist/content/heading-h3.d.ts +14 -0
  54. package/dist/content/heading-h3.js +18 -0
  55. package/dist/content/heading-h4.d.ts +14 -0
  56. package/dist/content/heading-h4.js +18 -0
  57. package/dist/content/index.d.ts +13 -0
  58. package/dist/content/index.js +27 -0
  59. package/dist/details/details.d.ts +26 -0
  60. package/dist/details/details.js +10 -0
  61. package/dist/details/index.d.ts +2 -0
  62. package/dist/details/index.js +4 -0
  63. package/dist/doclayout/anchors.d.ts +55 -0
  64. package/dist/doclayout/anchors.js +42 -0
  65. package/dist/doclayout/doc-layout-with-defaults.d.ts +83 -0
  66. package/dist/doclayout/doc-layout-with-defaults.js +159 -0
  67. package/dist/doclayout/doc-layout.d.ts +121 -0
  68. package/dist/doclayout/doc-layout.js +89 -0
  69. package/dist/doclayout/index.d.ts +6 -0
  70. package/dist/doclayout/index.js +17 -0
  71. package/dist/footer/footer.d.ts +42 -0
  72. package/dist/footer/footer.js +79 -0
  73. package/dist/footer/index.d.ts +3 -0
  74. package/dist/footer/index.js +4 -0
  75. package/dist/footer/types.d.ts +58 -0
  76. package/dist/footer/types.js +0 -0
  77. package/dist/head/doc-head.d.ts +33 -0
  78. package/dist/head/doc-head.js +90 -0
  79. package/dist/head/index.d.ts +5 -0
  80. package/dist/head/index.js +8 -0
  81. package/dist/head/og-tags.d.ts +25 -0
  82. package/dist/head/og-tags.js +16 -0
  83. package/dist/head/twitter-card.d.ts +21 -0
  84. package/dist/head/twitter-card.js +14 -0
  85. package/dist/head/types.d.ts +83 -0
  86. package/dist/head/types.js +0 -0
  87. package/dist/header/header.d.ts +158 -0
  88. package/dist/header/header.js +367 -0
  89. package/dist/header/index.d.ts +6 -0
  90. package/dist/header/index.js +18 -0
  91. package/dist/header/nav-active.d.ts +39 -0
  92. package/dist/header/nav-active.js +24 -0
  93. package/dist/header/nav-overflow-script.d.ts +3 -0
  94. package/dist/header/nav-overflow-script.js +169 -0
  95. package/dist/header/right-items.d.ts +38 -0
  96. package/dist/header/right-items.js +30 -0
  97. package/dist/header/types.d.ts +40 -0
  98. package/dist/header/types.js +0 -0
  99. package/dist/html-preview-wrapper/dedent.d.ts +10 -0
  100. package/dist/html-preview-wrapper/dedent.js +16 -0
  101. package/dist/html-preview-wrapper/highlighted-code.d.ts +18 -0
  102. package/dist/html-preview-wrapper/highlighted-code.js +53 -0
  103. package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +60 -0
  104. package/dist/html-preview-wrapper/html-preview-wrapper.js +36 -0
  105. package/dist/html-preview-wrapper/html-preview.d.ts +35 -0
  106. package/dist/html-preview-wrapper/html-preview.js +75 -0
  107. package/dist/html-preview-wrapper/index.d.ts +5 -0
  108. package/dist/html-preview-wrapper/index.js +12 -0
  109. package/dist/html-preview-wrapper/preflight.d.ts +13 -0
  110. package/dist/html-preview-wrapper/preflight.js +108 -0
  111. package/dist/html-preview-wrapper/preview-base.d.ts +29 -0
  112. package/dist/html-preview-wrapper/preview-base.js +127 -0
  113. package/dist/i18n-version/index.d.ts +5 -0
  114. package/dist/i18n-version/index.js +14 -0
  115. package/dist/i18n-version/language-switcher.d.ts +24 -0
  116. package/dist/i18n-version/language-switcher.js +25 -0
  117. package/dist/i18n-version/types.d.ts +43 -0
  118. package/dist/i18n-version/types.js +0 -0
  119. package/dist/i18n-version/version-banner.d.ts +30 -0
  120. package/dist/i18n-version/version-banner.js +21 -0
  121. package/dist/i18n-version/version-switcher.d.ts +112 -0
  122. package/dist/i18n-version/version-switcher.js +157 -0
  123. package/dist/index.d.ts +2 -0
  124. package/dist/index.js +0 -0
  125. package/dist/integrations/claude-resources/escape-for-mdx.d.ts +8 -0
  126. package/dist/integrations/claude-resources/escape-for-mdx.js +131 -0
  127. package/dist/integrations/claude-resources/generate.d.ts +13 -0
  128. package/dist/integrations/claude-resources/generate.js +404 -0
  129. package/dist/integrations/claude-resources/index.d.ts +46 -0
  130. package/dist/integrations/claude-resources/index.js +24 -0
  131. package/dist/integrations/doc-history/index.d.ts +137 -0
  132. package/dist/integrations/doc-history/index.js +138 -0
  133. package/dist/integrations/doc-history/pre-build.d.ts +58 -0
  134. package/dist/integrations/doc-history/pre-build.js +67 -0
  135. package/dist/integrations/llms-txt/dev-middleware.d.ts +40 -0
  136. package/dist/integrations/llms-txt/dev-middleware.js +76 -0
  137. package/dist/integrations/llms-txt/emit.d.ts +22 -0
  138. package/dist/integrations/llms-txt/emit.js +55 -0
  139. package/dist/integrations/llms-txt/generate.d.ts +26 -0
  140. package/dist/integrations/llms-txt/generate.js +36 -0
  141. package/dist/integrations/llms-txt/index.d.ts +7 -0
  142. package/dist/integrations/llms-txt/index.js +27 -0
  143. package/dist/integrations/llms-txt/load.d.ts +51 -0
  144. package/dist/integrations/llms-txt/load.js +83 -0
  145. package/dist/integrations/llms-txt/strip.d.ts +22 -0
  146. package/dist/integrations/llms-txt/strip.js +10 -0
  147. package/dist/integrations/llms-txt/types.d.ts +145 -0
  148. package/dist/integrations/llms-txt/types.js +0 -0
  149. package/dist/integrations/search-index/build-emitter.d.ts +30 -0
  150. package/dist/integrations/search-index/build-emitter.js +15 -0
  151. package/dist/integrations/search-index/collect.d.ts +12 -0
  152. package/dist/integrations/search-index/collect.js +48 -0
  153. package/dist/integrations/search-index/content-files.d.ts +32 -0
  154. package/dist/integrations/search-index/content-files.js +50 -0
  155. package/dist/integrations/search-index/dev-middleware.d.ts +16 -0
  156. package/dist/integrations/search-index/dev-middleware.js +30 -0
  157. package/dist/integrations/search-index/index.d.ts +5 -0
  158. package/dist/integrations/search-index/index.js +14 -0
  159. package/dist/integrations/search-index/types.d.ts +38 -0
  160. package/dist/integrations/search-index/types.js +6 -0
  161. package/dist/metainfo/doc-metainfo.d.ts +50 -0
  162. package/dist/metainfo/doc-metainfo.js +107 -0
  163. package/dist/metainfo/doc-tags.d.ts +66 -0
  164. package/dist/metainfo/doc-tags.js +53 -0
  165. package/dist/metainfo/frontmatter-preview.d.ts +95 -0
  166. package/dist/metainfo/frontmatter-preview.js +55 -0
  167. package/dist/metainfo/index.d.ts +4 -0
  168. package/dist/metainfo/index.js +28 -0
  169. package/dist/nav-indexing/category-nav.d.ts +28 -0
  170. package/dist/nav-indexing/category-nav.js +41 -0
  171. package/dist/nav-indexing/category-tree-nav.d.ts +27 -0
  172. package/dist/nav-indexing/category-tree-nav.js +49 -0
  173. package/dist/nav-indexing/doc-card-grid.d.ts +38 -0
  174. package/dist/nav-indexing/doc-card-grid.js +40 -0
  175. package/dist/nav-indexing/docs-sitemap.d.ts +25 -0
  176. package/dist/nav-indexing/docs-sitemap.js +40 -0
  177. package/dist/nav-indexing/index.d.ts +10 -0
  178. package/dist/nav-indexing/index.js +18 -0
  179. package/dist/nav-indexing/nav-card-grid.d.ts +31 -0
  180. package/dist/nav-indexing/nav-card-grid.js +43 -0
  181. package/dist/nav-indexing/site-tree-nav-demo.d.ts +39 -0
  182. package/dist/nav-indexing/site-tree-nav-demo.js +65 -0
  183. package/dist/nav-indexing/tag-nav.d.ts +38 -0
  184. package/dist/nav-indexing/tag-nav.js +96 -0
  185. package/dist/nav-indexing/types.d.ts +95 -0
  186. package/dist/nav-indexing/types.js +0 -0
  187. package/dist/nav-indexing/versions-page-content.d.ts +29 -0
  188. package/dist/nav-indexing/versions-page-content.js +76 -0
  189. package/dist/page-loading/index.d.ts +2 -0
  190. package/dist/page-loading/index.js +10 -0
  191. package/dist/page-loading/page-loading-overlay.d.ts +35 -0
  192. package/dist/page-loading/page-loading-overlay.js +50 -0
  193. package/dist/sidebar/index.d.ts +3 -0
  194. package/dist/sidebar/index.js +4 -0
  195. package/dist/sidebar/sidebar.d.ts +54 -0
  196. package/dist/sidebar/sidebar.js +35 -0
  197. package/dist/sidebar/types.d.ts +71 -0
  198. package/dist/sidebar/types.js +0 -0
  199. package/dist/sidebar-resizer/index.d.ts +14 -0
  200. package/dist/sidebar-resizer/index.js +165 -0
  201. package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +20 -0
  202. package/dist/sidebar-resizer/sidebar-resizer-init.js +119 -0
  203. package/dist/sidebar-tree/build-tree.d.ts +43 -0
  204. package/dist/sidebar-tree/build-tree.js +127 -0
  205. package/dist/sidebar-tree/category-meta.d.ts +19 -0
  206. package/dist/sidebar-tree/category-meta.js +63 -0
  207. package/dist/sidebar-tree/index.d.ts +3 -0
  208. package/dist/sidebar-tree/index.js +13 -0
  209. package/dist/sidebar-tree/types.d.ts +120 -0
  210. package/dist/sidebar-tree/types.js +0 -0
  211. package/dist/tab-item/index.d.ts +2 -0
  212. package/dist/tab-item/index.js +5 -0
  213. package/dist/tab-item/tab-item.d.ts +38 -0
  214. package/dist/tab-item/tab-item.js +25 -0
  215. package/dist/theme/color-scheme-provider.d.ts +32 -0
  216. package/dist/theme/color-scheme-provider.js +43 -0
  217. package/dist/theme/color-tweak-export-modal.d.ts +20 -0
  218. package/dist/theme/color-tweak-export-modal.js +138 -0
  219. package/dist/theme/design-token-serde.d.ts +136 -0
  220. package/dist/theme/design-token-serde.js +254 -0
  221. package/dist/theme/design-token-tweak-panel.d.ts +11 -0
  222. package/dist/theme/design-token-tweak-panel.js +10 -0
  223. package/dist/theme/design-token-types.d.ts +19 -0
  224. package/dist/theme/design-token-types.js +6 -0
  225. package/dist/theme/iframe-bridge.d.ts +44 -0
  226. package/dist/theme/iframe-bridge.js +70 -0
  227. package/dist/theme/index.d.ts +9 -0
  228. package/dist/theme/index.js +42 -0
  229. package/dist/theme/theme-toggle.d.ts +17 -0
  230. package/dist/theme/theme-toggle.js +91 -0
  231. package/dist/toc/cx.d.ts +16 -0
  232. package/dist/toc/cx.js +22 -0
  233. package/dist/toc/index.d.ts +5 -0
  234. package/dist/toc/index.js +9 -0
  235. package/dist/toc/mobile-toc.d.ts +46 -0
  236. package/dist/toc/mobile-toc.js +88 -0
  237. package/dist/toc/smart-break.d.ts +27 -0
  238. package/dist/toc/smart-break.js +36 -0
  239. package/dist/toc/toc-title.d.ts +10 -0
  240. package/dist/toc/toc-title.js +14 -0
  241. package/dist/toc/toc.d.ts +60 -0
  242. package/dist/toc/toc.js +56 -0
  243. package/dist/toc/types.d.ts +23 -0
  244. package/dist/toc/types.js +0 -0
  245. package/dist/toc/use-active-heading.d.ts +30 -0
  246. package/dist/toc/use-active-heading.js +106 -0
  247. package/dist/transitions/index.d.ts +1 -0
  248. package/dist/transitions/index.js +12 -0
  249. package/dist/transitions/page-events.d.ts +41 -0
  250. package/dist/transitions/page-events.js +20 -0
  251. package/dist/url-normalizer/index.d.ts +1 -0
  252. package/dist/url-normalizer/index.js +6 -0
  253. package/dist/url-normalizer/normalize.d.ts +104 -0
  254. package/dist/url-normalizer/normalize.js +22 -0
  255. package/package.json +186 -0
@@ -0,0 +1,108 @@
1
+ const preflightCss = `
2
+ *,
3
+ ::after,
4
+ ::before,
5
+ ::backdrop,
6
+ ::file-selector-button {
7
+ box-sizing: border-box;
8
+ margin: 0;
9
+ padding: 0;
10
+ border: 0 solid;
11
+ }
12
+
13
+ html,
14
+ :host {
15
+ line-height: 1.5;
16
+ -webkit-text-size-adjust: 100%;
17
+ tab-size: 4;
18
+ font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
19
+ -webkit-tap-highlight-color: transparent;
20
+ }
21
+
22
+ hr {
23
+ height: 0;
24
+ color: inherit;
25
+ border-top-width: 1px;
26
+ }
27
+
28
+ abbr:where([title]) {
29
+ -webkit-text-decoration: underline dotted;
30
+ text-decoration: underline dotted;
31
+ }
32
+
33
+ h1, h2, h3, h4, h5, h6 {
34
+ font-size: inherit;
35
+ font-weight: inherit;
36
+ }
37
+
38
+ a {
39
+ color: inherit;
40
+ -webkit-text-decoration: inherit;
41
+ text-decoration: inherit;
42
+ }
43
+
44
+ b, strong {
45
+ font-weight: bolder;
46
+ }
47
+
48
+ code, kbd, samp, pre {
49
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
50
+ font-size: 1em;
51
+ }
52
+
53
+ small {
54
+ font-size: 80%;
55
+ }
56
+
57
+ sub, sup {
58
+ font-size: 75%;
59
+ line-height: 0;
60
+ position: relative;
61
+ vertical-align: baseline;
62
+ }
63
+
64
+ sub { bottom: -0.25em; }
65
+ sup { top: -0.5em; }
66
+
67
+ table {
68
+ text-indent: 0;
69
+ border-color: inherit;
70
+ border-collapse: collapse;
71
+ }
72
+
73
+ ol, ul, menu {
74
+ list-style: none;
75
+ }
76
+
77
+ img, svg, video, canvas, audio, iframe, embed, object {
78
+ display: block;
79
+ vertical-align: middle;
80
+ }
81
+
82
+ img, video {
83
+ max-width: 100%;
84
+ height: auto;
85
+ }
86
+
87
+ button, input, select, optgroup, textarea, ::file-selector-button {
88
+ font: inherit;
89
+ font-feature-settings: inherit;
90
+ font-variation-settings: inherit;
91
+ letter-spacing: inherit;
92
+ color: inherit;
93
+ border-radius: 0;
94
+ background-color: transparent;
95
+ opacity: 1;
96
+ }
97
+
98
+ textarea {
99
+ resize: vertical;
100
+ }
101
+
102
+ [hidden]:where(:not([hidden='until-found'])) {
103
+ display: none !important;
104
+ }
105
+ `;
106
+ export {
107
+ preflightCss
108
+ };
@@ -0,0 +1,29 @@
1
+ import { VNode } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ interface CodeBlockData {
7
+ language: string;
8
+ title: string;
9
+ code: string;
10
+ }
11
+ interface PreviewBaseProps {
12
+ title?: string;
13
+ height?: number;
14
+ srcdoc: string;
15
+ sandbox?: string;
16
+ syncDelay: number;
17
+ codeBlocks: CodeBlockData[];
18
+ defaultOpen?: boolean;
19
+ }
20
+ /**
21
+ * Interactive preview base: iframe viewport switcher + collapsible code
22
+ * section.
23
+ *
24
+ * JSX port of src/components/html-preview/preview-base.tsx with
25
+ * React → Preact hook imports and `className` → `class` attribute.
26
+ */
27
+ declare function PreviewBase({ title, height, srcdoc, sandbox, syncDelay, codeBlocks, defaultOpen, }: PreviewBaseProps): VNode;
28
+
29
+ export { type CodeBlockData, PreviewBase, type PreviewBaseProps };
@@ -0,0 +1,127 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ import { useCallback, useEffect, useRef, useState } from "preact/hooks";
3
+ import { HighlightedCode } from "./highlighted-code.js";
4
+ const VIEWPORTS = [
5
+ { label: "Mobile", width: "320px" },
6
+ { label: "Tablet", width: "768px" },
7
+ { label: "Full", width: "100%" }
8
+ ];
9
+ function PreviewBase({
10
+ title,
11
+ height,
12
+ srcdoc,
13
+ sandbox,
14
+ syncDelay,
15
+ codeBlocks,
16
+ defaultOpen
17
+ }) {
18
+ const [activeViewport, setActiveViewport] = useState(2);
19
+ const [codeOpen, setCodeOpen] = useState(defaultOpen ?? false);
20
+ const [iframeHeight, setIframeHeight] = useState(height ?? 200);
21
+ const iframeRef = useRef(null);
22
+ const syncHeight = useCallback(() => {
23
+ const iframe = iframeRef.current;
24
+ if (!iframe || height != null) return;
25
+ try {
26
+ const doc = iframe.contentDocument;
27
+ if (doc?.body) {
28
+ const h = doc.body.scrollHeight;
29
+ if (h > 0) setIframeHeight(Math.max(h + 16, 200));
30
+ }
31
+ } catch {
32
+ }
33
+ }, [height]);
34
+ useEffect(() => {
35
+ const iframe = iframeRef.current;
36
+ if (!iframe) return;
37
+ let timeoutId;
38
+ const onLoad = () => {
39
+ if (syncDelay > 0) {
40
+ timeoutId = setTimeout(syncHeight, syncDelay);
41
+ } else {
42
+ syncHeight();
43
+ }
44
+ };
45
+ iframe.addEventListener("load", onLoad);
46
+ return () => {
47
+ iframe.removeEventListener("load", onLoad);
48
+ clearTimeout(timeoutId);
49
+ };
50
+ }, [syncHeight, srcdoc, syncDelay]);
51
+ useEffect(() => {
52
+ if (height != null) return;
53
+ const id = setTimeout(syncHeight, 150);
54
+ return () => clearTimeout(id);
55
+ }, [activeViewport, syncHeight, height]);
56
+ const containerWidth = VIEWPORTS[activeViewport].width;
57
+ return /* @__PURE__ */ jsxs("div", { class: "border border-muted rounded-lg overflow-hidden my-vsp-md", children: [
58
+ /* @__PURE__ */ jsxs("div", { class: "flex items-center justify-between px-hsp-md py-hsp-sm bg-surface border-b border-muted gap-hsp-sm flex-wrap", children: [
59
+ title && /* @__PURE__ */ jsx("span", { class: "text-caption font-semibold text-fg", children: title }),
60
+ /* @__PURE__ */ jsx("div", { class: "flex gap-hsp-2xs", role: "group", "aria-label": "Viewport size", children: VIEWPORTS.map((vp, i) => /* @__PURE__ */ jsx(
61
+ "button",
62
+ {
63
+ type: "button",
64
+ class: `px-hsp-sm py-hsp-2xs text-caption border rounded-full cursor-pointer transition-[background,color,border-color] duration-150 leading-snug ${i === activeViewport ? "bg-accent text-bg border-accent hover:bg-accent-hover hover:border-accent-hover" : "bg-transparent text-muted border-muted hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)]"}`,
65
+ "aria-pressed": i === activeViewport,
66
+ onClick: () => setActiveViewport(i),
67
+ children: vp.label
68
+ },
69
+ vp.label
70
+ )) })
71
+ ] }),
72
+ /* @__PURE__ */ jsx("div", { class: "bg-surface p-hsp-lg", children: /* @__PURE__ */ jsx(
73
+ "div",
74
+ {
75
+ class: "resize-x overflow-auto max-w-full mx-auto",
76
+ style: { width: containerWidth },
77
+ children: /* @__PURE__ */ jsx(
78
+ "iframe",
79
+ {
80
+ ref: iframeRef,
81
+ class: "block w-full border-none bg-[#fff] rounded shadow-[0_1px_3px_color-mix(in_srgb,var(--color-fg)_8%,transparent)]",
82
+ srcDoc: srcdoc,
83
+ sandbox,
84
+ style: { height: iframeHeight },
85
+ title: title ?? "Preview"
86
+ }
87
+ )
88
+ }
89
+ ) }),
90
+ /* @__PURE__ */ jsxs("div", { class: "border-t border-muted", children: [
91
+ /* @__PURE__ */ jsxs(
92
+ "button",
93
+ {
94
+ type: "button",
95
+ class: "flex items-center w-full px-hsp-md py-hsp-sm text-caption font-medium text-muted bg-surface border-none cursor-pointer gap-hsp-xs hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)]",
96
+ onClick: () => setCodeOpen((v) => !v),
97
+ "aria-expanded": codeOpen,
98
+ children: [
99
+ /* @__PURE__ */ jsx(
100
+ "span",
101
+ {
102
+ class: `text-caption transition-transform duration-200 ${codeOpen ? "rotate-90" : ""}`,
103
+ "aria-hidden": "true",
104
+ children: "\u25B6"
105
+ }
106
+ ),
107
+ codeOpen ? "Hide code" : "Show code"
108
+ ]
109
+ }
110
+ ),
111
+ codeOpen && /* @__PURE__ */ jsx("div", { children: codeBlocks.map((block, idx) => /* @__PURE__ */ jsxs(
112
+ "div",
113
+ {
114
+ class: `overflow-x-auto ${idx > 0 ? "border-t border-muted" : ""}`,
115
+ children: [
116
+ /* @__PURE__ */ jsx("span", { class: "block px-hsp-md py-hsp-xs text-caption font-semibold text-muted bg-surface border-b border-muted uppercase tracking-wider", children: block.title }),
117
+ /* @__PURE__ */ jsx(HighlightedCode, { code: block.code, language: block.language })
118
+ ]
119
+ },
120
+ block.title
121
+ )) })
122
+ ] })
123
+ ] });
124
+ }
125
+ export {
126
+ PreviewBase
127
+ };
@@ -0,0 +1,5 @@
1
+ export { LanguageSwitcher, LanguageSwitcherProps } from './language-switcher.js';
2
+ export { VERSION_SWITCHER_INIT_SCRIPT, VERSION_SWITCHER_VISIBILITY_STYLE, VersionSwitcher, VersionSwitcherProps } from './version-switcher.js';
3
+ export { VersionBanner, VersionBannerLabels, VersionBannerProps } from './version-banner.js';
4
+ export { LocaleLink, VersionEntry, VersionSwitcherLabels } from './types.js';
5
+ import 'preact';
@@ -0,0 +1,14 @@
1
+ import { LanguageSwitcher } from "./language-switcher.js";
2
+ import {
3
+ VersionSwitcher,
4
+ VERSION_SWITCHER_INIT_SCRIPT,
5
+ VERSION_SWITCHER_VISIBILITY_STYLE
6
+ } from "./version-switcher.js";
7
+ import { VersionBanner } from "./version-banner.js";
8
+ export {
9
+ LanguageSwitcher,
10
+ VERSION_SWITCHER_INIT_SCRIPT,
11
+ VERSION_SWITCHER_VISIBILITY_STYLE,
12
+ VersionBanner,
13
+ VersionSwitcher
14
+ };
@@ -0,0 +1,24 @@
1
+ import { VNode } from 'preact';
2
+ import { LocaleLink } from './types.js';
3
+
4
+ /** @jsxRuntime automatic */
5
+ /** @jsxImportSource preact */
6
+
7
+ interface LanguageSwitcherProps {
8
+ /**
9
+ * Pre-built locale links, ordered as they should appear in the bar.
10
+ * The host project typically derives this with its own
11
+ * `buildLocaleLinks(currentPath, currentLang)` helper before passing.
12
+ */
13
+ links: LocaleLink[];
14
+ }
15
+ /**
16
+ * Inline locale switcher rendered in the header / sidebar footer.
17
+ *
18
+ * Returns `null` when there is one locale or fewer (matches the Astro
19
+ * template's `localeLinks.length > 1 &&` guard so call-sites can mount
20
+ * the component unconditionally).
21
+ */
22
+ declare function LanguageSwitcher({ links }: LanguageSwitcherProps): VNode | null;
23
+
24
+ export { LanguageSwitcher, type LanguageSwitcherProps, LocaleLink };
@@ -0,0 +1,25 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ import { Fragment } from "preact";
3
+ function LanguageSwitcher({ links }) {
4
+ if (links.length <= 1) return null;
5
+ return /* @__PURE__ */ jsx("div", { class: "flex items-center gap-x-hsp-xs text-small", children: links.map((link, i) => (
6
+ // Fragment is keyed via the locale code so the reconciler keeps
7
+ // the active/inactive nodes paired correctly across re-renders
8
+ // (e.g. when the active locale flips after navigation).
9
+ /* @__PURE__ */ jsxs(Fragment, { children: [
10
+ i > 0 && /* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" }),
11
+ link.active ? /* @__PURE__ */ jsx("span", { "aria-current": "true", class: "font-medium text-fg", children: link.label }) : /* @__PURE__ */ jsx(
12
+ "a",
13
+ {
14
+ href: link.href,
15
+ lang: link.code,
16
+ class: "text-muted hover:text-fg",
17
+ children: link.label
18
+ }
19
+ )
20
+ ] }, link.code)
21
+ )) });
22
+ }
23
+ export {
24
+ LanguageSwitcher
25
+ };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Single link in the language-switcher's ordered list.
3
+ *
4
+ * Mirrors the shape of `LocaleLink` from src/types/locale.ts so existing
5
+ * call-sites can pass their already-built links straight through.
6
+ */
7
+ interface LocaleLink {
8
+ /** BCP-47 code, e.g. "en", "ja". Rendered as the anchor's `lang` attribute. */
9
+ code: string;
10
+ /** Display label (typically the uppercased code). */
11
+ label: string;
12
+ /** Pre-resolved href for the locale (already prefixed with the configured base). */
13
+ href: string;
14
+ /** True for the currently-active locale — rendered as plain text, not a link. */
15
+ active: boolean;
16
+ }
17
+ /**
18
+ * Single entry in the version-switcher's drop-down list.
19
+ *
20
+ * Slug is the URL-segment identifier; label is the user-visible string
21
+ * (e.g. "v2.0", "1.x").
22
+ */
23
+ interface VersionEntry {
24
+ slug: string;
25
+ label: string;
26
+ }
27
+ /**
28
+ * UI strings the version-switcher renders. Kept as a labels bag rather
29
+ * than wired to a host-side i18n module so the v2 package stays
30
+ * locale-system agnostic.
31
+ */
32
+ interface VersionSwitcherLabels {
33
+ /** Label for the "latest" entry, e.g. "Latest" / "最新". */
34
+ latest: string;
35
+ /** Trigger-button prefix, e.g. "Version" / "バージョン". */
36
+ switcher: string;
37
+ /** `title` attribute for unavailable items, e.g. "Not available". */
38
+ unavailable: string;
39
+ /** Footer link label, e.g. "All versions". */
40
+ allVersions: string;
41
+ }
42
+
43
+ export type { LocaleLink, VersionEntry, VersionSwitcherLabels };
File without changes
@@ -0,0 +1,30 @@
1
+ import { VNode } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ interface VersionBannerLabels {
7
+ /** Banner body text (e.g. "You are viewing documentation for an older version."). */
8
+ message: string;
9
+ /** Link label to the latest version (e.g. "View the latest version"). */
10
+ latestLink: string;
11
+ }
12
+ interface VersionBannerProps {
13
+ /** Variant — drives icon/colour selection downstream and is exposed via `data-variant`. */
14
+ type: "unmaintained" | "unreleased";
15
+ /** Pre-resolved href to the latest version of the current page. */
16
+ latestUrl: string;
17
+ /** UI strings — see `VersionBannerLabels`. */
18
+ labels: VersionBannerLabels;
19
+ }
20
+ /**
21
+ * Banner element rendered above the article body on versioned doc
22
+ * pages. Displays a localized notice and a link to the latest version
23
+ * of the current page.
24
+ *
25
+ * The host typically resolves `labels` via `t("version.banner.*", lang)`
26
+ * and `latestUrl` via the project's URL helpers.
27
+ */
28
+ declare function VersionBanner(props: VersionBannerProps): VNode;
29
+
30
+ export { VersionBanner, type VersionBannerLabels, type VersionBannerProps };
@@ -0,0 +1,21 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ function VersionBanner(props) {
3
+ const { type, latestUrl, labels } = props;
4
+ return /* @__PURE__ */ jsxs(
5
+ "div",
6
+ {
7
+ role: "note",
8
+ "data-version-banner": true,
9
+ "data-variant": type,
10
+ class: "mb-vsp-md border border-warning/30 bg-warning/5 px-hsp-lg py-vsp-sm text-small text-muted rounded",
11
+ children: [
12
+ /* @__PURE__ */ jsx("span", { children: labels.message }),
13
+ " ",
14
+ /* @__PURE__ */ jsx("a", { href: latestUrl, class: "underline text-accent hover:text-accent-hover", children: labels.latestLink })
15
+ ]
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ VersionBanner
21
+ };
@@ -0,0 +1,112 @@
1
+ import { VNode } from 'preact';
2
+ import { VersionEntry, VersionSwitcherLabels } from './types.js';
3
+
4
+ /** @jsxRuntime automatic */
5
+ /** @jsxImportSource preact */
6
+
7
+ interface VersionSwitcherProps {
8
+ /**
9
+ * All known versions, in display order (latest at top of the dropdown
10
+ * is rendered separately via `latestUrl` — this list is the
11
+ * non-latest versions only).
12
+ */
13
+ versions: VersionEntry[];
14
+ /** Current version slug, or undefined when the page is on "latest". */
15
+ currentVersion?: string;
16
+ /** Pre-resolved href for the "Latest" entry. */
17
+ latestUrl: string;
18
+ /** Pre-resolved href for the "All versions" footer link. */
19
+ versionsPageUrl: string;
20
+ /**
21
+ * Map of `version slug` → pre-resolved href to that version of the
22
+ * current page (or the versions index page when no slug is in scope).
23
+ * Pass an empty object when the current page is not a versionable doc.
24
+ */
25
+ versionUrls: Record<string, string>;
26
+ /**
27
+ * Slugs of versions where the current page is NOT available. Renders
28
+ * those entries as muted, non-interactive links with the
29
+ * `unavailable` title attribute. Omit (or pass `undefined`) when no
30
+ * availability data is in scope — every entry is then treated as
31
+ * available, matching the Astro template's `!availability` branch.
32
+ */
33
+ unavailableVersions?: ReadonlySet<string>;
34
+ /** UI strings — see `VersionSwitcherLabels` for the field list. */
35
+ labels: VersionSwitcherLabels;
36
+ /**
37
+ * Optional suffix appended to the menu's DOM id. Used when more than
38
+ * one version-switcher is rendered on the same page (e.g. one in the
39
+ * header, one in the sidebar) so each `aria-controls` reference stays
40
+ * unique.
41
+ */
42
+ idSuffix?: string;
43
+ /**
44
+ * @deprecated No longer wired — the component never emits an inline
45
+ * `<style>`. Visibility CSS lives in the consumer's global stylesheet
46
+ * (see `VERSION_SWITCHER_VISIBILITY_STYLE` for the canonical rule).
47
+ * Retained on the public interface for backwards compatibility; passing
48
+ * any value is a no-op.
49
+ */
50
+ disableInlineVisibilityStyle?: boolean;
51
+ }
52
+ /**
53
+ * Canonical CSS rule that backs the responsive visibility of the
54
+ * version-switcher's host wrapper. **The component itself does NOT
55
+ * emit a `<style>` carrying this rule** — it lives in the consumer's
56
+ * global stylesheet to avoid HTML5's `<style>`-as-flow-content
57
+ * violation (zudolab/zudo-doc#1505). This export remains as a
58
+ * re-usable canonical string so downstream consumers can drop the
59
+ * rule into their own `global.css` verbatim or assert against it.
60
+ *
61
+ * The selector `.hidden:has(> [data-version-switcher])` keys off the
62
+ * host header's `<div class="hidden lg:block">` baseline (the `.hidden`
63
+ * part is always generated by Tailwind because `pages/` directly
64
+ * references it) and only adds the *desktop* override at viewports
65
+ * `>= 64rem`. Below 64rem there is no rule, so visibility falls
66
+ * through to Tailwind's `.hidden` rule — mobile stays hidden the way
67
+ * the host requested.
68
+ *
69
+ * Why scope to `.hidden`: a consumer that wraps `<VersionSwitcher>` in
70
+ * something *without* the `.hidden` baseline (a flex row, a grid cell, an
71
+ * unstyled span) is not asking for "hide on mobile, show on desktop" and
72
+ * shouldn't have this rule rewrite its parent's `display`. Pinning the
73
+ * selector to the `.hidden` precondition keeps the override surgical to
74
+ * the documented usage pattern.
75
+ *
76
+ * The breakpoint (`64rem` = 1024px) intentionally mirrors the project's
77
+ * Tailwind `lg` token. If the design system's `lg` boundary moves, update
78
+ * this value to match.
79
+ *
80
+ * Specificity: `.hidden:has(> [data-version-switcher])` resolves to 0,0,2,0
81
+ * — higher than Tailwind's `.hidden` (0,0,1,0). The unlayered author origin
82
+ * also wins over `@layer utilities` regardless of specificity, so this rule
83
+ * reliably overrides the wrapper's `display: none` at `>= 64rem`.
84
+ */
85
+ declare const VERSION_SWITCHER_VISIBILITY_STYLE = "@media (min-width:64rem){.hidden:has(> [data-version-switcher]){display:block}}";
86
+ /**
87
+ * Drop-down version switcher rendered in the header.
88
+ *
89
+ * The toggle / outside-click / Escape-key behavior lives in
90
+ * `VERSION_SWITCHER_INIT_SCRIPT` — mount it once at body-end on any
91
+ * page that includes a `<VersionSwitcher>`.
92
+ */
93
+ declare function VersionSwitcher(props: VersionSwitcherProps): VNode;
94
+ /**
95
+ * Self-contained init script for the version-switcher's interactive
96
+ * behavior. Mount once per page (e.g. inside the layout's body-end
97
+ * scripts slot) — it idempotently re-binds via an AbortController so
98
+ * multiple switchers on the page share a single event-listener
99
+ * generation.
100
+ *
101
+ * The post-navigation rebinder uses `AFTER_NAVIGATE_EVENT` from
102
+ * `transitions/page-events.ts` (today: `zfb:after-swap`) rather than
103
+ * a hard-coded `astro:*` literal — see that module's header for the
104
+ * full vocabulary rationale.
105
+ *
106
+ * Lifted from the `<script>` block of the original
107
+ * version-switcher.astro; behaviour is unchanged modulo the lifecycle
108
+ * vocabulary swap.
109
+ */
110
+ declare const VERSION_SWITCHER_INIT_SCRIPT: string;
111
+
112
+ export { VERSION_SWITCHER_INIT_SCRIPT, VERSION_SWITCHER_VISIBILITY_STYLE, VersionEntry, VersionSwitcher, VersionSwitcherLabels, type VersionSwitcherProps };