@takazudo/zudo-doc 1.3.0 → 2.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.
Files changed (52) hide show
  1. package/dist/chrome/derive.d.ts +68 -0
  2. package/dist/chrome/derive.js +231 -0
  3. package/dist/chrome/index.d.ts +37 -0
  4. package/dist/chrome/index.js +43 -0
  5. package/dist/doc-body-end/index.d.ts +9 -11
  6. package/dist/doc-body-end/index.js +4 -2
  7. package/dist/doc-content-header/index.d.ts +10 -2
  8. package/dist/doc-content-header/index.js +8 -8
  9. package/dist/doc-history-area/index.d.ts +10 -25
  10. package/dist/doc-history-area/index.js +14 -10
  11. package/dist/doc-metainfo-area/index.d.ts +9 -15
  12. package/dist/doc-metainfo-area/index.js +6 -2
  13. package/dist/doc-page-renderer/index.d.ts +11 -2
  14. package/dist/doc-page-renderer/index.js +22 -15
  15. package/dist/doc-page-shell/index.d.ts +11 -3
  16. package/dist/doc-page-shell/index.js +21 -14
  17. package/dist/doc-pager/index.d.ts +6 -7
  18. package/dist/doc-pager/index.js +2 -2
  19. package/dist/doc-route-entries/index.d.ts +22 -46
  20. package/dist/doc-route-entries/index.js +15 -10
  21. package/dist/doc-tags-area/index.d.ts +9 -19
  22. package/dist/doc-tags-area/index.js +12 -2
  23. package/dist/factory-context/index.d.ts +163 -1
  24. package/dist/footer-with-defaults/index.d.ts +12 -13
  25. package/dist/footer-with-defaults/index.js +8 -10
  26. package/dist/head/types.d.ts +39 -0
  27. package/dist/head-with-defaults/index.d.ts +12 -16
  28. package/dist/head-with-defaults/index.js +93 -10
  29. package/dist/header-with-defaults/index.d.ts +10 -31
  30. package/dist/header-with-defaults/index.js +15 -18
  31. package/dist/nav-source-docs/index.d.ts +20 -54
  32. package/dist/nav-source-docs/index.js +9 -10
  33. package/dist/route-context/index.d.ts +24 -0
  34. package/dist/route-context/index.js +147 -0
  35. package/dist/route-enumerators/index.d.ts +25 -74
  36. package/dist/route-enumerators/index.js +17 -18
  37. package/dist/routes/_chrome.d.ts +6 -25
  38. package/dist/routes/_chrome.js +14 -387
  39. package/dist/routes/_context.d.ts +10 -43
  40. package/dist/routes/_context.js +29 -157
  41. package/dist/safelist.css +1 -1
  42. package/dist/settings.d.ts +54 -0
  43. package/dist/sidebar-with-defaults/index.d.ts +8 -15
  44. package/dist/sidebar-with-defaults/index.js +6 -10
  45. package/dist/tag-pages/index.d.ts +12 -3
  46. package/dist/tag-pages/index.js +24 -19
  47. package/dist/versions-page/index.d.ts +10 -3
  48. package/dist/versions-page/index.js +18 -14
  49. package/eject/doc-pager/index.tsx +8 -10
  50. package/package.json +13 -5
  51. package/routes-src/_chrome.tsx +31 -552
  52. package/routes-src/_context.ts +37 -269
@@ -1,5 +1,7 @@
1
1
  import type { NavSourceDocs } from "../nav-source-docs/index.js";
2
2
  import type { DocPageEntry, DocNavNode } from "../doc-page-props/index.js";
3
+ import type { CategoryMeta } from "../sidebar-tree/index.js";
4
+ import type { Settings } from "../settings.js";
3
5
  export type { DocPageEntry, DocNavNode, NavSourceDocs };
4
6
  /**
5
7
  * Minimal docs entry shape needed for tag enumeration (no Content/module_specifier).
@@ -33,100 +35,49 @@ export interface TagInfoForEnum {
33
35
  count: number;
34
36
  }
35
37
  /**
36
- * Injected context for `createRouteEnumerators`.
37
- *
38
- * All host-specific singletons and utilities are passed in so the package
39
- * factory never imports `@/` aliases.
38
+ * Context slice `createRouteEnumerators` derives its bag from (epic Collapse
39
+ * Wiring Shells #2420, FACTORIES #2424 — breaking signature). STRUCTURAL SUBSET
40
+ * of the unified `RouteContext`/`ChromeContext`: `getLocaleKeys`/`getVersions`/
41
+ * `getDocTags` read off `settings`, `loadDocs` is the content-bridge `stableDocs`,
42
+ * `mergeLocaleDocs` is imported directly, and the rest are reconstructed
43
+ * callables already on the context (including the nav-source resolvers, which
44
+ * `createRouteContext` assembles BEFORE the enumerators).
40
45
  */
41
46
  export interface RouteEnumeratorsContext {
42
- /** Default locale code. Host passes `defaultLocale` from `@/config/i18n`. */
47
+ /** The host's resolved settings object (reads `locales`/`versions`/`docTags`). */
48
+ settings: Settings;
49
+ /** Default locale code. */
43
50
  defaultLocale: string;
44
- /**
45
- * Getter for all non-default locale codes.
46
- * Host passes `() => Object.keys(settings.locales)`.
47
- * Called per invocation so mutations to settings.locales are picked up.
48
- */
49
- getLocaleKeys: () => readonly string[];
50
- /**
51
- * Getter for the configured versions list (or false/undefined).
52
- * Host passes `() => settings.versions`.
53
- * Called per invocation so mutations to settings.versions are picked up.
54
- */
55
- getVersions: () => VersionConfigForEnum[] | false | undefined;
56
- /**
57
- * Getter for whether tag pages are enabled.
58
- * Host passes `() => settings.docTags`.
59
- */
60
- getDocTags: () => boolean | undefined;
61
- /** `docsUrl(slug, lang)` from `@/utils/base` (resolved with settings). */
51
+ /** Build a docs URL for the given slug and locale. */
62
52
  docsUrl: (slug: string, lang?: string) => string;
63
- /** `versionedDocsUrl(slug, versionSlug, lang)` from `@/utils/base`. */
53
+ /** Build a versioned docs URL. */
64
54
  versionedDocsUrl: (slug: string, versionSlug: string, lang?: string) => string;
65
- /** `withBase(path)` from `@/utils/base`. */
55
+ /** Prefix a path with the configured base directory. */
66
56
  withBase: (path: string) => string;
67
- /**
68
- * Load docs from a named collection.
69
- * Host passes `loadDocs` from `pages/_data.ts`.
70
- */
71
- loadDocs: (collectionName: string) => DocsEntryForTags[];
72
- /**
73
- * Returns true for paths that are only shown in the default locale.
74
- * Host passes `isDefaultLocaleOnlyPath` from `@/utils/base`.
75
- */
57
+ /** Identity-stable, draft-filtered docs array for a collection. */
58
+ stableDocs: (collectionName: string) => DocPageEntry[];
59
+ /** Returns true for paths that are only shown in the default locale. */
76
60
  isDefaultLocaleOnlyPath: (path: string) => boolean;
77
- /**
78
- * Collect tags from a docs array.
79
- * Host passes `collectTags` from `@/utils/tags`.
80
- */
61
+ /** Aggregate a `tag → docs` index from a doc collection. */
81
62
  collectTags: (docs: DocsEntryForTags[], slugFn: (id: string, data: {
82
63
  slug?: string;
83
64
  }) => string) => Map<string, TagInfoForEnum>;
84
- /**
85
- * Convert a content entry slug to a canonical route slug.
86
- * Host passes `toRouteSlug` from `@/utils/slug`.
87
- */
65
+ /** Convert a content entry slug to a canonical route slug. */
88
66
  toRouteSlug: (id: string) => string;
89
- /**
90
- * Build the nav tree for a locale.
91
- * Host passes `buildNavTree` from `@/utils/docs`.
92
- */
93
- buildNavTree: (docs: DocPageEntry[], locale: string, categoryMeta: Map<string, unknown>) => DocNavNode[];
94
- /**
95
- * Collect auto-generated index nodes.
96
- * Host passes `collectAutoIndexNodes` from `@/utils/docs`.
97
- */
67
+ /** Build the nav tree for a locale (4-arg form with an explicit href builder). */
68
+ buildNavTree: (docs: DocPageEntry[], locale: string, categoryMeta: Map<string, CategoryMeta> | undefined, buildHref: (slug: string, locale: string) => string) => DocNavNode[];
69
+ /** Collect auto-generated index nodes. */
98
70
  collectAutoIndexNodes: (tree: DocNavNode[]) => DocNavNode[];
99
- /**
100
- * Resolve the identity-stable nav source for an EN/locale context.
101
- * Host passes `resolveNavSource` from `pages/lib/_nav-source-docs.ts`.
102
- */
71
+ /** Resolve the identity-stable nav source for an EN/locale context. */
103
72
  resolveNavSource: (lang: string, currentVersion: string | undefined, options?: {
104
73
  applyDefaultLocaleOnlyFilter?: boolean;
105
74
  keepUnlisted?: boolean;
106
75
  }) => NavSourceDocs;
107
- /**
108
- * Resolve the identity-stable nav source for a versioned non-default-locale
109
- * context.
110
- * Host passes `resolveVersionedLocaleSource` from `pages/lib/_nav-source-docs.ts`.
111
- */
76
+ /** Resolve the identity-stable nav source for a versioned non-default-locale context. */
112
77
  resolveVersionedLocaleSource: (versionSlug: string, versionDocsDir: string | undefined, lang: string, localeDir: string | undefined, options?: {
113
78
  applyDefaultLocaleOnlyFilter?: boolean;
114
79
  keepUnlisted?: boolean;
115
80
  }) => NavSourceDocs;
116
- /**
117
- * Merge locale docs with base-locale fallbacks.
118
- * Host passes `mergeLocaleDocs` from `pages/lib/locale-merge.ts`.
119
- */
120
- mergeLocaleDocs: (options: {
121
- baseDocs: DocsEntryForTags[];
122
- localeDocs: DocsEntryForTags[];
123
- applyDefaultLocaleOnlyFilter?: boolean;
124
- keepUnlisted?: boolean;
125
- isDefaultLocaleOnlyPath?: (path: string) => boolean;
126
- }) => {
127
- docs: DocsEntryForTags[];
128
- localeSlugSet: ReadonlySet<string>;
129
- };
130
81
  }
131
82
  export interface RouteEnumeratorsAPI {
132
83
  /**
@@ -1,22 +1,21 @@
1
+ import { mergeLocaleDocs as mergeLocaleDocsImpl } from "../locale-merge/index.js";
1
2
  function createRouteEnumerators(ctx) {
2
- const {
3
- defaultLocale,
4
- getLocaleKeys,
5
- getVersions,
6
- getDocTags,
7
- docsUrl,
8
- versionedDocsUrl,
9
- withBase,
10
- loadDocs,
11
- isDefaultLocaleOnlyPath,
12
- collectTags,
13
- toRouteSlug,
14
- buildNavTree,
15
- collectAutoIndexNodes,
16
- resolveNavSource,
17
- resolveVersionedLocaleSource,
18
- mergeLocaleDocs
19
- } = ctx;
3
+ const defaultLocale = ctx.defaultLocale;
4
+ const getLocaleKeys = () => Object.keys(ctx.settings.locales);
5
+ const getVersions = () => ctx.settings.versions;
6
+ const getDocTags = () => ctx.settings.docTags;
7
+ const docsUrl = ctx.docsUrl;
8
+ const versionedDocsUrl = ctx.versionedDocsUrl;
9
+ const withBase = ctx.withBase;
10
+ const loadDocs = (collectionName) => ctx.stableDocs(collectionName);
11
+ const isDefaultLocaleOnlyPath = ctx.isDefaultLocaleOnlyPath;
12
+ const collectTags = ctx.collectTags;
13
+ const toRouteSlug = ctx.toRouteSlug;
14
+ const buildNavTree = (docs, locale, categoryMeta) => ctx.buildNavTree(docs, locale, categoryMeta, (slug, loc) => ctx.docsUrl(slug, loc));
15
+ const collectAutoIndexNodes = ctx.collectAutoIndexNodes;
16
+ const resolveNavSource = ctx.resolveNavSource;
17
+ const resolveVersionedLocaleSource = ctx.resolveVersionedLocaleSource;
18
+ const mergeLocaleDocs = mergeLocaleDocsImpl;
20
19
  function enumerateDocsRoutes(locale) {
21
20
  const urls = [];
22
21
  const { docs: allDocs, navDocs, categoryMeta } = resolveNavSource(
@@ -1,32 +1,13 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- import type { JSX, VNode, ComponentChildren } from "preact";
4
1
  import type { DocNavNode } from "./_docs-helpers.js";
5
- /** Package-default body-end islands the package-island subset of the host's
6
- * `BodyEndIslands` (AiChatModal / ImageEnlarge / MermaidEnlarge), reconstructed
7
- * from the serializable virtual-module `settings` flags (#2406 / #2401(c)).
8
- * The host-owned bootstraps (client-router / design-token-panel) cannot live
9
- * in the package, so they are NOT included here — A2/S4 re-homes those. */
10
- declare const BodyEndIslands: (props: import("../doc-body-end-islands/index.js").BodyEndIslandsProps) => 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: {
2
+ export declare const composeMetaTitle: (title: string) => string, HeadWithDefaults: (props: import("../head-with-defaults/index.js").HeadWithDefaultsProps) => import("preact").JSX.Element, HeaderWithDefaults: (props: import("../header-with-defaults/index.js").HeaderWithDefaultsProps) => import("preact").JSX.Element, FooterWithDefaults: (props: {
15
3
  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: {
4
+ }) => import("preact").VNode, SidebarWithDefaults: (props: import("../sidebar-with-defaults/index.js").SidebarWithDefaultsProps) => import("preact").JSX.Element, renderDocPage: (props: import("../doc-page-props/index.js").DocPageBaseProps, opts: import("../doc-page-renderer/index.js").RenderDocPageOptions) => import("preact").JSX.Element, VersionsPageView: (props: import("../versions-page/index.js").VersionsPageViewProps) => import("preact").JSX.Element, collectTagMapForLocale: (locale: string) => Map<string, import("../tag-pages/index.js").TagInfo>, TagDetailPageView: (props: {
23
5
  locale: string;
24
6
  tag: string;
25
7
  tagInfo: import("../tag-pages/index.js").TagInfo;
26
- }) => JSX.Element, TagsIndexPageView: (props: {
8
+ }) => import("preact").JSX.Element, TagsIndexPageView: (props: {
27
9
  locale: string;
28
- children?: ComponentChildren;
29
- }) => JSX.Element;
30
- export { SiteTreeNavWrapper, BodyEndIslands };
31
- export { buildDocRouteEntries, } from "./_context.js";
10
+ children?: import("preact").ComponentChildren;
11
+ }) => import("preact").JSX.Element, SiteTreeNavWrapper: import("../factory-context/index.js").FactoryComponent, BodyEndIslands: (props: import("../doc-body-end-islands/index.js").BodyEndIslandsProps) => import("preact").JSX.Element;
12
+ export { buildDocRouteEntries } from "./_context.js";
32
13
  export type { DocNavNode };
@@ -1,393 +1,21 @@
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
- colorSchemes
27
- } from "./_context.js";
28
- import { createComposeMetaTitle } from "../compose-meta-title/index.js";
29
- import {
30
- generateCssCustomProperties,
31
- generateLightDarkCssProperties
32
- } from "../color-scheme-utils.js";
33
- import { createHeadWithDefaults } from "../head-with-defaults/index.js";
34
- import { createHeaderWithDefaults } from "../header-with-defaults/index.js";
35
- import { createFooterWithDefaults } from "../footer-with-defaults/index.js";
36
- import { createSidebarWithDefaults } from "../sidebar-with-defaults/index.js";
37
- import { createSidebarPrepaint } from "../sidebar-prepaint/index.js";
38
- import { createDocBodyEnd } from "../doc-body-end/index.js";
39
- import { createBodyEndIslands } from "../doc-body-end-islands/index.js";
40
- import { createDocPager } from "../doc-pager/index.js";
41
- import { createDocPageShell } from "../doc-page-shell/index.js";
42
- import { createDocContentHeader } from "../doc-content-header/index.js";
43
- import { createDocMetainfoArea } from "../doc-metainfo-area/index.js";
44
- import { createDocTagsArea } from "../doc-tags-area/index.js";
45
- import { createDocHistoryArea } from "../doc-history-area/index.js";
46
- import { createInlineVersionSwitcher } from "../inline-version-switcher/index.js";
47
- import { createRenderDocPage } from "../doc-page-renderer/index.js";
48
- import { createVersionsPageView } from "../versions-page/index.js";
49
- import { createTagPages } from "../tag-pages/index.js";
50
- import { createMdxComponents } from "../mdx-components/index.js";
51
- import { createCategoryNavWrapper } from "../category-nav/index.js";
52
- import { createCategoryTreeNavWrapper } from "../category-tree-nav/index.js";
53
- import { createSiteTreeNavWrapper } from "../site-tree-nav/index.js";
54
- import { getTocTitle } from "../toc/index.js";
55
- import { SearchWidget } from "../search-widget/index.js";
56
- import { buildGitHubRepoUrl, buildGitHubSourceUrl } from "../github-helpers/index.js";
57
- import { toHistorySlug } from "../slug/index.js";
58
- import {
59
- buildRootMenuItems as buildRootMenuItemsBase,
60
- buildLocaleLinksForNav as buildLocaleLinksForNavBase,
61
- remapVersionedHrefs,
62
- getThemeDefaultMode as getThemeDefaultModeBase
63
- } from "../nav-data-prep/index.js";
64
- import { buildSidebarForSection } from "../sidebar-utils/index.js";
65
- import { Details } from "../details/index.js";
66
- import {
67
- HtmlPreviewWrapper
68
- } from "../html-preview-wrapper/index.js";
69
- const GREY_RAMP = [
70
- "#000000",
71
- "#1a1a1a",
72
- "#333333",
73
- "#4d4d4d",
74
- "#666666",
75
- "#808080",
76
- "#999999",
77
- "#b3b3b3",
78
- "#cccccc",
79
- "#d9d9d9",
80
- "#e6e6e6",
81
- "#f2f2f2",
82
- "#ff5555",
83
- "#50fa7b",
84
- "#f1fa8c",
85
- "#8be9fd"
86
- ];
87
- const DEFAULT_SCHEME = {
88
- background: "#000000",
89
- foreground: "#ffffff",
90
- cursor: "#ffffff",
91
- selectionBg: "#444444",
92
- selectionFg: "#ffffff",
93
- palette: GREY_RAMP
94
- };
95
- const docHistoryMeta = {};
96
- const sidebarsConfig = {};
97
- const BodyEndIslands = createBodyEndIslands({ settings });
98
- function DocHistoryStub(_props) {
99
- return /* @__PURE__ */ jsx(Fragment, {});
100
- }
101
- function SearchWidgetBound(props) {
102
- return SearchWidget({ ...props, base: withBase("/") });
103
- }
104
- const composeMetaTitle = createComposeMetaTitle(settings.siteName);
105
- function resolveHostScheme(key) {
106
- if (!colorSchemes) return DEFAULT_SCHEME;
107
- return colorSchemes[key] ?? DEFAULT_SCHEME;
108
- }
109
- const HeadWithDefaults = createHeadWithDefaults({
110
- settings,
111
- composeMetaTitle,
112
- withBase,
113
- absoluteUrl,
114
- // Called only in single-scheme mode (colorMode false): resolve via settings.colorScheme.
115
- generateCssCustomProperties: () => generateCssCustomProperties(resolveHostScheme(settings.colorScheme)),
116
- // Called only in light/dark mode (colorMode truthy): resolve the pair.
117
- generateLightDarkCssProperties: () => {
118
- const cm = settings.colorMode;
119
- if (cm) {
120
- return generateLightDarkCssProperties(
121
- resolveHostScheme(cm.lightScheme),
122
- resolveHostScheme(cm.darkScheme)
123
- );
124
- }
125
- return generateLightDarkCssProperties(DEFAULT_SCHEME, DEFAULT_SCHEME);
126
- }
127
- });
128
- function buildRootMenuItems(lang, currentVersion) {
129
- return buildRootMenuItemsBase(
130
- lang,
131
- currentVersion,
132
- settings.headerNav,
133
- (key, l) => t(key, l),
134
- (path, l, v) => navHref(path, l, v)
135
- );
136
- }
137
- function buildLocaleLinksForNav(currentPath, lang, localeCount) {
138
- return buildLocaleLinksForNavBase(
139
- currentPath,
140
- lang,
141
- localeCount,
142
- (path, l) => buildLocaleLinks(path, l)
143
- );
144
- }
145
- function buildSidebarNodes(lang, navSection, currentVersion, emptyWhenUnsectioned = true) {
146
- if (navSection === void 0 && emptyWhenUnsectioned) return [];
147
- const { navDocs, categoryMeta } = loadNavSourceDocs(lang, currentVersion);
148
- const explicitPrefixes = getCategoryOrder().filter((cm) => cm !== "!");
149
- const rawNodes = buildSidebarForSection(
150
- navDocs,
151
- lang,
152
- navSection,
153
- categoryMeta,
154
- sidebarsConfig,
155
- (d, l, meta) => buildNavTree(
156
- d,
157
- l,
158
- meta,
159
- (slug, loc) => docsUrl(slug, loc)
160
- ),
161
- explicitPrefixes
162
- );
163
- return currentVersion ? remapVersionedHrefs(
164
- rawNodes,
165
- currentVersion,
166
- lang,
167
- (slug, v, l) => versionedDocsUrl(slug, v, l)
168
- ) : rawNodes;
169
- }
170
- function getThemeDefaultMode() {
171
- return getThemeDefaultModeBase(settings.colorMode);
172
- }
173
- const HeaderWithDefaults = createHeaderWithDefaults({
174
- settings,
175
- defaultLocale,
176
- locales,
177
- t,
178
- withBase,
179
- stripBase,
180
- docsUrl,
181
- navHref,
182
- versionedDocsUrl,
183
- buildLocaleLinksForNav,
184
- buildRootMenuItems,
185
- buildSidebarNodes,
186
- getThemeDefaultMode,
187
- buildGitHubRepoUrl: () => buildGitHubRepoUrl(settings.githubUrl),
188
- SearchWidget: SearchWidgetBound
189
- });
190
- const FooterWithDefaults = createFooterWithDefaults({
191
- settings,
192
- defaultLocale,
193
- tagVocabulary: [],
194
- isExternal: (href) => /^https?:\/\//.test(href),
195
- resolveHref: (href) => /^https?:\/\//.test(href) ? href : withBase(href),
196
- withBase,
197
- // The footer taglist is host-bound (project tag aggregation); package default
198
- // renders no tag columns.
199
- loadTagsForLocale: () => []
200
- });
201
- const SidebarWithDefaults = createSidebarWithDefaults({
202
- defaultLocale,
203
- localeCount: locales.length,
204
- buildRootMenuItems,
205
- buildLocaleLinksForNav,
206
- buildSidebarNodes,
207
- getThemeDefaultMode,
208
- t
209
- });
210
- const SidebarPrepaint = createSidebarPrepaint({ sidebarToggle: settings.sidebarToggle });
211
- const DocBodyEnd = createDocBodyEnd({ settings, BodyEndIslands });
212
- const DocPager = createDocPager({ t });
213
- const DocMetainfoArea = createDocMetainfoArea({
214
- settings,
215
- defaultLocale,
216
- docHistoryMeta,
217
- t,
218
- toHistorySlug
219
- });
220
- const DocTagsArea = createDocTagsArea({
221
- settings,
222
- defaultLocale,
223
- tagVocabularyEntries: [],
224
- tagHref: (tag, locale) => {
225
- const encoded = encodeURIComponent(tag);
226
- return withBase(
227
- locale === defaultLocale ? `/docs/tags/${encoded}` : `/${locale}/docs/tags/${encoded}`
228
- );
229
- },
230
- t
231
- });
232
- const DocContentHeader = createDocContentHeader({
233
- t,
234
- buildFrontmatterPreviewEntries: () => [],
235
- frontmatterRenderers: {},
236
- DocMetainfoArea,
237
- DocTagsArea
238
- });
239
- const DocHistoryArea = createDocHistoryArea({
240
- settings,
241
- defaultLocale,
242
- docHistoryMeta,
243
- t,
244
- toHistorySlug,
245
- buildGitHubSourceUrl: (contentDir, entryId) => buildGitHubSourceUrl(settings.githubUrl, contentDir, entryId),
246
- DocHistory: DocHistoryStub
247
- });
248
- const buildInlineVersionSwitcher = createInlineVersionSwitcher({
249
- settings,
250
- defaultLocale,
251
- t,
252
- docsUrl,
253
- versionedDocsUrl,
254
- withBase
255
- });
256
- const CategoryNavWrapper = createCategoryNavWrapper({
257
- defaultLocale,
258
- resolveNavSource,
259
- buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
260
- docs,
261
- locale,
262
- categoryMeta,
263
- (slug, loc) => docsUrl(slug, loc)
264
- )),
265
- findNode,
266
- firstRoutedHref
267
- });
268
- const CategoryTreeNavWrapper = createCategoryTreeNavWrapper({
269
- defaultLocale,
270
- resolveNavSource,
271
- buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
272
- docs,
273
- locale,
274
- categoryMeta,
275
- (slug, loc) => docsUrl(slug, loc)
276
- )),
277
- groupSatelliteNodes,
278
- findNode
279
- });
280
- const SiteTreeNavWrapper = createSiteTreeNavWrapper({
281
- defaultLocale,
282
- resolveNavSource,
283
- buildNavTree: ((docs, locale, categoryMeta) => buildNavTree(
284
- docs,
285
- locale,
286
- categoryMeta,
287
- (slug, loc) => docsUrl(slug, loc)
288
- )),
289
- groupSatelliteNodes,
290
- getCategoryOrder
291
- });
292
- function HtmlPreviewBound(props) {
293
- return HtmlPreviewWrapper({
294
- globalConfig: settings.htmlPreview ?? null,
295
- ...props
296
- });
297
- }
298
- function IslandPassthrough(props) {
299
- return props.children ?? null;
300
- }
301
- function createMdxComponentsBound(lang = defaultLocale) {
302
- return createMdxComponents({
303
- settings,
304
- locale: lang,
305
- navData: {
306
- CategoryNav: CategoryNavWrapper,
307
- CategoryTreeNav: CategoryTreeNavWrapper,
308
- SiteTreeNav: SiteTreeNavWrapper
309
- },
310
- // Package-owned content components wired here so an INJECTED docs route
311
- // (packageOwnedRoutes, no host `pages/` stub) renders MDX using these tags
312
- // without the "MDX requires '<X>' to be passed via the 'components' prop"
313
- // error (sub-issue #2390 / supersedes #2377).
314
- // - Details → fully functional (pure <details>, no client JS).
315
- // - HtmlPreview → SSR-renders; see HtmlPreviewBound for the hydration
316
- // caveat tied to the node_modules islands-scanner gap.
317
- // - Island → SSR pass-through; see IslandPassthrough.
318
- // PresetGenerator stays a package stub (render nothing): it is the
319
- // showcase's project-bound interactive island and downstream projects stub
320
- // it. The showcase keeps its host-owned docs catch-all routes (allowlisted)
321
- // so its real PresetGenerator still renders.
322
- extras: {
323
- Details,
324
- HtmlPreview: HtmlPreviewBound,
325
- Island: IslandPassthrough,
326
- PresetGenerator: (_props) => null
327
- }
328
- });
329
- }
330
- const DocPageShell = createDocPageShell({
331
- settings,
1
+ import { routeCtx } from "./_context.js";
2
+ import { createChrome } from "../chrome/index.js";
3
+ const chrome = createChrome(routeCtx);
4
+ const {
332
5
  composeMetaTitle,
333
- getTocTitle,
334
6
  HeadWithDefaults,
335
- SidebarWithDefaults,
336
7
  HeaderWithDefaults,
337
8
  FooterWithDefaults,
338
- SidebarPrepaint,
339
- DocBodyEnd,
340
- DocPager
341
- });
342
- const renderDocPage = createRenderDocPage({
343
- docsUrl,
344
- versionedDocsUrl,
345
- absoluteUrl,
346
- getNavSectionForSlug,
347
- toRouteSlug,
348
- createMdxComponents: createMdxComponentsBound,
349
- t,
350
- buildInlineVersionSwitcher,
351
- DocPageShell,
352
- DocContentHeader,
353
- DocMetainfoArea,
354
- DocHistoryArea
355
- });
356
- const VersionsPageView = createVersionsPageView({
357
- settings,
358
- defaultLocale,
359
- t,
360
- withBase,
361
- composeMetaTitle,
362
- components: {
363
- HeadWithDefaults,
364
- HeaderWithDefaults,
365
- FooterWithDefaults,
366
- BodyEndIslands
367
- }
368
- });
369
- const tagPages = createTagPages({
370
- settings,
371
- defaultLocale,
372
- t,
373
- withBase,
374
- docsUrl,
375
- composeMetaTitle,
376
- collectTags,
377
- stableDocs,
378
- isDefaultLocaleOnlyPath: void 0,
379
- components: {
380
- HeadWithDefaults,
381
- HeaderWithDefaults,
382
- FooterWithDefaults,
383
- BodyEndIslands,
384
- DocHistoryArea
385
- }
386
- });
387
- const { collectTagMapForLocale, TagDetailPageView, TagsIndexPageView } = tagPages;
388
- import {
389
- buildDocRouteEntries
390
- } from "./_context.js";
9
+ SidebarWithDefaults,
10
+ renderDocPage,
11
+ VersionsPageView,
12
+ collectTagMapForLocale,
13
+ TagDetailPageView,
14
+ TagsIndexPageView,
15
+ SiteTreeNavWrapper,
16
+ BodyEndIslands
17
+ } = chrome;
18
+ import { buildDocRouteEntries } from "./_context.js";
391
19
  export {
392
20
  BodyEndIslands,
393
21
  FooterWithDefaults,
@@ -401,6 +29,5 @@ export {
401
29
  buildDocRouteEntries,
402
30
  collectTagMapForLocale,
403
31
  composeMetaTitle,
404
- createMdxComponentsBound,
405
32
  renderDocPage
406
33
  };