@takazudo/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.
- package/CHANGELOG.md +43 -0
- package/dist/chrome/derive.d.ts +7 -1
- package/dist/chrome/derive.js +13 -2
- package/dist/chrome-bindings.d.ts +159 -0
- package/dist/chrome-bindings.js +6 -0
- package/dist/code-syntax/mermaid-init-script.js +46 -1
- package/dist/color-scheme-utils.d.ts +1 -1
- package/dist/color-schemes-defaults/index.d.ts +23 -0
- package/dist/color-schemes-defaults/index.js +121 -0
- package/dist/config.d.ts +443 -0
- package/dist/config.js +116 -0
- package/dist/design-token-panel-bootstrap.d.ts +57 -7
- package/dist/design-token-panel-bootstrap.js +12 -0
- package/dist/design-token-panel-config/index.d.ts +49 -0
- package/dist/design-token-panel-config/index.js +214 -0
- package/dist/design-token-panel-config/manifest.d.ts +46 -0
- package/dist/design-token-panel-config/manifest.js +105 -0
- package/dist/directive-vocabulary-defaults/index.d.ts +16 -0
- package/dist/directive-vocabulary-defaults/index.js +12 -0
- package/dist/doc-body-end-islands/index.d.ts +30 -7
- package/dist/doc-body-end-islands/index.js +27 -0
- package/dist/docs-schema/index.d.ts +67 -0
- package/dist/docs-schema/index.js +47 -0
- package/dist/factory-context/index.d.ts +14 -0
- package/dist/features.css +10 -0
- package/dist/find-in-page/find-bar.d.ts +9 -0
- package/dist/find-in-page/find-bar.js +114 -0
- package/dist/find-in-page/find-in-page.d.ts +17 -0
- package/dist/find-in-page/find-in-page.js +131 -0
- package/dist/find-in-page/index.d.ts +11 -0
- package/dist/find-in-page/index.js +49 -0
- package/dist/frontmatter-preview-defaults/index.d.ts +16 -0
- package/dist/frontmatter-preview-defaults/index.js +25 -0
- package/dist/i18n-defaults/index.d.ts +22 -0
- package/dist/i18n-defaults/index.js +167 -0
- package/dist/plugins/routes.js +44 -20
- package/dist/preset.d.ts +12 -1
- package/dist/preset.js +2 -1
- package/dist/routes/_chrome.js +2 -1
- package/dist/safelist.css +1 -1
- package/dist/settings.d.ts +39 -0
- package/dist/theme.css +319 -0
- package/dist/z-index-defaults/index.d.ts +45 -0
- package/dist/z-index-defaults/index.js +34 -0
- package/package.json +55 -8
- package/routes-src/_chrome.tsx +30 -8
- package/routes-src/_virtual.d.ts +34 -2
- package/tsconfig.base.json +29 -0
- package/virtual-modules.d.ts +79 -0
- package/zfb-config-shim.d.ts +188 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const defaultZIndexTiers = [
|
|
2
|
+
// global — default in-flow content (implicit baseline)
|
|
3
|
+
{ name: "content", value: 0 },
|
|
4
|
+
// local — child promotion inside an isolated parent stacking context
|
|
5
|
+
{ name: "local-1", value: 1 },
|
|
6
|
+
// local — child promotion inside an isolated parent stacking context
|
|
7
|
+
{ name: "local-2", value: 2 },
|
|
8
|
+
// local — child promotion inside an isolated parent stacking context
|
|
9
|
+
{ name: "local-3", value: 3 },
|
|
10
|
+
// global — persistent layout chrome: desktop sidebar, TOC, sidebar-toggle
|
|
11
|
+
// handle, resizer handle
|
|
12
|
+
{ name: "sidebar", value: 10 },
|
|
13
|
+
// global — sticky top header (sits above sidebar chrome)
|
|
14
|
+
{ name: "toolbar", value: 20 },
|
|
15
|
+
// global — header menus, version/language switchers
|
|
16
|
+
{ name: "dropdown", value: 30 },
|
|
17
|
+
// global — reserved: inline popovers (canonical scale; not yet used)
|
|
18
|
+
{ name: "popover", value: 40 },
|
|
19
|
+
// global — mobile drawer backdrop, <dialog> ::backdrop
|
|
20
|
+
{ name: "modal-backdrop", value: 50 },
|
|
21
|
+
// global — mobile sidebar drawer panel, search <dialog>
|
|
22
|
+
{ name: "modal", value: 60 },
|
|
23
|
+
// global — reserved: transient notifications (canonical scale; not yet used)
|
|
24
|
+
{ name: "toast", value: 70 },
|
|
25
|
+
// global — reserved: highest steady UI layer, below only the transient drag
|
|
26
|
+
// tier (canonical scale; not yet used)
|
|
27
|
+
{ name: "tooltip", value: 80 },
|
|
28
|
+
// global — transient drag affordance: sidebar-resizer ghost line (replaces
|
|
29
|
+
// the z-9999 anti-pattern)
|
|
30
|
+
{ name: "drag", value: 90 }
|
|
31
|
+
];
|
|
32
|
+
export {
|
|
33
|
+
defaultZIndexTiers
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takazudo/zudo-doc",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "zudo-doc framework primitives layer that sits on top of zfb's engine — sidebar, theme, TOC, breadcrumb, layouts, head injection, View Transitions, SSR-skip wrappers (per ADR-003).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -227,15 +227,23 @@
|
|
|
227
227
|
"types": "./dist/chrome/index.d.ts",
|
|
228
228
|
"default": "./dist/chrome/index.js"
|
|
229
229
|
},
|
|
230
|
+
"./chrome-bindings": {
|
|
231
|
+
"types": "./dist/chrome-bindings.d.ts",
|
|
232
|
+
"default": "./dist/chrome-bindings.js"
|
|
233
|
+
},
|
|
230
234
|
"./home-page": {
|
|
231
235
|
"types": "./dist/home-page/index.d.ts",
|
|
232
236
|
"default": "./dist/home-page/index.js"
|
|
233
237
|
},
|
|
238
|
+
"./theme.css": "./dist/theme.css",
|
|
234
239
|
"./safelist.css": "./dist/safelist.css",
|
|
235
240
|
"./safelist": "./dist/safelist.css",
|
|
236
241
|
"./content.css": "./dist/content.css",
|
|
237
242
|
"./page-loading.css": "./dist/page-loading.css",
|
|
238
243
|
"./features.css": "./dist/features.css",
|
|
244
|
+
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
245
|
+
"./zfb-config-shim.d.ts": "./zfb-config-shim.d.ts",
|
|
246
|
+
"./virtual-modules.d.ts": "./virtual-modules.d.ts",
|
|
239
247
|
"./tags-audit": {
|
|
240
248
|
"types": "./dist/tags-audit.d.ts",
|
|
241
249
|
"default": "./dist/tags-audit.js"
|
|
@@ -248,6 +256,10 @@
|
|
|
248
256
|
"types": "./dist/design-token-panel-bootstrap.d.ts",
|
|
249
257
|
"default": "./dist/design-token-panel-bootstrap.js"
|
|
250
258
|
},
|
|
259
|
+
"./design-token-panel-config": {
|
|
260
|
+
"types": "./dist/design-token-panel-config/index.d.ts",
|
|
261
|
+
"default": "./dist/design-token-panel-config/index.js"
|
|
262
|
+
},
|
|
251
263
|
"./render-markdown": {
|
|
252
264
|
"types": "./dist/render-markdown/index.d.ts",
|
|
253
265
|
"default": "./dist/render-markdown/index.js"
|
|
@@ -316,6 +328,10 @@
|
|
|
316
328
|
"types": "./dist/ai-chat-modal/index.d.ts",
|
|
317
329
|
"default": "./dist/ai-chat-modal/index.js"
|
|
318
330
|
},
|
|
331
|
+
"./find-in-page": {
|
|
332
|
+
"types": "./dist/find-in-page/index.d.ts",
|
|
333
|
+
"default": "./dist/find-in-page/index.js"
|
|
334
|
+
},
|
|
319
335
|
"./doc-history": {
|
|
320
336
|
"types": "./dist/doc-history/index.d.ts",
|
|
321
337
|
"default": "./dist/doc-history/index.js"
|
|
@@ -531,6 +547,34 @@
|
|
|
531
547
|
"./sidebar-active-slug": {
|
|
532
548
|
"types": "./dist/sidebar-active-slug/index.d.ts",
|
|
533
549
|
"default": "./dist/sidebar-active-slug/index.js"
|
|
550
|
+
},
|
|
551
|
+
"./i18n-defaults": {
|
|
552
|
+
"types": "./dist/i18n-defaults/index.d.ts",
|
|
553
|
+
"default": "./dist/i18n-defaults/index.js"
|
|
554
|
+
},
|
|
555
|
+
"./color-schemes-defaults": {
|
|
556
|
+
"types": "./dist/color-schemes-defaults/index.d.ts",
|
|
557
|
+
"default": "./dist/color-schemes-defaults/index.js"
|
|
558
|
+
},
|
|
559
|
+
"./docs-schema": {
|
|
560
|
+
"types": "./dist/docs-schema/index.d.ts",
|
|
561
|
+
"default": "./dist/docs-schema/index.js"
|
|
562
|
+
},
|
|
563
|
+
"./z-index-defaults": {
|
|
564
|
+
"types": "./dist/z-index-defaults/index.d.ts",
|
|
565
|
+
"default": "./dist/z-index-defaults/index.js"
|
|
566
|
+
},
|
|
567
|
+
"./frontmatter-preview-defaults": {
|
|
568
|
+
"types": "./dist/frontmatter-preview-defaults/index.d.ts",
|
|
569
|
+
"default": "./dist/frontmatter-preview-defaults/index.js"
|
|
570
|
+
},
|
|
571
|
+
"./directive-vocabulary-defaults": {
|
|
572
|
+
"types": "./dist/directive-vocabulary-defaults/index.d.ts",
|
|
573
|
+
"default": "./dist/directive-vocabulary-defaults/index.js"
|
|
574
|
+
},
|
|
575
|
+
"./config": {
|
|
576
|
+
"types": "./dist/config.d.ts",
|
|
577
|
+
"default": "./dist/config.js"
|
|
534
578
|
}
|
|
535
579
|
},
|
|
536
580
|
"bin": {
|
|
@@ -544,15 +588,18 @@
|
|
|
544
588
|
"bin",
|
|
545
589
|
"eject",
|
|
546
590
|
"routes-src",
|
|
591
|
+
"tsconfig.base.json",
|
|
592
|
+
"zfb-config-shim.d.ts",
|
|
593
|
+
"virtual-modules.d.ts",
|
|
547
594
|
"README.md",
|
|
548
595
|
"CHANGELOG.md"
|
|
549
596
|
],
|
|
550
597
|
"peerDependencies": {
|
|
551
598
|
"preact": "^10.29.1",
|
|
552
|
-
"@takazudo/zfb": "^0.1.0-next.
|
|
553
|
-
"@takazudo/zfb-runtime": "^0.1.0-next.
|
|
554
|
-
"@takazudo/zudo-doc-history-server": "^3.
|
|
555
|
-
"@takazudo/zdtp": "^0.4.
|
|
599
|
+
"@takazudo/zfb": "^0.1.0-next.78",
|
|
600
|
+
"@takazudo/zfb-runtime": "^0.1.0-next.78",
|
|
601
|
+
"@takazudo/zudo-doc-history-server": "^3.1.0",
|
|
602
|
+
"@takazudo/zdtp": "^0.4.6",
|
|
556
603
|
"shiki": "^4.0.2",
|
|
557
604
|
"zod": "^4.3.6",
|
|
558
605
|
"katex": "^0.16.0",
|
|
@@ -593,9 +640,9 @@
|
|
|
593
640
|
"typescript": "^5.0.0",
|
|
594
641
|
"vitest": "^4.1.0",
|
|
595
642
|
"zod": "^4.3.6",
|
|
596
|
-
"@takazudo/zfb": "0.1.0-next.
|
|
597
|
-
"@takazudo/zfb-runtime": "0.1.0-next.
|
|
598
|
-
"@takazudo/zudo-doc-history-server": "3.
|
|
643
|
+
"@takazudo/zfb": "0.1.0-next.78",
|
|
644
|
+
"@takazudo/zfb-runtime": "0.1.0-next.78",
|
|
645
|
+
"@takazudo/zudo-doc-history-server": "3.3.0"
|
|
599
646
|
},
|
|
600
647
|
"scripts": {
|
|
601
648
|
"build": "tsup && tsc -p tsconfig.build.json",
|
package/routes-src/_chrome.tsx
CHANGED
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
import { routeCtx } from "./_context.js";
|
|
14
14
|
import { createChrome } from "@takazudo/zudo-doc/chrome";
|
|
15
15
|
import { DocHistory } from "@takazudo/zudo-doc/doc-history";
|
|
16
|
-
import type { ChromeHostBindings } from "@takazudo/zudo-doc/factory-context";
|
|
17
16
|
import type { DocNavNode } from "./_docs-helpers.js";
|
|
17
|
+
// Imported via the BARE published subpath rather than a relative
|
|
18
|
+
// `../chrome-bindings.js`. This file is copied into consumer projects by the
|
|
19
|
+
// routes-src mechanism (`scripts/copy-routes-src.mjs`), which rewrites relative
|
|
20
|
+
// `../` imports to `@takazudo/zudo-doc/*` specifiers so the copy resolves
|
|
21
|
+
// against this package's `dist/`. Writing the bare specifier here directly
|
|
22
|
+
// keeps the source identical to that rewritten output.
|
|
23
|
+
import { defineChromeBindings } from "@takazudo/zudo-doc/chrome-bindings";
|
|
18
24
|
// Host-callables channel (#2501): re-exports `settings.chromeBindingsModule`
|
|
19
25
|
// when the host configured one, else `{}` — see
|
|
20
26
|
// `plugins/routes.ts` and `docs/adr/route-injection-seam.md`
|
|
@@ -31,19 +37,35 @@ import { chromeBindings } from "virtual:zudo-doc-chrome-bindings";
|
|
|
31
37
|
// The import MUST stay static — a dynamic/type-only import stops zfb's island
|
|
32
38
|
// scanner from walking it. SSR output is unchanged: `DocHistoryArea` gates on
|
|
33
39
|
// `settings.docHistory` and the island is skip-SSR, so binding the real component
|
|
34
|
-
// vs the stub is byte-identical. Mirrors the host's `
|
|
40
|
+
// vs the stub is byte-identical. Mirrors the host's `src/chrome-bindings.tsx`.
|
|
35
41
|
// (The narrow real-island props signature isn't assignable to the structural
|
|
36
|
-
// `FactoryComponent`, so
|
|
42
|
+
// `FactoryComponent`, so it's widened through `defineChromeBindings` — same
|
|
43
|
+
// helper the host uses — which checks `DocHistory` against its real call-side
|
|
44
|
+
// prop contract before performing the widening, restoring the #2674
|
|
45
|
+
// drift-detection check a bare cast would erase.)
|
|
37
46
|
//
|
|
38
|
-
// `...chromeBindings` is spread AFTER the `DocHistory`
|
|
39
|
-
// configured `chromeBindingsModule` can override ANY
|
|
40
|
-
// DocHistory itself — while a host that didn't still gets
|
|
41
|
-
// free.
|
|
47
|
+
// `...chromeBindings` is spread AFTER the `defineChromeBindings({ DocHistory })`
|
|
48
|
+
// result so a host that configured `chromeBindingsModule` can override ANY
|
|
49
|
+
// slot — including DocHistory itself — while a host that didn't still gets
|
|
50
|
+
// the #2480 fix for free. `chromeBindings` (the virtual re-export) is already
|
|
51
|
+
// erased to the structural `ChromeHostBindings` at its own source, so it is
|
|
52
|
+
// spread as-is rather than run back through `defineChromeBindings` (which
|
|
53
|
+
// cannot recover types `defineChromeBindings` never checked in the first
|
|
54
|
+
// place). Note the SSR-presentational-only limitation: a client island defined
|
|
42
55
|
// INSIDE the bindings module is not guaranteed to register on injected routes
|
|
43
56
|
// the way the static `DocHistory` import above is (the virtual re-export sits
|
|
44
57
|
// outside zfb's static-import scanner reachability graph) — see the ADR.
|
|
58
|
+
//
|
|
59
|
+
// `DesignTokenPanelBootstrap` (#2658) is NOT threaded here: unlike DocHistory
|
|
60
|
+
// (whose derive-level default is a no-op stub), the package-default island IS
|
|
61
|
+
// the derive-level default (`chrome/derive.tsx`'s `deriveBodyEndIslands`,
|
|
62
|
+
// gate-2 fix from the Wave-5 confirm #2659) — so this shim, the locked-manifest
|
|
63
|
+
// self-contained doc stub (#2653), and every other bare `createChrome` caller
|
|
64
|
+
// all get it without explicit wiring. Scanner reachability holds through the
|
|
65
|
+
// static chain route → this shim → `createChrome` → `chrome/derive` →
|
|
66
|
+
// `design-token-panel-bootstrap`.
|
|
45
67
|
const chrome = createChrome(routeCtx, {
|
|
46
|
-
|
|
68
|
+
...defineChromeBindings({ DocHistory }),
|
|
47
69
|
...chromeBindings,
|
|
48
70
|
});
|
|
49
71
|
|
package/routes-src/_virtual.d.ts
CHANGED
|
@@ -6,6 +6,20 @@
|
|
|
6
6
|
// The payload is SERIALIZABLE DATA ONLY (ADR Decision 1): `settings`,
|
|
7
7
|
// `translations`, `tagVocabulary`, `colorSchemes`. `_context.ts` narrows it
|
|
8
8
|
// to the concrete `RouteContextPayload` at the seam.
|
|
9
|
+
//
|
|
10
|
+
// SINGLE SOURCE OF TRUTH for three shipped copies (#2656) — edit HERE only:
|
|
11
|
+
// 1. This file itself — typechecks the package's own `src/routes/*.tsx`.
|
|
12
|
+
// 2. `routes-src/_virtual.d.ts` — copied by `scripts/copy-routes-src.mjs`
|
|
13
|
+
// for downstream `packageOwnedRoutes` consumers.
|
|
14
|
+
// 3. `<package root>/virtual-modules.d.ts` — GENERATED by
|
|
15
|
+
// `scripts/copy-virtual-modules.mjs` (tsup onSuccess; gitignored like
|
|
16
|
+
// `routes-src/`), shipped via `tsconfig.base.json`'s `files` so a HOST
|
|
17
|
+
// project that imports these virtual modules directly (e.g. a `pages/`
|
|
18
|
+
// re-export stub calling `createRouteContext(routeContext)`) typechecks.
|
|
19
|
+
// Both copy steps rewrite parent-relative `import(...)` specifiers to bare
|
|
20
|
+
// `@takazudo/zudo-doc/*` subpaths, so the relative specifier below stays
|
|
21
|
+
// correct here while the shipped copies resolve from a consumer's
|
|
22
|
+
// node_modules.
|
|
9
23
|
declare module "virtual:zudo-doc-route-context" {
|
|
10
24
|
export const routeContext: {
|
|
11
25
|
settings: unknown;
|
|
@@ -27,8 +41,26 @@ declare module "virtual:zudo-doc-route-context" {
|
|
|
27
41
|
// chromeBindingsModule").
|
|
28
42
|
//
|
|
29
43
|
// Typed via an INLINE `import(...)` type (not a top-level import, which would
|
|
30
|
-
// break this file's ambient module declarations) — see
|
|
31
|
-
//
|
|
44
|
+
// break this file's ambient module declarations) — see the package's
|
|
45
|
+
// factory-context module (`src/factory-context/index.ts`) for the
|
|
46
|
+
// `ChromeHostBindings` shape.
|
|
32
47
|
declare module "virtual:zudo-doc-chrome-bindings" {
|
|
33
48
|
export const chromeBindings: import("@takazudo/zudo-doc/factory-context").ChromeHostBindings;
|
|
34
49
|
}
|
|
50
|
+
|
|
51
|
+
// Ambient typing for the design-token-panel-config virtual module emitted by
|
|
52
|
+
// the routes plugin (`addVirtualModule("virtual:zudo-doc-design-token-panel-config",
|
|
53
|
+
// …)`, #2658). No on-disk source — materialised at build, either as a
|
|
54
|
+
// re-export of the host's `settings.designTokenPanelConfigModule` file or as
|
|
55
|
+
// a re-export of the package default (`@takazudo/zudo-doc/design-token-panel-config`)
|
|
56
|
+
// when the setting is absent. See `plugins/routes.ts` and this package's
|
|
57
|
+
// `design-token-panel-bootstrap.tsx` for the full contract.
|
|
58
|
+
//
|
|
59
|
+
// Typed via an inline `import(...)` type (not a top-level import, for the
|
|
60
|
+
// same ambient-module-declaration reason as `chromeBindings` above) — see
|
|
61
|
+
// `@takazudo/zdtp`'s `PanelConfig`.
|
|
62
|
+
declare module "virtual:zudo-doc-design-token-panel-config" {
|
|
63
|
+
export const buildDesignTokenPanelConfig: (
|
|
64
|
+
mode: "light" | "dark",
|
|
65
|
+
) => import("@takazudo/zdtp").PanelConfig;
|
|
66
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"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
|
+
"baseUrl": "."
|
|
27
|
+
},
|
|
28
|
+
"files": ["./zfb-config-shim.d.ts", "./virtual-modules.d.ts"]
|
|
29
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// GENERATED FILE — DO NOT EDIT.
|
|
2
|
+
// Built from src/routes/_virtual.d.ts by scripts/copy-virtual-modules.mjs
|
|
3
|
+
// (tsup onSuccess), with parent-relative import(...) type specifiers
|
|
4
|
+
// rewritten to bare @takazudo/zudo-doc/* subpaths. Edit the source file and
|
|
5
|
+
// rebuild the package (pnpm --filter @takazudo/zudo-doc build) instead.
|
|
6
|
+
//
|
|
7
|
+
// Host-facing: pulled into consumer projects via tsconfig.base.json's
|
|
8
|
+
// top-level "files" so host code importing the zfb virtual modules
|
|
9
|
+
// (virtual:zudo-doc-route-context / virtual:zudo-doc-chrome-bindings)
|
|
10
|
+
// typechecks. Consumer-level regression proof (tsc/zfb check against a
|
|
11
|
+
// fixture extending tsconfig.base.json) lives in the Wave-5 confirm case
|
|
12
|
+
// (zudolab/zudo-doc#2659).
|
|
13
|
+
|
|
14
|
+
// Ambient typing for the route-context virtual module emitted by the routes
|
|
15
|
+
// plugin (`addVirtualModule("virtual:zudo-doc-route-context", …)`). The module
|
|
16
|
+
// has no on-disk source — it is materialised at build by the zfb plugin runtime
|
|
17
|
+
// — so this declaration gives the package route entrypoints a typed import.
|
|
18
|
+
//
|
|
19
|
+
// The payload is SERIALIZABLE DATA ONLY (ADR Decision 1): `settings`,
|
|
20
|
+
// `translations`, `tagVocabulary`, `colorSchemes`. `_context.ts` narrows it
|
|
21
|
+
// to the concrete `RouteContextPayload` at the seam.
|
|
22
|
+
//
|
|
23
|
+
// SINGLE SOURCE OF TRUTH for three shipped copies (#2656) — edit HERE only:
|
|
24
|
+
// 1. This file itself — typechecks the package's own `src/routes/*.tsx`.
|
|
25
|
+
// 2. `routes-src/_virtual.d.ts` — copied by `scripts/copy-routes-src.mjs`
|
|
26
|
+
// for downstream `packageOwnedRoutes` consumers.
|
|
27
|
+
// 3. `<package root>/virtual-modules.d.ts` — GENERATED by
|
|
28
|
+
// `scripts/copy-virtual-modules.mjs` (tsup onSuccess; gitignored like
|
|
29
|
+
// `routes-src/`), shipped via `tsconfig.base.json`'s `files` so a HOST
|
|
30
|
+
// project that imports these virtual modules directly (e.g. a `pages/`
|
|
31
|
+
// re-export stub calling `createRouteContext(routeContext)`) typechecks.
|
|
32
|
+
// Both copy steps rewrite parent-relative `import(...)` specifiers to bare
|
|
33
|
+
// `@takazudo/zudo-doc/*` subpaths, so the relative specifier below stays
|
|
34
|
+
// correct here while the shipped copies resolve from a consumer's
|
|
35
|
+
// node_modules.
|
|
36
|
+
declare module "virtual:zudo-doc-route-context" {
|
|
37
|
+
export const routeContext: {
|
|
38
|
+
settings: unknown;
|
|
39
|
+
translations: Record<string, Record<string, string>>;
|
|
40
|
+
tagVocabulary: ReadonlyArray<Record<string, unknown>>;
|
|
41
|
+
/** Host color-scheme palette map. `null` when the caller did not pass
|
|
42
|
+
* `colorSchemes` to `zudoDocPreset` — `_chrome.tsx` falls back to
|
|
43
|
+
* `DEFAULT_SCHEME` in that case. */
|
|
44
|
+
colorSchemes: Record<string, unknown> | null;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Ambient typing for the chrome-bindings virtual module emitted by the routes
|
|
49
|
+
// plugin (`addVirtualModule("virtual:zudo-doc-chrome-bindings", …)`, #2501).
|
|
50
|
+
// No on-disk source — materialised at build, either as a re-export of the
|
|
51
|
+
// host's `settings.chromeBindingsModule` file or as an empty-object fallback
|
|
52
|
+
// when the setting is absent. See `plugins/routes.ts` and
|
|
53
|
+
// `docs/adr/route-injection-seam.md` ("Host-callables channel —
|
|
54
|
+
// chromeBindingsModule").
|
|
55
|
+
//
|
|
56
|
+
// Typed via an INLINE `import(...)` type (not a top-level import, which would
|
|
57
|
+
// break this file's ambient module declarations) — see the package's
|
|
58
|
+
// factory-context module (`src/factory-context/index.ts`) for the
|
|
59
|
+
// `ChromeHostBindings` shape.
|
|
60
|
+
declare module "virtual:zudo-doc-chrome-bindings" {
|
|
61
|
+
export const chromeBindings: import("@takazudo/zudo-doc/factory-context").ChromeHostBindings;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Ambient typing for the design-token-panel-config virtual module emitted by
|
|
65
|
+
// the routes plugin (`addVirtualModule("virtual:zudo-doc-design-token-panel-config",
|
|
66
|
+
// …)`, #2658). No on-disk source — materialised at build, either as a
|
|
67
|
+
// re-export of the host's `settings.designTokenPanelConfigModule` file or as
|
|
68
|
+
// a re-export of the package default (`@takazudo/zudo-doc/design-token-panel-config`)
|
|
69
|
+
// when the setting is absent. See `plugins/routes.ts` and this package's
|
|
70
|
+
// `design-token-panel-bootstrap.tsx` for the full contract.
|
|
71
|
+
//
|
|
72
|
+
// Typed via an inline `import(...)` type (not a top-level import, for the
|
|
73
|
+
// same ambient-module-declaration reason as `chromeBindings` above) — see
|
|
74
|
+
// `@takazudo/zdtp`'s `PanelConfig`.
|
|
75
|
+
declare module "virtual:zudo-doc-design-token-panel-config" {
|
|
76
|
+
export const buildDesignTokenPanelConfig: (
|
|
77
|
+
mode: "light" | "dark",
|
|
78
|
+
) => import("@takazudo/zdtp").PanelConfig;
|
|
79
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
// Package-shipped type shim for the bare `zfb/config` specifier (#2656).
|
|
2
|
+
//
|
|
3
|
+
// `@takazudo/zfb` is consumed as a published npm package. The package
|
|
4
|
+
// exposes its real config types under the *scoped* subpath
|
|
5
|
+
// `@takazudo/zfb/config` → `dist/config.d.ts`. But `zfb.config.ts` imports
|
|
6
|
+
// from the *bare* specifier `zfb/config`, which zfb's build tool aliases to
|
|
7
|
+
// a runtime-only stub at parse time (`zfb-config-stub.mjs` — `defineConfig`
|
|
8
|
+
// is identity, carrying no types). No real file backs `zfb/config` in
|
|
9
|
+
// `node_modules`, so this ambient declaration is what supplies the
|
|
10
|
+
// `ZfbConfig` type to `zfb.config.ts`.
|
|
11
|
+
//
|
|
12
|
+
// Pulled into a consuming project via `tsconfig.base.json`'s
|
|
13
|
+
// `files: ["./zfb-config-shim.d.ts", "./virtual-modules.d.ts"]` — a project
|
|
14
|
+
// extending the base no longer needs its own local `zfb-shim.d.ts`.
|
|
15
|
+
//
|
|
16
|
+
// IMPORTANT — this block is the source of truth for the type `zfb check`
|
|
17
|
+
// (plain `tsc --noEmit`) binds against the config. An ambient `declare
|
|
18
|
+
// module` wins over node resolution AND over tsconfig `paths`, so it must
|
|
19
|
+
// be kept in sync BY HAND with the published `@takazudo/zfb/config`
|
|
20
|
+
// (`dist/config.d.ts`). When it lags the engine, valid config fields fail
|
|
21
|
+
// `pnpm check` with TS2353 (see Takazudo/zudo-front-builder#678 +
|
|
22
|
+
// zudolab/zudo-doc#1834 — `bundle` was missing here, blocking next.22's
|
|
23
|
+
// `bundle.exclude`). See `packages/zudo-doc/CLAUDE.md` ("Shipped ambient
|
|
24
|
+
// type shims") for the hand-sync duty this file carries.
|
|
25
|
+
|
|
26
|
+
declare module "zfb/config" {
|
|
27
|
+
/** JSX framework runtime. */
|
|
28
|
+
export type Framework = "preact" | "react";
|
|
29
|
+
|
|
30
|
+
/** A content collection registered with the zfb engine. */
|
|
31
|
+
export interface CollectionDef {
|
|
32
|
+
/** Identifier used at the call site (e.g. `"docs"`). */
|
|
33
|
+
name: string;
|
|
34
|
+
/** Directory (relative to the project root) holding the entries. */
|
|
35
|
+
path: string;
|
|
36
|
+
/**
|
|
37
|
+
* Optional schema. Reserved for v1.1 — accepted but not enforced
|
|
38
|
+
* today. Authored as zod and converted to JSON Schema via
|
|
39
|
+
* `z.toJSONSchema()` at the boundary.
|
|
40
|
+
*/
|
|
41
|
+
schema?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Tailwind options; absent = defaults. */
|
|
45
|
+
export interface TailwindConfig {
|
|
46
|
+
enabled?: boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** User-supplied plugin configuration entry. */
|
|
50
|
+
export interface PluginConfig {
|
|
51
|
+
name: string;
|
|
52
|
+
options?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Bundler options. Mirrors `BundleConfig` in crates/zfb/src/config.rs
|
|
57
|
+
* and the published `@takazudo/zfb/config` (`dist/config.d.ts`). Added
|
|
58
|
+
* in next.22 (`bundle.exclude`, #664) and extended in next.23
|
|
59
|
+
* (`mainFields` / `external`, #676).
|
|
60
|
+
*/
|
|
61
|
+
export interface BundleConfig {
|
|
62
|
+
/**
|
|
63
|
+
* Project-relative, gitignore-style globs for source files the bundler
|
|
64
|
+
* must NOT pull into the esbuild graph (e.g. test fixtures or
|
|
65
|
+
* `*.stories.tsx`). Matched files are skipped from the shadow-tree walk
|
|
66
|
+
* and dropped from any eager `import.meta.glob(...)` expansion.
|
|
67
|
+
*/
|
|
68
|
+
exclude?: string[];
|
|
69
|
+
/**
|
|
70
|
+
* Explicit esbuild `main-fields` for the `--platform=neutral` page/SSR
|
|
71
|
+
* pass (empty by default under `neutral`), letting CJS-`main`-only deps
|
|
72
|
+
* resolve. Mirrors `BundleConfig::main_fields`.
|
|
73
|
+
*/
|
|
74
|
+
mainFields?: string[];
|
|
75
|
+
/**
|
|
76
|
+
* Bare specifiers to mark external in the `--platform=neutral` pass so
|
|
77
|
+
* esbuild leaves them unbundled. Mirrors `BundleConfig::external`.
|
|
78
|
+
*/
|
|
79
|
+
external?: string[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/** Mirrors the Rust `Config` struct one-for-one. */
|
|
83
|
+
export interface ZfbConfig {
|
|
84
|
+
outDir?: string;
|
|
85
|
+
publicDir?: string;
|
|
86
|
+
host?: string;
|
|
87
|
+
port?: number;
|
|
88
|
+
framework?: Framework;
|
|
89
|
+
collections?: CollectionDef[];
|
|
90
|
+
tailwind?: TailwindConfig;
|
|
91
|
+
/**
|
|
92
|
+
* Bundler options. `bundle.exclude` keeps project-relative globs out of
|
|
93
|
+
* the esbuild graph — used e.g. to skip `e2e/fixtures/**` so the MDX link
|
|
94
|
+
* resolver doesn't walk committed test-fixture trees (silences spurious
|
|
95
|
+
* broken-link warnings). Mirrors `Config::bundle`.
|
|
96
|
+
*/
|
|
97
|
+
bundle?: BundleConfig;
|
|
98
|
+
plugins?: PluginConfig[];
|
|
99
|
+
adapter?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Strip `.md` / `.mdx` from in-page `<a href>` paths and append a
|
|
102
|
+
* trailing `/` so author-written `[label](other.mdx)` references
|
|
103
|
+
* resolve to the rendered route URL. Mirrors Config::strip_md_ext
|
|
104
|
+
* in crates/zfb/src/config.rs (zudolab/zfb#131).
|
|
105
|
+
*/
|
|
106
|
+
stripMdExt?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Site base path. Prefixed onto stable HTML asset URLs (CSS / JS
|
|
109
|
+
* `<link>` and `<script>` tags). Normalised to start AND end with
|
|
110
|
+
* `/`; `undefined` / `""` / `"/"` all behave identically (no
|
|
111
|
+
* prefix). Mirrors Config::base in crates/zfb/src/config.rs
|
|
112
|
+
* (Takazudo/zudo-front-builder#154).
|
|
113
|
+
*/
|
|
114
|
+
base?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Configures the syntect-based syntax highlighter shipped with zfb.
|
|
117
|
+
* Mirrors `CodeHighlightConfig` / `code_highlight` in crates/zfb/src/config.rs
|
|
118
|
+
* (single-theme: Takazudo/zudo-front-builder#188 / sub #194, commit 339e30f;
|
|
119
|
+
* dual-theme themeLight/themeDark added in the follow-up shipped in
|
|
120
|
+
* zfb 0.1.0-next.45+).
|
|
121
|
+
* When omitted, the engine falls back to the hardcoded default theme `base16-ocean.dark`.
|
|
122
|
+
*
|
|
123
|
+
* Single-theme mode: set `theme` — tokens get inline `style="color:#hex"`.
|
|
124
|
+
* Dual-theme mode: set BOTH `themeLight` and `themeDark` (mutually exclusive
|
|
125
|
+
* with `theme`) — tokens get `--shiki-light`/`--shiki-dark` CSS custom
|
|
126
|
+
* properties and the `<pre>` gains `class="syntect-dual"` + `--shiki-*-bg`.
|
|
127
|
+
* All names are SYNTECT theme names, not Shiki names.
|
|
128
|
+
*/
|
|
129
|
+
codeHighlight?: {
|
|
130
|
+
theme?: string;
|
|
131
|
+
themesDir?: string;
|
|
132
|
+
themeLight?: string;
|
|
133
|
+
themeDark?: string;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Markdown link resolver (port of `remarkResolveMarkdownLinks`).
|
|
137
|
+
* Mirrors `Config::resolve_markdown_links` in crates/zfb/src/config.rs
|
|
138
|
+
* (Takazudo/zudo-front-builder PR #234 / zudolab/zudo-doc#1577).
|
|
139
|
+
* When `enabled: true`, the build appends `ResolveLinksPlugin` to the
|
|
140
|
+
* mdast pipeline so author-written `[label](./other.mdx)` links are
|
|
141
|
+
* rewritten to the corresponding rendered route URL — bypassing the
|
|
142
|
+
* file→directory transformation that breaks relative paths in dist
|
|
143
|
+
* HTML when `foo.mdx` becomes `foo/index.html`.
|
|
144
|
+
*/
|
|
145
|
+
resolveMarkdownLinks?: {
|
|
146
|
+
enabled?: boolean;
|
|
147
|
+
docsDir?: string;
|
|
148
|
+
dirs?: Array<{ dir: string; routePrefix: string }>;
|
|
149
|
+
onBrokenLinks?: "warn" | "error" | "ignore";
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* Whether the basePath rewriter should append a trailing `/` to
|
|
153
|
+
* extensionless absolute hrefs. Mirrors `Config::trailing_slash` in
|
|
154
|
+
* crates/zfb/src/config.rs (Takazudo/zudo-front-builder PR #234 /
|
|
155
|
+
* zudolab/zudo-doc#1579). Off by default — preserves byte-for-byte
|
|
156
|
+
* parity with the pre-`trailingSlash` build for projects that
|
|
157
|
+
* haven't opted in.
|
|
158
|
+
*/
|
|
159
|
+
trailingSlash?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Minify production HTML output from `zfb build`.
|
|
162
|
+
* Mirrors `Config::minify_html` in crates/zfb/src/config.rs.
|
|
163
|
+
*/
|
|
164
|
+
minifyHtml?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Markdown / MDX pipeline options. Mirrors `Config::markdown` →
|
|
167
|
+
* `MarkdownConfig` in crates/zfb/src/config.rs. zfb next.12 moved the
|
|
168
|
+
* former-Core features under `markdown.features` and next.13 ships the
|
|
169
|
+
* rest as opt-in; zudo-doc uses `markdown.features` to opt back into the
|
|
170
|
+
* former-Core four plus the additional opt-in features (#1804). Each
|
|
171
|
+
* `features` value is per-feature: `true` for boolean-shorthand features,
|
|
172
|
+
* or an options object for object-typed features.
|
|
173
|
+
*/
|
|
174
|
+
markdown?: {
|
|
175
|
+
gfm?: boolean | Record<string, boolean>;
|
|
176
|
+
toc?: Record<string, unknown>;
|
|
177
|
+
externalLinks?: Record<string, unknown>;
|
|
178
|
+
cjkFriendly?: boolean;
|
|
179
|
+
features?: Record<string, boolean | Record<string, unknown>>;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Identity helper: returns the supplied config as-is, but typed
|
|
185
|
+
* against `ZfbConfig`. Use as the default export of `zfb.config.ts`.
|
|
186
|
+
*/
|
|
187
|
+
export function defineConfig(config: ZfbConfig): ZfbConfig;
|
|
188
|
+
}
|