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.
- package/dist/compose.d.ts +6 -3
- package/dist/compose.js +6 -4
- package/dist/features/image-enlarge.d.ts +22 -12
- package/dist/features/image-enlarge.js +23 -191
- package/dist/scaffold.d.ts +11 -0
- package/dist/scaffold.js +51 -24
- package/dist/settings-gen.js +4 -0
- package/dist/zfb-config-gen.d.ts +16 -10
- package/dist/zfb-config-gen.js +34 -239
- package/package.json +1 -1
- package/templates/base/pages/_mdx-components.ts +64 -185
- package/templates/base/pages/index.tsx +1 -1
- package/templates/base/pages/lib/_body-end-islands.tsx +6 -13
- package/templates/base/pages/lib/_category-nav.tsx +30 -115
- package/templates/base/pages/lib/_category-tree-nav.tsx +38 -65
- package/templates/base/pages/lib/_compose-meta-title.ts +2 -6
- package/templates/base/pages/lib/_doc-body-end.tsx +3 -35
- package/templates/base/pages/lib/_doc-content-header.tsx +10 -111
- package/templates/base/pages/lib/_doc-history-area.tsx +19 -211
- package/templates/base/pages/lib/_doc-metainfo-area.tsx +10 -113
- package/templates/base/pages/lib/_doc-page-renderer.tsx +22 -183
- package/templates/base/pages/lib/_doc-page-shell.tsx +17 -251
- package/templates/base/pages/lib/_doc-pager.tsx +4 -74
- package/templates/base/pages/lib/_doc-route-entries.ts +43 -177
- package/templates/base/pages/lib/_doc-route-paths.ts +16 -101
- package/templates/base/pages/lib/_doc-tags-area.tsx +14 -77
- package/templates/base/pages/lib/_extract-headings.ts +21 -295
- package/templates/base/pages/lib/_footer-with-defaults.tsx +37 -225
- package/templates/base/pages/lib/_frontmatter-preview-data.ts +5 -31
- package/templates/base/pages/lib/_head-with-defaults.tsx +13 -138
- package/templates/base/pages/lib/_header-with-defaults.tsx +24 -324
- package/templates/base/pages/lib/_inline-version-switcher.tsx +16 -78
- package/templates/base/pages/lib/_math-block.tsx +4 -63
- package/templates/base/pages/lib/_nav-data-prep.ts +32 -51
- package/templates/base/pages/lib/_nav-source-cache.ts +12 -57
- package/templates/base/pages/lib/_nav-source-docs.ts +33 -233
- package/templates/base/pages/lib/_search-widget-script.ts +2 -470
- package/templates/base/pages/lib/_search-widget.tsx +9 -195
- package/templates/base/pages/lib/_sidebar-prepaint.tsx +6 -59
- package/templates/base/pages/lib/_sidebar-with-defaults.tsx +16 -118
- package/templates/base/pages/lib/_site-tree-nav.tsx +29 -80
- package/templates/base/pages/lib/doc-page-props.ts +26 -44
- package/templates/base/pages/lib/locale-merge.ts +32 -145
- package/templates/base/pages/lib/route-enumerators.ts +52 -286
- package/templates/base/src/components/ai-chat-modal.tsx +9 -8
- package/templates/base/src/components/content/code-group.tsx +3 -76
- package/templates/base/src/components/content/content-admonition.tsx +4 -56
- package/templates/base/src/components/doc-history.tsx +9 -8
- package/templates/base/src/components/image-enlarge.tsx +11 -8
- package/templates/base/src/components/sidebar-toggle.tsx +6 -170
- package/templates/base/src/components/sidebar-tree.tsx +6 -548
- package/templates/base/src/config/color-scheme-utils.ts +34 -158
- package/templates/base/src/config/i18n.ts +9 -0
- package/templates/base/src/config/settings-types.ts +34 -172
- package/templates/base/src/config/z-index-tokens.ts +5 -4
- package/templates/base/src/styles/global.css +40 -587
- package/templates/base/src/utils/base.ts +1 -1
- package/templates/base/src/utils/docs.ts +47 -16
- package/templates/base/src/utils/github.ts +12 -9
- package/templates/base/src/utils/nav-scope.ts +13 -42
- package/templates/base/src/utils/sidebar.ts +18 -86
- package/templates/base/src/utils/slug.ts +10 -53
- package/templates/base/src/utils/smart-break.tsx +12 -120
- package/templates/base/src/utils/tags.ts +25 -68
- package/templates/features/bodyFootUtil/files/src/utils/github.ts +12 -9
- package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +13 -39
- package/templates/features/docHistory/files/src/components/doc-history.tsx +8 -636
- package/templates/features/docHistory/files/src/types/doc-history.ts +7 -23
- package/templates/features/docTags/files/pages/lib/_tag-pages.tsx +35 -201
- package/templates/features/i18n/files/pages/[locale]/index.tsx +1 -1
- package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +8 -269
- package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +6 -99
- package/templates/features/tagGovernance/files/scripts/tags-audit.ts +67 -515
- package/templates/features/versioning/files/pages/lib/_versions-page.tsx +21 -73
- package/templates/base/pages/404.tsx +0 -61
- package/templates/base/pages/robots.txt.tsx +0 -29
- package/templates/base/pages/sitemap.xml.tsx +0 -59
- package/templates/base/plugins/connect-adapter.mjs +0 -169
- package/templates/base/plugins/copy-public-plugin.mjs +0 -58
- package/templates/base/plugins/search-index-plugin.mjs +0 -66
- package/templates/base/scripts/gen-z-index.mjs +0 -157
- package/templates/base/src/components/mermaid-enlarge.tsx +0 -490
- package/templates/base/src/components/site-tree-nav.tsx +0 -220
- package/templates/features/claudeResources/files/plugins/claude-resources-plugin.mjs +0 -47
- package/templates/features/docHistory/files/plugins/doc-history-plugin.mjs +0 -111
- package/templates/features/docTags/files/pages/[locale]/docs/tags/[tag].tsx +0 -59
- package/templates/features/docTags/files/pages/[locale]/docs/tags/index.tsx +0 -39
- package/templates/features/docTags/files/pages/docs/tags/[tag].tsx +0 -43
- package/templates/features/docTags/files/pages/docs/tags/index.tsx +0 -20
- package/templates/features/llmsTxt/files/plugins/llms-txt-plugin.mjs +0 -93
- package/templates/features/versioning/files/pages/[locale]/docs/versions.tsx +0 -48
- package/templates/features/versioning/files/pages/docs/versions.tsx +0 -20
|
@@ -1,170 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
|
|
6
|
-
|
|
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";
|