@takazudo/zdtp 0.6.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/PORTABLE-CONTRACT.md +17 -7
  3. package/README.md +18 -7
  4. package/dist/apply/build-apply-overrides.d.ts +2 -0
  5. package/dist/astro/host-adapter.js +3 -3
  6. package/dist/astro/index.js +1 -1
  7. package/dist/{autoload-state-CGnis85c.js → autoload-state-CtB0e8mY.js} +1 -1
  8. package/dist/components/color-picker/color-field.d.ts +3 -1
  9. package/dist/components/color-picker/color-picker.d.ts +3 -1
  10. package/dist/components/color-picker/custom-slider.d.ts +2 -1
  11. package/dist/config/cluster-config.d.ts +10 -2
  12. package/dist/dashboard/index.d.ts +2 -1
  13. package/dist/dashboard/index.js +298 -249
  14. package/dist/dashboard/model.d.ts +3 -1
  15. package/dist/dashboard/styles.css +152 -43
  16. package/dist/dashboard/token-dashboard.d.ts +10 -3
  17. package/dist/dashboard/types.d.ts +21 -3
  18. package/dist/import-modal.d.ts +21 -22
  19. package/dist/{index-LYsbHWcy.js → index-BH_IJp9W.js} +2 -2
  20. package/dist/index-blRjSavc.js +12890 -0
  21. package/dist/index.d.ts +5 -3
  22. package/dist/index.js +39 -32
  23. package/dist/mode-dependence-Ci9avNt8.js +61 -0
  24. package/dist/{panel-config-Crn5QJGy.js → panel-config-DKfob-1r.js} +314 -301
  25. package/dist/state/tweak-state.d.ts +17 -7
  26. package/dist/tabs/modes-row.d.ts +39 -0
  27. package/dist/testing.js +2 -2
  28. package/dist/tokens/mode-dependence.d.ts +23 -0
  29. package/dist/tokens/tier-model.d.ts +9 -0
  30. package/dist/{tweak-state-Dzr5kDhX.js → tweak-state-BiaKbhXN.js} +729 -671
  31. package/dist/utils/design-token-serde.d.ts +32 -2
  32. package/dist/utils/resolve-css-color.d.ts +12 -0
  33. package/dist/zdtp.css +1 -1
  34. package/package.json +1 -1
  35. package/dist/index-DWs1XPfy.js +0 -12251
package/CHANGELOG.md CHANGED
@@ -4,6 +4,76 @@ All notable changes to `@takazudo/zdtp` are documented in this file.
4
4
 
5
5
  The format is based on Keep a Changelog, and release notes are generated from the changelog MDX pages.
6
6
 
7
+ ## [Unreleased]
8
+
9
+ No unreleased changes yet.
10
+
11
+ ## [0.8.0] - 2026-09-12
12
+
13
+ ### Breaking Changes
14
+
15
+ - feat(dashboard): render mode-aware token regions (bd8fb6b). Mode-dependent rows now precede independent rows in separate regions. Independent specimens follow `chrome`, while dependent specimens follow `mode`. **Migration**: update custom DOM/CSS integrations to target `.zdtp-dashboard__region`; set both `mode="dark"` and `chrome="dark"` for uniformly dark output, or compose filtered instances with `include="mode-dependent"` and `include="mode-independent"`.
16
+ - feat(dashboard): derive chrome colors from theme inputs (495af9f). The outer root is transparent and derived chrome paints the header and regions. **Migration**: provide any surrounding page background on your wrapper and customize the four inherited `--zdtp-dashboard-light-bg`, `--zdtp-dashboard-light-fg`, `--zdtp-dashboard-dark-bg`, and `--zdtp-dashboard-dark-fg` inputs instead of relying on the former fixed palette.
17
+ - feat(dashboard): model mode dependence per row (d570b9b). Existing top-level `light-dark()` defaults display and emit the selected side in light/dark snapshots; empty inventory groups are omitted. **Migration**: use `mode="host"` when the declaration should remain a browser-selected pair, and read the authored manifest when you need unfiltered source order or empty groups. The internal model helper's positional-mode overload remains available.
18
+ - feat(zdtp): add scoped import modal flow (a8223ba). Load becomes available after JSON analysis. **Migration**: in UI automation, choose **Analyze** or wait for **Import scope**, select the desired tabs/options, and then choose **Load**.
19
+
20
+ ### Features
21
+
22
+ - feat(zdtp): add mode-dependent token helpers (28cceb8)
23
+ - feat(zdtp): add scoped token import analysis and mode mapping (e2ea25a)
24
+ - feat(zdtp): apply manifest color modes across panel lifecycle (08bfb52)
25
+ - feat(zdtp): render and serialize manifest mode rows (2b501bf)
26
+
27
+ Mode pairs are display-only in the panel. Per-mode editing is tracked in [#953](https://github.com/Takazudo/zudo-design-token-panel/issues/953). Diff-only export retains its comparison against `item.default`; use `includeDefaults: true` for a complete export.
28
+
29
+ ### Fixed
30
+
31
+ - fix: preserve current references during single-side imports (87dc04b)
32
+
33
+ ### Other Changes
34
+
35
+ - test: clean up host adapter alias lifecycle (9361c48)
36
+ - test: drain host adapter autoload lifecycle (d8f7f2c)
37
+ - test(dashboard): guard against hostile host styles (070ae9b)
38
+ - test: verify mode pairs on real browser apply targets (def8853)
39
+ - test: align packed dashboard SSR with region chrome (d836407)
40
+ - test: analyze imports in the browser header workflow (50d1953)
41
+ - docs: cover mode-aware dashboard consumers (b2496d6)
42
+ - docs: capture mode-aware dashboard browser evidence (42ca61a)
43
+ - docs(deps): sync vendored zudo-doc scaffold to v5.21.0 ([#937](https://github.com/Takazudo/zudo-design-token-panel/pull/937)) (a7c56e2)
44
+ - docs(deps): sync pin comment, vendored manifest, and doc prose to 0.7.0 ([#936](https://github.com/Takazudo/zudo-design-token-panel/pull/936)) (7966f0b)
45
+ - chore(deps): bump @takazudo/* registry deps to frozen targets ([#936](https://github.com/Takazudo/zudo-design-token-panel/pull/936)) (af2f40f)
46
+
47
+ ## [0.7.0] - 2026-09-09
48
+
49
+ ### Breaking Changes
50
+
51
+ - feat(dashboard): separate chrome theme from specimen mode (84d4d8a). `TokenDashboard` no longer derives its chrome appearance from `mode`: with `mode="dark"` the inventory scope previously carried `color-scheme: dark`, and now only `.zdtp-dashboard__specimen` does, with chrome defaulting to light. **Migration**: pass the new `chrome="dark"` prop alongside `mode="dark"` to restore the previous dark chrome, or `chrome="host"` to inherit the host's effective color scheme.
52
+
53
+ ### Features
54
+
55
+ - feat: resolve CSS color expressions in host context ([#919](https://github.com/Takazudo/zudo-design-token-panel/issues/919)) (30dbabc)
56
+ - feat: require explicit conversion before editing color expressions (ffad163)
57
+
58
+ ### Fixed
59
+
60
+ - Fix invalid CSS color probe fallback (a1d468f)
61
+ - Reject unchanged invalid color declarations before measurement (27fbc70)
62
+
63
+ ### Other Changes
64
+
65
+ - docs(dashboard): document host chrome and add static theme examples (1b8e26d)
66
+ - docs(dashboard): document chrome contract (83778e8)
67
+ - test: cover dashboard chrome themes in browser (5682c72)
68
+ - test: strengthen dashboard specimen isolation assertions (cc62be6)
69
+ - test: prove dashboard host chrome from packed consumer (7a251f0)
70
+ - test(evidence): record dashboard chrome integration proof (690af1f)
71
+ - test: wire semantic expression picker modes (90af515)
72
+ - Cover empty CSS color resolution (18f45ba)
73
+ - docs: record reference-aware color picker fix (b1bb048)
74
+ - test: record reference-aware picker confirmation (045603b)
75
+ - docs: correct picker evidence provenance (89e0322)
76
+
7
77
  ## [0.6.1] - 2026-09-08
8
78
 
9
79
  ### Features
@@ -1743,15 +1743,18 @@ on across a release bump.
1743
1743
 
1744
1744
  ## 12. Static token dashboard
1745
1745
 
1746
- This entry is available from v0.6.1. It does
1747
- not change the `configurePanel` or persistence contracts above.
1746
+ This entry is available from v0.6.1. The `chrome` prop is **unreleased (next
1747
+ release)** and is not supported in v0.6.1. It does not change the
1748
+ `configurePanel` or persistence contracts above.
1748
1749
 
1749
1750
  `@takazudo/zdtp/dashboard` exports the Preact `TokenDashboard` component and
1750
- `TokenDashboardProps`, `DashboardMode`, `DashboardPreviewKind`, `TabConfig`,
1751
- `TierConfig`, and `TierItem` types. The internal value model is not a public API.
1751
+ `TokenDashboardProps`, `DashboardMode`, `DashboardChrome`,
1752
+ `DashboardPreviewKind`, `TabConfig`, `TierConfig`, and `TierItem` types. The
1753
+ internal value model is not a public API.
1752
1754
 
1753
1755
  ```ts
1754
1756
  export type DashboardMode = 'light' | 'dark';
1757
+ export type DashboardChrome = 'light' | 'dark' | 'host';
1755
1758
  export type DashboardPreviewKind =
1756
1759
  | 'bar' | 'size' | 'line-height' | 'family' | 'weight' | 'radius' | 'duration'
1757
1760
  | 'color' | 'shadow' | 'text';
@@ -1759,6 +1762,7 @@ export type DashboardPreviewKind =
1759
1762
  export interface TokenDashboardProps {
1760
1763
  tabs: readonly TabConfig[];
1761
1764
  mode?: DashboardMode; // default: light
1765
+ chrome?: DashboardChrome; // default: light; unreleased (next release)
1762
1766
  title?: string; // default: Token dashboard
1763
1767
  previewText?: string; // static typography passage; default English/Japanese prose
1764
1768
  id?: string; // optional root ID; caller owns uniqueness
@@ -1775,9 +1779,15 @@ export interface TokenDashboardProps {
1775
1779
  JavaScript has no CSS side-effect import; the host must include this asset
1776
1780
  through its CSS build or a static stylesheet link. It is not appended to the
1777
1781
  existing panel stylesheet, which is unnecessary for a dashboard-only page.
1778
- - Each instance declares known token variables inside its inventory and sets
1779
- `color-scheme` to its explicit `mode`. It never writes to `:root` or host
1780
- state. Dashboard chrome styles are independent of inventory variables.
1782
+ - The dashboard root's chrome appearance follows `chrome`: `light` and `dark`
1783
+ fix the shell scheme, while `host` inherits the host's effective
1784
+ `color-scheme` and requires the host to set it on an ancestor. The dashboard
1785
+ uses no media query, so an explicit application theme takes precedence over
1786
+ the OS preference. Inventory specimens retain their own `color-scheme` from
1787
+ `mode`, which also selects declared per-mode defaults. Chrome and specimens
1788
+ are independent; chrome uses package-owned CSS custom properties and never
1789
+ reads inventory variables. The component never writes to `:root` or host
1790
+ state.
1781
1791
  - Tabs, tiers, and rows render in input order. All token rows remain visible;
1782
1792
  no collapsed sections or automatic IDs are introduced. Empty input is valid.
1783
1793
  Notes-only tabs are omitted, and arbitrary notes HTML is never injected.
package/README.md CHANGED
@@ -43,7 +43,8 @@ walkthrough and the shortcut table.
43
43
  ## Static token dashboard
44
44
 
45
45
  Import `TokenDashboard` from `@takazudo/zdtp/dashboard` to render the same tab
46
- manifest on a plain page. This entry is available from v0.6.1. The [live workspace demo](https://zdtp-playground.zudolab.dev/dashboard/)
46
+ manifest on a plain page. This entry is available from v0.6.1. The `chrome`
47
+ prop is **unreleased (next release)** and is not supported in v0.6.1. The [live workspace demo](https://zdtp-playground.zudolab.dev/dashboard/)
47
48
  shows both modes and a compact embedded instance.
48
49
 
49
50
  ```tsx
@@ -92,9 +93,18 @@ public assets directory and add a stylesheet link. The
92
93
  [static dashboard recipe](https://zdtp.zudolab.dev/docs/recipes/static-token-dashboard/)
93
94
  provides complete data and CSS-copy examples.
94
95
 
95
- Optional props are `mode` (`light` by default), `title`, caller-owned unique
96
- `id`, `previewText`, and `previewOverrides` keyed by CSS variable (for example,
97
- a text-editor shadow can use `'shadow'`). Existing `TierConfig.preview` metadata is reused.
96
+ Optional props are `mode` (`light` by default), `chrome` (`light` by default;
97
+ **unreleased for the next release**), `title`, caller-owned unique `id`,
98
+ `previewText`, and `previewOverrides` keyed by CSS variable (for example, a
99
+ text-editor shadow can use `'shadow'`). Existing `TierConfig.preview` metadata is reused.
100
+
101
+ `chrome="light"` and `chrome="dark"` fix the dashboard shell appearance;
102
+ `chrome="host"` inherits the host's effective `color-scheme` and requires the
103
+ host to set it on an ancestor. Chrome is independent of `mode`: `mode` selects
104
+ declared per-mode defaults and each specimen's own `color-scheme`, while chrome
105
+ uses package-owned CSS custom properties and never reads inventory variables.
106
+ The dashboard uses no media query, so an explicit application theme wins over
107
+ the OS preference.
98
108
 
99
109
  Spacing uses actual-size rulers with local scrolling. Nonnegative px/rem, zero,
100
110
  and resolved direct aliases are supported; other lengths keep a readable fallback.
@@ -110,9 +120,10 @@ The inventory uses **declared defaults**: item defaults, per-mode
110
120
  named color presets, panel initialization, or persisted edits. CSS expressions
111
121
  remain expressions; samples depend on browser layout and available fonts.
112
122
  Missing/context-dependent references and invalid declarations remain readable
113
- with diagnostics rather than misleading samples. Preview variables and
114
- `color-scheme` are local to each instance; the component never writes to
115
- `:root`. Arbitrary notes HTML and URL/mask assets are not rendered or loaded.
123
+ with diagnostics rather than misleading samples. The dashboard root's chrome
124
+ scheme follows `chrome`, while each specimen's `color-scheme` follows `mode`;
125
+ both are local to the instance, and the component never writes to `:root`.
126
+ Arbitrary notes HTML and URL/mask assets are not rendered or loaded.
116
127
 
117
128
  This checkpoint provides a Preact component. An HTML-export API/CLI, React
118
129
  adapter, and automatic panel-state synchronization are outside its scope.
@@ -57,6 +57,8 @@
57
57
  *
58
58
  * For non-color tokens, the sparse maps may retain empty or default-equal
59
59
  * values. Those entries are omitted so Apply matches UI and diff-only export.
60
+ * Explicit `modes` rows are also emitted without an override, so their manifest
61
+ * pair is materialized on disk; existing overrides still take precedence.
60
62
  *
61
63
  * Pure / no IO — safe to import anywhere (browser, Node, tests).
62
64
  */
@@ -1,6 +1,6 @@
1
- import { c as y, g as m, a as w, b, i as P } from "../panel-config-Crn5QJGy.js";
2
- import { g, Z as A } from "../tweak-state-Dzr5kDhX.js";
3
- import { s as D, l as E, a as _, i as c, r as f, c as k, b as S, d } from "../autoload-state-CGnis85c.js";
1
+ import { c as y, g as m, a as w, b, i as P } from "../panel-config-DKfob-1r.js";
2
+ import { g, Z as A } from "../tweak-state-BiaKbhXN.js";
3
+ import { s as D, l as E, a as _, i as c, r as f, c as k, b as S, d } from "../autoload-state-CtB0e8mY.js";
4
4
  import { READABLE_STATE_KEY_SUFFIXES as T } from "../constants.js";
5
5
  const u = "tokenpanel-config";
6
6
  function I() {
@@ -1,4 +1,4 @@
1
- import { s as t } from "../panel-config-Crn5QJGy.js";
1
+ import { s as t } from "../panel-config-DKfob-1r.js";
2
2
  import { c as d } from "../color-schemes-CgzOBqGO.js";
3
3
  import { F as r, G as m, a as g, S as z } from "../manifest-DvuKi7I4.js";
4
4
  const e = {
@@ -1,4 +1,4 @@
1
- import { g as n, j as o } from "./panel-config-Crn5QJGy.js";
1
+ import { g as n, j as o } from "./panel-config-DKfob-1r.js";
2
2
  function c() {
3
3
  return typeof document < "u" && document !== null && typeof document.getElementById == "function";
4
4
  }
@@ -18,6 +18,8 @@ export interface ColorFieldProps {
18
18
  * with the native <input type="color"> path).
19
19
  */
20
20
  valueFormat?: ColorPickerValueFormat;
21
+ /** Host color scheme used to resolve CSS expressions. */
22
+ resolveMode?: 'light' | 'dark';
21
23
  /** Display label shown in the picker header and aria-label. */
22
24
  label: string;
23
25
  /** Optional CSS custom property name (e.g. `--my-color`). Used for aria-label. */
@@ -33,5 +35,5 @@ export interface ColorFieldProps {
33
35
  *
34
36
  * Readonly items show the swatch but do not open the picker on interaction.
35
37
  */
36
- export declare function ColorField({ value, onChange, valueFormat, label, cssVar, readonly: isReadonly, }: ColorFieldProps): import("preact").JSX.Element;
38
+ export declare function ColorField({ value, onChange, valueFormat, resolveMode, label, cssVar, readonly: isReadonly, }: ColorFieldProps): import("preact").JSX.Element;
37
39
  export default ColorField;
@@ -48,6 +48,8 @@ export interface ColorPickerProps {
48
48
  * with existing callers that pass no value).
49
49
  */
50
50
  valueFormat?: ColorPickerValueFormat;
51
+ /** Host color scheme used to resolve CSS expressions. */
52
+ resolveMode?: 'light' | 'dark';
51
53
  /** Optional label rendered in the picker header. */
52
54
  label?: string;
53
55
  /**
@@ -93,5 +95,5 @@ export declare function usePopoverClose(containerRef: React.RefObject<HTMLElemen
93
95
  * The parent renders `{isOpen && <ColorPicker ... />}`. This component does
94
96
  * NOT render a trigger swatch and does NOT use createPortal.
95
97
  */
96
- export declare function ColorPicker({ color, onChange, valueFormat, label, defaultMode, anchorRef, onClose, }: ColorPickerProps): JSX.Element;
98
+ export declare function ColorPicker({ color, onChange, valueFormat, resolveMode, label, defaultMode, anchorRef, onClose, }: ColorPickerProps): JSX.Element;
97
99
  export default ColorPicker;
@@ -12,6 +12,7 @@ export interface SliderConfig {
12
12
  format: (v: number) => string;
13
13
  }
14
14
  export interface CustomSliderProps {
15
+ disabled?: boolean;
15
16
  config: SliderConfig;
16
17
  value: number;
17
18
  /** CSS gradient string applied to the track div's background. */
@@ -20,5 +21,5 @@ export interface CustomSliderProps {
20
21
  onDragStart: () => void;
21
22
  onDragEnd: () => void;
22
23
  }
23
- export declare function CustomSlider({ config, value, gradient, onChange, onDragStart, onDragEnd, }: CustomSliderProps): JSX.Element;
24
+ export declare function CustomSlider({ disabled, config, value, gradient, onChange, onDragStart, onDragEnd, }: CustomSliderProps): JSX.Element;
24
25
  export default CustomSlider;
@@ -69,6 +69,11 @@ export interface ColorClusterDataConfig {
69
69
  label?: string;
70
70
  /** Expected palette size. Used for init + v1 validation. */
71
71
  paletteSize: number;
72
+ /** Manifest mode pairs keyed by palette slot; used to seed dense state. */
73
+ paletteModes?: Record<number, {
74
+ light: string;
75
+ dark: string;
76
+ }>;
72
77
  /** Map of base-role name → CSS custom-property name. Partial: a cluster
73
78
  * declares only the roles it actually has. */
74
79
  baseRoles: Partial<Record<BaseRoleKey, string>>;
@@ -114,8 +119,9 @@ import type { TabConfig } from "../tokens/tier-model.js";
114
119
  /**
115
120
  * Derive a `ColorClusterDataConfig` from a color `TabConfig`.
116
121
  *
117
- * - Palette items: the first tier whose items all have `kind: 'color'` and
118
- * are not `semantic: true`. Each item's `cssVar` becomes a palette slot;
122
+ * - Palette items: the first non-reference, non-semantic tier beginning with
123
+ * a color-kind item or an explicit `modes` pair. Each item's `cssVar`
124
+ * becomes a palette slot;
119
125
  * `paletteCssVarTemplate` is synthesised as `"{item.cssVar}"` with `{n}`
120
126
  * replaced by the slot index. Because item cssVars are explicit (e.g.
121
127
  * `--zfb-palette-0`) rather than template-based, we derive the template
@@ -133,6 +139,8 @@ import type { TabConfig } from "../tokens/tier-model.js";
133
139
  * render) but `semanticDefaults`/`semanticCssNames` are populated from the
134
140
  * semantic tier so the Semantic Tokens section isn't left empty (#463).
135
141
  *
142
+ * - Explicit mode pairs in additional tiers become literal semantic defaults
143
+ * so they participate in the cluster's apply and clear paths as well.
136
144
  * - Metadata comes from `tab.colorExtras` (required on a color tab).
137
145
  *
138
146
  * `tabs` is the panel config's full tabs array, used to resolve a semantic
@@ -1,4 +1,5 @@
1
1
  export { TokenDashboard } from "./token-dashboard.js";
2
2
  export type { TokenDashboardProps, DashboardPreviewKind } from "./token-dashboard.js";
3
- export type { DashboardMode } from "./types.js";
3
+ export type { DashboardMode, DashboardInclude, DashboardChrome } from "./types.js";
4
4
  export type { TabConfig, TierConfig, TierItem } from "../tokens/tier-model.js";
5
+ export { splitLightDark, resolveModeSides, isModeDependent } from "../tokens/mode-dependence.js";