create-zudo-doc 1.2.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.
Files changed (48) hide show
  1. package/dist/api.d.ts +6 -0
  2. package/dist/api.js +5 -2
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.js +4 -0
  5. package/dist/index.js +26 -1
  6. package/dist/scaffold.d.ts +1 -1
  7. package/dist/scaffold.js +10 -6
  8. package/dist/utils.d.ts +27 -0
  9. package/dist/utils.js +72 -1
  10. package/package.json +1 -1
  11. package/templates/base/pages/index.tsx +6 -4
  12. package/templates/base/pages/lib/_chrome.ts +166 -0
  13. package/templates/base/pages/lib/_doc-route-entries.ts +7 -51
  14. package/templates/base/pages/lib/_nav-source-docs.ts +9 -29
  15. package/templates/base/pages/lib/_route-context.ts +32 -0
  16. package/templates/base/src/config/tag-vocabulary-types.ts +4 -39
  17. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +137 -22
  18. package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +115 -28
  19. package/templates/features/i18n/files/pages/[locale]/index.tsx +6 -4
  20. package/templates/base/pages/_mdx-components.ts +0 -106
  21. package/templates/base/pages/lib/_category-nav.tsx +0 -34
  22. package/templates/base/pages/lib/_category-tree-nav.tsx +0 -45
  23. package/templates/base/pages/lib/_compose-meta-title.ts +0 -25
  24. package/templates/base/pages/lib/_doc-body-end.tsx +0 -8
  25. package/templates/base/pages/lib/_doc-content-header.tsx +0 -17
  26. package/templates/base/pages/lib/_doc-history-area.tsx +0 -34
  27. package/templates/base/pages/lib/_doc-metainfo-area.tsx +0 -26
  28. package/templates/base/pages/lib/_doc-page-renderer.tsx +0 -31
  29. package/templates/base/pages/lib/_doc-page-shell.tsx +0 -29
  30. package/templates/base/pages/lib/_doc-pager.tsx +0 -9
  31. package/templates/base/pages/lib/_doc-route-paths.ts +0 -16
  32. package/templates/base/pages/lib/_doc-tags-area.tsx +0 -30
  33. package/templates/base/pages/lib/_footer-with-defaults.tsx +0 -58
  34. package/templates/base/pages/lib/_head-with-defaults.tsx +0 -22
  35. package/templates/base/pages/lib/_header-with-defaults.tsx +0 -45
  36. package/templates/base/pages/lib/_inline-version-switcher.tsx +0 -23
  37. package/templates/base/pages/lib/_math-block.tsx +0 -4
  38. package/templates/base/pages/lib/_nav-data-prep.ts +0 -118
  39. package/templates/base/pages/lib/_search-widget-script.ts +0 -2
  40. package/templates/base/pages/lib/_sidebar-prepaint.tsx +0 -11
  41. package/templates/base/pages/lib/_sidebar-with-defaults.tsx +0 -26
  42. package/templates/base/pages/lib/_site-tree-nav.tsx +0 -37
  43. package/templates/base/pages/lib/_toc-title.ts +0 -3
  44. package/templates/base/pages/lib/route-enumerators.ts +0 -58
  45. package/templates/base/src/components/tree-nav-shared.tsx +0 -71
  46. package/templates/base/src/utils/content-files.ts +0 -110
  47. package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +0 -47
  48. package/templates/features/versioning/files/pages/lib/_versions-page.tsx +0 -33
@@ -1,34 +0,0 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- // Thin stub — category-nav moved to the package (epic #2344, S8).
4
- // Calls `createCategoryNavWrapper(deps)` from @takazudo/zudo-doc/category-nav
5
- // with host singletons injected, then re-exports the resulting component so
6
- // all existing call sites continue to work unchanged.
7
-
8
- import { createCategoryNavWrapper } from "@takazudo/zudo-doc/category-nav";
9
- import { buildNavTree, findNode, firstRoutedHref } from "@/utils/docs";
10
- import { defaultLocale } from "@/config/i18n";
11
- import { resolveNavSource } from "./_nav-source-docs";
12
-
13
- export type { CategoryNavWrapperProps } from "@takazudo/zudo-doc/category-nav";
14
-
15
- export const CategoryNavWrapper = createCategoryNavWrapper({
16
- defaultLocale,
17
- resolveNavSource: resolveNavSource as (
18
- lang: string,
19
- currentVersion: string | undefined,
20
- options?: { applyDefaultLocaleOnlyFilter?: boolean; keepUnlisted?: boolean },
21
- ) => import("@takazudo/zudo-doc/category-nav").CategoryNavSource,
22
- buildNavTree: buildNavTree as (
23
- docs: unknown[],
24
- locale: string,
25
- categoryMeta: Map<string, unknown>,
26
- ) => import("@takazudo/zudo-doc/category-nav").CategoryNavNode[],
27
- findNode: findNode as (
28
- tree: import("@takazudo/zudo-doc/category-nav").CategoryNavNode[],
29
- slug: string,
30
- ) => import("@takazudo/zudo-doc/category-nav").CategoryNavNode | undefined,
31
- firstRoutedHref: firstRoutedHref as (
32
- node: import("@takazudo/zudo-doc/category-nav").CategoryNavNode,
33
- ) => string | undefined,
34
- });
@@ -1,45 +0,0 @@
1
- /** @jsxRuntime automatic */
2
- /** @jsxImportSource preact */
3
- // Thin stub — category-tree-nav moved to the package (epic #2344, S8).
4
- // Calls `createCategoryTreeNavWrapper(deps)` from
5
- // @takazudo/zudo-doc/category-tree-nav with host singletons injected,
6
- // then re-exports the resulting component so all existing call sites continue
7
- // to work unchanged.
8
-
9
- import { createCategoryTreeNavWrapper } from "@takazudo/zudo-doc/category-tree-nav";
10
- import type {
11
- CategoryTreeNavNode,
12
- CategoryTreeNavSource,
13
- } from "@takazudo/zudo-doc/category-tree-nav";
14
- import { buildNavTree, groupSatelliteNodes, findNode, type NavNode } from "@/utils/docs";
15
- import { defaultLocale, type Locale } from "@/config/i18n";
16
- import type { DocsEntry } from "@/types/docs-entry";
17
- import type { CategoryMeta } from "@/utils/docs";
18
- import { resolveNavSource } from "./_nav-source-docs";
19
-
20
- export type { CategoryTreeNavWrapperProps } from "@takazudo/zudo-doc/category-tree-nav";
21
-
22
- // The factory describes its injected nav helpers with the minimal
23
- // CategoryTreeNavNode view (no `slug` / `position`), while the host helpers are
24
- // typed against the full NavNode. At runtime the nodes are real NavNodes; the
25
- // wrappers re-view them as the minimal type at the injection boundary (cast via
26
- // `unknown` because NavNode is a structural supertype of CategoryTreeNavNode,
27
- // so a direct cast is rejected as non-overlapping).
28
- export const CategoryTreeNavWrapper = createCategoryTreeNavWrapper({
29
- defaultLocale,
30
- resolveNavSource: resolveNavSource as (
31
- lang: string,
32
- currentVersion: string | undefined,
33
- options?: { applyDefaultLocaleOnlyFilter?: boolean; keepUnlisted?: boolean },
34
- ) => CategoryTreeNavSource,
35
- buildNavTree: (docs: unknown[], locale: string, categoryMeta: Map<string, unknown>) =>
36
- buildNavTree(
37
- docs as DocsEntry[],
38
- locale as Locale,
39
- categoryMeta as Map<string, CategoryMeta>,
40
- ) as unknown as CategoryTreeNavNode[],
41
- groupSatelliteNodes: (tree: CategoryTreeNavNode[], prefixes: string[]) =>
42
- groupSatelliteNodes(tree as unknown as NavNode[], prefixes) as unknown as CategoryTreeNavNode[],
43
- findNode: (tree: CategoryTreeNavNode[], slug: string) =>
44
- findNode(tree as unknown as NavNode[], slug) as unknown as CategoryTreeNavNode | undefined,
45
- });
@@ -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,2 +0,0 @@
1
- // Host thin-stub — see @takazudo/zudo-doc/search-widget-script (epic #2344, S5).
2
- export { SEARCH_WIDGET_SCRIPT } from "@takazudo/zudo-doc/search-widget-script";
@@ -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
- });