@takazudo/zudo-doc 1.3.0 → 2.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/dist/chrome/derive.d.ts +68 -0
- package/dist/chrome/derive.js +231 -0
- package/dist/chrome/index.d.ts +37 -0
- package/dist/chrome/index.js +43 -0
- package/dist/doc-body-end/index.d.ts +9 -11
- package/dist/doc-body-end/index.js +4 -2
- package/dist/doc-content-header/index.d.ts +10 -2
- package/dist/doc-content-header/index.js +8 -8
- package/dist/doc-history-area/index.d.ts +10 -25
- package/dist/doc-history-area/index.js +14 -10
- package/dist/doc-metainfo-area/index.d.ts +9 -15
- package/dist/doc-metainfo-area/index.js +6 -2
- package/dist/doc-page-renderer/index.d.ts +11 -2
- package/dist/doc-page-renderer/index.js +22 -15
- package/dist/doc-page-shell/index.d.ts +11 -3
- package/dist/doc-page-shell/index.js +21 -14
- package/dist/doc-pager/index.d.ts +6 -7
- package/dist/doc-pager/index.js +2 -2
- package/dist/doc-route-entries/index.d.ts +22 -46
- package/dist/doc-route-entries/index.js +15 -10
- package/dist/doc-tags-area/index.d.ts +9 -19
- package/dist/doc-tags-area/index.js +12 -2
- package/dist/factory-context/index.d.ts +163 -1
- package/dist/footer-with-defaults/index.d.ts +12 -13
- package/dist/footer-with-defaults/index.js +8 -10
- package/dist/head-with-defaults/index.d.ts +12 -16
- package/dist/head-with-defaults/index.js +7 -9
- package/dist/header-with-defaults/index.d.ts +10 -31
- package/dist/header-with-defaults/index.js +15 -18
- package/dist/nav-source-docs/index.d.ts +20 -54
- package/dist/nav-source-docs/index.js +9 -10
- package/dist/route-context/index.d.ts +24 -0
- package/dist/route-context/index.js +147 -0
- package/dist/route-enumerators/index.d.ts +25 -74
- package/dist/route-enumerators/index.js +17 -18
- package/dist/routes/_chrome.d.ts +6 -25
- package/dist/routes/_chrome.js +14 -387
- package/dist/routes/_context.d.ts +10 -43
- package/dist/routes/_context.js +29 -157
- package/dist/sidebar-with-defaults/index.d.ts +8 -15
- package/dist/sidebar-with-defaults/index.js +6 -10
- package/dist/tag-pages/index.d.ts +12 -3
- package/dist/tag-pages/index.js +24 -19
- package/dist/versions-page/index.d.ts +10 -3
- package/dist/versions-page/index.js +18 -14
- package/eject/doc-pager/index.tsx +8 -10
- package/package.json +9 -1
- package/routes-src/_chrome.tsx +31 -552
- package/routes-src/_context.ts +37 -269
package/dist/routes/_context.js
CHANGED
|
@@ -1,64 +1,19 @@
|
|
|
1
1
|
import { routeContext } from "virtual:zudo-doc-route-context";
|
|
2
|
-
import { makeUrlHelpers } from "../url-helpers/index.js";
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
} from "../
|
|
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";
|
|
3
|
+
createRouteContext
|
|
4
|
+
} from "../route-context/index.js";
|
|
34
5
|
const ctx = routeContext;
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const locales = [
|
|
41
|
-
defaultLocale,
|
|
42
|
-
...Object.keys(settings.locales)
|
|
43
|
-
];
|
|
44
|
-
function getLocaleConfig(locale) {
|
|
45
|
-
return settings.locales[locale];
|
|
46
|
-
}
|
|
47
|
-
function getLocaleLabel(locale) {
|
|
48
|
-
if (locale === defaultLocale) return defaultLocale.toUpperCase();
|
|
49
|
-
return getLocaleConfig(locale)?.label ?? locale.toUpperCase();
|
|
50
|
-
}
|
|
51
|
-
function t(key, locale = defaultLocale) {
|
|
52
|
-
return translations[locale]?.[key] ?? translations[defaultLocale]?.[key] ?? key;
|
|
53
|
-
}
|
|
54
|
-
const i18n = {
|
|
6
|
+
const routeCtx = createRouteContext(ctx);
|
|
7
|
+
const settings = routeCtx.settings;
|
|
8
|
+
const colorSchemes = routeCtx.colorSchemes;
|
|
9
|
+
const {
|
|
10
|
+
i18n,
|
|
55
11
|
defaultLocale,
|
|
56
12
|
locales,
|
|
13
|
+
getLocaleConfig,
|
|
57
14
|
getLocaleLabel,
|
|
58
|
-
t
|
|
59
|
-
|
|
60
|
-
const urlHelpers = makeUrlHelpers(settings, i18n);
|
|
61
|
-
const {
|
|
15
|
+
t,
|
|
16
|
+
urlHelpers,
|
|
62
17
|
withBase,
|
|
63
18
|
stripBase,
|
|
64
19
|
docsUrl,
|
|
@@ -68,115 +23,31 @@ const {
|
|
|
68
23
|
absoluteUrl,
|
|
69
24
|
isExternal,
|
|
70
25
|
resolveHref,
|
|
71
|
-
buildLocaleLinks
|
|
72
|
-
|
|
73
|
-
function getCategoryOrder() {
|
|
74
|
-
return getCategoryOrderBase(settings.headerNav);
|
|
75
|
-
}
|
|
76
|
-
function getNavSectionForSlug(slug) {
|
|
77
|
-
return getNavSectionForSlugBase(slug, settings.headerNav);
|
|
78
|
-
}
|
|
79
|
-
function getNavSubtree(tree, categoryMatch) {
|
|
80
|
-
return getNavSubtreeBase(tree, categoryMatch, settings.headerNav);
|
|
81
|
-
}
|
|
82
|
-
function extractHeadings(body) {
|
|
83
|
-
return extractHeadingsBase(body, {
|
|
84
|
-
tocMinDepth: settings.tocMinDepth,
|
|
85
|
-
tocMaxDepth: settings.tocMaxDepth,
|
|
86
|
-
strategy: settings.headingIdStrategy
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function getVocab() {
|
|
90
|
-
return settings.tagVocabulary ? tagVocabulary : false;
|
|
91
|
-
}
|
|
92
|
-
function resolveTagBound(raw) {
|
|
93
|
-
return resolveTag(raw, getVocab(), settings.tagGovernance);
|
|
94
|
-
}
|
|
95
|
-
function collectTags(entries, slugFn) {
|
|
96
|
-
const tagMap = /* @__PURE__ */ new Map();
|
|
97
|
-
for (const entry of entries) {
|
|
98
|
-
const rawTags = entry.data.tags ?? [];
|
|
99
|
-
const slug = slugFn(entry.id, entry.data);
|
|
100
|
-
const seen = /* @__PURE__ */ new Set();
|
|
101
|
-
for (const raw of rawTags) {
|
|
102
|
-
const resolved = resolveTagBound(raw);
|
|
103
|
-
if (resolved.deprecated) continue;
|
|
104
|
-
if (seen.has(resolved.canonical)) continue;
|
|
105
|
-
seen.add(resolved.canonical);
|
|
106
|
-
if (!tagMap.has(resolved.canonical)) {
|
|
107
|
-
tagMap.set(resolved.canonical, { tag: resolved.canonical, count: 0, docs: [] });
|
|
108
|
-
}
|
|
109
|
-
const info = tagMap.get(resolved.canonical);
|
|
110
|
-
info.count++;
|
|
111
|
-
info.docs.push({
|
|
112
|
-
slug,
|
|
113
|
-
title: entry.data.title ?? "",
|
|
114
|
-
description: entry.data.description
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return tagMap;
|
|
119
|
-
}
|
|
120
|
-
const navSourceDocs = createNavSourceDocs({
|
|
121
|
-
defaultLocale,
|
|
122
|
-
docsDir: settings.docsDir,
|
|
123
|
-
getVersions: () => settings.versions,
|
|
124
|
-
getLocaleConfig,
|
|
125
|
-
loadCategoryMeta,
|
|
126
|
-
isNavVisible,
|
|
127
|
-
isDefaultLocaleOnlyPath,
|
|
128
|
-
stableDocs
|
|
129
|
-
});
|
|
130
|
-
const {
|
|
131
|
-
resolveNavSource,
|
|
132
|
-
resolveVersionedLocaleSource,
|
|
133
|
-
loadNavSourceDocs
|
|
134
|
-
} = navSourceDocs;
|
|
135
|
-
const docRouteEntries = createDocRouteEntries({
|
|
136
|
-
buildNavTree: (docs, locale, categoryMeta) => buildNavTree(
|
|
137
|
-
docs,
|
|
138
|
-
locale,
|
|
139
|
-
categoryMeta,
|
|
140
|
-
(slug, loc) => docsUrl(slug, loc)
|
|
141
|
-
),
|
|
142
|
-
buildBreadcrumbs: (tree, slug, locale, urlFor) => buildBreadcrumbs(
|
|
143
|
-
tree,
|
|
144
|
-
slug,
|
|
145
|
-
locale === defaultLocale ? withBase("/") : withBase(`/${locale}/`),
|
|
146
|
-
urlFor
|
|
147
|
-
),
|
|
148
|
-
collectAutoIndexNodes,
|
|
26
|
+
buildLocaleLinks,
|
|
27
|
+
getCategoryOrder,
|
|
149
28
|
getNavSectionForSlug,
|
|
150
29
|
getNavSubtree,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
const { buildDocRouteEntries } = docRouteEntries;
|
|
156
|
-
const routeEnumerators = createRouteEnumerators({
|
|
157
|
-
defaultLocale,
|
|
158
|
-
getLocaleKeys: () => Object.keys(settings.locales),
|
|
159
|
-
getVersions: () => settings.versions,
|
|
160
|
-
getDocTags: () => settings.docTags,
|
|
161
|
-
docsUrl,
|
|
162
|
-
versionedDocsUrl,
|
|
163
|
-
withBase,
|
|
164
|
-
loadDocs: (collectionName) => stableDocs(collectionName),
|
|
165
|
-
isDefaultLocaleOnlyPath,
|
|
166
|
-
collectTags: (docs, slugFn) => collectTags(docs, slugFn),
|
|
167
|
-
toRouteSlug,
|
|
168
|
-
buildNavTree: (docs, locale, categoryMeta) => buildNavTree(docs, locale, categoryMeta, (slug, loc) => docsUrl(slug, loc)),
|
|
169
|
-
collectAutoIndexNodes,
|
|
30
|
+
extractHeadings,
|
|
31
|
+
resolveTagBound,
|
|
32
|
+
collectTags,
|
|
170
33
|
resolveNavSource,
|
|
171
34
|
resolveVersionedLocaleSource,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const {
|
|
35
|
+
loadNavSourceDocs,
|
|
36
|
+
buildDocRouteEntries,
|
|
175
37
|
enumerateDocsRoutes,
|
|
176
38
|
enumerateTagsRoutes,
|
|
177
39
|
enumerateVersionedRoutes,
|
|
178
|
-
enumerateAllRoutes
|
|
179
|
-
|
|
40
|
+
enumerateAllRoutes,
|
|
41
|
+
buildNavTree,
|
|
42
|
+
groupSatelliteNodes,
|
|
43
|
+
findNode,
|
|
44
|
+
firstRoutedHref,
|
|
45
|
+
collectAutoIndexNodes,
|
|
46
|
+
isNavVisible,
|
|
47
|
+
stableDocs,
|
|
48
|
+
toRouteSlug,
|
|
49
|
+
toSlugParams
|
|
50
|
+
} = routeCtx;
|
|
180
51
|
export {
|
|
181
52
|
absoluteUrl,
|
|
182
53
|
buildDocRouteEntries,
|
|
@@ -212,6 +83,7 @@ export {
|
|
|
212
83
|
resolveNavSource,
|
|
213
84
|
resolveTagBound,
|
|
214
85
|
resolveVersionedLocaleSource,
|
|
86
|
+
routeCtx,
|
|
215
87
|
settings,
|
|
216
88
|
stableDocs,
|
|
217
89
|
stripBase,
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/** @jsxImportSource preact */
|
|
3
3
|
import type { JSX } from "preact";
|
|
4
4
|
import type { SidebarNavNode, SidebarRootMenuItem } from "../sidebar/types.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ChromeContext } from "../factory-context/index.js";
|
|
6
|
+
import type { Settings } from "../settings.js";
|
|
6
7
|
export type { SidebarNavNode, SidebarRootMenuItem };
|
|
7
8
|
export interface SidebarWithDefaultsProps {
|
|
8
9
|
/** Slug of the active doc page, used to highlight the current entry. */
|
|
@@ -19,20 +20,12 @@ export interface SidebarWithDefaultsProps {
|
|
|
19
20
|
*/
|
|
20
21
|
currentPath?: string;
|
|
21
22
|
}
|
|
22
|
-
/** Dependencies injected by the host stub. */
|
|
23
|
-
export interface SidebarWithDefaultsDeps {
|
|
24
|
-
defaultLocale: string;
|
|
25
|
-
localeCount: number;
|
|
26
|
-
buildRootMenuItems: (lang: string, currentVersion: string | undefined) => SidebarRootMenuItem[];
|
|
27
|
-
buildLocaleLinksForNav: (currentPath: string, lang: string, localeCount: number) => LocaleLink[] | undefined;
|
|
28
|
-
buildSidebarNodes: (lang: string, navSection: string | undefined, currentVersion: string | undefined, emptyWhenUnsectioned?: boolean) => SidebarNavNode[];
|
|
29
|
-
getThemeDefaultMode: () => "light" | "dark" | undefined;
|
|
30
|
-
t: (key: string, lang: string) => string;
|
|
31
|
-
}
|
|
32
23
|
/**
|
|
33
|
-
* Create a `SidebarWithDefaults` component
|
|
24
|
+
* Create a `SidebarWithDefaults` component from the unified {@link ChromeContext}
|
|
25
|
+
* (epic Collapse Wiring Shells #2420, FACTORIES #2424 — breaking signature).
|
|
34
26
|
*
|
|
35
|
-
*
|
|
36
|
-
* the
|
|
27
|
+
* Derives its old nav-builder bag from the context: `defaultLocale`/`localeCount`
|
|
28
|
+
* (= `locales.length`)/`t` read directly; the four nav data-prep builders come
|
|
29
|
+
* from the shared `chrome/derive` helper (identical to the pre-collapse wiring).
|
|
37
30
|
*/
|
|
38
|
-
export declare function createSidebarWithDefaults(
|
|
31
|
+
export declare function createSidebarWithDefaults<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: SidebarWithDefaultsProps) => JSX.Element;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { jsx } from "preact/jsx-runtime";
|
|
2
2
|
import { Island } from "@takazudo/zfb";
|
|
3
3
|
import { SidebarTree } from "../sidebar-tree-island/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
buildSidebarNodes,
|
|
11
|
-
getThemeDefaultMode,
|
|
12
|
-
t
|
|
13
|
-
} = deps;
|
|
4
|
+
import { deriveNavDataPrep } from "../chrome/derive.js";
|
|
5
|
+
function createSidebarWithDefaults(ctx) {
|
|
6
|
+
const defaultLocale = ctx.defaultLocale;
|
|
7
|
+
const localeCount = ctx.locales.length;
|
|
8
|
+
const t = ctx.t;
|
|
9
|
+
const { buildRootMenuItems, buildLocaleLinksForNav, buildSidebarNodes, getThemeDefaultMode } = deriveNavDataPrep(ctx);
|
|
14
10
|
function SidebarWithDefaults(props) {
|
|
15
11
|
const {
|
|
16
12
|
currentSlug,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
2
|
/** @jsxImportSource preact */
|
|
3
3
|
import type { ComponentChildren, JSX } from "preact";
|
|
4
|
+
import type { ChromeContext } from "../factory-context/index.js";
|
|
5
|
+
import type { Settings } from "../settings.js";
|
|
4
6
|
/** Minimal docs entry shape needed by the tag-pages factory. */
|
|
5
7
|
export interface TagPagesDocsEntry {
|
|
6
8
|
id: string;
|
|
@@ -108,7 +110,14 @@ export interface TagPagesAPI {
|
|
|
108
110
|
}) => JSX.Element;
|
|
109
111
|
}
|
|
110
112
|
/**
|
|
111
|
-
* Create the tag-pages functions
|
|
112
|
-
*
|
|
113
|
+
* Create the tag-pages functions from the unified {@link ChromeContext}
|
|
114
|
+
* (epic Collapse Wiring Shells #2420, FACTORIES #2424 — breaking signature).
|
|
115
|
+
*
|
|
116
|
+
* Reads `settings`/`defaultLocale`/`t`/`withBase`/`docsUrl`/`collectTags`/
|
|
117
|
+
* `stableDocs` off the context, derives `composeMetaTitle`, and rebuilds the
|
|
118
|
+
* Head / Header / Footer / BodyEndIslands / DocHistoryArea chrome from the SAME
|
|
119
|
+
* context. `isDefaultLocaleOnlyPath` is left `undefined` to reproduce the
|
|
120
|
+
* pre-collapse injected wiring (`routes/_chrome.tsx` passed `undefined`) — the
|
|
121
|
+
* frozen baseline's tag pages are rendered through that path BYTE-FOR-BYTE.
|
|
113
122
|
*/
|
|
114
|
-
export declare function createTagPages(
|
|
123
|
+
export declare function createTagPages<S extends Settings = Settings>(ctx: ChromeContext<S>): TagPagesAPI;
|
package/dist/tag-pages/index.js
CHANGED
|
@@ -5,25 +5,30 @@ import { DocCardGrid, TagNav } from "../nav-indexing/index.js";
|
|
|
5
5
|
import { memoizeDerived } from "../nav-source-cache/index.js";
|
|
6
6
|
import { mergeLocaleDocs } from "../locale-merge/index.js";
|
|
7
7
|
import { toRouteSlug } from "../slug/index.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
8
|
+
import { createHeadWithDefaults } from "../head-with-defaults/index.js";
|
|
9
|
+
import { createHeaderWithDefaults } from "../header-with-defaults/index.js";
|
|
10
|
+
import { createFooterWithDefaults } from "../footer-with-defaults/index.js";
|
|
11
|
+
import { createDocHistoryArea } from "../doc-history-area/index.js";
|
|
12
|
+
import { deriveComposeMetaTitle, deriveBodyEndIslands } from "../chrome/derive.js";
|
|
13
|
+
function createTagPages(ctx) {
|
|
14
|
+
const settings = ctx.settings;
|
|
15
|
+
const defaultLocale = ctx.defaultLocale;
|
|
16
|
+
const t = ctx.t;
|
|
17
|
+
const withBase = ctx.withBase;
|
|
18
|
+
const docsUrl = ctx.docsUrl;
|
|
19
|
+
const composeMetaTitle = deriveComposeMetaTitle(ctx);
|
|
20
|
+
const collectTags = ctx.collectTags;
|
|
21
|
+
const stableDocs = ctx.stableDocs;
|
|
22
|
+
const isDefaultLocaleOnlyPath = void 0;
|
|
23
|
+
const HeadWithDefaults = createHeadWithDefaults(ctx);
|
|
24
|
+
const HeaderWithDefaults = createHeaderWithDefaults(
|
|
25
|
+
ctx
|
|
26
|
+
);
|
|
27
|
+
const FooterWithDefaults = createFooterWithDefaults(
|
|
28
|
+
ctx
|
|
29
|
+
);
|
|
30
|
+
const BodyEndIslands = deriveBodyEndIslands(ctx);
|
|
31
|
+
const DocHistoryArea = createDocHistoryArea(ctx);
|
|
27
32
|
function localePrefix(locale) {
|
|
28
33
|
return locale === defaultLocale ? "" : `/${locale}`;
|
|
29
34
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/** @jsxRuntime automatic */
|
|
2
2
|
/** @jsxImportSource preact */
|
|
3
3
|
import type { ComponentChildren, JSX } from "preact";
|
|
4
|
+
import type { ChromeContext } from "../factory-context/index.js";
|
|
5
|
+
import type { Settings } from "../settings.js";
|
|
4
6
|
/** Minimal version config entry needed by the versions page. */
|
|
5
7
|
export interface VersionsPageVersionEntry {
|
|
6
8
|
slug: string;
|
|
@@ -49,7 +51,12 @@ export interface VersionsPageViewProps {
|
|
|
49
51
|
children?: ComponentChildren;
|
|
50
52
|
}
|
|
51
53
|
/**
|
|
52
|
-
* Create a `VersionsPageView` component
|
|
53
|
-
*
|
|
54
|
+
* Create a `VersionsPageView` component from the unified {@link ChromeContext}
|
|
55
|
+
* (epic Collapse Wiring Shells #2420, FACTORIES #2424 — breaking signature).
|
|
56
|
+
*
|
|
57
|
+
* Reads `settings`/`defaultLocale`/`t`/`withBase` off the context, derives
|
|
58
|
+
* `composeMetaTitle`, and rebuilds the Head / Header / Footer / BodyEndIslands
|
|
59
|
+
* chrome from the SAME context (so the injected stub path and a host-bound
|
|
60
|
+
* context both render byte-identically).
|
|
54
61
|
*/
|
|
55
|
-
export declare function createVersionsPageView(
|
|
62
|
+
export declare function createVersionsPageView<S extends Settings = Settings>(ctx: ChromeContext<S>): (props: VersionsPageViewProps) => JSX.Element;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { Fragment, jsx } from "preact/jsx-runtime";
|
|
2
2
|
import { DocLayoutWithDefaults } from "../doclayout/index.js";
|
|
3
3
|
import { VersionsPageContent } from "../nav-indexing/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
import { createHeadWithDefaults } from "../head-with-defaults/index.js";
|
|
5
|
+
import { createHeaderWithDefaults } from "../header-with-defaults/index.js";
|
|
6
|
+
import { createFooterWithDefaults } from "../footer-with-defaults/index.js";
|
|
7
|
+
import { deriveComposeMetaTitle, deriveBodyEndIslands } from "../chrome/derive.js";
|
|
8
|
+
function createVersionsPageView(ctx) {
|
|
9
|
+
const settings = ctx.settings;
|
|
10
|
+
const defaultLocale = ctx.defaultLocale;
|
|
11
|
+
const t = ctx.t;
|
|
12
|
+
const withBase = ctx.withBase;
|
|
13
|
+
const composeMetaTitle = deriveComposeMetaTitle(ctx);
|
|
14
|
+
const HeadWithDefaults = createHeadWithDefaults(ctx);
|
|
15
|
+
const HeaderWithDefaults = createHeaderWithDefaults(
|
|
16
|
+
ctx
|
|
17
|
+
);
|
|
18
|
+
const FooterWithDefaults = createFooterWithDefaults(
|
|
19
|
+
ctx
|
|
20
|
+
);
|
|
21
|
+
const BodyEndIslands = deriveBodyEndIslands(ctx);
|
|
18
22
|
function VersionsPageView({ locale }) {
|
|
19
23
|
const isDefault = locale === defaultLocale;
|
|
20
24
|
const prefix = isDefault ? "" : `/${locale}`;
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
import type { JSX } from "preact";
|
|
11
11
|
import { ChevronLeft, ChevronRight } from "../icons/index.js";
|
|
12
|
+
import type { ChromeContext } from "../factory-context/index.js";
|
|
13
|
+
import type { Settings } from "../settings.js";
|
|
12
14
|
|
|
13
15
|
// NavNode is a superset; we only need the fields the pager uses.
|
|
14
16
|
interface PagerNode {
|
|
@@ -25,19 +27,15 @@ export interface DocPagerProps {
|
|
|
25
27
|
locale: string;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
/** Dependencies injected by the host stub. */
|
|
29
|
-
export interface DocPagerDeps {
|
|
30
|
-
/** Translate a UI string key for a locale. */
|
|
31
|
-
t: (key: string, locale: string) => string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
/**
|
|
35
|
-
* Create a `DocPager` component
|
|
31
|
+
* Create a `DocPager` component from the unified {@link ChromeContext}
|
|
32
|
+
* (epic Collapse Wiring Shells #2420, FACTORIES #2424 — breaking signature).
|
|
33
|
+
* Reads only the `t` translator off the context.
|
|
36
34
|
*/
|
|
37
|
-
export function createDocPager(
|
|
38
|
-
|
|
35
|
+
export function createDocPager<S extends Settings = Settings>(
|
|
36
|
+
ctx: ChromeContext<S>,
|
|
39
37
|
): (props: DocPagerProps) => JSX.Element {
|
|
40
|
-
const
|
|
38
|
+
const t = ctx.t;
|
|
41
39
|
|
|
42
40
|
/**
|
|
43
41
|
* Prev/next pagination nav shared by all four doc-route page components.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -207,6 +207,14 @@
|
|
|
207
207
|
"types": "./dist/mdx-components/index.d.ts",
|
|
208
208
|
"default": "./dist/mdx-components/index.js"
|
|
209
209
|
},
|
|
210
|
+
"./route-context": {
|
|
211
|
+
"types": "./dist/route-context/index.d.ts",
|
|
212
|
+
"default": "./dist/route-context/index.js"
|
|
213
|
+
},
|
|
214
|
+
"./chrome": {
|
|
215
|
+
"types": "./dist/chrome/index.d.ts",
|
|
216
|
+
"default": "./dist/chrome/index.js"
|
|
217
|
+
},
|
|
210
218
|
"./safelist.css": "./dist/safelist.css",
|
|
211
219
|
"./safelist": "./dist/safelist.css",
|
|
212
220
|
"./content.css": "./dist/content.css",
|