@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.
- package/CHANGELOG.md +70 -0
- package/PORTABLE-CONTRACT.md +17 -7
- package/README.md +18 -7
- 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/components/color-picker/color-field.d.ts +3 -1
- package/dist/components/color-picker/color-picker.d.ts +3 -1
- package/dist/components/color-picker/custom-slider.d.ts +2 -1
- package/dist/config/cluster-config.d.ts +10 -2
- package/dist/dashboard/index.d.ts +2 -1
- package/dist/dashboard/index.js +298 -249
- package/dist/dashboard/model.d.ts +3 -1
- package/dist/dashboard/styles.css +152 -43
- package/dist/dashboard/token-dashboard.d.ts +10 -3
- package/dist/dashboard/types.d.ts +21 -3
- package/dist/import-modal.d.ts +21 -22
- package/dist/{index-LYsbHWcy.js → index-BH_IJp9W.js} +2 -2
- package/dist/index-blRjSavc.js +12890 -0
- 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/modes-row.d.ts +39 -0
- 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-Dzr5kDhX.js → tweak-state-BiaKbhXN.js} +729 -671
- package/dist/utils/design-token-serde.d.ts +32 -2
- package/dist/utils/resolve-css-color.d.ts +12 -0
- package/dist/zdtp.css +1 -1
- package/package.json +1 -1
- package/dist/index-DWs1XPfy.js +0 -12251
|
@@ -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
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export interface ModesRowProps {
|
|
24
|
+
item: TierItem;
|
|
25
|
+
sides?: ModeSides;
|
|
26
|
+
className?: string;
|
|
27
|
+
dataTestId?: string;
|
|
28
|
+
address?: TokenAddress;
|
|
29
|
+
leading?: ComponentChildren;
|
|
30
|
+
trailing?: ComponentChildren;
|
|
31
|
+
tail?: ComponentChildren;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Display-only row for a manifest `modes` item. It deliberately carries an
|
|
35
|
+
* editor-disabled state class while retaining ordinary row actions such as
|
|
36
|
+
* highlighting and token-chain navigation. The pair itself contains no
|
|
37
|
+
* input, select, picker, or other editing affordance.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ModesRow({ item, sides, className, dataTestId, address, leading, trailing, tail, }: ModesRowProps): 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
|
}
|