create-zudo-doc 3.1.0 → 3.3.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 (127) hide show
  1. package/dist/claude-md-gen.d.ts +8 -0
  2. package/dist/claude-md-gen.js +43 -26
  3. package/dist/compose.d.ts +14 -20
  4. package/dist/compose.js +15 -25
  5. package/dist/features/body-foot-util.d.ts +8 -4
  6. package/dist/features/body-foot-util.js +8 -4
  7. package/dist/features/claude-resources.d.ts +12 -0
  8. package/dist/features/claude-resources.js +13 -6
  9. package/dist/features/design-token-panel.d.ts +0 -12
  10. package/dist/features/design-token-panel.js +32 -93
  11. package/dist/features/doc-history.d.ts +18 -3
  12. package/dist/features/doc-history.js +45 -60
  13. package/dist/features/doc-tags.d.ts +9 -13
  14. package/dist/features/doc-tags.js +10 -26
  15. package/dist/features/dynamic-page-transition.d.ts +19 -30
  16. package/dist/features/dynamic-page-transition.js +21 -209
  17. package/dist/features/footer-taglist.d.ts +1 -1
  18. package/dist/features/footer-taglist.js +1 -1
  19. package/dist/features/footer.d.ts +3 -2
  20. package/dist/features/footer.js +3 -2
  21. package/dist/features/i18n.d.ts +13 -8
  22. package/dist/features/i18n.js +14 -9
  23. package/dist/features/image-enlarge.d.ts +7 -26
  24. package/dist/features/image-enlarge.js +7 -26
  25. package/dist/features/llms-txt.d.ts +3 -5
  26. package/dist/features/llms-txt.js +3 -5
  27. package/dist/features/search.d.ts +7 -3
  28. package/dist/features/search.js +7 -3
  29. package/dist/features/sidebar-resizer.d.ts +4 -8
  30. package/dist/features/sidebar-resizer.js +4 -8
  31. package/dist/features/sidebar-toggle.d.ts +7 -7
  32. package/dist/features/sidebar-toggle.js +7 -7
  33. package/dist/features/tag-governance.d.ts +14 -7
  34. package/dist/features/tag-governance.js +52 -8
  35. package/dist/features/tauri.d.ts +13 -10
  36. package/dist/features/tauri.js +16 -52
  37. package/dist/features/versioning.d.ts +12 -24
  38. package/dist/features/versioning.js +13 -39
  39. package/dist/index.js +2 -3
  40. package/dist/preset.d.ts +1 -0
  41. package/dist/preset.js +5 -0
  42. package/dist/prompts.d.ts +2 -0
  43. package/dist/prompts.js +1 -0
  44. package/dist/scaffold.d.ts +13 -6
  45. package/dist/scaffold.js +78 -59
  46. package/dist/utils.d.ts +10 -0
  47. package/dist/utils.js +14 -0
  48. package/dist/zfb-config-gen.d.ts +32 -20
  49. package/dist/zfb-config-gen.js +400 -53
  50. package/package.json +2 -2
  51. package/templates/base/pages/docs/[[...slug]].tsx +59 -0
  52. package/templates/base/pages/index.tsx +6 -41
  53. package/templates/base/scripts/setup-doc-skill.sh +261 -0
  54. package/templates/base/src/styles/global.css +15 -340
  55. package/templates/base/tsconfig.json +3 -26
  56. package/templates/features/i18n/files/pages/[locale]/docs/[[...slug]].tsx +88 -0
  57. package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +3 -1
  58. package/dist/settings-gen.d.ts +0 -2
  59. package/dist/settings-gen.js +0 -319
  60. package/templates/base/.htmlvalidate.json +0 -5
  61. package/templates/base/.zfb/doc-history-meta.json +0 -1
  62. package/templates/base/pages/_data.ts +0 -160
  63. package/templates/base/pages/lib/_body-end-islands.tsx +0 -165
  64. package/templates/base/pages/lib/_chrome.ts +0 -167
  65. package/templates/base/pages/lib/_details.tsx +0 -29
  66. package/templates/base/pages/lib/_doc-route-entries.ts +0 -10
  67. package/templates/base/pages/lib/_extract-headings.ts +0 -37
  68. package/templates/base/pages/lib/_frontmatter-preview-data.ts +0 -27
  69. package/templates/base/pages/lib/_nav-source-cache.ts +0 -100
  70. package/templates/base/pages/lib/_nav-source-docs.ts +0 -17
  71. package/templates/base/pages/lib/_preset-generator.tsx +0 -81
  72. package/templates/base/pages/lib/_route-context.ts +0 -32
  73. package/templates/base/pages/lib/_search-widget.tsx +0 -17
  74. package/templates/base/pages/lib/doc-page-props.ts +0 -30
  75. package/templates/base/pages/lib/locale-merge.ts +0 -59
  76. package/templates/base/scripts/run-b4push.sh +0 -102
  77. package/templates/base/src/components/ai-chat-modal.tsx +0 -18
  78. package/templates/base/src/components/content/code-group.tsx +0 -3
  79. package/templates/base/src/components/content/content-admonition.tsx +0 -4
  80. package/templates/base/src/components/desktop-sidebar-toggle.tsx +0 -15
  81. package/templates/base/src/components/doc-history.tsx +0 -21
  82. package/templates/base/src/components/image-enlarge.tsx +0 -24
  83. package/templates/base/src/components/preset-generator.tsx +0 -14
  84. package/templates/base/src/components/sidebar-toggle.tsx +0 -6
  85. package/templates/base/src/components/sidebar-tree.tsx +0 -6
  86. package/templates/base/src/config/color-scheme-utils.ts +0 -69
  87. package/templates/base/src/config/color-schemes.ts +0 -165
  88. package/templates/base/src/config/docs-schema.ts +0 -95
  89. package/templates/base/src/config/frontmatter-preview-defaults.ts +0 -27
  90. package/templates/base/src/config/frontmatter-preview-renderers.tsx +0 -46
  91. package/templates/base/src/config/i18n.ts +0 -239
  92. package/templates/base/src/config/settings-types.ts +0 -45
  93. package/templates/base/src/config/sidebars.ts +0 -66
  94. package/templates/base/src/config/tag-vocabulary-types.ts +0 -4
  95. package/templates/base/src/config/tag-vocabulary.ts +0 -20
  96. package/templates/base/src/config/z-index-tokens.ts +0 -128
  97. package/templates/base/src/types/docs-entry.ts +0 -28
  98. package/templates/base/src/types/heading.ts +0 -5
  99. package/templates/base/src/types/locale.ts +0 -10
  100. package/templates/base/src/utils/base.ts +0 -164
  101. package/templates/base/src/utils/docs.ts +0 -446
  102. package/templates/base/src/utils/git-info.ts +0 -70
  103. package/templates/base/src/utils/github.ts +0 -22
  104. package/templates/base/src/utils/nav-scope.ts +0 -34
  105. package/templates/base/src/utils/sidebar.ts +0 -36
  106. package/templates/base/src/utils/slug.ts +0 -10
  107. package/templates/base/src/utils/smart-break.tsx +0 -12
  108. package/templates/base/src/utils/tags.ts +0 -83
  109. package/templates/base/zfb-shim.d.ts +0 -178
  110. package/templates/features/bodyFootUtil/files/src/utils/github.ts +0 -22
  111. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/escape-for-mdx.test.ts +0 -42
  112. package/templates/features/claudeResources/files/src/integrations/claude-resources/__tests__/generate.test.ts +0 -752
  113. package/templates/features/claudeResources/files/src/integrations/claude-resources/escape-for-mdx.ts +0 -97
  114. package/templates/features/claudeResources/files/src/integrations/claude-resources/generate.ts +0 -735
  115. package/templates/features/designTokenPanel/files/src/components/design-token-panel-bootstrap.tsx +0 -15
  116. package/templates/features/designTokenPanel/files/src/config/design-token-panel-config.ts +0 -435
  117. package/templates/features/designTokenPanel/files/src/config/design-tokens-manifest.ts +0 -174
  118. package/templates/features/designTokenPanel/files/src/lib/design-token-panel-bootstrap.ts +0 -30
  119. package/templates/features/docHistory/files/src/components/doc-history.tsx +0 -10
  120. package/templates/features/docHistory/files/src/types/doc-history.ts +0 -7
  121. package/templates/features/dynamicPageTransition/files/src/components/client-router-bootstrap.tsx +0 -72
  122. package/templates/features/i18n/files/pages/[locale]/index.tsx +0 -72
  123. package/templates/features/imageEnlarge/files/src/components/image-enlarge.tsx +0 -11
  124. package/templates/features/sidebarToggle/files/src/components/desktop-sidebar-toggle.tsx +0 -6
  125. package/templates/features/tauri/files/src/components/find-bar.tsx +0 -122
  126. package/templates/features/tauri/files/src/components/find-in-page-init.tsx +0 -59
  127. package/templates/features/tauri/files/src/utils/find-in-page.ts +0 -175
@@ -0,0 +1,261 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # ── setup-doc-skill.sh ─────────────────────────────────
5
+ # Creates an agent skill that exposes your zudo-doc
6
+ # documentation as a knowledge base, then symlinks it into
7
+ # the user-scope skills directory (~/.claude/skills/ and/or
8
+ # ~/.codex/skills/).
9
+ # ────────────────────────────────────────────────────────
10
+
11
+ TARGET_MODE="auto"
12
+
13
+ # Accept --silent (alias -y) for parity with the consuming-site convention:
14
+ # scaffolded sites expose `setup:doc-skill-silent` = `bash scripts/setup-doc-skill.sh
15
+ # --silent`. This script is already non-interactive (the skill name is deterministic
16
+ # — see below), so the flag is a no-op here; it is consumed only so it is never
17
+ # mistaken for the positional skill-name override (`$1`).
18
+ while [ $# -gt 0 ]; do
19
+ case "$1" in
20
+ --silent|-y) shift ;;
21
+ --target)
22
+ shift
23
+ if [ $# -eq 0 ]; then
24
+ echo "Error: --target requires one of: auto, claude, codex, both" >&2
25
+ exit 1
26
+ fi
27
+ TARGET_MODE="$1"
28
+ shift
29
+ ;;
30
+ --target=*)
31
+ TARGET_MODE="${1#--target=}"
32
+ shift
33
+ ;;
34
+ --) shift; break ;;
35
+ -*) echo "Error: unknown flag '$1'" >&2; exit 1 ;;
36
+ *) break ;;
37
+ esac
38
+ done
39
+
40
+ case "$TARGET_MODE" in
41
+ auto|claude|codex|both) ;;
42
+ *)
43
+ echo "Error: --target must be one of: auto, claude, codex, both" >&2
44
+ exit 1
45
+ ;;
46
+ esac
47
+
48
+ ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
49
+
50
+ # Read project name from package.json
51
+ PROJECT_NAME=$(node -e "console.log(require('$ROOT_DIR/package.json').name || 'my-project')")
52
+ DEFAULT_SKILL_NAME="${PROJECT_NAME}-wisdom"
53
+
54
+ echo ""
55
+ echo "=== zudo-doc Skill Setup ==="
56
+ echo ""
57
+
58
+ # Skill name is DETERMINISTIC: always `<projectName>-wisdom`. The scaffolded
59
+ # .gitignore (emitted by create-zudo-doc) hard-codes this exact name, so the
60
+ # generated skill directory must match it — an interactive prompt would let the
61
+ # name drift from the gitignore entry and leave the skill showing as untracked
62
+ # (zudolab/zudo-doc#2173). An explicit override is still allowed via the first
63
+ # CLI arg or the SKILL_NAME env var (consumers who override must also update
64
+ # their .gitignore), but never via an interactive prompt.
65
+ SKILL_NAME="${1:-${SKILL_NAME:-$DEFAULT_SKILL_NAME}}"
66
+
67
+ # Validate skill name (allow only alphanumeric, hyphens, underscores)
68
+ if [[ ! "$SKILL_NAME" =~ ^[a-zA-Z0-9_-]+$ ]]; then
69
+ echo "Error: Skill name may only contain letters, numbers, hyphens, and underscores."
70
+ exit 1
71
+ fi
72
+
73
+ # Resolve the main repo root (handles git worktrees correctly)
74
+ # Use the main worktree path so symlinks survive worktree removal
75
+ REPO_ROOT="$(git -C "$ROOT_DIR" worktree list | head -1 | awk '{print $1}')"
76
+
77
+ DOCS_DIR="$ROOT_DIR/src/content/docs"
78
+
79
+ # Validate docs directory exists
80
+ if [ ! -d "$DOCS_DIR" ]; then
81
+ echo "Error: Documentation directory not found at $DOCS_DIR"
82
+ exit 1
83
+ fi
84
+
85
+ # Helper: replace a symlink or file at the given path
86
+ ensure_symlink() {
87
+ local link_path="$1"
88
+ local target="$2"
89
+ if [ -L "$link_path" ] || [ -e "$link_path" ]; then
90
+ rm -rf "$link_path"
91
+ fi
92
+ ln -s "$target" "$link_path"
93
+ }
94
+
95
+ DOCS_JA_DIR="$ROOT_DIR/src/content/docs-ja"
96
+ HAS_JA=""
97
+ if [ -d "$DOCS_JA_DIR" ]; then
98
+ HAS_JA="true"
99
+ fi
100
+
101
+ # Discover top-level doc categories dynamically
102
+ DOC_TREE=""
103
+ for dir in "$DOCS_DIR"/*/; do
104
+ [ -d "$dir" ] || continue
105
+ dirname="$(basename "$dir")"
106
+ DOC_TREE="${DOC_TREE}- ${dirname}/
107
+ "
108
+ done
109
+
110
+ resolve_targets() {
111
+ case "$TARGET_MODE" in
112
+ claude) echo "claude" ;;
113
+ codex) echo "codex" ;;
114
+ both) echo "claude codex" ;;
115
+ auto)
116
+ local has_claude=""
117
+ local has_codex=""
118
+ [ -d "$HOME/.claude" ] && has_claude="true"
119
+ [ -d "$HOME/.codex" ] && has_codex="true"
120
+
121
+ if [ "$has_claude" = "true" ] && [ "$has_codex" = "true" ]; then
122
+ echo "claude codex"
123
+ elif [ "$has_codex" = "true" ]; then
124
+ echo "codex"
125
+ else
126
+ # Preserve the historical default for fresh machines and test homes.
127
+ echo "claude"
128
+ fi
129
+ ;;
130
+ esac
131
+ }
132
+
133
+ generate_skill() {
134
+ local target="$1"
135
+ local project_skills_dir="$ROOT_DIR/.$target/skills"
136
+ local skill_dir="$project_skills_dir/$SKILL_NAME"
137
+ local global_skills_dir="$HOME/.$target/skills"
138
+ local assistant_label
139
+
140
+ case "$target" in
141
+ claude) assistant_label="Claude Code" ;;
142
+ codex) assistant_label="Codex" ;;
143
+ *) echo "Error: unknown target '$target'" >&2; exit 1 ;;
144
+ esac
145
+
146
+ mkdir -p "$skill_dir"
147
+
148
+ ensure_symlink "$skill_dir/docs" "$REPO_ROOT/src/content/docs"
149
+ echo " [$target] Created docs symlink -> $REPO_ROOT/src/content/docs"
150
+
151
+ if [ "$HAS_JA" = "true" ]; then
152
+ ensure_symlink "$skill_dir/docs-ja" "$REPO_ROOT/src/content/docs-ja"
153
+ echo " [$target] Created docs-ja symlink -> $REPO_ROOT/src/content/docs-ja"
154
+ fi
155
+
156
+ cat > "$skill_dir/SKILL.md" << SKILLEOF
157
+ ---
158
+ name: $SKILL_NAME
159
+ description: >-
160
+ Search and reference documentation from the $PROJECT_NAME project.
161
+ Use when answering questions about $PROJECT_NAME features, configuration,
162
+ components, or usage patterns.
163
+ user-invocable: true
164
+ argument-hint: "[-u|--update] [topic keyword, e.g., 'configuration', 'sidebar', 'i18n']"
165
+ ---
166
+
167
+ # $PROJECT_NAME Documentation Reference
168
+
169
+ Look up documentation from the $PROJECT_NAME project for $assistant_label.
170
+ Documentation base path: \`src/content/docs\` (relative to repo root)
171
+
172
+ ## Mode Detection
173
+
174
+ Parse the argument string for flags:
175
+
176
+ - If args start with \`-u\` or \`--update\`: enter **Update mode** (see below)
177
+ - Otherwise: enter **Lookup mode** (default)
178
+
179
+ Strip the flag from the remaining argument to get the topic keyword.
180
+
181
+ ## Lookup Mode (default)
182
+
183
+ 1. Find the relevant article(s) from the \`docs/\` directory based on the topic
184
+ 2. Read ONLY the specific article(s) you need — do NOT load all articles at once
185
+ 3. Apply the information from the article when answering the user's question
186
+ 4. Mention the source article path so the user can find it for further reading
187
+
188
+ ## Update Mode (\`-u\` / \`--update\`)
189
+
190
+ The user has new information and wants to add or update documentation in this repo.
191
+
192
+ ### Workflow
193
+
194
+ 1. **Understand the new info**: Ask the user what they learned or want to
195
+ document. The topic keyword (if provided) hints at the subject area.
196
+ 2. **Find existing docs**: Search the \`docs/\` directory for articles related to
197
+ the topic. Read them to understand what is already covered.
198
+ 3. **Decide create vs update**: If an existing article covers the topic, update
199
+ it. Otherwise, create a new \`.mdx\` file in the appropriate subdirectory.
200
+ 4. **Write the content**: Follow the doc-authoring rules in the root CLAUDE.md:
201
+ - Required frontmatter: \`title\` (string). Always set \`sidebar_position\`.
202
+ Optional: \`description\`, \`sidebar_label\`, \`tags\`, etc.
203
+ - Do NOT use \`# h1\` in content — the frontmatter \`title\` renders as h1.
204
+ Start with \`## h2\` headings.
205
+ - Use available MDX components (\`<Note>\`, \`<Tip>\`, \`<Info>\`, \`<Warning>\`,
206
+ \`<Danger>\`, \`<HtmlPreview>\`) where appropriate.
207
+ - For live demos, use \`<HtmlPreview>\` with \`js\`/\`displayJs\` props.
208
+ - Link to other docs using relative paths with \`.mdx\` extension.
209
+ 5. **Update Japanese docs**: Create or update the corresponding file under
210
+ \`docs-ja/\` mirroring the English directory structure. Keep code blocks,
211
+ Mermaid diagrams, and \`<HtmlPreview>\` blocks identical — only translate
212
+ surrounding prose. Exception: pages with \`generated: true\` skip translation.
213
+ 6. **Format**: Run \`pnpm format:md\` to format the new/changed MDX files.
214
+ 7. **Verify**: Run \`pnpm build\` to confirm the site builds correctly.
215
+
216
+ ## Documentation Structure
217
+
218
+ The documentation is organized in MDX files under \`docs/\`:
219
+
220
+ \`\`\`
221
+ ${DOC_TREE}\`\`\`
222
+
223
+ Browse the \`docs/\` directory to discover available articles. Each \`.mdx\` file
224
+ has YAML frontmatter with \`title\` and \`description\` fields that help identify
225
+ the right article to read.
226
+ SKILLEOF
227
+
228
+ if [ "$HAS_JA" = "true" ]; then
229
+ cat >> "$skill_dir/SKILL.md" << JAEOF
230
+
231
+ ## Japanese Documentation
232
+
233
+ Japanese translations are available under \`docs-ja/\`. When the user is working
234
+ in Japanese or asks for Japanese content, prefer articles from \`docs-ja/\`.
235
+ JAEOF
236
+ fi
237
+
238
+ echo " [$target] Generated SKILL.md"
239
+
240
+ mkdir -p "$global_skills_dir"
241
+ ensure_symlink "$global_skills_dir/$SKILL_NAME" "$skill_dir"
242
+
243
+ echo " [$target] Project skill: $skill_dir"
244
+ echo " [$target] Global symlink: $global_skills_dir/$SKILL_NAME"
245
+ }
246
+
247
+ read -r -a TARGETS <<< "$(resolve_targets)"
248
+ echo "Target: $TARGET_MODE -> ${TARGETS[*]}"
249
+ echo ""
250
+
251
+ for target in "${TARGETS[@]}"; do
252
+ generate_skill "$target"
253
+ done
254
+
255
+ echo ""
256
+ echo "Done! Skill '$SKILL_NAME' is ready."
257
+ echo ""
258
+ echo "Use --target claude, --target codex, or --target both to override auto-detection."
259
+ echo "In Claude Code, use: /$SKILL_NAME <topic>"
260
+ echo "In Codex, mention the skill by name when asking about this documentation."
261
+ echo ""
@@ -1,353 +1,28 @@
1
- /* Cascade-layer order for the flow-space fix (zudolab/zudo-doc#2082 / #2109):
2
- * zd-preflight — Tailwind's preflight reset (incl. `* { margin: 0 }`)
3
- * zd-flow — the .zd-content flow-space margin-top rule (below)
4
- * (unlayered) — `tailwindcss/utilities` (mt-* etc.) highest priority
5
- * Unlayered always beats any layer, so `mt-*` utilities win over the flow
6
- * rule; the flow rule (zd-flow) sits above zd-preflight so it still beats the
7
- * preflight `margin: 0` reset and the .zd-content vertical rhythm is preserved.
8
- * Preflight is the de-facto lowest-priority origin already, so moving it into
9
- * the lowest layer is observably inert for every other author rule (which stay
10
- * unlayered and continue to outrank it). */
1
+ /* Cascade layers: preflight flow (unlayered utilities). Tokens/base rules
2
+ ship from @takazudo/zudo-doc/theme.css.
3
+ NOTE: the `@takazudo/zdtp/styles.css` import is intentionally NOT here —
4
+ it is inserted right after the @layer line above, ONLY when
5
+ designTokenPanel is selected (see features/design-token-panel.ts). It
6
+ can't ship unconditionally because it pulls in zdtp's own bytes. */
11
7
  @layer zd-preflight, zd-flow;
12
8
  @import "tailwindcss/preflight" layer(zd-preflight);
13
9
  @import "tailwindcss/utilities";
14
10
 
15
- /* ========================================
16
- * @takazudo/zudo-doc package safelist
17
- *
18
- * The package ships a build-generated safelist at `dist/safelist.css`
19
- * (zudolab/zudo-doc#1993). Importing it via the module resolver is
20
- * reliable across all consumer environments — the same module-resolver
21
- * code path used for any feature stylesheet injected at the
22
- * `@slot:global-css:feature-styles` anchor below.
23
- *
24
- * Why not @source the package dist/ glob? The old approach
25
- * (`@source "../../node_modules/@takazudo/zudo-doc/dist/**"`) was
26
- * unreliable: pnpm stores packages in a content-addressable store and
27
- * surfaces them to node_modules via symlinks. Tailwind v4's file
28
- * scanner does not reliably traverse those symlinks, so arbitrary-value
29
- * candidates (e.g. `w-[var(--zd-sidebar-w)]`, `h-[calc(100vh-3.5rem)]`)
30
- * were intermittently dropped across rebuilds (zudolab/zudo-doc#1971,
31
- * #1989). The package-generated `@source inline()` in dist/safelist.css
32
- * contains the full set, extracted at package build time — no drift, no
33
- * symlink traversal, auto-syncs on package upgrade (zudolab/zudo-doc#1994).
34
- * ======================================== */
35
-
11
+ /* Package-shipped tokens, safelist, content typography, and feature CSS.
12
+ Order is load-bearing theme.css MUST precede features.css. Do not reorder. */
13
+ @import "@takazudo/zudo-doc/theme.css";
36
14
  @import "@takazudo/zudo-doc/safelist.css";
37
-
38
- /* Content typography (`.zd-content` rules + admonitions + mermaid layout).
39
- Shipped by @takazudo/zudo-doc as the single source of truth — do not inline
40
- these rules here (they used to live here and drifted; see
41
- zudolab/zudo-doc#2188). The @layer zd-flow order it relies on is declared
42
- above (line 11); the safelist import above generates the component utilities
43
- its headings/links/etc. depend on. */
44
15
  @import "@takazudo/zudo-doc/content.css";
45
- /* Non-island feature CSS (code block buttons, syntect light-dark token rule,
46
- .zd-html-preview-code, KaTeX, sidebar toggle geometry, view-transition chrome,
47
- .ai-chat-md, .zd-enlarge*, .zd-mermaid*).
48
- Shipped by @takazudo/zudo-doc as single source of truth. See zudolab/zudo-doc#2331. */
16
+ @import "@takazudo/zudo-doc/page-loading.css";
49
17
  @import "@takazudo/zudo-doc/features.css";
50
- /* @slot:global-css:imports */
51
-
52
- /* ========================================
53
- * Tailwind v4 content sources
54
- *
55
- * Without a `.git` directory in the project root Tailwind v4's content
56
- * scanner falls back to explicit @source directives for class detection.
57
- * Builds that run outside a git checkout (E2E fixtures, CI containers
58
- * that copy the source tree without history, etc.) hit this fallback,
59
- * and zfb's default content roots only cover `pages/`. Components live
60
- * outside pages/, so these directives ensure the consumer's own code is
61
- * always scanned for utility classes. The package's utilities are now
62
- * covered by the @import above — these directives cover consumer code only.
63
- * ======================================== */
64
18
 
65
- @source "src/components/**/*.{tsx,ts,jsx,js,mdx,md}";
19
+ /* Scan this project's own source for Tailwind utility classes. */
66
20
  @source "src/content/**/*.{mdx,md}";
67
- @source "src/hooks/**/*.{tsx,ts,jsx,js}";
68
- @source "src/utils/**/*.{tsx,ts,jsx,js}";
21
+ @source "src/components/**/*.{tsx,ts,jsx,js}";
69
22
  @source "pages/**/*.{tsx,ts,jsx,js}";
70
23
 
71
- /* ========================================
72
- * Design Token System
73
- *
74
- * Tight token strategy: import preflight + utilities only (no default theme).
75
- * Only project-specific tokens are available.
76
- *
77
- * Base roles: --zd-bg/--zd-fg/--zd-selection-bg/--zd-selection-fg + ramps
78
- * (--palette-base-0..4 / --palette-accent-0..2 / --palette-state-*) +
79
- * 23 --zd-{role} semantic tokens, all injected by ColorSchemeProvider.
80
- * Tailwind tokens: registered below via @theme
81
- * ======================================== */
82
-
24
+ /* ── Your token overrides ──────────────────────────────────────────────
25
+ Override any default @theme token from @takazudo/zudo-doc/theme.css here. */
83
26
  @theme {
84
- /* ========================================
85
- * Project tight-token color reset
86
- *
87
- * Wipes all Tailwind default color tokens (`--color-*`) so only
88
- * project-defined palette and semantic tokens remain. This enforces the
89
- * tight-token policy: "NEVER use Tailwind default colors" (per Color Rules
90
- * in src/CLAUDE.md). Project color tokens (defined below) are added back
91
- * after this reset.
92
- *
93
- * The upstream split-import fix (zfb#159 / 9e37551, shipped in f68a9ba)
94
- * eliminated the original leak cause (zfb no longer prepends the full
95
- * @import "tailwindcss" bundle). The reset is retained as an explicit
96
- * design guardrail — it prevents accidental default palette bleed from any
97
- * future upstream change and keeps the project's color surface intentional.
98
- *
99
- * NOT reset: `--spacing` (the base spacing scale, default 0.25rem).
100
- * Tailwind spacing utilities compute as calc(var(--spacing) * N); wiping
101
- * `--spacing` collapses them to zero (observed in Wave 4 Sub-7 #1403).
102
- * ======================================== */
103
- --color-*: initial;
104
-
105
- /* ========================================
106
- * Colors — Three-tier token system
107
- * ======================================== */
108
-
109
- /* ── Base ── */
110
- --color-bg: var(--zd-bg);
111
- --color-fg: var(--zd-fg);
112
- --color-sel-bg: var(--zd-selection-bg);
113
- --color-sel-fg: var(--zd-selection-fg);
114
-
115
- /* ── Semantic aliases ── */
116
- --color-surface: var(--zd-surface);
117
- --color-muted: var(--zd-muted);
118
- --color-accent: var(--zd-accent);
119
- --color-accent-hover: var(--zd-accent-hover);
120
- --color-code-bg: var(--zd-code-bg);
121
- --color-code-fg: var(--zd-code-fg);
122
- --color-success: var(--zd-success);
123
- --color-danger: var(--zd-danger);
124
- --color-warning: var(--zd-warning);
125
- --color-info: var(--zd-info);
126
- /* Overlay is intentionally theme-independent (always dark, not scheme-driven) */
127
- --color-overlay: #000;
128
- /* The page-loading overlay scrim token is feature-gated: the dynamicPageTransition
129
- feature injects it into @slot:global-css:theme-tokens when enabled, so it is
130
- intentionally absent from this base @theme block (the host showcase global.css
131
- carries it inline only because the host is fully featured). Do not re-add it here. */
132
- --color-image-overlay-bg: var(--zd-image-overlay-bg);
133
- --color-image-overlay-fg: var(--zd-image-overlay-fg);
134
- /* --color-mermaid-* aliases removed: mermaid-init-script.ts reads --zd-mermaid-* directly;
135
- these @theme registrations were unused (no Tailwind utility references). --zd-mermaid-*
136
- injection in color-scheme-utils.ts is preserved and remains the live source. */
137
- --color-chat-user-bg: var(--zd-chat-user-bg);
138
- --color-chat-user-text: var(--zd-chat-user-text);
139
- --color-chat-assistant-bg: var(--zd-chat-assistant-bg);
140
- --color-chat-assistant-text: var(--zd-chat-assistant-text);
141
- --color-matched-keyword-bg: var(--zd-matched-keyword-bg);
142
- --color-matched-keyword-fg: var(--zd-matched-keyword-fg);
143
- /* @slot:global-css:theme-tokens */
144
-
145
- /* ========================================
146
- * Spacing — hsp (horizontal) + vsp (vertical)
147
- * ======================================== */
148
- --spacing-0: 0;
149
- --spacing-px: 1px;
150
-
151
- /* Horizontal spacing (7 steps) */
152
- --spacing-hsp-2xs: 0.125rem; /* 2px — tight inline */
153
- --spacing-hsp-xs: 0.375rem; /* 6px — compact inline */
154
- --spacing-hsp-sm: 0.5rem; /* 8px — small padding */
155
- --spacing-hsp-md: 0.75rem; /* 12px — default gaps */
156
- --spacing-hsp-lg: 1rem; /* 16px — standard padding */
157
- --spacing-hsp-xl: 1.5rem; /* 24px — generous padding */
158
- --spacing-hsp-2xl: 2rem; /* 32px — large padding */
159
-
160
- /* Vertical spacing (8 steps) */
161
- --spacing-vsp-3xs: 0.25rem; /* 4px — hairline gap */
162
- --spacing-vsp-2xs: 0.4375rem; /* 7px — tight gap */
163
- --spacing-vsp-xs: 0.875rem; /* 14px — small gap */
164
- --spacing-vsp-sm: 1.25rem; /* 20px — compact gap */
165
- --spacing-vsp-md: 1.5rem; /* 24px — standard gap */
166
- --spacing-vsp-lg: 1.75rem; /* 28px — section gap */
167
- --spacing-vsp-xl: 2.5rem; /* 40px — large section gap */
168
- --spacing-vsp-2xl: 3.5rem; /* 56px — page-level gap */
169
-
170
- /* ========================================
171
- * Element sizes — semantic icon dimensions
172
- * ======================================== */
173
- --spacing-icon-xs: 0.75rem; /* 12px — inline meta icons, chevrons */
174
- --spacing-icon-sm: 1rem; /* 16px — standard UI icons */
175
- --spacing-icon-md: 1.25rem; /* 20px — medium emphasis icons */
176
- --spacing-icon-lg: 1.5rem; /* 24px — large / mobile icons */
177
-
178
- /* Image overlay button chrome */
179
- --spacing-image-overlay-inset: 0.5rem; /* 8px — overlay button corner inset + internal padding */
180
-
181
- /* ========================================
182
- * Elevation — the tight `@import "tailwindcss/utilities"` (no default
183
- * @theme) drops Tailwind's default shadow scale, so `shadow-*` utilities
184
- * generate nothing. Re-add the one elevation the components use: header
185
- * and version-switcher dropdown panels apply `shadow-lg`. Value is
186
- * Tailwind v4's default shadow-lg; the black is intentionally
187
- * theme-independent (a drop shadow is absence of light, not a themed color).
188
- * ======================================== */
189
- --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
190
-
191
- /* ========================================
192
- * Typography
193
- * ======================================== */
194
-
195
- /* ── Tier 2: Semantic font-size tokens (reference Tier 1 scale only) ── */
196
- --text-micro: var(--text-scale-2xs); /* 12px — compact panel labels, color swatch annotations */
197
- --text-caption: var(--text-scale-xs); /* labels, timestamps */
198
- --text-small: var(--text-scale-sm); /* secondary text, nav items */
199
- --text-body: var(--text-scale-md); /* paragraphs, default */
200
- --text-title: var(--text-scale-lg); /* card titles, section labels */
201
- --text-heading: var(--text-scale-xl); /* page headings */
202
- --text-display: var(--text-scale-2xl); /* hero text */
203
-
204
- /* Font families */
205
- --font-sans: system-ui, sans-serif;
206
- --font-mono: ui-monospace, monospace;
207
-
208
- /* Font weights (4 steps) */
209
- --font-weight-normal: 400;
210
- --font-weight-medium: 500;
211
- --font-weight-semibold: 600;
212
- --font-weight-bold: 700;
213
-
214
- /* Line heights (4 steps) */
215
- --leading-tight: 1.25;
216
- --leading-snug: 1.375;
217
- --leading-normal: 1.5;
218
- --leading-relaxed: 1.625;
219
-
220
- /* Letter spacing / tracking (4 steps) */
221
- --tracking-tight: -0.025em; /* headings, display text */
222
- --tracking-normal: normal; /* browser default — resets any inherited tracking */
223
- --tracking-wide: 0.05em; /* labels, UI text */
224
- --tracking-wider: 0.1em; /* small caps, decorative */
225
-
226
- /* ========================================
227
- * Border radius (3 steps)
228
- * ======================================== */
229
- --radius-DEFAULT: 0.25rem; /* 4px — rounded */
230
- --radius-lg: 0.5rem; /* 8px — rounded-lg */
231
- --radius-full: 9999px; /* rounded-full */
232
-
233
- /* ========================================
234
- * Breakpoints (3 steps)
235
- * ======================================== */
236
- --breakpoint-sm: 640px;
237
- --breakpoint-lg: 1024px;
238
- --breakpoint-xl: 1280px;
27
+ /* e.g. --color-accent: oklch(0.6 0.2 250); */
239
28
  }
240
-
241
- /* ========================================
242
- * Z-index tiers — semantic, single-namespace scale.
243
- *
244
- * The @theme block below is GENERATED from src/config/z-index-tokens.ts
245
- * (the single source of truth) by `pnpm gen:z-index`. Tailwind v4 reads the
246
- * --z-index-<name> theme key and generates a `z-<name>` utility, so e.g.
247
- * --z-index-toolbar: 20 produces `.z-toolbar { z-index: 20 }`; raw CSS can
248
- * also reference `z-index: var(--z-index-<name>)`. `pnpm check:z-index` fails
249
- * on drift. Do NOT hand-edit between the BEGIN/END markers.
250
- * ======================================== */
251
- /* GENERATED:Z_INDEX_BEGIN
252
- * GENERATED:Z_INDEX — do not hand-edit; run pnpm gen:z-index.
253
- * Source of truth: src/config/z-index-tokens.ts. Tailwind v4 reads the
254
- * --z-index-<name> theme key and generates a z-<name> utility. */
255
- @theme {
256
- --z-index-content: 0;
257
- --z-index-local-1: 1;
258
- --z-index-local-2: 2;
259
- --z-index-local-3: 3;
260
- --z-index-sidebar: 10;
261
- --z-index-toolbar: 20;
262
- --z-index-dropdown: 30;
263
- --z-index-popover: 40;
264
- --z-index-modal-backdrop: 50;
265
- --z-index-modal: 60;
266
- --z-index-toast: 70;
267
- --z-index-tooltip: 80;
268
- --z-index-drag: 90;
269
- }
270
- /* GENERATED:Z_INDEX_END */
271
-
272
- :root {
273
- /* Default responsive range; sidebar-resizer.ts allows 192–448px for explicit resizing. */
274
- --zd-sidebar-w: clamp(14rem, 20vw, 22rem);
275
-
276
- /* ── Tier 1: Abstract font-size scale (raw values — NOT for direct component use) ── */
277
- /* Used only as a source of truth for Tier 2 semantic tokens above. */
278
- --text-scale-2xs: 0.75rem; /* 12px */
279
- --text-scale-xs: 0.875rem; /* 14px */
280
- --text-scale-sm: 1rem; /* 16px */
281
- --text-scale-md: 1.2rem; /* 19.2px */
282
- --text-scale-lg: 1.4rem; /* 22.4px */
283
- --text-scale-xl: 3rem; /* 48px */
284
- --text-scale-2xl: 3.75rem; /* 60px */
285
-
286
- --default-transition-duration: 150ms; /* consumed by image-enlarge and hash-link opacity fade */
287
- --zd-transition-slow: 200ms; /* sidebar transform/visibility and content-band max-width */
288
- --zd-transition-slower: 300ms; /* view-transition fade-in (contentFadeIn animation) */
289
- --zd-header-h: 80px; /* sticky header height; consumed by scroll-margin-top on [id] anchors */
290
- }
291
-
292
- /* ========================================
293
- * Base styles
294
- * ======================================== */
295
-
296
- [id] {
297
- scroll-margin-top: var(--zd-header-h);
298
- }
299
-
300
- body {
301
- background-color: var(--color-bg);
302
- color: var(--color-fg);
303
- }
304
-
305
- ::selection {
306
- background-color: var(--color-sel-bg);
307
- color: var(--color-sel-fg);
308
- }
309
-
310
- @layer base {
311
- a {
312
- text-underline-offset: 4px;
313
- }
314
- button {
315
- cursor: pointer;
316
- }
317
- :focus-visible {
318
- outline: 2px solid var(--color-accent);
319
- outline-offset: 2px;
320
- }
321
- }
322
-
323
- /* ── Search highlight ── */
324
- [data-search-results] mark {
325
- background-color: var(--color-matched-keyword-bg);
326
- color: var(--color-matched-keyword-fg);
327
- padding: 0;
328
- border-radius: 2px;
329
- }
330
-
331
- /* Version-switcher responsive visibility (moved out of the component to
332
- * avoid <style>-inside-<div> HTML5 content-model violation; required when
333
- * the i18nVersion feature ships a <VersionSwitcher> wrapped in
334
- * `<div class="hidden lg:block">`. Inert when no version-switcher is on
335
- * the page. */
336
- @media (min-width: 64rem) {
337
- .hidden:has(> [data-version-switcher]) {
338
- display: block;
339
- }
340
- }
341
-
342
- /* ── Find-in-page highlight (W7A: unconditional — Tauri feature gates at runtime) ── */
343
- .find-match {
344
- background-color: color-mix(in oklch, var(--color-warning) 40%, transparent);
345
- border-radius: 2px;
346
- }
347
- .find-match-active {
348
- background-color: color-mix(in oklch, var(--color-warning) 70%, transparent);
349
- border-radius: 2px;
350
- outline: 2px solid color-mix(in oklch, var(--color-warning) 90%, transparent);
351
- }
352
-
353
- /* @slot:global-css:feature-styles */
@@ -1,36 +1,13 @@
1
1
  {
2
- "$schema": "https://json.schemastore.org/tsconfig",
2
+ "extends": "@takazudo/zudo-doc/tsconfig.base.json",
3
+ "include": ["src", "pages", "zfb.config.ts"],
3
4
  "compilerOptions": {
4
- "target": "ESNext",
5
- "module": "ESNext",
6
- "moduleResolution": "Bundler",
7
- "allowImportingTsExtensions": true,
8
- "resolveJsonModule": true,
9
- "verbatimModuleSyntax": true,
10
- "isolatedModules": true,
11
- "noEmit": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "esModuleInterop": true,
14
- "skipLibCheck": true,
15
- "allowJs": true,
16
- "jsx": "preserve",
17
- "strict": true,
18
- "noImplicitAny": true,
19
- "strictNullChecks": true,
20
- "strictFunctionTypes": true,
21
- "strictBindCallApply": true,
22
- "strictPropertyInitialization": true,
23
- "noImplicitThis": true,
24
- "useUnknownInCatchVariables": true,
25
- "alwaysStrict": true,
26
5
  "baseUrl": ".",
27
6
  "paths": {
28
7
  "@/*": ["src/*"],
29
- "#doc-history-meta": [".zfb/doc-history-meta.json"],
30
8
  "react": ["./node_modules/preact/compat/"],
31
9
  "react/jsx-runtime": ["./node_modules/preact/jsx-runtime"],
32
10
  "react-dom": ["./node_modules/preact/compat/"]
33
11
  }
34
- },
35
- "exclude": ["dist", "e2e/fixtures", "packages", "pages", "worktrees", "vendor", "src/**/__tests__", "vitest.config.ts"]
12
+ }
36
13
  }