@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,106 @@
1
+ import { AFTER_NAVIGATE_EVENT } from "../transitions/page-events.js";
2
+ const TABS_INIT_SCRIPT = `(function () {
3
+ var BASE_BTN = "px-hsp-lg py-vsp-xs text-small font-medium border-b-[5px] -mb-px transition-colors";
4
+ var ACTIVE_BTN = BASE_BTN + " text-accent border-accent";
5
+ var INACTIVE_BTN = BASE_BTN + " text-muted border-transparent hover:text-fg";
6
+
7
+ function activateTab(container, value) {
8
+ // Update button styles.
9
+ var buttons = container.querySelectorAll("[data-tab-btn]");
10
+ for (var i = 0; i < buttons.length; i++) {
11
+ var btn = buttons[i];
12
+ var isActive = btn.dataset.tabBtn === value;
13
+ btn.className = isActive ? ACTIVE_BTN : INACTIVE_BTN;
14
+ btn.setAttribute("aria-selected", String(isActive));
15
+ }
16
+ // Update panel visibility.
17
+ showPanel(container, value);
18
+ }
19
+
20
+ function showPanel(container, value) {
21
+ var panels = container.querySelectorAll(".tab-panel");
22
+ for (var i = 0; i < panels.length; i++) {
23
+ var panel = panels[i];
24
+ panel.hidden = panel.dataset.tabValue !== value;
25
+ }
26
+ }
27
+
28
+ function syncGroup(groupId, value, source) {
29
+ var others = document.querySelectorAll("[data-tabs][data-group-id=\\"" + CSS.escape(groupId) + "\\"]");
30
+ for (var i = 0; i < others.length; i++) {
31
+ var container = others[i];
32
+ if (container === source) continue;
33
+ var hasPanel = container.querySelector(".tab-panel[data-tab-value=\\"" + CSS.escape(value) + "\\"]");
34
+ if (hasPanel) activateTab(container, value);
35
+ }
36
+ }
37
+
38
+ function initTabs() {
39
+ var containers = document.querySelectorAll("[data-tabs]");
40
+
41
+ for (var ci = 0; ci < containers.length; ci++) {
42
+ var container = containers[ci];
43
+ if (container.dataset.tabsInit) continue;
44
+ container.dataset.tabsInit = "true";
45
+
46
+ var panels = container.querySelectorAll(".tab-panel");
47
+ if (panels.length === 0) continue;
48
+
49
+ var groupId = container.dataset.groupId;
50
+
51
+ // Determine which tab should be active.
52
+ var activeValue = null;
53
+
54
+ if (groupId) {
55
+ var stored = localStorage.getItem("tabs-group-" + groupId);
56
+ if (stored) {
57
+ // Only use stored value if a matching panel exists.
58
+ for (var pi = 0; pi < panels.length; pi++) {
59
+ if (panels[pi].dataset.tabValue === stored) {
60
+ activeValue = stored;
61
+ break;
62
+ }
63
+ }
64
+ }
65
+ }
66
+
67
+ if (!activeValue) {
68
+ var defaultPanel = container.querySelector(".tab-panel[data-tab-default]");
69
+ activeValue = defaultPanel
70
+ ? defaultPanel.dataset.tabValue
71
+ : panels[0].dataset.tabValue;
72
+ }
73
+
74
+ // Activate the correct tab (set button styles + show panel).
75
+ activateTab(container, activeValue);
76
+
77
+ // Wire click handlers on the server-rendered buttons.
78
+ (function (cont, gid) {
79
+ var buttons = cont.querySelectorAll("[data-tab-btn]");
80
+ for (var bi = 0; bi < buttons.length; bi++) {
81
+ (function (btn) {
82
+ btn.addEventListener("click", function () {
83
+ var val = btn.dataset.tabBtn;
84
+ activateTab(cont, val);
85
+ if (gid) {
86
+ localStorage.setItem("tabs-group-" + gid, val);
87
+ syncGroup(gid, val, cont);
88
+ }
89
+ });
90
+ })(buttons[bi]);
91
+ }
92
+ })(container, groupId);
93
+ }
94
+ }
95
+
96
+ // Run on initial load.
97
+ initTabs();
98
+
99
+ // Re-run after every page-navigate-end signal so View Transitions
100
+ // navigations (which under the zfb runtime are real page loads) see
101
+ // the tabs initialised on the new page.
102
+ document.addEventListener(${JSON.stringify(AFTER_NAVIGATE_EVENT)}, initTabs);
103
+ })();`;
104
+ export {
105
+ TABS_INIT_SCRIPT
106
+ };
@@ -0,0 +1,24 @@
1
+ import { JSX } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ /**
7
+ * Drop-in JSX replacement for `src/components/tabs-init.astro`.
8
+ *
9
+ * Include **once** in the layout (e.g. in the `<body>` foot). Emits the
10
+ * tabs interactivity script via `dangerouslySetInnerHTML`.
11
+ *
12
+ * The script:
13
+ * - Activates the correct panel on first paint (localStorage → default → first).
14
+ * - Wires click handlers to the pre-rendered `[data-tab-btn]` buttons from
15
+ * the `<Tabs>` component.
16
+ * - Syncs tab state across containers that share a `data-group-id`.
17
+ * - Re-runs on `AFTER_NAVIGATE_EVENT` (from `../transitions/page-events.ts`)
18
+ * to support View Transitions.
19
+ *
20
+ * Requires `<Tabs>` to have server-rendered the tab buttons in the DOM.
21
+ */
22
+ declare function TabsInit(): JSX.Element;
23
+
24
+ export { TabsInit, TabsInit as default };
@@ -0,0 +1,10 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import { TABS_INIT_SCRIPT } from "./tabs-init-script.js";
3
+ function TabsInit() {
4
+ return /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: TABS_INIT_SCRIPT } });
5
+ }
6
+ var tabs_init_default = TabsInit;
7
+ export {
8
+ TabsInit,
9
+ tabs_init_default as default
10
+ };
@@ -0,0 +1,36 @@
1
+ import { ComponentChildren, JSX } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ interface TabsProps {
7
+ /**
8
+ * When set, clicking a tab in this group persists the chosen value to
9
+ * `localStorage` under `tabs-group-{groupId}` and syncs all other
10
+ * containers that share the same `groupId`.
11
+ */
12
+ groupId?: string;
13
+ /** `<TabItem>` children (and any other content). */
14
+ children?: ComponentChildren;
15
+ }
16
+ /**
17
+ * Server-rendered tab container — JSX port of `src/components/tabs.astro`.
18
+ *
19
+ * Iterates `children` via `toChildArray` to discover `<TabItem>` elements
20
+ * and renders their labels as `<button>` elements in the tab nav bar.
21
+ * All panels remain `hidden` on first paint; `<TabsInit>` (the companion
22
+ * script component) activates the default/stored tab after hydration.
23
+ *
24
+ * Place `<TabsInit>` once in the layout — NOT inside each `<Tabs>`.
25
+ *
26
+ * @example
27
+ * ```tsx
28
+ * <Tabs>
29
+ * <TabItem label="npm"><code>npm install …</code></TabItem>
30
+ * <TabItem label="pnpm" default><code>pnpm add …</code></TabItem>
31
+ * </Tabs>
32
+ * ```
33
+ */
34
+ declare function Tabs({ groupId, children }: TabsProps): JSX.Element;
35
+
36
+ export { Tabs, type TabsProps, Tabs as default };
@@ -0,0 +1,62 @@
1
+ import { jsx, jsxs } from "preact/jsx-runtime";
2
+ import { cloneElement, toChildArray } from "preact";
3
+ import { TabItem } from "../tab-item/tab-item.js";
4
+ const BASE_BTN_CLASS = "px-hsp-lg py-vsp-xs text-small font-medium border-b-[5px] -mb-px transition-colors";
5
+ const ACTIVE_BTN_CLASS = `${BASE_BTN_CLASS} text-accent border-accent`;
6
+ const INACTIVE_BTN_CLASS = `${BASE_BTN_CLASS} text-muted border-transparent hover:text-fg`;
7
+ function Tabs({ groupId, children }) {
8
+ const childArray = toChildArray(children);
9
+ const tabItemNodes = childArray.filter(
10
+ (child) => typeof child === "object" && child !== null && child.type === TabItem
11
+ );
12
+ const tabItems = tabItemNodes.map((n) => ({
13
+ ...n,
14
+ props: n.props
15
+ }));
16
+ const explicitDefault = tabItems.find((item) => item.props.default === true);
17
+ const fallbackDefault = tabItems[0];
18
+ const defaultItem = explicitDefault ?? fallbackDefault;
19
+ const defaultValue = defaultItem ? defaultItem.props.value ?? defaultItem.props.label : void 0;
20
+ const renderedChildren = childArray.map((child) => {
21
+ if (typeof child === "object" && child !== null && child.type === TabItem) {
22
+ const node = child;
23
+ const props = node.props;
24
+ const value = props.value ?? props.label;
25
+ const isDefault = value === defaultValue;
26
+ return cloneElement(node, { default: isDefault });
27
+ }
28
+ return child;
29
+ });
30
+ return /* @__PURE__ */ jsxs(
31
+ "div",
32
+ {
33
+ class: "tabs-container my-vsp-md",
34
+ "data-tabs": true,
35
+ "data-group-id": groupId,
36
+ children: [
37
+ /* @__PURE__ */ jsx("div", { class: "tabs-nav flex border-b border-muted", role: "tablist", children: tabItems.map((item) => {
38
+ const value = item.props.value ?? item.props.label;
39
+ const isActive = value === defaultValue;
40
+ return /* @__PURE__ */ jsx(
41
+ "button",
42
+ {
43
+ type: "button",
44
+ role: "tab",
45
+ class: isActive ? ACTIVE_BTN_CLASS : INACTIVE_BTN_CLASS,
46
+ "data-tab-btn": value,
47
+ "aria-selected": isActive ? "true" : "false",
48
+ children: item.props.label
49
+ },
50
+ value
51
+ );
52
+ }) }),
53
+ /* @__PURE__ */ jsx("div", { class: "tabs-content", children: renderedChildren })
54
+ ]
55
+ }
56
+ );
57
+ }
58
+ var tabs_default = Tabs;
59
+ export {
60
+ Tabs,
61
+ tabs_default as default
62
+ };
@@ -0,0 +1,51 @@
1
+ import { HeadingH2 } from './heading-h2.js';
2
+ import { HeadingH3 } from './heading-h3.js';
3
+ import { HeadingH4 } from './heading-h4.js';
4
+ import { ContentParagraph } from './content-paragraph.js';
5
+ import { ContentLink } from './content-link.js';
6
+ import { ContentStrong } from './content-strong.js';
7
+ import { ContentBlockquote } from './content-blockquote.js';
8
+ import { ContentUl } from './content-ul.js';
9
+ import { ContentOl } from './content-ol.js';
10
+ import { ContentTable } from './content-table.js';
11
+ import { ContentCode } from './content-code.js';
12
+ import 'preact';
13
+
14
+ /**
15
+ * MDX component overrides map for the HTML elements used in doc content.
16
+ *
17
+ * Pass this to `<Content components={defaultComponents} />` (or spread it
18
+ * into a larger components object that also includes admonition overrides,
19
+ * custom shortcodes, etc.) at the Astro page layer.
20
+ */
21
+ declare const htmlOverrides: {
22
+ h2: typeof HeadingH2;
23
+ h3: typeof HeadingH3;
24
+ h4: typeof HeadingH4;
25
+ p: typeof ContentParagraph;
26
+ a: typeof ContentLink;
27
+ strong: typeof ContentStrong;
28
+ blockquote: typeof ContentBlockquote;
29
+ ul: typeof ContentUl;
30
+ ol: typeof ContentOl;
31
+ table: typeof ContentTable;
32
+ code: typeof ContentCode;
33
+ };
34
+ /**
35
+ * Alias for `htmlOverrides`. Prefer this name in new consumer code.
36
+ */
37
+ declare const defaultComponents: {
38
+ h2: typeof HeadingH2;
39
+ h3: typeof HeadingH3;
40
+ h4: typeof HeadingH4;
41
+ p: typeof ContentParagraph;
42
+ a: typeof ContentLink;
43
+ strong: typeof ContentStrong;
44
+ blockquote: typeof ContentBlockquote;
45
+ ul: typeof ContentUl;
46
+ ol: typeof ContentOl;
47
+ table: typeof ContentTable;
48
+ code: typeof ContentCode;
49
+ };
50
+
51
+ export { defaultComponents, htmlOverrides };
@@ -0,0 +1,29 @@
1
+ import { HeadingH2 } from "./heading-h2.js";
2
+ import { HeadingH3 } from "./heading-h3.js";
3
+ import { HeadingH4 } from "./heading-h4.js";
4
+ import { ContentParagraph } from "./content-paragraph.js";
5
+ import { ContentLink } from "./content-link.js";
6
+ import { ContentStrong } from "./content-strong.js";
7
+ import { ContentBlockquote } from "./content-blockquote.js";
8
+ import { ContentUl } from "./content-ul.js";
9
+ import { ContentOl } from "./content-ol.js";
10
+ import { ContentTable } from "./content-table.js";
11
+ import { ContentCode } from "./content-code.js";
12
+ const htmlOverrides = {
13
+ h2: HeadingH2,
14
+ h3: HeadingH3,
15
+ h4: HeadingH4,
16
+ p: ContentParagraph,
17
+ a: ContentLink,
18
+ strong: ContentStrong,
19
+ blockquote: ContentBlockquote,
20
+ ul: ContentUl,
21
+ ol: ContentOl,
22
+ table: ContentTable,
23
+ code: ContentCode
24
+ };
25
+ const defaultComponents = htmlOverrides;
26
+ export {
27
+ defaultComponents,
28
+ htmlOverrides
29
+ };
@@ -0,0 +1,11 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ declare function ContentBlockquote({ children, className, ...rest }: Props): preact.JSX.Element;
10
+
11
+ export { ContentBlockquote };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentBlockquote({ children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "blockquote",
5
+ {
6
+ className: `border-l-[3px] border-muted pl-hsp-lg text-muted italic${className ? ` ${className}` : ""}`,
7
+ ...rest,
8
+ children
9
+ }
10
+ );
11
+ }
12
+ export {
13
+ ContentBlockquote
14
+ };
@@ -0,0 +1,26 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ /**
10
+ * Override for inline `<code>` in MDX. Wraps text-only inline code with
11
+ * <SmartBreak> so that path/URL-like strings (e.g. `src/foo/bar.ts`) can
12
+ * break at delimiters on narrow viewports.
13
+ *
14
+ * Block code inside a fenced block is processed by Shiki, which emits a
15
+ * <code> element with class "language-*" containing a tree of <span>
16
+ * nodes (not a plain string). We detect those and render untouched so
17
+ * syntax highlighting is never disturbed.
18
+ *
19
+ * Astro 6 passes pure-text MDX children wrapped in a `StaticHtml` Preact
20
+ * component whose text lives in `props.value`, not as a string child.
21
+ * `extractText` unwraps that so the heuristic works regardless of MDX's
22
+ * internal wrapping.
23
+ */
24
+ declare function ContentCode({ children, className, ...rest }: Props): preact.JSX.Element;
25
+
26
+ export { ContentCode };
@@ -0,0 +1,39 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import { SmartBreak as SmartBreakImpl } from "../toc/smart-break.js";
3
+ const SmartBreak = SmartBreakImpl;
4
+ function ContentCode({ children, className, ...rest }) {
5
+ const isShikiBlock = typeof className === "string" && /(^|\s)language-/.test(className);
6
+ const textFromChildren = isShikiBlock ? null : extractText(children);
7
+ if (textFromChildren === null) {
8
+ return /* @__PURE__ */ jsx("code", { className, ...rest, children });
9
+ }
10
+ return /* @__PURE__ */ jsx("code", { className, ...rest, children: /* @__PURE__ */ jsx(SmartBreak, { children: textFromChildren }) });
11
+ }
12
+ function extractText(children) {
13
+ if (typeof children === "string") return children;
14
+ if (typeof children === "number") return String(children);
15
+ if (children && typeof children === "object" && !Array.isArray(children)) {
16
+ const v = children;
17
+ if (v.props && v.props.value != null) {
18
+ if (typeof v.props.value === "string" || v.props.value instanceof String || typeof v.props.value === "object" && typeof v.props.value.toString === "function") {
19
+ const s = String(v.props.value);
20
+ if (!s || s.startsWith("[object")) return null;
21
+ if (looksLikeHtmlMarkup(s)) return null;
22
+ return decodeEntities(s);
23
+ }
24
+ }
25
+ }
26
+ return null;
27
+ }
28
+ function looksLikeHtmlMarkup(s) {
29
+ return /&lt;(span|code|pre|div|br|i|b|em|strong)\b/i.test(s) || /<(span|code|pre)\s/i.test(s);
30
+ }
31
+ function decodeEntities(s) {
32
+ return s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/gi, "'").replace(/&nbsp;/g, " ").replace(/&#(\d+);/g, (_, n) => String.fromCodePoint(Number(n))).replace(
33
+ /&#x([0-9a-f]+);/gi,
34
+ (_, n) => String.fromCodePoint(parseInt(n, 16))
35
+ ).replace(/&amp;/g, "&");
36
+ }
37
+ export {
38
+ ContentCode
39
+ };
@@ -0,0 +1,12 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ href?: string;
6
+ className?: string;
7
+ children?: ComponentChildren;
8
+ [key: string]: any;
9
+ };
10
+ declare function ContentLink({ href, className, children, ...rest }: Props): preact.JSX.Element;
11
+
12
+ export { ContentLink };
@@ -0,0 +1,43 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ import { SmartBreak as SmartBreakBase } from "../toc/smart-break.js";
3
+ const SmartBreak = SmartBreakBase;
4
+ function ContentLink({ href, className, children, ...rest }) {
5
+ const classes = className ? className.split(" ") : [];
6
+ if (classes.includes("block") || classes.includes("hash-link")) {
7
+ return /* @__PURE__ */ jsx("a", { href, className, ...rest, children });
8
+ }
9
+ const textFromChildren = extractText(children);
10
+ const content = textFromChildren !== null ? /* @__PURE__ */ jsx(SmartBreak, { children: textFromChildren }) : children;
11
+ return /* @__PURE__ */ jsx(
12
+ "a",
13
+ {
14
+ href,
15
+ className: `text-accent underline hover:text-accent-hover${className ? ` ${className}` : ""}`,
16
+ ...rest,
17
+ children: content
18
+ }
19
+ );
20
+ }
21
+ function extractText(children) {
22
+ if (typeof children === "string") return children;
23
+ if (typeof children === "number") return String(children);
24
+ if (children && typeof children === "object" && !Array.isArray(children)) {
25
+ const v = children;
26
+ if (v.props && v.props.value != null) {
27
+ if (typeof v.props.value === "string" || v.props.value instanceof String || typeof v.props.value === "object" && typeof v.props.value.toString === "function") {
28
+ const s = String(v.props.value);
29
+ if (s && !s.startsWith("[object")) return decodeEntities(s);
30
+ }
31
+ }
32
+ }
33
+ return null;
34
+ }
35
+ function decodeEntities(s) {
36
+ return s.replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&#x27;/gi, "'").replace(/&nbsp;/g, " ").replace(/&#(\d+);/g, (_, n) => String.fromCodePoint(Number(n))).replace(
37
+ /&#x([0-9a-f]+);/gi,
38
+ (_, n) => String.fromCodePoint(parseInt(n, 16))
39
+ ).replace(/&amp;/g, "&");
40
+ }
41
+ export {
42
+ ContentLink
43
+ };
@@ -0,0 +1,11 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ declare function ContentOl({ children, className, ...rest }: Props): preact.JSX.Element;
10
+
11
+ export { ContentOl };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentOl({ children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "ol",
5
+ {
6
+ ...rest,
7
+ className: className || void 0,
8
+ style: { paddingLeft: "2em", listStyleType: "decimal" },
9
+ children
10
+ }
11
+ );
12
+ }
13
+ export {
14
+ ContentOl
15
+ };
@@ -0,0 +1,10 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ [key: string]: any;
7
+ };
8
+ declare function ContentParagraph({ children, ...rest }: Props): preact.JSX.Element;
9
+
10
+ export { ContentParagraph };
@@ -0,0 +1,7 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentParagraph({ children, ...rest }) {
3
+ return /* @__PURE__ */ jsx("p", { ...rest, children });
4
+ }
5
+ export {
6
+ ContentParagraph
7
+ };
@@ -0,0 +1,11 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ declare function ContentStrong({ children, className, ...rest }: Props): preact.JSX.Element;
10
+
11
+ export { ContentStrong };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentStrong({ children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "strong",
5
+ {
6
+ className: `font-bold text-fg${className ? ` ${className}` : ""}`,
7
+ ...rest,
8
+ children
9
+ }
10
+ );
11
+ }
12
+ export {
13
+ ContentStrong
14
+ };
@@ -0,0 +1,11 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ declare function ContentTable({ children, className, ...rest }: Props): preact.JSX.Element;
10
+
11
+ export { ContentTable };
@@ -0,0 +1,14 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentTable({ children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsx(
4
+ "table",
5
+ {
6
+ className: `w-full border-collapse text-small${className ? ` ${className}` : ""}`,
7
+ ...rest,
8
+ children
9
+ }
10
+ ) });
11
+ }
12
+ export {
13
+ ContentTable
14
+ };
@@ -0,0 +1,11 @@
1
+ import * as preact from 'preact';
2
+ import { ComponentChildren } from 'preact';
3
+
4
+ type Props = {
5
+ children?: ComponentChildren;
6
+ className?: string;
7
+ [key: string]: any;
8
+ };
9
+ declare function ContentUl({ children, className, ...rest }: Props): preact.JSX.Element;
10
+
11
+ export { ContentUl };
@@ -0,0 +1,15 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function ContentUl({ children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "ul",
5
+ {
6
+ ...rest,
7
+ className: className || void 0,
8
+ style: { paddingLeft: "2em", listStyleType: "disc" },
9
+ children
10
+ }
11
+ );
12
+ }
13
+ export {
14
+ ContentUl
15
+ };
@@ -0,0 +1,14 @@
1
+ import { ComponentChildren, JSX } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ type Props = {
7
+ id?: string;
8
+ className?: string;
9
+ children?: ComponentChildren;
10
+ [key: string]: any;
11
+ };
12
+ declare function HeadingH2({ id, children, className, ...rest }: Props): JSX.Element;
13
+
14
+ export { HeadingH2 };
@@ -0,0 +1,18 @@
1
+ import { jsx } from "preact/jsx-runtime";
2
+ function HeadingH2({ id, children, className, ...rest }) {
3
+ return /* @__PURE__ */ jsx(
4
+ "h2",
5
+ {
6
+ id,
7
+ className: `text-title font-bold leading-tight pt-vsp-sm border-t-[3px] border-transparent${className ? ` ${className}` : ""}`,
8
+ style: {
9
+ borderImage: "linear-gradient(to right, var(--color-fg), transparent) 1"
10
+ },
11
+ ...rest,
12
+ children
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ HeadingH2
18
+ };
@@ -0,0 +1,14 @@
1
+ import { ComponentChildren, JSX } from 'preact';
2
+
3
+ /** @jsxRuntime automatic */
4
+ /** @jsxImportSource preact */
5
+
6
+ type Props = {
7
+ id?: string;
8
+ className?: string;
9
+ children?: ComponentChildren;
10
+ [key: string]: any;
11
+ };
12
+ declare function HeadingH3({ id, children, className, ...rest }: Props): JSX.Element;
13
+
14
+ export { HeadingH3 };