create-zudo-doc 3.2.0 → 4.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/README.md +3 -2
- package/dist/api.d.ts +2 -0
- package/dist/api.js +9 -1
- package/dist/claude-md-gen.d.ts +8 -0
- package/dist/claude-md-gen.js +44 -26
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +11 -1
- package/dist/compose.d.ts +14 -20
- package/dist/compose.js +15 -25
- package/dist/constants.d.ts +6 -0
- package/dist/constants.js +123 -1
- package/dist/features/body-foot-util.d.ts +8 -4
- package/dist/features/body-foot-util.js +8 -4
- package/dist/features/claude-resources.d.ts +9 -0
- package/dist/features/claude-resources.js +10 -6
- package/dist/features/design-token-panel.d.ts +0 -12
- package/dist/features/design-token-panel.js +32 -93
- package/dist/features/doc-history.d.ts +19 -3
- package/dist/features/doc-history.js +49 -60
- package/dist/features/doc-tags.d.ts +9 -13
- package/dist/features/doc-tags.js +10 -26
- package/dist/features/dynamic-page-transition.d.ts +19 -30
- package/dist/features/dynamic-page-transition.js +21 -209
- package/dist/features/footer-taglist.d.ts +1 -1
- package/dist/features/footer-taglist.js +1 -1
- package/dist/features/footer.d.ts +3 -2
- package/dist/features/footer.js +3 -2
- package/dist/features/i18n.d.ts +13 -8
- package/dist/features/i18n.js +14 -9
- package/dist/features/image-enlarge.d.ts +7 -26
- package/dist/features/image-enlarge.js +7 -26
- package/dist/features/index.js +2 -0
- package/dist/features/llms-txt.d.ts +3 -5
- package/dist/features/llms-txt.js +3 -5
- package/dist/features/search.d.ts +7 -3
- package/dist/features/search.js +7 -3
- package/dist/features/sidebar-resizer.d.ts +4 -8
- package/dist/features/sidebar-resizer.js +4 -8
- package/dist/features/sidebar-toggle.d.ts +7 -7
- package/dist/features/sidebar-toggle.js +7 -7
- package/dist/features/tag-governance.d.ts +3 -8
- package/dist/features/tag-governance.js +37 -9
- package/dist/features/tauri.d.ts +13 -10
- package/dist/features/tauri.js +16 -52
- package/dist/features/theme-pack-switcher.d.ts +11 -0
- package/dist/features/theme-pack-switcher.js +13 -0
- package/dist/features/versioning.d.ts +12 -24
- package/dist/features/versioning.js +13 -39
- package/dist/index.js +5 -3
- package/dist/preset.d.ts +2 -0
- package/dist/preset.js +12 -1
- package/dist/prompts.d.ts +2 -0
- package/dist/prompts.js +22 -1
- package/dist/scaffold.d.ts +13 -6
- package/dist/scaffold.js +97 -78
- package/dist/utils.d.ts +10 -0
- package/dist/utils.js +14 -0
- package/dist/zfb-config-gen.d.ts +32 -20
- package/dist/zfb-config-gen.js +410 -53
- package/package.json +2 -2
- package/templates/base/pages/docs/[[...slug]].tsx +64 -0
- package/templates/base/pages/index.tsx +6 -41
- package/templates/base/src/styles/global.css +15 -340
- package/templates/base/tsconfig.json +3 -26
- package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +92 -0
- package/dist/settings-gen.d.ts +0 -2
- package/dist/settings-gen.js +0 -320
- package/templates/base/.htmlvalidate.json +0 -5
- package/templates/base/.zfb/doc-history-meta.json +0 -1
- package/templates/base/pages/_data.ts +0 -160
- package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
- package/templates/base/pages/lib/_chrome.ts +0 -167
- package/templates/base/pages/lib/_details.tsx +0 -29
- package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
- package/templates/base/pages/lib/_extract-headings.ts +0 -37
- package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
- package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
- package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
- package/templates/base/pages/lib/_preset-generator.tsx +0 -81
- package/templates/base/pages/lib/_route-context.ts +0 -32
- package/templates/base/pages/lib/_search-widget.tsx +0 -17
- package/templates/base/pages/lib/doc-page-props.ts +0 -30
- package/templates/base/pages/lib/locale-merge.ts +0 -59
- package/templates/base/scripts/run-b4push.sh +0 -102
- package/templates/base/src/components/ai-chat-modal.tsx +0 -18
- package/templates/base/src/components/content/code-group.tsx +0 -3
- package/templates/base/src/components/content/content-admonition.tsx +0 -4
- package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
- package/templates/base/src/components/doc-history.tsx +0 -21
- package/templates/base/src/components/image-enlarge.tsx +0 -24
- package/templates/base/src/components/preset-generator.tsx +0 -14
- package/templates/base/src/components/sidebar-toggle.tsx +0 -6
- package/templates/base/src/components/sidebar-tree.tsx +0 -6
- package/templates/base/src/config/color-scheme-utils.ts +0 -69
- package/templates/base/src/config/color-schemes.ts +0 -165
- package/templates/base/src/config/docs-schema.ts +0 -95
- package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
- package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
- package/templates/base/src/config/i18n.ts +0 -239
- package/templates/base/src/config/settings-types.ts +0 -45
- package/templates/base/src/config/sidebars.ts +0 -66
- package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
- package/templates/base/src/config/tag-vocabulary.ts +0 -20
- package/templates/base/src/config/z-index-tokens.ts +0 -128
- package/templates/base/src/types/docs-entry.ts +0 -28
- package/templates/base/src/types/heading.ts +0 -5
- package/templates/base/src/types/locale.ts +0 -10
- package/templates/base/src/utils/base.ts +0 -164
- package/templates/base/src/utils/docs.ts +0 -446
- package/templates/base/src/utils/git-info.ts +0 -70
- package/templates/base/src/utils/github.ts +0 -22
- package/templates/base/src/utils/nav-scope.ts +0 -34
- package/templates/base/src/utils/sidebar.ts +0 -36
- package/templates/base/src/utils/slug.ts +0 -10
- package/templates/base/src/utils/smart-break.tsx +0 -12
- package/templates/base/src/utils/tags.ts +0 -83
- package/templates/base/zfb-shim.d.ts +0 -183
- package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
- package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
- package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
- package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
- package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
- package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
- package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
- package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
- package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
- package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
- package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
- package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
- package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
- package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
- package/templates/features/tagGovernance/files/scripts/tags-audit.ts +0 -131
- package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +0 -428
- package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
- package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
- package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
export interface FindResult {
|
|
2
|
-
matches: number;
|
|
3
|
-
activeMatchOrdinal: number; // 1-based
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface FindInPage {
|
|
7
|
-
find(container: HTMLElement, query: string): FindResult;
|
|
8
|
-
next(): FindResult;
|
|
9
|
-
prev(): FindResult;
|
|
10
|
-
stop(): void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const MATCH_CLASS = "find-match";
|
|
14
|
-
const ACTIVE_CLASS = "find-match-active";
|
|
15
|
-
const MATCH_ATTR = "data-find-match";
|
|
16
|
-
const ACTIVE_ATTR = "data-find-active";
|
|
17
|
-
|
|
18
|
-
const EMPTY_RESULT: FindResult = Object.freeze({ matches: 0, activeMatchOrdinal: 0 });
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Create a DOM-based find-in-page utility.
|
|
22
|
-
*
|
|
23
|
-
* Limitation: only matches within single text nodes. Cross-element matching
|
|
24
|
-
* (e.g. "Hello world" spanning `<strong>Hello</strong> world`) is not supported.
|
|
25
|
-
*/
|
|
26
|
-
export function createFindInPage(): FindInPage {
|
|
27
|
-
let matchElements: HTMLElement[] = [];
|
|
28
|
-
let activeIndex = -1;
|
|
29
|
-
|
|
30
|
-
function clearMarks(): void {
|
|
31
|
-
const parentsToNormalize = new Set<Node>();
|
|
32
|
-
|
|
33
|
-
for (let i = matchElements.length - 1; i >= 0; i--) {
|
|
34
|
-
const mark = matchElements[i];
|
|
35
|
-
const parent = mark.parentNode;
|
|
36
|
-
if (parent) {
|
|
37
|
-
const textNode = document.createTextNode(mark.textContent || "");
|
|
38
|
-
parent.replaceChild(textNode, mark);
|
|
39
|
-
parentsToNormalize.add(parent);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
for (const parent of parentsToNormalize) {
|
|
43
|
-
(parent as Element).normalize();
|
|
44
|
-
}
|
|
45
|
-
matchElements = [];
|
|
46
|
-
activeIndex = -1;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function setActive(index: number): void {
|
|
50
|
-
if (activeIndex >= 0 && activeIndex < matchElements.length) {
|
|
51
|
-
const prev = matchElements[activeIndex];
|
|
52
|
-
prev.classList.remove(ACTIVE_CLASS);
|
|
53
|
-
prev.removeAttribute(ACTIVE_ATTR);
|
|
54
|
-
}
|
|
55
|
-
activeIndex = index;
|
|
56
|
-
if (activeIndex >= 0 && activeIndex < matchElements.length) {
|
|
57
|
-
const current = matchElements[activeIndex];
|
|
58
|
-
current.classList.add(ACTIVE_CLASS);
|
|
59
|
-
current.setAttribute(ACTIVE_ATTR, "true");
|
|
60
|
-
current.scrollIntoView?.({ block: "center" });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function currentResult(): FindResult {
|
|
65
|
-
if (matchElements.length === 0) {
|
|
66
|
-
return EMPTY_RESULT;
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
matches: matchElements.length,
|
|
70
|
-
activeMatchOrdinal: activeIndex + 1,
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function find(container: HTMLElement, query: string): FindResult {
|
|
75
|
-
clearMarks();
|
|
76
|
-
|
|
77
|
-
if (!query) {
|
|
78
|
-
return EMPTY_RESULT;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
const lowerQuery = query.toLowerCase();
|
|
82
|
-
|
|
83
|
-
const walker = document.createTreeWalker(
|
|
84
|
-
container,
|
|
85
|
-
NodeFilter.SHOW_TEXT,
|
|
86
|
-
null,
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
const textNodes: Text[] = [];
|
|
90
|
-
let node: Text | null;
|
|
91
|
-
while ((node = walker.nextNode() as Text | null)) {
|
|
92
|
-
textNodes.push(node);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
for (const textNode of textNodes) {
|
|
96
|
-
const text = textNode.textContent || "";
|
|
97
|
-
const lowerText = text.toLowerCase();
|
|
98
|
-
|
|
99
|
-
const positions: number[] = [];
|
|
100
|
-
let searchFrom = 0;
|
|
101
|
-
while (searchFrom < lowerText.length) {
|
|
102
|
-
const idx = lowerText.indexOf(lowerQuery, searchFrom);
|
|
103
|
-
if (idx === -1) break;
|
|
104
|
-
positions.push(idx);
|
|
105
|
-
searchFrom = idx + lowerQuery.length;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (positions.length === 0) continue;
|
|
109
|
-
|
|
110
|
-
const parent = textNode.parentNode;
|
|
111
|
-
if (!parent) continue;
|
|
112
|
-
|
|
113
|
-
let remainingNode: Text = textNode;
|
|
114
|
-
const nodeMarks: HTMLElement[] = [];
|
|
115
|
-
|
|
116
|
-
for (let i = positions.length - 1; i >= 0; i--) {
|
|
117
|
-
const pos = positions[i];
|
|
118
|
-
const matchLen = query.length;
|
|
119
|
-
|
|
120
|
-
if (pos + matchLen < remainingNode.length) {
|
|
121
|
-
remainingNode.splitText(pos + matchLen);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
let matchNode: Text;
|
|
125
|
-
if (pos > 0) {
|
|
126
|
-
matchNode = remainingNode.splitText(pos);
|
|
127
|
-
} else {
|
|
128
|
-
matchNode = remainingNode;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const mark = document.createElement("mark");
|
|
132
|
-
mark.className = MATCH_CLASS;
|
|
133
|
-
mark.setAttribute(MATCH_ATTR, "true");
|
|
134
|
-
mark.textContent = matchNode.textContent;
|
|
135
|
-
|
|
136
|
-
parent.replaceChild(mark, matchNode);
|
|
137
|
-
nodeMarks.unshift(mark);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
matchElements.push(...nodeMarks);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (matchElements.length === 0) {
|
|
144
|
-
return EMPTY_RESULT;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
setActive(0);
|
|
148
|
-
return currentResult();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function next(): FindResult {
|
|
152
|
-
if (matchElements.length === 0) {
|
|
153
|
-
return EMPTY_RESULT;
|
|
154
|
-
}
|
|
155
|
-
const newIndex = (activeIndex + 1) % matchElements.length;
|
|
156
|
-
setActive(newIndex);
|
|
157
|
-
return currentResult();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function prev(): FindResult {
|
|
161
|
-
if (matchElements.length === 0) {
|
|
162
|
-
return EMPTY_RESULT;
|
|
163
|
-
}
|
|
164
|
-
const newIndex =
|
|
165
|
-
(activeIndex - 1 + matchElements.length) % matchElements.length;
|
|
166
|
-
setActive(newIndex);
|
|
167
|
-
return currentResult();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function stop(): void {
|
|
171
|
-
clearMarks();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return { find, next, prev, stop };
|
|
175
|
-
}
|