create-zudo-doc 3.2.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.
- package/dist/claude-md-gen.d.ts +8 -0
- package/dist/claude-md-gen.js +43 -26
- package/dist/compose.d.ts +14 -20
- package/dist/compose.js +15 -25
- 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 +12 -0
- package/dist/features/claude-resources.js +13 -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 +18 -3
- package/dist/features/doc-history.js +45 -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/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 +14 -7
- package/dist/features/tag-governance.js +52 -8
- package/dist/features/tauri.d.ts +13 -10
- package/dist/features/tauri.js +16 -52
- package/dist/features/versioning.d.ts +12 -24
- package/dist/features/versioning.js +13 -39
- package/dist/index.js +2 -3
- package/dist/scaffold.d.ts +13 -6
- package/dist/scaffold.js +64 -45
- 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 +400 -53
- package/package.json +2 -2
- package/templates/base/pages/docs/[[...slug]].tsx +59 -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 +88 -0
- package/templates/features/tagGovernance/files/scripts/tags-suggest.ts +3 -1
- 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/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,102 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
# b4push — local quality gate run before pushing.
|
|
5
|
-
#
|
|
6
|
-
# Step order (cheap → expensive):
|
|
7
|
-
# 1. Type checking (zfb check)
|
|
8
|
-
# 2. Build (zfb build)
|
|
9
|
-
# 3. HTML validation (html-validate dist/**/*.html)
|
|
10
|
-
# 4. Manual interactive smoke (operator-driven)
|
|
11
|
-
#
|
|
12
|
-
# Env overrides for non-interactive use:
|
|
13
|
-
# B4PUSH_SKIP_HTML_VALIDATE=1 — skip HTML validation (step 3)
|
|
14
|
-
# B4PUSH_SKIP_MANUAL_SMOKE=1 — skip the manual interactive smoke
|
|
15
|
-
|
|
16
|
-
START_TIME=$(date +%s)
|
|
17
|
-
FAILURES=()
|
|
18
|
-
TOTAL_STEPS=4
|
|
19
|
-
CURRENT_STEP=0
|
|
20
|
-
|
|
21
|
-
step() {
|
|
22
|
-
CURRENT_STEP=$((CURRENT_STEP + 1))
|
|
23
|
-
echo ""
|
|
24
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
25
|
-
echo "▶ Step $CURRENT_STEP/$TOTAL_STEPS: $1"
|
|
26
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
pass() { echo "✅ $1"; }
|
|
30
|
-
fail() { echo "❌ $1"; FAILURES+=("$1"); }
|
|
31
|
-
skip() { echo "⏭ $1 (skipped)"; }
|
|
32
|
-
|
|
33
|
-
ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
34
|
-
|
|
35
|
-
# ── Step 1: Type checking ─────────────────────────────
|
|
36
|
-
step "Type checking (zfb check)"
|
|
37
|
-
if (cd "$ROOT_DIR" && pnpm check); then
|
|
38
|
-
pass "Type checking passed"
|
|
39
|
-
else
|
|
40
|
-
fail "Type checking"
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
# ── Step 2: Build ─────────────────────────────────────
|
|
44
|
-
step "Build (zfb build)"
|
|
45
|
-
if (cd "$ROOT_DIR" && pnpm build); then
|
|
46
|
-
pass "Build passed"
|
|
47
|
-
else
|
|
48
|
-
fail "Build"
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
# ── Step 3: HTML validation ───────────────────────────
|
|
52
|
-
step "HTML validation (html-validate)"
|
|
53
|
-
if [[ "${B4PUSH_SKIP_HTML_VALIDATE:-}" == "1" ]]; then
|
|
54
|
-
skip "HTML validation (B4PUSH_SKIP_HTML_VALIDATE=1)"
|
|
55
|
-
else
|
|
56
|
-
if (cd "$ROOT_DIR" && pnpm check:html); then
|
|
57
|
-
pass "HTML validation passed"
|
|
58
|
-
else
|
|
59
|
-
fail "HTML validation"
|
|
60
|
-
fi
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
# ── Step 4: Manual interactive smoke ─────────────────
|
|
64
|
-
step "Manual interactive smoke"
|
|
65
|
-
if [[ "${B4PUSH_SKIP_MANUAL_SMOKE:-}" == "1" ]]; then
|
|
66
|
-
skip "Manual smoke (B4PUSH_SKIP_MANUAL_SMOKE=1)"
|
|
67
|
-
else
|
|
68
|
-
cat <<'MANUAL'
|
|
69
|
-
Run `pnpm preview` in another terminal and exercise:
|
|
70
|
-
• theme toggle (light/dark)
|
|
71
|
-
• mobile menu (narrow viewport)
|
|
72
|
-
• search dropdown (header search)
|
|
73
|
-
• code-block syntax highlighting
|
|
74
|
-
|
|
75
|
-
Press [Enter] when all flows look healthy, or Ctrl-C to abort.
|
|
76
|
-
MANUAL
|
|
77
|
-
if read -r _; then
|
|
78
|
-
pass "Manual smoke acknowledged"
|
|
79
|
-
else
|
|
80
|
-
fail "Manual smoke (aborted)"
|
|
81
|
-
fi
|
|
82
|
-
fi
|
|
83
|
-
|
|
84
|
-
# ── Summary ──────────────────────────────────────────
|
|
85
|
-
END_TIME=$(date +%s)
|
|
86
|
-
DURATION=$((END_TIME - START_TIME))
|
|
87
|
-
|
|
88
|
-
echo ""
|
|
89
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
90
|
-
echo " SUMMARY (${DURATION}s)"
|
|
91
|
-
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
92
|
-
|
|
93
|
-
if [ ${#FAILURES[@]} -eq 0 ]; then
|
|
94
|
-
echo "✅ All $TOTAL_STEPS checks passed (or skipped). Safe to push."
|
|
95
|
-
exit 0
|
|
96
|
-
else
|
|
97
|
-
echo "❌ ${#FAILURES[@]} check(s) failed:"
|
|
98
|
-
for f in "${FAILURES[@]}"; do
|
|
99
|
-
echo " - $f"
|
|
100
|
-
done
|
|
101
|
-
exit 1
|
|
102
|
-
fi
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
// W6A stub — no-op default + AiChatModal named exports.
|
|
2
|
-
//
|
|
3
|
-
// The AiChatModal island now ships from the package
|
|
4
|
-
// (`@takazudo/zudo-doc/ai-chat-modal`); the unconditional
|
|
5
|
-
// `pages/lib/_body-end-islands.tsx` imports it directly from there. This
|
|
6
|
-
// stub exists only so any project-local code that references the
|
|
7
|
-
// `@/components/ai-chat-modal` path still resolves — it renders nothing.
|
|
8
|
-
// Replace this file to wire a project-specific modal.
|
|
9
|
-
import type { JSX } from "preact";
|
|
10
|
-
|
|
11
|
-
function AiChatModal(): JSX.Element | null {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
AiChatModal.displayName = "AiChatModal";
|
|
15
|
-
|
|
16
|
-
export default AiChatModal;
|
|
17
|
-
|
|
18
|
-
export { AiChatModal };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// Re-export from the shared package — moved to @takazudo/zudo-doc/content-admonition
|
|
2
|
-
// as part of the package-first migration (epic #2321, S4 #2327).
|
|
3
|
-
export type { AdmonitionVariant, AdmonitionProps } from "@takazudo/zudo-doc/content-admonition";
|
|
4
|
-
export { makeAdmonition } from "@takazudo/zudo-doc/content-admonition";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// W6A stub — no-op default export.
|
|
2
|
-
//
|
|
3
|
-
// When the sidebarToggle feature is enabled, the feature template
|
|
4
|
-
// overwrites this file with the real desktop sidebar-toggle island.
|
|
5
|
-
// Generated projects without the feature ship the no-op so the
|
|
6
|
-
// unconditional `pages/lib/_body-end-islands` (or sidebar wrapper)
|
|
7
|
-
// import resolves at typecheck time.
|
|
8
|
-
import type { JSX } from "preact";
|
|
9
|
-
|
|
10
|
-
function DesktopSidebarToggle(): JSX.Element | null {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
DesktopSidebarToggle.displayName = "DesktopSidebarToggle";
|
|
14
|
-
|
|
15
|
-
export default DesktopSidebarToggle;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// W6A stub — no-op default + DocHistory named exports.
|
|
2
|
-
//
|
|
3
|
-
// The real DocHistory island now ships from the package
|
|
4
|
-
// (`@takazudo/zudo-doc/doc-history`); the unconditional
|
|
5
|
-
// `pages/lib/_doc-history-area.tsx` imports it directly from there. When
|
|
6
|
-
// the docHistory feature is enabled the feature template overwrites this
|
|
7
|
-
// file with a re-export shim pointing at the package island. Generated
|
|
8
|
-
// projects without the feature ship this no-op so any project-local code
|
|
9
|
-
// that references the `@/components/doc-history` path still resolves. The
|
|
10
|
-
// host module exposes `DocHistory` as a named export, so the stub mirrors
|
|
11
|
-
// both the default and named shapes to keep the import surface stable.
|
|
12
|
-
import type { JSX } from "preact";
|
|
13
|
-
|
|
14
|
-
function DocHistoryComponent(): JSX.Element | null {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
DocHistoryComponent.displayName = "DocHistory";
|
|
18
|
-
|
|
19
|
-
export default DocHistoryComponent;
|
|
20
|
-
|
|
21
|
-
export const DocHistory = DocHistoryComponent;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// W6A stub — no-op default + ImageEnlarge / ImageEnlargeSsrFallback exports.
|
|
2
|
-
//
|
|
3
|
-
// The real ImageEnlarge island and its SSR fallback now ship from the
|
|
4
|
-
// package (`@takazudo/zudo-doc/image-enlarge`); the unconditional
|
|
5
|
-
// `pages/lib/_body-end-islands.tsx` imports them directly from there. When
|
|
6
|
-
// the imageEnlarge feature is enabled the feature template overwrites this
|
|
7
|
-
// file with a re-export shim pointing at the package island. Generated
|
|
8
|
-
// projects without the feature ship this no-op so any project-local code
|
|
9
|
-
// that references the `@/components/image-enlarge` path still resolves (the
|
|
10
|
-
// body-end renderer references both the default and the SSR fallback).
|
|
11
|
-
import type { JSX } from "preact";
|
|
12
|
-
|
|
13
|
-
function ImageEnlarge(): JSX.Element | null {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
ImageEnlarge.displayName = "ImageEnlarge";
|
|
17
|
-
|
|
18
|
-
export default ImageEnlarge;
|
|
19
|
-
|
|
20
|
-
export { ImageEnlarge };
|
|
21
|
-
|
|
22
|
-
export function ImageEnlargeSsrFallback(): JSX.Element | null {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// W6A stub — no-op default export.
|
|
2
|
-
//
|
|
3
|
-
// The host (zudo-doc showcase) ships an interactive preset-generator
|
|
4
|
-
// island used by its onboarding pages. Generated downstream projects
|
|
5
|
-
// ship the no-op so unconditional page imports (`pages/lib/_preset-generator`)
|
|
6
|
-
// resolve. Wire a real implementation by replacing this file.
|
|
7
|
-
import type { JSX } from "preact";
|
|
8
|
-
|
|
9
|
-
function PresetGenerator(): JSX.Element | null {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
PresetGenerator.displayName = "PresetGenerator";
|
|
13
|
-
|
|
14
|
-
export default PresetGenerator;
|
|
@@ -1,6 +0,0 @@
|
|
|
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";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Thin re-export shim. SidebarTree moved into the package
|
|
2
|
-
// (`@takazudo/zudo-doc/sidebar-tree-island`) as part of the package-first
|
|
3
|
-
// migration (#2344, S2). Host code using `@/components/sidebar-tree`
|
|
4
|
-
// still resolves correctly; the implementation lives in the package.
|
|
5
|
-
export { SidebarTree } from "@takazudo/zudo-doc/sidebar-tree-island";
|
|
6
|
-
export type { SidebarTreeProps } from "@takazudo/zudo-doc/sidebar-tree-island";
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Project-side color-scheme helpers.
|
|
3
|
-
*
|
|
4
|
-
* The MECHANISM (ramp→CSS injection logic) now lives in the package:
|
|
5
|
-
* `@takazudo/zudo-doc/color-scheme-utils`. This file re-exports those
|
|
6
|
-
* mechanism symbols and adds project-specific thin wrappers that read from
|
|
7
|
-
* this project's `colorSchemes` map and `settings`. The DATA (ramp values,
|
|
8
|
-
* scheme names) stays in `./color-schemes` and `./settings`.
|
|
9
|
-
*
|
|
10
|
-
* S9a package-first migration — zudolab/zudo-doc#2333.
|
|
11
|
-
* Ramp-native rewrite — zudolab/zudo-doc#2585/#2586.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
type OKLCH,
|
|
16
|
-
type StateRole,
|
|
17
|
-
type SemanticKey,
|
|
18
|
-
type RampRef,
|
|
19
|
-
type Ramps,
|
|
20
|
-
type ModeMap,
|
|
21
|
-
type ColorScheme,
|
|
22
|
-
type CssEmitScope,
|
|
23
|
-
STATE_ROLES,
|
|
24
|
-
SEMANTIC_KEYS,
|
|
25
|
-
SEMANTIC_RAMP_DEFAULTS,
|
|
26
|
-
SEMANTIC_CSS_NAMES,
|
|
27
|
-
resolveRampRef,
|
|
28
|
-
resolveSemanticColors,
|
|
29
|
-
schemeToCssPairs,
|
|
30
|
-
generateCssCustomProperties as generateCssCustomPropertiesFromScheme,
|
|
31
|
-
generateLightDarkCssProperties as generateLightDarkCssPropertiesFromSchemes,
|
|
32
|
-
} from "@takazudo/zudo-doc/color-scheme-utils";
|
|
33
|
-
import {
|
|
34
|
-
generateCssCustomProperties as _generateCssCustomProperties,
|
|
35
|
-
generateLightDarkCssProperties as _generateLightDarkCssProperties,
|
|
36
|
-
} from "@takazudo/zudo-doc/color-scheme-utils";
|
|
37
|
-
|
|
38
|
-
import { colorSchemes } from "./color-schemes";
|
|
39
|
-
import { settings } from "./settings";
|
|
40
|
-
|
|
41
|
-
export const lightDarkPairings = [
|
|
42
|
-
{ light: "Default Light", dark: "Default Dark", label: "Default" },
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
export function getActiveScheme() {
|
|
46
|
-
const scheme = colorSchemes[settings.colorScheme];
|
|
47
|
-
if (!scheme) {
|
|
48
|
-
throw new Error(`Unknown color scheme: "${settings.colorScheme}". Available: ${Object.keys(colorSchemes).join(", ")}`);
|
|
49
|
-
}
|
|
50
|
-
return scheme;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/** Generate `:root { --zd-* }` CSS for the project's active single scheme. */
|
|
54
|
-
export function generateCssCustomProperties(): string {
|
|
55
|
-
return _generateCssCustomProperties(getActiveScheme());
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Generate `:root { --zd-*: light-dark(…) }` CSS for the project's configured light/dark pair. */
|
|
59
|
-
export function generateLightDarkCssProperties(): string {
|
|
60
|
-
if (!settings.colorMode) {
|
|
61
|
-
throw new Error("colorMode is not configured");
|
|
62
|
-
}
|
|
63
|
-
const { lightScheme, darkScheme } = settings.colorMode;
|
|
64
|
-
const light = colorSchemes[lightScheme];
|
|
65
|
-
const dark = colorSchemes[darkScheme];
|
|
66
|
-
if (!light) throw new Error(`Unknown light scheme: "${lightScheme}"`);
|
|
67
|
-
if (!dark) throw new Error(`Unknown dark scheme: "${darkScheme}"`);
|
|
68
|
-
return _generateLightDarkCssProperties(light, dark);
|
|
69
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ramp-native color schemes (Color Ramp Restructure — zudolab/zudo-doc#2584;
|
|
3
|
-
* minimize pass #2601 / #2602).
|
|
4
|
-
*
|
|
5
|
-
* A `ColorScheme` is `{ ramps, map }` (the MECHANISM types live in the package
|
|
6
|
-
* and are re-exported by `./color-scheme-utils`):
|
|
7
|
-
* - `ramps` — the shared Tier-1 source of truth: a warm-neutral `base` ramp
|
|
8
|
-
* (5 stops, index 0 = lightest), an `accent` ramp (3 stops), and 4 `state`
|
|
9
|
-
* colors. Light and dark modes SHARE these values.
|
|
10
|
-
* - `map` — the per-mode Tier-2 wiring: which ramp stop (or literal OKLCH)
|
|
11
|
-
* each UI role points at.
|
|
12
|
-
*
|
|
13
|
-
* The palette was minimized from base=12 / accent=7 to **base=5 / accent=3**
|
|
14
|
-
* (#2602): the ramp-native engine is length-agnostic, so this is a DATA change.
|
|
15
|
-
* Semantic roles are aggressively merged onto shared stops to keep the number of
|
|
16
|
-
* distinct tones small — most notably `surface`, `codeBg`(light) and
|
|
17
|
-
* `chatAssistantBg` collapse onto `bg`, so header Version boxes and doc cards
|
|
18
|
-
* render as page-bg + border only (no gray fill). 5 stops leave no subtle
|
|
19
|
-
* near-white, so light-mode elevated fills are border-only by design.
|
|
20
|
-
*
|
|
21
|
-
* `ColorScheme` is re-exported here so the many sites that still
|
|
22
|
-
* `import { ColorScheme } from "./color-schemes"` (contrast tooling,
|
|
23
|
-
* zfb.config.ts, …) keep resolving until their own waves port them.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
import type { ColorScheme, Ramps, ModeMap } from "./color-scheme-utils";
|
|
27
|
-
|
|
28
|
-
export type { ColorScheme } from "./color-scheme-utils";
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Shared Tier-1 ramps — identical across Default Light and Default Dark.
|
|
32
|
-
* Minimized to 5 base / 3 accent (#2602). The warm-neutral spine keeps hue 65;
|
|
33
|
-
* the accent stops are the three tuned orange stops carried over from the 7-stop
|
|
34
|
-
* ramp (old accent2/3/6, re-indexed). Index 0 = lightest.
|
|
35
|
-
*/
|
|
36
|
-
const ramps: Ramps = {
|
|
37
|
-
base: [
|
|
38
|
-
"oklch(.965 .004 65)", // 0 — lightest (light bg / dark fg)
|
|
39
|
-
"oklch(.705 .008 65)", // 1 — dark muted / light selection & mermaid fill
|
|
40
|
-
"oklch(.480 .008 65)", // 2 — light muted / dark selection & mermaid note
|
|
41
|
-
"oklch(.300 .006 65)", // 3 — dark codeBg / mermaid fill
|
|
42
|
-
"oklch(.185 .005 65)", // 4 — darkest (dark bg / light fg)
|
|
43
|
-
],
|
|
44
|
-
accent: [
|
|
45
|
-
"oklch(.755 .130 64)", // 0 — dark hover (was accent2)
|
|
46
|
-
"oklch(.700 .158 62)", // 1 — dark accent (was accent3)
|
|
47
|
-
"oklch(.470 .120 56)", // 2 — light accent (was accent6)
|
|
48
|
-
],
|
|
49
|
-
state: {
|
|
50
|
-
danger: "oklch(.640 .170 25)",
|
|
51
|
-
success: "oklch(.680 .145 145)",
|
|
52
|
-
warning: "oklch(.760 .135 82)",
|
|
53
|
-
info: "oklch(.680 .130 245)",
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Default Dark — the authored reference scheme (epic #2584; minimized #2602).
|
|
59
|
-
* bg = darkest base stop, fg = lightest. Roles merged onto shared stops:
|
|
60
|
-
* `surface`, `chatAssistantBg`, `imageOverlayBg` all = `bg` (b4) so elevated
|
|
61
|
-
* panels are bg + border only. Per-mode AA-tuned literals: `danger`,
|
|
62
|
-
* `matchedKeyword*` (carried from #2593). Full WCAG matrix passes at
|
|
63
|
-
* threshold+0.1.
|
|
64
|
-
*/
|
|
65
|
-
const darkMap: ModeMap = {
|
|
66
|
-
bg: { base: 4 },
|
|
67
|
-
fg: { base: 0 },
|
|
68
|
-
selectionBg: { base: 2 },
|
|
69
|
-
selectionFg: { base: 0 },
|
|
70
|
-
semantic: {
|
|
71
|
-
// Merged onto bg (b4) — elevated panels read as page-bg + border, no gray fill.
|
|
72
|
-
surface: { base: 4 },
|
|
73
|
-
muted: { base: 1 },
|
|
74
|
-
accent: { accent: 1 },
|
|
75
|
-
accentHover: { accent: 0 },
|
|
76
|
-
codeBg: { base: 3 },
|
|
77
|
-
codeFg: { base: 0 },
|
|
78
|
-
success: { state: "success" },
|
|
79
|
-
// Per-mode AA-tuned literal — shared state.danger oklch(.640 .170 25) is too
|
|
80
|
-
// dark for the danger-admonition title on its 12%-tint dark bg. L .640→.655
|
|
81
|
-
// (H/C fixed) — admonition-danger at threshold+0.1; carried from #2593.
|
|
82
|
-
danger: "oklch(.655 .170 25)",
|
|
83
|
-
warning: { state: "warning" },
|
|
84
|
-
info: { state: "info" },
|
|
85
|
-
mermaidNodeBg: { base: 3 },
|
|
86
|
-
mermaidText: { base: 0 },
|
|
87
|
-
mermaidLine: { base: 1 },
|
|
88
|
-
mermaidLabelBg: { base: 3 },
|
|
89
|
-
mermaidNoteBg: { base: 2 },
|
|
90
|
-
chatUserBg: { accent: 1 },
|
|
91
|
-
chatUserText: { base: 4 },
|
|
92
|
-
// Merged onto bg (b4) — the chat assistant bubble reads as page-bg + border.
|
|
93
|
-
chatAssistantBg: { base: 4 },
|
|
94
|
-
chatAssistantText: { base: 0 },
|
|
95
|
-
imageOverlayBg: { base: 4 },
|
|
96
|
-
imageOverlayFg: { base: 0 },
|
|
97
|
-
// Search-result <mark> highlight: an amber (accent-hue) fill with dark text —
|
|
98
|
-
// the classic highlighter look, identical in both modes. Kept as literals so
|
|
99
|
-
// the amber fill is scheme-stable; matchedKeywordFg dark so text clears AA on
|
|
100
|
-
// the amber bg — matched-keyword at threshold+0.1; carried from #2593.
|
|
101
|
-
matchedKeywordBg: "oklch(.700 .158 62)",
|
|
102
|
-
matchedKeywordFg: "oklch(.300 .003 65)",
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Default Light — the authored light-mode scheme (epic #2584; minimized #2602).
|
|
108
|
-
* Shares `ramps` with Default Dark; the `map` inverts (light bg = lightest base
|
|
109
|
-
* stop, dark fg = darkest). Roles merged onto shared stops: `surface`, `codeBg`,
|
|
110
|
-
* `chatAssistantBg` all = `bg` (b0) so elevated panels are bg + border only
|
|
111
|
-
* (the intended flat, few-tone look — 5 stops leave no subtle near-white fill).
|
|
112
|
-
* The accent/state colors — authored for a dark bg — need darker per-mode
|
|
113
|
-
* literals to clear AA on a near-white bg. Full WCAG matrix passes at
|
|
114
|
-
* threshold+0.1; ramps untouched so Default Dark is unaffected.
|
|
115
|
-
*/
|
|
116
|
-
const lightMap: ModeMap = {
|
|
117
|
-
bg: { base: 0 },
|
|
118
|
-
fg: { base: 4 },
|
|
119
|
-
selectionBg: { base: 1 },
|
|
120
|
-
selectionFg: { base: 4 },
|
|
121
|
-
semantic: {
|
|
122
|
-
// Merged onto bg (b0) — elevated panels read as page-bg + border, no gray fill.
|
|
123
|
-
surface: { base: 0 },
|
|
124
|
-
muted: { base: 2 },
|
|
125
|
-
accent: { accent: 2 },
|
|
126
|
-
// Light: per-mode literal — the accent ramp has no stop darker than accent2,
|
|
127
|
-
// so the link-hover state darkens further (hover-darkens-on-light
|
|
128
|
-
// convention). L .400, C fitted to the sRGB gamut edge at that L; carried
|
|
129
|
-
// from #2595. accent-hover-vs-bg clears threshold+0.1.
|
|
130
|
-
accentHover: "oklch(.400 .096 56)",
|
|
131
|
-
// Merged onto bg (b0) — inline/code-block fill reads as page-bg + border.
|
|
132
|
-
codeBg: { base: 0 },
|
|
133
|
-
codeFg: { base: 4 },
|
|
134
|
-
// Light: per-mode literals — the shared state colors are authored for a dark
|
|
135
|
-
// bg and are too light on the 12%-tint admonition backgrounds over a light
|
|
136
|
-
// page bg. Each darkened (H fixed; C at gamut max, clipped where noted) to
|
|
137
|
-
// clear its admonition pair at threshold+0.1; carried from #2595.
|
|
138
|
-
success: "oklch(.470 .140 145)",
|
|
139
|
-
danger: "oklch(.505 .170 25)",
|
|
140
|
-
warning: "oklch(.490 .100 82)", // C .135→.100 (gamut-clips at this L)
|
|
141
|
-
info: "oklch(.485 .122 245)",
|
|
142
|
-
mermaidNodeBg: { base: 1 },
|
|
143
|
-
mermaidText: { base: 4 },
|
|
144
|
-
mermaidLine: { base: 2 },
|
|
145
|
-
mermaidLabelBg: { base: 1 },
|
|
146
|
-
mermaidNoteBg: { base: 1 },
|
|
147
|
-
chatUserBg: { accent: 1 },
|
|
148
|
-
// Dark text on the amber user bubble (matches Default Dark).
|
|
149
|
-
chatUserText: { base: 4 },
|
|
150
|
-
// Merged onto bg (b0) — the chat assistant bubble reads as page-bg + border.
|
|
151
|
-
chatAssistantBg: { base: 0 },
|
|
152
|
-
chatAssistantText: { base: 4 },
|
|
153
|
-
imageOverlayBg: { base: 4 },
|
|
154
|
-
imageOverlayFg: { base: 0 },
|
|
155
|
-
// Search-result <mark>: amber highlighter fill with dark text — same look as
|
|
156
|
-
// Default Dark (an amber-on-white highlight reads identically in both modes).
|
|
157
|
-
matchedKeywordBg: "oklch(.700 .158 62)",
|
|
158
|
-
matchedKeywordFg: "oklch(.300 .003 65)",
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
export const colorSchemes: Record<string, ColorScheme> = {
|
|
163
|
-
"Default Light": { ramps, map: lightMap },
|
|
164
|
-
"Default Dark": { ramps, map: darkMap },
|
|
165
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { settings } from "./settings";
|
|
3
|
-
import { tagVocabulary } from "./tag-vocabulary";
|
|
4
|
-
|
|
5
|
-
// ---------------------------------------------------------------------------
|
|
6
|
-
// Tags schema builder — governance-aware.
|
|
7
|
-
// ---------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Build the `tags` schema based on governance mode. `"strict"` tightens to a
|
|
11
|
-
* `z.enum` of every canonical id plus every alias (content still uses
|
|
12
|
-
* aliases verbatim — resolution happens at the aggregation layer, after
|
|
13
|
-
* parsing).
|
|
14
|
-
*/
|
|
15
|
-
function buildTagsSchema() {
|
|
16
|
-
const vocabularyActive =
|
|
17
|
-
settings.tagVocabulary && settings.tagGovernance === "strict";
|
|
18
|
-
if (!vocabularyActive) return z.array(z.string()).optional();
|
|
19
|
-
const allowed = new Set<string>();
|
|
20
|
-
for (const entry of tagVocabulary) {
|
|
21
|
-
allowed.add(entry.id);
|
|
22
|
-
for (const alias of entry.aliases ?? []) allowed.add(alias);
|
|
23
|
-
}
|
|
24
|
-
const allowedList = [...allowed];
|
|
25
|
-
if (allowedList.length === 0) return z.array(z.string()).optional();
|
|
26
|
-
const [first, ...rest] = allowedList;
|
|
27
|
-
return z
|
|
28
|
-
.array(z.enum([first, ...rest] as [string, ...string[]]))
|
|
29
|
-
.optional();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ---------------------------------------------------------------------------
|
|
33
|
-
// Schema builder — single source of truth for the docs frontmatter shape.
|
|
34
|
-
// ---------------------------------------------------------------------------
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Build the docs frontmatter zod schema.
|
|
38
|
-
*
|
|
39
|
-
* Returns a single `z.object(...).passthrough()` that is reused for every
|
|
40
|
-
* docs collection (default + per-locale + per-version + per-version-per-locale).
|
|
41
|
-
* The `tags` field is governance-aware: `buildTagsSchema()` returns a plain
|
|
42
|
-
* `z.array(z.string())` when governance is off, or a restricted `z.enum`
|
|
43
|
-
* when `tagGovernance: "strict"` + `tagVocabulary` is configured.
|
|
44
|
-
*
|
|
45
|
-
* `.passthrough()` keeps custom frontmatter keys (e.g. `author`, `status`)
|
|
46
|
-
* available downstream — the frontmatter-preview UI relies on this to
|
|
47
|
-
* surface arbitrary keys without declaring each one here.
|
|
48
|
-
*/
|
|
49
|
-
export function buildDocsSchema() {
|
|
50
|
-
return z
|
|
51
|
-
.object({
|
|
52
|
-
title: z.string(),
|
|
53
|
-
description: z.string().optional(),
|
|
54
|
-
category: z.string().optional(),
|
|
55
|
-
sidebar_position: z.number().optional(),
|
|
56
|
-
sidebar_label: z.string().optional(),
|
|
57
|
-
tags: buildTagsSchema(),
|
|
58
|
-
search_exclude: z.boolean().optional(),
|
|
59
|
-
pagination_next: z.string().nullable().optional(),
|
|
60
|
-
pagination_prev: z.string().nullable().optional(),
|
|
61
|
-
draft: z.boolean().optional(),
|
|
62
|
-
unlisted: z.boolean().optional(),
|
|
63
|
-
hide_sidebar: z.boolean().optional(),
|
|
64
|
-
hide_toc: z.boolean().optional(),
|
|
65
|
-
wide: z.boolean().optional(),
|
|
66
|
-
doc_history: z.boolean().optional(),
|
|
67
|
-
standalone: z.boolean().optional(),
|
|
68
|
-
slug: z.string().optional(),
|
|
69
|
-
generated: z.boolean().optional(),
|
|
70
|
-
// Category metadata expressed as a directory index.mdx's frontmatter — the
|
|
71
|
-
// frontmatter form of `_category_.json`. `category_no_page` makes the index
|
|
72
|
-
// a non-linked sidebar header excluded from routes/sitemap/search;
|
|
73
|
-
// `category_sort_order` sets the child sort direction. Frontmatter wins
|
|
74
|
-
// over the sidecar.
|
|
75
|
-
category_no_page: z.boolean().optional(),
|
|
76
|
-
category_sort_order: z.enum(["asc", "desc"]).optional(),
|
|
77
|
-
})
|
|
78
|
-
.passthrough();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
|
-
// Inferred type — single source of truth for the docs data shape.
|
|
83
|
-
// ---------------------------------------------------------------------------
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* TypeScript type inferred from the docs frontmatter zod schema.
|
|
87
|
-
*
|
|
88
|
-
* Import this type instead of hand-writing the field list in `pages/_data.ts`
|
|
89
|
-
* (`ZfbDocsData`) or `src/types/docs-entry.ts` (`DocsEntry.data`).
|
|
90
|
-
*
|
|
91
|
-
* The `[key: string]: unknown` index signature from `.passthrough()` is
|
|
92
|
-
* naturally present via `z.infer` — custom frontmatter keys remain accessible
|
|
93
|
-
* downstream (e.g. frontmatter-preview) without extra casting.
|
|
94
|
-
*/
|
|
95
|
-
export type DocsData = z.infer<ReturnType<typeof buildDocsSchema>>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Schema-managed frontmatter keys that are handled by the framework and
|
|
3
|
-
* should be hidden from the frontmatter preview by default.
|
|
4
|
-
* These correspond to every field defined in the docsSchema in src/content.config.ts.
|
|
5
|
-
*/
|
|
6
|
-
export const DEFAULT_FRONTMATTER_IGNORE_KEYS: string[] = [
|
|
7
|
-
"title",
|
|
8
|
-
"description",
|
|
9
|
-
"category",
|
|
10
|
-
"sidebar_position",
|
|
11
|
-
"sidebar_label",
|
|
12
|
-
"tags",
|
|
13
|
-
"search_exclude",
|
|
14
|
-
"pagination_next",
|
|
15
|
-
"pagination_prev",
|
|
16
|
-
"draft",
|
|
17
|
-
"unlisted",
|
|
18
|
-
"hide_sidebar",
|
|
19
|
-
"hide_toc",
|
|
20
|
-
"wide",
|
|
21
|
-
"doc_history",
|
|
22
|
-
"standalone",
|
|
23
|
-
"slug",
|
|
24
|
-
"generated",
|
|
25
|
-
"category_no_page",
|
|
26
|
-
"category_sort_order",
|
|
27
|
-
];
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
FrontmatterCellRenderer,
|
|
3
|
-
FrontmatterCellRendererProps,
|
|
4
|
-
} from "@takazudo/zudo-doc/metainfo";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Props passed to every custom frontmatter renderer component.
|
|
8
|
-
*
|
|
9
|
-
* Lookup rule: `frontmatterRenderers[key]` is checked after the ignore-list
|
|
10
|
-
* filter and after null/undefined skipping, so renderers only receive defined
|
|
11
|
-
* values and are never invoked for ignored keys.
|
|
12
|
-
*
|
|
13
|
-
* Ignore-list precedence: if a key appears in `settings.frontmatterPreview.ignoreKeys`
|
|
14
|
-
* (or the default ignore list), the row is suppressed entirely — even if a renderer
|
|
15
|
-
* is registered for that key. To reveal a framework-managed key with a custom
|
|
16
|
-
* renderer, first remove the key from the ignore list in settings.
|
|
17
|
-
*
|
|
18
|
-
* Fallback behavior: if no renderer is registered for a key, the built-in
|
|
19
|
-
* `renderValue()` path is used (string/number/boolean as text, other types as
|
|
20
|
-
* JSON in a `<code>` element).
|
|
21
|
-
*
|
|
22
|
-
* Null/undefined skipping: values of `null` or `undefined` are filtered out
|
|
23
|
-
* before renderer lookup. Renderers can assume `value` is defined.
|
|
24
|
-
*/
|
|
25
|
-
// Re-export the canonical props type from the package so project code has a
|
|
26
|
-
// single import path. The locale field is typed as string (the package uses
|
|
27
|
-
// string rather than the project-specific Locale union to avoid a circular
|
|
28
|
-
// dependency); the runtime values are identical.
|
|
29
|
-
export type { FrontmatterCellRendererProps as FrontmatterRendererProps };
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Per-key custom renderer map for the frontmatter-preview component.
|
|
33
|
-
*
|
|
34
|
-
* Add entries here to override how specific frontmatter fields are displayed.
|
|
35
|
-
* Keys must match frontmatter field names exactly (case-sensitive).
|
|
36
|
-
*
|
|
37
|
-
* Each renderer is a function `(props: FrontmatterCellRendererProps) => ComponentChildren`.
|
|
38
|
-
* Return `null` or `undefined` to fall through to the built-in `renderValue()`
|
|
39
|
-
* plain-text path.
|
|
40
|
-
*
|
|
41
|
-
* Example (add a renderer for a `status` field):
|
|
42
|
-
* ```tsx
|
|
43
|
-
* status: ({ value }) => <strong>{String(value)}</strong>,
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export const frontmatterRenderers: Record<string, FrontmatterCellRenderer> = {};
|