@takazudo/zudo-doc 2.5.1 โ†’ 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/content.css CHANGED
@@ -28,7 +28,7 @@
28
28
  * 2. DESIGN TOKENS โ€” the consumer's `@theme` MUST define every custom property
29
29
  * consumed below:
30
30
  * --color-{fg,bg,muted,accent,accent-hover,code-bg,code-fg,info,success,
31
- * warning,danger,p5}
31
+ * warning,danger}
32
32
  * --spacing-{vsp-2xs,vsp-xs,vsp-sm,vsp-md,vsp-lg,vsp-xl,vsp-2xl,
33
33
  * hsp-2xs,hsp-xs,hsp-sm,hsp-md,hsp-lg,hsp-xl}
34
34
  * --text-{body,small} --font-mono --font-weight-{medium,semibold}
@@ -405,16 +405,16 @@
405
405
  content: "๐Ÿšจ";
406
406
  }
407
407
 
408
- /* github-alerts [!IMPORTANT] โ†’ magenta/accent-adjacent (p5 = magenta palette slot) */
408
+ /* github-alerts [!IMPORTANT] โ†’ shares the orange accent (--color-accent โ†’ --zd-accent โ†’ accent ramp); โ— icon differentiates it from other admonitions */
409
409
  [data-admonition="important"],
410
410
  .admonition-important {
411
- border-left-color: var(--color-p5);
412
- background-color: color-mix(in srgb, var(--color-p5) 12%, var(--color-bg));
411
+ border-left-color: var(--color-accent);
412
+ background-color: color-mix(in srgb, var(--color-accent) 12%, var(--color-bg));
413
413
  }
414
414
 
415
415
  [data-admonition="important"] .admonition-title,
416
416
  .admonition-important .admonition-title {
417
- color: var(--color-p5);
417
+ color: var(--color-accent);
418
418
  }
419
419
 
420
420
  [data-admonition="important"] .admonition-title::before,
@@ -1,20 +1,28 @@
1
1
  /**
2
2
  * Design-token panel (zdtp) WIRING MECHANISM.
3
3
  *
4
- * A side-effect module that calls `configurePanel(panelConfig)` and wires
5
- * zdtp's lifecycle hooks to zfb's navigation events via
6
- * `setLifecycleAdapter()`. Projects import this with their own
7
- * `designTokenPanelConfig` object โ€” the DATA stays project-side.
4
+ * A side-effect module that configures zdtp's panel and wires its lifecycle
5
+ * hooks to zfb's navigation events via `setLifecycleAdapter()`. Projects import
6
+ * this with their own PanelConfig DATA โ€” which stays project-side.
8
7
  *
9
- * Usage (project-side `src/lib/design-token-panel-bootstrap.ts`):
8
+ * Two calling shapes (both supported):
10
9
  *
10
+ * // Mode-scoped builder (showcase host) โ€” rebuilds the panel per light/dark
11
+ * // mode on every `color-scheme-changed` toggle:
11
12
  * import { bootstrapDesignTokenPanel } from "@takazudo/zudo-doc/design-token-panel-bootstrap";
13
+ * import { buildDesignTokenPanelConfig } from "@/config/design-token-panel-config";
14
+ * bootstrapDesignTokenPanel(buildDesignTokenPanelConfig);
15
+ *
16
+ * // Plain config (back-compat โ€” generated projects on the old shape):
12
17
  * import { designTokenPanelConfig } from "@/config/design-token-panel-config";
13
18
  * bootstrapDesignTokenPanel(designTokenPanelConfig);
14
19
  *
20
+ * A plain-config caller gets NO toggle listener (a static config has nothing to
21
+ * rebuild), so existing generated projects keep working with zero changes.
22
+ *
15
23
  * Moved from the host's `src/lib/design-token-panel-bootstrap.ts` as part of
16
- * the package-first migration (S9a zudolab/zudo-doc#2333). The PanelConfig
17
- * DATA stays project-side.
24
+ * the package-first migration (S9a zudolab/zudo-doc#2333); mode-scoped rebuild
25
+ * wiring added in zudolab/zudo-doc#2610.
18
26
  *
19
27
  * CSS is pulled via `@import "@takazudo/zdtp/styles.css"` in the project's
20
28
  * `src/styles/global.css` so the panel chrome lands in the main page CSS
@@ -23,16 +31,29 @@
23
31
  * required pull point. See @takazudo/zdtp PORTABLE-CONTRACT.md ยง7.
24
32
  */
25
33
  import { type PanelConfig } from "@takazudo/zdtp";
34
+ /** Active color-scheme mode, read from `<html data-theme>`. */
35
+ type ColorSchemeMode = "light" | "dark";
26
36
  /**
27
- * Bootstrap zdtp for a project. Calls `configurePanel(panelConfig)`,
28
- * drains any pre-hydration click queue, and wires the zdtp lifecycle
29
- * adapter to zfb's navigation events so persisted token overrides are
30
- * re-applied on every soft navigation.
37
+ * A per-mode PanelConfig factory. Supplied by hosts that want the panel's
38
+ * defaults to follow the live light/dark mode (see `buildDesignTokenPanelConfig`
39
+ * in the host's `design-token-panel-config.ts`).
40
+ */
41
+ export type PanelConfigBuilder = (mode: ColorSchemeMode) => PanelConfig;
42
+ /**
43
+ * Bootstrap zdtp for a project. Configures the panel, drains any pre-hydration
44
+ * click queue, and wires the zdtp lifecycle adapter to zfb's navigation events
45
+ * so persisted token overrides re-apply on every soft navigation.
46
+ *
47
+ * When passed a `PanelConfigBuilder`, also wires a `color-scheme-changed`
48
+ * listener that rebuilds the panel per light/dark mode (see the toggle sequence
49
+ * below). When passed a plain `PanelConfig`, no toggle listener is registered.
31
50
  *
32
- * Call this once, as a side-effect import from the project's island
33
- * wrapper (`src/components/design-token-panel-bootstrap.tsx`).
51
+ * Call this once, as a side-effect import from the project's island wrapper
52
+ * (`src/components/design-token-panel-bootstrap.tsx`).
34
53
  *
35
- * @param panelConfig - The project's `PanelConfig` object (data stays
36
- * project-side in `src/config/design-token-panel-config.ts`).
54
+ * @param configOrBuilder - The project's `PanelConfig`, or a `(mode) =>
55
+ * PanelConfig` builder for mode-scoped rebuilds. DATA stays project-side in
56
+ * `src/config/design-token-panel-config.ts`.
37
57
  */
38
- export declare function bootstrapDesignTokenPanel(panelConfig: PanelConfig): void;
58
+ export declare function bootstrapDesignTokenPanel(configOrBuilder: PanelConfig | PanelConfigBuilder): void;
59
+ export {};
@@ -1,28 +1,56 @@
1
- import { configurePanel, setLifecycleAdapter } from "@takazudo/zdtp";
1
+ import {
2
+ configurePanel,
3
+ setLifecycleAdapter,
4
+ showDesignTokenPanel
5
+ } from "@takazudo/zdtp";
2
6
  import {
3
7
  BEFORE_NAVIGATE_EVENT,
4
8
  AFTER_NAVIGATE_EVENT
5
9
  } from "./transitions/page-events.js";
6
- function bootstrapDesignTokenPanel(panelConfig) {
7
- configurePanel(panelConfig);
8
- if (typeof window !== "undefined") {
9
- window.__zdtpReadyClicks?.();
10
+ const COLOR_SCHEME_CHANGED_EVENT = "color-scheme-changed";
11
+ function openStateKey(instancePrefix) {
12
+ return `${instancePrefix}-open`;
13
+ }
14
+ function readMode() {
15
+ return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
16
+ }
17
+ function bootstrapDesignTokenPanel(configOrBuilder) {
18
+ if (typeof window === "undefined" || typeof document === "undefined") {
19
+ return;
10
20
  }
11
- if (typeof document !== "undefined") {
12
- const adapter = {
13
- onBeforeSwap(cb) {
14
- const handler = () => cb();
15
- document.addEventListener(BEFORE_NAVIGATE_EVENT, handler);
16
- return () => document.removeEventListener(BEFORE_NAVIGATE_EVENT, handler);
17
- },
18
- onPageLoad(cb) {
19
- const handler = () => cb();
20
- document.addEventListener(AFTER_NAVIGATE_EVENT, handler);
21
- return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handler);
22
- }
23
- };
24
- setLifecycleAdapter(adapter);
21
+ const isBuilder = typeof configOrBuilder === "function";
22
+ const builder = isBuilder ? configOrBuilder : () => configOrBuilder;
23
+ let handle = configurePanel(builder(readMode()));
24
+ if (isBuilder) {
25
+ let pendingMode = readMode();
26
+ let timer = null;
27
+ window.addEventListener(COLOR_SCHEME_CHANGED_EVENT, () => {
28
+ pendingMode = readMode();
29
+ if (timer !== null) return;
30
+ timer = setTimeout(() => {
31
+ timer = null;
32
+ const mode = pendingMode;
33
+ const wasOpen = localStorage.getItem(openStateKey(handle.instanceId)) === "1";
34
+ handle.destroy();
35
+ handle = configurePanel(builder(mode));
36
+ if (wasOpen) showDesignTokenPanel();
37
+ }, 0);
38
+ });
25
39
  }
40
+ window.__zdtpReadyClicks?.();
41
+ const adapter = {
42
+ onBeforeSwap(cb) {
43
+ const handler = () => cb();
44
+ document.addEventListener(BEFORE_NAVIGATE_EVENT, handler);
45
+ return () => document.removeEventListener(BEFORE_NAVIGATE_EVENT, handler);
46
+ },
47
+ onPageLoad(cb) {
48
+ const handler = () => cb();
49
+ document.addEventListener(AFTER_NAVIGATE_EVENT, handler);
50
+ return () => document.removeEventListener(AFTER_NAVIGATE_EVENT, handler);
51
+ }
52
+ };
53
+ setLifecycleAdapter(adapter);
26
54
  }
27
55
  export {
28
56
  bootstrapDesignTokenPanel
package/dist/safelist.css CHANGED
@@ -1,2 +1,2 @@
1
1
  /* generated by gen-safelist.mjs โ€” do not edit by hand */
2
- @source inline("-link -mb-px -ml-hsp-sm -noscript -translate-x-full 2xl:w-[24px] [&::-webkit-details-marker]:hidden [&_a]:text-accent [&_a]:underline [&_nav]:mb-0 [data-admonition] [data-kbd-shortcut] [doc-history-meta] [doc-history] [doc-layout] [llms-txt] a a2 abbr about above absent absolute accent across activated active actual added admonition admonition- admonition-body admonition-title admonition/callout after after-breadcrumb after-content after-navigate after-sidebar after-title against agent agents ai-chat ai-chat-md ai-chat-trigger alert align-top all allow-same-origin allow-scripts alone already already-executed already-picked an anchor anchored and and/or animate-spin announce antialiased any application/json application/xml applies apply-css-vars approach are area arg aria-atomic aria-busy aria-controls aria-current aria-disabled aria-expanded aria-haspopup aria-hidden aria-label aria-live aria-orientation aria-pressed aria-selected aria-valuemax aria-valuemin aria-valuenow arm arms arrows article as asc aside aspect-[1200/630] aspect-square asset- assets assistant async at attach attribute attributes auto autogenerated available avoid await away b back backdrop:bg-bg/30 backdrop:bg-bg/80 backdrop:bg-overlay/60 backdrop:z-modal-backdrop background background-color backtick backticks baked banner bare base base64 based batch be because before below best between bg bg-[#fff] bg-accent bg-bg bg-chat-assistant-bg bg-chat-user-bg bg-code-bg bg-fg bg-info/10 bg-info/5 bg-muted bg-overlay/30 bg-surface bg-transparent bg-warning/10 bg-warning/5 bi bigint bin blank blanks blob block blockquote blocks blur body body-end-components body-end-scripts bold boolean bootstrap border border-accent border-b border-b-2 border-b-[5px] border-bg/30 border-collapse border-danger border-dashed border-fg border-info/30 border-l border-l-0 border-l-[3px] border-left-width border-muted border-none border-r border-radius border-solid border-t border-t-[2px] border-t-[3px] border-transparent border-warning/30 border-width border-y both bottom-vsp-xl box-border br brand breadcrumb:end breadcrumb:start break-words browser browsers btn bug build bundler but button buttons by bypassed byte-identical bytes cached call caller calls can cancellation cannot canonical canvas caption card card-grid carry cases cat-nav- catch category catppuccin-latte caught caution center center/contain ch chains change changed changes checkbox child chrome ci circle cite class class-less claude claude-agents claude-commands claude-md claude-skills cleaned clear clear-css-vars clearing click client client-router client-side clip clobbering close closed closing code code-block-sr-announce code-group code-group-panel col col-resize colgroup collision color color-scheme color-scheme-changed color-scheme-provider color-tweak colorization colors column comma command commands comment commit compare component component:github-link component:language-switcher component:search component:theme-toggle component:version-switcher compute computed concrete configuration configure configured confuse connect const construction consumer consumes container containers containing content content-admonition content-link content-type content-wrapper:end content-wrapper:start contents context controller controls converts copy corners correct correctly corrupt count covered covers cp crashes created cross-component crumb- cs css ctx cur current cursor cursor-not-allowed cursor-pointer custom danger dark data data-active data-admonition data-base data-close-search data-current-locale data-default-locale data-group-id data-header data-header-logo data-header-nav data-header-right data-kbd-shortcut data-language-switcher data-loading-index data-mermaid-enlarge-ready data-mermaid-rendered data-mermaid-src data-nav-active data-nav-item data-nav-item-dropdown data-nav-more data-nav-more-menu data-nav-more-toggle data-no-results data-open-search data-pan-active data-processed data-result-count-template data-search-count data-search-count-narrow data-search-dialog data-search-input data-search-placeholder data-search-results data-search-unavailable data-sidebar-hidden data-sidebar-resizer data-site-nav data-tab-btn data-tab-default data-tab-label data-tab-value data-tabs data-taglist-group data-testid data-theme data-theme/style data-trailing-slash data-variant data-version-banner data-version-latest data-version-menu data-version-rewire data-version-slug data-version-switcher data-version-toggle data-version-trigger-label data-zd-nosidebar data-zd-toc data-zfb-transition-persist dd decimal declare decoration decoration-muted default defaults del delegated dependency depth desc description design design-token-panel design-token-trigger desktop desktop-sidebar desktop-sidebar-toggle desktop-sidebar-toggle-island destructive detach detached details deterministic develop dfn diagram diagrams dialog dieser diff diff-line-added diff-line-content diff-line-empty diff-line-num diff-line-removed diff-row dir directly directories directory disabled disabled:opacity-50 disc display:none dist distinct div dl do doc doc-card- doc-content-band doc-history doc-history-generate doc-history-panel doc-history-trigger doc-page doc-pager doc-prose doc-title docs docs- docs-v- document document-level documented does double-registration drag draggable drop dropdown dropdown-child dropdown-parent dropdowns dt duration-150 duration-200 during dynamically e2e each ease-in-out edge eject ejected el element elements els else em embedded emit emitting empty empty/undefined en enable end enlarged entire entities entries entry error escape escaped even eventually every exactly excerpt excludes existing exists exit expected export extends factories failed fall fallback fallbacks falls false family fast feature feed fg fields fieldset figcaption figure file fill fills finally find fire fires first fixed fixed-width fixtures flag flash flat flex flex-1 flex-col flex-wrap flip flipping flips flush-left focus focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2 focus-visible:underline focus:border-accent focus:outline-none focus:underline font font-bold font-family font-medium font-mono font-semibold font-weight footer footer- for form found free fresh from frontmatter frontmatter-preview frozen fs-extra full fully function further g gap-[0.3em] gap-[clamp(1.5rem,3vw,4rem)] gap-hsp-2xs gap-hsp-md gap-hsp-sm gap-hsp-xl gap-hsp-xs gap-vsp-2xs gap-vsp-lg gap-vsp-md gap-vsp-xs gap-x-hsp-2xs gap-x-hsp-lg gap-x-hsp-md gap-x-hsp-sm gap-x-hsp-xs gap-y-vsp-2xs gap-y-vsp-lg gap-y-vsp-md gap-y-vsp-xs gaps gate generate generation genuine geometry get github github-link go got graph gray-matter grid grid-cols-1 grid-cols-2 group group-focus-visible:text-accent group-focus-visible:underline group-focus-within:block group-hover:bg-fg group-hover:block group-hover:text-accent group-hover:text-bg group-hover:underline group-open:rotate-90 guard h-[0.5rem] h-[0.625rem] h-[0.875rem] h-[1.125rem] h-[1.25rem] h-[1.575rem] h-[14px] h-[1em] h-[1lh] h-[2rem] h-[3.5rem] h-[3rem] h-[90vh] h-[calc(100%-3rem)] h-[calc(100vh-3.5rem)] h-dvh h-full h-icon-lg h-icon-md h-icon-sm h-icon-xs h1 h1s h2 h2s h3 h4 h5 h6 half hand hand-copied handle handled handler handlers has hash-link have head head-links head-scripts header header- header-call:end header-call:start heading heading-h2 heading-h3 heading-h4 headings height here hex hidden highlight highlighter history hit horizontal host hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)] hover:bg-accent-hover hover:bg-accent/10 hover:bg-surface hover:border-accent hover:border-accent-hover hover:border-fg hover:text-accent hover:text-accent-hover hover:text-fg hover:underline hr href hrefs html i i18n/theme. i2 i3 i4 icon identical idle idx if iframe image image-enlarge image/png img implementation import important imports in inactive inbox includes index info inherit inherited initial initialised injected inline inline-block inline-flex inner input input-clear ins inset-0 inside install instance instanceof instead instructions intended intent into invalid inverse inversion invoke is issues it italic item item- items items-baseline items-center items-start its itself javascript justify-between justify-center justify-end justify-start katex kbd keep keeps kept keyboard keyboard-shortcut keydown keystroke keywords khroma label landing language-switcher last:border-b-0 later launch layout leading-relaxed leading-snug leading-tight leaf- leak leaves leaving left left-0 left:calc legend legitimate letter-spacing lg lg:block lg:border lg:border-fg lg:border-solid lg:flex lg:flex-col lg:flex-row lg:gap-hsp-xl lg:grid-cols-[repeat(auto-fit,minmax(12rem,1fr))] lg:h-[90vh] lg:hidden lg:justify-start lg:m-auto lg:max-h-[90vh] lg:max-w-[52.5rem] lg:ml-[var(--zd-sidebar-w)] lg:pt-vsp-2xl lg:px-hsp-2xl lg:py-vsp-2xl lg:text-left lg:w-[90vw] lg:w-[clamp(16rem,25%,22rem)] li li2 library light like likely line linger link link- links list-disc list-none listener literal literals lives llms llms-txt load local locale locales log longest-match look lostpointercapture lower luminance m m-0 m21 m6 main make malformed malicious maps mark marks matches matching math math-display math-inline max max-h-[80vh] max-h-[85vh] max-h-[90vh] max-h-full max-h-none max-w-[46rem] max-w-[85%] max-w-[85vw] max-w-[90vw] max-w-[clamp(50rem,75vw,90rem)] max-w-full max-w-none max-width may mb-0 mb-vsp-2xs mb-vsp-lg mb-vsp-md mb-vsp-sm mb-vsp-xl mb-vsp-xs measures measuring mechanism menu merged mermaid message messages meta meta-knob metadata migration min-h-[60vh] min-h-[calc(100vh-3.5rem)] min-h-screen min-w-0 min-w-[10rem] min-w-[8rem] mirror mirrors missing ml-auto ml-hsp-2xl ml-hsp-lg ml-hsp-sm ml-hsp-xl mod mode module mounted mouseenter mouseleave mr-hsp-sm mt-0 mt-vsp-2xl mt-vsp-2xs mt-vsp-3xs mt-vsp-lg mt-vsp-md mt-vsp-sm mt-vsp-xl must mutates mutation mutations mx-auto my-vsp-lg my-vsp-md name named native nav nav-active nav-card- nav/doc navigating navigation navigations near needs nested new newly-swapped next no no-enlarge no-op no-repeat no-underline node node:buffer node:fs node:fs/promises node:module node:path nodes nofollow noindex non-empty non-light-dark non-persisted non-string none noopener noreferrer normal noscript not not-object note now null number numeric object object-contain observe observer occurred of off og:description og:image og:image:alt og:image:height og:image:width og:title og:type og:url ol old older on once one only onto opacity-60 open open/close option or original other others out outline-none over overflow overflow-auto overflow-hidden overflow-x-auto overflow-y-auto overflow-y:auto overwrite own p p-0 p-hsp-lg p-hsp-md p-hsp-sm p-hsp-xl package package-owned packages padding page page-loading page-loading-overlay page-loading-spinner page-navigate-end page-title pages pages/. paint paint-and-read pan panel panels paren-balance-aware parent parse parsed pass passed passes path paths pattern pb-[50vh] pb-vsp-md pb-vsp-xl pb-vsp-xs per per-link permanently persisted pi pick picked picks picocolors pins pipelines pl-[1.25rem] pl-hsp-lg pl-hsp-sm pl-hsp-xl place placeholder placeholder:text-muted plain plural plus pnpm pointer-events-none pointercancel pointerdown pointermove pointerup polite polygon polyline populates port position position:fixed pr-[4px] pr-hsp-lg pr-hsp-md pr-hsp-sm pr-hsp-xl pre pre-lowercased preact preact/compat preact/hooks preact/jsx-runtime preconnect prefix preload pres preserving print produce produced produces production project project-root-relative properties property props prose provided proxy pt-[0.15rem] pt-[2px] pt-vsp-3xs pt-vsp-md pt-vsp-sm pt-vsp-xl pt-vsp-xs ptag- public purely px px-hsp-2xl px-hsp-2xs px-hsp-lg px-hsp-md px-hsp-sm px-hsp-xl px-hsp-xs py-0 py-[2px] py-[calc(var(--spacing-vsp-xs)+0.15rem)] py-hsp-2xs py-hsp-sm py-hsp-xs py-vsp-2xs py-vsp-3xs py-vsp-lg py-vsp-md py-vsp-sm py-vsp-xl py-vsp-xs q query question r radius raw re-encode/decode re-querying re-render re-renders re-run re-running re-selects reach reached reaches read reading ready real real-value received receives recorded recovers redefine ref- references refetch refreshes regenerate regenerates regex reinit reinits relative reload relying remove removed render rendered renders reorder repaint repeated repeating replaced replaces repopulate requires reserved resize resize-x resolve resolved resolves response restore restores result result-click results results-area retry return returns revision revisions rewrite right right- right-0 ro robots role root rotate-180 rotate-90 round round-trip rounded rounded-[0.75rem] rounded-bl-[0.25rem] rounded-bl-[1rem] rounded-br-[0.25rem] rounded-br-[1rem] rounded-full rounded-lg rounded-t-[1rem] rounds route router routes routes-src running runs runtime s safe safer same same-locale samp scale scanned schema-mismatch schema-missing scheme scored script script- script-eval script-evaluation script-injection scripts scroll scrollbar scrolled scrollend search search-index section section- see sel-bg sel-fg select select-none self self-start semibold sentinel separator serialised serialize server server-rendered set sets setting setup shadow-[0_1px_3px_color-mix(in_srgb,var(--color-fg)_8%,transparent)] shadow-lg shape share shared sharing shiki ship shipped ships short shortcut should show shown shrink-0 sidebar sidebar- sidebar-toggle-island sidebar-tree-island signal similarity single singular site-search site-tree-nav-island sitemap- sites size skill skills skipping skips slash slug sm:border sm:border-muted sm:flex-row sm:grid-cols-2 sm:h-auto sm:items-center sm:justify-between sm:max-h-[80vh] sm:max-w-[52rem] sm:mx-auto sm:my-[10vh] sm:rounded-lg small smooth snapshot snapshots so soft soft-nav solid some somehow source sources space-y-vsp-2xs spacing span spans spec specifier specifiers splitter square sr-only src stale start state status stay staying sticky still stop stored stray string strings strip stripe stroke-linecap stroke-linejoin stroke-width strong stronger style style-attribute styled styles stylesheet sub subagents subsequent success successful summary sup surfaces survives svg swap swapped swaps synchronous synchronously syntactically syntect t tab tab-item tab-panel tabindex table tablist tabpanel tabs tabs-container tabs-content tabs-nav tag tag- tag-item- tags tags:audit take tbody td temp-element template temporary temporary-element terminal terms test-results tested text text-accent text-bg text-body text-caption text-center text-chat-assistant-text text-chat-user-text text-code-fg text-danger text-decoration text-display text-fg text-heading text-info text-left text-micro text-muted text-muted/50 text-right text-small text-title text-warning text/plain textarea tfoot th that the thead their them theme theme-color theme-toggle theme/token then there these they this through throw tighten time tip title to toc toggle toggle-ai-chat toggle-design-token-panel toggles token tokens tolerates too toolbar top-0 top-[3.5rem] top-full top-level total touches tp tr tracked tracking-wider trade-off transition transition-[background,color,border-color] transition-[left,color] transition-colors transition-transform translate-x-0 translations transparent treats tree tree-child- tree-item- tree-top- trigger trigger:ai-chat trigger:design-token-panel triggers true truncate truncated try turn twitter:card twitter:creator twitter:description twitter:image twitter:site twitter:title two type typography u ul unavailable unchanged undefined under underline underlines understand unit-tested unknown unmaintained unobserve unreadable unrelated unreleased unset unsupported up uppercase usage use used user uses utf-8 utf8 utilities utility v v2 val value value-reader values var variable variant verbatim version version- version-menu version-switcher vertical via video viewport virtual:zudo-doc-chrome-bindings virtual:zudo-doc-route-context visible vitesse-dark vocabulary w w-1/2 w-[0.5rem] w-[0.625rem] w-[0.875rem] w-[1.125rem] w-[1.575rem] w-[1.5rem] w-[1.75rem] w-[14px] w-[16px] w-[16rem] w-[18px] w-[1em] w-[280px] w-[2rem] w-[320px] w-[90vw] w-[var(--zd-sidebar-w)] w-dvw w-full w-icon-lg w-icon-md w-icon-sm w-icon-xs want warning was watching wbr wbr- we website weight went were what when where whereas whether which while whitespace-nowrap whitespace-pre whole wide-gamut width will with without word working worktrees would wrap wrapper wrappers written wrong wrote xl:flex xl:hidden y-scrollbar yet you your z-dropdown z-local-1 z-modal z-modal-backdrop z-sidebar z-toolbar zd-content zd-desktop-sidebar-toggle zd-doc-content-band zd-enlarge-btn zd-enlarge-dialog zd-enlarge-dialog-close zd-enlargeable zd-html-preview-code zd-mermaid-dialog zd-mermaid-enlargeable zd-mermaid-tool-btn zd-mermaid-toolbar zd-mermaid-transform zd-mermaid-viewport zd-sidebar-content-wrapper zd-sidebar-open zfb zfb:after-swap zfb:before-preparation zod zoom zudo-doc-design-tokens/v1 zudo-doc-sidebar-visible zudo-doc-sidebar-width zudo-doc-theme zudo-doc-theme-bridge");
2
+ @source inline("-link -mb-px -ml-hsp-sm -noscript -open -translate-x-full 2xl:w-[24px] [&::-webkit-details-marker]:hidden [&_a]:text-accent [&_a]:underline [&_nav]:mb-0 [data-admonition] [data-kbd-shortcut] [doc-history-meta] [doc-history] [doc-layout] [llms-txt] [zudo-doc] a a2 abbr about above absent absolute accent accent:accent- across activated active actual added admonition admonition- admonition-body admonition-title admonition/callout after after-breadcrumb after-content after-navigate after-sidebar after-title against agent agents ai-chat ai-chat-md ai-chat-trigger alert align-top all allow-same-origin allow-scripts alone already already-executed already-picked an anchor anchored and and/or animate-spin announce antialiased any application/json application/xml applies apply-css-vars approach are area arg aria-atomic aria-busy aria-controls aria-current aria-disabled aria-expanded aria-haspopup aria-hidden aria-label aria-live aria-orientation aria-pressed aria-selected aria-valuemax aria-valuemin aria-valuenow arm arms array arrows article as asc aside aspect-[1200/630] aspect-square asset- assets assistant async at attach attribute attributes auto autogenerated available avoid await away b back backdrop:bg-bg/30 backdrop:bg-bg/80 backdrop:bg-overlay/60 backdrop:z-modal-backdrop background background-color backtick backticks baked banner bare base base64 base:base- based baseline batch be because before below best between bg bg-[#fff] bg-accent bg-bg bg-chat-assistant-bg bg-chat-user-bg bg-code-bg bg-fg bg-info/10 bg-info/5 bg-muted bg-overlay/30 bg-surface bg-transparent bg-warning/10 bg-warning/5 bi bigint bin blank blanks blob block blockquote blocks blur body body-end-components body-end-scripts bold boolean bootstrap border border-accent border-b border-b-2 border-b-[5px] border-bg/30 border-collapse border-danger border-dashed border-fg border-info/30 border-l border-l-0 border-l-[3px] border-left-width border-muted border-none border-r border-radius border-solid border-t border-t-[2px] border-t-[3px] border-transparent border-warning/30 border-width border-y both bottom-vsp-xl box-border br brand breadcrumb:end breadcrumb:start break-words browser browsers btn bug build bundler but button buttons by bypassed byte-identical bytes cached call caller calls can cancellation cannot canonical canvas caption card card-grid carry cases cat-nav- catch category catppuccin-latte caught caution center center/contain ch chains change changed changes checkbox child chrome ci circle cite class class-less claude claude-agents claude-commands claude-md claude-skills cleaned clear clear-css-vars clearing click client client-router client-side clip clobbering close closed closing code code-block-sr-announce code-group code-group-panel col col-resize colgroup collision color color-scheme color-scheme-changed color-scheme-provider color-tweak colorization colors column comma command commands comment commit compare component component:github-link component:language-switcher component:search component:theme-toggle component:version-switcher compute computed concrete configuration configure configured confuse connect const construction consumer consumes container containers containing content content-admonition content-link content-type content-wrapper:end content-wrapper:start contents context controller controls converts copy corners correct correctly corrupt count covered covers cp crashes created cross-component crumb- cs css ctx cur current cursor-not-allowed cursor-pointer custom danger dark data data-active data-admonition data-base data-close-search data-current-locale data-default-locale data-group-id data-header data-header-logo data-header-nav data-header-right data-kbd-shortcut data-language-switcher data-loading-index data-mermaid-enlarge-ready data-mermaid-rendered data-mermaid-src data-nav-active data-nav-item data-nav-item-dropdown data-nav-more data-nav-more-menu data-nav-more-toggle data-no-results data-open-search data-pan-active data-processed data-result-count-template data-search-count data-search-count-narrow data-search-dialog data-search-input data-search-placeholder data-search-results data-search-unavailable data-sidebar-hidden data-sidebar-resizer data-site-nav data-tab-btn data-tab-default data-tab-label data-tab-value data-tabs data-taglist-group data-testid data-theme data-theme/style data-trailing-slash data-variant data-version-banner data-version-latest data-version-menu data-version-rewire data-version-slug data-version-switcher data-version-toggle data-version-trigger-label data-zd-nosidebar data-zd-toc data-zfb-transition-persist dd decimal declare decoration decoration-muted default defaults del delegated dependency depth desc description design design-token design-token-panel design-token-trigger desktop desktop-sidebar desktop-sidebar-toggle desktop-sidebar-toggle-island destructive detach detached details detected deterministic develop dfn diagram diagrams dialog dieser diff diff-line-added diff-line-content diff-line-empty diff-line-num diff-line-removed diff-row dir directly directories directory disabled disabled:opacity-50 disc display:none dist distinct div dl do doc doc-card- doc-content-band doc-history doc-history-generate doc-history-panel doc-history-trigger doc-page doc-pager doc-prose doc-title docs docs- docs-v- document document-level documented does double-registration drag draggable drop dropdown dropdown-child dropdown-parent dropdowns dt duration-150 duration-200 during dynamically e2e each ease-in-out edge eject ejected el element elements els else em embedded emit emitting empty empty/undefined en enable end enlarged entire entities entries entry error escape escaped even eventually every exactly excerpt excludes existing exists exit expected export extends factories failed faithful fall fallback fallbacks falls false family fast feature feed fg fields fieldset figcaption figure file fill fills finally find fire fires first fixed fixed-width fixtures flag flash flat flex flex-1 flex-col flex-wrap flip flipping flips flush-left focus focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2 focus-visible:underline focus:border-accent focus:outline-none focus:underline font font-bold font-family font-medium font-mono font-semibold font-weight footer footer- for form found free fresh from frontmatter frontmatter-preview frozen fs-extra full fully function further g gap-[0.3em] gap-[clamp(1.5rem,3vw,4rem)] gap-hsp-2xs gap-hsp-md gap-hsp-sm gap-hsp-xl gap-hsp-xs gap-vsp-2xs gap-vsp-lg gap-vsp-md gap-vsp-xs gap-x-hsp-2xs gap-x-hsp-lg gap-x-hsp-md gap-x-hsp-sm gap-x-hsp-xs gap-y-vsp-2xs gap-y-vsp-lg gap-y-vsp-md gap-y-vsp-xs gaps gate generate generation genuine geometry get github github-link go got graph gray-matter grid grid-cols-1 grid-cols-2 group group-focus-visible:text-accent group-focus-visible:underline group-focus-within:block group-hover:bg-fg group-hover:block group-hover:text-accent group-hover:text-bg group-hover:underline group-open:rotate-90 guard h-[0.5rem] h-[0.625rem] h-[0.875rem] h-[1.125rem] h-[1.25rem] h-[1.575rem] h-[14px] h-[1em] h-[1lh] h-[2rem] h-[3.5rem] h-[3rem] h-[90vh] h-[calc(100%-3rem)] h-[calc(100vh-3.5rem)] h-dvh h-full h-icon-lg h-icon-md h-icon-sm h-icon-xs h1 h1s h2 h2s h3 h4 h5 h6 half hand hand-copied handle handled handler handlers has hash-link have head head-links head-scripts header header- header-call:end header-call:start heading heading-h2 heading-h3 heading-h4 headings height here hex hidden highlight highlighter history hit horizontal host hover:bg-[color-mix(in_srgb,var(--color-surface)_80%,var(--color-fg)_20%)] hover:bg-accent-hover hover:bg-accent/10 hover:bg-surface hover:border-accent hover:border-accent-hover hover:border-fg hover:text-accent hover:text-accent-hover hover:text-fg hover:underline hr href hrefs html i i18n/theme. i2 i3 i4 icon identical idle idx if iframe image image-enlarge image/png img implementation import important imports in inactive inbox includes index info inherit inherited initial initialised injected inline inline-block inline-flex inner input input-clear ins inset-0 inside install instance instanceof instead instructions intended intent into invalid inverse inversion invoke is issues it italic item item- items items-baseline items-center items-start its itself javascript justify-between justify-center justify-end justify-start katex kbd keep keeps kept keyboard keyboard-shortcut keydown keystroke keywords khroma label landing language-switcher last:border-b-0 later launch layout leading-relaxed leading-snug leading-tight leaf- leak leaves left left-0 left:calc legend legitimate letter-spacing lg lg:block lg:border lg:border-fg lg:border-solid lg:flex lg:flex-col lg:flex-row lg:gap-hsp-xl lg:grid-cols-[repeat(auto-fit,minmax(12rem,1fr))] lg:h-[90vh] lg:hidden lg:justify-start lg:m-auto lg:max-h-[90vh] lg:max-w-[52.5rem] lg:ml-[var(--zd-sidebar-w)] lg:pt-vsp-2xl lg:px-hsp-2xl lg:py-vsp-2xl lg:text-left lg:w-[90vw] lg:w-[clamp(16rem,25%,22rem)] li li2 library light like likely line linger link link- links list-disc list-none listener literal literals lives llms llms-txt load local locale locales log longest-match look lostpointercapture lower luminance m m-0 m21 m6 main make malformed malicious maps mark marks matches matching math math-display math-inline max max-h-[80vh] max-h-[85vh] max-h-[90vh] max-h-full max-h-none max-w-[46rem] max-w-[85%] max-w-[85vw] max-w-[90vw] max-w-[clamp(50rem,75vw,90rem)] max-w-full max-w-none max-width may mb-0 mb-vsp-2xs mb-vsp-lg mb-vsp-md mb-vsp-sm mb-vsp-xl mb-vsp-xs measures measuring mechanism menu merged mermaid message messages meta meta-knob metadata migration min-h-[60vh] min-h-[calc(100vh-3.5rem)] min-h-screen min-w-0 min-w-[10rem] min-w-[8rem] mirror mirrors missing ml-auto ml-hsp-2xl ml-hsp-lg ml-hsp-sm ml-hsp-xl mod mode module mounted mouseenter mouseleave mr-hsp-sm mt-0 mt-vsp-2xl mt-vsp-2xs mt-vsp-3xs mt-vsp-lg mt-vsp-md mt-vsp-sm mt-vsp-xl must mutates mutation mutations muted mx-auto my-vsp-lg my-vsp-md name named native nav nav-active nav-card- nav/doc navigating navigation navigations near needs nested new newly-swapped next no no-enlarge no-op no-repeat no-underline node node:buffer node:fs node:fs/promises node:module node:path nodes nofollow noindex non-empty non-light-dark non-persisted none noopener noreferrer normal noscript not not-object note now null number numeric object object-contain observe observer occurred of off og:description og:image og:image:alt og:image:height og:image:width og:title og:type og:url oklch ol old older on once one only onto opacity-60 open open/close option or original other others out outline-none over overflow overflow-auto overflow-hidden overflow-x-auto overflow-y-auto overflow-y:auto overwrite own p p-0 p-hsp-lg p-hsp-md p-hsp-sm p-hsp-xl package package-owned packages padding page page-loading page-loading-overlay page-loading-spinner page-navigate-end page-title pages pages/. paint paint-and-read palette pan panel panels paren-balance-aware parent parse parsed pass passed passes path paths pattern pb-[50vh] pb-vsp-md pb-vsp-xl pb-vsp-xs per per-link permanently persisted pi pick picked picks picocolors pins pipelines pl-[1.25rem] pl-hsp-lg pl-hsp-sm pl-hsp-xl place placeholder placeholder:text-muted plain plural plus pnpm pointer-events-none pointercancel pointerdown pointermove pointerup polite polygon polyline populates port position position:fixed pr-[4px] pr-hsp-lg pr-hsp-md pr-hsp-sm pr-hsp-xl pre pre-lowercased preact preact/compat preact/hooks preact/jsx-runtime preconnect prefix preload pres preserving print produce produced produces production project project-root-relative properties property props prose provided proxy pt-[0.15rem] pt-[2px] pt-vsp-3xs pt-vsp-md pt-vsp-sm pt-vsp-xl pt-vsp-xs ptag- public purely px px-hsp-2xl px-hsp-2xs px-hsp-lg px-hsp-md px-hsp-sm px-hsp-xl px-hsp-xs py-0 py-[2px] py-[calc(var(--spacing-vsp-xs)+0.15rem)] py-hsp-2xs py-hsp-sm py-hsp-xs py-vsp-2xs py-vsp-3xs py-vsp-lg py-vsp-md py-vsp-sm py-vsp-xl py-vsp-xs q query question r radius ramp range raw re-encode/decode re-querying re-render re-renders re-run re-running re-selects reach reached reaches read reading ready real real-value received receives recorded recovers redefine ref- references refetch refreshes regenerate regenerates regex reinit reinits relative reload relying remove removed render rendered renders reorder repaint repeated repeating replaced replaces repopulate requires reserved reset resize resize-x resolve resolved resolves response restore restores result result-click results results-area retry return returns revision revisions rewrite right right- right-0 ro robots role roles root rotate-180 rotate-90 round round-trip rounded rounded-[0.75rem] rounded-bl-[0.25rem] rounded-bl-[1rem] rounded-br-[0.25rem] rounded-br-[1rem] rounded-full rounded-lg rounded-t-[1rem] rounds route router routes routes-src running runs runtime s safe safer same same-locale samp scale scanned schema-mismatch schema-missing scheme scored script script- script-eval script-evaluation script-injection scripts scroll scrollbar scrolled scrollend search search-index section section- see select select-none selection-bg selection-fg self self-start semibold sentinel separator serialised serialize server server-rendered set sets setting setup shadow-[0_1px_3px_color-mix(in_srgb,var(--color-fg)_8%,transparent)] shadow-lg shape share shared sharing shiki ship shipped ships short shortcut should show shown shrink-0 sidebar sidebar- sidebar-toggle-island sidebar-tree-island signal similarity single singular site-search site-tree-nav-island sitemap- sites size skill skills skipping skips slash slug sm:border sm:border-muted sm:flex-row sm:grid-cols-2 sm:h-auto sm:items-center sm:justify-between sm:max-h-[80vh] sm:max-w-[52rem] sm:mx-auto sm:my-[10vh] sm:rounded-lg small smooth snapshot snapshots so soft soft-nav solid some somehow source sources space-y-vsp-2xs spacing span spans spec specifier specifiers splitter square sr-only src stale start state state:state- status stay staying sticky still stop stored stray string strings strip stripe stroke-linecap stroke-linejoin stroke-width strong stronger style style-attribute styled styles stylesheet sub subagents subsequent success successful summary sup surface surfaces survives svg swap swapped swaps synchronous synchronously syntactically syntect t tab tab-item tab-panel tabindex table tablist tabpanel tabs tabs-container tabs-content tabs-nav tag tag- tag-item- tags tags:audit take tbody td temp-element template temporary temporary-element terminal terms test-results tested text text-accent text-bg text-body text-caption text-center text-chat-assistant-text text-chat-user-text text-code-fg text-danger text-decoration text-display text-fg text-heading text-info text-left text-micro text-muted text-muted/50 text-right text-small text-title text-warning text/plain textarea tfoot th that the thead their them theme theme-color theme-toggle theme/token then there these they this through throw tighten time tip title to toc toggle toggle-ai-chat toggle-design-token-panel toggles token tokens tolerates too toolbar top-0 top-[3.5rem] top-full top-level total touches tp tr tracked tracking-wider trade-off transition transition-[background,color,border-color] transition-[left,color] transition-colors transition-transform translate-x-0 translations transparent treats tree tree-child- tree-item- tree-top- trigger trigger:ai-chat trigger:design-token-panel triggers true truncate truncated try turn twitter:card twitter:creator twitter:description twitter:image twitter:site twitter:title two type typography u ul unavailable unchanged undefined under underline underlines understand unit-tested unknown unmaintained unobserve unreadable unrelated unreleased unset up uppercase usage use used user uses utf-8 utf8 utilities utility v v1 v2 val valid value value-reader values var variable variant verbatim version version- version-menu version-switcher vertical via video viewport virtual:zudo-doc-chrome-bindings virtual:zudo-doc-route-context visible vitesse-dark vocabulary w w-1/2 w-[0.5rem] w-[0.625rem] w-[0.875rem] w-[1.125rem] w-[1.575rem] w-[1.5rem] w-[1.75rem] w-[14px] w-[16px] w-[16rem] w-[18px] w-[1em] w-[280px] w-[2rem] w-[320px] w-[90vw] w-[var(--zd-sidebar-w)] w-dvw w-full w-icon-lg w-icon-md w-icon-sm w-icon-xs want warning was watching wbr wbr- we website weight went were what when where whereas whether which while whitespace-nowrap whitespace-pre whole wide-gamut width will with without word working worktrees would wrap wrapper wrappers written wrong wrote xl:flex xl:hidden y-scrollbar yet you your z-dropdown z-local-1 z-modal z-modal-backdrop z-sidebar z-toolbar zd-content zd-desktop-sidebar-toggle zd-doc-content-band zd-enlarge-btn zd-enlarge-dialog zd-enlarge-dialog-close zd-enlargeable zd-html-preview-code zd-mermaid-dialog zd-mermaid-enlargeable zd-mermaid-tool-btn zd-mermaid-toolbar zd-mermaid-transform zd-mermaid-viewport zd-sidebar-content-wrapper zd-sidebar-open zfb zfb:after-swap zfb:before-preparation zod zoom zudo-doc-design-tokens/v1 zudo-doc-design-tokens/v2 zudo-doc-design-tokens/v3 zudo-doc-sidebar-visible zudo-doc-sidebar-width zudo-doc-theme zudo-doc-theme-bridge");
@@ -6,7 +6,50 @@
6
6
  * spacing, font, size) so an AI assistant can consume or emit a whole
7
7
  * design-token tweak in one round-trip.
8
8
  *
9
- * Format: `$schema = "zudo-doc-design-tokens/v1"`.
9
+ * Format: `$schema = "zudo-doc-design-tokens/v3"`.
10
+ *
11
+ * v3 color slice โ€” ramp-native, minimized (Color Ramp Restructure,
12
+ * zudolab/zudo-doc#2584 / #2591; minimized to 5/3 in #2602)
13
+ * -----------------------------------------------------------------------------------
14
+ * The color block is the ramp-native `ColorScheme` from `color-scheme-utils.ts`:
15
+ * - `ramps` โ€” the shared Tier-1 source of truth (`base[5]`, `accent[3]`,
16
+ * `state{danger,success,warning,info}`), emitted verbatim as OKLCH strings.
17
+ * - `map` โ€” the per-mode Tier-2 wiring (`bg`/`fg`/`selectionBg`/`selectionFg`
18
+ * + 23 `semantic` roles), each a `RampRef` (`{base:n}` / `{accent:n}` /
19
+ * `{state:role}` / a literal OKLCH string).
20
+ *
21
+ * The legacy v1 color slice (`palette: string[16]`, numeric `base`, `cursor`,
22
+ * `semanticMappings`) is gone. Both `ramps` and `map` are plain JSON data, so
23
+ * the color block is essentially a serialized `ColorScheme`.
24
+ *
25
+ * v1 โ†’ v3 migration (RESET, not remap)
26
+ * ------------------------------------
27
+ * A persisted v1 payload (detected by `$schema === "โ€ฆ/v1"`, a `palette` array,
28
+ * or a numeric `base` block) has NO faithful mapping to the new model: the old
29
+ * 16-slot ghostty palette + numeric semantic indices do not correspond to the
30
+ * 5-base / 3-accent / 4-state ramps + `RampRef` wiring. Any remap would invent
31
+ * colors and mislead the user, so `deserialize` RESETS the color slice to the
32
+ * caller-supplied baseline (the current default scheme) and emits a
33
+ * `console.warn` + a `warnings[]` entry โ€” no throw, no blank screen. The
34
+ * spacing/font/size slices are format-compatible across v1/v3 and are preserved.
35
+ *
36
+ * v2 โ†’ v3 migration (RESET, schema-label-only โ€” zudolab/zudo-doc#2599)
37
+ * ---------------------------------------------------------------------
38
+ * `v2` was the ramp-native label BEFORE the base-12/accent-7 โ†’ base-5/accent-3
39
+ * minimize (#2602); the shape (`ramps` + `map` of `RampRef`s) never changed, only
40
+ * the ramp lengths did. That means a `v2`-labeled payload is ambiguous in a way
41
+ * `v1` never was: `parseRamps` catches a wrong-length `ramps.base`/`ramps.accent`
42
+ * array and falls back to baseline, but `parseMap`'s `RampRef` parser only
43
+ * shape-checks a numeric index (`{base:11}`) โ€” it does NOT range-check it against
44
+ * the ramp length, because that tolerance is also relied on by legitimate
45
+ * already-5/3 round-trip exports (see the `{accent:5}`-style fixtures in the test
46
+ * file). So an out-of-range ref alone can't tell a genuinely-stale pre-5/3 export
47
+ * apart from an intentionally-tolerated current-shape ref โ€” both look identical
48
+ * once parsed. Rather than guess from ref values, `v2` is retired as a whole:
49
+ * ANY payload still carrying the `v2` label (regardless of whether its arrays
50
+ * happen to already be 5/3-shaped) is treated as legacy and RESET to baseline,
51
+ * exactly like v1. Only payloads relabeled `v3` are trusted to resolve cleanly
52
+ * against the current ramp lengths.
10
53
  *
11
54
  * Diff-only by default
12
55
  * --------------------
@@ -14,7 +57,11 @@
14
57
  * the provided `colorDefaults` (for the color block) and the manifest defaults
15
58
  * (for spacing / font / size). Pass `includeDefaults: true` to dump the full
16
59
  * state instead. The whole-category keys (`color`, `spacing`, `font`, `size`)
17
- * are omitted entirely when nothing in them differs.
60
+ * are omitted entirely when nothing in them differs. For the color block the
61
+ * `ramps` and `map` sub-blocks are each emitted whole (not per-stop / per-role
62
+ * diffed) when they differ from the baseline โ€” the ramp-native shape has no
63
+ * stable per-slot index to diff against, and a whole-block emit round-trips
64
+ * cleanly against the same baseline.
18
65
  *
19
66
  * Spacing / font / size keys use CSS variable names (`"--spacing-hsp-md"`) โ€”
20
67
  * the external schema โ€” rather than the internal token id (`"hsp-md"`). This
@@ -42,23 +89,15 @@ interface TokenDef {
42
89
  /** Read-only tokens are displayed but not editable. */
43
90
  readonly?: true;
44
91
  }
45
- import { type ColorTweakState, type TweakState } from "./design-token-types.js";
46
- export declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v1";
47
- /** External JSON value for a base-color / semantic-color entry. */
48
- type ColorSlotValue = number | "bg" | "fg";
49
- export interface DesignTokenJsonColorBase {
50
- bg?: number;
51
- fg?: number;
52
- cursor?: number;
53
- /** Dashed keys mirror the external docs; they are quoted in source. */
54
- "sel-bg"?: number;
55
- "sel-fg"?: number;
56
- }
92
+ import { type TweakState } from "./design-token-types.js";
93
+ import { type ColorScheme, type ModeMap, type Ramps } from "../color-scheme-utils.js";
94
+ export declare const DESIGN_TOKEN_SCHEMA: "zudo-doc-design-tokens/v3";
95
+ /** External JSON color block โ€” a (possibly diff-only) serialized `ColorScheme`.
96
+ * Both sub-blocks are optional: in diff-only output an unchanged `ramps` or
97
+ * `map` is omitted and filled from the baseline on deserialize. */
57
98
  export interface DesignTokenJsonColor {
58
- palette?: string[];
59
- base?: DesignTokenJsonColorBase;
60
- /** Palette-index (or "bg"/"fg") mappings, same keys as `SEMANTIC_DEFAULTS`. */
61
- semantic?: Record<string, ColorSlotValue>;
99
+ ramps?: Ramps;
100
+ map?: ModeMap;
62
101
  }
63
102
  /** External token map keyed by CSS var name. */
64
103
  export type DesignTokenJsonOverrides = Record<string, string>;
@@ -85,14 +124,14 @@ export interface SerializeOptions {
85
124
  /** Token manifest (spacing / font / size arrays) used to compute
86
125
  * diff-only output and resolve CSS-var names. Required. */
87
126
  manifest: DesignTokenManifest;
88
- /** When true, dump full state (all palette entries, all token manifest
127
+ /** When true, dump full state (whole `ramps` + `map`, all token manifest
89
128
  * defaults merged in). Default: diff-only. */
90
129
  includeDefaults?: boolean;
91
- /** Color baseline to diff against โ€” typically the current scheme's initial
92
- * state. Required for meaningful color-diff output; callers that don't have
93
- * it available (e.g. tests without DOM) can omit it and we'll treat the
94
- * whole color block as changed. */
95
- colorDefaults?: ColorTweakState;
130
+ /** Color baseline to diff against โ€” typically the active scheme's initial
131
+ * `ColorScheme`. Required for meaningful color-diff output; callers that
132
+ * don't have it available (e.g. tests without DOM) can omit it and we'll
133
+ * treat the whole color block as changed. */
134
+ colorDefaults?: ColorScheme;
96
135
  /** Override the `exportedAt` stamp (test-only). */
97
136
  now?: () => Date;
98
137
  }
@@ -102,7 +141,7 @@ export interface DeserializeResult {
102
141
  /** CSS var names present in the payload that don't match any known token. */
103
142
  unknownTokens: string[];
104
143
  /** Human-readable errors that did not prevent a state from being produced
105
- * (e.g. "semantic mapping dropped because value isn't a number"). */
144
+ * (e.g. "v1 payload detected; color reset to default"). */
106
145
  warnings: string[];
107
146
  }
108
147
  export interface DeserializeOptions {
@@ -110,12 +149,13 @@ export interface DeserializeOptions {
110
149
  * names back to internal token ids. Required. */
111
150
  manifest: DesignTokenManifest;
112
151
  /** Color baseline used to fill in fields absent from the payload (diff-only
113
- * exports are missing most fields by design). Typically the current
114
- * scheme's initial state. */
115
- colorDefaults?: ColorTweakState;
152
+ * exports are missing most fields by design) and as the reset target for a
153
+ * v1 migration. Typically the active scheme's initial `ColorScheme`. */
154
+ colorDefaults?: ColorScheme;
116
155
  }
117
- /** Thrown when the payload is not a v1 schema object. The error `.reason`
118
- * helps the UI render a precise inline message. */
156
+ /** Thrown when the payload is not a recognized schema object. The error
157
+ * `.reason` helps the UI render a precise inline message. A v1 payload is NOT
158
+ * thrown for โ€” it is migrated (see `deserialize`). */
119
159
  export declare class DesignTokenSchemaError extends Error {
120
160
  readonly reason: "not-object" | "schema-missing" | "schema-mismatch";
121
161
  readonly actualSchema?: unknown;
@@ -131,9 +171,10 @@ export declare function serialize(state: TweakState, opts: SerializeOptions): De
131
171
  /**
132
172
  * Parse a design-token JSON document and lift it back into a tweak state.
133
173
  *
134
- * Throws `DesignTokenSchemaError` on schema mismatch / non-object input. Any
135
- * CSS var name that doesn't match a known manifest entry is collected into
136
- * `unknownTokens` (the caller can surface these as a warning).
174
+ * Throws `DesignTokenSchemaError` on schema mismatch / non-object input. A v1
175
+ * (palette-based) payload is NOT thrown for โ€” its color slice is reset to the
176
+ * baseline default (see the v1โ†’v2 migration note at the top). Any CSS var name
177
+ * that doesn't match a known manifest entry is collected into `unknownTokens`.
137
178
  *
138
179
  * Missing fields fall back to `opts.colorDefaults` (or, absent that, a
139
180
  * minimal neutral default) so the result is always a valid `TweakState`.