@takazudo/zdtp 0.4.3 → 0.4.5
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 +68 -0
- package/README.md +113 -12
- package/dist/apply/apply-token-overrides.d.ts +139 -32
- package/dist/apply/build-apply-overrides.d.ts +20 -4
- package/dist/apply/tier-resolver.d.ts +28 -0
- package/dist/astro/host-adapter.js +39 -39
- package/dist/astro/index.js +1 -1
- package/dist/{autoload-state-B1MWY_Pp.js → autoload-state-DF7TsTgY.js} +1 -1
- package/dist/bin/server.js +116 -112
- package/dist/config/cluster-config.d.ts +36 -13
- package/dist/config/panel-config.d.ts +36 -1
- package/dist/controls/tier-ref-selector.d.ts +65 -21
- package/dist/export-modal.d.ts +5 -3
- package/dist/import-modal.d.ts +9 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3535 -2941
- package/dist/load-routing-LJ72261l.js +421 -0
- package/dist/panel-config-CipeKMTz.js +876 -0
- package/dist/server/create-apply-handler.d.ts +6 -0
- package/dist/server/index.js +1 -1
- package/dist/state/persist.d.ts +7 -0
- package/dist/state/tweak-state.d.ts +245 -9
- package/dist/tabs/color-tab.d.ts +13 -1
- package/dist/tabs/generic-tab.d.ts +4 -2
- package/dist/testing.js +5 -5
- package/dist/tokens/tier-model.d.ts +62 -0
- package/dist/tweak-state-xt-tSQ_t.js +1958 -0
- package/dist/utils/design-token-serde.d.ts +93 -17
- package/dist/zdtp.css +1 -1
- package/package.json +1 -1
- package/dist/load-routing-DtNTKoLW.js +0 -353
- package/dist/panel-config-3tBEHjvZ.js +0 -493
- package/dist/tweak-state-BEx1SHu7.js +0 -1773
|
@@ -86,7 +86,12 @@ export interface PanelConfig {
|
|
|
86
86
|
consoleNamespace: string;
|
|
87
87
|
/** BEM-style prefix used by every modal in the panel (export / import / apply). */
|
|
88
88
|
modalClassPrefix: string;
|
|
89
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Schema label surfaced in the Import modal's hint/placeholder/error text
|
|
91
|
+
* and the Export modal's copy. NOT enforced: `serialize()`/`deserialize()`
|
|
92
|
+
* always use the fixed `SCHEMA_V1`/`SCHEMA_V2`/`SCHEMA_V3` constants
|
|
93
|
+
* regardless of this value (#498).
|
|
94
|
+
*/
|
|
90
95
|
schemaId: string;
|
|
91
96
|
/** Default filename base — exports save as `${exportFilenameBase}.json`. */
|
|
92
97
|
exportFilenameBase: string;
|
|
@@ -364,6 +369,24 @@ export declare function getPanelConfigByPrefix(prefix: string): PanelConfig | nu
|
|
|
364
369
|
* instance, parked presets, and parked pre-configure hooks.
|
|
365
370
|
*/
|
|
366
371
|
export declare function __resetPanelConfigForTests(): void;
|
|
372
|
+
/**
|
|
373
|
+
* #501 — record that the panel instance keyed by `prefix` wrote `color-scheme`
|
|
374
|
+
* to its apply target. Called from the apply path (`applyColorState`) wherever
|
|
375
|
+
* a per-mode literal forces `color-scheme: light dark`.
|
|
376
|
+
*/
|
|
377
|
+
export declare function markColorSchemeWritten(prefix: string): void;
|
|
378
|
+
/**
|
|
379
|
+
* #501 — drop the color-scheme ownership claim for `prefix`. Called from the
|
|
380
|
+
* clear paths after a panel-written `color-scheme` is removed (or found to have
|
|
381
|
+
* been overwritten by the host — the stale-ownership case).
|
|
382
|
+
*/
|
|
383
|
+
export declare function clearColorSchemeOwnership(prefix: string): void;
|
|
384
|
+
/**
|
|
385
|
+
* #501 — true when the panel instance keyed by `prefix` is the recorded writer
|
|
386
|
+
* of the current inline `color-scheme`. Gates the clear paths so the panel
|
|
387
|
+
* never removes a `color-scheme` it did not write.
|
|
388
|
+
*/
|
|
389
|
+
export declare function ownsColorScheme(prefix: string): boolean;
|
|
367
390
|
export { resolvePrimaryColorCluster, resolveSecondaryColorClusterFromTabs, } from './cluster-config';
|
|
368
391
|
import type { ColorClusterDataConfig } from './cluster-config';
|
|
369
392
|
/**
|
|
@@ -391,6 +414,18 @@ export declare function storageKey_stateV2(cfg: PanelConfig): string;
|
|
|
391
414
|
* this key, then deletes the v2 key.
|
|
392
415
|
*/
|
|
393
416
|
export declare function storageKey_stateV3(cfg: PanelConfig): string;
|
|
417
|
+
/**
|
|
418
|
+
* Storage key for the v4 unified envelope. Upgrades the "global tweak model" to
|
|
419
|
+
* per-scheme color persistence (#500/#509): the `color` and `secondary` slices
|
|
420
|
+
* become identity-keyed sub-objects (one slot per resolved scheme/mode), so a
|
|
421
|
+
* per-scheme color tweak survives a scheme toggle round-trip instead of being
|
|
422
|
+
* clobbered by the next unrelated edit. Non-color slices stay global. Kept a
|
|
423
|
+
* SINGLE storage key (not one key per scheme) because the Astro bootstrap must
|
|
424
|
+
* existence-check persistence before cluster config loads — a per-scheme key
|
|
425
|
+
* would hit a chicken-and-egg there. v1/v2/v3 migrate into this key on first
|
|
426
|
+
* load; v4 takes precedence on every subsequent load.
|
|
427
|
+
*/
|
|
428
|
+
export declare function storageKey_stateV4(cfg: PanelConfig): string;
|
|
394
429
|
/** Legacy v1 key (Color-only flat state). Migrated into v2 on first load, then deleted. */
|
|
395
430
|
export declare function storageKey_stateV1(cfg: PanelConfig): string;
|
|
396
431
|
/** Mirror of the panel's `open` boolean (synchronous mount-time read). */
|
|
@@ -1,38 +1,82 @@
|
|
|
1
1
|
import type { TabConfig } from '../tokens/tier-model';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* CSS override.
|
|
3
|
+
* Names one item in a (possibly cross-tab) tier. `tab` omitted means "the tab
|
|
4
|
+
* `TierRefSelector` itself renders in" — the intra-tab case used by the
|
|
5
|
+
* font/spacing/size/generic-tab consumers, whose refs never cross tabs.
|
|
7
6
|
*/
|
|
8
|
-
export
|
|
7
|
+
export interface TierRefTarget {
|
|
8
|
+
tab?: string;
|
|
9
|
+
tier: string;
|
|
10
|
+
item: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The value `TierRefSelector` reads and writes. Mirrors the `{ ref } | {
|
|
14
|
+
* literal }` variants of `SemanticValue` (`tokens/tier-model.ts`) — including
|
|
15
|
+
* the per-mode `{ literal: { light, dark } }` shape (#472/#473) — so the
|
|
16
|
+
* Color tab can pass a semantic mapping straight through. Flat/intra-tab
|
|
17
|
+
* consumers (font/spacing/size/generic-tab) wrap their bare `TokenOverrides`
|
|
18
|
+
* string into `{ ref: { tier, item } }` at the call site, and unwrap a
|
|
19
|
+
* `{ literal }` response back into "drop the override" — see those tabs'
|
|
20
|
+
* `onChange` handlers. Those flat consumers never produce a per-mode literal.
|
|
21
|
+
*/
|
|
22
|
+
export type TierRefSelectorValue = {
|
|
23
|
+
ref: TierRefTarget;
|
|
24
|
+
} | {
|
|
25
|
+
literal: string;
|
|
26
|
+
} | {
|
|
27
|
+
literal: {
|
|
28
|
+
light: string;
|
|
29
|
+
dark: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
9
32
|
export interface TierRefSelectorProps {
|
|
10
|
-
/**
|
|
33
|
+
/** The tab this row belongs to — provides the semantic/reference tier
|
|
34
|
+
* config and doubles as the default "current tab" for intra-tab refs. */
|
|
11
35
|
tab: TabConfig;
|
|
12
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Full panel tabs array, needed to resolve a grouped tier's cross-tab ramp
|
|
38
|
+
* sources. Defaults to `[tab]` — fine for intra-tab (flat) callers, which
|
|
39
|
+
* never reference another tab.
|
|
40
|
+
*/
|
|
41
|
+
tabs?: readonly TabConfig[];
|
|
42
|
+
/** The tier whose item is being edited (the semantic / reference tier). */
|
|
13
43
|
tierId: string;
|
|
14
44
|
/** The item being edited within `tierId`. */
|
|
15
45
|
itemId: string;
|
|
46
|
+
/** Current value — a ramp/ref target, or a literal color/CSS string. */
|
|
47
|
+
value: TierRefSelectorValue;
|
|
16
48
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
49
|
+
* Called when the user commits a selection or edits the literal value.
|
|
50
|
+
*
|
|
51
|
+
* - Picking a ramp/ref option: `onChange(itemId, { ref: {...} })`
|
|
52
|
+
* - Picking "Literal…" or editing the literal swatch (grouped mode only):
|
|
53
|
+
* `onChange(itemId, { literal: <value> })`
|
|
20
54
|
*/
|
|
21
|
-
|
|
55
|
+
onChange: (itemId: string, next: TierRefSelectorValue) => void;
|
|
22
56
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
57
|
+
* Returns the resolved (override-aware) preview string for a ramp/ref
|
|
58
|
+
* target. Each option label is formatted as `${item.cssVar} (${truncated
|
|
59
|
+
* preview})`. Falls back to the target item's manifest `default` when
|
|
60
|
+
* omitted.
|
|
61
|
+
*/
|
|
62
|
+
previewValueFor?: (ref: TierRefTarget) => string;
|
|
63
|
+
/**
|
|
64
|
+
* Friendly label used for the literal-mode `ColorField` editor (grouped
|
|
65
|
+
* mode only) and the select's `aria-label`. Defaults to `itemId`.
|
|
66
|
+
*/
|
|
67
|
+
label?: string;
|
|
68
|
+
/**
|
|
69
|
+
* The row's own cssVar — threaded into the literal-mode `ColorField`
|
|
70
|
+
* editor for its `aria-label`, matching `SemanticLiteralRow`'s convention.
|
|
27
71
|
*/
|
|
28
|
-
|
|
72
|
+
cssVar?: string;
|
|
29
73
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
74
|
+
* The cluster's `getClusterDefaultMode()` result (#472) — used only when
|
|
75
|
+
* the user collapses a per-mode literal back to single-mode, to pick which
|
|
76
|
+
* side (`light` or `dark`) survives. Defaults to `'light'`.
|
|
33
77
|
*/
|
|
34
|
-
|
|
78
|
+
defaultMode?: 'light' | 'dark';
|
|
35
79
|
}
|
|
36
|
-
declare function TierRefSelector({ tab, tierId, itemId, value, onChange, previewValueFor }: TierRefSelectorProps): import("preact").JSX.Element;
|
|
80
|
+
declare function TierRefSelector({ tab, tabs, tierId, itemId, value, onChange, previewValueFor, label, cssVar, defaultMode, }: TierRefSelectorProps): import("preact").JSX.Element;
|
|
37
81
|
declare const _default: typeof TierRefSelector;
|
|
38
82
|
export default _default;
|
package/dist/export-modal.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Export modal — renders the current `TweakState` as a design-tokens JSON
|
|
3
|
-
* document (
|
|
4
|
-
* `panelConfig.schemaId`
|
|
5
|
-
*
|
|
3
|
+
* document (`serialize()` emits `SCHEMA_V2` or opportunistically `SCHEMA_V3`
|
|
4
|
+
* — see `./utils/design-token-serde`; `panelConfig.schemaId` is not read
|
|
5
|
+
* here or anywhere else in this package — it is a UI-label-only field on
|
|
6
|
+
* `PanelConfig` that hosts may read via `getDesignTokenSchema()`, #498) with
|
|
7
|
+
* a diff-only toggle and a copy-to-clipboard button.
|
|
6
8
|
*
|
|
7
9
|
* Ported verbatim from zudo-doc's
|
|
8
10
|
* `src/components/design-token-tweak/export-modal.tsx`. Intentional deltas:
|
package/dist/import-modal.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Import modal — accepts a pasted design-tokens JSON document
|
|
3
|
-
* `
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Import modal — accepts a pasted design-tokens JSON document and lifts it
|
|
3
|
+
* into a `TweakState` via `deserialize()`. `deserialize()` validates the
|
|
4
|
+
* `$schema` key against the fixed `SCHEMA_V1`/`SCHEMA_V2`/`SCHEMA_V3`
|
|
5
|
+
* constants exported by the serde — `panelConfig.schemaId` plays no part in
|
|
6
|
+
* that validation; it is a UI-label-only field (#498). This component does
|
|
7
|
+
* not read `schemaId` at all; the hint/placeholder/error copy below names
|
|
8
|
+
* the actual accepted constants directly.
|
|
7
9
|
*
|
|
8
10
|
* Ported verbatim from zudo-doc's
|
|
9
11
|
* `src/components/design-token-tweak/import-modal.tsx`. Intentional deltas:
|
|
10
|
-
* - `deserialize` / `DesignTokenSchemaError`
|
|
11
|
-
*
|
|
12
|
-
* id is read at render time from `panelConfig.schemaId` instead of
|
|
13
|
-
* being a module-level constant.
|
|
12
|
+
* - `deserialize` / `DesignTokenSchemaError` come from this package's serde
|
|
13
|
+
* (`./utils/design-token-serde`).
|
|
14
14
|
* - State types import from this package's state envelope.
|
|
15
15
|
* - Modal class names are derived from `panelConfig.modalClassPrefix` via
|
|
16
16
|
* `modalClass(...)` so a single config swap re-themes every dialog.
|
package/dist/index.d.ts
CHANGED
|
@@ -60,6 +60,8 @@ export type { TierValueKind, PillSpec, TierItem, TierConfig, TabConfig, ColorClu
|
|
|
60
60
|
export { isLengthKind, isNumberKind, isSelectKind, isTextKind, isColorKind, isCursorKind, isContentKind, isMaskImageKind, } from './tokens/tier-model';
|
|
61
61
|
export type { TweakState } from './state/tweak-state';
|
|
62
62
|
export { emptyOverrides } from './state/tweak-state';
|
|
63
|
+
export { SCHEMA_V1, SCHEMA_V2, SCHEMA_V3, } from './utils/design-token-serde';
|
|
64
|
+
export { getClusterDefaultMode, resolvePerModeLiteral, resolveSemanticPreviewColor, } from './state/tweak-state';
|
|
63
65
|
export declare function showDesignTokenPanel(): void;
|
|
64
66
|
export declare function hideDesignTokenPanel(): void;
|
|
65
67
|
export declare function toggleDesignPanel(): void;
|