@takazudo/zudo-doc 0.2.22 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/zudo-doc.mjs +83 -0
- package/dist/eject/index.d.ts +33 -0
- package/dist/eject/index.js +229 -0
- package/dist/plugins/routes.d.ts +2 -0
- package/dist/plugins/routes.js +100 -0
- package/dist/preset.d.ts +47 -1
- package/dist/preset.js +29 -13
- package/dist/routes/404.d.ts +7 -0
- package/dist/routes/404.js +47 -0
- package/dist/routes/_chrome.d.ts +32 -0
- package/dist/routes/_chrome.js +365 -0
- package/dist/routes/_context.d.ts +56 -0
- package/dist/routes/_context.js +222 -0
- package/dist/routes/_docs-helpers.d.ts +43 -0
- package/dist/routes/_docs-helpers.js +173 -0
- package/dist/routes/_virtual.d.js +0 -0
- package/dist/routes/api-ai-chat.d.ts +5 -0
- package/dist/routes/api-ai-chat.js +24 -0
- package/dist/routes/docs-slug.d.ts +21 -0
- package/dist/routes/docs-slug.js +26 -0
- package/dist/routes/docs-tags-index.d.ts +7 -0
- package/dist/routes/docs-tags-index.js +11 -0
- package/dist/routes/docs-tags-tag.d.ts +23 -0
- package/dist/routes/docs-tags-tag.js +19 -0
- package/dist/routes/docs-versions.d.ts +7 -0
- package/dist/routes/docs-versions.js +11 -0
- package/dist/routes/index.d.ts +7 -0
- package/dist/routes/index.js +117 -0
- package/dist/routes/locale-docs-slug.d.ts +27 -0
- package/dist/routes/locale-docs-slug.js +40 -0
- package/dist/routes/locale-docs-tags-index.d.ts +18 -0
- package/dist/routes/locale-docs-tags-index.js +15 -0
- package/dist/routes/locale-docs-tags-tag.d.ts +25 -0
- package/dist/routes/locale-docs-tags-tag.js +22 -0
- package/dist/routes/locale-docs-versions.d.ts +18 -0
- package/dist/routes/locale-docs-versions.js +15 -0
- package/dist/routes/locale-index.d.ts +24 -0
- package/dist/routes/locale-index.js +132 -0
- package/dist/routes/robots.txt.d.ts +3 -0
- package/dist/routes/robots.txt.js +8 -0
- package/dist/routes/sitemap.xml.d.ts +5 -0
- package/dist/routes/sitemap.xml.js +31 -0
- package/dist/routes/v-docs-slug.d.ts +27 -0
- package/dist/routes/v-docs-slug.js +34 -0
- package/dist/routes/v-locale-docs-slug.d.ts +31 -0
- package/dist/routes/v-locale-docs-slug.js +50 -0
- package/dist/safelist.css +1 -1
- package/dist/settings.d.ts +15 -0
- package/eject/breadcrumb/breadcrumb.tsx +194 -0
- package/eject/breadcrumb/find-path.ts +26 -0
- package/eject/breadcrumb/index.ts +4 -0
- package/eject/breadcrumb/types.ts +32 -0
- package/eject/code-group/index.tsx +78 -0
- package/eject/content-admonition/index.tsx +50 -0
- package/eject/details/details.tsx +34 -0
- package/eject/details/index.ts +4 -0
- package/eject/doc-pager/index.tsx +91 -0
- package/eject/footer/footer.tsx +167 -0
- package/eject/footer/index.ts +19 -0
- package/eject/footer/types.ts +60 -0
- package/eject/header/header.tsx +725 -0
- package/eject/header/index.ts +36 -0
- package/eject/header/nav-active.ts +122 -0
- package/eject/header/nav-overflow-script.ts +302 -0
- package/eject/header/right-items.ts +78 -0
- package/eject/header/types.ts +69 -0
- package/eject/page-loading/index.ts +10 -0
- package/eject/page-loading/page-loading-overlay.tsx +103 -0
- package/eject/sidebar/index.ts +27 -0
- package/eject/sidebar/sidebar.tsx +137 -0
- package/eject/sidebar/types.ts +73 -0
- package/eject/tab-item/index.ts +7 -0
- package/eject/tab-item/tab-item.tsx +70 -0
- package/eject/theme-toggle/color-scheme-sync.ts +73 -0
- package/eject/theme-toggle/index.tsx +120 -0
- package/eject/toc/cx.ts +38 -0
- package/eject/toc/index.ts +11 -0
- package/eject/toc/mobile-toc.tsx +133 -0
- package/eject/toc/toc-title.ts +33 -0
- package/eject/toc/toc.tsx +119 -0
- package/eject/toc/types.ts +14 -0
- package/eject/toc/use-active-heading.ts +162 -0
- package/package.json +87 -7
- package/routes-src/404.tsx +49 -0
- package/routes-src/_chrome.tsx +470 -0
- package/routes-src/_context.ts +314 -0
- package/routes-src/_docs-helpers.ts +284 -0
- package/routes-src/_virtual.d.ts +15 -0
- package/routes-src/api-ai-chat.tsx +46 -0
- package/routes-src/docs-slug.tsx +43 -0
- package/routes-src/docs-tags-index.tsx +14 -0
- package/routes-src/docs-tags-tag.tsx +29 -0
- package/routes-src/docs-versions.tsx +15 -0
- package/routes-src/index.tsx +134 -0
- package/routes-src/locale-docs-slug.tsx +69 -0
- package/routes-src/locale-docs-tags-index.tsx +23 -0
- package/routes-src/locale-docs-tags-tag.tsx +39 -0
- package/routes-src/locale-docs-versions.tsx +23 -0
- package/routes-src/locale-index.tsx +150 -0
- package/routes-src/robots.txt.tsx +13 -0
- package/routes-src/sitemap.xml.tsx +48 -0
- package/routes-src/v-docs-slug.tsx +64 -0
- package/routes-src/v-locale-docs-slug.tsx +85 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type CategoryMeta } from "../sidebar-tree/index.js";
|
|
2
|
+
import type { DocNavNode, DocPageEntry } from "../doc-page-props/index.js";
|
|
3
|
+
export type { CategoryMeta, DocNavNode, DocPageEntry };
|
|
4
|
+
/**
|
|
5
|
+
* Identity-stable, draft-filtered `DocPageEntry[]` for a collection. Returns the
|
|
6
|
+
* SAME array instance on every call within one build (anchored on the snapshot
|
|
7
|
+
* array); the no-snapshot (fs-fallback / unit-test) path computes fresh and is
|
|
8
|
+
* deliberately unmemoized. Passed as `stableDocs` to `createNavSourceDocs`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function stableDocs(collectionName: string): DocPageEntry[];
|
|
11
|
+
/** Filter predicate: true when a doc should appear in navigation. */
|
|
12
|
+
export declare function isNavVisible(doc: DocPageEntry): boolean;
|
|
13
|
+
/** A docs-href builder: `(slug, locale) => url`. */
|
|
14
|
+
export type BuildHref = (slug: string, locale: string) => string;
|
|
15
|
+
export interface BuildNavTreeOptions {
|
|
16
|
+
buildHref?: BuildHref;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a recursive navigation tree from a flat doc collection. Delegates tree
|
|
20
|
+
* construction to the shared `buildSidebarTree`; keeps the host-side concerns
|
|
21
|
+
* (DocNavNode shape, root-index node synthesis). `buildHref` parameterizes the
|
|
22
|
+
* href space (default: the injected `docsUrl`). Unlike the host copy this drops
|
|
23
|
+
* the LRU / identity caches — the snapshot-anchored `stableDocs` already makes
|
|
24
|
+
* the input arrays identity-stable so the factory-level `memoizeDerived` short-
|
|
25
|
+
* circuits per build.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildNavTree(docs: DocPageEntry[], locale: string, categoryMeta: Map<string, CategoryMeta> | undefined, buildHref: BuildHref, options?: BuildNavTreeOptions): DocNavNode[];
|
|
28
|
+
/** Group "satellite" nodes (slug-prefix siblings) under their primary node. */
|
|
29
|
+
export declare function groupSatelliteNodes(tree: DocNavNode[], prefixes: string[]): DocNavNode[];
|
|
30
|
+
/** Find a node by slug anywhere in the tree. */
|
|
31
|
+
export declare function findNode(nodes: DocNavNode[], slug: string): DocNavNode | undefined;
|
|
32
|
+
/** Href of the first routed descendant, walking children depth-first. */
|
|
33
|
+
export declare function firstRoutedHref(node: DocNavNode): string | undefined;
|
|
34
|
+
/** Collect all category nodes that have children but no page (no index.mdx). */
|
|
35
|
+
export declare function collectAutoIndexNodes(nodes: DocNavNode[]): DocNavNode[];
|
|
36
|
+
export interface BreadcrumbItem {
|
|
37
|
+
label: string;
|
|
38
|
+
href?: string;
|
|
39
|
+
}
|
|
40
|
+
/** Build breadcrumb trail by walking the nav tree. `homeHref` is the locale
|
|
41
|
+
* docs root (injected). `hrefFor` optionally remaps intermediate crumbs into
|
|
42
|
+
* a versioned URL space. */
|
|
43
|
+
export declare function buildBreadcrumbs(tree: DocNavNode[], slug: string, homeHref: string, hrefFor?: (slug: string) => string): BreadcrumbItem[];
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCollection,
|
|
3
|
+
getContentSnapshot
|
|
4
|
+
} from "@takazudo/zfb/content";
|
|
5
|
+
import {
|
|
6
|
+
buildSidebarTree
|
|
7
|
+
} from "../sidebar-tree/index.js";
|
|
8
|
+
import { toRouteSlug } from "../slug/index.js";
|
|
9
|
+
function snapshotAnchor(name) {
|
|
10
|
+
return getContentSnapshot()?.collections[name];
|
|
11
|
+
}
|
|
12
|
+
const bridgedByAnchor = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
function bridgeEntry(e, collectionName) {
|
|
14
|
+
return {
|
|
15
|
+
slug: e.slug,
|
|
16
|
+
id: toRouteSlug(e.slug),
|
|
17
|
+
collection: collectionName,
|
|
18
|
+
data: e.data,
|
|
19
|
+
body: e.body,
|
|
20
|
+
module_specifier: e.module_specifier,
|
|
21
|
+
Content: e.Content
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function buildBridged(collectionName) {
|
|
25
|
+
const raw = getCollection(collectionName);
|
|
26
|
+
return raw.map((e) => bridgeEntry(e, collectionName)).filter((d) => !d.data.draft);
|
|
27
|
+
}
|
|
28
|
+
function stableDocs(collectionName) {
|
|
29
|
+
const anchor = snapshotAnchor(collectionName);
|
|
30
|
+
if (anchor === void 0) return buildBridged(collectionName);
|
|
31
|
+
const cached = bridgedByAnchor.get(anchor);
|
|
32
|
+
if (cached) return cached;
|
|
33
|
+
const built = buildBridged(collectionName);
|
|
34
|
+
bridgedByAnchor.set(anchor, built);
|
|
35
|
+
return built;
|
|
36
|
+
}
|
|
37
|
+
function isNavVisible(doc) {
|
|
38
|
+
return !doc.data.unlisted && !doc.data.standalone;
|
|
39
|
+
}
|
|
40
|
+
function toNavNode(node) {
|
|
41
|
+
return {
|
|
42
|
+
slug: node.id,
|
|
43
|
+
label: node.label,
|
|
44
|
+
description: node.description,
|
|
45
|
+
position: node.sidebar_position ?? 999,
|
|
46
|
+
href: node.href,
|
|
47
|
+
hasPage: node.hasPage,
|
|
48
|
+
children: node.children.map(toNavNode),
|
|
49
|
+
sortOrder: node.sortOrder ?? "asc"
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function findRootIndexDoc(docs) {
|
|
53
|
+
let found;
|
|
54
|
+
for (const d of docs) {
|
|
55
|
+
const slug = d.data.slug ?? d.id.replace(/\/index$/, "");
|
|
56
|
+
if (slug === "") found = d;
|
|
57
|
+
}
|
|
58
|
+
return found;
|
|
59
|
+
}
|
|
60
|
+
function toRootNavNode(doc, locale, buildHref, categoryMeta) {
|
|
61
|
+
const meta = categoryMeta?.get("");
|
|
62
|
+
const noPage = doc.data.category_no_page ?? meta?.noPage;
|
|
63
|
+
const sortOrder = doc.data.category_sort_order ?? meta?.sortOrder ?? "asc";
|
|
64
|
+
return {
|
|
65
|
+
slug: "",
|
|
66
|
+
label: doc.data.sidebar_label ?? doc.data.title ?? meta?.label ?? "",
|
|
67
|
+
description: doc.data.description ?? meta?.description,
|
|
68
|
+
position: doc.data.sidebar_position ?? meta?.position ?? 999,
|
|
69
|
+
href: noPage ? void 0 : buildHref("", locale),
|
|
70
|
+
hasPage: noPage !== true,
|
|
71
|
+
children: [],
|
|
72
|
+
sortOrder
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function buildNavTree(docs, locale, categoryMeta, buildHref, options) {
|
|
76
|
+
const href = options?.buildHref ?? buildHref;
|
|
77
|
+
const sidebarTree = buildSidebarTree(
|
|
78
|
+
docs.map((d) => ({ id: d.id, data: d.data })),
|
|
79
|
+
locale,
|
|
80
|
+
{
|
|
81
|
+
categoryMeta,
|
|
82
|
+
buildHref: (slug, loc) => href(slug, loc),
|
|
83
|
+
// Host call sites own visibility; disable the builder's default filter so
|
|
84
|
+
// breadcrumb (unfiltered) and nav (pre-filtered) paths are unchanged.
|
|
85
|
+
isNavVisible: () => true
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
const result = sidebarTree.map(toNavNode);
|
|
89
|
+
const rootDoc = findRootIndexDoc(docs);
|
|
90
|
+
if (rootDoc) {
|
|
91
|
+
result.push(toRootNavNode(rootDoc, locale, href, categoryMeta));
|
|
92
|
+
result.sort((a, b) => {
|
|
93
|
+
const posCompare = a.position - b.position;
|
|
94
|
+
if (posCompare !== 0) return posCompare;
|
|
95
|
+
return a.slug.localeCompare(b.slug);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
function groupSatelliteNodes(tree, prefixes) {
|
|
101
|
+
const result = [...tree];
|
|
102
|
+
for (const prefix of prefixes) {
|
|
103
|
+
const primaryIdx = result.findIndex((n) => n.slug === prefix);
|
|
104
|
+
if (primaryIdx < 0) continue;
|
|
105
|
+
const primary = result[primaryIdx];
|
|
106
|
+
if (!primary) continue;
|
|
107
|
+
const satelliteIdxs = [];
|
|
108
|
+
for (let i = 0; i < result.length; i++) {
|
|
109
|
+
const node = result[i];
|
|
110
|
+
if (node && i !== primaryIdx && node.slug.startsWith(`${prefix}-`)) {
|
|
111
|
+
satelliteIdxs.push(i);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
if (satelliteIdxs.length === 0) continue;
|
|
115
|
+
const extraChildren = [];
|
|
116
|
+
for (const idx of satelliteIdxs) {
|
|
117
|
+
const node = result[idx];
|
|
118
|
+
if (node) extraChildren.push(node);
|
|
119
|
+
}
|
|
120
|
+
result[primaryIdx] = { ...primary, children: [...primary.children, ...extraChildren] };
|
|
121
|
+
for (const idx of satelliteIdxs.reverse()) result.splice(idx, 1);
|
|
122
|
+
}
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
125
|
+
function findNode(nodes, slug) {
|
|
126
|
+
for (const node of nodes) {
|
|
127
|
+
if (node.slug === slug) return node;
|
|
128
|
+
const found = findNode(node.children, slug);
|
|
129
|
+
if (found) return found;
|
|
130
|
+
}
|
|
131
|
+
return void 0;
|
|
132
|
+
}
|
|
133
|
+
function firstRoutedHref(node) {
|
|
134
|
+
for (const child of node.children) {
|
|
135
|
+
if (child.hasPage && child.href) return child.href;
|
|
136
|
+
const nested = firstRoutedHref(child);
|
|
137
|
+
if (nested) return nested;
|
|
138
|
+
}
|
|
139
|
+
return void 0;
|
|
140
|
+
}
|
|
141
|
+
function collectAutoIndexNodes(nodes) {
|
|
142
|
+
const result = [];
|
|
143
|
+
for (const node of nodes) {
|
|
144
|
+
if (!node.hasPage && node.children.length > 0 && node.href) result.push(node);
|
|
145
|
+
result.push(...collectAutoIndexNodes(node.children));
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
function buildBreadcrumbs(tree, slug, homeHref, hrefFor) {
|
|
150
|
+
const parts = slug.split("/");
|
|
151
|
+
const crumbs = [{ label: "", href: homeHref }];
|
|
152
|
+
let nodes = tree;
|
|
153
|
+
for (let i = 0; i < parts.length; i++) {
|
|
154
|
+
const partialSlug = parts.slice(0, i + 1).join("/");
|
|
155
|
+
const node = nodes.find((n) => n.slug === partialSlug);
|
|
156
|
+
if (!node) break;
|
|
157
|
+
const isLast = i === parts.length - 1;
|
|
158
|
+
const href = isLast ? void 0 : hrefFor && node.href !== void 0 ? hrefFor(node.slug) : node.href;
|
|
159
|
+
crumbs.push({ label: node.label, href });
|
|
160
|
+
nodes = node.children;
|
|
161
|
+
}
|
|
162
|
+
return crumbs;
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
buildBreadcrumbs,
|
|
166
|
+
buildNavTree,
|
|
167
|
+
collectAutoIndexNodes,
|
|
168
|
+
findNode,
|
|
169
|
+
firstRoutedHref,
|
|
170
|
+
groupSatelliteNodes,
|
|
171
|
+
isNavVisible,
|
|
172
|
+
stableDocs
|
|
173
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { settings } from "./_context.js";
|
|
2
|
+
const frontmatter = { title: "AI Chat API" };
|
|
3
|
+
const prerender = false;
|
|
4
|
+
const DISABLED_MESSAGE = "This feature is disabled on this demo. Need per project setup to enable this.";
|
|
5
|
+
function jsonResponse(body, status) {
|
|
6
|
+
return new Response(JSON.stringify(body), {
|
|
7
|
+
status,
|
|
8
|
+
headers: { "Content-Type": "application/json" }
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function AiChatHandler() {
|
|
12
|
+
if (settings.aiChatDemoMode === false && settings.aiAssistant) {
|
|
13
|
+
return jsonResponse(
|
|
14
|
+
{ error: "ai-chat handler not provided by the package route (see A1 #2361)" },
|
|
15
|
+
501
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
return jsonResponse({ response: DISABLED_MESSAGE }, 200);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
AiChatHandler as default,
|
|
22
|
+
frontmatter,
|
|
23
|
+
prerender
|
|
24
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
import type { DocPageEntryProps, DocPageAutoIndexProps } from "../doc-page-props/index.js";
|
|
5
|
+
export declare const frontmatter: {
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
type DocPageProps = DocPageEntryProps | DocPageAutoIndexProps;
|
|
9
|
+
export declare function paths(): Array<{
|
|
10
|
+
params: {
|
|
11
|
+
slug: string[];
|
|
12
|
+
};
|
|
13
|
+
props: DocPageProps;
|
|
14
|
+
}>;
|
|
15
|
+
type PageArgs = DocPageProps & {
|
|
16
|
+
params: {
|
|
17
|
+
slug: string[];
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default function DocsPage(props: PageArgs): JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { settings, defaultLocale, resolveNavSource, buildDocRouteEntries } from "./_context.js";
|
|
2
|
+
import { renderDocPage } from "./_chrome.js";
|
|
3
|
+
const frontmatter = { title: "Docs" };
|
|
4
|
+
function paths() {
|
|
5
|
+
const locale = defaultLocale;
|
|
6
|
+
const source = resolveNavSource(locale, void 0);
|
|
7
|
+
return buildDocRouteEntries({
|
|
8
|
+
source,
|
|
9
|
+
locale,
|
|
10
|
+
routeSig: `docs;${locale}`
|
|
11
|
+
}).map((item) => ({
|
|
12
|
+
params: { slug: item.slugParams },
|
|
13
|
+
props: item.props
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
function DocsPage(props) {
|
|
17
|
+
return renderDocPage(props, {
|
|
18
|
+
locale: defaultLocale,
|
|
19
|
+
docHistoryContentDir: settings.docsDir
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
DocsPage as default,
|
|
24
|
+
frontmatter,
|
|
25
|
+
paths
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { defaultLocale } from "./_context.js";
|
|
3
|
+
import { TagsIndexPageView } from "./_chrome.js";
|
|
4
|
+
const frontmatter = { title: "All Tags" };
|
|
5
|
+
function DocsTagsIndexPage() {
|
|
6
|
+
return /* @__PURE__ */ jsx(TagsIndexPageView, { locale: defaultLocale });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
DocsTagsIndexPage as default,
|
|
10
|
+
frontmatter
|
|
11
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
import type { TagInfo } from "../tag-pages/index.js";
|
|
5
|
+
export declare const frontmatter: {
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function paths(): Array<{
|
|
9
|
+
params: {
|
|
10
|
+
tag: string;
|
|
11
|
+
};
|
|
12
|
+
props: {
|
|
13
|
+
tagInfo: TagInfo;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
interface PageProps {
|
|
17
|
+
params: {
|
|
18
|
+
tag: string;
|
|
19
|
+
};
|
|
20
|
+
tagInfo: TagInfo;
|
|
21
|
+
}
|
|
22
|
+
export default function DocTagPage({ params, tagInfo }: PageProps): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { defaultLocale } from "./_context.js";
|
|
3
|
+
import { collectTagMapForLocale, TagDetailPageView } from "./_chrome.js";
|
|
4
|
+
const frontmatter = { title: "Tag" };
|
|
5
|
+
function paths() {
|
|
6
|
+
const tagMap = collectTagMapForLocale(defaultLocale);
|
|
7
|
+
return [...tagMap.entries()].map(([tag, tagInfo]) => ({
|
|
8
|
+
params: { tag },
|
|
9
|
+
props: { tagInfo }
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
function DocTagPage({ params, tagInfo }) {
|
|
13
|
+
return /* @__PURE__ */ jsx(TagDetailPageView, { locale: defaultLocale, tag: params.tag, tagInfo });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
DocTagPage as default,
|
|
17
|
+
frontmatter,
|
|
18
|
+
paths
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { defaultLocale } from "./_context.js";
|
|
3
|
+
import { VersionsPageView } from "./_chrome.js";
|
|
4
|
+
const frontmatter = { title: "Versions" };
|
|
5
|
+
function VersionsPage() {
|
|
6
|
+
return /* @__PURE__ */ jsx(VersionsPageView, { locale: defaultLocale });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
VersionsPage as default,
|
|
10
|
+
frontmatter
|
|
11
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { Island } from "@takazudo/zfb";
|
|
3
|
+
import { DocLayoutWithDefaults } from "../doclayout/index.js";
|
|
4
|
+
import { SiteTreeNav } from "../site-tree-nav-island/index.js";
|
|
5
|
+
import {
|
|
6
|
+
settings,
|
|
7
|
+
defaultLocale,
|
|
8
|
+
t,
|
|
9
|
+
withBase,
|
|
10
|
+
resolveNavSource,
|
|
11
|
+
buildNavTree,
|
|
12
|
+
groupSatelliteNodes,
|
|
13
|
+
getCategoryOrder,
|
|
14
|
+
collectTags,
|
|
15
|
+
docsUrl,
|
|
16
|
+
toRouteSlug
|
|
17
|
+
} from "./_context.js";
|
|
18
|
+
import {
|
|
19
|
+
HeadWithDefaults,
|
|
20
|
+
HeaderWithDefaults,
|
|
21
|
+
FooterWithDefaults,
|
|
22
|
+
BodyEndIslandsStub,
|
|
23
|
+
composeMetaTitle
|
|
24
|
+
} from "./_chrome.js";
|
|
25
|
+
const frontmatter = { title: "Home" };
|
|
26
|
+
function IndexPage() {
|
|
27
|
+
const locale = defaultLocale;
|
|
28
|
+
const { navDocs, categoryMeta } = resolveNavSource(locale, void 0);
|
|
29
|
+
const tree = buildNavTree(
|
|
30
|
+
navDocs,
|
|
31
|
+
locale,
|
|
32
|
+
categoryMeta,
|
|
33
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
34
|
+
);
|
|
35
|
+
const categoryOrder = getCategoryOrder();
|
|
36
|
+
const groupedTree = groupSatelliteNodes(tree, categoryOrder);
|
|
37
|
+
const tagCount = collectTags(
|
|
38
|
+
navDocs.filter((d) => !d.data.category_no_page),
|
|
39
|
+
(id, data) => data.slug ?? toRouteSlug(id)
|
|
40
|
+
).size;
|
|
41
|
+
const ctaNav = settings.headerNav[0] ?? null;
|
|
42
|
+
const overview = ctaNav ? withBase(ctaNav.path) : null;
|
|
43
|
+
const logoUrl = withBase("/img/logo.svg");
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
DocLayoutWithDefaults,
|
|
46
|
+
{
|
|
47
|
+
title: composeMetaTitle(settings.siteName),
|
|
48
|
+
head: /* @__PURE__ */ jsx(HeadWithDefaults, { title: settings.siteName }),
|
|
49
|
+
lang: locale,
|
|
50
|
+
noindex: settings.noindex,
|
|
51
|
+
hideSidebar: true,
|
|
52
|
+
hideToc: true,
|
|
53
|
+
sidebarOverride: /* @__PURE__ */ jsx(Fragment, {}),
|
|
54
|
+
headerOverride: /* @__PURE__ */ jsx(HeaderWithDefaults, { lang: locale, currentPath: withBase("/") }),
|
|
55
|
+
footerOverride: /* @__PURE__ */ jsx(FooterWithDefaults, { lang: locale }),
|
|
56
|
+
bodyEndComponents: /* @__PURE__ */ jsx(BodyEndIslandsStub, { basePath: settings.base ?? "/" }),
|
|
57
|
+
enableClientRouter: settings.dynamicPageTransition,
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx("div", { class: "flex justify-center mb-vsp-xl", children: /* @__PURE__ */ jsxs("div", { class: "flex flex-col items-center text-center gap-hsp-md lg:flex-row lg:text-left lg:gap-hsp-xl", children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
class: "w-[320px] max-w-full aspect-[1200/630] bg-fg shrink-0",
|
|
64
|
+
style: {
|
|
65
|
+
WebkitMask: `url(${logoUrl}) center/contain no-repeat`,
|
|
66
|
+
mask: `url(${logoUrl}) center/contain no-repeat`
|
|
67
|
+
},
|
|
68
|
+
"aria-hidden": "true"
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
72
|
+
/* @__PURE__ */ jsx("h1", { class: "text-heading font-bold mb-vsp-2xs", children: settings.siteName }),
|
|
73
|
+
/* @__PURE__ */ jsx("p", { class: "text-muted text-small mb-vsp-sm", children: settings.siteDescription }),
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { class: "flex items-center justify-center lg:justify-start gap-hsp-md text-small", children: [
|
|
75
|
+
overview && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
76
|
+
/* @__PURE__ */ jsx("a", { href: overview, class: "text-fg underline hover:text-accent", children: t("nav.overview", locale) }),
|
|
77
|
+
/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" })
|
|
78
|
+
] }),
|
|
79
|
+
settings.githubUrl && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
"a",
|
|
82
|
+
{
|
|
83
|
+
href: settings.githubUrl,
|
|
84
|
+
class: "inline-flex items-center gap-[0.3em] text-fg underline hover:text-accent",
|
|
85
|
+
target: "_blank",
|
|
86
|
+
rel: "noopener noreferrer",
|
|
87
|
+
children: "GitHub"
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx("span", { class: "text-muted", children: "/" })
|
|
91
|
+
] })
|
|
92
|
+
] })
|
|
93
|
+
] })
|
|
94
|
+
] }) }),
|
|
95
|
+
Island({
|
|
96
|
+
when: "idle",
|
|
97
|
+
children: /* @__PURE__ */ jsx(
|
|
98
|
+
SiteTreeNav,
|
|
99
|
+
{
|
|
100
|
+
tree: groupedTree,
|
|
101
|
+
categoryOrder,
|
|
102
|
+
categoryIgnore: ["inbox", "develop"]
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}),
|
|
106
|
+
settings.docTags && tagCount > 0 && /* @__PURE__ */ jsxs("section", { class: "mt-vsp-xl", children: [
|
|
107
|
+
/* @__PURE__ */ jsx("h2", { class: "text-title font-bold mb-vsp-md", children: t("doc.allTags", locale) }),
|
|
108
|
+
/* @__PURE__ */ jsx("a", { href: withBase("/docs/tags"), class: "text-accent underline hover:text-accent-hover", children: t("doc.allTags", locale) })
|
|
109
|
+
] })
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
IndexPage as default,
|
|
116
|
+
frontmatter
|
|
117
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
import type { DocPageEntryProps, DocPageAutoIndexProps } from "../doc-page-props/index.js";
|
|
5
|
+
export declare const frontmatter: {
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
interface LocaleDocPageExtra {
|
|
9
|
+
contentDir: string;
|
|
10
|
+
isFallback: boolean;
|
|
11
|
+
}
|
|
12
|
+
type DocPageProps = (DocPageEntryProps & LocaleDocPageExtra) | (DocPageAutoIndexProps & LocaleDocPageExtra);
|
|
13
|
+
export declare function paths(): Array<{
|
|
14
|
+
params: {
|
|
15
|
+
locale: string;
|
|
16
|
+
slug: string[];
|
|
17
|
+
};
|
|
18
|
+
props: DocPageProps;
|
|
19
|
+
}>;
|
|
20
|
+
type PageArgs = DocPageProps & {
|
|
21
|
+
params: {
|
|
22
|
+
locale: string;
|
|
23
|
+
slug: string[];
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export default function LocaleDocsPage(props: PageArgs): JSX.Element;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { settings, getLocaleConfig, resolveNavSource, buildDocRouteEntries } from "./_context.js";
|
|
2
|
+
import { renderDocPage } from "./_chrome.js";
|
|
3
|
+
const frontmatter = { title: "Docs" };
|
|
4
|
+
function paths() {
|
|
5
|
+
const result = [];
|
|
6
|
+
for (const locale of Object.keys(settings.locales)) {
|
|
7
|
+
const contentDir = getLocaleConfig(locale)?.dir ?? settings.docsDir;
|
|
8
|
+
const source = resolveNavSource(locale, void 0, {
|
|
9
|
+
applyDefaultLocaleOnlyFilter: true,
|
|
10
|
+
keepUnlisted: true
|
|
11
|
+
});
|
|
12
|
+
for (const item of buildDocRouteEntries({
|
|
13
|
+
source,
|
|
14
|
+
locale,
|
|
15
|
+
routeSig: `locale-docs;${locale}`
|
|
16
|
+
})) {
|
|
17
|
+
const extra = {
|
|
18
|
+
contentDir: item.isFallback ? settings.docsDir : contentDir,
|
|
19
|
+
isFallback: item.isFallback
|
|
20
|
+
};
|
|
21
|
+
result.push({
|
|
22
|
+
params: { locale, slug: item.slugParams },
|
|
23
|
+
props: { ...item.props, ...extra }
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
29
|
+
function LocaleDocsPage(props) {
|
|
30
|
+
return renderDocPage(props, {
|
|
31
|
+
locale: props.params.locale,
|
|
32
|
+
isFallback: props.isFallback,
|
|
33
|
+
docHistoryContentDir: props.contentDir
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
LocaleDocsPage as default,
|
|
38
|
+
frontmatter,
|
|
39
|
+
paths
|
|
40
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
export declare const frontmatter: {
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function paths(): Array<{
|
|
8
|
+
params: {
|
|
9
|
+
locale: string;
|
|
10
|
+
};
|
|
11
|
+
}>;
|
|
12
|
+
interface PageProps {
|
|
13
|
+
params: {
|
|
14
|
+
locale: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export default function LocaleTagsIndexPage({ params }: PageProps): JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { settings } from "./_context.js";
|
|
3
|
+
import { TagsIndexPageView } from "./_chrome.js";
|
|
4
|
+
const frontmatter = { title: "All Tags" };
|
|
5
|
+
function paths() {
|
|
6
|
+
return Object.keys(settings.locales).map((locale) => ({ params: { locale } }));
|
|
7
|
+
}
|
|
8
|
+
function LocaleTagsIndexPage({ params }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(TagsIndexPageView, { locale: params.locale });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
LocaleTagsIndexPage as default,
|
|
13
|
+
frontmatter,
|
|
14
|
+
paths
|
|
15
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX } from "preact";
|
|
4
|
+
import type { TagInfo } from "../tag-pages/index.js";
|
|
5
|
+
export declare const frontmatter: {
|
|
6
|
+
title: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function paths(): Array<{
|
|
9
|
+
params: {
|
|
10
|
+
locale: string;
|
|
11
|
+
tag: string;
|
|
12
|
+
};
|
|
13
|
+
props: {
|
|
14
|
+
tagInfo: TagInfo;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
interface PageProps {
|
|
18
|
+
params: {
|
|
19
|
+
locale: string;
|
|
20
|
+
tag: string;
|
|
21
|
+
};
|
|
22
|
+
tagInfo: TagInfo;
|
|
23
|
+
}
|
|
24
|
+
export default function LocaleDocTagPage({ params, tagInfo }: PageProps): JSX.Element;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { settings } from "./_context.js";
|
|
3
|
+
import { collectTagMapForLocale, TagDetailPageView } from "./_chrome.js";
|
|
4
|
+
const frontmatter = { title: "Tag" };
|
|
5
|
+
function paths() {
|
|
6
|
+
const result = [];
|
|
7
|
+
for (const locale of Object.keys(settings.locales)) {
|
|
8
|
+
const tagMap = collectTagMapForLocale(locale);
|
|
9
|
+
for (const [tag, tagInfo] of tagMap.entries()) {
|
|
10
|
+
result.push({ params: { locale, tag }, props: { tagInfo } });
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
function LocaleDocTagPage({ params, tagInfo }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(TagDetailPageView, { locale: params.locale, tag: params.tag, tagInfo });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
LocaleDocTagPage as default,
|
|
20
|
+
frontmatter,
|
|
21
|
+
paths
|
|
22
|
+
};
|