create-zudo-doc 0.2.21 → 1.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 (92) hide show
  1. package/dist/compose.d.ts +6 -3
  2. package/dist/compose.js +6 -4
  3. package/dist/features/image-enlarge.d.ts +22 -12
  4. package/dist/features/image-enlarge.js +23 -191
  5. package/dist/scaffold.d.ts +11 -0
  6. package/dist/scaffold.js +51 -24
  7. package/dist/settings-gen.js +4 -0
  8. package/dist/zfb-config-gen.d.ts +16 -10
  9. package/dist/zfb-config-gen.js +34 -239
  10. package/package.json +1 -1
  11. package/templates/base/pages/_mdx-components.ts +64 -185
  12. package/templates/base/pages/index.tsx +1 -1
  13. package/templates/base/pages/lib/_body-end-islands.tsx +6 -13
  14. package/templates/base/pages/lib/_category-nav.tsx +30 -115
  15. package/templates/base/pages/lib/_category-tree-nav.tsx +38 -65
  16. package/templates/base/pages/lib/_compose-meta-title.ts +2 -6
  17. package/templates/base/pages/lib/_doc-body-end.tsx +3 -35
  18. package/templates/base/pages/lib/_doc-content-header.tsx +10 -111
  19. package/templates/base/pages/lib/_doc-history-area.tsx +19 -211
  20. package/templates/base/pages/lib/_doc-metainfo-area.tsx +10 -113
  21. package/templates/base/pages/lib/_doc-page-renderer.tsx +22 -183
  22. package/templates/base/pages/lib/_doc-page-shell.tsx +17 -251
  23. package/templates/base/pages/lib/_doc-pager.tsx +4 -74
  24. package/templates/base/pages/lib/_doc-route-entries.ts +43 -177
  25. package/templates/base/pages/lib/_doc-route-paths.ts +16 -101
  26. package/templates/base/pages/lib/_doc-tags-area.tsx +14 -77
  27. package/templates/base/pages/lib/_extract-headings.ts +21 -295
  28. package/templates/base/pages/lib/_footer-with-defaults.tsx +37 -225
  29. package/templates/base/pages/lib/_frontmatter-preview-data.ts +5 -31
  30. package/templates/base/pages/lib/_head-with-defaults.tsx +13 -138
  31. package/templates/base/pages/lib/_header-with-defaults.tsx +24 -324
  32. package/templates/base/pages/lib/_inline-version-switcher.tsx +16 -78
  33. package/templates/base/pages/lib/_math-block.tsx +4 -63
  34. package/templates/base/pages/lib/_nav-data-prep.ts +32 -51
  35. package/templates/base/pages/lib/_nav-source-cache.ts +12 -57
  36. package/templates/base/pages/lib/_nav-source-docs.ts +33 -233
  37. package/templates/base/pages/lib/_search-widget-script.ts +2 -470
  38. package/templates/base/pages/lib/_search-widget.tsx +9 -195
  39. package/templates/base/pages/lib/_sidebar-prepaint.tsx +6 -59
  40. package/templates/base/pages/lib/_sidebar-with-defaults.tsx +16 -118
  41. package/templates/base/pages/lib/_site-tree-nav.tsx +29 -80
  42. package/templates/base/pages/lib/doc-page-props.ts +26 -44
  43. package/templates/base/pages/lib/locale-merge.ts +32 -145
  44. package/templates/base/pages/lib/route-enumerators.ts +52 -286
  45. package/templates/base/src/components/ai-chat-modal.tsx +9 -8
  46. package/templates/base/src/components/content/code-group.tsx +3 -76
  47. package/templates/base/src/components/content/content-admonition.tsx +4 -56
  48. package/templates/base/src/components/doc-history.tsx +9 -8
  49. package/templates/base/src/components/image-enlarge.tsx +11 -8
  50. package/templates/base/src/components/sidebar-toggle.tsx +6 -170
  51. package/templates/base/src/components/sidebar-tree.tsx +6 -548
  52. package/templates/base/src/config/color-scheme-utils.ts +34 -158
  53. package/templates/base/src/config/i18n.ts +9 -0
  54. package/templates/base/src/config/settings-types.ts +34 -172
  55. package/templates/base/src/config/z-index-tokens.ts +5 -4
  56. package/templates/base/src/styles/global.css +40 -587
  57. package/templates/base/src/utils/base.ts +1 -1
  58. package/templates/base/src/utils/docs.ts +47 -16
  59. package/templates/base/src/utils/github.ts +12 -9
  60. package/templates/base/src/utils/nav-scope.ts +13 -42
  61. package/templates/base/src/utils/sidebar.ts +18 -86
  62. package/templates/base/src/utils/slug.ts +10 -53
  63. package/templates/base/src/utils/smart-break.tsx +12 -120
  64. package/templates/base/src/utils/tags.ts +25 -68
  65. package/templates/features/bodyFootUtil/files/src/utils/github.ts +12 -9
  66. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +13 -39
  67. package/templates/features/docHistory/files/src/components/doc-history.tsx +8 -636
  68. package/templates/features/docHistory/files/src/types/doc-history.ts +7 -23
  69. package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +35 -201
  70. package/templates/features/i18n/files/pages/[locale]/index.tsx +1 -1
  71. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +8 -269
  72. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +6 -99
  73. package/templates/features/tagGovernance/files/scripts/tags-audit.ts +67 -515
  74. package/templates/features/versioning/files/pages/lib/_versions-page.tsx +21 -73
  75. package/templates/base/pages/404.tsx +0 -61
  76. package/templates/base/pages/robots.txt.tsx +0 -29
  77. package/templates/base/pages/sitemap.xml.tsx +0 -59
  78. package/templates/base/plugins/connect-adapter.mjs +0 -169
  79. package/templates/base/plugins/copy-public-plugin.mjs +0 -58
  80. package/templates/base/plugins/search-index-plugin.mjs +0 -66
  81. package/templates/base/scripts/gen-z-index.mjs +0 -157
  82. package/templates/base/src/components/mermaid-enlarge.tsx +0 -490
  83. package/templates/base/src/components/site-tree-nav.tsx +0 -220
  84. package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +0 -47
  85. package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +0 -111
  86. package/templates/features/docTags/files/pages/[locale]/docs/tags/[tag].tsx +0 -59
  87. package/templates/features/docTags/files/pages/[locale]/docs/tags/index.tsx +0 -39
  88. package/templates/features/docTags/files/pages/docs/tags/[tag].tsx +0 -43
  89. package/templates/features/docTags/files/pages/docs/tags/index.tsx +0 -20
  90. package/templates/features/llmsTxt/files/plugins/llms-txt-plugin.mjs +0 -93
  91. package/templates/features/versioning/files/pages/[locale]/docs/versions.tsx +0 -48
  92. package/templates/features/versioning/files/pages/docs/versions.tsx +0 -20
@@ -1,170 +1,6 @@
1
- "use client";
2
-
3
- // Use preact hook entrypoints directly the "react" → "preact/compat" alias
4
- // lets us consume React-typed components in this Preact app (configured
5
- // project-wide). Same pattern as src/components/sidebar-tree.tsx and
6
- // packages/zudo-doc/src/theme-toggle/index.tsx. Type references via
7
- // the global React namespace still resolve via @types/react.
8
- import { useState, useEffect } from "preact/hooks";
9
- // After zudolab/zudo-doc#1335 (E2 task 2 half B) the host components
10
- // pull lifecycle event names from the v2 transitions module rather
11
- // than hard-coding `astro:*` literals.
12
- import { AFTER_NAVIGATE_EVENT } from "@takazudo/zudo-doc/transitions";
13
- import SidebarTree from "@/components/sidebar-tree";
14
- import type { NavNode } from "@/utils/docs";
15
- import type { LocaleLink } from "@/types/locale";
16
- // Types-only subpath (`./sidebar/types`) sidesteps the JSX type-graph
17
- // pulled in by `./sidebar`'s runtime barrel.
18
- import type { SidebarRootMenuItem } from "@takazudo/zudo-doc/sidebar/types";
19
-
20
- const cx = (...classes: Array<string | false | null | undefined>) =>
21
- classes.filter(Boolean).join(" ");
22
-
23
- // Mobile drawer hosts the SidebarTree directly (rather than receiving it as
24
- // JSX children) so the tree's data props ride across the SSR → hydrate
25
- // boundary inside the Island marker's `data-props` attribute. zfb's
26
- // `Island()` only serialises a child component's *own* props (excluding
27
- // `children`); when SidebarTree was passed as `children`, its data was
28
- // dropped during hydration and Preact wiped the SSR-rendered tree DOM.
29
- // Mirroring the desktop `<Sidebar treeComponent={SidebarTree} ...>` shape
30
- // keeps the data attached to the wrapping island. zudolab/zudo-doc#1355
31
- // wave 13.5.
32
-
33
- interface SidebarToggleProps {
34
- nodes: NavNode[];
35
- currentSlug?: string;
36
- rootMenuItems?: SidebarRootMenuItem[];
37
- backToMenuLabel?: string;
38
- localeLinks?: LocaleLink[];
39
- themeDefaultMode?: "light" | "dark";
40
- }
41
-
42
- export default function SidebarToggle({
43
- nodes,
44
- currentSlug,
45
- rootMenuItems,
46
- backToMenuLabel,
47
- localeLinks,
48
- themeDefaultMode,
49
- }: SidebarToggleProps) {
50
- // Initial state must match SSR (`open=false`) so the hydration DOM
51
- // matches the SSG output byte-for-byte. The backdrop and toggle-icon
52
- // are rendered unconditionally below so the hydration tree has the
53
- // same shape regardless of `open`, preventing Preact from re-mounting
54
- // the subtree (which can drop click handlers on the hamburger button).
55
- const [open, setOpen] = useState(false);
56
-
57
- useEffect(() => {
58
- if (open) {
59
- document.body.style.overflow = "hidden";
60
- } else {
61
- document.body.style.overflow = "";
62
- }
63
- return () => {
64
- document.body.style.overflow = "";
65
- };
66
- }, [open]);
67
-
68
- // Close mobile sidebar on View Transition navigation
69
- useEffect(() => {
70
- function handleSwap() {
71
- setOpen(false);
72
- }
73
- document.addEventListener(AFTER_NAVIGATE_EVENT, handleSwap);
74
- return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handleSwap);
75
- }, []);
76
-
77
- return (
78
- <>
79
- {/* Hamburger button - visible only on mobile.
80
- Both icons are always rendered so the SSR output has the same
81
- DOM shape as the post-hydration tree. The closed-state icon is
82
- hidden via `hidden` when open=true, and vice versa, so Preact's
83
- hydration walk sees byte-stable markup and keeps the click
84
- handler attached. */}
85
- <button
86
- type="button"
87
- onClick={() => setOpen(!open)}
88
- className="lg:hidden px-hsp-sm py-vsp-xs -ml-hsp-sm mr-hsp-sm text-muted hover:text-fg"
89
- aria-label={open ? "Close sidebar" : "Open sidebar"}
90
- aria-expanded={open}
91
- >
92
- {/* X icon — visible only when open */}
93
- <svg
94
- xmlns="http://www.w3.org/2000/svg"
95
- className={cx("h-icon-lg w-icon-lg", !open && "hidden")}
96
- aria-hidden="true"
97
- fill="none"
98
- viewBox="0 0 24 24"
99
- stroke="currentColor"
100
- strokeWidth={2}
101
- >
102
- <path
103
- strokeLinecap="round"
104
- strokeLinejoin="round"
105
- d="M6 18L18 6M6 6l12 12"
106
- />
107
- </svg>
108
- {/* Hamburger icon — visible only when closed */}
109
- <svg
110
- xmlns="http://www.w3.org/2000/svg"
111
- className={cx("h-icon-lg w-icon-lg", open && "hidden")}
112
- aria-hidden="true"
113
- fill="none"
114
- viewBox="0 0 24 24"
115
- stroke="currentColor"
116
- strokeWidth={2}
117
- >
118
- <path
119
- strokeLinecap="round"
120
- strokeLinejoin="round"
121
- d="M4 6h16M4 12h16M4 18h16"
122
- />
123
- </svg>
124
- </button>
125
-
126
- {/* Backdrop overlay - mobile only.
127
- Rendered unconditionally; CSS `hidden` toggles visibility so
128
- the SSR DOM tree matches the hydrated tree (no subtree
129
- mount/unmount across the hydration boundary).
130
- `z-modal-backdrop` (50) intentionally sits ABOVE the header
131
- (`z-toolbar`, 20): the open mobile drawer is a modal surface that
132
- dims the whole viewport, header included. Closing is via tapping the
133
- backdrop (onClick below), so the header hamburger being dimmed under
134
- it is fine. */}
135
- <div
136
- className={cx("fixed inset-0 z-modal-backdrop bg-overlay/30 lg:hidden", !open && "hidden")}
137
- aria-hidden={!open}
138
- onClick={() => setOpen(false)}
139
- />
140
-
141
- {/* Sidebar panel - mobile only (desktop sidebar is in doc-layout).
142
- `inert` when closed: the panel is only visually hidden via
143
- `-translate-x-full`, so without `inert` its links/filter/buttons
144
- stay in the tab order and accessibility tree while off-screen
145
- (zudolab/zudo-doc#2059). `inert={false}` serialises to no attribute,
146
- so the SSR (open=false → `inert`) and initial client render stay
147
- byte-stable for hydration. */}
148
- <aside
149
- inert={!open}
150
- className={`
151
- fixed top-[3.5rem] left-0 z-modal h-[calc(100vh-3.5rem)] w-[16rem] flex flex-col
152
- border-r border-muted bg-bg transition-transform duration-200
153
- lg:hidden
154
- ${open ? "translate-x-0" : "-translate-x-full"}
155
- `}
156
- >
157
- <div className="flex-1 overflow-y-auto">
158
- <SidebarTree
159
- nodes={nodes}
160
- currentSlug={currentSlug}
161
- rootMenuItems={rootMenuItems}
162
- backToMenuLabel={backToMenuLabel}
163
- localeLinks={localeLinks}
164
- themeDefaultMode={themeDefaultMode}
165
- />
166
- </div>
167
- </aside>
168
- </>
169
- );
170
- }
1
+ // Thin re-export shim. SidebarToggle moved into the package
2
+ // (`@takazudo/zudo-doc/sidebar-toggle-island`) as part of the package-first
3
+ // migration (#2344, S2). Host code using `@/components/sidebar-toggle`
4
+ // still resolves correctly; the implementation lives in the package.
5
+ export { SidebarToggle } from "@takazudo/zudo-doc/sidebar-toggle-island";
6
+ export type { SidebarToggleProps } from "@takazudo/zudo-doc/sidebar-toggle-island";