create-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.
- package/dist/scaffold.d.ts +1 -1
- package/dist/scaffold.js +10 -9
- package/package.json +1 -1
- package/templates/base/pages/index.tsx +6 -4
- package/templates/base/pages/lib/_chrome.ts +166 -0
- package/templates/base/pages/lib/_doc-route-entries.ts +7 -51
- package/templates/base/pages/lib/_nav-source-docs.ts +9 -29
- package/templates/base/pages/lib/_route-context.ts +32 -0
- package/templates/base/src/config/settings-types.ts +1 -0
- package/templates/base/src/config/tag-vocabulary-types.ts +4 -39
- package/templates/features/i18n/files/pages/[locale]/index.tsx +6 -4
- package/templates/base/pages/_mdx-components.ts +0 -106
- package/templates/base/pages/lib/_category-nav.tsx +0 -34
- package/templates/base/pages/lib/_category-tree-nav.tsx +0 -45
- package/templates/base/pages/lib/_compose-meta-title.ts +0 -25
- package/templates/base/pages/lib/_doc-body-end.tsx +0 -8
- package/templates/base/pages/lib/_doc-content-header.tsx +0 -17
- package/templates/base/pages/lib/_doc-history-area.tsx +0 -34
- package/templates/base/pages/lib/_doc-metainfo-area.tsx +0 -26
- package/templates/base/pages/lib/_doc-page-renderer.tsx +0 -31
- package/templates/base/pages/lib/_doc-page-shell.tsx +0 -29
- package/templates/base/pages/lib/_doc-pager.tsx +0 -9
- package/templates/base/pages/lib/_doc-route-paths.ts +0 -16
- package/templates/base/pages/lib/_doc-tags-area.tsx +0 -30
- package/templates/base/pages/lib/_footer-with-defaults.tsx +0 -58
- package/templates/base/pages/lib/_head-with-defaults.tsx +0 -22
- package/templates/base/pages/lib/_header-with-defaults.tsx +0 -45
- package/templates/base/pages/lib/_inline-version-switcher.tsx +0 -23
- package/templates/base/pages/lib/_math-block.tsx +0 -4
- package/templates/base/pages/lib/_nav-data-prep.ts +0 -118
- package/templates/base/pages/lib/_search-widget-script.ts +0 -2
- package/templates/base/pages/lib/_sidebar-prepaint.tsx +0 -11
- package/templates/base/pages/lib/_sidebar-with-defaults.tsx +0 -26
- package/templates/base/pages/lib/_site-tree-nav.tsx +0 -37
- package/templates/base/pages/lib/_toc-title.ts +0 -3
- package/templates/base/pages/lib/route-enumerators.ts +0 -58
- package/templates/base/src/components/tree-nav-shared.tsx +0 -71
- package/templates/base/src/utils/content-files.ts +0 -110
- package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +0 -47
- package/templates/features/versioning/files/pages/lib/_versions-page.tsx +0 -33
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compose the canonical "<title> | <siteName>" page-title shape used by
|
|
3
|
-
* both <title> (emitted by DocLayout) and og:title (emitted by
|
|
4
|
-
* HeadWithDefaults).
|
|
5
|
-
*
|
|
6
|
-
* Why this exists: the legacy Astro layout synthesised this suffix
|
|
7
|
-
* inline. The zfb DocLayout shell intentionally renders only what the
|
|
8
|
-
* host passes as `title`, so the host has to compose the suffix itself.
|
|
9
|
-
* Centralising the composition in one helper keeps every host call
|
|
10
|
-
* site in sync and matches the SEO/UX-recognised shape the original
|
|
11
|
-
* site shipped (also asserted by smoke-seo.spec.ts).
|
|
12
|
-
*
|
|
13
|
-
* Edge cases:
|
|
14
|
-
* - When `title` is identical to `settings.siteName` (e.g. the home
|
|
15
|
-
* page already passes `settings.siteName` as the title), do NOT
|
|
16
|
-
* duplicate — return just the bare site name. Mirrors the legacy
|
|
17
|
-
* Astro behaviour.
|
|
18
|
-
* - When `siteName` is missing/empty (defensive — settings.ts always
|
|
19
|
-
* has it in practice), fall back to the bare title.
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
import { createComposeMetaTitle } from "@takazudo/zudo-doc/compose-meta-title";
|
|
23
|
-
import { settings } from "@/config/settings";
|
|
24
|
-
|
|
25
|
-
export const composeMetaTitle = createComposeMetaTitle(settings.siteName);
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-body-end (epic #2344, S7).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { createDocBodyEnd } from "@takazudo/zudo-doc/doc-body-end";
|
|
6
|
-
import { BodyEndIslands } from "./_body-end-islands";
|
|
7
|
-
|
|
8
|
-
export const DocBodyEnd = createDocBodyEnd({ settings, BodyEndIslands });
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-content-header (epic #2344, S7).
|
|
4
|
-
import { t } from "@/config/i18n";
|
|
5
|
-
import { frontmatterRenderers } from "@/config/frontmatter-preview-renderers";
|
|
6
|
-
import { createDocContentHeader } from "@takazudo/zudo-doc/doc-content-header";
|
|
7
|
-
import { buildFrontmatterPreviewEntries } from "./_frontmatter-preview-data";
|
|
8
|
-
import { DocMetainfoArea } from "./_doc-metainfo-area";
|
|
9
|
-
import { DocTagsArea } from "./_doc-tags-area";
|
|
10
|
-
|
|
11
|
-
export const DocContentHeader = createDocContentHeader({
|
|
12
|
-
t,
|
|
13
|
-
buildFrontmatterPreviewEntries,
|
|
14
|
-
frontmatterRenderers,
|
|
15
|
-
DocMetainfoArea,
|
|
16
|
-
DocTagsArea,
|
|
17
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-history-area (epic #2344, S7).
|
|
4
|
-
//
|
|
5
|
-
// The DocHistory import is kept here so zfb's island scanner walks the chain:
|
|
6
|
-
// page → stub → DocHistory. The factory receives the constructor via deps.
|
|
7
|
-
import { settings } from "@/config/settings";
|
|
8
|
-
import { defaultLocale, t } from "@/config/i18n";
|
|
9
|
-
import { toHistorySlug } from "@/utils/slug";
|
|
10
|
-
import { buildGitHubSourceUrl as _buildGitHubSourceUrl } from "@/utils/github";
|
|
11
|
-
import { createDocHistoryArea } from "@takazudo/zudo-doc/doc-history-area";
|
|
12
|
-
import { DocHistory } from "@takazudo/zudo-doc/doc-history";
|
|
13
|
-
// SSR author + date metadata comes from `.zfb/doc-history-meta.json`, a
|
|
14
|
-
// build-time manifest emitted by `scripts/zfb-prebuild.mjs` (step 2:
|
|
15
|
-
// doc-history-meta) before `zfb build` runs. esbuild inlines the JSON
|
|
16
|
-
// statically so no Node-only `fs` code reaches the client bundle.
|
|
17
|
-
// The `#doc-history-meta` alias is defined in tsconfig.json and resolves
|
|
18
|
-
// to the absolute path of `.zfb/doc-history-meta.json` — this is needed
|
|
19
|
-
// because the zfb bundler builds pages from a shadow tree; relative paths
|
|
20
|
-
// across the shadow boundary would resolve to the wrong location.
|
|
21
|
-
import docHistoryMeta from "#doc-history-meta";
|
|
22
|
-
import type { DocHistoryAreaProps } from "@takazudo/zudo-doc/doc-history-area";
|
|
23
|
-
|
|
24
|
-
export type { DocHistoryAreaProps };
|
|
25
|
-
|
|
26
|
-
export const DocHistoryArea = createDocHistoryArea({
|
|
27
|
-
settings,
|
|
28
|
-
defaultLocale,
|
|
29
|
-
docHistoryMeta: docHistoryMeta as Record<string, { author: string; createdDate: string; updatedDate: string; ext?: string }>,
|
|
30
|
-
t,
|
|
31
|
-
toHistorySlug,
|
|
32
|
-
buildGitHubSourceUrl: (contentDir: string, entryId: string) => _buildGitHubSourceUrl(contentDir, entryId),
|
|
33
|
-
DocHistory,
|
|
34
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-metainfo-area (epic #2344, S7).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { defaultLocale, t } from "@/config/i18n";
|
|
6
|
-
import { toHistorySlug } from "@/utils/slug";
|
|
7
|
-
import { createDocMetainfoArea } from "@takazudo/zudo-doc/doc-metainfo-area";
|
|
8
|
-
// SSR author + date metadata comes from `.zfb/doc-history-meta.json`, a
|
|
9
|
-
// build-time manifest emitted by `scripts/zfb-prebuild.mjs` (step 2:
|
|
10
|
-
// doc-history-meta) before `zfb build` runs. esbuild inlines the JSON
|
|
11
|
-
// statically so no Node-only `fs` code reaches the client bundle.
|
|
12
|
-
// The `#doc-history-meta` alias is defined in tsconfig.json and resolves
|
|
13
|
-
// to the absolute path of `.zfb/doc-history-meta.json` — this is needed
|
|
14
|
-
// because the zfb bundler builds pages from a shadow tree; relative paths
|
|
15
|
-
// across the shadow boundary would resolve to the wrong location.
|
|
16
|
-
import docHistoryMeta from "#doc-history-meta";
|
|
17
|
-
|
|
18
|
-
export type { DocMetainfoAreaProps } from "@takazudo/zudo-doc/doc-metainfo-area";
|
|
19
|
-
|
|
20
|
-
export const DocMetainfoArea = createDocMetainfoArea({
|
|
21
|
-
settings,
|
|
22
|
-
defaultLocale,
|
|
23
|
-
docHistoryMeta: docHistoryMeta as Record<string, { author: string; createdDate: string; updatedDate: string }>,
|
|
24
|
-
t,
|
|
25
|
-
toHistorySlug,
|
|
26
|
-
});
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-page-renderer (epic #2344, S7).
|
|
4
|
-
import { t } from "@/config/i18n";
|
|
5
|
-
import { docsUrl, versionedDocsUrl, absoluteUrl } from "@/utils/base";
|
|
6
|
-
import { getNavSectionForSlug } from "@/utils/nav-scope";
|
|
7
|
-
import { toRouteSlug } from "@/utils/slug";
|
|
8
|
-
import { createMdxComponents } from "../_mdx-components";
|
|
9
|
-
import { createRenderDocPage } from "@takazudo/zudo-doc/doc-page-renderer";
|
|
10
|
-
import { buildInlineVersionSwitcher } from "./_inline-version-switcher";
|
|
11
|
-
import { DocPageShell } from "./_doc-page-shell";
|
|
12
|
-
import { DocContentHeader } from "./_doc-content-header";
|
|
13
|
-
import { DocMetainfoArea } from "./_doc-metainfo-area";
|
|
14
|
-
import { DocHistoryArea } from "./_doc-history-area";
|
|
15
|
-
|
|
16
|
-
export type { RenderDocPageOptions } from "@takazudo/zudo-doc/doc-page-renderer";
|
|
17
|
-
|
|
18
|
-
export const renderDocPage = createRenderDocPage({
|
|
19
|
-
docsUrl,
|
|
20
|
-
versionedDocsUrl,
|
|
21
|
-
absoluteUrl,
|
|
22
|
-
getNavSectionForSlug,
|
|
23
|
-
toRouteSlug,
|
|
24
|
-
createMdxComponents,
|
|
25
|
-
t,
|
|
26
|
-
buildInlineVersionSwitcher,
|
|
27
|
-
DocPageShell,
|
|
28
|
-
DocContentHeader,
|
|
29
|
-
DocMetainfoArea,
|
|
30
|
-
DocHistoryArea,
|
|
31
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-page-shell (epic #2344, S5).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { createDocPageShell } from "@takazudo/zudo-doc/doc-page-shell";
|
|
6
|
-
import { composeMetaTitle } from "./_compose-meta-title";
|
|
7
|
-
import { getTocTitle } from "./_toc-title";
|
|
8
|
-
import { HeadWithDefaults } from "./_head-with-defaults";
|
|
9
|
-
import { SidebarWithDefaults } from "./_sidebar-with-defaults";
|
|
10
|
-
import { HeaderWithDefaults } from "./_header-with-defaults";
|
|
11
|
-
import { FooterWithDefaults } from "./_footer-with-defaults";
|
|
12
|
-
import { SidebarPrepaint } from "./_sidebar-prepaint";
|
|
13
|
-
import { DocBodyEnd } from "./_doc-body-end";
|
|
14
|
-
import { DocPager } from "./_doc-pager";
|
|
15
|
-
|
|
16
|
-
export type { DocPageShellProps } from "@takazudo/zudo-doc/doc-page-shell";
|
|
17
|
-
|
|
18
|
-
export const DocPageShell = createDocPageShell({
|
|
19
|
-
settings,
|
|
20
|
-
composeMetaTitle,
|
|
21
|
-
getTocTitle,
|
|
22
|
-
HeadWithDefaults,
|
|
23
|
-
SidebarWithDefaults,
|
|
24
|
-
HeaderWithDefaults,
|
|
25
|
-
FooterWithDefaults,
|
|
26
|
-
SidebarPrepaint,
|
|
27
|
-
DocBodyEnd,
|
|
28
|
-
DocPager,
|
|
29
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-pager (epic #2344, S7).
|
|
4
|
-
import { t } from "@/config/i18n";
|
|
5
|
-
import { createDocPager } from "@takazudo/zudo-doc/doc-pager";
|
|
6
|
-
|
|
7
|
-
export type { DocPagerProps } from "@takazudo/zudo-doc/doc-pager";
|
|
8
|
-
|
|
9
|
-
export const DocPager = createDocPager({ t });
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Thin stub — doc-route-paths moved to the package (epic #2344, S6).
|
|
2
|
-
// Re-exports the pure prop-builder helpers from @takazudo/zudo-doc/doc-route-paths.
|
|
3
|
-
|
|
4
|
-
export type {
|
|
5
|
-
DocNavNode,
|
|
6
|
-
PaginationOverrides,
|
|
7
|
-
} from "@takazudo/zudo-doc/doc-route-paths";
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
flattenTree,
|
|
11
|
-
findNode,
|
|
12
|
-
flattenSubtree,
|
|
13
|
-
resolveDocPrevNext,
|
|
14
|
-
rewriteNavHref,
|
|
15
|
-
remapNavChildHrefs,
|
|
16
|
-
} from "@takazudo/zudo-doc/doc-route-paths";
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/doc-tags-area (epic #2344, S7).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { defaultLocale, t } from "@/config/i18n";
|
|
6
|
-
import { withBase } from "@/utils/base";
|
|
7
|
-
import { tagVocabulary } from "@/config/tag-vocabulary";
|
|
8
|
-
import { createDocTagsArea } from "@takazudo/zudo-doc/doc-tags-area";
|
|
9
|
-
|
|
10
|
-
// Inlined from the original _doc-tags-area.tsx `tagHref` helper.
|
|
11
|
-
// Builds the base-prefixed tag detail page href for the given locale.
|
|
12
|
-
// The tag segment is URL-encoded at the href site only.
|
|
13
|
-
function tagHref(tag: string, locale: string): string {
|
|
14
|
-
const encoded = encodeURIComponent(tag);
|
|
15
|
-
const path =
|
|
16
|
-
locale === defaultLocale
|
|
17
|
-
? `/docs/tags/${encoded}`
|
|
18
|
-
: `/${locale}/docs/tags/${encoded}`;
|
|
19
|
-
return withBase(path);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type { DocTagsAreaProps } from "@takazudo/zudo-doc/doc-tags-area";
|
|
23
|
-
|
|
24
|
-
export const DocTagsArea = createDocTagsArea({
|
|
25
|
-
settings,
|
|
26
|
-
defaultLocale,
|
|
27
|
-
tagVocabularyEntries: tagVocabulary,
|
|
28
|
-
tagHref,
|
|
29
|
-
t,
|
|
30
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/footer-with-defaults (epic #2344, S5).
|
|
4
|
-
// Wires host singletons into the package factory and passes the tag loading
|
|
5
|
-
// function as a dependency so the factory never imports @/ aliases.
|
|
6
|
-
import { settings } from "@/config/settings";
|
|
7
|
-
import { isExternal, resolveHref, withBase } from "@/utils/base";
|
|
8
|
-
import { defaultLocale } from "@/config/i18n";
|
|
9
|
-
import { tagVocabulary } from "@/config/tag-vocabulary";
|
|
10
|
-
import { collectTags } from "@/utils/tags";
|
|
11
|
-
import { toRouteSlug } from "@/utils/slug";
|
|
12
|
-
import { mergeLocaleDocs } from "./locale-merge";
|
|
13
|
-
import { stableDocs, memoizeDerived } from "./_nav-source-cache";
|
|
14
|
-
import type { DocsEntry } from "@/types/docs-entry";
|
|
15
|
-
import { createFooterWithDefaults } from "@takazudo/zudo-doc/footer-with-defaults";
|
|
16
|
-
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Tag loading (host-side, reads collections via stableDocs / memoizeDerived)
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
|
|
21
|
-
function loadTagsForLocale(lang: string) {
|
|
22
|
-
if (lang === defaultLocale) {
|
|
23
|
-
const baseDocs = stableDocs("docs");
|
|
24
|
-
return memoizeDerived([baseDocs], "footerTaglist;default", () => {
|
|
25
|
-
const docs: DocsEntry[] = baseDocs.filter(
|
|
26
|
-
(d) => !d.data.draft && !d.data.unlisted && !d.data.category_no_page,
|
|
27
|
-
);
|
|
28
|
-
const tagMap = collectTags(docs, (id, data) => data.slug ?? toRouteSlug(id));
|
|
29
|
-
return [...tagMap.values()].sort((a, b) => a.tag.localeCompare(b.tag, lang));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
const baseDocs = stableDocs("docs");
|
|
33
|
-
const localeDocs = stableDocs(`docs-${lang}`);
|
|
34
|
-
return memoizeDerived([baseDocs, localeDocs], `footerTaglist;${lang}`, () => {
|
|
35
|
-
const result = mergeLocaleDocs({
|
|
36
|
-
baseDocs: baseDocs.filter((d) => !d.data.draft),
|
|
37
|
-
localeDocs: localeDocs.filter((d) => !d.data.draft),
|
|
38
|
-
applyDefaultLocaleOnlyFilter: true,
|
|
39
|
-
});
|
|
40
|
-
const docs: DocsEntry[] = result.docs.filter((d) => !d.data.category_no_page);
|
|
41
|
-
const tagMap = collectTags(docs, (id, data) => data.slug ?? toRouteSlug(id));
|
|
42
|
-
return [...tagMap.values()].sort((a, b) => a.tag.localeCompare(b.tag, lang));
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
// Thin-stub export
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
export const FooterWithDefaults = createFooterWithDefaults({
|
|
51
|
-
settings,
|
|
52
|
-
defaultLocale,
|
|
53
|
-
tagVocabulary,
|
|
54
|
-
isExternal,
|
|
55
|
-
resolveHref,
|
|
56
|
-
withBase,
|
|
57
|
-
loadTagsForLocale,
|
|
58
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/head-with-defaults (epic #2344, S5).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { withBase, absoluteUrl } from "@/utils/base";
|
|
6
|
-
import {
|
|
7
|
-
generateCssCustomProperties,
|
|
8
|
-
generateLightDarkCssProperties,
|
|
9
|
-
} from "@/config/color-scheme-utils";
|
|
10
|
-
import { composeMetaTitle } from "./_compose-meta-title";
|
|
11
|
-
import { createHeadWithDefaults } from "@takazudo/zudo-doc/head-with-defaults";
|
|
12
|
-
|
|
13
|
-
export type { HeadWithDefaultsProps } from "@takazudo/zudo-doc/head-with-defaults";
|
|
14
|
-
|
|
15
|
-
export const HeadWithDefaults = createHeadWithDefaults({
|
|
16
|
-
settings,
|
|
17
|
-
composeMetaTitle,
|
|
18
|
-
withBase,
|
|
19
|
-
absoluteUrl,
|
|
20
|
-
generateCssCustomProperties,
|
|
21
|
-
generateLightDarkCssProperties,
|
|
22
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/header-with-defaults (epic #2344, S5).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { defaultLocale, locales, t, type Locale } from "@/config/i18n";
|
|
6
|
-
import { buildGitHubRepoUrl } from "@/utils/github";
|
|
7
|
-
import {
|
|
8
|
-
docsUrl,
|
|
9
|
-
navHref,
|
|
10
|
-
stripBase,
|
|
11
|
-
versionedDocsUrl,
|
|
12
|
-
withBase,
|
|
13
|
-
} from "@/utils/base";
|
|
14
|
-
import { createHeaderWithDefaults } from "@takazudo/zudo-doc/header-with-defaults";
|
|
15
|
-
import { SearchWidget } from "./_search-widget";
|
|
16
|
-
import {
|
|
17
|
-
buildRootMenuItems,
|
|
18
|
-
buildLocaleLinksForNav,
|
|
19
|
-
buildSidebarNodes,
|
|
20
|
-
getThemeDefaultMode,
|
|
21
|
-
} from "./_nav-data-prep";
|
|
22
|
-
|
|
23
|
-
export type { HeaderWithDefaultsProps } from "@takazudo/zudo-doc/header-with-defaults";
|
|
24
|
-
|
|
25
|
-
export const HeaderWithDefaults = createHeaderWithDefaults({
|
|
26
|
-
settings,
|
|
27
|
-
defaultLocale,
|
|
28
|
-
locales,
|
|
29
|
-
t: (key, lang) => t(key as Parameters<typeof t>[0], lang as Locale),
|
|
30
|
-
withBase,
|
|
31
|
-
stripBase,
|
|
32
|
-
docsUrl: (slug, lang) => docsUrl(slug, lang as Locale),
|
|
33
|
-
navHref: (path, lang, version) => navHref(path, lang as Locale | undefined, version),
|
|
34
|
-
versionedDocsUrl: (slug, versionSlug, lang) =>
|
|
35
|
-
versionedDocsUrl(slug, versionSlug, lang as Locale),
|
|
36
|
-
buildLocaleLinksForNav: (currentPath, lang, localeCount) =>
|
|
37
|
-
buildLocaleLinksForNav(currentPath, lang as Locale, localeCount),
|
|
38
|
-
buildRootMenuItems: (lang, currentVersion) =>
|
|
39
|
-
buildRootMenuItems(lang as Locale, currentVersion),
|
|
40
|
-
buildSidebarNodes: (lang, navSection, currentVersion) =>
|
|
41
|
-
buildSidebarNodes(lang as Locale, navSection, currentVersion),
|
|
42
|
-
getThemeDefaultMode,
|
|
43
|
-
buildGitHubRepoUrl,
|
|
44
|
-
SearchWidget,
|
|
45
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Thin stub — inline-version-switcher moved to the package (epic #2344, S8).
|
|
4
|
-
// Calls `createInlineVersionSwitcher(deps)` from
|
|
5
|
-
// @takazudo/zudo-doc/inline-version-switcher with host singletons injected,
|
|
6
|
-
// then re-exports the resulting builder so all existing call sites continue
|
|
7
|
-
// to work unchanged.
|
|
8
|
-
|
|
9
|
-
import { createInlineVersionSwitcher } from "@takazudo/zudo-doc/inline-version-switcher";
|
|
10
|
-
import { settings } from "@/config/settings";
|
|
11
|
-
import { defaultLocale, t } from "@/config/i18n";
|
|
12
|
-
import { docsUrl, versionedDocsUrl, withBase } from "@/utils/base";
|
|
13
|
-
|
|
14
|
-
export { type InlineVersionSwitcherVersionEntry } from "@takazudo/zudo-doc/inline-version-switcher";
|
|
15
|
-
|
|
16
|
-
export const buildInlineVersionSwitcher = createInlineVersionSwitcher({
|
|
17
|
-
settings,
|
|
18
|
-
defaultLocale,
|
|
19
|
-
t,
|
|
20
|
-
docsUrl,
|
|
21
|
-
versionedDocsUrl,
|
|
22
|
-
withBase,
|
|
23
|
-
});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// Re-export from the shared package — moved to @takazudo/zudo-doc/math-block
|
|
2
|
-
// as part of the package-first migration (epic #2321, S4 #2327).
|
|
3
|
-
export type { MathBlockProps } from "@takazudo/zudo-doc/math-block";
|
|
4
|
-
export { MathBlock } from "@takazudo/zudo-doc/math-block";
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
// Host thin-stub for nav data-prep utilities (epic #2344, S5).
|
|
2
|
-
// Imports core logic from @takazudo/zudo-doc and wires host singletons.
|
|
3
|
-
//
|
|
4
|
-
// Package exports the pure parameterized functions; this stub binds
|
|
5
|
-
// them to the host's `settings`, `i18n`, and `base` singletons so
|
|
6
|
-
// existing call sites (_header-with-defaults.tsx, _sidebar-with-defaults.tsx)
|
|
7
|
-
// are unchanged.
|
|
8
|
-
|
|
9
|
-
import { settings } from "@/config/settings";
|
|
10
|
-
import { t, type Locale } from "@/config/i18n";
|
|
11
|
-
import {
|
|
12
|
-
buildLocaleLinks,
|
|
13
|
-
navHref,
|
|
14
|
-
versionedDocsUrl,
|
|
15
|
-
} from "@/utils/base";
|
|
16
|
-
import { type NavNode } from "@/utils/docs";
|
|
17
|
-
import { buildSidebarForSection } from "@/utils/sidebar";
|
|
18
|
-
import { loadNavSourceDocs } from "./_nav-source-docs";
|
|
19
|
-
import {
|
|
20
|
-
remapVersionedHrefs as _remapVersionedHrefs,
|
|
21
|
-
buildRootMenuItems as _buildRootMenuItems,
|
|
22
|
-
buildLocaleLinksForNav as _buildLocaleLinksForNav,
|
|
23
|
-
getThemeDefaultMode as _getThemeDefaultMode,
|
|
24
|
-
} from "@takazudo/zudo-doc/nav-data-prep";
|
|
25
|
-
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
// remapVersionedHrefs
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Walk the nav tree and rewrite each node's `href` to its versioned form.
|
|
32
|
-
*/
|
|
33
|
-
export function remapVersionedHrefs(
|
|
34
|
-
nodes: NavNode[],
|
|
35
|
-
version: string,
|
|
36
|
-
nodeLang: Locale,
|
|
37
|
-
): NavNode[] {
|
|
38
|
-
return _remapVersionedHrefs(
|
|
39
|
-
nodes,
|
|
40
|
-
version,
|
|
41
|
-
nodeLang,
|
|
42
|
-
(slug, v, lang) => versionedDocsUrl(slug, v, lang as Locale),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
// buildRootMenuItems
|
|
48
|
-
// ---------------------------------------------------------------------------
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Root-menu items derived from settings.headerNav (mobile "back to menu" list).
|
|
52
|
-
*/
|
|
53
|
-
export function buildRootMenuItems(
|
|
54
|
-
lang: Locale,
|
|
55
|
-
currentVersion?: string,
|
|
56
|
-
) {
|
|
57
|
-
return _buildRootMenuItems(
|
|
58
|
-
lang,
|
|
59
|
-
currentVersion,
|
|
60
|
-
settings.headerNav,
|
|
61
|
-
(key, l) => t(key as Parameters<typeof t>[0], l as Locale),
|
|
62
|
-
(path, l, v) => navHref(path, l as Locale | undefined, v),
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
// buildLocaleLinksForNav
|
|
68
|
-
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Locale-switcher links for the mobile sidebar footer and language switcher.
|
|
72
|
-
* Returns `undefined` when only one locale is configured (single-locale guard).
|
|
73
|
-
*/
|
|
74
|
-
export function buildLocaleLinksForNav(
|
|
75
|
-
currentPath: string,
|
|
76
|
-
lang: Locale,
|
|
77
|
-
localeCount: number,
|
|
78
|
-
) {
|
|
79
|
-
return _buildLocaleLinksForNav(
|
|
80
|
-
currentPath,
|
|
81
|
-
lang,
|
|
82
|
-
localeCount,
|
|
83
|
-
(path, l) => buildLocaleLinks(path, l as Locale),
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// ---------------------------------------------------------------------------
|
|
88
|
-
// buildSidebarNodes
|
|
89
|
-
// ---------------------------------------------------------------------------
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Build the resolved sidebar node list for a given section + version.
|
|
93
|
-
*/
|
|
94
|
-
export function buildSidebarNodes(
|
|
95
|
-
lang: Locale,
|
|
96
|
-
navSection: string | undefined,
|
|
97
|
-
currentVersion?: string,
|
|
98
|
-
emptyWhenUnsectioned = true,
|
|
99
|
-
): NavNode[] {
|
|
100
|
-
if (navSection === undefined && emptyWhenUnsectioned) return [];
|
|
101
|
-
const { navDocs, categoryMeta } = loadNavSourceDocs(lang, currentVersion);
|
|
102
|
-
const rawNodes = buildSidebarForSection(navDocs, lang, navSection, categoryMeta);
|
|
103
|
-
return currentVersion
|
|
104
|
-
? remapVersionedHrefs(rawNodes, currentVersion, lang)
|
|
105
|
-
: rawNodes;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// ---------------------------------------------------------------------------
|
|
109
|
-
// themeDefaultMode
|
|
110
|
-
// ---------------------------------------------------------------------------
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Extract the configured default color mode from settings.
|
|
114
|
-
* Returns `undefined` when color mode is not configured (single-scheme projects).
|
|
115
|
-
*/
|
|
116
|
-
export function getThemeDefaultMode() {
|
|
117
|
-
return _getThemeDefaultMode(settings.colorMode);
|
|
118
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/sidebar-prepaint (epic #2344, S5).
|
|
4
|
-
import { settings } from "@/config/settings";
|
|
5
|
-
import { createSidebarPrepaint } from "@takazudo/zudo-doc/sidebar-prepaint";
|
|
6
|
-
|
|
7
|
-
export type { SidebarPrepaintProps } from "@takazudo/zudo-doc/sidebar-prepaint";
|
|
8
|
-
|
|
9
|
-
export const SidebarPrepaint = createSidebarPrepaint({
|
|
10
|
-
sidebarToggle: Boolean(settings.sidebarToggle),
|
|
11
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Host thin-stub — see @takazudo/zudo-doc/sidebar-with-defaults (epic #2344, S5).
|
|
4
|
-
import { defaultLocale, locales, t, type Locale } from "@/config/i18n";
|
|
5
|
-
import { createSidebarWithDefaults } from "@takazudo/zudo-doc/sidebar-with-defaults";
|
|
6
|
-
import {
|
|
7
|
-
buildRootMenuItems,
|
|
8
|
-
buildLocaleLinksForNav,
|
|
9
|
-
buildSidebarNodes,
|
|
10
|
-
getThemeDefaultMode,
|
|
11
|
-
} from "./_nav-data-prep";
|
|
12
|
-
|
|
13
|
-
export type { SidebarWithDefaultsProps } from "@takazudo/zudo-doc/sidebar-with-defaults";
|
|
14
|
-
|
|
15
|
-
export const SidebarWithDefaults = createSidebarWithDefaults({
|
|
16
|
-
defaultLocale,
|
|
17
|
-
localeCount: locales.length,
|
|
18
|
-
buildRootMenuItems: (lang, currentVersion) =>
|
|
19
|
-
buildRootMenuItems(lang as Locale, currentVersion),
|
|
20
|
-
buildLocaleLinksForNav: (currentPath, lang, localeCount) =>
|
|
21
|
-
buildLocaleLinksForNav(currentPath, lang as Locale, localeCount),
|
|
22
|
-
buildSidebarNodes: (lang, navSection, currentVersion, emptyWhenUnsectioned) =>
|
|
23
|
-
buildSidebarNodes(lang as Locale, navSection, currentVersion, emptyWhenUnsectioned),
|
|
24
|
-
getThemeDefaultMode,
|
|
25
|
-
t: (key, lang) => t(key as Parameters<typeof t>[0], lang as Locale),
|
|
26
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** @jsxRuntime automatic */
|
|
2
|
-
/** @jsxImportSource preact */
|
|
3
|
-
// Thin stub — site-tree-nav moved to the package (epic #2344, S8).
|
|
4
|
-
// Calls `createSiteTreeNavWrapper(deps)` from @takazudo/zudo-doc/site-tree-nav
|
|
5
|
-
// with host singletons injected, then re-exports the resulting component so
|
|
6
|
-
// all existing call sites continue to work unchanged.
|
|
7
|
-
//
|
|
8
|
-
// IMPORTANT: Island({when:"idle"}) is PRESERVED in the package factory —
|
|
9
|
-
// the island mounts after the page is idle for performance (refs #1453).
|
|
10
|
-
|
|
11
|
-
import { createSiteTreeNavWrapper } from "@takazudo/zudo-doc/site-tree-nav";
|
|
12
|
-
import type { SidebarNavNode } from "@takazudo/zudo-doc/sidebar/types";
|
|
13
|
-
import { buildNavTree, groupSatelliteNodes } from "@/utils/docs";
|
|
14
|
-
import { defaultLocale } from "@/config/i18n";
|
|
15
|
-
import { getCategoryOrder } from "@/utils/nav-scope";
|
|
16
|
-
import { resolveNavSource } from "./_nav-source-docs";
|
|
17
|
-
|
|
18
|
-
export type { SiteTreeNavWrapperProps } from "@takazudo/zudo-doc/site-tree-nav";
|
|
19
|
-
|
|
20
|
-
export const SiteTreeNavWrapper = createSiteTreeNavWrapper({
|
|
21
|
-
defaultLocale,
|
|
22
|
-
resolveNavSource: resolveNavSource as (
|
|
23
|
-
lang: string,
|
|
24
|
-
currentVersion: string | undefined,
|
|
25
|
-
options?: { applyDefaultLocaleOnlyFilter?: boolean; keepUnlisted?: boolean },
|
|
26
|
-
) => import("@takazudo/zudo-doc/site-tree-nav").SiteTreeNavSource,
|
|
27
|
-
buildNavTree: buildNavTree as (
|
|
28
|
-
docs: unknown[],
|
|
29
|
-
locale: string,
|
|
30
|
-
categoryMeta: Map<string, unknown>,
|
|
31
|
-
) => SidebarNavNode[],
|
|
32
|
-
groupSatelliteNodes: groupSatelliteNodes as (
|
|
33
|
-
tree: SidebarNavNode[],
|
|
34
|
-
prefixes: string[],
|
|
35
|
-
) => SidebarNavNode[],
|
|
36
|
-
getCategoryOrder,
|
|
37
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// Thin stub — route-enumerators moved to the package (epic #2344, S6).
|
|
2
|
-
// Calls `createRouteEnumerators(ctx)` from @takazudo/zudo-doc/route-enumerators
|
|
3
|
-
// with the host singletons injected, then re-exports the resulting enumeration
|
|
4
|
-
// functions so all existing call sites continue to work unchanged.
|
|
5
|
-
|
|
6
|
-
import { createRouteEnumerators } from "@takazudo/zudo-doc/route-enumerators";
|
|
7
|
-
import type {
|
|
8
|
-
DocsEntryForTags,
|
|
9
|
-
TagInfoForEnum,
|
|
10
|
-
DocPageEntry,
|
|
11
|
-
DocNavNode,
|
|
12
|
-
} from "@takazudo/zudo-doc/route-enumerators";
|
|
13
|
-
import { settings } from "@/config/settings";
|
|
14
|
-
import { defaultLocale, type Locale } from "@/config/i18n";
|
|
15
|
-
import { docsUrl, versionedDocsUrl, withBase, isDefaultLocaleOnlyPath } from "@/utils/base";
|
|
16
|
-
import { buildNavTree, collectAutoIndexNodes, type CategoryMeta } from "@/utils/docs";
|
|
17
|
-
import { collectTags } from "@/utils/tags";
|
|
18
|
-
import { toRouteSlug } from "@/utils/slug";
|
|
19
|
-
import type { DocsEntry } from "@/types/docs-entry";
|
|
20
|
-
import { loadDocs } from "../_data";
|
|
21
|
-
import { resolveNavSource, resolveVersionedLocaleSource } from "./_nav-source-docs";
|
|
22
|
-
import { mergeLocaleDocs } from "./locale-merge";
|
|
23
|
-
|
|
24
|
-
export const {
|
|
25
|
-
enumerateDocsRoutes,
|
|
26
|
-
enumerateTagsRoutes,
|
|
27
|
-
enumerateVersionedRoutes,
|
|
28
|
-
enumerateAllRoutes,
|
|
29
|
-
} = createRouteEnumerators({
|
|
30
|
-
defaultLocale,
|
|
31
|
-
getLocaleKeys: () => Object.keys(settings.locales),
|
|
32
|
-
getVersions: () => settings.versions,
|
|
33
|
-
getDocTags: () => settings.docTags,
|
|
34
|
-
docsUrl,
|
|
35
|
-
versionedDocsUrl,
|
|
36
|
-
withBase,
|
|
37
|
-
loadDocs,
|
|
38
|
-
isDefaultLocaleOnlyPath,
|
|
39
|
-
// The factory describes collectTags / buildNavTree with the package's minimal
|
|
40
|
-
// structural slots (DocsEntryForTags / DocPageEntry / Map<string, unknown> /
|
|
41
|
-
// TagInfoForEnum). The host helpers are typed against the concrete project
|
|
42
|
-
// types (DocsEntry / NavNode / the Locale union / TagInfo) but are runtime-
|
|
43
|
-
// identical, so the stub adapts them with thin casting wrappers at the
|
|
44
|
-
// injection boundary where the host owns the type knowledge.
|
|
45
|
-
collectTags: (docs: DocsEntryForTags[], slugFn): Map<string, TagInfoForEnum> =>
|
|
46
|
-
collectTags(docs as unknown as DocsEntry[], slugFn),
|
|
47
|
-
toRouteSlug,
|
|
48
|
-
buildNavTree: (docs: DocPageEntry[], locale: string, categoryMeta: Map<string, unknown>) =>
|
|
49
|
-
buildNavTree(
|
|
50
|
-
docs as unknown as DocsEntry[],
|
|
51
|
-
locale as Locale,
|
|
52
|
-
categoryMeta as Map<string, CategoryMeta>,
|
|
53
|
-
) as DocNavNode[],
|
|
54
|
-
collectAutoIndexNodes,
|
|
55
|
-
resolveNavSource,
|
|
56
|
-
resolveVersionedLocaleSource,
|
|
57
|
-
mergeLocaleDocs,
|
|
58
|
-
});
|