@takazudo/zudo-doc 0.1.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/LICENSE +21 -0
- package/README.md +18 -0
- package/dist/body-foot-util/body-foot-util-area.d.ts +55 -0
- package/dist/body-foot-util/body-foot-util-area.js +71 -0
- package/dist/body-foot-util/edit-link.d.ts +45 -0
- package/dist/body-foot-util/edit-link.js +42 -0
- package/dist/body-foot-util/index.d.ts +3 -0
- package/dist/body-foot-util/index.js +11 -0
- package/dist/breadcrumb/breadcrumb.d.ts +57 -0
- package/dist/breadcrumb/breadcrumb.js +113 -0
- package/dist/breadcrumb/find-path.d.ts +16 -0
- package/dist/breadcrumb/find-path.js +13 -0
- package/dist/breadcrumb/index.d.ts +4 -0
- package/dist/breadcrumb/index.js +7 -0
- package/dist/breadcrumb/types.d.ts +32 -0
- package/dist/breadcrumb/types.js +0 -0
- package/dist/code-syntax/code-block-enhancer-script.d.ts +3 -0
- package/dist/code-syntax/code-block-enhancer-script.js +165 -0
- package/dist/code-syntax/code-block-enhancer.d.ts +22 -0
- package/dist/code-syntax/code-block-enhancer.js +13 -0
- package/dist/code-syntax/index.d.ts +8 -0
- package/dist/code-syntax/index.js +29 -0
- package/dist/code-syntax/mermaid-init-script.d.ts +51 -0
- package/dist/code-syntax/mermaid-init-script.js +225 -0
- package/dist/code-syntax/mermaid-init.d.ts +48 -0
- package/dist/code-syntax/mermaid-init.js +14 -0
- package/dist/code-syntax/tabs-init-script.d.ts +3 -0
- package/dist/code-syntax/tabs-init-script.js +106 -0
- package/dist/code-syntax/tabs-init.d.ts +24 -0
- package/dist/code-syntax/tabs-init.js +10 -0
- package/dist/code-syntax/tabs.d.ts +36 -0
- package/dist/code-syntax/tabs.js +62 -0
- package/dist/content/component-map.d.ts +51 -0
- package/dist/content/component-map.js +29 -0
- package/dist/content/content-blockquote.d.ts +11 -0
- package/dist/content/content-blockquote.js +14 -0
- package/dist/content/content-code.d.ts +26 -0
- package/dist/content/content-code.js +39 -0
- package/dist/content/content-link.d.ts +12 -0
- package/dist/content/content-link.js +43 -0
- package/dist/content/content-ol.d.ts +11 -0
- package/dist/content/content-ol.js +15 -0
- package/dist/content/content-paragraph.d.ts +10 -0
- package/dist/content/content-paragraph.js +7 -0
- package/dist/content/content-strong.d.ts +11 -0
- package/dist/content/content-strong.js +14 -0
- package/dist/content/content-table.d.ts +11 -0
- package/dist/content/content-table.js +14 -0
- package/dist/content/content-ul.d.ts +11 -0
- package/dist/content/content-ul.js +15 -0
- package/dist/content/heading-h2.d.ts +14 -0
- package/dist/content/heading-h2.js +18 -0
- package/dist/content/heading-h3.d.ts +14 -0
- package/dist/content/heading-h3.js +18 -0
- package/dist/content/heading-h4.d.ts +14 -0
- package/dist/content/heading-h4.js +18 -0
- package/dist/content/index.d.ts +13 -0
- package/dist/content/index.js +27 -0
- package/dist/details/details.d.ts +26 -0
- package/dist/details/details.js +10 -0
- package/dist/details/index.d.ts +2 -0
- package/dist/details/index.js +4 -0
- package/dist/doclayout/anchors.d.ts +55 -0
- package/dist/doclayout/anchors.js +42 -0
- package/dist/doclayout/doc-layout-with-defaults.d.ts +83 -0
- package/dist/doclayout/doc-layout-with-defaults.js +159 -0
- package/dist/doclayout/doc-layout.d.ts +121 -0
- package/dist/doclayout/doc-layout.js +89 -0
- package/dist/doclayout/index.d.ts +6 -0
- package/dist/doclayout/index.js +17 -0
- package/dist/footer/footer.d.ts +42 -0
- package/dist/footer/footer.js +79 -0
- package/dist/footer/index.d.ts +3 -0
- package/dist/footer/index.js +4 -0
- package/dist/footer/types.d.ts +58 -0
- package/dist/footer/types.js +0 -0
- package/dist/head/doc-head.d.ts +33 -0
- package/dist/head/doc-head.js +90 -0
- package/dist/head/index.d.ts +5 -0
- package/dist/head/index.js +8 -0
- package/dist/head/og-tags.d.ts +25 -0
- package/dist/head/og-tags.js +16 -0
- package/dist/head/twitter-card.d.ts +21 -0
- package/dist/head/twitter-card.js +14 -0
- package/dist/head/types.d.ts +83 -0
- package/dist/head/types.js +0 -0
- package/dist/header/header.d.ts +158 -0
- package/dist/header/header.js +367 -0
- package/dist/header/index.d.ts +6 -0
- package/dist/header/index.js +18 -0
- package/dist/header/nav-active.d.ts +39 -0
- package/dist/header/nav-active.js +24 -0
- package/dist/header/nav-overflow-script.d.ts +3 -0
- package/dist/header/nav-overflow-script.js +169 -0
- package/dist/header/right-items.d.ts +38 -0
- package/dist/header/right-items.js +30 -0
- package/dist/header/types.d.ts +40 -0
- package/dist/header/types.js +0 -0
- package/dist/html-preview-wrapper/dedent.d.ts +10 -0
- package/dist/html-preview-wrapper/dedent.js +16 -0
- package/dist/html-preview-wrapper/highlighted-code.d.ts +18 -0
- package/dist/html-preview-wrapper/highlighted-code.js +53 -0
- package/dist/html-preview-wrapper/html-preview-wrapper.d.ts +60 -0
- package/dist/html-preview-wrapper/html-preview-wrapper.js +36 -0
- package/dist/html-preview-wrapper/html-preview.d.ts +35 -0
- package/dist/html-preview-wrapper/html-preview.js +75 -0
- package/dist/html-preview-wrapper/index.d.ts +5 -0
- package/dist/html-preview-wrapper/index.js +12 -0
- package/dist/html-preview-wrapper/preflight.d.ts +13 -0
- package/dist/html-preview-wrapper/preflight.js +108 -0
- package/dist/html-preview-wrapper/preview-base.d.ts +29 -0
- package/dist/html-preview-wrapper/preview-base.js +127 -0
- package/dist/i18n-version/index.d.ts +5 -0
- package/dist/i18n-version/index.js +14 -0
- package/dist/i18n-version/language-switcher.d.ts +24 -0
- package/dist/i18n-version/language-switcher.js +25 -0
- package/dist/i18n-version/types.d.ts +43 -0
- package/dist/i18n-version/types.js +0 -0
- package/dist/i18n-version/version-banner.d.ts +30 -0
- package/dist/i18n-version/version-banner.js +21 -0
- package/dist/i18n-version/version-switcher.d.ts +112 -0
- package/dist/i18n-version/version-switcher.js +157 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +0 -0
- package/dist/integrations/claude-resources/escape-for-mdx.d.ts +8 -0
- package/dist/integrations/claude-resources/escape-for-mdx.js +131 -0
- package/dist/integrations/claude-resources/generate.d.ts +13 -0
- package/dist/integrations/claude-resources/generate.js +404 -0
- package/dist/integrations/claude-resources/index.d.ts +46 -0
- package/dist/integrations/claude-resources/index.js +24 -0
- package/dist/integrations/doc-history/index.d.ts +137 -0
- package/dist/integrations/doc-history/index.js +138 -0
- package/dist/integrations/doc-history/pre-build.d.ts +58 -0
- package/dist/integrations/doc-history/pre-build.js +67 -0
- package/dist/integrations/llms-txt/dev-middleware.d.ts +40 -0
- package/dist/integrations/llms-txt/dev-middleware.js +76 -0
- package/dist/integrations/llms-txt/emit.d.ts +22 -0
- package/dist/integrations/llms-txt/emit.js +55 -0
- package/dist/integrations/llms-txt/generate.d.ts +26 -0
- package/dist/integrations/llms-txt/generate.js +36 -0
- package/dist/integrations/llms-txt/index.d.ts +7 -0
- package/dist/integrations/llms-txt/index.js +27 -0
- package/dist/integrations/llms-txt/load.d.ts +51 -0
- package/dist/integrations/llms-txt/load.js +83 -0
- package/dist/integrations/llms-txt/strip.d.ts +22 -0
- package/dist/integrations/llms-txt/strip.js +10 -0
- package/dist/integrations/llms-txt/types.d.ts +145 -0
- package/dist/integrations/llms-txt/types.js +0 -0
- package/dist/integrations/search-index/build-emitter.d.ts +30 -0
- package/dist/integrations/search-index/build-emitter.js +15 -0
- package/dist/integrations/search-index/collect.d.ts +12 -0
- package/dist/integrations/search-index/collect.js +48 -0
- package/dist/integrations/search-index/content-files.d.ts +32 -0
- package/dist/integrations/search-index/content-files.js +50 -0
- package/dist/integrations/search-index/dev-middleware.d.ts +16 -0
- package/dist/integrations/search-index/dev-middleware.js +30 -0
- package/dist/integrations/search-index/index.d.ts +5 -0
- package/dist/integrations/search-index/index.js +14 -0
- package/dist/integrations/search-index/types.d.ts +38 -0
- package/dist/integrations/search-index/types.js +6 -0
- package/dist/metainfo/doc-metainfo.d.ts +50 -0
- package/dist/metainfo/doc-metainfo.js +107 -0
- package/dist/metainfo/doc-tags.d.ts +66 -0
- package/dist/metainfo/doc-tags.js +53 -0
- package/dist/metainfo/frontmatter-preview.d.ts +95 -0
- package/dist/metainfo/frontmatter-preview.js +55 -0
- package/dist/metainfo/index.d.ts +4 -0
- package/dist/metainfo/index.js +28 -0
- package/dist/nav-indexing/category-nav.d.ts +28 -0
- package/dist/nav-indexing/category-nav.js +41 -0
- package/dist/nav-indexing/category-tree-nav.d.ts +27 -0
- package/dist/nav-indexing/category-tree-nav.js +49 -0
- package/dist/nav-indexing/doc-card-grid.d.ts +38 -0
- package/dist/nav-indexing/doc-card-grid.js +40 -0
- package/dist/nav-indexing/docs-sitemap.d.ts +25 -0
- package/dist/nav-indexing/docs-sitemap.js +40 -0
- package/dist/nav-indexing/index.d.ts +10 -0
- package/dist/nav-indexing/index.js +18 -0
- package/dist/nav-indexing/nav-card-grid.d.ts +31 -0
- package/dist/nav-indexing/nav-card-grid.js +43 -0
- package/dist/nav-indexing/site-tree-nav-demo.d.ts +39 -0
- package/dist/nav-indexing/site-tree-nav-demo.js +65 -0
- package/dist/nav-indexing/tag-nav.d.ts +38 -0
- package/dist/nav-indexing/tag-nav.js +96 -0
- package/dist/nav-indexing/types.d.ts +95 -0
- package/dist/nav-indexing/types.js +0 -0
- package/dist/nav-indexing/versions-page-content.d.ts +29 -0
- package/dist/nav-indexing/versions-page-content.js +76 -0
- package/dist/page-loading/index.d.ts +2 -0
- package/dist/page-loading/index.js +10 -0
- package/dist/page-loading/page-loading-overlay.d.ts +35 -0
- package/dist/page-loading/page-loading-overlay.js +50 -0
- package/dist/sidebar/index.d.ts +3 -0
- package/dist/sidebar/index.js +4 -0
- package/dist/sidebar/sidebar.d.ts +54 -0
- package/dist/sidebar/sidebar.js +35 -0
- package/dist/sidebar/types.d.ts +71 -0
- package/dist/sidebar/types.js +0 -0
- package/dist/sidebar-resizer/index.d.ts +14 -0
- package/dist/sidebar-resizer/index.js +165 -0
- package/dist/sidebar-resizer/sidebar-resizer-init.d.ts +20 -0
- package/dist/sidebar-resizer/sidebar-resizer-init.js +119 -0
- package/dist/sidebar-tree/build-tree.d.ts +43 -0
- package/dist/sidebar-tree/build-tree.js +127 -0
- package/dist/sidebar-tree/category-meta.d.ts +19 -0
- package/dist/sidebar-tree/category-meta.js +63 -0
- package/dist/sidebar-tree/index.d.ts +3 -0
- package/dist/sidebar-tree/index.js +13 -0
- package/dist/sidebar-tree/types.d.ts +120 -0
- package/dist/sidebar-tree/types.js +0 -0
- package/dist/tab-item/index.d.ts +2 -0
- package/dist/tab-item/index.js +5 -0
- package/dist/tab-item/tab-item.d.ts +38 -0
- package/dist/tab-item/tab-item.js +25 -0
- package/dist/theme/color-scheme-provider.d.ts +32 -0
- package/dist/theme/color-scheme-provider.js +43 -0
- package/dist/theme/color-tweak-export-modal.d.ts +20 -0
- package/dist/theme/color-tweak-export-modal.js +138 -0
- package/dist/theme/design-token-serde.d.ts +136 -0
- package/dist/theme/design-token-serde.js +254 -0
- package/dist/theme/design-token-tweak-panel.d.ts +11 -0
- package/dist/theme/design-token-tweak-panel.js +10 -0
- package/dist/theme/design-token-types.d.ts +19 -0
- package/dist/theme/design-token-types.js +6 -0
- package/dist/theme/iframe-bridge.d.ts +44 -0
- package/dist/theme/iframe-bridge.js +70 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.js +42 -0
- package/dist/theme/theme-toggle.d.ts +17 -0
- package/dist/theme/theme-toggle.js +91 -0
- package/dist/toc/cx.d.ts +16 -0
- package/dist/toc/cx.js +22 -0
- package/dist/toc/index.d.ts +5 -0
- package/dist/toc/index.js +9 -0
- package/dist/toc/mobile-toc.d.ts +46 -0
- package/dist/toc/mobile-toc.js +88 -0
- package/dist/toc/smart-break.d.ts +27 -0
- package/dist/toc/smart-break.js +36 -0
- package/dist/toc/toc-title.d.ts +10 -0
- package/dist/toc/toc-title.js +14 -0
- package/dist/toc/toc.d.ts +60 -0
- package/dist/toc/toc.js +56 -0
- package/dist/toc/types.d.ts +23 -0
- package/dist/toc/types.js +0 -0
- package/dist/toc/use-active-heading.d.ts +30 -0
- package/dist/toc/use-active-heading.js +106 -0
- package/dist/transitions/index.d.ts +1 -0
- package/dist/transitions/index.js +12 -0
- package/dist/transitions/page-events.d.ts +41 -0
- package/dist/transitions/page-events.js +20 -0
- package/dist/url-normalizer/index.d.ts +1 -0
- package/dist/url-normalizer/index.js +6 -0
- package/dist/url-normalizer/normalize.d.ts +104 -0
- package/dist/url-normalizer/normalize.js +22 -0
- package/package.json +186 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { TokenDef } from '@takazudo/zdtp';
|
|
2
|
+
import { ColorTweakState, TweakState } from './design-token-types.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Design-token SerDe — unified JSON export / import for the design-token panel.
|
|
6
|
+
*
|
|
7
|
+
* Supersedes the legacy TypeScript-object export in `export-code.ts`. The JSON
|
|
8
|
+
* format is a single document covering all four token categories (color,
|
|
9
|
+
* spacing, font, size) so an AI assistant can consume or emit a whole
|
|
10
|
+
* design-token tweak in one round-trip.
|
|
11
|
+
*
|
|
12
|
+
* Format: `$schema = "zudo-doc-design-tokens/v1"`.
|
|
13
|
+
*
|
|
14
|
+
* Diff-only by default
|
|
15
|
+
* --------------------
|
|
16
|
+
* `serialize()` only emits tokens the user has actually changed relative to
|
|
17
|
+
* the provided `colorDefaults` (for the color block) and the manifest defaults
|
|
18
|
+
* (for spacing / font / size). Pass `includeDefaults: true` to dump the full
|
|
19
|
+
* state instead. The whole-category keys (`color`, `spacing`, `font`, `size`)
|
|
20
|
+
* are omitted entirely when nothing in them differs.
|
|
21
|
+
*
|
|
22
|
+
* Spacing / font / size keys use CSS variable names (`"--spacing-hsp-md"`) —
|
|
23
|
+
* the external schema — rather than the internal token id (`"hsp-md"`). This
|
|
24
|
+
* keeps the file human-readable and agnostic of our internal manifest.
|
|
25
|
+
* `deserialize()` maps them back; unknown CSS vars are reported via
|
|
26
|
+
* `unknownTokens` so the UI can surface them.
|
|
27
|
+
*
|
|
28
|
+
* Read-only manifest tokens (e.g. `--spacing-0`, `--zd-sidebar-w` with
|
|
29
|
+
* `clamp()`) are skipped in both directions.
|
|
30
|
+
*
|
|
31
|
+
* W3B (#1730 — Generator Pages Migration): moved from
|
|
32
|
+
* `src/utils/design-token-serde.ts` into v2. The manifest tokens
|
|
33
|
+
* (`SPACING_TOKENS` / `FONT_TOKENS` / `SIZE_TOKENS`) are no longer
|
|
34
|
+
* imported from the host's `@/config/design-tokens-manifest` — the
|
|
35
|
+
* caller now passes them through `SerializeOptions.manifest` /
|
|
36
|
+
* `DeserializeOptions.manifest`, preserving consumer override hooks.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v1";
|
|
40
|
+
/** External JSON value for a base-color / semantic-color entry. */
|
|
41
|
+
type ColorSlotValue = number | "bg" | "fg";
|
|
42
|
+
interface DesignTokenJsonColorBase {
|
|
43
|
+
bg?: number;
|
|
44
|
+
fg?: number;
|
|
45
|
+
cursor?: number;
|
|
46
|
+
/** Dashed keys mirror the external docs; they are quoted in source. */
|
|
47
|
+
"sel-bg"?: number;
|
|
48
|
+
"sel-fg"?: number;
|
|
49
|
+
}
|
|
50
|
+
interface DesignTokenJsonColor {
|
|
51
|
+
palette?: string[];
|
|
52
|
+
base?: DesignTokenJsonColorBase;
|
|
53
|
+
/** Palette-index (or "bg"/"fg") mappings, same keys as `SEMANTIC_DEFAULTS`. */
|
|
54
|
+
semantic?: Record<string, ColorSlotValue>;
|
|
55
|
+
}
|
|
56
|
+
/** External token map keyed by CSS var name. */
|
|
57
|
+
type DesignTokenJsonOverrides = Record<string, string>;
|
|
58
|
+
interface DesignTokenJson {
|
|
59
|
+
$schema: typeof DESIGN_TOKEN_SCHEMA;
|
|
60
|
+
exportedAt: string;
|
|
61
|
+
color?: DesignTokenJsonColor;
|
|
62
|
+
spacing?: DesignTokenJsonOverrides;
|
|
63
|
+
font?: DesignTokenJsonOverrides;
|
|
64
|
+
size?: DesignTokenJsonOverrides;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Token manifest the caller hands in — the consumer's
|
|
68
|
+
* `src/config/design-tokens-manifest.ts` (or generator override). v2
|
|
69
|
+
* doesn't ship its own manifest; this is intentionally a caller concern
|
|
70
|
+
* so each consumer keeps full control over the editable token set.
|
|
71
|
+
*/
|
|
72
|
+
interface DesignTokenManifest {
|
|
73
|
+
spacing: readonly TokenDef[];
|
|
74
|
+
font: readonly TokenDef[];
|
|
75
|
+
size: readonly TokenDef[];
|
|
76
|
+
}
|
|
77
|
+
interface SerializeOptions {
|
|
78
|
+
/** Token manifest (spacing / font / size arrays) used to compute
|
|
79
|
+
* diff-only output and resolve CSS-var names. Required. */
|
|
80
|
+
manifest: DesignTokenManifest;
|
|
81
|
+
/** When true, dump full state (all palette entries, all token manifest
|
|
82
|
+
* defaults merged in). Default: diff-only. */
|
|
83
|
+
includeDefaults?: boolean;
|
|
84
|
+
/** Color baseline to diff against — typically the current scheme's initial
|
|
85
|
+
* state. Required for meaningful color-diff output; callers that don't have
|
|
86
|
+
* it available (e.g. tests without DOM) can omit it and we'll treat the
|
|
87
|
+
* whole color block as changed. */
|
|
88
|
+
colorDefaults?: ColorTweakState;
|
|
89
|
+
/** Override the `exportedAt` stamp (test-only). */
|
|
90
|
+
now?: () => Date;
|
|
91
|
+
}
|
|
92
|
+
interface DeserializeResult {
|
|
93
|
+
/** The reconstructed tweak state, with unknown-token values dropped. */
|
|
94
|
+
state: TweakState;
|
|
95
|
+
/** CSS var names present in the payload that don't match any known token. */
|
|
96
|
+
unknownTokens: string[];
|
|
97
|
+
/** Human-readable errors that did not prevent a state from being produced
|
|
98
|
+
* (e.g. "semantic mapping dropped because value isn't a number"). */
|
|
99
|
+
warnings: string[];
|
|
100
|
+
}
|
|
101
|
+
interface DeserializeOptions {
|
|
102
|
+
/** Token manifest (spacing / font / size arrays) used to resolve CSS-var
|
|
103
|
+
* names back to internal token ids. Required. */
|
|
104
|
+
manifest: DesignTokenManifest;
|
|
105
|
+
/** Color baseline used to fill in fields absent from the payload (diff-only
|
|
106
|
+
* exports are missing most fields by design). Typically the current
|
|
107
|
+
* scheme's initial state. */
|
|
108
|
+
colorDefaults?: ColorTweakState;
|
|
109
|
+
}
|
|
110
|
+
/** Thrown when the payload is not a v1 schema object. The error `.reason`
|
|
111
|
+
* helps the UI render a precise inline message. */
|
|
112
|
+
declare class DesignTokenSchemaError extends Error {
|
|
113
|
+
readonly reason: "not-object" | "schema-missing" | "schema-mismatch";
|
|
114
|
+
readonly actualSchema?: unknown;
|
|
115
|
+
constructor(reason: "not-object" | "schema-missing" | "schema-mismatch", message: string, actualSchema?: unknown);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Produce the external JSON document for a given tweak state.
|
|
119
|
+
*
|
|
120
|
+
* By default this is diff-only against `opts.colorDefaults` + manifest
|
|
121
|
+
* defaults; set `opts.includeDefaults = true` to dump everything.
|
|
122
|
+
*/
|
|
123
|
+
declare function serialize(state: TweakState, opts: SerializeOptions): DesignTokenJson;
|
|
124
|
+
/**
|
|
125
|
+
* Parse a design-token JSON document and lift it back into a tweak state.
|
|
126
|
+
*
|
|
127
|
+
* Throws `DesignTokenSchemaError` on schema mismatch / non-object input. Any
|
|
128
|
+
* CSS var name that doesn't match a known manifest entry is collected into
|
|
129
|
+
* `unknownTokens` (the caller can surface these as a warning).
|
|
130
|
+
*
|
|
131
|
+
* Missing fields fall back to `opts.colorDefaults` (or, absent that, a
|
|
132
|
+
* minimal neutral default) so the result is always a valid `TweakState`.
|
|
133
|
+
*/
|
|
134
|
+
declare function deserialize(input: unknown, opts: DeserializeOptions): DeserializeResult;
|
|
135
|
+
|
|
136
|
+
export { DESIGN_TOKEN_SCHEMA, type DeserializeOptions, type DeserializeResult, type DesignTokenJson, type DesignTokenJsonColor, type DesignTokenJsonColorBase, type DesignTokenJsonOverrides, type DesignTokenManifest, DesignTokenSchemaError, type SerializeOptions, deserialize, serialize };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import {} from "@takazudo/zdtp";
|
|
2
|
+
import {
|
|
3
|
+
emptyOverrides
|
|
4
|
+
} from "./design-token-types.js";
|
|
5
|
+
const DESIGN_TOKEN_SCHEMA = "zudo-doc-design-tokens/v1";
|
|
6
|
+
class DesignTokenSchemaError extends Error {
|
|
7
|
+
reason;
|
|
8
|
+
actualSchema;
|
|
9
|
+
constructor(reason, message, actualSchema) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.name = "DesignTokenSchemaError";
|
|
12
|
+
this.reason = reason;
|
|
13
|
+
this.actualSchema = actualSchema;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function serialize(state, opts) {
|
|
17
|
+
const now = opts.now ? opts.now() : /* @__PURE__ */ new Date();
|
|
18
|
+
const out = {
|
|
19
|
+
$schema: DESIGN_TOKEN_SCHEMA,
|
|
20
|
+
exportedAt: now.toISOString()
|
|
21
|
+
};
|
|
22
|
+
const color = serializeColor(state.color, opts);
|
|
23
|
+
if (color) out.color = color;
|
|
24
|
+
const spacing = serializeOverrides(opts.manifest.spacing, state.spacing, opts);
|
|
25
|
+
if (spacing) out.spacing = spacing;
|
|
26
|
+
const font = serializeOverrides(opts.manifest.font, state.font, opts);
|
|
27
|
+
if (font) out.font = font;
|
|
28
|
+
const size = serializeOverrides(opts.manifest.size, state.size, opts);
|
|
29
|
+
if (size) out.size = size;
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
function serializeColor(color, opts) {
|
|
33
|
+
const baseline = opts.colorDefaults;
|
|
34
|
+
const full = opts.includeDefaults === true;
|
|
35
|
+
const out = {};
|
|
36
|
+
let changed = false;
|
|
37
|
+
const paletteChanged = full || !baseline || baseline.palette.length !== color.palette.length || color.palette.some((c, i) => c !== baseline.palette[i]);
|
|
38
|
+
if (paletteChanged) {
|
|
39
|
+
out.palette = [...color.palette];
|
|
40
|
+
changed = true;
|
|
41
|
+
}
|
|
42
|
+
const base = {};
|
|
43
|
+
let baseChanged = false;
|
|
44
|
+
const baseEntries = [
|
|
45
|
+
["bg", color.background, baseline?.background],
|
|
46
|
+
["fg", color.foreground, baseline?.foreground],
|
|
47
|
+
["cursor", color.cursor, baseline?.cursor],
|
|
48
|
+
["sel-bg", color.selectionBg, baseline?.selectionBg],
|
|
49
|
+
["sel-fg", color.selectionFg, baseline?.selectionFg]
|
|
50
|
+
];
|
|
51
|
+
for (const [key, value, baselineValue] of baseEntries) {
|
|
52
|
+
if (full || baseline === void 0 || value !== baselineValue) {
|
|
53
|
+
base[key] = value;
|
|
54
|
+
baseChanged = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (baseChanged) {
|
|
58
|
+
out.base = base;
|
|
59
|
+
changed = true;
|
|
60
|
+
}
|
|
61
|
+
const semantic = {};
|
|
62
|
+
let semanticChanged = false;
|
|
63
|
+
const semKeys = /* @__PURE__ */ new Set([
|
|
64
|
+
...Object.keys(color.semanticMappings),
|
|
65
|
+
...baseline ? Object.keys(baseline.semanticMappings) : []
|
|
66
|
+
]);
|
|
67
|
+
for (const key of semKeys) {
|
|
68
|
+
const cur = color.semanticMappings[key];
|
|
69
|
+
if (cur === void 0) continue;
|
|
70
|
+
const base2 = baseline?.semanticMappings[key];
|
|
71
|
+
if (full || base2 === void 0 || cur !== base2) {
|
|
72
|
+
semantic[key] = cur;
|
|
73
|
+
semanticChanged = true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (semanticChanged) {
|
|
77
|
+
out.semantic = semantic;
|
|
78
|
+
changed = true;
|
|
79
|
+
}
|
|
80
|
+
return changed ? out : void 0;
|
|
81
|
+
}
|
|
82
|
+
function serializeOverrides(manifest, overrides, opts) {
|
|
83
|
+
const full = opts.includeDefaults === true;
|
|
84
|
+
const out = {};
|
|
85
|
+
let wrote = false;
|
|
86
|
+
if (full) {
|
|
87
|
+
for (const t of manifest) {
|
|
88
|
+
if (t.readonly) continue;
|
|
89
|
+
const v = overrides[t.id];
|
|
90
|
+
out[t.cssVar] = typeof v === "string" && v.length > 0 ? v : t.default;
|
|
91
|
+
wrote = true;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
for (const t of manifest) {
|
|
95
|
+
if (t.readonly) continue;
|
|
96
|
+
const v = overrides[t.id];
|
|
97
|
+
if (typeof v === "string" && v.length > 0 && v !== t.default) {
|
|
98
|
+
out[t.cssVar] = v;
|
|
99
|
+
wrote = true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return wrote ? out : void 0;
|
|
104
|
+
}
|
|
105
|
+
function deserialize(input, opts) {
|
|
106
|
+
if (input === null || typeof input !== "object") {
|
|
107
|
+
throw new DesignTokenSchemaError(
|
|
108
|
+
"not-object",
|
|
109
|
+
"Input is not a JSON object."
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
const obj = input;
|
|
113
|
+
const schema = obj.$schema;
|
|
114
|
+
if (schema === void 0) {
|
|
115
|
+
throw new DesignTokenSchemaError(
|
|
116
|
+
"schema-missing",
|
|
117
|
+
`Missing "$schema" key. Expected "${DESIGN_TOKEN_SCHEMA}".`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
if (schema !== DESIGN_TOKEN_SCHEMA) {
|
|
121
|
+
throw new DesignTokenSchemaError(
|
|
122
|
+
"schema-mismatch",
|
|
123
|
+
`Unsupported "$schema" value: ${JSON.stringify(schema)}. Expected "${DESIGN_TOKEN_SCHEMA}".`,
|
|
124
|
+
schema
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
const warnings = [];
|
|
128
|
+
const unknownTokens = [];
|
|
129
|
+
const baseline = opts.colorDefaults ?? neutralColorDefaults();
|
|
130
|
+
const color = deserializeColor(obj.color, baseline, warnings);
|
|
131
|
+
const spacing = deserializeOverrides(
|
|
132
|
+
obj.spacing,
|
|
133
|
+
opts.manifest.spacing,
|
|
134
|
+
"spacing",
|
|
135
|
+
unknownTokens,
|
|
136
|
+
warnings
|
|
137
|
+
);
|
|
138
|
+
const font = deserializeOverrides(
|
|
139
|
+
obj.font,
|
|
140
|
+
opts.manifest.font,
|
|
141
|
+
"font",
|
|
142
|
+
unknownTokens,
|
|
143
|
+
warnings
|
|
144
|
+
);
|
|
145
|
+
const size = deserializeOverrides(
|
|
146
|
+
obj.size,
|
|
147
|
+
opts.manifest.size,
|
|
148
|
+
"size",
|
|
149
|
+
unknownTokens,
|
|
150
|
+
warnings
|
|
151
|
+
);
|
|
152
|
+
return {
|
|
153
|
+
state: { color, spacing, font, size },
|
|
154
|
+
unknownTokens,
|
|
155
|
+
warnings
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function deserializeColor(raw, baseline, warnings) {
|
|
159
|
+
if (!raw || typeof raw !== "object") {
|
|
160
|
+
return { ...baseline, palette: [...baseline.palette], semanticMappings: { ...baseline.semanticMappings } };
|
|
161
|
+
}
|
|
162
|
+
const c = raw;
|
|
163
|
+
let palette = [...baseline.palette];
|
|
164
|
+
if (Array.isArray(c.palette)) {
|
|
165
|
+
const parsed = c.palette.filter((v) => typeof v === "string");
|
|
166
|
+
if (parsed.length === 16 && parsed.length === c.palette.length) {
|
|
167
|
+
palette = parsed;
|
|
168
|
+
} else if (c.palette.length > 0) {
|
|
169
|
+
const detail = parsed.length < c.palette.length ? `${c.palette.length - parsed.length} non-string entries dropped, leaving ${parsed.length}` : `${c.palette.length} entries`;
|
|
170
|
+
warnings.push(
|
|
171
|
+
`color.palette: expected 16 string entries; got ${detail}. Palette ignored.`
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const base = c.base && typeof c.base === "object" ? c.base : {};
|
|
176
|
+
const background = numOr(base.bg, baseline.background);
|
|
177
|
+
const foreground = numOr(base.fg, baseline.foreground);
|
|
178
|
+
const cursor = numOr(base.cursor, baseline.cursor);
|
|
179
|
+
const selectionBg = numOr(base["sel-bg"], baseline.selectionBg);
|
|
180
|
+
const selectionFg = numOr(base["sel-fg"], baseline.selectionFg);
|
|
181
|
+
const semanticMappings = {
|
|
182
|
+
...baseline.semanticMappings
|
|
183
|
+
};
|
|
184
|
+
if (c.semantic && typeof c.semantic === "object") {
|
|
185
|
+
for (const [key, val] of Object.entries(c.semantic)) {
|
|
186
|
+
if (typeof val === "number") {
|
|
187
|
+
semanticMappings[key] = val;
|
|
188
|
+
} else if (val === "bg" || val === "fg") {
|
|
189
|
+
semanticMappings[key] = val;
|
|
190
|
+
} else {
|
|
191
|
+
warnings.push(
|
|
192
|
+
`color.semantic.${key} has unsupported value ${JSON.stringify(val)}; kept baseline.`
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
palette,
|
|
199
|
+
background,
|
|
200
|
+
foreground,
|
|
201
|
+
cursor,
|
|
202
|
+
selectionBg,
|
|
203
|
+
selectionFg,
|
|
204
|
+
semanticMappings
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function deserializeOverrides(raw, manifest, label, unknownTokens, warnings) {
|
|
208
|
+
if (!raw || typeof raw !== "object") return emptyOverrides();
|
|
209
|
+
const byVar = /* @__PURE__ */ new Map();
|
|
210
|
+
for (const t of manifest) {
|
|
211
|
+
if (t.readonly) continue;
|
|
212
|
+
byVar.set(t.cssVar, t);
|
|
213
|
+
}
|
|
214
|
+
const out = {};
|
|
215
|
+
for (const [cssVar, value] of Object.entries(raw)) {
|
|
216
|
+
const t = byVar.get(cssVar);
|
|
217
|
+
if (!t) {
|
|
218
|
+
unknownTokens.push(cssVar);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
222
|
+
warnings.push(
|
|
223
|
+
`${label}.${cssVar} is not a non-empty string; ignored.`
|
|
224
|
+
);
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
out[t.id] = value;
|
|
228
|
+
}
|
|
229
|
+
return out;
|
|
230
|
+
}
|
|
231
|
+
function numOr(v, fallback) {
|
|
232
|
+
return typeof v === "number" && Number.isFinite(v) ? v : fallback;
|
|
233
|
+
}
|
|
234
|
+
function neutralColorDefaults() {
|
|
235
|
+
const palette = Array.from(
|
|
236
|
+
{ length: 16 },
|
|
237
|
+
(_, i) => i === 0 ? "#000000" : i === 15 ? "#ffffff" : "#808080"
|
|
238
|
+
);
|
|
239
|
+
return {
|
|
240
|
+
palette,
|
|
241
|
+
background: 0,
|
|
242
|
+
foreground: 15,
|
|
243
|
+
cursor: 6,
|
|
244
|
+
selectionBg: 0,
|
|
245
|
+
selectionFg: 15,
|
|
246
|
+
semanticMappings: {}
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export {
|
|
250
|
+
DESIGN_TOKEN_SCHEMA,
|
|
251
|
+
DesignTokenSchemaError,
|
|
252
|
+
deserialize,
|
|
253
|
+
serialize
|
|
254
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JSX } from 'preact';
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime automatic */
|
|
4
|
+
/** @jsxImportSource preact */
|
|
5
|
+
|
|
6
|
+
/** Stub — the real panel is bootstrapped by zdtp via design-token-panel-bootstrap.ts. */
|
|
7
|
+
declare function DesignTokenTweakPanelInner(): JSX.Element | null;
|
|
8
|
+
/** Stub — see DesignTokenTweakPanelInner. */
|
|
9
|
+
declare function DesignTokenTweakPanel(): JSX.Element | null;
|
|
10
|
+
|
|
11
|
+
export { DesignTokenTweakPanelInner, DesignTokenTweakPanel as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface ColorTweakState {
|
|
2
|
+
palette: string[];
|
|
3
|
+
background: number;
|
|
4
|
+
foreground: number;
|
|
5
|
+
cursor: number;
|
|
6
|
+
selectionBg: number;
|
|
7
|
+
selectionFg: number;
|
|
8
|
+
semanticMappings: Record<string, number | "bg" | "fg">;
|
|
9
|
+
}
|
|
10
|
+
type TokenOverrides = Record<string, string>;
|
|
11
|
+
interface TweakState {
|
|
12
|
+
color: ColorTweakState;
|
|
13
|
+
spacing: TokenOverrides;
|
|
14
|
+
font: TokenOverrides;
|
|
15
|
+
size: TokenOverrides;
|
|
16
|
+
}
|
|
17
|
+
declare function emptyOverrides(): TokenOverrides;
|
|
18
|
+
|
|
19
|
+
export { type ColorTweakState, type TokenOverrides, type TweakState, emptyOverrides };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
declare const BRIDGE_SOURCE: "zudo-doc-theme-bridge";
|
|
2
|
+
type CssVarPair = readonly [name: string, value: string];
|
|
3
|
+
interface ApplyCssVarsMessage {
|
|
4
|
+
source: typeof BRIDGE_SOURCE;
|
|
5
|
+
type: "apply-css-vars";
|
|
6
|
+
vars: ReadonlyArray<CssVarPair>;
|
|
7
|
+
}
|
|
8
|
+
interface ClearCssVarsMessage {
|
|
9
|
+
source: typeof BRIDGE_SOURCE;
|
|
10
|
+
type: "clear-css-vars";
|
|
11
|
+
names: ReadonlyArray<string>;
|
|
12
|
+
}
|
|
13
|
+
interface ReadyMessage {
|
|
14
|
+
source: typeof BRIDGE_SOURCE;
|
|
15
|
+
type: "ready";
|
|
16
|
+
}
|
|
17
|
+
interface ErrorMessage {
|
|
18
|
+
source: typeof BRIDGE_SOURCE;
|
|
19
|
+
type: "error";
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
type BridgeMessage = ApplyCssVarsMessage | ClearCssVarsMessage | ReadyMessage | ErrorMessage;
|
|
23
|
+
/**
|
|
24
|
+
* Type guard. Accepts any postMessage payload and confirms it is a bridge
|
|
25
|
+
* envelope. Foreign messages are ignored silently.
|
|
26
|
+
*/
|
|
27
|
+
declare function isBridgeMessage(value: unknown): value is BridgeMessage;
|
|
28
|
+
/** Send `apply-css-vars` to the iframe. No-op when the iframe has not loaded. */
|
|
29
|
+
declare function sendApplyCssVars(iframe: HTMLIFrameElement | null, vars: ReadonlyArray<CssVarPair>): void;
|
|
30
|
+
/** Send `clear-css-vars` to the iframe so it removes inline overrides. */
|
|
31
|
+
declare function sendClearCssVars(iframe: HTMLIFrameElement | null, names: ReadonlyArray<string>): void;
|
|
32
|
+
/**
|
|
33
|
+
* Install a message listener inside the preview iframe document that applies
|
|
34
|
+
* any incoming CSS-var batches onto `documentElement.style`. Returns a
|
|
35
|
+
* teardown function. Intended to be called once at iframe boot.
|
|
36
|
+
*/
|
|
37
|
+
declare function installIframeReceiver(target?: Window): () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Install a `ready` listener on the panel side so callers can defer the
|
|
40
|
+
* initial CSS-var sync until the iframe document has booted.
|
|
41
|
+
*/
|
|
42
|
+
declare function onIframeReady(expectedSource: Window | null, callback: () => void): () => void;
|
|
43
|
+
|
|
44
|
+
export { type ApplyCssVarsMessage, BRIDGE_SOURCE, type BridgeMessage, type ClearCssVarsMessage, type CssVarPair, type ErrorMessage, type ReadyMessage, installIframeReceiver, isBridgeMessage, onIframeReady, sendApplyCssVars, sendClearCssVars };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
const BRIDGE_SOURCE = "zudo-doc-theme-bridge";
|
|
2
|
+
function isBridgeMessage(value) {
|
|
3
|
+
if (!value || typeof value !== "object") return false;
|
|
4
|
+
const v = value;
|
|
5
|
+
return v.source === BRIDGE_SOURCE && typeof v.type === "string";
|
|
6
|
+
}
|
|
7
|
+
function sendApplyCssVars(iframe, vars) {
|
|
8
|
+
const win = iframe?.contentWindow;
|
|
9
|
+
if (!win) return;
|
|
10
|
+
const message = {
|
|
11
|
+
source: BRIDGE_SOURCE,
|
|
12
|
+
type: "apply-css-vars",
|
|
13
|
+
vars
|
|
14
|
+
};
|
|
15
|
+
win.postMessage(message, "*");
|
|
16
|
+
}
|
|
17
|
+
function sendClearCssVars(iframe, names) {
|
|
18
|
+
const win = iframe?.contentWindow;
|
|
19
|
+
if (!win) return;
|
|
20
|
+
const message = {
|
|
21
|
+
source: BRIDGE_SOURCE,
|
|
22
|
+
type: "clear-css-vars",
|
|
23
|
+
names
|
|
24
|
+
};
|
|
25
|
+
win.postMessage(message, "*");
|
|
26
|
+
}
|
|
27
|
+
function installIframeReceiver(target = window) {
|
|
28
|
+
function handler(event) {
|
|
29
|
+
const data = event.data;
|
|
30
|
+
if (!isBridgeMessage(data)) return;
|
|
31
|
+
if (data.type === "apply-css-vars") {
|
|
32
|
+
const root = target.document.documentElement;
|
|
33
|
+
for (const [name, value] of data.vars) {
|
|
34
|
+
root.style.setProperty(name, value);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (data.type === "clear-css-vars") {
|
|
39
|
+
const root = target.document.documentElement;
|
|
40
|
+
for (const name of data.names) {
|
|
41
|
+
root.style.removeProperty(name);
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
target.addEventListener("message", handler);
|
|
47
|
+
const parent = target.parent;
|
|
48
|
+
if (parent && parent !== target) {
|
|
49
|
+
const ready = { source: BRIDGE_SOURCE, type: "ready" };
|
|
50
|
+
parent.postMessage(ready, "*");
|
|
51
|
+
}
|
|
52
|
+
return () => target.removeEventListener("message", handler);
|
|
53
|
+
}
|
|
54
|
+
function onIframeReady(expectedSource, callback) {
|
|
55
|
+
function handler(event) {
|
|
56
|
+
if (expectedSource && event.source !== expectedSource) return;
|
|
57
|
+
if (!isBridgeMessage(event.data)) return;
|
|
58
|
+
if (event.data.type === "ready") callback();
|
|
59
|
+
}
|
|
60
|
+
window.addEventListener("message", handler);
|
|
61
|
+
return () => window.removeEventListener("message", handler);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
BRIDGE_SOURCE,
|
|
65
|
+
installIframeReceiver,
|
|
66
|
+
isBridgeMessage,
|
|
67
|
+
onIframeReady,
|
|
68
|
+
sendApplyCssVars,
|
|
69
|
+
sendClearCssVars
|
|
70
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as ThemeToggle } from './theme-toggle.js';
|
|
2
|
+
export { default as ColorSchemeProvider, ColorSchemeProviderColorMode, ColorSchemeProviderProps } from './color-scheme-provider.js';
|
|
3
|
+
export { default as DesignTokenTweakPanel, DesignTokenTweakPanelInner } from './design-token-tweak-panel.js';
|
|
4
|
+
export { default as ColorTweakExportModal } from './color-tweak-export-modal.js';
|
|
5
|
+
export { DESIGN_TOKEN_SCHEMA, DeserializeOptions, DeserializeResult, DesignTokenJson, DesignTokenJsonColor, DesignTokenJsonColorBase, DesignTokenJsonOverrides, DesignTokenManifest, DesignTokenSchemaError, SerializeOptions, deserialize, serialize } from './design-token-serde.js';
|
|
6
|
+
export { ColorTweakState, TokenOverrides, TweakState, emptyOverrides } from './design-token-types.js';
|
|
7
|
+
export { ApplyCssVarsMessage, BRIDGE_SOURCE, BridgeMessage, ClearCssVarsMessage, CssVarPair, ErrorMessage, ReadyMessage, installIframeReceiver, isBridgeMessage, onIframeReady, sendApplyCssVars, sendClearCssVars } from './iframe-bridge.js';
|
|
8
|
+
import 'preact';
|
|
9
|
+
import '@takazudo/zdtp';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { default as default2 } from "./theme-toggle.js";
|
|
2
|
+
import { default as default3 } from "./color-scheme-provider.js";
|
|
3
|
+
import {
|
|
4
|
+
default as default4,
|
|
5
|
+
DesignTokenTweakPanelInner
|
|
6
|
+
} from "./design-token-tweak-panel.js";
|
|
7
|
+
import { default as default5 } from "./color-tweak-export-modal.js";
|
|
8
|
+
import {
|
|
9
|
+
DESIGN_TOKEN_SCHEMA,
|
|
10
|
+
DesignTokenSchemaError,
|
|
11
|
+
deserialize,
|
|
12
|
+
serialize
|
|
13
|
+
} from "./design-token-serde.js";
|
|
14
|
+
import {
|
|
15
|
+
emptyOverrides
|
|
16
|
+
} from "./design-token-types.js";
|
|
17
|
+
import {
|
|
18
|
+
BRIDGE_SOURCE,
|
|
19
|
+
isBridgeMessage,
|
|
20
|
+
installIframeReceiver,
|
|
21
|
+
onIframeReady,
|
|
22
|
+
sendApplyCssVars,
|
|
23
|
+
sendClearCssVars
|
|
24
|
+
} from "./iframe-bridge.js";
|
|
25
|
+
export {
|
|
26
|
+
BRIDGE_SOURCE,
|
|
27
|
+
default3 as ColorSchemeProvider,
|
|
28
|
+
default5 as ColorTweakExportModal,
|
|
29
|
+
DESIGN_TOKEN_SCHEMA,
|
|
30
|
+
DesignTokenSchemaError,
|
|
31
|
+
default4 as DesignTokenTweakPanel,
|
|
32
|
+
DesignTokenTweakPanelInner,
|
|
33
|
+
default2 as ThemeToggle,
|
|
34
|
+
deserialize,
|
|
35
|
+
emptyOverrides,
|
|
36
|
+
installIframeReceiver,
|
|
37
|
+
isBridgeMessage,
|
|
38
|
+
onIframeReady,
|
|
39
|
+
sendApplyCssVars,
|
|
40
|
+
sendClearCssVars,
|
|
41
|
+
serialize
|
|
42
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { VNode } from 'preact';
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime automatic */
|
|
4
|
+
/** @jsxImportSource preact */
|
|
5
|
+
|
|
6
|
+
interface ThemeToggleProps {
|
|
7
|
+
defaultMode?: "light" | "dark";
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Default-export click-toggle for color scheme. Wraps `<ThemeToggleInner>`
|
|
11
|
+
* in `<Island when="load">` so the SSG renderer emits a
|
|
12
|
+
* `data-zfb-island="ThemeToggle"` marker the hydration runtime can
|
|
13
|
+
* find at boot time.
|
|
14
|
+
*/
|
|
15
|
+
declare function ThemeToggle(props?: ThemeToggleProps): VNode;
|
|
16
|
+
|
|
17
|
+
export { ThemeToggle as default };
|