@ng-native/fabric 0.3.0 → 0.5.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/dist/aria-props.d.ts +16 -0
- package/dist/aria-props.js +78 -0
- package/dist/aria-props.js.map +1 -0
- package/dist/color-mix.js +1 -16
- package/dist/color-mix.js.map +1 -1
- package/dist/css.d.ts +169 -2
- package/dist/css.js +676 -34
- package/dist/css.js.map +1 -1
- package/dist/element-styles.d.ts +15 -0
- package/dist/element-styles.js +103 -0
- package/dist/element-styles.js.map +1 -0
- package/dist/engine.d.ts +252 -7
- package/dist/engine.js +1081 -80
- package/dist/engine.js.map +1 -1
- package/dist/font-faces.d.ts +5 -2
- package/dist/font-faces.js +13 -2
- package/dist/font-faces.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/inline-derived-token.js +11 -10
- package/dist/inline-derived-token.js.map +1 -1
- package/dist/inline-token.d.ts +7 -0
- package/dist/inline-token.js +53 -8
- package/dist/inline-token.js.map +1 -1
- package/dist/inline-transform.d.ts +5 -1
- package/dist/inline-transform.js +34 -6
- package/dist/inline-transform.js.map +1 -1
- package/dist/native-drive.d.ts +21 -0
- package/dist/native-drive.js +60 -0
- package/dist/native-drive.js.map +1 -1
- package/dist/premultiplied-stops.d.ts +7 -0
- package/dist/premultiplied-stops.js +131 -0
- package/dist/premultiplied-stops.js.map +1 -0
- package/dist/scroll-animation.d.ts +11 -0
- package/dist/scroll-animation.js +29 -0
- package/dist/scroll-animation.js.map +1 -1
- package/dist/transition.d.ts +15 -0
- package/dist/transition.js +42 -1
- package/dist/transition.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web's `aria-*` attributes as the props native reads, mapped as React Native's `View.js`
|
|
3
|
+
* maps them before a view's props reach native.
|
|
4
|
+
*
|
|
5
|
+
* An attribute is text, on any element that commits a view: the host of an app's own component
|
|
6
|
+
* has no input to take one, and a label that is dropped fails silently for exactly the people who
|
|
7
|
+
* cannot see that it is missing. A prop the element already has is its own answer and is left:
|
|
8
|
+
* the primitives of `@ng-native/components` take these as inputs and write the props themselves.
|
|
9
|
+
*/
|
|
10
|
+
type Props = Record<string, unknown>;
|
|
11
|
+
/**
|
|
12
|
+
* Writes into `props` what the `aria-*` attributes among `attributes` say, wherever `props` does
|
|
13
|
+
* not say it already.
|
|
14
|
+
*/
|
|
15
|
+
export declare function applyAria(attributes: Props, props: Props): void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The web's `aria-*` attributes as the props native reads, mapped as React Native's `View.js`
|
|
3
|
+
* maps them before a view's props reach native.
|
|
4
|
+
*
|
|
5
|
+
* An attribute is text, on any element that commits a view: the host of an app's own component
|
|
6
|
+
* has no input to take one, and a label that is dropped fails silently for exactly the people who
|
|
7
|
+
* cannot see that it is missing. A prop the element already has is its own answer and is left:
|
|
8
|
+
* the primitives of `@ng-native/components` take these as inputs and write the props themselves.
|
|
9
|
+
*/
|
|
10
|
+
/** `'true'` and `'false'` as the booleans they say; anything else, `mixed` included, as written. */
|
|
11
|
+
const flag = (value) => value === 'true' || value === '' ? true : value === 'false' ? false : value;
|
|
12
|
+
/** Text as the number it says, and nothing where it says none: `NaN` is no value to send. */
|
|
13
|
+
const number = (value) => {
|
|
14
|
+
if (typeof value !== 'string')
|
|
15
|
+
return value;
|
|
16
|
+
const said = value.trim() === '' ? NaN : Number(value);
|
|
17
|
+
return Number.isFinite(said) ? said : undefined;
|
|
18
|
+
};
|
|
19
|
+
/** The attributes that are one prop each, with how the value is read. */
|
|
20
|
+
const ONE_TO_ONE = {
|
|
21
|
+
'aria-label': ['accessibilityLabel', (value) => value],
|
|
22
|
+
'aria-labelledby': [
|
|
23
|
+
'accessibilityLabelledBy',
|
|
24
|
+
(value) => (typeof value === 'string' ? value.split(/\s*,\s*/) : value),
|
|
25
|
+
],
|
|
26
|
+
'aria-live': ['accessibilityLiveRegion', (value) => (value === 'off' ? 'none' : value)],
|
|
27
|
+
'aria-hidden': ['accessibilityElementsHidden', flag],
|
|
28
|
+
'aria-modal': ['accessibilityViewIsModal', flag],
|
|
29
|
+
};
|
|
30
|
+
/** The attributes gathered into `accessibilityState`, by the key each is there. */
|
|
31
|
+
const STATE = {
|
|
32
|
+
'aria-busy': 'busy',
|
|
33
|
+
'aria-checked': 'checked',
|
|
34
|
+
'aria-disabled': 'disabled',
|
|
35
|
+
'aria-expanded': 'expanded',
|
|
36
|
+
'aria-selected': 'selected',
|
|
37
|
+
};
|
|
38
|
+
/** The attributes gathered into `accessibilityValue`. */
|
|
39
|
+
const VALUE = {
|
|
40
|
+
'aria-valuemax': 'max',
|
|
41
|
+
'aria-valuemin': 'min',
|
|
42
|
+
'aria-valuenow': 'now',
|
|
43
|
+
'aria-valuetext': 'text',
|
|
44
|
+
};
|
|
45
|
+
/** `attributes` gathered into one object by `keys`, or undefined when it has none of them. */
|
|
46
|
+
function gathered(attributes, keys, read) {
|
|
47
|
+
let out;
|
|
48
|
+
for (const attribute of Object.keys(keys)) {
|
|
49
|
+
const value = attributes[attribute];
|
|
50
|
+
const said = value === undefined || value === null ? undefined : read(keys[attribute], value);
|
|
51
|
+
if (said !== undefined)
|
|
52
|
+
(out ??= {})[keys[attribute]] = said;
|
|
53
|
+
}
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Writes into `props` what the `aria-*` attributes among `attributes` say, wherever `props` does
|
|
58
|
+
* not say it already.
|
|
59
|
+
*/
|
|
60
|
+
export function applyAria(attributes, props) {
|
|
61
|
+
for (const attribute of Object.keys(ONE_TO_ONE)) {
|
|
62
|
+
const value = attributes[attribute];
|
|
63
|
+
const [prop, read] = ONE_TO_ONE[attribute];
|
|
64
|
+
if (value !== undefined && value !== null && props[prop] === undefined)
|
|
65
|
+
props[prop] = read(value);
|
|
66
|
+
}
|
|
67
|
+
// As `View.js`: a hidden element takes what is inside it out of the accessibility tree on
|
|
68
|
+
// Android too, which has no prop of its own for that.
|
|
69
|
+
if (flag(attributes['aria-hidden']) === true)
|
|
70
|
+
props['importantForAccessibility'] ??= 'no-hide-descendants';
|
|
71
|
+
const state = gathered(attributes, STATE, (_, value) => flag(value));
|
|
72
|
+
if (state)
|
|
73
|
+
props['accessibilityState'] ??= state;
|
|
74
|
+
const value = gathered(attributes, VALUE, (key, part) => (key === 'text' ? part : number(part)));
|
|
75
|
+
if (value)
|
|
76
|
+
props['accessibilityValue'] ??= value;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=aria-props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aria-props.js","sourceRoot":"","sources":["../src/aria-props.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,oGAAoG;AACpG,MAAM,IAAI,GAAG,CAAC,KAAc,EAAW,EAAE,CACvC,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AAE9E,6FAA6F;AAC7F,MAAM,MAAM,GAAG,CAAC,KAAc,EAAW,EAAE;IACzC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC,CAAC;AAEF,yEAAyE;AACzE,MAAM,UAAU,GAEZ;IACF,YAAY,EAAE,CAAC,oBAAoB,EAAE,CAAC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AAK,KAAK,CAAC;AACnD,CAAC","sourcesContent":["/**\n * The web's `aria-*` attributes as the props native reads, mapped as React Native's `View.js`\n * maps them before a view's props reach native.\n *\n * An attribute is text, on any element that commits a view: the host of an app's own component\n * has no input to take one, and a label that is dropped fails silently for exactly the people who\n * cannot see that it is missing. A prop the element already has is its own answer and is left:\n * the primitives of `@ng-native/components` take these as inputs and write the props themselves.\n */\n\ntype Props = Record<string, unknown>;\n\n/** `'true'` and `'false'` as the booleans they say; anything else, `mixed` included, as written. */\nconst flag = (value: unknown): unknown =>\n value === 'true' || value === '' ? true : value === 'false' ? false : value;\n\n/** Text as the number it says, and nothing where it says none: `NaN` is no value to send. */\nconst number = (value: unknown): unknown => {\n if (typeof value !== 'string') return value;\n const said = value.trim() === '' ? NaN : Number(value);\n return Number.isFinite(said) ? said : undefined;\n};\n\n/** The attributes that are one prop each, with how the value is read. */\nconst ONE_TO_ONE: Readonly<\n Record<string, readonly [prop: string, read: (value: unknown) => unknown]>\n> = {\n 'aria-label': ['accessibilityLabel', (value) => value],\n 'aria-labelledby': [\n 'accessibilityLabelledBy',\n (value) => (typeof value === 'string' ? value.split(/\\s*,\\s*/) : value),\n ],\n 'aria-live': ['accessibilityLiveRegion', (value) => (value === 'off' ? 'none' : value)],\n 'aria-hidden': ['accessibilityElementsHidden', flag],\n 'aria-modal': ['accessibilityViewIsModal', flag],\n};\n\n/** The attributes gathered into `accessibilityState`, by the key each is there. */\nconst STATE: Readonly<Record<string, string>> = {\n 'aria-busy': 'busy',\n 'aria-checked': 'checked',\n 'aria-disabled': 'disabled',\n 'aria-expanded': 'expanded',\n 'aria-selected': 'selected',\n};\n\n/** The attributes gathered into `accessibilityValue`. */\nconst VALUE: Readonly<Record<string, string>> = {\n 'aria-valuemax': 'max',\n 'aria-valuemin': 'min',\n 'aria-valuenow': 'now',\n 'aria-valuetext': 'text',\n};\n\n/** `attributes` gathered into one object by `keys`, or undefined when it has none of them. */\nfunction gathered(\n attributes: Props,\n keys: Readonly<Record<string, string>>,\n read: (key: string, value: unknown) => unknown,\n): Props | undefined {\n let out: Props | undefined;\n for (const attribute of Object.keys(keys)) {\n const value = attributes[attribute];\n const said = value === undefined || value === null ? undefined : read(keys[attribute]!, value);\n if (said !== undefined) (out ??= {})[keys[attribute]!] = said;\n }\n return out;\n}\n\n/**\n * Writes into `props` what the `aria-*` attributes among `attributes` say, wherever `props` does\n * not say it already.\n */\nexport function applyAria(attributes: Props, props: Props): void {\n for (const attribute of Object.keys(ONE_TO_ONE)) {\n const value = attributes[attribute];\n const [prop, read] = ONE_TO_ONE[attribute]!;\n if (value !== undefined && value !== null && props[prop] === undefined)\n props[prop] = read(value);\n }\n // As `View.js`: a hidden element takes what is inside it out of the accessibility tree on\n // Android too, which has no prop of its own for that.\n if (flag(attributes['aria-hidden']) === true)\n props['importantForAccessibility'] ??= 'no-hide-descendants';\n const state = gathered(attributes, STATE, (_, value) => flag(value));\n if (state) props['accessibilityState'] ??= state;\n const value = gathered(attributes, VALUE, (key, part) => (key === 'text' ? part : number(part)));\n if (value) props['accessibilityValue'] ??= value;\n}\n"]}
|
package/dist/color-mix.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* convert a literal colour at build time, copied here because the engine cannot depend on the
|
|
12
12
|
* build step; the tests hold the two to the same answers.
|
|
13
13
|
*/
|
|
14
|
-
import { parseColor } from "./transition.js";
|
|
14
|
+
import { hslToSrgb, hwbToSrgb, parseColor } from "./transition.js";
|
|
15
15
|
export const MIX_SPACES = new Set([
|
|
16
16
|
'srgb',
|
|
17
17
|
'oklab',
|
|
@@ -112,25 +112,10 @@ function srgbToHsl([r, g, b]) {
|
|
|
112
112
|
: ((r - g) / d + 4) * 60;
|
|
113
113
|
return [h, s, l];
|
|
114
114
|
}
|
|
115
|
-
function hslToSrgb([h, s, l]) {
|
|
116
|
-
const hue = Number.isFinite(h) ? ((h % 360) + 360) % 360 : 0;
|
|
117
|
-
const f = (n) => {
|
|
118
|
-
const k = (n + hue / 30) % 12;
|
|
119
|
-
return l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1));
|
|
120
|
-
};
|
|
121
|
-
return [f(0), f(8), f(4)];
|
|
122
|
-
}
|
|
123
115
|
function srgbToHwb(rgb) {
|
|
124
116
|
const [h] = srgbToHsl(rgb);
|
|
125
117
|
return [h, Math.min(...rgb), 1 - Math.max(...rgb)];
|
|
126
118
|
}
|
|
127
|
-
function hwbToSrgb([h, w, b]) {
|
|
128
|
-
if (w + b >= 1) {
|
|
129
|
-
const grey = w / (w + b);
|
|
130
|
-
return [grey, grey, grey];
|
|
131
|
-
}
|
|
132
|
-
return hslToSrgb([h, 1, 0.5]).map((c) => c * (1 - w - b) + w);
|
|
133
|
-
}
|
|
134
119
|
/** Where the hue sits in each space's coordinates, if it has one. */
|
|
135
120
|
const HUE_INDEX = { oklch: 2, lch: 2, hsl: 0, hwb: 0 };
|
|
136
121
|
/** An sRGB colour, channels 0 to 1, in the space's own coordinates. */
|
package/dist/color-mix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-mix.js","sourceRoot":"","sources":["../src/color-mix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK7C,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAW;IAC/D,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC,CAAC;AAMH,MAAM,KAAK,GAAG,CAAC,CAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAS,EAAU,EAAE,CAChE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAW,CA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,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;QACnF,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,CAAC;IAC5C,CAAC,CAAW,CAAC;IACb,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAE,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC5E,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * `color-mix()` worked out on device, for a mix with a token in it.\n *\n * The compiler folds a mix of literal colours at build time (lightningcss does the arithmetic); a\n * mix with a `var()` in it can only be done once the token is known, so it is done here, with CSS\n * Color 4 and 5's own arithmetic: each colour converted into the named space, premultiplied by its\n * alpha, interpolated (a hue the shorter way round), and brought back to the sRGB native paints,\n * inside its gamut by CSS Color 4's chroma reduction rather than a clip.\n *\n * The matrices and the gamut mapping are the ones `@ng-native/metro`'s `color-spaces.cjs` uses to\n * convert a literal colour at build time, copied here because the engine cannot depend on the\n * build step; the tests hold the two to the same answers.\n */\nimport { parseColor } from './transition.ts';\n\n/** The spaces a mix is worked out in: every one the compiler also folds a literal mix in. */\nexport type MixSpace = 'srgb' | 'oklab' | 'oklch' | 'lab' | 'lch' | 'hsl' | 'hwb';\n\nexport const MIX_SPACES: ReadonlySet<string> = new Set<MixSpace>([\n 'srgb',\n 'oklab',\n 'oklch',\n 'lab',\n 'lch',\n 'hsl',\n 'hwb',\n]);\n\nexport type HueMethod = 'shorter' | 'longer' | 'increasing' | 'decreasing';\n\nexport type Vector = [number, number, number];\n\nconst times = (m: readonly Vector[], [x, y, z]: Vector): Vector =>\n m.map(([a, b, c]) => a * x + b * y + c * z) as Vector;\n\nconst OKLAB_TO_LMS: Vector[] = [\n [1.0, 0.3963377773761749, 0.2158037573099136],\n [1.0, -0.1055613458156586, -0.0638541728258133],\n [1.0, -0.0894841775298119, -1.2914855480194092],\n];\nconst LMS_TO_XYZ: Vector[] = [\n [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],\n [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],\n [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816],\n];\nconst XYZ_TO_LMS: Vector[] = [\n [0.819022437996703, 0.3619062600528904, -0.1288737815209879],\n [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],\n [0.0481771893596242, 0.2642395317527308, 0.6335478284694309],\n];\nconst LMS_TO_OKLAB: Vector[] = [\n [0.210454268309314, 0.7936177747023054, -0.0040720430116193],\n [1.9779985324311684, -2.4285922420485799, 0.450593709617411],\n [0.0259040424655478, 0.7827717124575296, -0.8086757549230774],\n];\nconst XYZ_TO_LINEAR_SRGB: Vector[] = [\n [3.2409699419045226, -1.537383177570094, -0.4986107602930034],\n [-0.9692436362808796, 1.8759675015077202, 0.04155505740717559],\n [0.05563007969699366, -0.20397695888897652, 1.0569715142428786],\n];\nconst LINEAR_SRGB_TO_XYZ: Vector[] = [\n [0.41239079926595934, 0.357584339383878, 0.1804807884018343],\n [0.21263900587151027, 0.715168678767756, 0.07219231536073371],\n [0.01933081871559182, 0.11919477979462598, 0.9505321522496607],\n];\n/** Bradford chromatic adaptation between `lab()`'s D50 white and sRGB's D65. */\nconst D50_TO_D65: Vector[] = [\n [0.955473421488075, -0.02309845494876471, 0.06325924320057072],\n [-0.0283697093338637, 1.0099953980813041, 0.021041441191917323],\n [0.012314014864481998, -0.020507649298898964, 1.330365926242124],\n];\nconst D65_TO_D50: Vector[] = [\n [1.0479298208405488, 0.022946793341019088, -0.05019222954313557],\n [0.029627815688159344, 0.990434484573249, -0.01707382502938514],\n [-0.009243058152591178, 0.015055144896577895, 0.7518742899580008],\n];\nconst D50_WHITE: Vector = [0.3457 / 0.3585, 1, (1 - 0.3457 - 0.3585) / 0.3585];\n\nconst encode = (c: number) =>\n Math.sign(c) * (Math.abs(c) > 0.0031308 ? 1.055 * Math.abs(c) ** (1 / 2.4) - 0.055 : 12.92 * c);\nconst decode = (c: number) =>\n Math.sign(c) * (Math.abs(c) > 0.04045 ? ((Math.abs(c) + 0.055) / 1.055) ** 2.4 : c / 12.92);\n\nconst srgbToXyz = (rgb: Vector) => times(LINEAR_SRGB_TO_XYZ, rgb.map(decode) as Vector);\nconst xyzToSrgb = (xyz: Vector) => times(XYZ_TO_LINEAR_SRGB, xyz).map(encode) as Vector;\nconst xyzToOklab = (xyz: Vector) =>\n times(LMS_TO_OKLAB, times(XYZ_TO_LMS, xyz).map(Math.cbrt) as Vector);\nconst oklabToXyz = (lab: Vector) =>\n times(LMS_TO_XYZ, times(OKLAB_TO_LMS, lab).map((c) => c ** 3) as Vector);\n\nconst KAPPA = 24389 / 27;\nconst EPSILON = 216 / 24389;\n\nfunction xyzToLab(xyz: Vector): Vector {\n const [x, y, z] = times(D65_TO_D50, xyz).map((c, i) => c / D50_WHITE[i]!);\n const f = (c: number) => (c > EPSILON ? Math.cbrt(c) : (KAPPA * c + 16) / 116);\n const [fx, fy, fz] = [f(x!), f(y!), f(z!)];\n return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];\n}\n\nfunction labToXyz([l, a, b]: Vector): Vector {\n const fy = (l + 16) / 116;\n const fx = a / 500 + fy;\n const fz = fy - b / 200;\n const x = fx ** 3 > EPSILON ? fx ** 3 : (116 * fx - 16) / KAPPA;\n const y = l > KAPPA * EPSILON ? fy ** 3 : l / KAPPA;\n const z = fz ** 3 > EPSILON ? fz ** 3 : (116 * fz - 16) / KAPPA;\n return times(D50_TO_D65, [x, y, z].map((c, i) => c * D50_WHITE[i]!) as Vector);\n}\n\n/** Lightness, chroma and hue in degrees, from the rectangular form, and back. */\nconst polar = ([l, a, b]: Vector): Vector => {\n const hue = (Math.atan2(b, a) * 180) / Math.PI;\n return [l, Math.hypot(a, b), hue < 0 ? hue + 360 : hue];\n};\nconst rectangular = ([l, c, h]: Vector): Vector => [\n l,\n c * Math.cos((h * Math.PI) / 180),\n c * Math.sin((h * Math.PI) / 180),\n];\n\nfunction srgbToHsl([r, g, b]: Vector): Vector {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n const d = max - min;\n if (d === 0) return [NaN, 0, l];\n const s = l === 0 || l === 1 ? 0 : (max - l) / Math.min(l, 1 - l);\n const h =\n max === r\n ? ((g - b) / d + (g < b ? 6 : 0)) * 60\n : max === g\n ? ((b - r) / d + 2) * 60\n : ((r - g) / d + 4) * 60;\n return [h, s, l];\n}\n\nfunction hslToSrgb([h, s, l]: Vector): Vector {\n const hue = Number.isFinite(h) ? ((h % 360) + 360) % 360 : 0;\n const f = (n: number) => {\n const k = (n + hue / 30) % 12;\n return l - s * Math.min(l, 1 - l) * Math.max(-1, Math.min(k - 3, 9 - k, 1));\n };\n return [f(0), f(8), f(4)];\n}\n\nfunction srgbToHwb(rgb: Vector): Vector {\n const [h] = srgbToHsl(rgb);\n return [h, Math.min(...rgb), 1 - Math.max(...rgb)];\n}\n\nfunction hwbToSrgb([h, w, b]: Vector): Vector {\n if (w + b >= 1) {\n const grey = w / (w + b);\n return [grey, grey, grey];\n }\n return hslToSrgb([h, 1, 0.5]).map((c) => c * (1 - w - b) + w) as Vector;\n}\n\n/** Where the hue sits in each space's coordinates, if it has one. */\nconst HUE_INDEX: Partial<Record<MixSpace, number>> = { oklch: 2, lch: 2, hsl: 0, hwb: 0 };\n\n/** An sRGB colour, channels 0 to 1, in the space's own coordinates. */\nexport function into(space: MixSpace, rgb: Vector): Vector {\n switch (space) {\n case 'srgb':\n return rgb;\n case 'oklab':\n return xyzToOklab(srgbToXyz(rgb));\n case 'oklch':\n return powerless(polar(xyzToOklab(srgbToXyz(rgb))), 0.000004);\n case 'lab':\n return xyzToLab(srgbToXyz(rgb));\n case 'lch':\n return powerless(polar(xyzToLab(srgbToXyz(rgb))), 0.0015);\n case 'hsl':\n return srgbToHsl(rgb);\n case 'hwb':\n return srgbToHwb(rgb);\n }\n}\n\n/** A hue that does not matter, for a colour with no chroma to speak of, is missing, as CSS says. */\nconst powerless = ([l, c, h]: Vector, threshold: number): Vector => [\n l,\n c,\n c <= threshold ? NaN : h,\n];\n\n/** Back to sRGB, 0 to 1, brought inside the gamut where the space reaches past it. */\nexport function outOf(space: MixSpace, coords: Vector): Vector {\n const finite = coords.map((c) => (Number.isFinite(c) ? c : 0)) as Vector;\n switch (space) {\n case 'srgb':\n return clip(finite);\n case 'oklab':\n return gamutMap(finite);\n case 'oklch':\n return gamutMap(rectangular(finite));\n case 'lab':\n return gamutMap(xyzToOklab(labToXyz(finite)));\n case 'lch':\n return gamutMap(xyzToOklab(labToXyz(rectangular(finite))));\n case 'hsl':\n return clip(hslToSrgb(finite));\n case 'hwb':\n return clip(hwbToSrgb(finite));\n }\n}\n\nconst clip = (rgb: Vector) => rgb.map((c) => Math.min(1, Math.max(0, c))) as Vector;\nconst inGamut = (rgb: Vector) => rgb.every((c) => c >= -1e-6 && c <= 1 + 1e-6);\nconst deltaEOK = (a: Vector, b: Vector) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);\n\n/** CSS Color 4 section 13.2.2: reduce OKLCh chroma until clipping no longer shows. */\nfunction gamutMap(oklab: Vector): Vector {\n const origin = polar(oklab);\n if (origin[0] >= 1) return [1, 1, 1];\n if (origin[0] <= 0) return [0, 0, 0];\n const srgbOf = (lch: Vector) => xyzToSrgb(oklabToXyz(rectangular(lch)));\n const rgb = srgbOf(origin);\n if (inGamut(rgb)) return clip(rgb);\n\n const JND = 0.02;\n const EPS = 0.0001;\n let clipped = clip(rgb);\n if (deltaEOK(xyzToOklab(srgbToXyz(clipped)), oklab) < JND) return clipped;\n let min = 0;\n let max = origin[1];\n let minInGamut = true;\n while (max - min > EPS) {\n const chroma = (min + max) / 2;\n const current: Vector = [origin[0], chroma, origin[2]];\n const converted = srgbOf(current);\n if (minInGamut && inGamut(converted)) {\n min = chroma;\n continue;\n }\n clipped = clip(converted);\n const error = deltaEOK(xyzToOklab(srgbToXyz(clipped)), rectangular(current));\n if (error < JND) {\n if (JND - error < EPS) return clipped;\n minInGamut = false;\n min = chroma;\n } else {\n max = chroma;\n }\n }\n return clipped;\n}\n\n/** Two hues, one moved by whole turns so that interpolating between them goes the way asked. */\nfunction fixHues(a: number, b: number, method: HueMethod): [number, number] {\n const delta = b - a;\n const lift = HUE_LIFTS[method](delta);\n return lift === 'a' ? [a + 360, b] : lift === 'b' ? [a, b + 360] : [a, b];\n}\n\n/** For each method, which of the two hues takes a whole turn more, given how far apart they are. */\nconst HUE_LIFTS: Record<HueMethod, (delta: number) => 'a' | 'b' | null> = {\n shorter: (delta) => (delta > 180 ? 'a' : delta < -180 ? 'b' : null),\n longer: (delta) => (delta > 0 && delta < 180 ? 'a' : delta > -180 && delta <= 0 ? 'b' : null),\n increasing: (delta) => (delta < 0 ? 'b' : null),\n decreasing: (delta) => (delta > 0 ? 'a' : null),\n};\n\n/** A colour's channels, 0 to 255 and unrounded, and its alpha: what one mix hands another. */\nexport type Rgba = readonly [r: number, g: number, b: number, alpha: number];\n\n/**\n * One side of a mix: a colour as native paints it, or the unrounded channels of another mix, and\n * the percentage written beside it.\n */\nexport interface MixSide {\n readonly colour: string | Rgba;\n readonly percentage?: number;\n}\n\n/**\n * `color-mix(in <space> [<hue> hue], <a> [p%], <b> [q%])`, as the `rgb()` or `rgba()` native\n * reads. Undefined when a side is not a colour it can read - a platform colour, say - or when the\n * two percentages come to zero, which CSS says is not a colour at all.\n */\nexport function mixColours(\n space: MixSpace,\n a: MixSide,\n b: MixSide,\n hue: HueMethod = 'shorter',\n): string | undefined {\n const mixed = mixChannels(space, a, b, hue);\n if (!mixed) return undefined;\n const [r, g, bl] = mixed.map((c) => Math.round(c));\n const opacity = Math.round(mixed[3] * 1000) / 1000;\n return opacity >= 1 ? `rgb(${r}, ${g}, ${bl})` : `rgba(${r}, ${g}, ${bl}, ${opacity})`;\n}\n\n/**\n * The same mix, unrounded, for a mix around it to take as one of its sides: CSS works a nested\n * mix out in full and rounds only the colour at the end.\n */\nexport function mixChannels(\n space: MixSpace,\n a: MixSide,\n b: MixSide,\n hue: HueMethod = 'shorter',\n): Rgba | undefined {\n const first = typeof a.colour === 'string' ? parseColor(a.colour) : a.colour;\n const second = typeof b.colour === 'string' ? parseColor(b.colour) : b.colour;\n const weights = weightsOf(a.percentage, b.percentage);\n if (!first || !second || !weights) return undefined;\n\n const [c1, c2] = [first, second].map(([r, g, bl, alpha]) => ({\n coords: into(space, [r / 255, g / 255, bl / 255]),\n alpha,\n })) as [Side, Side];\n const hueAt = HUE_INDEX[space];\n alignComponents(c1, c2, hueAt, hue);\n\n const { t, alphaScale } = weights;\n const alpha = c1.alpha * (1 - t) + c2.alpha * t;\n const mixed = interpolate(c1, c2, t, alpha, hueAt);\n const [r, g, bl] = outOf(space, mixed).map((c) => c * 255);\n return [r!, g!, bl!, alpha * alphaScale];\n}\n\ninterface Side {\n coords: Vector;\n alpha: number;\n}\n\n/**\n * CSS Color 5, 2.1: missing percentages take what the other leaves, or half each; the second\n * colour's share is `t`, and a pair summing under 100 scales the alpha down.\n */\nfunction weightsOf(p?: number, q?: number): { t: number; alphaScale: number } | null {\n const [first, second] =\n p === undefined && q === undefined\n ? [50, 50]\n : p === undefined\n ? [100 - q!, q!]\n : q === undefined\n ? [p, 100 - p]\n : [p, q];\n const sum = first + second;\n if (sum <= 0) return null;\n return { t: second / sum, alphaScale: sum < 100 ? sum / 100 : 1 };\n}\n\n/** A missing component takes the other colour's, and the hues are set to go the way asked. */\nfunction alignComponents(c1: Side, c2: Side, hueAt: number | undefined, hue: HueMethod): void {\n for (let i = 0; i < 3; i++) {\n if (Number.isNaN(c1.coords[i])) c1.coords[i] = c2.coords[i]!;\n if (Number.isNaN(c2.coords[i])) c2.coords[i] = c1.coords[i]!;\n }\n if (hueAt === undefined) return;\n const [h1, h2] = [c1.coords[hueAt]!, c2.coords[hueAt]!];\n if (Number.isFinite(h1) && Number.isFinite(h2)) {\n [c1.coords[hueAt], c2.coords[hueAt]] = fixHues(h1, h2, hue);\n }\n}\n\n/** Premultiplied by alpha, except the hue, which is an angle and not an amount. */\nfunction interpolate(c1: Side, c2: Side, t: number, alpha: number, hueAt?: number): Vector {\n const mixed = [0, 1, 2].map((i) => {\n if (i === hueAt) return c1.coords[i]! * (1 - t) + c2.coords[i]! * t;\n const premixed = c1.coords[i]! * c1.alpha * (1 - t) + c2.coords[i]! * c2.alpha * t;\n return alpha === 0 ? 0 : premixed / alpha;\n }) as Vector;\n if (hueAt !== undefined) mixed[hueAt] = ((mixed[hueAt]! % 360) + 360) % 360;\n return mixed;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"color-mix.js","sourceRoot":"","sources":["../src/color-mix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKnE,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,GAAG,CAAW;IAC/D,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;CACN,CAAC,CAAC;AAMH,MAAM,KAAK,GAAG,CAAC,CAAoB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAS,EAAU,EAAE,CAChE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAW,CAAC;AAExD,MAAM,YAAY,GAAa;IAC7B,CAAC,GAAG,EAAE,kBAAkB,EAAE,kBAAkB,CAAC;IAC7C,CAAC,GAAG,EAAE,CAAC,kBAAkB,EAAE,CAAC,kBAAkB,CAAC;IAC/C,CAAC,GAAG,EAAE,CAAC,kBAAkB,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AC;IAC5C,CAAC,CAAW,CAAC;IACb,IAAI,KAAK,KAAK,SAAS;QAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAE,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAC5E,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * `color-mix()` worked out on device, for a mix with a token in it.\n *\n * The compiler folds a mix of literal colours at build time (lightningcss does the arithmetic); a\n * mix with a `var()` in it can only be done once the token is known, so it is done here, with CSS\n * Color 4 and 5's own arithmetic: each colour converted into the named space, premultiplied by its\n * alpha, interpolated (a hue the shorter way round), and brought back to the sRGB native paints,\n * inside its gamut by CSS Color 4's chroma reduction rather than a clip.\n *\n * The matrices and the gamut mapping are the ones `@ng-native/metro`'s `color-spaces.cjs` uses to\n * convert a literal colour at build time, copied here because the engine cannot depend on the\n * build step; the tests hold the two to the same answers.\n */\nimport { hslToSrgb, hwbToSrgb, parseColor } from './transition.ts';\n\n/** The spaces a mix is worked out in: every one the compiler also folds a literal mix in. */\nexport type MixSpace = 'srgb' | 'oklab' | 'oklch' | 'lab' | 'lch' | 'hsl' | 'hwb';\n\nexport const MIX_SPACES: ReadonlySet<string> = new Set<MixSpace>([\n 'srgb',\n 'oklab',\n 'oklch',\n 'lab',\n 'lch',\n 'hsl',\n 'hwb',\n]);\n\nexport type HueMethod = 'shorter' | 'longer' | 'increasing' | 'decreasing';\n\nexport type Vector = [number, number, number];\n\nconst times = (m: readonly Vector[], [x, y, z]: Vector): Vector =>\n m.map(([a, b, c]) => a * x + b * y + c * z) as Vector;\n\nconst OKLAB_TO_LMS: Vector[] = [\n [1.0, 0.3963377773761749, 0.2158037573099136],\n [1.0, -0.1055613458156586, -0.0638541728258133],\n [1.0, -0.0894841775298119, -1.2914855480194092],\n];\nconst LMS_TO_XYZ: Vector[] = [\n [1.2268798758459243, -0.5578149944602171, 0.2813910456659647],\n [-0.0405757452148008, 1.112286803280317, -0.0717110580655164],\n [-0.0763729366746601, -0.4214933324022432, 1.5869240198367816],\n];\nconst XYZ_TO_LMS: Vector[] = [\n [0.819022437996703, 0.3619062600528904, -0.1288737815209879],\n [0.0329836539323885, 0.9292868615863434, 0.0361446663506424],\n [0.0481771893596242, 0.2642395317527308, 0.6335478284694309],\n];\nconst LMS_TO_OKLAB: Vector[] = [\n [0.210454268309314, 0.7936177747023054, -0.0040720430116193],\n [1.9779985324311684, -2.4285922420485799, 0.450593709617411],\n [0.0259040424655478, 0.7827717124575296, -0.8086757549230774],\n];\nconst XYZ_TO_LINEAR_SRGB: Vector[] = [\n [3.2409699419045226, -1.537383177570094, -0.4986107602930034],\n [-0.9692436362808796, 1.8759675015077202, 0.04155505740717559],\n [0.05563007969699366, -0.20397695888897652, 1.0569715142428786],\n];\nconst LINEAR_SRGB_TO_XYZ: Vector[] = [\n [0.41239079926595934, 0.357584339383878, 0.1804807884018343],\n [0.21263900587151027, 0.715168678767756, 0.07219231536073371],\n [0.01933081871559182, 0.11919477979462598, 0.9505321522496607],\n];\n/** Bradford chromatic adaptation between `lab()`'s D50 white and sRGB's D65. */\nconst D50_TO_D65: Vector[] = [\n [0.955473421488075, -0.02309845494876471, 0.06325924320057072],\n [-0.0283697093338637, 1.0099953980813041, 0.021041441191917323],\n [0.012314014864481998, -0.020507649298898964, 1.330365926242124],\n];\nconst D65_TO_D50: Vector[] = [\n [1.0479298208405488, 0.022946793341019088, -0.05019222954313557],\n [0.029627815688159344, 0.990434484573249, -0.01707382502938514],\n [-0.009243058152591178, 0.015055144896577895, 0.7518742899580008],\n];\nconst D50_WHITE: Vector = [0.3457 / 0.3585, 1, (1 - 0.3457 - 0.3585) / 0.3585];\n\nconst encode = (c: number) =>\n Math.sign(c) * (Math.abs(c) > 0.0031308 ? 1.055 * Math.abs(c) ** (1 / 2.4) - 0.055 : 12.92 * c);\nconst decode = (c: number) =>\n Math.sign(c) * (Math.abs(c) > 0.04045 ? ((Math.abs(c) + 0.055) / 1.055) ** 2.4 : c / 12.92);\n\nconst srgbToXyz = (rgb: Vector) => times(LINEAR_SRGB_TO_XYZ, rgb.map(decode) as Vector);\nconst xyzToSrgb = (xyz: Vector) => times(XYZ_TO_LINEAR_SRGB, xyz).map(encode) as Vector;\nconst xyzToOklab = (xyz: Vector) =>\n times(LMS_TO_OKLAB, times(XYZ_TO_LMS, xyz).map(Math.cbrt) as Vector);\nconst oklabToXyz = (lab: Vector) =>\n times(LMS_TO_XYZ, times(OKLAB_TO_LMS, lab).map((c) => c ** 3) as Vector);\n\nconst KAPPA = 24389 / 27;\nconst EPSILON = 216 / 24389;\n\nfunction xyzToLab(xyz: Vector): Vector {\n const [x, y, z] = times(D65_TO_D50, xyz).map((c, i) => c / D50_WHITE[i]!);\n const f = (c: number) => (c > EPSILON ? Math.cbrt(c) : (KAPPA * c + 16) / 116);\n const [fx, fy, fz] = [f(x!), f(y!), f(z!)];\n return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - fz)];\n}\n\nfunction labToXyz([l, a, b]: Vector): Vector {\n const fy = (l + 16) / 116;\n const fx = a / 500 + fy;\n const fz = fy - b / 200;\n const x = fx ** 3 > EPSILON ? fx ** 3 : (116 * fx - 16) / KAPPA;\n const y = l > KAPPA * EPSILON ? fy ** 3 : l / KAPPA;\n const z = fz ** 3 > EPSILON ? fz ** 3 : (116 * fz - 16) / KAPPA;\n return times(D50_TO_D65, [x, y, z].map((c, i) => c * D50_WHITE[i]!) as Vector);\n}\n\n/** Lightness, chroma and hue in degrees, from the rectangular form, and back. */\nconst polar = ([l, a, b]: Vector): Vector => {\n const hue = (Math.atan2(b, a) * 180) / Math.PI;\n return [l, Math.hypot(a, b), hue < 0 ? hue + 360 : hue];\n};\nconst rectangular = ([l, c, h]: Vector): Vector => [\n l,\n c * Math.cos((h * Math.PI) / 180),\n c * Math.sin((h * Math.PI) / 180),\n];\n\nfunction srgbToHsl([r, g, b]: Vector): Vector {\n const max = Math.max(r, g, b);\n const min = Math.min(r, g, b);\n const l = (max + min) / 2;\n const d = max - min;\n if (d === 0) return [NaN, 0, l];\n const s = l === 0 || l === 1 ? 0 : (max - l) / Math.min(l, 1 - l);\n const h =\n max === r\n ? ((g - b) / d + (g < b ? 6 : 0)) * 60\n : max === g\n ? ((b - r) / d + 2) * 60\n : ((r - g) / d + 4) * 60;\n return [h, s, l];\n}\n\nfunction srgbToHwb(rgb: Vector): Vector {\n const [h] = srgbToHsl(rgb);\n return [h, Math.min(...rgb), 1 - Math.max(...rgb)];\n}\n\n/** Where the hue sits in each space's coordinates, if it has one. */\nconst HUE_INDEX: Partial<Record<MixSpace, number>> = { oklch: 2, lch: 2, hsl: 0, hwb: 0 };\n\n/** An sRGB colour, channels 0 to 1, in the space's own coordinates. */\nexport function into(space: MixSpace, rgb: Vector): Vector {\n switch (space) {\n case 'srgb':\n return rgb;\n case 'oklab':\n return xyzToOklab(srgbToXyz(rgb));\n case 'oklch':\n return powerless(polar(xyzToOklab(srgbToXyz(rgb))), 0.000004);\n case 'lab':\n return xyzToLab(srgbToXyz(rgb));\n case 'lch':\n return powerless(polar(xyzToLab(srgbToXyz(rgb))), 0.0015);\n case 'hsl':\n return srgbToHsl(rgb);\n case 'hwb':\n return srgbToHwb(rgb);\n }\n}\n\n/** A hue that does not matter, for a colour with no chroma to speak of, is missing, as CSS says. */\nconst powerless = ([l, c, h]: Vector, threshold: number): Vector => [\n l,\n c,\n c <= threshold ? NaN : h,\n];\n\n/** Back to sRGB, 0 to 1, brought inside the gamut where the space reaches past it. */\nexport function outOf(space: MixSpace, coords: Vector): Vector {\n const finite = coords.map((c) => (Number.isFinite(c) ? c : 0)) as Vector;\n switch (space) {\n case 'srgb':\n return clip(finite);\n case 'oklab':\n return gamutMap(finite);\n case 'oklch':\n return gamutMap(rectangular(finite));\n case 'lab':\n return gamutMap(xyzToOklab(labToXyz(finite)));\n case 'lch':\n return gamutMap(xyzToOklab(labToXyz(rectangular(finite))));\n case 'hsl':\n return clip(hslToSrgb(finite));\n case 'hwb':\n return clip(hwbToSrgb(finite));\n }\n}\n\nconst clip = (rgb: Vector) => rgb.map((c) => Math.min(1, Math.max(0, c))) as Vector;\nconst inGamut = (rgb: Vector) => rgb.every((c) => c >= -1e-6 && c <= 1 + 1e-6);\nconst deltaEOK = (a: Vector, b: Vector) => Math.hypot(a[0] - b[0], a[1] - b[1], a[2] - b[2]);\n\n/** CSS Color 4 section 13.2.2: reduce OKLCh chroma until clipping no longer shows. */\nfunction gamutMap(oklab: Vector): Vector {\n const origin = polar(oklab);\n if (origin[0] >= 1) return [1, 1, 1];\n if (origin[0] <= 0) return [0, 0, 0];\n const srgbOf = (lch: Vector) => xyzToSrgb(oklabToXyz(rectangular(lch)));\n const rgb = srgbOf(origin);\n if (inGamut(rgb)) return clip(rgb);\n\n const JND = 0.02;\n const EPS = 0.0001;\n let clipped = clip(rgb);\n if (deltaEOK(xyzToOklab(srgbToXyz(clipped)), oklab) < JND) return clipped;\n let min = 0;\n let max = origin[1];\n let minInGamut = true;\n while (max - min > EPS) {\n const chroma = (min + max) / 2;\n const current: Vector = [origin[0], chroma, origin[2]];\n const converted = srgbOf(current);\n if (minInGamut && inGamut(converted)) {\n min = chroma;\n continue;\n }\n clipped = clip(converted);\n const error = deltaEOK(xyzToOklab(srgbToXyz(clipped)), rectangular(current));\n if (error < JND) {\n if (JND - error < EPS) return clipped;\n minInGamut = false;\n min = chroma;\n } else {\n max = chroma;\n }\n }\n return clipped;\n}\n\n/** Two hues, one moved by whole turns so that interpolating between them goes the way asked. */\nfunction fixHues(a: number, b: number, method: HueMethod): [number, number] {\n const delta = b - a;\n const lift = HUE_LIFTS[method](delta);\n return lift === 'a' ? [a + 360, b] : lift === 'b' ? [a, b + 360] : [a, b];\n}\n\n/** For each method, which of the two hues takes a whole turn more, given how far apart they are. */\nconst HUE_LIFTS: Record<HueMethod, (delta: number) => 'a' | 'b' | null> = {\n shorter: (delta) => (delta > 180 ? 'a' : delta < -180 ? 'b' : null),\n longer: (delta) => (delta > 0 && delta < 180 ? 'a' : delta > -180 && delta <= 0 ? 'b' : null),\n increasing: (delta) => (delta < 0 ? 'b' : null),\n decreasing: (delta) => (delta > 0 ? 'a' : null),\n};\n\n/** A colour's channels, 0 to 255 and unrounded, and its alpha: what one mix hands another. */\nexport type Rgba = readonly [r: number, g: number, b: number, alpha: number];\n\n/**\n * One side of a mix: a colour as native paints it, or the unrounded channels of another mix, and\n * the percentage written beside it.\n */\nexport interface MixSide {\n readonly colour: string | Rgba;\n readonly percentage?: number;\n}\n\n/**\n * `color-mix(in <space> [<hue> hue], <a> [p%], <b> [q%])`, as the `rgb()` or `rgba()` native\n * reads. Undefined when a side is not a colour it can read - a platform colour, say - or when the\n * two percentages come to zero, which CSS says is not a colour at all.\n */\nexport function mixColours(\n space: MixSpace,\n a: MixSide,\n b: MixSide,\n hue: HueMethod = 'shorter',\n): string | undefined {\n const mixed = mixChannels(space, a, b, hue);\n if (!mixed) return undefined;\n const [r, g, bl] = mixed.map((c) => Math.round(c));\n const opacity = Math.round(mixed[3] * 1000) / 1000;\n return opacity >= 1 ? `rgb(${r}, ${g}, ${bl})` : `rgba(${r}, ${g}, ${bl}, ${opacity})`;\n}\n\n/**\n * The same mix, unrounded, for a mix around it to take as one of its sides: CSS works a nested\n * mix out in full and rounds only the colour at the end.\n */\nexport function mixChannels(\n space: MixSpace,\n a: MixSide,\n b: MixSide,\n hue: HueMethod = 'shorter',\n): Rgba | undefined {\n const first = typeof a.colour === 'string' ? parseColor(a.colour) : a.colour;\n const second = typeof b.colour === 'string' ? parseColor(b.colour) : b.colour;\n const weights = weightsOf(a.percentage, b.percentage);\n if (!first || !second || !weights) return undefined;\n\n const [c1, c2] = [first, second].map(([r, g, bl, alpha]) => ({\n coords: into(space, [r / 255, g / 255, bl / 255]),\n alpha,\n })) as [Side, Side];\n const hueAt = HUE_INDEX[space];\n alignComponents(c1, c2, hueAt, hue);\n\n const { t, alphaScale } = weights;\n const alpha = c1.alpha * (1 - t) + c2.alpha * t;\n const mixed = interpolate(c1, c2, t, alpha, hueAt);\n const [r, g, bl] = outOf(space, mixed).map((c) => c * 255);\n return [r!, g!, bl!, alpha * alphaScale];\n}\n\ninterface Side {\n coords: Vector;\n alpha: number;\n}\n\n/**\n * CSS Color 5, 2.1: missing percentages take what the other leaves, or half each; the second\n * colour's share is `t`, and a pair summing under 100 scales the alpha down.\n */\nfunction weightsOf(p?: number, q?: number): { t: number; alphaScale: number } | null {\n const [first, second] =\n p === undefined && q === undefined\n ? [50, 50]\n : p === undefined\n ? [100 - q!, q!]\n : q === undefined\n ? [p, 100 - p]\n : [p, q];\n const sum = first + second;\n if (sum <= 0) return null;\n return { t: second / sum, alphaScale: sum < 100 ? sum / 100 : 1 };\n}\n\n/** A missing component takes the other colour's, and the hues are set to go the way asked. */\nfunction alignComponents(c1: Side, c2: Side, hueAt: number | undefined, hue: HueMethod): void {\n for (let i = 0; i < 3; i++) {\n if (Number.isNaN(c1.coords[i])) c1.coords[i] = c2.coords[i]!;\n if (Number.isNaN(c2.coords[i])) c2.coords[i] = c1.coords[i]!;\n }\n if (hueAt === undefined) return;\n const [h1, h2] = [c1.coords[hueAt]!, c2.coords[hueAt]!];\n if (Number.isFinite(h1) && Number.isFinite(h2)) {\n [c1.coords[hueAt], c2.coords[hueAt]] = fixHues(h1, h2, hue);\n }\n}\n\n/** Premultiplied by alpha, except the hue, which is an angle and not an amount. */\nfunction interpolate(c1: Side, c2: Side, t: number, alpha: number, hueAt?: number): Vector {\n const mixed = [0, 1, 2].map((i) => {\n if (i === hueAt) return c1.coords[i]! * (1 - t) + c2.coords[i]! * t;\n const premixed = c1.coords[i]! * c1.alpha * (1 - t) + c2.coords[i]! * c2.alpha * t;\n return alpha === 0 ? 0 : premixed / alpha;\n }) as Vector;\n if (hueAt !== undefined) mixed[hueAt] = ((mixed[hueAt]! % 360) + 360) % 360;\n return mixed;\n}\n"]}
|
package/dist/css.d.ts
CHANGED
|
@@ -37,6 +37,11 @@ export interface Compound {
|
|
|
37
37
|
* What Tailwind's `group-*` variants compile to.
|
|
38
38
|
*/
|
|
39
39
|
readonly ancestors?: readonly Compound[];
|
|
40
|
+
/**
|
|
41
|
+
* `:is(<compound> > *)`: every one of these must match the node's parent. What Tailwind's `*:`
|
|
42
|
+
* variant compiles to.
|
|
43
|
+
*/
|
|
44
|
+
readonly parents?: readonly Compound[];
|
|
40
45
|
/** Interaction state the engine tracks: `:focus` and `:active`. */
|
|
41
46
|
readonly pseudo?: readonly ('focus' | 'active')[];
|
|
42
47
|
/**
|
|
@@ -46,6 +51,14 @@ export interface Compound {
|
|
|
46
51
|
readonly nth?: readonly NthTest[];
|
|
47
52
|
/** `:empty`: no children at all, text included. */
|
|
48
53
|
readonly empty?: true;
|
|
54
|
+
/** `:has()`: every one of these must find a match beneath the node. */
|
|
55
|
+
readonly has?: readonly HasTest[];
|
|
56
|
+
}
|
|
57
|
+
/** One `:has()`: some element beneath the node, or some child of it, matches one of `any`. */
|
|
58
|
+
export interface HasTest {
|
|
59
|
+
/** `:has(> x)`: a child, not any descendant. */
|
|
60
|
+
readonly child?: true;
|
|
61
|
+
readonly any: readonly Compound[];
|
|
49
62
|
}
|
|
50
63
|
/** `an + b`, counted from the start unless `fromEnd`. */
|
|
51
64
|
export interface NthTest {
|
|
@@ -59,13 +72,29 @@ export interface StyleRule {
|
|
|
59
72
|
/** Between compounds; length is `compounds.length - 1`. */
|
|
60
73
|
readonly combinators: readonly Combinator[];
|
|
61
74
|
readonly specificity: number;
|
|
75
|
+
/**
|
|
76
|
+
* The cascade layer the rule is in, as its place in its sheet's `layers`, or nothing for a rule
|
|
77
|
+
* in no layer, which beats every layered one whatever their specificity.
|
|
78
|
+
*/
|
|
79
|
+
readonly layer?: number;
|
|
62
80
|
readonly order: number;
|
|
63
81
|
readonly declarations: Readonly<Record<string, unknown>>;
|
|
64
82
|
readonly important?: Readonly<Record<string, unknown>>;
|
|
65
83
|
/** Custom properties this rule defines, pre-converted into every form a use site might want. */
|
|
66
84
|
readonly tokens?: Readonly<Record<string, TokenValue>>;
|
|
85
|
+
/** The names among `tokens` declared `!important`, which beat every plain one. */
|
|
86
|
+
readonly importantTokens?: readonly string[];
|
|
67
87
|
/** Declarations whose value is a `var()`, resolved once the token map is known. */
|
|
68
88
|
readonly deferred?: readonly DeferredDeclaration[];
|
|
89
|
+
/**
|
|
90
|
+
* The corners and edges the rule's plain declarations wrote, in the order it wrote them, where
|
|
91
|
+
* it wrote one in both its logical form and its physical one. The cascade settles the two as
|
|
92
|
+
* one property, and a value settled on device is in a list of its own, with no order between
|
|
93
|
+
* it and the rest.
|
|
94
|
+
*/
|
|
95
|
+
readonly sides?: readonly string[];
|
|
96
|
+
/** The same for the rule's important declarations. */
|
|
97
|
+
readonly importantSides?: readonly string[];
|
|
69
98
|
/** The media query guarding this rule, if any. */
|
|
70
99
|
readonly condition?: MediaCondition;
|
|
71
100
|
/** Memo of the last condition evaluation, and the conditions version it was made against. */
|
|
@@ -81,7 +110,8 @@ export type MediaCondition = {
|
|
|
81
110
|
readonly op: 'gt' | 'gte' | 'lt' | 'lte' | 'eq';
|
|
82
111
|
readonly value: number;
|
|
83
112
|
} | {
|
|
84
|
-
|
|
113
|
+
/** `direction` is not a media feature: it is what `:dir()` asks, of the app as a whole. */
|
|
114
|
+
readonly feature: 'orientation' | 'prefers-color-scheme' | 'prefers-reduced-motion' | 'direction';
|
|
85
115
|
readonly value: string;
|
|
86
116
|
};
|
|
87
117
|
/** What media queries are evaluated against. Pushed in by the host: the engine imports no RN. */
|
|
@@ -102,6 +132,12 @@ export interface Conditions {
|
|
|
102
132
|
* (`Engine.remeasureText`), which `watchConditions` does after it.
|
|
103
133
|
*/
|
|
104
134
|
readonly fontScale?: number;
|
|
135
|
+
/**
|
|
136
|
+
* The direction the app is laid out in, which is the device's unless the app forced one:
|
|
137
|
+
* `I18nManager.isRTL`. Optional, and left to right when absent. It decides which physical
|
|
138
|
+
* corner or edge a logical one is, where an element has both and no `direction` of its own.
|
|
139
|
+
*/
|
|
140
|
+
readonly direction?: 'ltr' | 'rtl';
|
|
105
141
|
}
|
|
106
142
|
/** A run of CSS whitespace: spaces, tabs, newlines, carriage returns and form feeds, and no other. */
|
|
107
143
|
export declare const CSS_SPACE: RegExp;
|
|
@@ -186,6 +222,8 @@ export interface DeferredDeclaration {
|
|
|
186
222
|
* unambiguous given a single-valued token, so `padding: var(--gap)` writes all four.
|
|
187
223
|
*/
|
|
188
224
|
readonly props: readonly string[];
|
|
225
|
+
/** The element a bound declaration is on, by name, for a message about it to say. */
|
|
226
|
+
readonly on?: string;
|
|
189
227
|
/** A `var()` reference. Exactly one of this and `compute` is present. */
|
|
190
228
|
readonly kind?: TokenKind;
|
|
191
229
|
readonly reference?: string;
|
|
@@ -284,6 +322,8 @@ export interface LineTemplate {
|
|
|
284
322
|
readonly roles: readonly ('width' | 'style' | 'color')[];
|
|
285
323
|
readonly widths: readonly string[];
|
|
286
324
|
readonly colors: readonly string[];
|
|
325
|
+
/** `color-mix(in srgb, var(--tint) 35%, transparent)`: the colour, written as a function. */
|
|
326
|
+
readonly colour?: unknown;
|
|
287
327
|
readonly style?: string;
|
|
288
328
|
}
|
|
289
329
|
/**
|
|
@@ -363,6 +403,12 @@ export interface GradientTemplate {
|
|
|
363
403
|
}
|
|
364
404
|
export interface StyleSheet {
|
|
365
405
|
readonly rules: readonly StyleRule[];
|
|
406
|
+
/**
|
|
407
|
+
* The sheet's cascade layers, each by its name from the outermost layer in, in the order they
|
|
408
|
+
* were first named. A name that starts with a null is a block with no name, which is a layer
|
|
409
|
+
* no other block can name.
|
|
410
|
+
*/
|
|
411
|
+
readonly layers?: readonly (readonly string[])[];
|
|
366
412
|
/**
|
|
367
413
|
* `@keyframes` by name. Global within a sheet, as they are within a document; the engine keeps
|
|
368
414
|
* one registry across every sheet it sees, so a name defined in a global stylesheet is usable
|
|
@@ -377,6 +423,12 @@ export interface StyleSheet {
|
|
|
377
423
|
* has to re-resolve a whole child list when it changes. It only does that where a sheet asks.
|
|
378
424
|
*/
|
|
379
425
|
readonly structural?: true;
|
|
426
|
+
/**
|
|
427
|
+
* Some rule uses `:has()`, so what a node matches can change when something beneath it does.
|
|
428
|
+
* Said on the sheet for the same reason `structural` is: the cost is invalidation, and only a
|
|
429
|
+
* sheet that asks has the engine match a changed node's ancestors again.
|
|
430
|
+
*/
|
|
431
|
+
readonly has?: true;
|
|
380
432
|
/**
|
|
381
433
|
* The `@font-face` rules the sheet declares, each `source` the bundler's `require` of the file.
|
|
382
434
|
* The engine does not read them: `loadFonts()` in `@ng-native/expo/fonts` registers them with
|
|
@@ -386,6 +438,8 @@ export interface StyleSheet {
|
|
|
386
438
|
readonly family: string;
|
|
387
439
|
readonly source: unknown;
|
|
388
440
|
readonly weight?: number;
|
|
441
|
+
/** The weights a variable font covers, `font-weight: 100 900`, in place of one `weight`. */
|
|
442
|
+
readonly weightRange?: readonly [number, number];
|
|
389
443
|
readonly style?: string;
|
|
390
444
|
}[];
|
|
391
445
|
}
|
|
@@ -413,6 +467,11 @@ export interface StyleCache {
|
|
|
413
467
|
* values do, and by the same copy-on-write rule, so a subtree that defines none shares one map.
|
|
414
468
|
*/
|
|
415
469
|
tokens: Readonly<Record<string, TokenValue>>;
|
|
470
|
+
/**
|
|
471
|
+
* The rules the node matched, kept only while a sheet uses `:has()`: what a node whose
|
|
472
|
+
* subtree changed is compared against, to tell whether it has to be restyled.
|
|
473
|
+
*/
|
|
474
|
+
matched?: readonly StyleRule[];
|
|
416
475
|
}
|
|
417
476
|
/** What the matcher needs of a node. The engine's node satisfies this structurally. */
|
|
418
477
|
export interface StyleTarget {
|
|
@@ -432,6 +491,20 @@ export interface StyleTarget {
|
|
|
432
491
|
readonly kind?: string;
|
|
433
492
|
readonly classes: ReadonlySet<string> | null;
|
|
434
493
|
readonly props: Readonly<Record<string, unknown>>;
|
|
494
|
+
/**
|
|
495
|
+
* Whether `props.style` sets a property children inherit, kept by whoever sets the style so the
|
|
496
|
+
* resolver reads the style only where it can matter. Absent is false.
|
|
497
|
+
*/
|
|
498
|
+
readonly inlineInherits?: boolean;
|
|
499
|
+
/**
|
|
500
|
+
* The bound declarations that are a `var()`, `[style.color]="'var(--brand)'"`, as the deferred
|
|
501
|
+
* declarations a rule's would be: settled with the node's tokens, last of its normal ones.
|
|
502
|
+
*/
|
|
503
|
+
readonly boundStyle?: readonly DeferredDeclaration[] | null;
|
|
504
|
+
/** A node the engine made, such as the paragraph around loose text: it only inherits. */
|
|
505
|
+
readonly anonymous?: true;
|
|
506
|
+
/** One of HTML's text elements the engine has styles of its own for, such as `strong`. */
|
|
507
|
+
readonly styled?: true;
|
|
435
508
|
/**
|
|
436
509
|
* The sheet this node's own rules come from, which is the sheet of the component whose renderer
|
|
437
510
|
* created it. Read from the node rather than passed in, because a node's ancestors usually
|
|
@@ -454,6 +527,19 @@ export interface StyleTarget {
|
|
|
454
527
|
styleCache: StyleCache | null;
|
|
455
528
|
/** Set when something that could change what this node matches has changed. */
|
|
456
529
|
styleDirty: boolean;
|
|
530
|
+
/**
|
|
531
|
+
* Set when something beneath this node changed and a sheet uses `:has()`: the node is matched
|
|
532
|
+
* again, and restyled only if the rules it matches came out different. Absent on a hand-built
|
|
533
|
+
* target.
|
|
534
|
+
*/
|
|
535
|
+
hasDirty?: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* Set by the engine when the node's own interaction state changed and nothing else about it
|
|
538
|
+
* did: a press began or ended on it or under it. It is matched again, and keeps the style it
|
|
539
|
+
* has, and everything under it, when it matches the rules it did. Not for an element a rule
|
|
540
|
+
* asks about from another one, which is restyled: see `usesActive`.
|
|
541
|
+
*/
|
|
542
|
+
stateDirty?: boolean;
|
|
457
543
|
/** `:focus`. Set by the engine from the native focus and blur events. */
|
|
458
544
|
focused?: boolean;
|
|
459
545
|
/**
|
|
@@ -472,6 +558,18 @@ export interface StyleTarget {
|
|
|
472
558
|
* The cost is one integer increment per comparison, against a Set lookup and several property
|
|
473
559
|
* reads, so it does not distort what it measures.
|
|
474
560
|
*/
|
|
561
|
+
/**
|
|
562
|
+
* What a sheet asks about a pressed element. `own` is whether a rule styles one, `.button:active`,
|
|
563
|
+
* which matching the pressed elements again answers. `elsewhere` is each compound that asks about
|
|
564
|
+
* a pressed element from another one: `.card:active .title`, `.a:active + .b`, or `:active`
|
|
565
|
+
* inside `:not()`, `:is()` or `:has()`. An element such a compound could be is restyled with
|
|
566
|
+
* everything under it when it is pressed, as what it changes is not itself alone.
|
|
567
|
+
*/
|
|
568
|
+
export declare function usesActive(sheet: StyleSheet): ActiveUse;
|
|
569
|
+
export interface ActiveUse {
|
|
570
|
+
readonly own: boolean;
|
|
571
|
+
readonly elsewhere: readonly Compound[];
|
|
572
|
+
}
|
|
475
573
|
export declare const styleStats: {
|
|
476
574
|
/** Calls to `matchesCompound`, the innermost unit of matching work. */
|
|
477
575
|
compoundTests: number;
|
|
@@ -521,6 +619,14 @@ export declare function indexRules(entries: readonly RuleEntry[]): RuleIndex;
|
|
|
521
619
|
* lists are short by construction, which is the entire point of the index.
|
|
522
620
|
*/
|
|
523
621
|
export declare function candidateRules(node: StyleTarget, index: RuleIndex): RuleEntry[];
|
|
622
|
+
/** Whether an inline style sets a property children inherit. Allocates nothing: it runs per set. */
|
|
623
|
+
export declare function setsInherited(style: unknown): boolean;
|
|
624
|
+
/**
|
|
625
|
+
* The inherited properties a node's inline style sets, or null for none. Inline style is the
|
|
626
|
+
* strongest normal declaration on its element, so what it sets is inherited, and read by
|
|
627
|
+
* `color: inherit` and `currentColor`, as a rule's would be.
|
|
628
|
+
*/
|
|
629
|
+
export declare function inlineInherited(style: unknown): Record<string, unknown> | null;
|
|
524
630
|
/**
|
|
525
631
|
* The runtime half of CSS for one engine: the global sheet, the conditions media queries are
|
|
526
632
|
* evaluated against, and the memo that makes resolution cost nodes x rules rather than
|
|
@@ -558,6 +664,21 @@ export declare class StyleResolver {
|
|
|
558
664
|
* single index.
|
|
559
665
|
*/
|
|
560
666
|
private merged;
|
|
667
|
+
/**
|
|
668
|
+
* Whether any sheet merged so far has a rule in a cascade layer. Until one does, rules are
|
|
669
|
+
* ordered by weight alone and the cascade does not look for layers, which is nearly every app.
|
|
670
|
+
* It stays set once a layered sheet has gone, which costs a look at each cascade and no more.
|
|
671
|
+
*/
|
|
672
|
+
private layered;
|
|
673
|
+
/**
|
|
674
|
+
* Every layer the sheets seen so far have named, in the order each name was first seen, which
|
|
675
|
+
* is the one order a document has for them. A name keeps its place when its sheet is replaced.
|
|
676
|
+
*/
|
|
677
|
+
private readonly layerNames;
|
|
678
|
+
/** Each layered rule's place among them, set when its sheet is first merged. */
|
|
679
|
+
private readonly layerPlaces;
|
|
680
|
+
private readonly layeredSheets;
|
|
681
|
+
private unnamedLayers;
|
|
561
682
|
/**
|
|
562
683
|
* The application-level sheet, if any: the one set of rules allowed to match a node whatever
|
|
563
684
|
* component created it, which is what resets, utility classes and `:root` tokens all need.
|
|
@@ -584,7 +705,7 @@ export declare class StyleResolver {
|
|
|
584
705
|
* Told of a `var()` that names a custom property nothing in scope defines and has no fallback,
|
|
585
706
|
* which is dropped. Set only in development, where it is how the engine says so.
|
|
586
707
|
*/
|
|
587
|
-
onUndefinedToken: ((name: string, props: readonly string[]) => void) | null;
|
|
708
|
+
onUndefinedToken: ((name: string, props: readonly string[], on?: string) => void) | null;
|
|
588
709
|
/**
|
|
589
710
|
* Told of a `display: var()` whose token holds no display native has, `grid` or `table`, which
|
|
590
711
|
* leaves display unset. Set only in development, where it is how the engine says so: the
|
|
@@ -612,6 +733,26 @@ export declare class StyleResolver {
|
|
|
612
733
|
* resolves at most once however many descendants ask for its inherited values.
|
|
613
734
|
*/
|
|
614
735
|
resolve(node: StyleTarget, epoch: number): StyleCache;
|
|
736
|
+
/** The rules a node matched, for its cache to keep, while a sheet uses `:has()`. */
|
|
737
|
+
private record;
|
|
738
|
+
/**
|
|
739
|
+
* Set by the engine once a sheet uses `:has()`. Until then no cache keeps the rules it matched,
|
|
740
|
+
* so an app that never asks pays nothing for it.
|
|
741
|
+
*/
|
|
742
|
+
tracksHas: boolean;
|
|
743
|
+
/**
|
|
744
|
+
* The cache of a node whose subtree changed, and nothing else, when it matches the rules it
|
|
745
|
+
* did: keeping the object is what leaves everything under it alone. Nothing when it has to be
|
|
746
|
+
* resolved, as it does with no record of what it matched, made before any sheet asked.
|
|
747
|
+
*/
|
|
748
|
+
private keptBeneath;
|
|
749
|
+
/** A cache that still stands for a node marked for its subtree or its state alone. */
|
|
750
|
+
private kept;
|
|
751
|
+
/**
|
|
752
|
+
* The cache of a node whose pressed state changed and nothing else, where no rule can match
|
|
753
|
+
* it at all: it has no style of its own to change, so it and all under it stay as they are.
|
|
754
|
+
*/
|
|
755
|
+
private keptUnmatched;
|
|
615
756
|
/**
|
|
616
757
|
* Whether a node's last answer still stands under a parent that resolved to `parentContext`,
|
|
617
758
|
* without resolving it. What lets a commit step over a clean child in one comparison.
|
|
@@ -658,6 +799,12 @@ export declare class StyleResolver {
|
|
|
658
799
|
* it, so it loses to their extra attribute and wins a tie with them.
|
|
659
800
|
*/
|
|
660
801
|
private merge;
|
|
802
|
+
/**
|
|
803
|
+
* Gives each of a sheet's layers its place among every sheet's, the first time the sheet is
|
|
804
|
+
* merged, and each of its layered rules that place. Sheets are merged in the order a document
|
|
805
|
+
* holds them: the app's global sheet, then each component's as it first renders.
|
|
806
|
+
*/
|
|
807
|
+
private placeLayers;
|
|
661
808
|
/**
|
|
662
809
|
* A node's style from the rules it matched, shared with every other node that matched the same
|
|
663
810
|
* rules under the same inherited values and tokens: a list's rows, and what is inside each.
|
|
@@ -679,6 +826,16 @@ export declare class StyleResolver {
|
|
|
679
826
|
private matched;
|
|
680
827
|
/** The declarations of the rules a node matched. The list is sorted, so later simply wins. */
|
|
681
828
|
private cascade;
|
|
829
|
+
/**
|
|
830
|
+
* An inline style over the style the cascade settled, both already in `style`: a corner or an
|
|
831
|
+
* edge the inline style sets takes the other form of it out, as a later rule would.
|
|
832
|
+
*/
|
|
833
|
+
overOtherForms(inline: Readonly<Record<string, unknown>>, style: Record<string, unknown>): void;
|
|
834
|
+
/**
|
|
835
|
+
* The direction an element is laid out in: the last `direction` its own rules give it, the one
|
|
836
|
+
* it inherits, or the app's. A logical corner is a different physical one in each.
|
|
837
|
+
*/
|
|
838
|
+
private directionOf;
|
|
682
839
|
/**
|
|
683
840
|
* Whether a rule's media query holds, memoised per rule.
|
|
684
841
|
*
|
|
@@ -722,6 +879,16 @@ export declare class StyleResolver {
|
|
|
722
879
|
/** A length relative to the viewport or to the font size in scope. */
|
|
723
880
|
private computed;
|
|
724
881
|
}
|
|
882
|
+
/**
|
|
883
|
+
* A bound declaration whose value is one `var()`, `var(--brand, red)`, as the deferred declaration
|
|
884
|
+
* the compiler writes for the same value in a rule. `token` is the value as a token, which is an
|
|
885
|
+
* alias when it is a `var()`; null for any other.
|
|
886
|
+
*
|
|
887
|
+
* ponytail: the whole value has to be the `var()`. One inside a longer value, `calc()` included,
|
|
888
|
+
* is what the compiler parses at build time and nothing here does; write the sum in a custom
|
|
889
|
+
* property, `[style.--gap]`, and read that in the stylesheet.
|
|
890
|
+
*/
|
|
891
|
+
export declare function boundDeclaration(prop: string, token: TokenValue | undefined, on?: string): DeferredDeclaration | null;
|
|
725
892
|
/** `hsl()` reads a channels token as hue, saturation and lightness; `rgb()` as sRGB. */
|
|
726
893
|
type ChannelSpace = 'rgb' | 'hsl';
|
|
727
894
|
/**
|