@wordpress/theme 0.1.0 → 0.2.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/README.md +69 -9
- package/bin/generate-default-ramps/index.ts +49 -0
- package/bin/generate-primitive-tokens/index.ts +14 -9
- package/bin/terrazzo-plugin-ds-tokens-docs/index.ts +5 -24
- package/bin/terrazzo-plugin-figma-ds-token-manager/index.ts +11 -4
- package/bin/terrazzo-plugin-inline-alias-values/index.ts +84 -0
- package/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +19 -39
- package/build/color-ramps/index.js +21 -39
- package/build/color-ramps/index.js.map +3 -3
- package/build/color-ramps/lib/color-utils.js +39 -0
- package/build/color-ramps/lib/color-utils.js.map +7 -0
- package/build/color-ramps/lib/constants.js +20 -27
- package/build/color-ramps/lib/constants.js.map +3 -3
- package/build/color-ramps/lib/default-ramps.js +220 -0
- package/build/color-ramps/lib/default-ramps.js.map +7 -0
- package/build/color-ramps/lib/find-color-with-constraints.js +60 -91
- package/build/color-ramps/lib/find-color-with-constraints.js.map +3 -3
- package/build/color-ramps/lib/index.js +77 -119
- package/build/color-ramps/lib/index.js.map +3 -3
- package/build/color-ramps/lib/ramp-configs.js +15 -14
- package/build/color-ramps/lib/ramp-configs.js.map +2 -2
- package/build/color-ramps/lib/register-color-spaces.js +7 -0
- package/build/color-ramps/lib/register-color-spaces.js.map +7 -0
- package/build/color-ramps/lib/taper-chroma.js +35 -27
- package/build/color-ramps/lib/taper-chroma.js.map +3 -3
- package/build/color-ramps/lib/types.js +2 -1
- package/build/color-ramps/lib/types.js.map +1 -1
- package/build/color-ramps/lib/utils.js +75 -11
- package/build/color-ramps/lib/utils.js.map +2 -2
- package/build/context.js +3 -2
- package/build/context.js.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -2
- package/build/lock-unlock.js.map +1 -1
- package/build/prebuilt/js/design-tokens.js +19 -11
- package/build/prebuilt/js/design-tokens.js.map +2 -2
- package/build/prebuilt/json/figma.json +165 -783
- package/build/prebuilt/ts/color-tokens.js +137 -0
- package/build/prebuilt/ts/color-tokens.js.map +7 -0
- package/build/private-apis.js +3 -2
- package/build/private-apis.js.map +1 -1
- package/build/theme-provider.js +19 -17
- package/build/theme-provider.js.map +4 -4
- package/build/token-id.js +30 -0
- package/build/token-id.js.map +7 -0
- package/build/types/css-modules.d.js +0 -1
- package/build/types.js +2 -1
- package/build/types.js.map +1 -1
- package/build/use-theme-provider-styles.js +67 -62
- package/build/use-theme-provider-styles.js.map +3 -3
- package/build-module/color-ramps/index.js +20 -28
- package/build-module/color-ramps/index.js.map +2 -2
- package/build-module/color-ramps/lib/color-utils.js +19 -0
- package/build-module/color-ramps/lib/color-utils.js.map +7 -0
- package/build-module/color-ramps/lib/constants.js +14 -11
- package/build-module/color-ramps/lib/constants.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +196 -0
- package/build-module/color-ramps/lib/default-ramps.js.map +7 -0
- package/build-module/color-ramps/lib/find-color-with-constraints.js +61 -87
- package/build-module/color-ramps/lib/find-color-with-constraints.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +85 -109
- package/build-module/color-ramps/lib/index.js.map +3 -3
- package/build-module/color-ramps/lib/ramp-configs.js +14 -13
- package/build-module/color-ramps/lib/ramp-configs.js.map +2 -2
- package/build-module/color-ramps/lib/register-color-spaces.js +7 -0
- package/build-module/color-ramps/lib/register-color-spaces.js.map +7 -0
- package/build-module/color-ramps/lib/taper-chroma.js +40 -16
- package/build-module/color-ramps/lib/taper-chroma.js.map +2 -2
- package/build-module/color-ramps/lib/utils.js +70 -6
- package/build-module/color-ramps/lib/utils.js.map +2 -2
- package/build-module/context.js +2 -1
- package/build-module/context.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/prebuilt/js/design-tokens.js +18 -10
- package/build-module/prebuilt/js/design-tokens.js.map +2 -2
- package/build-module/prebuilt/json/figma.json +165 -783
- package/build-module/prebuilt/ts/color-tokens.js +117 -0
- package/build-module/prebuilt/ts/color-tokens.js.map +7 -0
- package/build-module/private-apis.js +2 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/theme-provider.js +18 -6
- package/build-module/theme-provider.js.map +3 -3
- package/build-module/token-id.js +6 -0
- package/build-module/token-id.js.map +7 -0
- package/build-module/use-theme-provider-styles.js +69 -57
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/index.d.ts +9 -16
- package/build-types/color-ramps/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/color-utils.d.ts +22 -0
- package/build-types/color-ramps/lib/color-utils.d.ts.map +1 -0
- package/build-types/color-ramps/lib/constants.d.ts +7 -9
- package/build-types/color-ramps/lib/constants.d.ts.map +1 -1
- package/build-types/color-ramps/lib/default-ramps.d.ts +7 -0
- package/build-types/color-ramps/lib/default-ramps.d.ts.map +1 -0
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts +8 -7
- package/build-types/color-ramps/lib/find-color-with-constraints.d.ts.map +1 -1
- package/build-types/color-ramps/lib/index.d.ts +5 -2
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/register-color-spaces.d.ts +2 -0
- package/build-types/color-ramps/lib/register-color-spaces.d.ts.map +1 -0
- package/build-types/color-ramps/lib/taper-chroma.d.ts +7 -3
- package/build-types/color-ramps/lib/taper-chroma.d.ts.map +1 -1
- package/build-types/color-ramps/lib/utils.d.ts +28 -5
- package/build-types/color-ramps/lib/utils.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/prebuilt/ts/color-tokens.d.ts +7 -0
- package/build-types/prebuilt/ts/color-tokens.d.ts.map +1 -0
- package/build-types/stories/index.story.d.ts.map +1 -1
- package/build-types/theme-provider.d.ts.map +1 -1
- package/build-types/token-id.d.ts +9 -0
- package/build-types/token-id.d.ts.map +1 -0
- package/build-types/use-theme-provider-styles.d.ts +4 -0
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/docs/ds-tokens.md +22 -156
- package/package.json +19 -9
- package/src/color-ramps/index.ts +24 -41
- package/src/color-ramps/lib/color-utils.ts +34 -0
- package/src/color-ramps/lib/constants.ts +13 -9
- package/src/color-ramps/lib/default-ramps.ts +200 -0
- package/src/color-ramps/lib/find-color-with-constraints.ts +83 -116
- package/src/color-ramps/lib/index.ts +107 -145
- package/src/color-ramps/lib/ramp-configs.ts +3 -3
- package/src/color-ramps/lib/register-color-spaces.ts +13 -0
- package/src/color-ramps/lib/taper-chroma.ts +47 -19
- package/src/color-ramps/lib/utils.ts +117 -14
- package/src/color-ramps/stories/index.story.tsx +16 -22
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +45722 -376
- package/src/color-ramps/test/index.test.ts +68 -29
- package/src/prebuilt/css/design-tokens.css +88 -355
- package/src/prebuilt/js/design-tokens.js +17 -10
- package/src/prebuilt/json/figma.json +165 -783
- package/src/prebuilt/ts/color-tokens.ts +117 -0
- package/src/stories/index.story.tsx +4 -18
- package/src/test/token-id.test.ts +12 -0
- package/src/token-id.ts +9 -0
- package/src/use-theme-provider-styles.ts +67 -60
- package/terrazzo.config.ts +15 -12
- package/tokens/color.json +221 -69
- package/tokens/dimension.json +75 -0
- package/tsconfig.bin.json +13 -0
- package/tsconfig.bin.tsbuildinfo +1 -0
- package/tsconfig.json +6 -4
- package/tsconfig.src.json +9 -0
- package/tsconfig.src.tsbuildinfo +1 -0
- package/bin/build-tokens.js +0 -83
- package/build/color-ramps/lib/cache-utils.js +0 -57
- package/build/color-ramps/lib/cache-utils.js.map +0 -7
- package/build/prebuilt/ts/design-tokens.js +0 -354
- package/build/prebuilt/ts/design-tokens.js.map +0 -7
- package/build/style.module.css.js +0 -2
- package/build-module/color-ramps/lib/cache-utils.js +0 -31
- package/build-module/color-ramps/lib/cache-utils.js.map +0 -7
- package/build-module/prebuilt/ts/design-tokens.js +0 -334
- package/build-module/prebuilt/ts/design-tokens.js.map +0 -7
- package/build-module/style.module.css.js +0 -1
- package/build-style/style.css +0 -3
- package/build-types/color-ramps/lib/cache-utils.d.ts +0 -22
- package/build-types/color-ramps/lib/cache-utils.d.ts.map +0 -1
- package/build-types/prebuilt/ts/design-tokens.d.ts +0 -7
- package/build-types/prebuilt/ts/design-tokens.d.ts.map +0 -1
- package/src/color-ramps/lib/cache-utils.ts +0 -56
- package/src/prebuilt/ts/design-tokens.ts +0 -335
- package/tokens/spacing.json +0 -45
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
1
|
var __defProp = Object.defineProperty;
|
|
4
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
5
|
var __export = (target, all) => {
|
|
9
6
|
for (var name in all)
|
|
@@ -17,23 +14,19 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
14
|
}
|
|
18
15
|
return to;
|
|
19
16
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/color-ramps/lib/taper-chroma.ts
|
|
29
20
|
var taper_chroma_exports = {};
|
|
30
21
|
__export(taper_chroma_exports, {
|
|
31
22
|
taperChroma: () => taperChroma
|
|
32
23
|
});
|
|
33
24
|
module.exports = __toCommonJS(taper_chroma_exports);
|
|
34
|
-
var
|
|
25
|
+
var import_fn = require("colorjs.io/fn");
|
|
26
|
+
var import_register_color_spaces = require("./register-color-spaces");
|
|
35
27
|
function taperChroma(seed, lTarget, options = {}) {
|
|
36
28
|
const gamut = options.gamut ?? "p3";
|
|
29
|
+
const gamutSpace = gamut === "p3" ? import_fn.P3 : import_fn.sRGB;
|
|
37
30
|
const alpha = options.alpha ?? 0.65;
|
|
38
31
|
const carry = options.carry ?? 0.5;
|
|
39
32
|
const cUpperBound = options.cUpperBound ?? 0.45;
|
|
@@ -42,23 +35,31 @@ function taperChroma(seed, lTarget, options = {}) {
|
|
|
42
35
|
const kLight = options.kLight ?? 0.85;
|
|
43
36
|
const kDark = options.kDark ?? 0.85;
|
|
44
37
|
const achromaEpsilon = options.achromaEpsilon ?? 5e-3;
|
|
45
|
-
const cSeed = Math.max(0, seed.
|
|
46
|
-
let hSeed = Number(seed.
|
|
38
|
+
const cSeed = Math.max(0, (0, import_fn.get)(seed, [import_fn.OKLCH, "c"]));
|
|
39
|
+
let hSeed = Number((0, import_fn.get)(seed, [import_fn.OKLCH, "h"]));
|
|
47
40
|
const chromaIsTiny = cSeed < achromaEpsilon;
|
|
48
41
|
const hueIsInvalid = !Number.isFinite(hSeed);
|
|
49
42
|
if (chromaIsTiny || hueIsInvalid) {
|
|
50
43
|
if (typeof options.hueFallback === "number") {
|
|
51
44
|
hSeed = normalizeHue(options.hueFallback);
|
|
52
45
|
} else {
|
|
53
|
-
return
|
|
46
|
+
return {
|
|
47
|
+
spaceId: "oklch",
|
|
48
|
+
coords: [clamp01(lTarget), 0, 0]
|
|
49
|
+
};
|
|
54
50
|
}
|
|
55
51
|
}
|
|
56
|
-
const lSeed = clamp01(seed.
|
|
57
|
-
const cmaxSeed = getCachedMaxChromaAtLH(
|
|
52
|
+
const lSeed = clamp01((0, import_fn.get)(seed, [import_fn.OKLCH, "l"]));
|
|
53
|
+
const cmaxSeed = getCachedMaxChromaAtLH(
|
|
54
|
+
lSeed,
|
|
55
|
+
hSeed,
|
|
56
|
+
gamutSpace,
|
|
57
|
+
cUpperBound
|
|
58
|
+
);
|
|
58
59
|
const cmaxTarget = getCachedMaxChromaAtLH(
|
|
59
60
|
clamp01(lTarget),
|
|
60
61
|
hSeed,
|
|
61
|
-
|
|
62
|
+
gamutSpace,
|
|
62
63
|
cUpperBound
|
|
63
64
|
);
|
|
64
65
|
let seedRelative = 0;
|
|
@@ -74,10 +75,13 @@ function taperChroma(seed, lTarget, options = {}) {
|
|
|
74
75
|
});
|
|
75
76
|
let cPlanned = cWithCarry * t;
|
|
76
77
|
const lOut = clamp01(lTarget);
|
|
77
|
-
const candidate =
|
|
78
|
-
|
|
78
|
+
const candidate = {
|
|
79
|
+
spaceId: "oklch",
|
|
80
|
+
coords: [lOut, cPlanned, hSeed]
|
|
81
|
+
};
|
|
82
|
+
if (!(0, import_fn.inGamut)(candidate, gamutSpace)) {
|
|
79
83
|
const cap = Math.min(cPlanned, cUpperBound);
|
|
80
|
-
cPlanned = getCachedMaxChromaAtLH(lOut, hSeed,
|
|
84
|
+
cPlanned = getCachedMaxChromaAtLH(lOut, hSeed, gamutSpace, cap);
|
|
81
85
|
}
|
|
82
86
|
cPlanned = Math.min(cPlanned, cSeed);
|
|
83
87
|
return { l: lOut, c: cPlanned };
|
|
@@ -113,7 +117,7 @@ function continuousTaper(seedL, targetL, opts) {
|
|
|
113
117
|
const w = raisedCosine(u > 1 ? 1 : u);
|
|
114
118
|
return 1 - (1 - opts.kDark) * w;
|
|
115
119
|
}
|
|
116
|
-
|
|
120
|
+
var maxChromaCache = /* @__PURE__ */ new Map();
|
|
117
121
|
function keyMax(l, h, gamut, cap) {
|
|
118
122
|
const lq = quantize(l, 1e-3);
|
|
119
123
|
const hq = quantize(normalizeHue(h), 0.1);
|
|
@@ -124,17 +128,18 @@ function quantize(x, step) {
|
|
|
124
128
|
const k = Math.round(x / step);
|
|
125
129
|
return k * step;
|
|
126
130
|
}
|
|
127
|
-
function getCachedMaxChromaAtLH(l, h,
|
|
131
|
+
function getCachedMaxChromaAtLH(l, h, gamutSpace, cap) {
|
|
132
|
+
const gamut = gamutSpace === import_fn.P3 ? "p3" : "srgb";
|
|
128
133
|
const key = keyMax(l, h, gamut, cap);
|
|
129
134
|
const hit = maxChromaCache.get(key);
|
|
130
135
|
if (typeof hit === "number") {
|
|
131
136
|
return hit;
|
|
132
137
|
}
|
|
133
|
-
const computed = maxInGamutChromaAtLH(l, h,
|
|
138
|
+
const computed = maxInGamutChromaAtLH(l, h, gamutSpace, cap);
|
|
134
139
|
maxChromaCache.set(key, computed);
|
|
135
140
|
return computed;
|
|
136
141
|
}
|
|
137
|
-
function maxInGamutChromaAtLH(l, h,
|
|
142
|
+
function maxInGamutChromaAtLH(l, h, gamutSpace, cap) {
|
|
138
143
|
let lo = 0;
|
|
139
144
|
let hi = cap;
|
|
140
145
|
let ok = 0;
|
|
@@ -142,8 +147,11 @@ function maxInGamutChromaAtLH(l, h, gamut, cap) {
|
|
|
142
147
|
const hFixed = normalizeHue(h);
|
|
143
148
|
for (let i = 0; i < 18; i++) {
|
|
144
149
|
const mid = (lo + hi) / 2;
|
|
145
|
-
const probe =
|
|
146
|
-
|
|
150
|
+
const probe = {
|
|
151
|
+
spaceId: "oklch",
|
|
152
|
+
coords: [lFixed, mid, hFixed]
|
|
153
|
+
};
|
|
154
|
+
if ((0, import_fn.inGamut)(probe, gamutSpace)) {
|
|
147
155
|
ok = mid;
|
|
148
156
|
lo = mid;
|
|
149
157
|
} else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/taper-chroma.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tget,\n\tinGamut,\n\tOKLCH,\n\tP3,\n\tsRGB,\n\ttype ColorTypes,\n\ttype ColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\n\nexport interface TaperChromaOptions {\n\tgamut?: 'p3' | 'srgb'; // target gamut (default \"p3\")\n\talpha?: number; // base fraction of Cmax at target (default 0.62)\n\tcarry?: number; // seed vividness carry exponent \u03B2 in [0..1] (default 0.5)\n\tcUpperBound?: number; // hard search cap for C (default 0.45)\n\t// Continuous taper around the seed (desaturate both sides slightly)\n\tradiusLight?: number; // distance in L where kLight is reached (default 0.20)\n\tradiusDark?: number; // distance in L where kDark is reached (default 0.20)\n\tkLight?: number; // floor multiplier near lighter side (default 0.85)\n\tkDark?: number; // floor multiplier near darker side (default 0.85)\n\t// Achromatic handling\n\thueFallback?: number; // degrees: if seed is achromatic and you still want color\n\tachromaEpsilon?: number; // \u2264 this chroma \u2192 treat as achromatic (default 0.005)\n}\n\n/**\n * Given the seed and the target lightness, tapers the chroma smoothly.\n * - C_intended = Cmax(Lt,H0) * alpha * (seedRelative^carry)\n * - Continuous taper vs |Lt - Ls| to softly reduce chroma for neighbors\n * - Downward-only clamp on C (preserve L & H)\n * @param seed\n * @param lTarget\n * @param options\n */\nexport function taperChroma(\n\tseed: ColorTypes, // already OKLCH\n\tlTarget: number, // [0..1]\n\toptions: TaperChromaOptions = {}\n): { l: number; c: number } | ColorObject {\n\tconst gamut = options.gamut ?? 'p3';\n\tconst gamutSpace = gamut === 'p3' ? P3 : sRGB;\n\tconst alpha = options.alpha ?? 0.65; // 0.7-0.8 works well for accent surface\n\tconst carry = options.carry ?? 0.5;\n\tconst cUpperBound = options.cUpperBound ?? 0.45;\n\tconst radiusLight = options.radiusLight ?? 0.2;\n\tconst radiusDark = options.radiusDark ?? 0.2;\n\tconst kLight = options.kLight ?? 0.85;\n\tconst kDark = options.kDark ?? 0.85;\n\tconst achromaEpsilon = options.achromaEpsilon ?? 0.005;\n\n\tconst cSeed = Math.max( 0, get( seed, [ OKLCH, 'c' ] ) );\n\tlet hSeed = Number( get( seed, [ OKLCH, 'h' ] ) );\n\n\tconst chromaIsTiny = cSeed < achromaEpsilon;\n\tconst hueIsInvalid = ! Number.isFinite( hSeed );\n\n\tif ( chromaIsTiny || hueIsInvalid ) {\n\t\tif ( typeof options.hueFallback === 'number' ) {\n\t\t\thSeed = normalizeHue( options.hueFallback );\n\t\t} else {\n\t\t\t// Respect achromatic intent: grayscale at target L\n\t\t\treturn {\n\t\t\t\tspaceId: 'oklch',\n\t\t\t\tcoords: [ clamp01( lTarget ), 0, 0 ],\n\t\t\t};\n\t\t}\n\t}\n\n\t// Capacity at seed and target\n\tconst lSeed = clamp01( get( seed, [ OKLCH, 'l' ] ) );\n\tconst cmaxSeed = getCachedMaxChromaAtLH(\n\t\tlSeed,\n\t\thSeed,\n\t\tgamutSpace,\n\t\tcUpperBound\n\t);\n\tconst cmaxTarget = getCachedMaxChromaAtLH(\n\t\tclamp01( lTarget ),\n\t\thSeed,\n\t\tgamutSpace,\n\t\tcUpperBound\n\t);\n\n\t// Seed vividness ratio (hue-fair normalization)\n\tlet seedRelative = 0;\n\tconst denom = cmaxSeed > 0 ? cmaxSeed : 1e-6;\n\tseedRelative = clamp01( cSeed / denom );\n\n\t// Intended chroma from local capacity, tempered by seed vividness\n\tconst cIntendedBase = alpha * cmaxTarget;\n\tconst cWithCarry =\n\t\tcIntendedBase * Math.pow( seedRelative, clamp01( carry ) );\n\n\t// Gentle, symmetric desaturation vs distance in L\n\tconst t = continuousTaper( lSeed, lTarget, {\n\t\tradiusLight,\n\t\tradiusDark,\n\t\tkLight,\n\t\tkDark,\n\t} );\n\tlet cPlanned = cWithCarry * t;\n\n\t// Downward-only clamp (preserve L & H)\n\tconst lOut = clamp01( lTarget );\n\tconst candidate: ColorTypes = {\n\t\tspaceId: 'oklch',\n\t\tcoords: [ lOut, cPlanned, hSeed ],\n\t};\n\tif ( ! inGamut( candidate, gamutSpace ) ) {\n\t\tconst cap = Math.min( cPlanned, cUpperBound );\n\t\tcPlanned = getCachedMaxChromaAtLH( lOut, hSeed, gamutSpace, cap );\n\t}\n\n\tcPlanned = Math.min( cPlanned, cSeed );\n\n\treturn { l: lOut, c: cPlanned };\n}\n\n/* ---------------- helpers & caches ---------------- */\n\nfunction clamp01( x: number ): number {\n\tif ( x < 0 ) {\n\t\treturn 0;\n\t}\n\tif ( x > 1 ) {\n\t\treturn 1;\n\t}\n\treturn x;\n}\nfunction normalizeHue( h: number ): number {\n\tlet hue = h % 360;\n\tif ( hue < 0 ) {\n\t\thue += 360;\n\t}\n\treturn hue;\n}\nfunction raisedCosine( u: number ): number {\n\tconst x = clamp01( u );\n\treturn 0.5 - 0.5 * Math.cos( Math.PI * x );\n}\n\n/**\n * smooth, distance-from-seed chroma taper (raised-cosine per side)\n * @param seedL\n * @param targetL\n * @param opts\n * @param opts.radiusLight\n * @param opts.radiusDark\n * @param opts.kLight\n * @param opts.kDark\n */\nfunction continuousTaper(\n\tseedL: number,\n\ttargetL: number,\n\topts: {\n\t\tradiusLight: number;\n\t\tradiusDark: number;\n\t\tkLight: number;\n\t\tkDark: number;\n\t}\n): number {\n\tconst d = targetL - seedL;\n\tif ( d >= 0 ) {\n\t\tconst u = opts.radiusLight > 0 ? Math.abs( d ) / opts.radiusLight : 1;\n\t\tconst w = raisedCosine( u > 1 ? 1 : u );\n\t\treturn 1 - ( 1 - opts.kLight ) * w;\n\t}\n\tconst u = opts.radiusDark > 0 ? Math.abs( d ) / opts.radiusDark : 1;\n\tconst w = raisedCosine( u > 1 ? 1 : u );\n\treturn 1 - ( 1 - opts.kDark ) * w;\n}\n\n/* ---- chroma-capacity queries with small caches ---- */\n\nconst maxChromaCache = new Map< string, number >();\n\nfunction keyMax(\n\tl: number,\n\th: number,\n\tgamut: 'p3' | 'srgb',\n\tcap: number\n): string {\n\t// Quantize to keep cache compact\n\tconst lq = quantize( l, 1e-3 );\n\tconst hq = quantize( normalizeHue( h ), 1e-1 );\n\tconst cq = quantize( cap, 1e-3 );\n\treturn `${ gamut }|L:${ lq }|H:${ hq }|cap:${ cq }`;\n}\nfunction quantize( x: number, step: number ): number {\n\tconst k = Math.round( x / step );\n\treturn k * step;\n}\n\nfunction getCachedMaxChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: typeof P3 | typeof sRGB,\n\tcap: number\n): number {\n\tconst gamut = gamutSpace === P3 ? 'p3' : 'srgb';\n\tconst key = keyMax( l, h, gamut, cap );\n\tconst hit = maxChromaCache.get( key );\n\tif ( typeof hit === 'number' ) {\n\t\treturn hit;\n\t}\n\n\tconst computed = maxInGamutChromaAtLH( l, h, gamutSpace, cap );\n\tmaxChromaCache.set( key, computed );\n\treturn computed;\n}\n\n/**\n * Binary-search the max in-gamut chroma at fixed (L,H) in the target gamut\n * @param l\n * @param h\n * @param gamutSpace\n * @param cap\n */\nfunction maxInGamutChromaAtLH(\n\tl: number,\n\th: number,\n\tgamutSpace: typeof P3 | typeof sRGB,\n\tcap: number\n): number {\n\tlet lo = 0;\n\tlet hi = cap;\n\tlet ok = 0;\n\n\tconst lFixed = clamp01( l );\n\tconst hFixed = normalizeHue( h );\n\n\tfor ( let i = 0; i < 18; i++ ) {\n\t\tconst mid = ( lo + hi ) / 2;\n\t\tconst probe: ColorTypes = {\n\t\t\tspaceId: 'oklch',\n\t\t\tcoords: [ lFixed, mid, hFixed ],\n\t\t};\n\t\tif ( inGamut( probe, gamutSpace ) ) {\n\t\t\tok = mid;\n\t\t\tlo = mid;\n\t\t} else {\n\t\t\thi = mid;\n\t\t}\n\t}\n\treturn ok;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAQO;AAKP,mCAAO;AA0BA,SAAS,YACf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
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -12,6 +11,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
12
11
|
return to;
|
|
13
12
|
};
|
|
14
13
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// packages/theme/src/color-ramps/lib/types.ts
|
|
15
16
|
var types_exports = {};
|
|
16
17
|
module.exports = __toCommonJS(types_exports);
|
|
17
18
|
//# sourceMappingURL=types.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/types.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { TaperChromaOptions } from './taper-chroma';\n\nexport type Ramp = {\n\t// Backgrounds for surfaces (nuanced, slight variations compared to bg)\n\tsurface1: string;\n\tsurface2: string;\n\tsurface3: string;\n\tsurface4: string;\n\tsurface5: string;\n\tsurface6: string;\n\t// Strokes\n\tstroke1: string;\n\tstroke2: string;\n\tstroke3: string;\n\tstroke4: string;\n\t// Stronger backgrounds for primary UI elements\n\tbgFill1: string;\n\tbgFill2: string;\n\tbgFillInverted1: string;\n\tbgFillInverted2: string;\n\tbgFillDark: string;\n\t// Foreground (text, icon) colors\n\tfgSurface1: string;\n\tfgSurface2: string;\n\tfgSurface3: string;\n\tfgSurface4: string;\n\t// Foreground (text, icon) colors on top of bgFill\n\tfgFill: string;\n\tfgFillInverted: string;\n\tfgFillDark: string;\n};\n\nexport type RampDirection = 'lighter' | 'darker';\nexport type FollowDirection = 'main' | 'opposite' | 'best' | RampDirection;\nexport type ContrastRequirement = {\n\t/** The reference color against which to calculate the contrast */\n\treference: keyof Ramp | 'seed';\n\t/**\n\t * Which direction should the algorithm search a matching color in:\n\t * - main: follow the same direction as the ramp's main direction\n\t * - opposite: follow the opposite direction of the ramp\n\t * - best: pick the direction that has the most contrast headroom\n\t * - hardcoded ramp direction (useful for generating colors that always\n\t * light/dark regardless of the ramp direction)\n\t */\n\tfollowDirection: FollowDirection;\n\t/**\n\t * Prefer \"lighter\" direction when searching for a contrasting color.\n\t * Especially useful for foreground color to counter the poor results that the\n\t * WCAG algo gives when contrasting white text over mid-lightness backgrounds.\n\t */\n\tpreferLighter?: boolean;\n\t/**\n\t * The contrast target to meet.\n\t */\n\ttarget: number;\n\t/**\n\t * When true, the algorithm won't count a failure in meeting the contrast\n\t * target as a reason to recalculate the ramp.\n\t */\n\tignoreWhenAdjustingSeed?: boolean;\n};\n\nexport type RampStepConfig = {\n\tcontrast: ContrastRequirement;\n\tlightness?: ( direction: RampDirection ) => number;\n\ttaperChromaOptions?: TaperChromaOptions;\n\t/**\n\t * If specified, try to reuse the color from this step if it meets\n\t * the contrast requirements. This reduces the number of unique colors\n\t * in the ramp and improves consistency.\n\t */\n\tsameAsIfPossible?: keyof Ramp;\n};\n\nexport type RampConfig = Record< keyof Ramp, RampStepConfig >;\n\nexport type RampResult = {\n\tramp: Record<\n\t\tkeyof Ramp,\n\t\t{\n\t\t\tcolor: string;\n\t\t\twarning: boolean;\n\t\t}\n\t>;\n\tdirection: RampDirection;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -7,27 +6,33 @@ var __export = (target, all) => {
|
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
8
|
};
|
|
10
|
-
var __copyProps = (
|
|
9
|
+
var __copyProps = (to2, from, except, desc) => {
|
|
11
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
11
|
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(
|
|
14
|
-
__defProp(
|
|
12
|
+
if (!__hasOwnProp.call(to2, key) && key !== except)
|
|
13
|
+
__defProp(to2, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
14
|
}
|
|
16
|
-
return
|
|
15
|
+
return to2;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/color-ramps/lib/utils.ts
|
|
19
20
|
var utils_exports = {};
|
|
20
21
|
__export(utils_exports, {
|
|
21
22
|
adjustContrastTarget: () => adjustContrastTarget,
|
|
22
23
|
clampAccentScaleReferenceLightness: () => clampAccentScaleReferenceLightness,
|
|
23
24
|
clampToGamut: () => clampToGamut,
|
|
24
25
|
computeBetterFgColorDirection: () => computeBetterFgColorDirection,
|
|
25
|
-
|
|
26
|
+
solveWithBisect: () => solveWithBisect,
|
|
27
|
+
sortByDependency: () => sortByDependency,
|
|
28
|
+
stepsForStep: () => stepsForStep
|
|
26
29
|
});
|
|
27
30
|
module.exports = __toCommonJS(utils_exports);
|
|
31
|
+
var import_fn = require("colorjs.io/fn");
|
|
32
|
+
var import_register_color_spaces = require("./register-color-spaces");
|
|
28
33
|
var import_constants = require("./constants");
|
|
29
|
-
var
|
|
30
|
-
|
|
34
|
+
var import_color_utils = require("./color-utils");
|
|
35
|
+
var clampToGamut = (c) => (0, import_fn.to)((0, import_fn.toGamut)(c, { space: import_fn.P3, method: "css" }), import_fn.OKLCH);
|
|
31
36
|
function buildDependencyGraph(config) {
|
|
32
37
|
const dependencies = /* @__PURE__ */ new Map();
|
|
33
38
|
const dependents = /* @__PURE__ */ new Map();
|
|
@@ -80,9 +85,28 @@ function sortByDependency(config) {
|
|
|
80
85
|
visit("seed");
|
|
81
86
|
return result;
|
|
82
87
|
}
|
|
88
|
+
function stepsForStep(stepName, config) {
|
|
89
|
+
const result = /* @__PURE__ */ new Set();
|
|
90
|
+
function visit(step) {
|
|
91
|
+
if (step === "seed" || result.has(step)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const stepConfig = config[step];
|
|
95
|
+
if (!stepConfig) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
visit(stepConfig.contrast.reference);
|
|
99
|
+
if (stepConfig.sameAsIfPossible) {
|
|
100
|
+
visit(stepConfig.sameAsIfPossible);
|
|
101
|
+
}
|
|
102
|
+
result.add(step);
|
|
103
|
+
}
|
|
104
|
+
visit(stepName);
|
|
105
|
+
return Array.from(result);
|
|
106
|
+
}
|
|
83
107
|
function computeBetterFgColorDirection(seed, preferLighter) {
|
|
84
|
-
const contrastAgainstBlack = (0,
|
|
85
|
-
const contrastAgainstWhite = (0,
|
|
108
|
+
const contrastAgainstBlack = (0, import_color_utils.getContrast)(seed, import_constants.BLACK);
|
|
109
|
+
const contrastAgainstWhite = (0, import_color_utils.getContrast)(seed, import_constants.WHITE);
|
|
86
110
|
return contrastAgainstBlack > contrastAgainstWhite + (preferLighter ? import_constants.WHITE_TEXT_CONTRAST_MARGIN : 0) ? { better: "darker", worse: "lighter" } : { better: "lighter", worse: "darker" };
|
|
87
111
|
}
|
|
88
112
|
function adjustContrastTarget(target) {
|
|
@@ -95,12 +119,52 @@ function clampAccentScaleReferenceLightness(rawLightness, direction) {
|
|
|
95
119
|
const thresholds = import_constants.ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS[direction];
|
|
96
120
|
return Math.max(thresholds.min, Math.min(thresholds.max, rawLightness));
|
|
97
121
|
}
|
|
122
|
+
function solveWithBisect(calculateC, calculateValue, initLowerL, initLowerValue, initUpperL, initUpperValue) {
|
|
123
|
+
let lowerL = initLowerL;
|
|
124
|
+
let lowerValue = initLowerValue;
|
|
125
|
+
let lowerReplaced = false;
|
|
126
|
+
let upperL = initUpperL;
|
|
127
|
+
let upperValue = initUpperValue;
|
|
128
|
+
let upperReplaced = false;
|
|
129
|
+
let bestC;
|
|
130
|
+
let bestValue;
|
|
131
|
+
let iterations = 0;
|
|
132
|
+
while (true) {
|
|
133
|
+
iterations++;
|
|
134
|
+
const newL = (lowerL * upperValue - upperL * lowerValue) / (upperValue - lowerValue);
|
|
135
|
+
bestC = calculateC(newL);
|
|
136
|
+
bestValue = calculateValue(bestC);
|
|
137
|
+
if (Math.abs(bestValue) <= import_constants.CONTRAST_EPSILON || iterations >= import_constants.MAX_BISECTION_ITERATIONS) {
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
if (bestValue <= 0) {
|
|
141
|
+
lowerL = newL;
|
|
142
|
+
lowerValue = bestValue;
|
|
143
|
+
if (lowerReplaced) {
|
|
144
|
+
upperValue /= 2;
|
|
145
|
+
}
|
|
146
|
+
lowerReplaced = true;
|
|
147
|
+
upperReplaced = false;
|
|
148
|
+
} else {
|
|
149
|
+
upperL = newL;
|
|
150
|
+
upperValue = bestValue;
|
|
151
|
+
if (upperReplaced) {
|
|
152
|
+
lowerValue /= 2;
|
|
153
|
+
}
|
|
154
|
+
upperReplaced = true;
|
|
155
|
+
lowerReplaced = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return bestC;
|
|
159
|
+
}
|
|
98
160
|
// Annotate the CommonJS export names for ESM import in node:
|
|
99
161
|
0 && (module.exports = {
|
|
100
162
|
adjustContrastTarget,
|
|
101
163
|
clampAccentScaleReferenceLightness,
|
|
102
164
|
clampToGamut,
|
|
103
165
|
computeBetterFgColorDirection,
|
|
104
|
-
|
|
166
|
+
solveWithBisect,
|
|
167
|
+
sortByDependency,
|
|
168
|
+
stepsForStep
|
|
105
169
|
});
|
|
106
170
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/utils.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport type
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { toGamut, to, P3, OKLCH, type ColorTypes } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport {\n\tWHITE,\n\tBLACK,\n\tUNIVERSAL_CONTRAST_TOPUP,\n\tWHITE_TEXT_CONTRAST_MARGIN,\n\tACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS,\n\tMAX_BISECTION_ITERATIONS,\n\tCONTRAST_EPSILON,\n} from './constants';\nimport type { Ramp, RampConfig, RampDirection } from './types';\nimport { getContrast } from './color-utils';\n\n/**\n * Make sure that a color is valid in the p3 gamut, and converts it to oklch.\n * @param c\n */\nexport const clampToGamut = ( c: ColorTypes ) =>\n\tto( toGamut( c, { space: P3, method: 'css' } ), OKLCH ); // map into Display-P3 using CSS OKLCH method\n\n/**\n * Build a dependency graph from the steps configuration\n * @param config - The steps configuration object\n */\nfunction buildDependencyGraph( config: RampConfig ): {\n\tdependencies: Map< keyof Ramp, ( keyof Ramp | 'seed' )[] >;\n\tdependents: Map< keyof Ramp | 'seed', ( keyof Ramp )[] >;\n} {\n\tconst dependencies = new Map< keyof Ramp, ( keyof Ramp | 'seed' )[] >();\n\tconst dependents = new Map< keyof Ramp | 'seed', ( keyof Ramp )[] >();\n\n\t// Initialize maps\n\tObject.keys( config ).forEach( ( step ) => {\n\t\tdependencies.set( step as keyof Ramp, [] );\n\t} );\n\tdependents.set( 'seed', [] );\n\tObject.keys( config ).forEach( ( step ) => {\n\t\tdependents.set( step as keyof Ramp, [] );\n\t} );\n\n\t// Build the graph\n\tObject.entries( config ).forEach( ( [ stepName, stepConfig ] ) => {\n\t\tconst step = stepName as keyof Ramp;\n\t\tconst reference = stepConfig.contrast.reference;\n\n\t\tdependencies.get( step )!.push( reference );\n\t\tdependents.get( reference )!.push( step );\n\n\t\t// Add dependency for sameAsIfPossible\n\t\tif ( stepConfig.sameAsIfPossible ) {\n\t\t\tdependencies.get( step )!.push( stepConfig.sameAsIfPossible );\n\t\t\tdependents.get( stepConfig.sameAsIfPossible )!.push( step );\n\t\t}\n\t} );\n\n\treturn { dependencies, dependents };\n}\n\n/**\n * Topologically sort steps based on their dependencies\n * @param config - The steps configuration object\n */\nexport function sortByDependency( config: RampConfig ): ( keyof Ramp )[] {\n\tconst { dependents } = buildDependencyGraph( config );\n\tconst result: ( keyof Ramp )[] = [];\n\tconst visited = new Set< keyof Ramp | 'seed' >();\n\tconst visiting = new Set< keyof Ramp | 'seed' >();\n\n\tfunction visit( node: keyof Ramp | 'seed' ): void {\n\t\tif ( visiting.has( node ) ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Circular dependency detected involving step: ${ String(\n\t\t\t\t\tnode\n\t\t\t\t) }`\n\t\t\t);\n\t\t}\n\t\tif ( visited.has( node ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvisiting.add( node );\n\n\t\t// Visit all dependents (steps that depend on this node)\n\t\tconst nodeDependents = dependents.get( node ) || [];\n\t\tnodeDependents.forEach( ( dependent ) => {\n\t\t\tvisit( dependent );\n\t\t} );\n\n\t\tvisiting.delete( node );\n\t\tvisited.add( node );\n\n\t\t// Add to result only if it's a step (not 'seed')\n\t\tif ( node !== 'seed' ) {\n\t\t\tresult.unshift( node ); // Add to front for correct topological order\n\t\t}\n\t}\n\n\t// Start with seed - this will recursively visit all reachable nodes\n\tvisit( 'seed' );\n\n\treturn result;\n}\n/**\n * Return minimal set of steps that are needed to calculate `stepName` from the seed.\n * @param stepName Name of the step.\n * @param config Configuration of the ramp.\n * @return Array of steps that `stepName` depends on.\n */\nexport function stepsForStep(\n\tstepName: keyof Ramp,\n\tconfig: RampConfig\n): ( keyof Ramp )[] {\n\tconst result = new Set< keyof Ramp >();\n\tfunction visit( step: keyof Ramp | 'seed' ) {\n\t\tif ( step === 'seed' || result.has( step ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst stepConfig = config[ step ];\n\t\tif ( ! stepConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvisit( stepConfig.contrast.reference );\n\t\tif ( stepConfig.sameAsIfPossible ) {\n\t\t\tvisit( stepConfig.sameAsIfPossible );\n\t\t}\n\n\t\tresult.add( step );\n\t}\n\tvisit( stepName );\n\treturn Array.from( result );\n}\n\n/**\n * Finds out whether a lighter or a darker foreground color achieves a better\n * contrast against the seed\n * @param seed\n * @param preferLighter Whether the check should favor white foreground color\n * @return An object with \"better\" and \"worse\" properties, each holding a\n * ramp direction value.\n */\nexport function computeBetterFgColorDirection(\n\tseed: ColorTypes,\n\tpreferLighter?: boolean\n): {\n\tbetter: RampDirection;\n\tworse: RampDirection;\n} {\n\tconst contrastAgainstBlack = getContrast( seed, BLACK );\n\tconst contrastAgainstWhite = getContrast( seed, WHITE );\n\n\treturn contrastAgainstBlack >\n\t\tcontrastAgainstWhite +\n\t\t\t( preferLighter ? WHITE_TEXT_CONTRAST_MARGIN : 0 )\n\t\t? { better: 'darker', worse: 'lighter' }\n\t\t: { better: 'lighter', worse: 'darker' };\n}\n\nexport function adjustContrastTarget( target: number ) {\n\tif ( target === 1 ) {\n\t\treturn 1;\n\t}\n\n\t// Add a little top up to take into account any rounding error and algo imprecisions.\n\treturn target + UNIVERSAL_CONTRAST_TOPUP;\n}\n\n/**\n * Prevent the accent scale from referencing a lightness value that\n * would prevent the algorithm from complying with the requirements\n * and cause it to generate unexpected results.\n * @param rawLightness\n * @param direction\n * @return The clamped lightness value\n */\nexport function clampAccentScaleReferenceLightness(\n\trawLightness: number,\n\tdirection: RampDirection\n) {\n\tconst thresholds = ACCENT_SCALE_BASE_LIGHTNESS_THRESHOLDS[ direction ];\n\treturn Math.max( thresholds.min, Math.min( thresholds.max, rawLightness ) );\n}\n\n/**\n * Find the value of of `L` (luminance) that produces a `C` (color) that has a\n * `value` (contrast delta) equal to zero.\n * @param calculateC Calculate `C` from a given `L`.\n * @param calculateValue Calculate value (delta) for a given `C`.\n * @param initLowerL Initial lower value of `L`.\n * @param initLowerValue Initial lower delta (negative).\n * @param initUpperL Initial upper value of `L`.\n * @param initUpperValue Initial upper delta (positive).\n * @return Resulting value of type `C`.\n */\nexport function solveWithBisect< C >(\n\tcalculateC: ( l: number ) => C,\n\tcalculateValue: ( t: C ) => number,\n\tinitLowerL: number,\n\tinitLowerValue: number,\n\tinitUpperL: number,\n\tinitUpperValue: number\n): C {\n\tlet lowerL = initLowerL;\n\tlet lowerValue = initLowerValue;\n\tlet lowerReplaced = false;\n\n\tlet upperL = initUpperL;\n\tlet upperValue = initUpperValue;\n\tlet upperReplaced = false;\n\n\tlet bestC: C;\n\tlet bestValue: number;\n\tlet iterations = 0;\n\n\twhile ( true ) {\n\t\titerations++;\n\n\t\t// Linear interpolation: find the point where a line would cross the zero axis.\n\t\tconst newL =\n\t\t\t( lowerL * upperValue - upperL * lowerValue ) /\n\t\t\t( upperValue - lowerValue );\n\n\t\tbestC = calculateC( newL );\n\t\tbestValue = calculateValue( bestC );\n\n\t\tif (\n\t\t\tMath.abs( bestValue ) <= CONTRAST_EPSILON ||\n\t\t\titerations >= MAX_BISECTION_ITERATIONS\n\t\t) {\n\t\t\tbreak;\n\t\t}\n\n\t\t// Update the lower/upper bracket values. When only one side is repeatedly updated,\n\t\t// apply so-called \"Illinois trick\" for faster convergence: halve the opposite value.\n\t\tif ( bestValue <= 0 ) {\n\t\t\tlowerL = newL;\n\t\t\tlowerValue = bestValue;\n\t\t\tif ( lowerReplaced ) {\n\t\t\t\tupperValue /= 2;\n\t\t\t}\n\t\t\tlowerReplaced = true;\n\t\t\tupperReplaced = false;\n\t\t} else {\n\t\t\tupperL = newL;\n\t\t\tupperValue = bestValue;\n\t\t\tif ( upperReplaced ) {\n\t\t\t\tlowerValue /= 2;\n\t\t\t}\n\t\t\tupperReplaced = true;\n\t\t\tlowerReplaced = false;\n\t\t}\n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f,cACA,WACC;AACD,QAAM,aAAa,wDAAwC,SAAU;AACrE,SAAO,KAAK,IAAK,WAAW,KAAK,KAAK,IAAK,WAAW,KAAK,YAAa,CAAE;AAC3E;AAaO,SAAS,gBACf,YACA,gBACA,YACA,gBACA,YACA,gBACI;AACJ,MAAI,SAAS;AACb,MAAI,aAAa;AACjB,MAAI,gBAAgB;AAEpB,MAAI,SAAS;AACb,MAAI,aAAa;AACjB,MAAI,gBAAgB;AAEpB,MAAI;AACJ,MAAI;AACJ,MAAI,aAAa;AAEjB,SAAQ,MAAO;AACd;AAGA,UAAM,QACH,SAAS,aAAa,SAAS,eAC/B,aAAa;AAEhB,YAAQ,WAAY,IAAK;AACzB,gBAAY,eAAgB,KAAM;AAElC,QACC,KAAK,IAAK,SAAU,KAAK,qCACzB,cAAc,2CACb;AACD;AAAA,IACD;AAIA,QAAK,aAAa,GAAI;AACrB,eAAS;AACT,mBAAa;AACb,UAAK,eAAgB;AACpB,sBAAc;AAAA,MACf;AACA,sBAAgB;AAChB,sBAAgB;AAAA,IACjB,OAAO;AACN,eAAS;AACT,mBAAa;AACb,UAAK,eAAgB;AACpB,sBAAc;AAAA,MACf;AACA,sBAAgB;AAChB,sBAAgB;AAAA,IACjB;AAAA,EACD;AAEA,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/context.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,13 +15,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/context.ts
|
|
19
20
|
var context_exports = {};
|
|
20
21
|
__export(context_exports, {
|
|
21
22
|
ThemeContext: () => ThemeContext
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(context_exports);
|
|
24
25
|
var import_element = require("@wordpress/element");
|
|
25
|
-
|
|
26
|
+
var ThemeContext = (0, import_element.createContext)({
|
|
26
27
|
resolvedSettings: {
|
|
27
28
|
color: {}
|
|
28
29
|
}
|
package/build/context.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/context.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ThemeProviderSettings } from './types';\n\ninterface ThemeContextType {\n\tresolvedSettings: ThemeProviderSettings;\n}\n\nexport const ThemeContext = createContext< ThemeContextType >( {\n\tresolvedSettings: {\n\t\tcolor: {},\n\t},\n} );\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA8B;AAWvB,IAAM,mBAAe,8BAAmC;AAAA,EAC9D,kBAAkB;AAAA,IACjB,OAAO,CAAC;AAAA,EACT;AACD,CAAE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/index.ts
|
|
19
20
|
var index_exports = {};
|
|
20
21
|
__export(index_exports, {
|
|
21
22
|
privateApis: () => import_private_apis.privateApis
|
package/build/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["// Private APIs.\nexport { privateApis } from './private-apis';\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAA4B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/lock-unlock.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/lock-unlock.ts
|
|
19
20
|
var lock_unlock_exports = {};
|
|
20
21
|
__export(lock_unlock_exports, {
|
|
21
22
|
lock: () => lock,
|
|
@@ -23,7 +24,7 @@ __export(lock_unlock_exports, {
|
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(lock_unlock_exports);
|
|
25
26
|
var import_private_apis = require("@wordpress/private-apis");
|
|
26
|
-
|
|
27
|
+
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
|
|
27
28
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
28
29
|
"@wordpress/theme"
|
|
29
30
|
);
|
package/build/lock-unlock.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/theme'\n\t);\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,IAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,6 +15,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
15
|
return to;
|
|
17
16
|
};
|
|
18
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// packages/theme/src/prebuilt/js/design-tokens.js
|
|
19
20
|
var design_tokens_exports = {};
|
|
20
21
|
__export(design_tokens_exports, {
|
|
21
22
|
default: () => design_tokens_default
|
|
@@ -37,6 +38,8 @@ var design_tokens_default = [
|
|
|
37
38
|
"--wpds-color-bg-surface-info-weak",
|
|
38
39
|
"--wpds-color-bg-surface-warning",
|
|
39
40
|
"--wpds-color-bg-surface-warning-weak",
|
|
41
|
+
"--wpds-color-bg-surface-caution",
|
|
42
|
+
"--wpds-color-bg-surface-caution-weak",
|
|
40
43
|
"--wpds-color-bg-surface-error",
|
|
41
44
|
"--wpds-color-bg-surface-error-weak",
|
|
42
45
|
"--wpds-color-bg-interactive-neutral",
|
|
@@ -66,6 +69,16 @@ var design_tokens_default = [
|
|
|
66
69
|
"--wpds-color-bg-thumb-brand-disabled",
|
|
67
70
|
"--wpds-color-fg-content-neutral",
|
|
68
71
|
"--wpds-color-fg-content-neutral-weak",
|
|
72
|
+
"--wpds-color-fg-content-success",
|
|
73
|
+
"--wpds-color-fg-content-success-weak",
|
|
74
|
+
"--wpds-color-fg-content-info",
|
|
75
|
+
"--wpds-color-fg-content-info-weak",
|
|
76
|
+
"--wpds-color-fg-content-warning",
|
|
77
|
+
"--wpds-color-fg-content-warning-weak",
|
|
78
|
+
"--wpds-color-fg-content-caution",
|
|
79
|
+
"--wpds-color-fg-content-caution-weak",
|
|
80
|
+
"--wpds-color-fg-content-error",
|
|
81
|
+
"--wpds-color-fg-content-error-weak",
|
|
69
82
|
"--wpds-color-fg-interactive-neutral",
|
|
70
83
|
"--wpds-color-fg-interactive-neutral-active",
|
|
71
84
|
"--wpds-color-fg-interactive-neutral-disabled",
|
|
@@ -102,20 +115,15 @@ var design_tokens_default = [
|
|
|
102
115
|
"--wpds-color-stroke-interactive-brand-disabled",
|
|
103
116
|
"--wpds-color-stroke-interactive-error-strong",
|
|
104
117
|
"--wpds-color-stroke-focus-brand",
|
|
118
|
+
"--wpds-dimension-base",
|
|
119
|
+
"--wpds-dimension-padding-surface-x-small",
|
|
120
|
+
"--wpds-dimension-padding-surface-small",
|
|
121
|
+
"--wpds-dimension-padding-surface-medium",
|
|
122
|
+
"--wpds-dimension-padding-surface-large",
|
|
105
123
|
"--wpds-elevation-x-small",
|
|
106
124
|
"--wpds-elevation-small",
|
|
107
125
|
"--wpds-elevation-medium",
|
|
108
126
|
"--wpds-elevation-large",
|
|
109
|
-
"--wpds-spacing-05",
|
|
110
|
-
"--wpds-spacing-10",
|
|
111
|
-
"--wpds-spacing-15",
|
|
112
|
-
"--wpds-spacing-20",
|
|
113
|
-
"--wpds-spacing-30",
|
|
114
|
-
"--wpds-spacing-40",
|
|
115
|
-
"--wpds-spacing-50",
|
|
116
|
-
"--wpds-spacing-60",
|
|
117
|
-
"--wpds-spacing-70",
|
|
118
|
-
"--wpds-spacing-80",
|
|
119
127
|
"--wpds-font-family-heading",
|
|
120
128
|
"--wpds-font-family-body",
|
|
121
129
|
"--wpds-font-family-mono",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/prebuilt/js/design-tokens.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin.\n * Do not edit this file directly.\n */\n\nexport default [\n\t'--wpds-border-radius-x-small',\n\t'--wpds-border-radius-small',\n\t'--wpds-border-radius-medium',\n\t'--wpds-border-radius-large',\n\t'--wpds-border-width-focus',\n\t'--wpds-color-bg-surface-neutral',\n\t'--wpds-color-bg-surface-neutral-strong',\n\t'--wpds-color-bg-surface-neutral-weak',\n\t'--wpds-color-bg-surface-brand',\n\t'--wpds-color-bg-surface-success',\n\t'--wpds-color-bg-surface-success-weak',\n\t'--wpds-color-bg-surface-info',\n\t'--wpds-color-bg-surface-info-weak',\n\t'--wpds-color-bg-surface-warning',\n\t'--wpds-color-bg-surface-warning-weak',\n\t'--wpds-color-bg-surface-error',\n\t'--wpds-color-bg-surface-error-weak',\n\t'--wpds-color-bg-interactive-neutral',\n\t'--wpds-color-bg-interactive-neutral-active',\n\t'--wpds-color-bg-interactive-neutral-disabled',\n\t'--wpds-color-bg-interactive-neutral-strong',\n\t'--wpds-color-bg-interactive-neutral-strong-active',\n\t'--wpds-color-bg-interactive-neutral-strong-disabled',\n\t'--wpds-color-bg-interactive-neutral-weak',\n\t'--wpds-color-bg-interactive-neutral-weak-active',\n\t'--wpds-color-bg-interactive-neutral-weak-disabled',\n\t'--wpds-color-bg-interactive-brand',\n\t'--wpds-color-bg-interactive-brand-active',\n\t'--wpds-color-bg-interactive-brand-disabled',\n\t'--wpds-color-bg-interactive-brand-strong',\n\t'--wpds-color-bg-interactive-brand-strong-active',\n\t'--wpds-color-bg-interactive-brand-strong-disabled',\n\t'--wpds-color-bg-interactive-brand-weak',\n\t'--wpds-color-bg-interactive-brand-weak-active',\n\t'--wpds-color-bg-interactive-brand-weak-disabled',\n\t'--wpds-color-bg-track-neutral-weak',\n\t'--wpds-color-bg-track-neutral',\n\t'--wpds-color-bg-thumb-neutral-weak',\n\t'--wpds-color-bg-thumb-neutral-weak-active',\n\t'--wpds-color-bg-thumb-brand',\n\t'--wpds-color-bg-thumb-brand-active',\n\t'--wpds-color-bg-thumb-brand-disabled',\n\t'--wpds-color-fg-content-neutral',\n\t'--wpds-color-fg-content-neutral-weak',\n\t'--wpds-color-fg-interactive-neutral',\n\t'--wpds-color-fg-interactive-neutral-active',\n\t'--wpds-color-fg-interactive-neutral-disabled',\n\t'--wpds-color-fg-interactive-neutral-strong',\n\t'--wpds-color-fg-interactive-neutral-strong-active',\n\t'--wpds-color-fg-interactive-neutral-strong-disabled',\n\t'--wpds-color-fg-interactive-neutral-weak',\n\t'--wpds-color-fg-interactive-neutral-weak-disabled',\n\t'--wpds-color-fg-interactive-brand',\n\t'--wpds-color-fg-interactive-brand-active',\n\t'--wpds-color-fg-interactive-brand-disabled',\n\t'--wpds-color-fg-interactive-brand-strong',\n\t'--wpds-color-fg-interactive-brand-strong-active',\n\t'--wpds-color-fg-interactive-brand-strong-disabled',\n\t'--wpds-color-stroke-surface-neutral',\n\t'--wpds-color-stroke-surface-neutral-weak',\n\t'--wpds-color-stroke-surface-neutral-strong',\n\t'--wpds-color-stroke-surface-brand',\n\t'--wpds-color-stroke-surface-brand-strong',\n\t'--wpds-color-stroke-surface-success',\n\t'--wpds-color-stroke-surface-success-strong',\n\t'--wpds-color-stroke-surface-info',\n\t'--wpds-color-stroke-surface-info-strong',\n\t'--wpds-color-stroke-surface-warning',\n\t'--wpds-color-stroke-surface-warning-strong',\n\t'--wpds-color-stroke-surface-error',\n\t'--wpds-color-stroke-surface-error-strong',\n\t'--wpds-color-stroke-interactive-neutral',\n\t'--wpds-color-stroke-interactive-neutral-active',\n\t'--wpds-color-stroke-interactive-neutral-disabled',\n\t'--wpds-color-stroke-interactive-neutral-strong',\n\t'--wpds-color-stroke-interactive-brand',\n\t'--wpds-color-stroke-interactive-brand-active',\n\t'--wpds-color-stroke-interactive-brand-disabled',\n\t'--wpds-color-stroke-interactive-error-strong',\n\t'--wpds-color-stroke-focus-brand',\n\t'--wpds-
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["/**\n * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin.\n * Do not edit this file directly.\n */\n\nexport default [\n\t'--wpds-border-radius-x-small',\n\t'--wpds-border-radius-small',\n\t'--wpds-border-radius-medium',\n\t'--wpds-border-radius-large',\n\t'--wpds-border-width-focus',\n\t'--wpds-color-bg-surface-neutral',\n\t'--wpds-color-bg-surface-neutral-strong',\n\t'--wpds-color-bg-surface-neutral-weak',\n\t'--wpds-color-bg-surface-brand',\n\t'--wpds-color-bg-surface-success',\n\t'--wpds-color-bg-surface-success-weak',\n\t'--wpds-color-bg-surface-info',\n\t'--wpds-color-bg-surface-info-weak',\n\t'--wpds-color-bg-surface-warning',\n\t'--wpds-color-bg-surface-warning-weak',\n\t'--wpds-color-bg-surface-caution',\n\t'--wpds-color-bg-surface-caution-weak',\n\t'--wpds-color-bg-surface-error',\n\t'--wpds-color-bg-surface-error-weak',\n\t'--wpds-color-bg-interactive-neutral',\n\t'--wpds-color-bg-interactive-neutral-active',\n\t'--wpds-color-bg-interactive-neutral-disabled',\n\t'--wpds-color-bg-interactive-neutral-strong',\n\t'--wpds-color-bg-interactive-neutral-strong-active',\n\t'--wpds-color-bg-interactive-neutral-strong-disabled',\n\t'--wpds-color-bg-interactive-neutral-weak',\n\t'--wpds-color-bg-interactive-neutral-weak-active',\n\t'--wpds-color-bg-interactive-neutral-weak-disabled',\n\t'--wpds-color-bg-interactive-brand',\n\t'--wpds-color-bg-interactive-brand-active',\n\t'--wpds-color-bg-interactive-brand-disabled',\n\t'--wpds-color-bg-interactive-brand-strong',\n\t'--wpds-color-bg-interactive-brand-strong-active',\n\t'--wpds-color-bg-interactive-brand-strong-disabled',\n\t'--wpds-color-bg-interactive-brand-weak',\n\t'--wpds-color-bg-interactive-brand-weak-active',\n\t'--wpds-color-bg-interactive-brand-weak-disabled',\n\t'--wpds-color-bg-track-neutral-weak',\n\t'--wpds-color-bg-track-neutral',\n\t'--wpds-color-bg-thumb-neutral-weak',\n\t'--wpds-color-bg-thumb-neutral-weak-active',\n\t'--wpds-color-bg-thumb-brand',\n\t'--wpds-color-bg-thumb-brand-active',\n\t'--wpds-color-bg-thumb-brand-disabled',\n\t'--wpds-color-fg-content-neutral',\n\t'--wpds-color-fg-content-neutral-weak',\n\t'--wpds-color-fg-content-success',\n\t'--wpds-color-fg-content-success-weak',\n\t'--wpds-color-fg-content-info',\n\t'--wpds-color-fg-content-info-weak',\n\t'--wpds-color-fg-content-warning',\n\t'--wpds-color-fg-content-warning-weak',\n\t'--wpds-color-fg-content-caution',\n\t'--wpds-color-fg-content-caution-weak',\n\t'--wpds-color-fg-content-error',\n\t'--wpds-color-fg-content-error-weak',\n\t'--wpds-color-fg-interactive-neutral',\n\t'--wpds-color-fg-interactive-neutral-active',\n\t'--wpds-color-fg-interactive-neutral-disabled',\n\t'--wpds-color-fg-interactive-neutral-strong',\n\t'--wpds-color-fg-interactive-neutral-strong-active',\n\t'--wpds-color-fg-interactive-neutral-strong-disabled',\n\t'--wpds-color-fg-interactive-neutral-weak',\n\t'--wpds-color-fg-interactive-neutral-weak-disabled',\n\t'--wpds-color-fg-interactive-brand',\n\t'--wpds-color-fg-interactive-brand-active',\n\t'--wpds-color-fg-interactive-brand-disabled',\n\t'--wpds-color-fg-interactive-brand-strong',\n\t'--wpds-color-fg-interactive-brand-strong-active',\n\t'--wpds-color-fg-interactive-brand-strong-disabled',\n\t'--wpds-color-stroke-surface-neutral',\n\t'--wpds-color-stroke-surface-neutral-weak',\n\t'--wpds-color-stroke-surface-neutral-strong',\n\t'--wpds-color-stroke-surface-brand',\n\t'--wpds-color-stroke-surface-brand-strong',\n\t'--wpds-color-stroke-surface-success',\n\t'--wpds-color-stroke-surface-success-strong',\n\t'--wpds-color-stroke-surface-info',\n\t'--wpds-color-stroke-surface-info-strong',\n\t'--wpds-color-stroke-surface-warning',\n\t'--wpds-color-stroke-surface-warning-strong',\n\t'--wpds-color-stroke-surface-error',\n\t'--wpds-color-stroke-surface-error-strong',\n\t'--wpds-color-stroke-interactive-neutral',\n\t'--wpds-color-stroke-interactive-neutral-active',\n\t'--wpds-color-stroke-interactive-neutral-disabled',\n\t'--wpds-color-stroke-interactive-neutral-strong',\n\t'--wpds-color-stroke-interactive-brand',\n\t'--wpds-color-stroke-interactive-brand-active',\n\t'--wpds-color-stroke-interactive-brand-disabled',\n\t'--wpds-color-stroke-interactive-error-strong',\n\t'--wpds-color-stroke-focus-brand',\n\t'--wpds-dimension-base',\n\t'--wpds-dimension-padding-surface-x-small',\n\t'--wpds-dimension-padding-surface-small',\n\t'--wpds-dimension-padding-surface-medium',\n\t'--wpds-dimension-padding-surface-large',\n\t'--wpds-elevation-x-small',\n\t'--wpds-elevation-small',\n\t'--wpds-elevation-medium',\n\t'--wpds-elevation-large',\n\t'--wpds-font-family-heading',\n\t'--wpds-font-family-body',\n\t'--wpds-font-family-mono',\n\t'--wpds-font-size-x-small',\n\t'--wpds-font-size-small',\n\t'--wpds-font-size-medium',\n\t'--wpds-font-size-large',\n\t'--wpds-font-size-x-large',\n\t'--wpds-font-size-2x-large',\n\t'--wpds-font-line-height-x-small',\n\t'--wpds-font-line-height-small',\n\t'--wpds-font-line-height-medium',\n\t'--wpds-font-line-height-large',\n\t'--wpds-font-line-height-x-large',\n\t'--wpds-font-line-height-2x-large',\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,IAAO,wBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|