@takazudo/zudo-doc 0.2.22 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,32 @@
|
|
|
1
|
+
/** @jsxRuntime automatic */
|
|
2
|
+
/** @jsxImportSource preact */
|
|
3
|
+
import type { JSX, VNode } from "preact";
|
|
4
|
+
import type { DocNavNode } from "./_docs-helpers.js";
|
|
5
|
+
/** Package no-op body-end islands. The host's `BodyEndIslands` wires project
|
|
6
|
+
* island bootstraps (client-router / design-token-panel) that cannot live in
|
|
7
|
+
* the package; the package default renders nothing. */
|
|
8
|
+
declare function BodyEndIslandsStub(_props: {
|
|
9
|
+
basePath: string;
|
|
10
|
+
}): JSX.Element;
|
|
11
|
+
export declare const composeMetaTitle: (title: string) => string;
|
|
12
|
+
export declare const HeadWithDefaults: (props: import("../head-with-defaults/index.js").HeadWithDefaultsProps) => JSX.Element;
|
|
13
|
+
export declare const HeaderWithDefaults: (props: import("../header-with-defaults/index.js").HeaderWithDefaultsProps) => JSX.Element;
|
|
14
|
+
export declare const FooterWithDefaults: (props: {
|
|
15
|
+
lang?: string;
|
|
16
|
+
}) => VNode;
|
|
17
|
+
export declare const SidebarWithDefaults: (props: import("../sidebar-with-defaults/index.js").SidebarWithDefaultsProps) => JSX.Element;
|
|
18
|
+
declare const SiteTreeNavWrapper: (props: import("../site-tree-nav/index.js").SiteTreeNavWrapperProps) => JSX.Element | null;
|
|
19
|
+
export declare function createMdxComponentsBound(lang?: string): Record<string, unknown>;
|
|
20
|
+
export declare const renderDocPage: (props: import("../doc-page-props/index.js").DocPageBaseProps, opts: import("../doc-page-renderer/index.js").RenderDocPageOptions) => JSX.Element;
|
|
21
|
+
export declare const VersionsPageView: (props: import("../versions-page/index.js").VersionsPageViewProps) => JSX.Element;
|
|
22
|
+
export declare const collectTagMapForLocale: (locale: string) => Map<string, import("../tag-pages/index.js").TagInfo>, TagDetailPageView: (props: {
|
|
23
|
+
locale: string;
|
|
24
|
+
tag: string;
|
|
25
|
+
tagInfo: import("../tag-pages/index.js").TagInfo;
|
|
26
|
+
}) => JSX.Element, TagsIndexPageView: (props: {
|
|
27
|
+
locale: string;
|
|
28
|
+
children?: import("preact").ComponentChildren;
|
|
29
|
+
}) => JSX.Element;
|
|
30
|
+
export { SiteTreeNavWrapper, BodyEndIslandsStub };
|
|
31
|
+
export { buildDocRouteEntries, } from "./_context.js";
|
|
32
|
+
export type { DocNavNode };
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { Fragment, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
settings,
|
|
4
|
+
defaultLocale,
|
|
5
|
+
locales,
|
|
6
|
+
t,
|
|
7
|
+
withBase,
|
|
8
|
+
stripBase,
|
|
9
|
+
docsUrl,
|
|
10
|
+
versionedDocsUrl,
|
|
11
|
+
absoluteUrl,
|
|
12
|
+
navHref,
|
|
13
|
+
buildLocaleLinks,
|
|
14
|
+
getNavSectionForSlug,
|
|
15
|
+
getCategoryOrder,
|
|
16
|
+
toRouteSlug,
|
|
17
|
+
resolveNavSource,
|
|
18
|
+
loadNavSourceDocs,
|
|
19
|
+
buildNavTree,
|
|
20
|
+
groupSatelliteNodes,
|
|
21
|
+
collectAutoIndexNodes,
|
|
22
|
+
findNode,
|
|
23
|
+
firstRoutedHref,
|
|
24
|
+
collectTags,
|
|
25
|
+
stableDocs
|
|
26
|
+
} from "./_context.js";
|
|
27
|
+
import { createComposeMetaTitle } from "../compose-meta-title/index.js";
|
|
28
|
+
import {
|
|
29
|
+
generateCssCustomProperties,
|
|
30
|
+
generateLightDarkCssProperties
|
|
31
|
+
} from "../color-scheme-utils.js";
|
|
32
|
+
import { createHeadWithDefaults } from "../head-with-defaults/index.js";
|
|
33
|
+
import { createHeaderWithDefaults } from "../header-with-defaults/index.js";
|
|
34
|
+
import { createFooterWithDefaults } from "../footer-with-defaults/index.js";
|
|
35
|
+
import { createSidebarWithDefaults } from "../sidebar-with-defaults/index.js";
|
|
36
|
+
import { createSidebarPrepaint } from "../sidebar-prepaint/index.js";
|
|
37
|
+
import { createDocBodyEnd } from "../doc-body-end/index.js";
|
|
38
|
+
import { createDocPager } from "../doc-pager/index.js";
|
|
39
|
+
import { createDocPageShell } from "../doc-page-shell/index.js";
|
|
40
|
+
import { createDocContentHeader } from "../doc-content-header/index.js";
|
|
41
|
+
import { createDocMetainfoArea } from "../doc-metainfo-area/index.js";
|
|
42
|
+
import { createDocTagsArea } from "../doc-tags-area/index.js";
|
|
43
|
+
import { createDocHistoryArea } from "../doc-history-area/index.js";
|
|
44
|
+
import { createInlineVersionSwitcher } from "../inline-version-switcher/index.js";
|
|
45
|
+
import { createRenderDocPage } from "../doc-page-renderer/index.js";
|
|
46
|
+
import { createVersionsPageView } from "../versions-page/index.js";
|
|
47
|
+
import { createTagPages } from "../tag-pages/index.js";
|
|
48
|
+
import { createMdxComponents } from "../mdx-components/index.js";
|
|
49
|
+
import { createCategoryNavWrapper } from "../category-nav/index.js";
|
|
50
|
+
import { createCategoryTreeNavWrapper } from "../category-tree-nav/index.js";
|
|
51
|
+
import { createSiteTreeNavWrapper } from "../site-tree-nav/index.js";
|
|
52
|
+
import { getTocTitle } from "../toc/index.js";
|
|
53
|
+
import { SearchWidget } from "../search-widget/index.js";
|
|
54
|
+
import { buildGitHubRepoUrl, buildGitHubSourceUrl } from "../github-helpers/index.js";
|
|
55
|
+
import { toHistorySlug } from "../slug/index.js";
|
|
56
|
+
import {
|
|
57
|
+
buildRootMenuItems as buildRootMenuItemsBase,
|
|
58
|
+
buildLocaleLinksForNav as buildLocaleLinksForNavBase,
|
|
59
|
+
remapVersionedHrefs,
|
|
60
|
+
getThemeDefaultMode as getThemeDefaultModeBase
|
|
61
|
+
} from "../nav-data-prep/index.js";
|
|
62
|
+
import { buildSidebarForSection } from "../sidebar-utils/index.js";
|
|
63
|
+
const GREY_RAMP = [
|
|
64
|
+
"#000000",
|
|
65
|
+
"#1a1a1a",
|
|
66
|
+
"#333333",
|
|
67
|
+
"#4d4d4d",
|
|
68
|
+
"#666666",
|
|
69
|
+
"#808080",
|
|
70
|
+
"#999999",
|
|
71
|
+
"#b3b3b3",
|
|
72
|
+
"#cccccc",
|
|
73
|
+
"#d9d9d9",
|
|
74
|
+
"#e6e6e6",
|
|
75
|
+
"#f2f2f2",
|
|
76
|
+
"#ff5555",
|
|
77
|
+
"#50fa7b",
|
|
78
|
+
"#f1fa8c",
|
|
79
|
+
"#8be9fd"
|
|
80
|
+
];
|
|
81
|
+
const DEFAULT_SCHEME = {
|
|
82
|
+
background: "#000000",
|
|
83
|
+
foreground: "#ffffff",
|
|
84
|
+
cursor: "#ffffff",
|
|
85
|
+
selectionBg: "#444444",
|
|
86
|
+
selectionFg: "#ffffff",
|
|
87
|
+
palette: GREY_RAMP
|
|
88
|
+
};
|
|
89
|
+
const docHistoryMeta = {};
|
|
90
|
+
const sidebarsConfig = {};
|
|
91
|
+
function BodyEndIslandsStub(_props) {
|
|
92
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
93
|
+
}
|
|
94
|
+
function DocHistoryStub(_props) {
|
|
95
|
+
return /* @__PURE__ */ jsx(Fragment, {});
|
|
96
|
+
}
|
|
97
|
+
function SearchWidgetBound(props) {
|
|
98
|
+
return SearchWidget({ ...props, base: withBase("/") });
|
|
99
|
+
}
|
|
100
|
+
const composeMetaTitle = createComposeMetaTitle(settings.siteName);
|
|
101
|
+
const HeadWithDefaults = createHeadWithDefaults({
|
|
102
|
+
settings,
|
|
103
|
+
composeMetaTitle,
|
|
104
|
+
withBase,
|
|
105
|
+
absoluteUrl,
|
|
106
|
+
generateCssCustomProperties: () => generateCssCustomProperties(DEFAULT_SCHEME),
|
|
107
|
+
generateLightDarkCssProperties: () => generateLightDarkCssProperties(DEFAULT_SCHEME, DEFAULT_SCHEME)
|
|
108
|
+
});
|
|
109
|
+
function buildRootMenuItems(lang, currentVersion) {
|
|
110
|
+
return buildRootMenuItemsBase(
|
|
111
|
+
lang,
|
|
112
|
+
currentVersion,
|
|
113
|
+
settings.headerNav,
|
|
114
|
+
(key, l) => t(key, l),
|
|
115
|
+
(path, l, v) => navHref(path, l, v)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function buildLocaleLinksForNav(currentPath, lang, localeCount) {
|
|
119
|
+
return buildLocaleLinksForNavBase(
|
|
120
|
+
currentPath,
|
|
121
|
+
lang,
|
|
122
|
+
localeCount,
|
|
123
|
+
(path, l) => buildLocaleLinks(path, l)
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function buildSidebarNodes(lang, navSection, currentVersion, emptyWhenUnsectioned = true) {
|
|
127
|
+
if (navSection === void 0 && emptyWhenUnsectioned) return [];
|
|
128
|
+
const { navDocs, categoryMeta } = loadNavSourceDocs(lang, currentVersion);
|
|
129
|
+
const explicitPrefixes = getCategoryOrder().filter((cm) => cm !== "!");
|
|
130
|
+
const rawNodes = buildSidebarForSection(
|
|
131
|
+
navDocs,
|
|
132
|
+
lang,
|
|
133
|
+
navSection,
|
|
134
|
+
categoryMeta,
|
|
135
|
+
sidebarsConfig,
|
|
136
|
+
(d, l, meta) => buildNavTree(
|
|
137
|
+
d,
|
|
138
|
+
l,
|
|
139
|
+
meta,
|
|
140
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
141
|
+
),
|
|
142
|
+
explicitPrefixes
|
|
143
|
+
);
|
|
144
|
+
return currentVersion ? remapVersionedHrefs(
|
|
145
|
+
rawNodes,
|
|
146
|
+
currentVersion,
|
|
147
|
+
lang,
|
|
148
|
+
(slug, v, l) => versionedDocsUrl(slug, v, l)
|
|
149
|
+
) : rawNodes;
|
|
150
|
+
}
|
|
151
|
+
function getThemeDefaultMode() {
|
|
152
|
+
return getThemeDefaultModeBase(settings.colorMode);
|
|
153
|
+
}
|
|
154
|
+
const HeaderWithDefaults = createHeaderWithDefaults({
|
|
155
|
+
settings,
|
|
156
|
+
defaultLocale,
|
|
157
|
+
locales,
|
|
158
|
+
t,
|
|
159
|
+
withBase,
|
|
160
|
+
stripBase,
|
|
161
|
+
docsUrl,
|
|
162
|
+
navHref,
|
|
163
|
+
versionedDocsUrl,
|
|
164
|
+
buildLocaleLinksForNav,
|
|
165
|
+
buildRootMenuItems,
|
|
166
|
+
buildSidebarNodes,
|
|
167
|
+
getThemeDefaultMode,
|
|
168
|
+
buildGitHubRepoUrl: () => buildGitHubRepoUrl(settings.githubUrl),
|
|
169
|
+
SearchWidget: SearchWidgetBound
|
|
170
|
+
});
|
|
171
|
+
const FooterWithDefaults = createFooterWithDefaults({
|
|
172
|
+
settings,
|
|
173
|
+
defaultLocale,
|
|
174
|
+
tagVocabulary: [],
|
|
175
|
+
isExternal: (href) => /^https?:\/\//.test(href),
|
|
176
|
+
resolveHref: (href) => /^https?:\/\//.test(href) ? href : withBase(href),
|
|
177
|
+
withBase,
|
|
178
|
+
// The footer taglist is host-bound (project tag aggregation); package default
|
|
179
|
+
// renders no tag columns.
|
|
180
|
+
loadTagsForLocale: () => []
|
|
181
|
+
});
|
|
182
|
+
const SidebarWithDefaults = createSidebarWithDefaults({
|
|
183
|
+
defaultLocale,
|
|
184
|
+
localeCount: locales.length,
|
|
185
|
+
buildRootMenuItems,
|
|
186
|
+
buildLocaleLinksForNav,
|
|
187
|
+
buildSidebarNodes,
|
|
188
|
+
getThemeDefaultMode,
|
|
189
|
+
t
|
|
190
|
+
});
|
|
191
|
+
const SidebarPrepaint = createSidebarPrepaint({ sidebarToggle: settings.sidebarToggle });
|
|
192
|
+
const DocBodyEnd = createDocBodyEnd({ settings, BodyEndIslands: BodyEndIslandsStub });
|
|
193
|
+
const DocPager = createDocPager({ t });
|
|
194
|
+
const DocMetainfoArea = createDocMetainfoArea({
|
|
195
|
+
settings,
|
|
196
|
+
defaultLocale,
|
|
197
|
+
docHistoryMeta,
|
|
198
|
+
t,
|
|
199
|
+
toHistorySlug
|
|
200
|
+
});
|
|
201
|
+
const DocTagsArea = createDocTagsArea({
|
|
202
|
+
settings,
|
|
203
|
+
defaultLocale,
|
|
204
|
+
tagVocabularyEntries: [],
|
|
205
|
+
tagHref: (tag, locale) => {
|
|
206
|
+
const encoded = encodeURIComponent(tag);
|
|
207
|
+
return withBase(
|
|
208
|
+
locale === defaultLocale ? `/docs/tags/${encoded}` : `/${locale}/docs/tags/${encoded}`
|
|
209
|
+
);
|
|
210
|
+
},
|
|
211
|
+
t
|
|
212
|
+
});
|
|
213
|
+
const DocContentHeader = createDocContentHeader({
|
|
214
|
+
t,
|
|
215
|
+
buildFrontmatterPreviewEntries: () => [],
|
|
216
|
+
frontmatterRenderers: {},
|
|
217
|
+
DocMetainfoArea,
|
|
218
|
+
DocTagsArea
|
|
219
|
+
});
|
|
220
|
+
const DocHistoryArea = createDocHistoryArea({
|
|
221
|
+
settings,
|
|
222
|
+
defaultLocale,
|
|
223
|
+
docHistoryMeta,
|
|
224
|
+
t,
|
|
225
|
+
toHistorySlug,
|
|
226
|
+
buildGitHubSourceUrl: (contentDir, entryId) => buildGitHubSourceUrl(settings.githubUrl, contentDir, entryId),
|
|
227
|
+
DocHistory: DocHistoryStub
|
|
228
|
+
});
|
|
229
|
+
const buildInlineVersionSwitcher = createInlineVersionSwitcher({
|
|
230
|
+
settings,
|
|
231
|
+
defaultLocale,
|
|
232
|
+
t,
|
|
233
|
+
docsUrl,
|
|
234
|
+
versionedDocsUrl,
|
|
235
|
+
withBase
|
|
236
|
+
});
|
|
237
|
+
const CategoryNavWrapper = createCategoryNavWrapper({
|
|
238
|
+
defaultLocale,
|
|
239
|
+
resolveNavSource,
|
|
240
|
+
buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
|
|
241
|
+
docs,
|
|
242
|
+
locale,
|
|
243
|
+
categoryMeta,
|
|
244
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
245
|
+
)),
|
|
246
|
+
findNode,
|
|
247
|
+
firstRoutedHref
|
|
248
|
+
});
|
|
249
|
+
const CategoryTreeNavWrapper = createCategoryTreeNavWrapper({
|
|
250
|
+
defaultLocale,
|
|
251
|
+
resolveNavSource,
|
|
252
|
+
buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
|
|
253
|
+
docs,
|
|
254
|
+
locale,
|
|
255
|
+
categoryMeta,
|
|
256
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
257
|
+
)),
|
|
258
|
+
groupSatelliteNodes,
|
|
259
|
+
findNode
|
|
260
|
+
});
|
|
261
|
+
const SiteTreeNavWrapper = createSiteTreeNavWrapper({
|
|
262
|
+
defaultLocale,
|
|
263
|
+
resolveNavSource,
|
|
264
|
+
buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
|
|
265
|
+
docs,
|
|
266
|
+
locale,
|
|
267
|
+
categoryMeta,
|
|
268
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
269
|
+
)),
|
|
270
|
+
groupSatelliteNodes,
|
|
271
|
+
getCategoryOrder
|
|
272
|
+
});
|
|
273
|
+
function createMdxComponentsBound(lang = defaultLocale) {
|
|
274
|
+
return createMdxComponents({
|
|
275
|
+
settings,
|
|
276
|
+
locale: lang,
|
|
277
|
+
navData: {
|
|
278
|
+
CategoryNav: CategoryNavWrapper,
|
|
279
|
+
CategoryTreeNav: CategoryTreeNavWrapper,
|
|
280
|
+
SiteTreeNav: SiteTreeNavWrapper
|
|
281
|
+
},
|
|
282
|
+
// PresetGenerator and other showcase-only slots resolve to a package stub
|
|
283
|
+
// (render nothing) — they are project-bound and not in the package.
|
|
284
|
+
extras: {
|
|
285
|
+
PresetGenerator: (_props) => null
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
const DocPageShell = createDocPageShell({
|
|
290
|
+
settings,
|
|
291
|
+
composeMetaTitle,
|
|
292
|
+
getTocTitle,
|
|
293
|
+
HeadWithDefaults,
|
|
294
|
+
SidebarWithDefaults,
|
|
295
|
+
HeaderWithDefaults,
|
|
296
|
+
FooterWithDefaults,
|
|
297
|
+
SidebarPrepaint,
|
|
298
|
+
DocBodyEnd,
|
|
299
|
+
DocPager
|
|
300
|
+
});
|
|
301
|
+
const renderDocPage = createRenderDocPage({
|
|
302
|
+
docsUrl,
|
|
303
|
+
versionedDocsUrl,
|
|
304
|
+
absoluteUrl,
|
|
305
|
+
getNavSectionForSlug,
|
|
306
|
+
toRouteSlug,
|
|
307
|
+
createMdxComponents: createMdxComponentsBound,
|
|
308
|
+
t,
|
|
309
|
+
buildInlineVersionSwitcher,
|
|
310
|
+
DocPageShell,
|
|
311
|
+
DocContentHeader,
|
|
312
|
+
DocMetainfoArea,
|
|
313
|
+
DocHistoryArea
|
|
314
|
+
});
|
|
315
|
+
const VersionsPageView = createVersionsPageView({
|
|
316
|
+
settings,
|
|
317
|
+
defaultLocale,
|
|
318
|
+
t,
|
|
319
|
+
withBase,
|
|
320
|
+
composeMetaTitle,
|
|
321
|
+
components: {
|
|
322
|
+
HeadWithDefaults,
|
|
323
|
+
HeaderWithDefaults,
|
|
324
|
+
FooterWithDefaults,
|
|
325
|
+
BodyEndIslands: BodyEndIslandsStub
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
const tagPages = createTagPages({
|
|
329
|
+
settings,
|
|
330
|
+
defaultLocale,
|
|
331
|
+
t,
|
|
332
|
+
withBase,
|
|
333
|
+
docsUrl,
|
|
334
|
+
composeMetaTitle,
|
|
335
|
+
collectTags,
|
|
336
|
+
stableDocs,
|
|
337
|
+
isDefaultLocaleOnlyPath: void 0,
|
|
338
|
+
components: {
|
|
339
|
+
HeadWithDefaults,
|
|
340
|
+
HeaderWithDefaults,
|
|
341
|
+
FooterWithDefaults,
|
|
342
|
+
BodyEndIslands: BodyEndIslandsStub,
|
|
343
|
+
DocHistoryArea
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
const { collectTagMapForLocale, TagDetailPageView, TagsIndexPageView } = tagPages;
|
|
347
|
+
import {
|
|
348
|
+
buildDocRouteEntries
|
|
349
|
+
} from "./_context.js";
|
|
350
|
+
export {
|
|
351
|
+
BodyEndIslandsStub,
|
|
352
|
+
FooterWithDefaults,
|
|
353
|
+
HeadWithDefaults,
|
|
354
|
+
HeaderWithDefaults,
|
|
355
|
+
SidebarWithDefaults,
|
|
356
|
+
SiteTreeNavWrapper,
|
|
357
|
+
TagDetailPageView,
|
|
358
|
+
TagsIndexPageView,
|
|
359
|
+
VersionsPageView,
|
|
360
|
+
buildDocRouteEntries,
|
|
361
|
+
collectTagMapForLocale,
|
|
362
|
+
composeMetaTitle,
|
|
363
|
+
createMdxComponentsBound,
|
|
364
|
+
renderDocPage
|
|
365
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Settings } from "../settings.js";
|
|
2
|
+
import type { FactoryI18n } from "../factory-context/index.js";
|
|
3
|
+
import { type UrlHelpers } from "../url-helpers/index.js";
|
|
4
|
+
import { toRouteSlug, toSlugParams } from "../slug/index.js";
|
|
5
|
+
import { type TagVocabularyEntry } from "../tag-helpers/index.js";
|
|
6
|
+
import type { DocNavNode } from "../doc-page-props/index.js";
|
|
7
|
+
import type { HeadingItem } from "../extract-headings/index.js";
|
|
8
|
+
import { stableDocs, isNavVisible, buildNavTree, collectAutoIndexNodes, groupSatelliteNodes, findNode, firstRoutedHref } from "./_docs-helpers.js";
|
|
9
|
+
export interface RouteContextPayload {
|
|
10
|
+
settings: Settings;
|
|
11
|
+
translations: Record<string, Record<string, string>>;
|
|
12
|
+
tagVocabulary: readonly TagVocabularyEntry[];
|
|
13
|
+
}
|
|
14
|
+
/** The serializable route-context (from the virtual module). */
|
|
15
|
+
export declare const ctx: RouteContextPayload;
|
|
16
|
+
export declare const settings: Settings;
|
|
17
|
+
export declare const defaultLocale: string;
|
|
18
|
+
export declare const locales: readonly string[];
|
|
19
|
+
export declare function getLocaleConfig(locale: string): {
|
|
20
|
+
label: string;
|
|
21
|
+
dir: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
export declare function getLocaleLabel(locale: string): string;
|
|
24
|
+
export declare function t(key: string, locale?: string): string;
|
|
25
|
+
export declare const i18n: FactoryI18n;
|
|
26
|
+
export declare const urlHelpers: UrlHelpers;
|
|
27
|
+
export declare const withBase: (path: string) => string, stripBase: (path: string) => string, docsUrl: (slug: string, lang?: string) => string, versionedDocsUrl: (slug: string, versionSlug: string, lang?: string) => string, navHref: (path: string, lang: string | undefined, currentVersion: string | undefined) => string, isDefaultLocaleOnlyPath: (path: string) => boolean, absoluteUrl: (pageUrl: string) => string | undefined, isExternal: (href: string) => boolean, resolveHref: (href: string) => string, buildLocaleLinks: (currentPath: string, currentLang: string) => import("../url-helpers/index.js").LocaleLink[];
|
|
28
|
+
export declare function getCategoryOrder(): string[];
|
|
29
|
+
export declare function getNavSectionForSlug(slug: string): string | undefined;
|
|
30
|
+
export declare function getNavSubtree(tree: DocNavNode[], categoryMatch?: string): DocNavNode[];
|
|
31
|
+
export declare function extractHeadings(body: string): HeadingItem[];
|
|
32
|
+
export interface TagInfo {
|
|
33
|
+
tag: string;
|
|
34
|
+
count: number;
|
|
35
|
+
docs: {
|
|
36
|
+
slug: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
}[];
|
|
40
|
+
}
|
|
41
|
+
export declare function resolveTagBound(raw: string): import("../tag-helpers/index.js").ResolvedTag;
|
|
42
|
+
export declare function collectTags(entries: ReadonlyArray<{
|
|
43
|
+
id: string;
|
|
44
|
+
data: {
|
|
45
|
+
slug?: string;
|
|
46
|
+
title?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
tags?: string[];
|
|
49
|
+
};
|
|
50
|
+
}>, slugFn: (id: string, data: {
|
|
51
|
+
slug?: string;
|
|
52
|
+
}) => string): Map<string, TagInfo>;
|
|
53
|
+
export declare const resolveNavSource: (lang: string, currentVersion: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, resolveVersionedLocaleSource: (versionSlug: string, versionDocsDir: string | undefined, lang: string, localeDir: string | undefined, options?: import("../nav-source-docs/index.js").NavSourceOptions) => import("../nav-source-docs/index.js").NavSourceDocs, loadNavSourceDocs: (lang: string, currentVersion: string | undefined) => import("../nav-source-docs/index.js").NavSourceDocs;
|
|
54
|
+
export declare const buildDocRouteEntries: (args: import("../doc-route-entries/index.js").BuildDocRouteEntriesArgs) => import("../doc-route-entries/index.js").DocRouteEntry[];
|
|
55
|
+
export declare const enumerateDocsRoutes: (locale: string) => string[], enumerateTagsRoutes: (locale: string) => string[], enumerateVersionedRoutes: (version: import("../route-enumerators/index.js").VersionConfigForEnum, locale: string) => string[], enumerateAllRoutes: () => Map<string, string>;
|
|
56
|
+
export { buildNavTree, groupSatelliteNodes, findNode, firstRoutedHref, collectAutoIndexNodes, isNavVisible, stableDocs, toRouteSlug, toSlugParams, };
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { routeContext } from "virtual:zudo-doc-route-context";
|
|
2
|
+
import { makeUrlHelpers } from "../url-helpers/index.js";
|
|
3
|
+
import {
|
|
4
|
+
loadCategoryMeta
|
|
5
|
+
} from "../sidebar-tree/index.js";
|
|
6
|
+
import { extractHeadings as extractHeadingsBase } from "../extract-headings/index.js";
|
|
7
|
+
import { toRouteSlug, toSlugParams } from "../slug/index.js";
|
|
8
|
+
import { resolveTag } from "../tag-helpers/index.js";
|
|
9
|
+
import {
|
|
10
|
+
getCategoryOrder as getCategoryOrderBase,
|
|
11
|
+
getNavSectionForSlug as getNavSectionForSlugBase,
|
|
12
|
+
getNavSubtree as getNavSubtreeBase
|
|
13
|
+
} from "../nav-scope/index.js";
|
|
14
|
+
import { mergeLocaleDocs } from "../locale-merge/index.js";
|
|
15
|
+
import {
|
|
16
|
+
createNavSourceDocs
|
|
17
|
+
} from "../nav-source-docs/index.js";
|
|
18
|
+
import {
|
|
19
|
+
createDocRouteEntries
|
|
20
|
+
} from "../doc-route-entries/index.js";
|
|
21
|
+
import {
|
|
22
|
+
createRouteEnumerators
|
|
23
|
+
} from "../route-enumerators/index.js";
|
|
24
|
+
import {
|
|
25
|
+
stableDocs,
|
|
26
|
+
isNavVisible,
|
|
27
|
+
buildNavTree,
|
|
28
|
+
buildBreadcrumbs,
|
|
29
|
+
collectAutoIndexNodes,
|
|
30
|
+
groupSatelliteNodes,
|
|
31
|
+
findNode,
|
|
32
|
+
firstRoutedHref
|
|
33
|
+
} from "./_docs-helpers.js";
|
|
34
|
+
const ctx = routeContext;
|
|
35
|
+
const settings = ctx.settings;
|
|
36
|
+
const translations = ctx.translations;
|
|
37
|
+
const tagVocabulary = ctx.tagVocabulary;
|
|
38
|
+
const defaultLocale = settings.defaultLocale;
|
|
39
|
+
const locales = [
|
|
40
|
+
defaultLocale,
|
|
41
|
+
...Object.keys(settings.locales)
|
|
42
|
+
];
|
|
43
|
+
function getLocaleConfig(locale) {
|
|
44
|
+
return settings.locales[locale];
|
|
45
|
+
}
|
|
46
|
+
function getLocaleLabel(locale) {
|
|
47
|
+
if (locale === defaultLocale) return defaultLocale.toUpperCase();
|
|
48
|
+
return getLocaleConfig(locale)?.label ?? locale.toUpperCase();
|
|
49
|
+
}
|
|
50
|
+
function t(key, locale = defaultLocale) {
|
|
51
|
+
return translations[locale]?.[key] ?? translations[defaultLocale]?.[key] ?? key;
|
|
52
|
+
}
|
|
53
|
+
const i18n = {
|
|
54
|
+
defaultLocale,
|
|
55
|
+
locales,
|
|
56
|
+
getLocaleLabel,
|
|
57
|
+
t
|
|
58
|
+
};
|
|
59
|
+
const urlHelpers = makeUrlHelpers(settings, i18n);
|
|
60
|
+
const {
|
|
61
|
+
withBase,
|
|
62
|
+
stripBase,
|
|
63
|
+
docsUrl,
|
|
64
|
+
versionedDocsUrl,
|
|
65
|
+
navHref,
|
|
66
|
+
isDefaultLocaleOnlyPath,
|
|
67
|
+
absoluteUrl,
|
|
68
|
+
isExternal,
|
|
69
|
+
resolveHref,
|
|
70
|
+
buildLocaleLinks
|
|
71
|
+
} = urlHelpers;
|
|
72
|
+
function getCategoryOrder() {
|
|
73
|
+
return getCategoryOrderBase(settings.headerNav);
|
|
74
|
+
}
|
|
75
|
+
function getNavSectionForSlug(slug) {
|
|
76
|
+
return getNavSectionForSlugBase(slug, settings.headerNav);
|
|
77
|
+
}
|
|
78
|
+
function getNavSubtree(tree, categoryMatch) {
|
|
79
|
+
return getNavSubtreeBase(tree, categoryMatch, settings.headerNav);
|
|
80
|
+
}
|
|
81
|
+
function extractHeadings(body) {
|
|
82
|
+
return extractHeadingsBase(body, {
|
|
83
|
+
tocMinDepth: settings.tocMinDepth,
|
|
84
|
+
tocMaxDepth: settings.tocMaxDepth,
|
|
85
|
+
strategy: settings.headingIdStrategy
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function getVocab() {
|
|
89
|
+
return settings.tagVocabulary ? tagVocabulary : false;
|
|
90
|
+
}
|
|
91
|
+
function resolveTagBound(raw) {
|
|
92
|
+
return resolveTag(raw, getVocab(), settings.tagGovernance);
|
|
93
|
+
}
|
|
94
|
+
function collectTags(entries, slugFn) {
|
|
95
|
+
const tagMap = /* @__PURE__ */ new Map();
|
|
96
|
+
for (const entry of entries) {
|
|
97
|
+
const rawTags = entry.data.tags ?? [];
|
|
98
|
+
const slug = slugFn(entry.id, entry.data);
|
|
99
|
+
const seen = /* @__PURE__ */ new Set();
|
|
100
|
+
for (const raw of rawTags) {
|
|
101
|
+
const resolved = resolveTagBound(raw);
|
|
102
|
+
if (resolved.deprecated) continue;
|
|
103
|
+
if (seen.has(resolved.canonical)) continue;
|
|
104
|
+
seen.add(resolved.canonical);
|
|
105
|
+
if (!tagMap.has(resolved.canonical)) {
|
|
106
|
+
tagMap.set(resolved.canonical, { tag: resolved.canonical, count: 0, docs: [] });
|
|
107
|
+
}
|
|
108
|
+
const info = tagMap.get(resolved.canonical);
|
|
109
|
+
info.count++;
|
|
110
|
+
info.docs.push({
|
|
111
|
+
slug,
|
|
112
|
+
title: entry.data.title ?? "",
|
|
113
|
+
description: entry.data.description
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return tagMap;
|
|
118
|
+
}
|
|
119
|
+
const navSourceDocs = createNavSourceDocs({
|
|
120
|
+
defaultLocale,
|
|
121
|
+
docsDir: settings.docsDir,
|
|
122
|
+
getVersions: () => settings.versions,
|
|
123
|
+
getLocaleConfig,
|
|
124
|
+
loadCategoryMeta,
|
|
125
|
+
isNavVisible,
|
|
126
|
+
isDefaultLocaleOnlyPath,
|
|
127
|
+
stableDocs
|
|
128
|
+
});
|
|
129
|
+
const {
|
|
130
|
+
resolveNavSource,
|
|
131
|
+
resolveVersionedLocaleSource,
|
|
132
|
+
loadNavSourceDocs
|
|
133
|
+
} = navSourceDocs;
|
|
134
|
+
const docRouteEntries = createDocRouteEntries({
|
|
135
|
+
buildNavTree: (docs, locale, categoryMeta) => buildNavTree(
|
|
136
|
+
docs,
|
|
137
|
+
locale,
|
|
138
|
+
categoryMeta,
|
|
139
|
+
(slug, loc) => docsUrl(slug, loc)
|
|
140
|
+
),
|
|
141
|
+
buildBreadcrumbs: (tree, slug, locale, urlFor) => buildBreadcrumbs(
|
|
142
|
+
tree,
|
|
143
|
+
slug,
|
|
144
|
+
locale === defaultLocale ? withBase("/") : withBase(`/${locale}/`),
|
|
145
|
+
urlFor
|
|
146
|
+
),
|
|
147
|
+
collectAutoIndexNodes,
|
|
148
|
+
getNavSectionForSlug,
|
|
149
|
+
getNavSubtree,
|
|
150
|
+
toRouteSlug,
|
|
151
|
+
toSlugParams,
|
|
152
|
+
extractHeadings
|
|
153
|
+
});
|
|
154
|
+
const { buildDocRouteEntries } = docRouteEntries;
|
|
155
|
+
const routeEnumerators = createRouteEnumerators({
|
|
156
|
+
defaultLocale,
|
|
157
|
+
getLocaleKeys: () => Object.keys(settings.locales),
|
|
158
|
+
getVersions: () => settings.versions,
|
|
159
|
+
getDocTags: () => settings.docTags,
|
|
160
|
+
docsUrl,
|
|
161
|
+
versionedDocsUrl,
|
|
162
|
+
withBase,
|
|
163
|
+
loadDocs: (collectionName) => stableDocs(collectionName),
|
|
164
|
+
isDefaultLocaleOnlyPath,
|
|
165
|
+
collectTags: (docs, slugFn) => collectTags(docs, slugFn),
|
|
166
|
+
toRouteSlug,
|
|
167
|
+
buildNavTree: (docs, locale, categoryMeta) => buildNavTree(docs, locale, categoryMeta, (slug, loc) => docsUrl(slug, loc)),
|
|
168
|
+
collectAutoIndexNodes,
|
|
169
|
+
resolveNavSource,
|
|
170
|
+
resolveVersionedLocaleSource,
|
|
171
|
+
mergeLocaleDocs
|
|
172
|
+
});
|
|
173
|
+
const {
|
|
174
|
+
enumerateDocsRoutes,
|
|
175
|
+
enumerateTagsRoutes,
|
|
176
|
+
enumerateVersionedRoutes,
|
|
177
|
+
enumerateAllRoutes
|
|
178
|
+
} = routeEnumerators;
|
|
179
|
+
export {
|
|
180
|
+
absoluteUrl,
|
|
181
|
+
buildDocRouteEntries,
|
|
182
|
+
buildLocaleLinks,
|
|
183
|
+
buildNavTree,
|
|
184
|
+
collectAutoIndexNodes,
|
|
185
|
+
collectTags,
|
|
186
|
+
ctx,
|
|
187
|
+
defaultLocale,
|
|
188
|
+
docsUrl,
|
|
189
|
+
enumerateAllRoutes,
|
|
190
|
+
enumerateDocsRoutes,
|
|
191
|
+
enumerateTagsRoutes,
|
|
192
|
+
enumerateVersionedRoutes,
|
|
193
|
+
extractHeadings,
|
|
194
|
+
findNode,
|
|
195
|
+
firstRoutedHref,
|
|
196
|
+
getCategoryOrder,
|
|
197
|
+
getLocaleConfig,
|
|
198
|
+
getLocaleLabel,
|
|
199
|
+
getNavSectionForSlug,
|
|
200
|
+
getNavSubtree,
|
|
201
|
+
groupSatelliteNodes,
|
|
202
|
+
i18n,
|
|
203
|
+
isDefaultLocaleOnlyPath,
|
|
204
|
+
isExternal,
|
|
205
|
+
isNavVisible,
|
|
206
|
+
loadNavSourceDocs,
|
|
207
|
+
locales,
|
|
208
|
+
navHref,
|
|
209
|
+
resolveHref,
|
|
210
|
+
resolveNavSource,
|
|
211
|
+
resolveTagBound,
|
|
212
|
+
resolveVersionedLocaleSource,
|
|
213
|
+
settings,
|
|
214
|
+
stableDocs,
|
|
215
|
+
stripBase,
|
|
216
|
+
t,
|
|
217
|
+
toRouteSlug,
|
|
218
|
+
toSlugParams,
|
|
219
|
+
urlHelpers,
|
|
220
|
+
versionedDocsUrl,
|
|
221
|
+
withBase
|
|
222
|
+
};
|