@takazudo/zdtp 0.2.3 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +81 -10
- package/dist/apply-modal.d.ts +10 -0
- package/dist/apply-modal.d.ts.map +1 -1
- package/dist/astro/host-adapter.js +36 -38
- package/dist/astro/index.js +1 -1
- package/dist/config/panel-config.d.ts +247 -27
- package/dist/config/panel-config.d.ts.map +1 -1
- package/dist/export-modal.d.ts +9 -1
- package/dist/export-modal.d.ts.map +1 -1
- package/dist/import-modal.d.ts +9 -1
- package/dist/import-modal.d.ts.map +1 -1
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2348 -2189
- package/dist/{panel-config-DP2_P7dD.js → panel-config-BOyB8Egg.js} +197 -118
- package/dist/panel.d.ts +17 -1
- package/dist/panel.d.ts.map +1 -1
- package/dist/state/persist.d.ts +12 -1
- package/dist/state/persist.d.ts.map +1 -1
- package/dist/state/tweak-state.d.ts +109 -32
- package/dist/state/tweak-state.d.ts.map +1 -1
- package/dist/testing.js +2 -2
- package/dist/tweak-state-DMwBHPow.js +730 -0
- package/dist/utils/design-token-serde.d.ts +41 -8
- package/dist/utils/design-token-serde.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/tweak-state-DSJa5csL.js +0 -624
|
@@ -40,6 +40,13 @@
|
|
|
40
40
|
* }
|
|
41
41
|
* ```
|
|
42
42
|
*
|
|
43
|
+
* Host-coined GENERIC tabs (any configured tab whose id is not one of the
|
|
44
|
+
* dedicated slices `color` / `color-secondary` / `spacing` / `font` / `size`)
|
|
45
|
+
* round-trip the same way as spacing/size: their overrides live in
|
|
46
|
+
* `state.tabs[id]` (the v3 envelope) and serialize under `tabs[id].raw`,
|
|
47
|
+
* cssVar-keyed (issue #363). The apply path (`applyFullState`) already consumes
|
|
48
|
+
* `state.tabs`; serialize + deserialize make Export/Load symmetric with it.
|
|
49
|
+
*
|
|
43
50
|
* Key decisions (issue #74):
|
|
44
51
|
* - cssVar-keyed leaves for portability across host id renames.
|
|
45
52
|
* - Tier-2 ref values are stored as the literal `var(--tier1-cssvar)` CSS
|
|
@@ -65,18 +72,25 @@
|
|
|
65
72
|
* Read-only manifest tokens are skipped in both directions.
|
|
66
73
|
*/
|
|
67
74
|
import type { ColorTweakState, TweakState } from '../state/tweak-state';
|
|
75
|
+
import { type PanelConfig } from '../config/panel-config';
|
|
68
76
|
/** The canonical v2 schema identifier emitted by serialize(). */
|
|
69
77
|
export declare const SCHEMA_V2 = "zudo-design-tokens/v2";
|
|
70
78
|
/** The legacy v1 schema identifier accepted by deserialize() for back-compat. */
|
|
71
79
|
export declare const SCHEMA_V1 = "zudo-design-tokens/v1";
|
|
72
80
|
/**
|
|
73
|
-
* Read the
|
|
81
|
+
* Read the design-token schema id at call time.
|
|
82
|
+
*
|
|
83
|
+
* Returns the host-configured schema id from `cfg.schemaId`. Used as the
|
|
84
|
+
* `$schema` value in legacy v1 exports (for hosts that have not upgraded their
|
|
85
|
+
* config to v2) and as the expected-schema label the Import modal surfaces. The
|
|
86
|
+
* canonical v2 serialize path always emits `SCHEMA_V2`.
|
|
74
87
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
88
|
+
* `cfg` defaults to the active (most-recently-configured) instance so the
|
|
89
|
+
* single-default path stays byte-identical. The Import modal threads its OWN
|
|
90
|
+
* mounted instance config (multi-instance, #361) so a non-default panel
|
|
91
|
+
* validates against ITS schema id, not the default's.
|
|
78
92
|
*/
|
|
79
|
-
export declare function getDesignTokenSchema(): string;
|
|
93
|
+
export declare function getDesignTokenSchema(cfg?: PanelConfig): string;
|
|
80
94
|
/** External JSON value for a base-color / semantic-color entry (v1). */
|
|
81
95
|
type ColorSlotValue = number | 'bg' | 'fg';
|
|
82
96
|
export interface DesignTokenJsonColorBase {
|
|
@@ -114,7 +128,14 @@ export interface DesignTokenJson {
|
|
|
114
128
|
* For color semantic: values are palette-index integers.
|
|
115
129
|
*/
|
|
116
130
|
export type V2TierMap = Record<string, string | number>;
|
|
117
|
-
/**
|
|
131
|
+
/**
|
|
132
|
+
* Per-tab overrides in v2 format. Keyed nominally by tier id — but only the
|
|
133
|
+
* `color` tab uses real tier ids (`palette` / `semantic`). Every other tab
|
|
134
|
+
* (spacing / font / size AND host-coined generic tabs) uses the single synthetic
|
|
135
|
+
* external key `raw` regardless of its internal tier ids; the cssVar leaves under
|
|
136
|
+
* `raw` carry the identity, so the external JSON never depends on a tab's
|
|
137
|
+
* internal tier structure.
|
|
138
|
+
*/
|
|
118
139
|
export type V2TabEntry = Record<string, V2TierMap>;
|
|
119
140
|
/** v2 external JSON document shape. */
|
|
120
141
|
export interface DesignTokenJsonV2 {
|
|
@@ -169,8 +190,14 @@ export declare class DesignTokenSchemaError extends Error {
|
|
|
169
190
|
* defaults; set `opts.includeDefaults = true` to dump everything.
|
|
170
191
|
*
|
|
171
192
|
* The output `$schema` is always `SCHEMA_V2` ("zudo-design-tokens/v2").
|
|
193
|
+
*
|
|
194
|
+
* `cfg` defaults to the active (most-recently-configured) instance so the
|
|
195
|
+
* single-default path stays byte-identical. The Export / Apply modals thread
|
|
196
|
+
* their OWN mounted instance config (multi-instance, #361) so a non-default
|
|
197
|
+
* panel's export JSON / revert blob is built from ITS tab manifest + color
|
|
198
|
+
* cluster, not the default instance's.
|
|
172
199
|
*/
|
|
173
|
-
export declare function serialize(state: TweakState, opts?: SerializeOptions): DesignTokenJsonV2;
|
|
200
|
+
export declare function serialize(state: TweakState, opts?: SerializeOptions, cfg?: PanelConfig): DesignTokenJsonV2;
|
|
174
201
|
/**
|
|
175
202
|
* Parse a design-token JSON document and lift it back into a tweak state.
|
|
176
203
|
*
|
|
@@ -187,7 +214,13 @@ export declare function serialize(state: TweakState, opts?: SerializeOptions): D
|
|
|
187
214
|
*
|
|
188
215
|
* Missing fields fall back to `opts.colorDefaults` (or, absent that, a
|
|
189
216
|
* minimal neutral default) so the result is always a valid `TweakState`.
|
|
217
|
+
*
|
|
218
|
+
* `cfg` defaults to the active (most-recently-configured) instance so the
|
|
219
|
+
* single-default path stays byte-identical. The Import modal threads its OWN
|
|
220
|
+
* mounted instance config (multi-instance, #361) so a non-default panel's
|
|
221
|
+
* schema-check + cssVar→id mapping use ITS tab manifest + color cluster, not
|
|
222
|
+
* the default instance's.
|
|
190
223
|
*/
|
|
191
|
-
export declare function deserialize(input: unknown, opts?: DeserializeOptions): DeserializeResult;
|
|
224
|
+
export declare function deserialize(input: unknown, opts?: DeserializeOptions, cfg?: PanelConfig): DeserializeResult;
|
|
192
225
|
export {};
|
|
193
226
|
//# sourceMappingURL=design-token-serde.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-token-serde.d.ts","sourceRoot":"","sources":["../../src/utils/design-token-serde.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"design-token-serde.d.ts","sourceRoot":"","sources":["../../src/utils/design-token-serde.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAgC,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEtG,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAsF1E,iEAAiE;AACjE,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAEjD,iFAAiF;AACjF,eAAO,MAAM,SAAS,0BAA0B,CAAC;AAWjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,WAA8B,GAAG,MAAM,CAEhF;AAMD,wEAAwE;AACxE,KAAK,cAAc,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,MAAM,WAAW,wBAAwB;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC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