@takazudo/zdtp 0.7.0 → 0.8.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 +53 -0
- package/dist/apply/build-apply-overrides.d.ts +2 -0
- package/dist/astro/host-adapter.js +3 -3
- package/dist/astro/index.js +1 -1
- package/dist/{autoload-state-CGnis85c.js → autoload-state-CtB0e8mY.js} +1 -1
- package/dist/config/cluster-config.d.ts +10 -2
- package/dist/dashboard/index.d.ts +2 -1
- package/dist/dashboard/index.js +314 -266
- package/dist/dashboard/model.d.ts +3 -1
- package/dist/dashboard/styles.css +107 -32
- package/dist/dashboard/token-dashboard.d.ts +8 -5
- package/dist/dashboard/types.d.ts +19 -3
- package/dist/import-modal.d.ts +21 -22
- package/dist/index-CXkidCHj.js +12948 -0
- package/dist/{index-BcqHRoxf.js → index-DufuQu_v.js} +2 -2
- package/dist/index.d.ts +5 -3
- package/dist/index.js +39 -32
- package/dist/mode-dependence-Ci9avNt8.js +61 -0
- package/dist/{panel-config-Crn5QJGy.js → panel-config-DKfob-1r.js} +314 -301
- package/dist/state/tweak-state.d.ts +17 -7
- package/dist/tabs/_generic-item-editor.d.ts +3 -0
- package/dist/tabs/modes-row.d.ts +58 -0
- package/dist/tabs/palette/palette-check-view.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/tokens/mode-dependence.d.ts +23 -0
- package/dist/tokens/tier-model.d.ts +9 -0
- package/dist/{tweak-state-Dhjqig0C.js → tweak-state-BiaKbhXN.js} +729 -671
- package/dist/utils/design-token-serde.d.ts +32 -2
- package/dist/zdtp.css +1 -1
- package/package.json +1 -1
- package/dist/index-CUWkR-Gb.js +0 -12322
|
@@ -495,9 +495,10 @@ export declare function initColorFromScheme(cluster?: ColorClusterDataConfig, cf
|
|
|
495
495
|
*/
|
|
496
496
|
export declare function getActiveColorIdentity(cluster?: ColorClusterDataConfig, cfg?: PanelConfig): string;
|
|
497
497
|
/**
|
|
498
|
-
* Palette entry sanitiser.
|
|
498
|
+
* Palette entry sanitiser. Complete `light-dark(...)` pairs and raw `oklch(...)`
|
|
499
|
+
* values are preserved verbatim so mode defaults and
|
|
499
500
|
* wide-gamut chroma survives (and they never touch the canvas → no '#000000'
|
|
500
|
-
* under jsdom / engines whose 2D canvas can't parse oklch).
|
|
501
|
+
* under jsdom / engines whose 2D canvas can't parse oklch). Other entries
|
|
501
502
|
* goes through cssColorToHex() — the exact pre-OKLCH behaviour — which
|
|
502
503
|
* canonicalises valid hex/rgb and, crucially, turns an unparseable string into a
|
|
503
504
|
* safe '#000000' rather than leaking it into a CSS custom property. Without this,
|
|
@@ -559,6 +560,13 @@ export declare function resolvePerModeLiteral(value: {
|
|
|
559
560
|
* default-mode color, while the applied CSS var still emits `light-dark()`.
|
|
560
561
|
*/
|
|
561
562
|
export declare function resolveSemanticPreviewColor(mapping: SemanticValue, state: ColorTweakState, cluster?: ColorClusterDataConfig, currentTab?: TabConfig, tabs?: readonly TabConfig[]): string;
|
|
563
|
+
/**
|
|
564
|
+
* Apply only explicit manifest mode pairs, without painting scheme seeds or
|
|
565
|
+
* changing other host declarations. Used at cold start and after Reset All.
|
|
566
|
+
* `colorOnly` restores color defaults when the active scheme has no saved slot;
|
|
567
|
+
* the independent generic-tab overrides remain applied by their normal path.
|
|
568
|
+
*/
|
|
569
|
+
export declare function applyManifestModeDefaults(cfg?: PanelConfig, colorOnly?: boolean): void;
|
|
562
570
|
/**
|
|
563
571
|
* Apply a single `ColorTweakState` to the DOM using the given cluster config.
|
|
564
572
|
*
|
|
@@ -616,8 +624,11 @@ export declare function applyTokenOverrides(tokens: readonly TokenDef[], overrid
|
|
|
616
624
|
* instance actually wrote (`clearOwnedColorSchemeFromDocument`) so a host that
|
|
617
625
|
* owns `<html style="color-scheme">` is never clobbered; the sink path stays
|
|
618
626
|
* unconditional (sink targets are panel-owned) but drops the ownership claim.
|
|
627
|
+
* A color-only pass preserves the fallback serving generic manifest mode rows.
|
|
628
|
+
* `applyFullState` disables that preservation because its following generic
|
|
629
|
+
* pass resolves whether those rows have active single-color overrides.
|
|
619
630
|
*/
|
|
620
|
-
export declare function applyColorSlices(color: ColorTweakState, secondary: ColorTweakState | undefined, cfg?: PanelConfig): void;
|
|
631
|
+
export declare function applyColorSlices(color: ColorTweakState, secondary: ColorTweakState | undefined, cfg?: PanelConfig, preserveNonColorModes?: boolean): void;
|
|
621
632
|
/**
|
|
622
633
|
* Apply the full unified `TweakState` — primary color cluster + token
|
|
623
634
|
* overrides + optional secondary cluster.
|
|
@@ -636,10 +647,9 @@ export declare function applyColorSlices(color: ColorTweakState, secondary: Colo
|
|
|
636
647
|
*/
|
|
637
648
|
export declare function applyFullState(state: TweakState, cfg?: PanelConfig): void;
|
|
638
649
|
/**
|
|
639
|
-
* Apply
|
|
640
|
-
* overrides),
|
|
641
|
-
* untouched
|
|
642
|
-
* `applyFullState`.
|
|
650
|
+
* Apply the non-color slices (spacing / typography / size / generic-tab
|
|
651
|
+
* overrides), plus explicit manifest color mode defaults. Dense scheme seeds
|
|
652
|
+
* remain untouched, while mode pairs receive the required color-scheme fallback.
|
|
643
653
|
*
|
|
644
654
|
* Extracted (#509 audit) so the persisted-overrides reapply paths
|
|
645
655
|
* (`reapplyPersistedOverrides`, the panel first-open effect) can, when a v4
|
|
@@ -17,6 +17,9 @@ export interface GenericItemEditorProps {
|
|
|
17
17
|
value: string;
|
|
18
18
|
/** Called with (itemId, newValue). */
|
|
19
19
|
onChange: (itemId: string, next: string) => void;
|
|
20
|
+
/** Stored override, if any. Distinct from `value` so a loaded override
|
|
21
|
+
* equal to `item.default` still wins over the manifest pair. */
|
|
22
|
+
override?: string;
|
|
20
23
|
}
|
|
21
24
|
declare function GenericItemEditor(props: GenericItemEditorProps): import("preact").JSX.Element;
|
|
22
25
|
declare const _default: typeof GenericItemEditor;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ComponentChildren } from 'preact';
|
|
2
|
+
import type { TierItem } from "../tokens/tier-model.js";
|
|
3
|
+
import type { TokenAddress } from "./flat/types.js";
|
|
4
|
+
export interface ModeSides {
|
|
5
|
+
light: string;
|
|
6
|
+
dark: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Resolve the pair shown by a mode row. A stored override is an effective
|
|
10
|
+
* value, so a complete light-dark() override is split for display and a
|
|
11
|
+
* plain override is shown on both sides. With no override the manifest pair
|
|
12
|
+
* is authoritative; this keeps the presentation independent of the ordinary
|
|
13
|
+
* `default` fallback used by generic consumers.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveModeRowSides(item: TierItem, value?: string, preferValue?: boolean): ModeSides;
|
|
16
|
+
export interface ModesValuePairProps {
|
|
17
|
+
sides: ModeSides;
|
|
18
|
+
/** Prefix used for stable test and automation selectors. */
|
|
19
|
+
testIdPrefix?: string;
|
|
20
|
+
}
|
|
21
|
+
/** Render the two authored values with mode-labelled swatches. */
|
|
22
|
+
export declare function ModesValuePair({ sides, testIdPrefix }: ModesValuePairProps): import("preact").JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* Commit one side of a mode pair as `light-dark(light, dark)`. The untouched
|
|
25
|
+
* side is copied byte-for-byte so a mixed-format pair such as
|
|
26
|
+
* `light-dark(rgb(10, 20, 30), oklch(0.8 0.1 240))` keeps the other side's
|
|
27
|
+
* authored syntax.
|
|
28
|
+
*/
|
|
29
|
+
export declare function commitModePair(sides: ModeSides, side: keyof ModeSides, next: string): string;
|
|
30
|
+
export interface ModesEditorFieldsProps {
|
|
31
|
+
item: TierItem;
|
|
32
|
+
sides: ModeSides;
|
|
33
|
+
onChange: (next: string) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Compact light/dark ColorField pair for a manifest `modes` row. Palette Check
|
|
37
|
+
* reuses this without ModesRow chrome. Manifest `modes` is always a pair — no
|
|
38
|
+
* SemanticLiteralRow "Per-mode" checkbox.
|
|
39
|
+
*/
|
|
40
|
+
export declare function ModesEditorFields({ item, sides, onChange }: ModesEditorFieldsProps): import("preact").JSX.Element;
|
|
41
|
+
export interface ModesRowProps {
|
|
42
|
+
item: TierItem;
|
|
43
|
+
sides?: ModeSides;
|
|
44
|
+
className?: string;
|
|
45
|
+
dataTestId?: string;
|
|
46
|
+
address?: TokenAddress;
|
|
47
|
+
leading?: ComponentChildren;
|
|
48
|
+
trailing?: ComponentChildren;
|
|
49
|
+
tail?: ComponentChildren;
|
|
50
|
+
/** Parents close over address/ids. Absent or a readonly item keeps chips. */
|
|
51
|
+
onChange?: (next: string) => void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Row for a manifest `modes` item. With `onChange` (and not readonly) the pair
|
|
55
|
+
* is edited via `ModesEditorFields`; otherwise chips stay and the row keeps
|
|
56
|
+
* `tokenpanel-row--editor-disabled` while retaining ordinary row actions.
|
|
57
|
+
*/
|
|
58
|
+
export declare function ModesRow({ item, sides, className, dataTestId, address, leading, trailing, tail, onChange, }: ModesRowProps): import("preact").JSX.Element;
|
|
@@ -9,4 +9,4 @@ export interface PaletteCheckViewProps {
|
|
|
9
9
|
changedOnly?: boolean;
|
|
10
10
|
isChanged?: (address: TokenAddress) => boolean;
|
|
11
11
|
}
|
|
12
|
-
export default function PaletteCheckView({ tab, overrides, searchQuery, changedOnly, isChanged, }: PaletteCheckViewProps): import("preact").JSX.Element;
|
|
12
|
+
export default function PaletteCheckView({ tab, overrides, onChange, searchQuery, changedOnly, isChanged, }: PaletteCheckViewProps): import("preact").JSX.Element;
|
package/dist/testing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as r, b as i, c as n, d as _, e as g, f as l, h as R, a as f } from "./panel-config-
|
|
2
|
-
import { a as P, b as y, l as O } from "./tweak-state-
|
|
1
|
+
import { _ as r, b as i, c as n, d as _, e as g, f as l, h as R, a as f } from "./panel-config-DKfob-1r.js";
|
|
2
|
+
import { a as P, b as y, l as O } from "./tweak-state-BiaKbhXN.js";
|
|
3
3
|
import { F as E, G as S, a as V, S as d } from "./manifest-DvuKi7I4.js";
|
|
4
4
|
async function s(a, e) {
|
|
5
5
|
await a.fill(e), await a.dispatchEvent("input");
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SemanticValue, TierItem } from "./tier-model.js";
|
|
2
|
+
interface ModeSides {
|
|
3
|
+
light: string;
|
|
4
|
+
dark: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Split a complete `light-dark(light, dark)` declaration into its two
|
|
8
|
+
* top-level arguments.
|
|
9
|
+
*
|
|
10
|
+
* The scanner deliberately understands nested parentheses so values such as
|
|
11
|
+
* `light-dark(rgb(0, 0, 0), #fff)` remain a single pair. It only recognizes a
|
|
12
|
+
* single outer call: a second top-level value, an extra argument, an
|
|
13
|
+
* unbalanced parenthesis, or a nested `light-dark()` call is rejected.
|
|
14
|
+
*/
|
|
15
|
+
export declare function splitLightDark(value: string): ModeSides | null;
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the direct mode pair for one item. References are propagated by
|
|
18
|
+
* consumers that have the surrounding token graph; this helper covers the
|
|
19
|
+
* item, semantic-literal, and parsed-default precedence rules.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveModeSides(item: TierItem, semanticOverride?: SemanticValue): ModeSides | null;
|
|
22
|
+
export declare function isModeDependent(item: TierItem, semanticOverride?: SemanticValue): boolean;
|
|
23
|
+
export {};
|
|
@@ -100,6 +100,15 @@ export interface TierItem {
|
|
|
100
100
|
label: string;
|
|
101
101
|
default: string;
|
|
102
102
|
type: TierValueKind;
|
|
103
|
+
/**
|
|
104
|
+
* Optional light/dark color pair for a mode-dependent row. Both sides are
|
|
105
|
+
* CSS colors because downstream emission uses `light-dark()`. The ordinary
|
|
106
|
+
* `default` remains the fallback value used by non-mode consumers.
|
|
107
|
+
*/
|
|
108
|
+
modes?: {
|
|
109
|
+
light: string;
|
|
110
|
+
dark: string;
|
|
111
|
+
};
|
|
103
112
|
pill?: PillSpec;
|
|
104
113
|
readonly?: true;
|
|
105
114
|
}
|