@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.
- package/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/body-foot-util/body-foot-util-area.d.ts +55 -0
- package/dist/body-foot-util/body-foot-util-area.js +71 -0
- package/dist/body-foot-util/edit-link.d.ts +45 -0
- package/dist/body-foot-util/edit-link.js +42 -0
- package/dist/body-foot-util/index.d.ts +3 -0
- package/dist/body-foot-util/index.js +11 -0
- package/dist/breadcrumb/breadcrumb.d.ts +57 -0
- package/dist/breadcrumb/breadcrumb.js +113 -0
- package/dist/breadcrumb/find-path.d.ts +16 -0
- package/dist/breadcrumb/find-path.js +13 -0
- package/dist/breadcrumb/index.d.ts +4 -0
- package/dist/breadcrumb/index.js +7 -0
- package/dist/breadcrumb/types.d.ts +32 -0
- package/dist/breadcrumb/types.js +0 -0
- package/dist/code-syntax/code-block-enhancer-script.d.ts +3 -0
- package/dist/code-syntax/code-block-enhancer-script.js +165 -0
- package/dist/code-syntax/code-block-enhancer.d.ts +22 -0
- package/dist/code-syntax/code-block-enhancer.js +13 -0
- package/dist/code-syntax/index.d.ts +8 -0
- package/dist/code-syntax/index.js +29 -0
- package/dist/code-syntax/mermaid-init-script.d.ts +51 -0
- package/dist/code-syntax/mermaid-init-script.js +225 -0
- package/dist/code-syntax/mermaid-init.d.ts +48 -0
- package/dist/code-syntax/mermaid-init.js +14 -0
- package/dist/code-syntax/tabs-init-script.d.ts +3 -0
- package/dist/code-syntax/tabs-init-script.js +106 -0
- package/dist/code-syntax/tabs-init.d.ts +24 -0
- package/dist/code-syntax/tabs-init.js +10 -0
- package/dist/code-syntax/tabs.d.ts +36 -0
- package/dist/code-syntax/tabs.js +62 -0
- package/dist/content/component-map.d.ts +51 -0
- package/dist/content/component-map.js +29 -0
- package/dist/content/content-blockquote.d.ts +11 -0
- package/dist/content/content-blockquote.js +14 -0
- package/dist/content/content-code.d.ts +26 -0
- package/dist/content/content-code.js +39 -0
- package/dist/content/content-link.d.ts +12 -0
- package/dist/content/content-link.js +43 -0
- package/dist/content/content-ol.d.ts +11 -0
- package/dist/content/content-ol.js +15 -0
- package/dist/content/content-paragraph.d.ts +10 -0
- package/dist/content/content-paragraph.js +7 -0
- package/dist/content/content-strong.d.ts +11 -0
- package/dist/content/content-strong.js +14 -0
- package/dist/content/content-table.d.ts +11 -0
- package/dist/content/content-table.js +14 -0
- package/dist/content/content-ul.d.ts +11 -0
- package/dist/content/content-ul.js +15 -0
- package/dist/content/heading-h2.d.ts +14 -0
- package/dist/content/heading-h2.js +18 -0
- package/dist/content/heading-h3.d.ts +14 -0
- package/dist/content/heading-h3.js +18 -0
- package/dist/content/heading-h4.d.ts +14 -0
- package/dist/content/heading-h4.js +18 -0
- package/dist/content/index.d.ts +13 -0
- package/dist/content/index.js +27 -0
- package/dist/details/details.d.ts +26 -0
- package/dist/details/details.js +10 -0
- package/dist/details/index.d.ts +2 -0
- package/dist/details/index.js +4 -0
- package/dist/doclayout/anchors.d.ts +55 -0
- package/dist/doclayout/anchors.js +42 -0
- package/dist/doclayout/doc-layout-with-defaults.d.ts +83 -0
- package/dist/doclayout/doc-layout-with-defaults.js +159 -0
- package/dist/doclayout/doc-layout.d.ts +121 -0
- package/dist/doclayout/doc-layout.js +89 -0
- package/dist/doclayout/index.d.ts +6 -0
- package/dist/doclayout/index.js +17 -0
- package/dist/footer/footer.d.ts +42 -0
- package/dist/footer/footer.js +79 -0
- package/dist/footer/index.d.ts +3 -0
- package/dist/footer/index.js +4 -0
- package/dist/footer/types.d.ts +58 -0
- package/dist/footer/types.js +0 -0
- package/dist/head/doc-head.d.ts +33 -0
- package/dist/head/doc-head.js +90 -0
- package/dist/head/index.d.ts +5 -0
- package/dist/head/index.js +8 -0
- package/dist/head/og-tags.d.ts +25 -0
- package/dist/head/og-tags.js +16 -0
- package/dist/head/twitter-card.d.ts +21 -0
- package/dist/head/twitter-card.js +14 -0
- package/dist/head/types.d.ts +83 -0
- package/dist/head/types.js +0 -0
- package/dist/header/header.d.ts +158 -0
- package/dist/header/header.js +367 -0
- package/dist/header/index.d.ts +6 -0
- package/dist/header/index.js +18 -0
- package/dist/header/nav-active.d.ts +39 -0
- package/dist/header/nav-active.js +24 -0
- package/dist/header/nav-overflow-script.d.ts +3 -0
- package/dist/header/nav-overflow-script.js +169 -0
- package/dist/header/right-items.d.ts +38 -0
- package/dist/header/right-items.js +30 -0
- package/dist/header/types.d.ts +40 -0
- package/dist/header/types.js +0 -0
- package/dist/html-preview-wrapper/dedent.d.ts +10 -0
- package/dist/html-preview-wrapper/dedent.js +16 -0
- package/dist/html-preview-wrapper/highlighted-code.d.ts +18 -0
- package/dist/html-preview-wrapper/highlighted-code.js +53 -0
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +60 -0
- package/dist/html-preview-wrapper/html-preview-wrapper.js +36 -0
- package/dist/html-preview-wrapper/html-preview.d.ts +35 -0
- package/dist/html-preview-wrapper/html-preview.js +75 -0
- package/dist/html-preview-wrapper/index.d.ts +5 -0
- package/dist/html-preview-wrapper/index.js +12 -0
- package/dist/html-preview-wrapper/preflight.d.ts +13 -0
- package/dist/html-preview-wrapper/preflight.js +108 -0
- package/dist/html-preview-wrapper/preview-base.d.ts +29 -0
- package/dist/html-preview-wrapper/preview-base.js +127 -0
- package/dist/i18n-version/index.d.ts +5 -0
- package/dist/i18n-version/index.js +14 -0
- package/dist/i18n-version/language-switcher.d.ts +24 -0
- package/dist/i18n-version/language-switcher.js +25 -0
- package/dist/i18n-version/types.d.ts +43 -0
- package/dist/i18n-version/types.js +0 -0
- package/dist/i18n-version/version-banner.d.ts +30 -0
- package/dist/i18n-version/version-banner.js +21 -0
- package/dist/i18n-version/version-switcher.d.ts +112 -0
- package/dist/i18n-version/version-switcher.js +157 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +0 -0
- package/dist/integrations/claude-resources/escape-for-mdx.d.ts +8 -0
- package/dist/integrations/claude-resources/escape-for-mdx.js +131 -0
- package/dist/integrations/claude-resources/generate.d.ts +13 -0
- package/dist/integrations/claude-resources/generate.js +404 -0
- package/dist/integrations/claude-resources/index.d.ts +46 -0
- package/dist/integrations/claude-resources/index.js +24 -0
- package/dist/integrations/doc-history/index.d.ts +137 -0
- package/dist/integrations/doc-history/index.js +138 -0
- package/dist/integrations/doc-history/pre-build.d.ts +58 -0
- package/dist/integrations/doc-history/pre-build.js +67 -0
- package/dist/integrations/llms-txt/dev-middleware.d.ts +40 -0
- package/dist/integrations/llms-txt/dev-middleware.js +76 -0
- package/dist/integrations/llms-txt/emit.d.ts +22 -0
- package/dist/integrations/llms-txt/emit.js +55 -0
- package/dist/integrations/llms-txt/generate.d.ts +26 -0
- package/dist/integrations/llms-txt/generate.js +36 -0
- package/dist/integrations/llms-txt/index.d.ts +7 -0
- package/dist/integrations/llms-txt/index.js +27 -0
- package/dist/integrations/llms-txt/load.d.ts +51 -0
- package/dist/integrations/llms-txt/load.js +83 -0
- package/dist/integrations/llms-txt/strip.d.ts +22 -0
- package/dist/integrations/llms-txt/strip.js +10 -0
- package/dist/integrations/llms-txt/types.d.ts +145 -0
- package/dist/integrations/llms-txt/types.js +0 -0
- package/dist/integrations/search-index/build-emitter.d.ts +30 -0
- package/dist/integrations/search-index/build-emitter.js +15 -0
- package/dist/integrations/search-index/collect.d.ts +12 -0
- package/dist/integrations/search-index/collect.js +48 -0
- package/dist/integrations/search-index/content-files.d.ts +32 -0
- package/dist/integrations/search-index/content-files.js +50 -0
- package/dist/integrations/search-index/dev-middleware.d.ts +16 -0
- package/dist/integrations/search-index/dev-middleware.js +30 -0
- package/dist/integrations/search-index/index.d.ts +5 -0
- package/dist/integrations/search-index/index.js +14 -0
- package/dist/integrations/search-index/types.d.ts +38 -0
- package/dist/integrations/search-index/types.js +6 -0
- package/dist/metainfo/doc-metainfo.d.ts +50 -0
- package/dist/metainfo/doc-metainfo.js +107 -0
- package/dist/metainfo/doc-tags.d.ts +66 -0
- package/dist/metainfo/doc-tags.js +53 -0
- package/dist/metainfo/frontmatter-preview.d.ts +95 -0
- package/dist/metainfo/frontmatter-preview.js +55 -0
- package/dist/metainfo/index.d.ts +4 -0
- package/dist/metainfo/index.js +28 -0
- package/dist/nav-indexing/category-nav.d.ts +28 -0
- package/dist/nav-indexing/category-nav.js +41 -0
- package/dist/nav-indexing/category-tree-nav.d.ts +27 -0
- package/dist/nav-indexing/category-tree-nav.js +49 -0
- package/dist/nav-indexing/doc-card-grid.d.ts +38 -0
- package/dist/nav-indexing/doc-card-grid.js +40 -0
- package/dist/nav-indexing/docs-sitemap.d.ts +25 -0
- package/dist/nav-indexing/docs-sitemap.js +40 -0
- package/dist/nav-indexing/index.d.ts +10 -0
- package/dist/nav-indexing/index.js +18 -0
- package/dist/nav-indexing/nav-card-grid.d.ts +31 -0
- package/dist/nav-indexing/nav-card-grid.js +43 -0
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +39 -0
- package/dist/nav-indexing/site-tree-nav-demo.js +65 -0
- package/dist/nav-indexing/tag-nav.d.ts +38 -0
- package/dist/nav-indexing/tag-nav.js +96 -0
- package/dist/nav-indexing/types.d.ts +95 -0
- package/dist/nav-indexing/types.js +0 -0
- package/dist/nav-indexing/versions-page-content.d.ts +29 -0
- package/dist/nav-indexing/versions-page-content.js +76 -0
- package/dist/page-loading/index.d.ts +2 -0
- package/dist/page-loading/index.js +10 -0
- package/dist/page-loading/page-loading-overlay.d.ts +35 -0
- package/dist/page-loading/page-loading-overlay.js +50 -0
- package/dist/sidebar/index.d.ts +3 -0
- package/dist/sidebar/index.js +4 -0
- package/dist/sidebar/sidebar.d.ts +54 -0
- package/dist/sidebar/sidebar.js +35 -0
- package/dist/sidebar/types.d.ts +71 -0
- package/dist/sidebar/types.js +0 -0
- package/dist/sidebar-resizer/index.d.ts +14 -0
- package/dist/sidebar-resizer/index.js +165 -0
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +20 -0
- package/dist/sidebar-resizer/sidebar-resizer-init.js +119 -0
- package/dist/sidebar-tree/build-tree.d.ts +43 -0
- package/dist/sidebar-tree/build-tree.js +127 -0
- package/dist/sidebar-tree/category-meta.d.ts +19 -0
- package/dist/sidebar-tree/category-meta.js +63 -0
- package/dist/sidebar-tree/index.d.ts +3 -0
- package/dist/sidebar-tree/index.js +13 -0
- package/dist/sidebar-tree/types.d.ts +120 -0
- package/dist/sidebar-tree/types.js +0 -0
- package/dist/tab-item/index.d.ts +2 -0
- package/dist/tab-item/index.js +5 -0
- package/dist/tab-item/tab-item.d.ts +38 -0
- package/dist/tab-item/tab-item.js +25 -0
- package/dist/theme/color-scheme-provider.d.ts +32 -0
- package/dist/theme/color-scheme-provider.js +43 -0
- package/dist/theme/color-tweak-export-modal.d.ts +20 -0
- package/dist/theme/color-tweak-export-modal.js +138 -0
- package/dist/theme/design-token-serde.d.ts +136 -0
- package/dist/theme/design-token-serde.js +254 -0
- package/dist/theme/design-token-tweak-panel.d.ts +11 -0
- package/dist/theme/design-token-tweak-panel.js +10 -0
- package/dist/theme/design-token-types.d.ts +19 -0
- package/dist/theme/design-token-types.js +6 -0
- package/dist/theme/iframe-bridge.d.ts +44 -0
- package/dist/theme/iframe-bridge.js +70 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.js +42 -0
- package/dist/theme/theme-toggle.d.ts +17 -0
- package/dist/theme/theme-toggle.js +91 -0
- package/dist/toc/cx.d.ts +16 -0
- package/dist/toc/cx.js +22 -0
- package/dist/toc/index.d.ts +5 -0
- package/dist/toc/index.js +9 -0
- package/dist/toc/mobile-toc.d.ts +46 -0
- package/dist/toc/mobile-toc.js +88 -0
- package/dist/toc/smart-break.d.ts +27 -0
- package/dist/toc/smart-break.js +36 -0
- package/dist/toc/toc-title.d.ts +10 -0
- package/dist/toc/toc-title.js +14 -0
- package/dist/toc/toc.d.ts +60 -0
- package/dist/toc/toc.js +56 -0
- package/dist/toc/types.d.ts +23 -0
- package/dist/toc/types.js +0 -0
- package/dist/toc/use-active-heading.d.ts +30 -0
- package/dist/toc/use-active-heading.js +106 -0
- package/dist/transitions/index.d.ts +1 -0
- package/dist/transitions/index.js +12 -0
- package/dist/transitions/page-events.d.ts +41 -0
- package/dist/transitions/page-events.js +20 -0
- package/dist/url-normalizer/index.d.ts +1 -0
- package/dist/url-normalizer/index.js +6 -0
- package/dist/url-normalizer/normalize.d.ts +104 -0
- package/dist/url-normalizer/normalize.js +22 -0
- package/package.json +186 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
const DEFAULT_CREATED_LABEL = "Created";
|
|
3
|
+
const DEFAULT_UPDATED_LABEL = "Updated";
|
|
4
|
+
function ClockIcon() {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"svg",
|
|
7
|
+
{
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
class: "h-icon-xs w-icon-xs",
|
|
10
|
+
fill: "none",
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
"stroke-width": "2",
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: /* @__PURE__ */ jsx(
|
|
16
|
+
"path",
|
|
17
|
+
{
|
|
18
|
+
"stroke-linecap": "round",
|
|
19
|
+
"stroke-linejoin": "round",
|
|
20
|
+
d: "M12 6v6l4 2m6-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
21
|
+
}
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
function RefreshIcon() {
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"svg",
|
|
29
|
+
{
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
class: "h-icon-xs w-icon-xs",
|
|
32
|
+
fill: "none",
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
"stroke-width": "2",
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
children: /* @__PURE__ */ jsx(
|
|
38
|
+
"path",
|
|
39
|
+
{
|
|
40
|
+
"stroke-linecap": "round",
|
|
41
|
+
"stroke-linejoin": "round",
|
|
42
|
+
d: "M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function UserIcon() {
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
"svg",
|
|
51
|
+
{
|
|
52
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
53
|
+
class: "h-icon-xs w-icon-xs",
|
|
54
|
+
fill: "none",
|
|
55
|
+
viewBox: "0 0 24 24",
|
|
56
|
+
stroke: "currentColor",
|
|
57
|
+
"stroke-width": "2",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: /* @__PURE__ */ jsx(
|
|
60
|
+
"path",
|
|
61
|
+
{
|
|
62
|
+
"stroke-linecap": "round",
|
|
63
|
+
"stroke-linejoin": "round",
|
|
64
|
+
d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
function DocMetainfo(props) {
|
|
71
|
+
const {
|
|
72
|
+
createdAt,
|
|
73
|
+
updatedAt,
|
|
74
|
+
author,
|
|
75
|
+
createdLabel = DEFAULT_CREATED_LABEL,
|
|
76
|
+
updatedLabel = DEFAULT_UPDATED_LABEL
|
|
77
|
+
} = props;
|
|
78
|
+
const hasInfo = Boolean(createdAt) || Boolean(updatedAt) && updatedAt !== createdAt || Boolean(author);
|
|
79
|
+
if (!hasInfo) return null;
|
|
80
|
+
return /* @__PURE__ */ jsxs("div", { class: "flex flex-wrap items-center gap-x-hsp-md gap-y-vsp-2xs text-caption text-fg mb-vsp-md border-t border-fg pt-vsp-xs", children: [
|
|
81
|
+
createdAt && /* @__PURE__ */ jsxs("span", { class: "inline-flex items-center gap-hsp-2xs", children: [
|
|
82
|
+
/* @__PURE__ */ jsx(ClockIcon, {}),
|
|
83
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
84
|
+
createdLabel,
|
|
85
|
+
" ",
|
|
86
|
+
createdAt
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
updatedAt && updatedAt !== createdAt && /* @__PURE__ */ jsxs("span", { class: "inline-flex items-center gap-hsp-2xs", children: [
|
|
90
|
+
/* @__PURE__ */ jsx(RefreshIcon, {}),
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
92
|
+
updatedLabel,
|
|
93
|
+
" ",
|
|
94
|
+
updatedAt
|
|
95
|
+
] })
|
|
96
|
+
] }),
|
|
97
|
+
author && /* @__PURE__ */ jsxs("span", { class: "inline-flex items-center gap-hsp-2xs", children: [
|
|
98
|
+
/* @__PURE__ */ jsx(UserIcon, {}),
|
|
99
|
+
/* @__PURE__ */ jsx("span", { children: author })
|
|
100
|
+
] })
|
|
101
|
+
] });
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
DEFAULT_CREATED_LABEL,
|
|
105
|
+
DEFAULT_UPDATED_LABEL,
|
|
106
|
+
DocMetainfo
|
|
107
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime automatic */
|
|
4
|
+
/** @jsxImportSource preact */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A single resolved tag with its navigation href. The legacy
|
|
8
|
+
* `doc-tags.astro` called `resolvePageTags(tags)` and used `TagNav`
|
|
9
|
+
* which computed `tagHref()` internally. v2 delegates both to the
|
|
10
|
+
* caller so the component has no upward dependency on project routing
|
|
11
|
+
* utilities.
|
|
12
|
+
*/
|
|
13
|
+
interface ResolvedTag {
|
|
14
|
+
/** Raw tag string (e.g. `"typescript"`). */
|
|
15
|
+
tag: string;
|
|
16
|
+
/** Pre-computed href for the tag page. */
|
|
17
|
+
href: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Controls vertical spacing: matches the `placement` prop on the
|
|
21
|
+
* legacy `doc-tags.astro` component.
|
|
22
|
+
*
|
|
23
|
+
* - `"after-title"` — tight top margin, bottom margin to separate from
|
|
24
|
+
* the body (`mt-0 mb-vsp-md`).
|
|
25
|
+
* - `"before-footer"` — extra top space, no bottom margin
|
|
26
|
+
* (`mt-vsp-xl mb-0`).
|
|
27
|
+
*/
|
|
28
|
+
type TagPlacement = "after-title" | "before-footer";
|
|
29
|
+
interface DocTagsProps {
|
|
30
|
+
/**
|
|
31
|
+
* Resolved tags with pre-computed hrefs. Pass an empty array (or
|
|
32
|
+
* omit) to suppress rendering — mirrors the legacy
|
|
33
|
+
* `resolvedTags.length > 0` guard.
|
|
34
|
+
*/
|
|
35
|
+
tags?: ResolvedTag[];
|
|
36
|
+
/**
|
|
37
|
+
* Placement context — controls the outer container spacing class.
|
|
38
|
+
*/
|
|
39
|
+
placement: TagPlacement;
|
|
40
|
+
/**
|
|
41
|
+
* Label shown before the tag list (e.g. `"Tags:"`). Pass the
|
|
42
|
+
* i18n-resolved `t("doc.tags", locale)` string from upstream.
|
|
43
|
+
* Defaults to `"Tags"`.
|
|
44
|
+
*/
|
|
45
|
+
tagsLabel?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Used in each tag's `aria-label` (`"Tagged with: <tag>"`). Defaults
|
|
48
|
+
* to `"Tagged with"`.
|
|
49
|
+
*/
|
|
50
|
+
taggedWithLabel?: string;
|
|
51
|
+
}
|
|
52
|
+
declare const DEFAULT_TAGS_LABEL = "Tags";
|
|
53
|
+
declare const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
54
|
+
/**
|
|
55
|
+
* Page-level tag chips — JSX port of `src/components/doc-tags.astro`
|
|
56
|
+
* (page-variant rendering from `src/components/tag-nav.astro`).
|
|
57
|
+
*
|
|
58
|
+
* Returns `null` when the `tags` array is empty, matching the original
|
|
59
|
+
* `resolvedTags.length > 0` guard.
|
|
60
|
+
*
|
|
61
|
+
* The pointed-chip shape is reproduced verbatim from the page-variant
|
|
62
|
+
* branch of `tag-nav.astro` using the same `clip-path` values.
|
|
63
|
+
*/
|
|
64
|
+
declare function DocTags(props: DocTagsProps): VNode | null;
|
|
65
|
+
|
|
66
|
+
export { DEFAULT_TAGGED_WITH_LABEL, DEFAULT_TAGS_LABEL, DocTags, type DocTagsProps, type ResolvedTag, type TagPlacement };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
const DEFAULT_TAGS_LABEL = "Tags";
|
|
3
|
+
const DEFAULT_TAGGED_WITH_LABEL = "Tagged with";
|
|
4
|
+
function DocTags(props) {
|
|
5
|
+
const {
|
|
6
|
+
tags = [],
|
|
7
|
+
placement,
|
|
8
|
+
tagsLabel = DEFAULT_TAGS_LABEL,
|
|
9
|
+
taggedWithLabel = DEFAULT_TAGGED_WITH_LABEL
|
|
10
|
+
} = props;
|
|
11
|
+
if (tags.length === 0) return null;
|
|
12
|
+
const spacingClass = placement === "after-title" ? "mt-0 mb-vsp-md" : "mt-vsp-xl mb-0";
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { class: spacingClass, children: /* @__PURE__ */ jsxs("div", { class: "flex flex-wrap items-center gap-x-hsp-xs gap-y-vsp-xs", children: [
|
|
14
|
+
/* @__PURE__ */ jsxs("span", { class: "text-caption text-muted", children: [
|
|
15
|
+
tagsLabel,
|
|
16
|
+
":"
|
|
17
|
+
] }),
|
|
18
|
+
tags.map(({ tag, href }) => /* @__PURE__ */ jsxs(
|
|
19
|
+
"a",
|
|
20
|
+
{
|
|
21
|
+
href,
|
|
22
|
+
"aria-label": `${taggedWithLabel}: ${tag}`,
|
|
23
|
+
class: "group relative inline-flex no-underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"span",
|
|
27
|
+
{
|
|
28
|
+
class: "absolute inset-0 bg-muted group-hover:bg-fg",
|
|
29
|
+
style: "clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%)"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsxs(
|
|
33
|
+
"span",
|
|
34
|
+
{
|
|
35
|
+
class: "relative inline-flex items-center text-caption text-fg bg-bg pl-hsp-sm pr-hsp-lg py-vsp-2xs group-hover:text-bg group-hover:bg-fg",
|
|
36
|
+
style: "clip-path: polygon(1px 1px, calc(100% - 13px) 1px, calc(100% - 1px) 50%, calc(100% - 13px) calc(100% - 1px), 1px calc(100% - 1px))",
|
|
37
|
+
children: [
|
|
38
|
+
"#",
|
|
39
|
+
tag
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
tag
|
|
46
|
+
))
|
|
47
|
+
] }) });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
DEFAULT_TAGGED_WITH_LABEL,
|
|
51
|
+
DEFAULT_TAGS_LABEL,
|
|
52
|
+
DocTags
|
|
53
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { ComponentChildren, VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime automatic */
|
|
4
|
+
/** @jsxImportSource preact */
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props passed to a per-key custom renderer component.
|
|
8
|
+
*
|
|
9
|
+
* The caller is responsible for filtering entries and skipping ignored keys
|
|
10
|
+
* before invoking `FrontmatterPreview`. Renderers are therefore guaranteed
|
|
11
|
+
* to receive only non-null, non-ignored values.
|
|
12
|
+
*/
|
|
13
|
+
interface FrontmatterCellRendererProps {
|
|
14
|
+
/** The frontmatter value (null/undefined values are never passed). */
|
|
15
|
+
value: NonNullable<unknown>;
|
|
16
|
+
/** The frontmatter key name. */
|
|
17
|
+
entryKey: string;
|
|
18
|
+
/** Full frontmatter of the current page — for cross-field dependencies. */
|
|
19
|
+
data: Record<string, unknown>;
|
|
20
|
+
/** Active locale string — forwarded from the page context. */
|
|
21
|
+
locale?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A custom renderer for a single frontmatter value cell.
|
|
25
|
+
*
|
|
26
|
+
* Return `null` or `undefined` to fall through to the built-in
|
|
27
|
+
* `renderValue()` plain-text path.
|
|
28
|
+
*/
|
|
29
|
+
type FrontmatterCellRenderer = (props: FrontmatterCellRendererProps) => ComponentChildren;
|
|
30
|
+
interface FrontmatterPreviewProps {
|
|
31
|
+
/**
|
|
32
|
+
* Pre-filtered `[key, value]` pairs to display. The legacy component
|
|
33
|
+
* owned the filtering logic (ignore-keys, null/undefined removal,
|
|
34
|
+
* `settings.frontmatterPreview` gating, `frontmatterRenderers`
|
|
35
|
+
* dispatch). v2 delegates all of that to the caller and accepts only
|
|
36
|
+
* the final entries to render.
|
|
37
|
+
*
|
|
38
|
+
* Pass an empty array (or omit) to suppress rendering.
|
|
39
|
+
*/
|
|
40
|
+
entries?: Array<[string, unknown]>;
|
|
41
|
+
/**
|
|
42
|
+
* Section heading above the table. Defaults to `"Frontmatter"`.
|
|
43
|
+
* Pass the i18n-resolved `t("frontmatter.preview.title", locale)`
|
|
44
|
+
* string from upstream.
|
|
45
|
+
*/
|
|
46
|
+
title?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Column header for the key column. Defaults to `"Key"`.
|
|
49
|
+
*/
|
|
50
|
+
keyColLabel?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Column header for the value column. Defaults to `"Value"`.
|
|
53
|
+
*/
|
|
54
|
+
valueColLabel?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional per-key custom renderer map. When a renderer is registered for
|
|
57
|
+
* a key, its return value replaces the built-in plain-text cell. A
|
|
58
|
+
* renderer that returns `null` or `undefined` falls through to the
|
|
59
|
+
* built-in path.
|
|
60
|
+
*
|
|
61
|
+
* Keyed by frontmatter field name (case-sensitive). The caller is
|
|
62
|
+
* responsible for ensuring the map does not contain entries for
|
|
63
|
+
* ignored keys (ignored keys are never in `entries`, so their
|
|
64
|
+
* renderers are never called anyway).
|
|
65
|
+
*/
|
|
66
|
+
renderers?: Record<string, FrontmatterCellRenderer>;
|
|
67
|
+
/**
|
|
68
|
+
* Full frontmatter data of the current page. Forwarded to each renderer
|
|
69
|
+
* via `FrontmatterCellRendererProps.data` so renderers can read
|
|
70
|
+
* cross-field context. Defaults to `{}`.
|
|
71
|
+
*/
|
|
72
|
+
data?: Record<string, unknown>;
|
|
73
|
+
/**
|
|
74
|
+
* Active locale string. Forwarded to each renderer via
|
|
75
|
+
* `FrontmatterCellRendererProps.locale`.
|
|
76
|
+
*/
|
|
77
|
+
locale?: string;
|
|
78
|
+
}
|
|
79
|
+
declare const DEFAULT_FRONTMATTER_PREVIEW_TITLE = "Frontmatter";
|
|
80
|
+
declare const DEFAULT_KEY_COL_LABEL = "Key";
|
|
81
|
+
declare const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
82
|
+
/**
|
|
83
|
+
* Frontmatter data table — JSX port of
|
|
84
|
+
* `src/components/frontmatter-preview.astro`.
|
|
85
|
+
*
|
|
86
|
+
* Returns `null` when `entries` is empty, mirroring the original
|
|
87
|
+
* `entries.length > 0` guard.
|
|
88
|
+
*
|
|
89
|
+
* When `renderers` is provided, each entry's value cell is first offered to
|
|
90
|
+
* the matching renderer. A renderer that returns `null` or `undefined` falls
|
|
91
|
+
* through to the built-in `renderValue()` plain-text path.
|
|
92
|
+
*/
|
|
93
|
+
declare function FrontmatterPreview(props: FrontmatterPreviewProps): VNode | null;
|
|
94
|
+
|
|
95
|
+
export { DEFAULT_FRONTMATTER_PREVIEW_TITLE, DEFAULT_KEY_COL_LABEL, DEFAULT_VALUE_COL_LABEL, type FrontmatterCellRenderer, type FrontmatterCellRendererProps, FrontmatterPreview, type FrontmatterPreviewProps };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
const DEFAULT_FRONTMATTER_PREVIEW_TITLE = "Frontmatter";
|
|
3
|
+
const DEFAULT_KEY_COL_LABEL = "Key";
|
|
4
|
+
const DEFAULT_VALUE_COL_LABEL = "Value";
|
|
5
|
+
function renderValue(v) {
|
|
6
|
+
if (typeof v === "string") return { text: v };
|
|
7
|
+
if (typeof v === "number") return { text: String(v) };
|
|
8
|
+
if (typeof v === "boolean") return { text: v ? "true" : "false" };
|
|
9
|
+
if (Array.isArray(v) && v.every((item) => typeof item === "string")) {
|
|
10
|
+
return { text: v.join(", ") };
|
|
11
|
+
}
|
|
12
|
+
return { code: JSON.stringify(v) };
|
|
13
|
+
}
|
|
14
|
+
function FrontmatterPreview(props) {
|
|
15
|
+
const {
|
|
16
|
+
entries = [],
|
|
17
|
+
title = DEFAULT_FRONTMATTER_PREVIEW_TITLE,
|
|
18
|
+
keyColLabel = DEFAULT_KEY_COL_LABEL,
|
|
19
|
+
valueColLabel = DEFAULT_VALUE_COL_LABEL,
|
|
20
|
+
renderers,
|
|
21
|
+
data = {},
|
|
22
|
+
locale
|
|
23
|
+
} = props;
|
|
24
|
+
if (entries.length === 0) return null;
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", { "data-testid": "frontmatter-preview", class: "my-vsp-lg", children: [
|
|
26
|
+
/* @__PURE__ */ jsx("p", { class: "text-caption text-muted mb-vsp-2xs", children: title }),
|
|
27
|
+
/* @__PURE__ */ jsx("div", { class: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { class: "w-full border-collapse text-caption", children: [
|
|
28
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
29
|
+
/* @__PURE__ */ jsx("th", { class: "text-left font-semibold px-hsp-md py-vsp-2xs border-b-2 border-muted text-fg", children: keyColLabel }),
|
|
30
|
+
/* @__PURE__ */ jsx("th", { class: "text-left font-semibold px-hsp-md py-vsp-2xs border-b-2 border-muted text-fg", children: valueColLabel })
|
|
31
|
+
] }) }),
|
|
32
|
+
/* @__PURE__ */ jsx("tbody", { children: entries.map(([key, value]) => {
|
|
33
|
+
const rendererFn = renderers?.[key];
|
|
34
|
+
const customCell = rendererFn != null && value != null ? rendererFn({
|
|
35
|
+
value,
|
|
36
|
+
entryKey: key,
|
|
37
|
+
data,
|
|
38
|
+
locale
|
|
39
|
+
}) : void 0;
|
|
40
|
+
const useCustom = customCell !== null && customCell !== void 0;
|
|
41
|
+
const rendered = useCustom ? null : renderValue(value);
|
|
42
|
+
return /* @__PURE__ */ jsxs("tr", { class: "border-b border-muted", children: [
|
|
43
|
+
/* @__PURE__ */ jsx("td", { class: "px-hsp-md py-vsp-2xs text-muted font-mono align-top", children: key }),
|
|
44
|
+
/* @__PURE__ */ jsx("td", { class: "px-hsp-md py-vsp-2xs text-fg break-words align-top", children: useCustom ? customCell : rendered.code !== void 0 ? /* @__PURE__ */ jsx("code", { class: "bg-code-bg text-code-fg px-hsp-xs py-0 rounded text-micro font-mono", children: rendered.code }) : rendered.text })
|
|
45
|
+
] }, key);
|
|
46
|
+
}) })
|
|
47
|
+
] }) })
|
|
48
|
+
] });
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
DEFAULT_FRONTMATTER_PREVIEW_TITLE,
|
|
52
|
+
DEFAULT_KEY_COL_LABEL,
|
|
53
|
+
DEFAULT_VALUE_COL_LABEL,
|
|
54
|
+
FrontmatterPreview
|
|
55
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { DEFAULT_CREATED_LABEL, DEFAULT_UPDATED_LABEL, DocMetainfo, DocMetainfoProps } from './doc-metainfo.js';
|
|
2
|
+
export { DEFAULT_TAGGED_WITH_LABEL, DEFAULT_TAGS_LABEL, DocTags, DocTagsProps, ResolvedTag, TagPlacement } from './doc-tags.js';
|
|
3
|
+
export { DEFAULT_FRONTMATTER_PREVIEW_TITLE, DEFAULT_KEY_COL_LABEL, DEFAULT_VALUE_COL_LABEL, FrontmatterCellRenderer, FrontmatterCellRendererProps, FrontmatterPreview, FrontmatterPreviewProps } from './frontmatter-preview.js';
|
|
4
|
+
import 'preact';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DocMetainfo,
|
|
3
|
+
DEFAULT_CREATED_LABEL,
|
|
4
|
+
DEFAULT_UPDATED_LABEL
|
|
5
|
+
} from "./doc-metainfo.js";
|
|
6
|
+
import {
|
|
7
|
+
DocTags,
|
|
8
|
+
DEFAULT_TAGS_LABEL,
|
|
9
|
+
DEFAULT_TAGGED_WITH_LABEL
|
|
10
|
+
} from "./doc-tags.js";
|
|
11
|
+
import {
|
|
12
|
+
FrontmatterPreview,
|
|
13
|
+
DEFAULT_FRONTMATTER_PREVIEW_TITLE,
|
|
14
|
+
DEFAULT_KEY_COL_LABEL,
|
|
15
|
+
DEFAULT_VALUE_COL_LABEL
|
|
16
|
+
} from "./frontmatter-preview.js";
|
|
17
|
+
export {
|
|
18
|
+
DEFAULT_CREATED_LABEL,
|
|
19
|
+
DEFAULT_FRONTMATTER_PREVIEW_TITLE,
|
|
20
|
+
DEFAULT_KEY_COL_LABEL,
|
|
21
|
+
DEFAULT_TAGGED_WITH_LABEL,
|
|
22
|
+
DEFAULT_TAGS_LABEL,
|
|
23
|
+
DEFAULT_UPDATED_LABEL,
|
|
24
|
+
DEFAULT_VALUE_COL_LABEL,
|
|
25
|
+
DocMetainfo,
|
|
26
|
+
DocTags,
|
|
27
|
+
FrontmatterPreview
|
|
28
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
import { NavNode } from './types.js';
|
|
3
|
+
|
|
4
|
+
/** @jsxRuntime automatic */
|
|
5
|
+
/** @jsxImportSource preact */
|
|
6
|
+
|
|
7
|
+
interface CategoryNavProps {
|
|
8
|
+
/**
|
|
9
|
+
* Direct children of the target category node. The consumer pre-filters to
|
|
10
|
+
* the desired category and passes the immediate children. Only nodes with
|
|
11
|
+
* `hasPage === true` will be rendered.
|
|
12
|
+
*/
|
|
13
|
+
children: NavNode[];
|
|
14
|
+
/** Optional extra CSS classes appended to the `<nav>` element. */
|
|
15
|
+
class?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* CategoryNav — JSX port of `src/components/category-nav.astro`.
|
|
19
|
+
*
|
|
20
|
+
* Renders direct children of a category as a two-column grid of card links.
|
|
21
|
+
* Each card shows the node's label (with an arrow icon) and an optional
|
|
22
|
+
* description line.
|
|
23
|
+
*
|
|
24
|
+
* Returns `null` when no `hasPage` children are found.
|
|
25
|
+
*/
|
|
26
|
+
declare function CategoryNav(props: CategoryNavProps): JSX.Element | null;
|
|
27
|
+
|
|
28
|
+
export { CategoryNav, type CategoryNavProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
function ArrowIcon() {
|
|
3
|
+
return /* @__PURE__ */ jsx(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
viewBox: "0 0 103.395 107.049",
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
class: "w-[16px] shrink-0",
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", { d: "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" })
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function CategoryNav(props) {
|
|
16
|
+
const { children, class: className } = props;
|
|
17
|
+
const items = children.filter((c) => c.hasPage);
|
|
18
|
+
if (items.length === 0) return null;
|
|
19
|
+
const navClass = [
|
|
20
|
+
"mt-vsp-lg mb-vsp-md grid grid-cols-1 gap-x-hsp-lg gap-y-vsp-md sm:grid-cols-2",
|
|
21
|
+
className
|
|
22
|
+
].filter(Boolean).join(" ");
|
|
23
|
+
return /* @__PURE__ */ jsx("nav", { class: navClass, children: items.map((child, i) => /* @__PURE__ */ jsxs(
|
|
24
|
+
"a",
|
|
25
|
+
{
|
|
26
|
+
href: child.href,
|
|
27
|
+
class: "group block rounded border border-muted bg-surface px-hsp-lg py-vsp-md hover:border-accent",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsxs("span", { class: "flex items-start gap-hsp-xs font-medium text-accent underline group-hover:underline", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", { class: "flex h-[1lh] items-center", children: /* @__PURE__ */ jsx(ArrowIcon, {}) }),
|
|
31
|
+
child.label
|
|
32
|
+
] }),
|
|
33
|
+
child.description && /* @__PURE__ */ jsx("span", { class: "mt-vsp-2xs block text-small text-muted group-hover:underline group-focus-visible:underline", children: child.description })
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
`cat-nav-${i}`
|
|
37
|
+
)) });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
CategoryNav
|
|
41
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
import { NavNode } from './types.js';
|
|
3
|
+
|
|
4
|
+
/** @jsxRuntime automatic */
|
|
5
|
+
/** @jsxImportSource preact */
|
|
6
|
+
|
|
7
|
+
interface CategoryTreeNavProps {
|
|
8
|
+
/**
|
|
9
|
+
* Direct children of the target category node. Nodes are filtered to
|
|
10
|
+
* those with `hasPage` or with child nodes before rendering.
|
|
11
|
+
*/
|
|
12
|
+
children: NavNode[];
|
|
13
|
+
/** Maximum depth to recurse. Defaults to unlimited (full tree). */
|
|
14
|
+
maxDepth?: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* CategoryTreeNav — JSX port of `src/components/category-tree-nav.astro`.
|
|
18
|
+
*
|
|
19
|
+
* Renders the children of a category as a recursive disc-bulleted list. Links
|
|
20
|
+
* are rendered for nodes that have a page; plain text for structural nodes.
|
|
21
|
+
* Descriptions are appended after a colon when present.
|
|
22
|
+
*
|
|
23
|
+
* Returns `null` when no renderable children exist.
|
|
24
|
+
*/
|
|
25
|
+
declare function CategoryTreeNav(props: CategoryTreeNavProps): JSX.Element | null;
|
|
26
|
+
|
|
27
|
+
export { CategoryTreeNav, type CategoryTreeNavProps };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
function NodeItem({ node, depth, maxDepth, index }) {
|
|
3
|
+
const visibleChildren = node.children.filter(
|
|
4
|
+
(c) => c.hasPage || c.children.length > 0
|
|
5
|
+
);
|
|
6
|
+
const hasChildren = visibleChildren.length > 0 && depth < maxDepth;
|
|
7
|
+
return /* @__PURE__ */ jsxs("li", { class: "m-0 p-0", children: [
|
|
8
|
+
node.href ? /* @__PURE__ */ jsx(
|
|
9
|
+
"a",
|
|
10
|
+
{
|
|
11
|
+
href: node.href,
|
|
12
|
+
class: "inline-block py-vsp-3xs text-accent hover:underline",
|
|
13
|
+
children: node.label
|
|
14
|
+
}
|
|
15
|
+
) : /* @__PURE__ */ jsx("span", { class: "inline-block py-vsp-3xs text-fg font-medium", children: node.label }),
|
|
16
|
+
node.description && /* @__PURE__ */ jsxs("span", { class: "ml-hsp-sm text-small text-muted", children: [
|
|
17
|
+
": ",
|
|
18
|
+
node.description
|
|
19
|
+
] }),
|
|
20
|
+
hasChildren && /* @__PURE__ */ jsx("ul", { class: "list-disc m-0 p-0 pl-hsp-xl", children: visibleChildren.map((child, ci) => /* @__PURE__ */ jsx(
|
|
21
|
+
NodeItem,
|
|
22
|
+
{
|
|
23
|
+
node: child,
|
|
24
|
+
depth: depth + 1,
|
|
25
|
+
maxDepth,
|
|
26
|
+
index: ci
|
|
27
|
+
},
|
|
28
|
+
`tree-child-${depth + 1}-${ci}`
|
|
29
|
+
)) })
|
|
30
|
+
] }, `tree-item-${depth}-${index}`);
|
|
31
|
+
}
|
|
32
|
+
function CategoryTreeNav(props) {
|
|
33
|
+
const { children, maxDepth = Infinity } = props;
|
|
34
|
+
const items = children.filter((c) => c.hasPage || c.children.length > 0);
|
|
35
|
+
if (items.length === 0) return null;
|
|
36
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": "Category navigation", class: "mt-vsp-lg mb-vsp-md", children: /* @__PURE__ */ jsx("ul", { class: "list-disc m-0 p-0 pl-hsp-xl", children: items.map((child, i) => /* @__PURE__ */ jsx(
|
|
37
|
+
NodeItem,
|
|
38
|
+
{
|
|
39
|
+
node: child,
|
|
40
|
+
depth: 0,
|
|
41
|
+
maxDepth,
|
|
42
|
+
index: i
|
|
43
|
+
},
|
|
44
|
+
`tree-top-${i}`
|
|
45
|
+
)) }) });
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
CategoryTreeNav
|
|
49
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime automatic */
|
|
4
|
+
/** @jsxImportSource preact */
|
|
5
|
+
|
|
6
|
+
/** A single resolved doc card item. */
|
|
7
|
+
interface DocCardItem {
|
|
8
|
+
/** Pre-resolved href (base-prefixed, locale-aware). */
|
|
9
|
+
href: string;
|
|
10
|
+
/** Display title for the card. */
|
|
11
|
+
title: string;
|
|
12
|
+
/** Optional description shown below the title. */
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
interface DocCardGridProps {
|
|
16
|
+
/** Flat list of fully resolved card items. */
|
|
17
|
+
items: DocCardItem[];
|
|
18
|
+
/** Accessible label for the `<nav>` element. Defaults to "Child pages". */
|
|
19
|
+
ariaLabel?: string;
|
|
20
|
+
/** Optional extra CSS classes appended to the `<nav>` element. */
|
|
21
|
+
class?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* DocCardGrid — JSX port of `src/components/doc-card-grid.astro`.
|
|
25
|
+
*
|
|
26
|
+
* Renders a flat list of `{ href, title, description? }` items as a two-column
|
|
27
|
+
* card grid. Each card shows an arrow icon, the doc title, and an optional
|
|
28
|
+
* description.
|
|
29
|
+
*
|
|
30
|
+
* This is the simplest of the card-grid family: it takes fully resolved items
|
|
31
|
+
* rather than NavNode tree nodes, making it easy to use for hand-crafted link
|
|
32
|
+
* lists or computed result sets.
|
|
33
|
+
*
|
|
34
|
+
* Returns `null` when `items` is empty.
|
|
35
|
+
*/
|
|
36
|
+
declare function DocCardGrid(props: DocCardGridProps): JSX.Element | null;
|
|
37
|
+
|
|
38
|
+
export { DocCardGrid, type DocCardGridProps, type DocCardItem };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
function ArrowIcon() {
|
|
3
|
+
return /* @__PURE__ */ jsx(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
viewBox: "0 0 103.395 107.049",
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
class: "w-[16px] shrink-0 text-accent",
|
|
11
|
+
children: /* @__PURE__ */ jsx("path", { d: "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" })
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
function DocCardGrid(props) {
|
|
16
|
+
const { items, ariaLabel = "Child pages", class: className } = props;
|
|
17
|
+
if (items.length === 0) return null;
|
|
18
|
+
const navClass = [
|
|
19
|
+
"grid grid-cols-1 gap-x-hsp-lg gap-y-vsp-md sm:grid-cols-2",
|
|
20
|
+
className
|
|
21
|
+
].filter(Boolean).join(" ");
|
|
22
|
+
return /* @__PURE__ */ jsx("nav", { "aria-label": ariaLabel, class: navClass, children: items.map((item, i) => /* @__PURE__ */ jsxs(
|
|
23
|
+
"a",
|
|
24
|
+
{
|
|
25
|
+
href: item.href,
|
|
26
|
+
class: "group block rounded border border-muted bg-surface px-hsp-lg py-vsp-md hover:border-accent",
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("span", { class: "flex items-center gap-hsp-xs", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(ArrowIcon, {}),
|
|
30
|
+
/* @__PURE__ */ jsx("span", { class: "font-medium text-accent group-hover:underline", children: item.title })
|
|
31
|
+
] }),
|
|
32
|
+
item.description && /* @__PURE__ */ jsx("span", { class: "mt-vsp-2xs block text-small text-muted", children: item.description })
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
`doc-card-${i}`
|
|
36
|
+
)) });
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
DocCardGrid
|
|
40
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
import { NavNode } from './types.js';
|
|
3
|
+
|
|
4
|
+
/** @jsxRuntime automatic */
|
|
5
|
+
/** @jsxImportSource preact */
|
|
6
|
+
|
|
7
|
+
interface DocsSitemapProps {
|
|
8
|
+
/**
|
|
9
|
+
* Pre-built navigation tree. Each top-level entry maps to one collapsible
|
|
10
|
+
* section in the sitemap.
|
|
11
|
+
*/
|
|
12
|
+
tree: NavNode[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* DocsSitemap — JSX port of `src/components/docs-sitemap.astro`.
|
|
16
|
+
*
|
|
17
|
+
* Renders the full documentation tree as a series of collapsible
|
|
18
|
+
* `<details>` sections. Each top-level node becomes one section; its
|
|
19
|
+
* descendants with `hasPage === true` are listed flat within that section.
|
|
20
|
+
*
|
|
21
|
+
* Returns `null` when `tree` is empty.
|
|
22
|
+
*/
|
|
23
|
+
declare function DocsSitemap(props: DocsSitemapProps): JSX.Element | null;
|
|
24
|
+
|
|
25
|
+
export { DocsSitemap, type DocsSitemapProps };
|