fashionable 0.3.0 → 0.4.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/calc/index.d.mts +1 -1
- package/dist/calc/index.mjs +1 -1
- package/dist/data/index.d.mts +2 -208
- package/dist/data/index.mjs +73 -54
- package/dist/data/index.mjs.map +1 -1
- package/dist/declaration/index.d.mts +1 -1
- package/dist/declaration/index.mjs +9 -28
- package/dist/declaration/index.mjs.map +1 -1
- package/dist/fontFace/index.d.mts +1 -1
- package/dist/property/index.d.mts +1 -1
- package/dist/property/index.mjs +1 -1
- package/dist/property/index.mjs.map +1 -1
- package/dist/query/index.d.mts +1 -1
- package/dist/rule/index.d.mts +1 -1
- package/dist/rule/index.mjs +45 -33
- package/dist/rule/index.mjs.map +1 -1
- package/dist/selector/index.d.mts +1 -1
- package/dist/selector/index.mjs +117 -21
- package/dist/selector/index.mjs.map +1 -1
- package/dist/shared/{calc-Cih4o2r7.mjs → calc-Uwbxd7CS.mjs} +233 -165
- package/dist/shared/calc-Uwbxd7CS.mjs.map +1 -0
- package/dist/shared/{color.internal-9fpSiiJk.mjs → color.internal-CxjlaRqR.mjs} +46 -11
- package/dist/shared/color.internal-CxjlaRqR.mjs.map +1 -0
- package/dist/shared/declaration-CqRm38oZ.d.mts +264 -0
- package/dist/shared/declaration.internal-bHzvbanA.mjs +121 -0
- package/dist/shared/declaration.internal-bHzvbanA.mjs.map +1 -0
- package/dist/shared/{fontFaceRule-DdnLAuVw.d.mts → fontFaceRule-BOgUM4PF.d.mts} +3 -3
- package/dist/shared/index-D-hVWDgZ.d.mts +2289 -0
- package/dist/shared/{mediaQuery-DsBivHi0.d.mts → mediaQuery-VDIAHnM1.d.mts} +2 -2
- package/dist/shared/{mediaRule-4kY2IOq-.d.mts → mediaRule-2K7Ggwe4.d.mts} +169 -105
- package/dist/shared/{propertyRule-B5pf7NgH.d.mts → propertyRule-B9ii0mv4.d.mts} +56 -21
- package/dist/shared/{propertyRule.internal-CRyFLwbn.mjs → propertyRule.internal-ncYCWUar.mjs} +31 -4
- package/dist/shared/propertyRule.internal-ncYCWUar.mjs.map +1 -0
- package/dist/shared/{ruleSet.internal-a5m40W9E.mjs → ruleSet.internal-Cj4yIYFI.mjs} +30 -17
- package/dist/shared/ruleSet.internal-Cj4yIYFI.mjs.map +1 -0
- package/dist/shared/selector-BkxnzX_6.d.mts +615 -0
- package/dist/shared/{selector.internal-ESe9s0IH.mjs → selector.internal-B3iu_RpX.mjs} +144 -30
- package/dist/shared/selector.internal-B3iu_RpX.mjs.map +1 -0
- package/dist/shared/{utils-BKm298I-.d.mts → utils-DpN6qr94.d.mts} +4 -4
- package/dist/shared/var.internal-DSxAzEFN.mjs +119 -0
- package/dist/shared/var.internal-DSxAzEFN.mjs.map +1 -0
- package/dist/stylesheet/index.d.mts +67 -53
- package/dist/stylesheet/index.mjs +44 -30
- package/dist/stylesheet/index.mjs.map +1 -1
- package/dist/utils.d.mts +1 -1
- package/dist/utils.mjs.map +1 -1
- package/dist/var/index.d.mts +2 -0
- package/dist/var/index.mjs +177 -0
- package/dist/var/index.mjs.map +1 -0
- package/package.json +8 -2
- package/dist/shared/calc-Cih4o2r7.mjs.map +0 -1
- package/dist/shared/color-BvNJ2YqL.d.mts +0 -590
- package/dist/shared/color.internal-9fpSiiJk.mjs.map +0 -1
- package/dist/shared/declaration-B-6Ykgs_.d.mts +0 -166
- package/dist/shared/declaration.internal-BeasYIJ0.mjs +0 -73
- package/dist/shared/declaration.internal-BeasYIJ0.mjs.map +0 -1
- package/dist/shared/index-BvtwY4FQ.d.mts +0 -841
- package/dist/shared/propertyRule.internal-CRyFLwbn.mjs.map +0 -1
- package/dist/shared/ruleSet.internal-a5m40W9E.mjs.map +0 -1
- package/dist/shared/selector-HZY-W6l6.d.mts +0 -346
- package/dist/shared/selector.internal-ESe9s0IH.mjs.map +0 -1
package/dist/calc/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as precision_d_exports, a as calc_d_exports } from "../shared/index-D-hVWDgZ.mjs";
|
|
2
2
|
export { calc_d_exports as Calc, precision_d_exports as Precision };
|
package/dist/calc/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { r as calc_exports, t as precision_exports } from "../shared/calc-
|
|
1
|
+
import { r as calc_exports, t as precision_exports } from "../shared/calc-Uwbxd7CS.mjs";
|
|
2
2
|
export { calc_exports as Calc, precision_exports as Precision };
|
package/dist/data/index.d.mts
CHANGED
|
@@ -1,208 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare namespace angle_d_exports {
|
|
4
|
-
export { Angle, deg, rad };
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* An `<angle>` expression: a `Calc` of angle kind, in any angle unit. Names the
|
|
8
|
-
* dimension without spelling `Calc<Refs, 'angle', Unit.Angle>` — `Angle.rad(2)`
|
|
9
|
-
* produces one, and it composes with every `Calc` combinator (subtracting two
|
|
10
|
-
* angles is an angle, scaling by a number stays an angle). `Refs` unions the
|
|
11
|
-
* unbound reference names, as on `Calc`.
|
|
12
|
-
*
|
|
13
|
-
* The leaf is the widened `Unit.Angle`, so every specific angle expression is
|
|
14
|
-
* assignable to it; a constructor narrows it (`Angle.rad` carries `Unit.Rad`).
|
|
15
|
-
*
|
|
16
|
-
* @since 0.2.0
|
|
17
|
-
*/
|
|
18
|
-
type Angle<Refs extends string = string> = Calc<Refs, 'angle', Angle$1>;
|
|
19
|
-
/**
|
|
20
|
-
* An angle in `rad` (radians). Radians are the numeric measure of an angle, so
|
|
21
|
-
* a radian-only expression solves with no unit context.
|
|
22
|
-
*
|
|
23
|
-
* @param value - The angle in radians.
|
|
24
|
-
* @param precision - Optional serialization precision.
|
|
25
|
-
* @returns A `rad` angle expression.
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* Calc.serialize(Angle.rad(1.5708)) // '1.5708rad'
|
|
29
|
-
* ```
|
|
30
|
-
* @since 0.2.0
|
|
31
|
-
*/
|
|
32
|
-
declare const rad: (value: number, precision?: Precision) => Calc<never, 'angle', Rad>;
|
|
33
|
-
/**
|
|
34
|
-
* An angle in `deg` (degrees). Degrees lower to radians at solve (`180deg` is
|
|
35
|
-
* `pi`), a fixed ratio, so a degree-only expression solves with no unit context.
|
|
36
|
-
*
|
|
37
|
-
* @param value - The angle in degrees.
|
|
38
|
-
* @param precision - Optional serialization precision.
|
|
39
|
-
* @returns A `deg` angle expression.
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* Calc.serialize(Angle.deg(45)) // '45deg'
|
|
43
|
-
* ```
|
|
44
|
-
* @since 0.2.0
|
|
45
|
-
*/
|
|
46
|
-
declare const deg: (value: number, precision?: Precision) => Calc<never, 'angle', Deg>;
|
|
47
|
-
declare namespace channels_d_exports {
|
|
48
|
-
export { Alpha, B, C, G, H, L, R };
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The `l` origin channel — lightness in `oklch`. Serializes bare as `l`.
|
|
52
|
-
*
|
|
53
|
-
* @since 0.2.0
|
|
54
|
-
*/
|
|
55
|
-
declare const L: Calc<never, 'number', ChannelLeaf<'l'>>;
|
|
56
|
-
/**
|
|
57
|
-
* The `c` origin channel — chroma in `oklch`. Serializes bare as `c`.
|
|
58
|
-
*
|
|
59
|
-
* @since 0.2.0
|
|
60
|
-
*/
|
|
61
|
-
declare const C: Calc<never, 'number', ChannelLeaf<'c'>>;
|
|
62
|
-
/**
|
|
63
|
-
* The `h` origin channel — hue in `oklch`, in degrees. Serializes bare as `h`.
|
|
64
|
-
*
|
|
65
|
-
* @since 0.2.0
|
|
66
|
-
*/
|
|
67
|
-
declare const H: Calc<never, 'number', ChannelLeaf<'h'>>;
|
|
68
|
-
/**
|
|
69
|
-
* The `r` origin channel — red in `color(srgb ...)`. Serializes bare as `r`.
|
|
70
|
-
*
|
|
71
|
-
* @since 0.2.0
|
|
72
|
-
*/
|
|
73
|
-
declare const R: Calc<never, 'number', ChannelLeaf<'r'>>;
|
|
74
|
-
/**
|
|
75
|
-
* The `g` origin channel — green in `color(srgb ...)`. Serializes bare as `g`.
|
|
76
|
-
*
|
|
77
|
-
* @since 0.2.0
|
|
78
|
-
*/
|
|
79
|
-
declare const G: Calc<never, 'number', ChannelLeaf<'g'>>;
|
|
80
|
-
/**
|
|
81
|
-
* The `b` origin channel — blue in `color(srgb ...)`. Serializes bare as `b`.
|
|
82
|
-
*
|
|
83
|
-
* @since 0.2.0
|
|
84
|
-
*/
|
|
85
|
-
declare const B: Calc<never, 'number', ChannelLeaf<'b'>>;
|
|
86
|
-
/**
|
|
87
|
-
* The `alpha` origin channel — the opacity of the `from` origin, in `oklch`
|
|
88
|
-
* and `color(srgb ...)` alike. Serializes bare as `alpha`.
|
|
89
|
-
*
|
|
90
|
-
* @since 0.2.0
|
|
91
|
-
*/
|
|
92
|
-
declare const Alpha: Calc<never, 'number', ChannelLeaf<'alpha'>>;
|
|
93
|
-
declare namespace length_d_exports {
|
|
94
|
-
export { Length, em, px, rem, vh, vmax, vmin, vw };
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* A `<length>` expression: a `Calc` of length kind, in any length unit. Names
|
|
98
|
-
* the dimension without spelling `Calc<Refs, 'length', Unit.Length>` —
|
|
99
|
-
* `Length.px(16)` produces one, and it composes with every `Calc` combinator
|
|
100
|
-
* (adding two lengths is a length, dividing one by another is a number). `Refs`
|
|
101
|
-
* unions the unbound reference names, as on `Calc`.
|
|
102
|
-
*
|
|
103
|
-
* The leaf is the widened `Unit.Length`, so a mixed-unit sum
|
|
104
|
-
* (`Calc.add(Length.px(16), Length.vw(2))`) and every single-unit length are
|
|
105
|
-
* alike assignable to it.
|
|
106
|
-
*
|
|
107
|
-
* @since 0.2.0
|
|
108
|
-
*/
|
|
109
|
-
type Length<Refs extends string = string> = Calc<Refs, 'length', Length$1>;
|
|
110
|
-
/**
|
|
111
|
-
* A length in `px` (absolute pixels).
|
|
112
|
-
*
|
|
113
|
-
* @param value - The pixel count.
|
|
114
|
-
* @param precision - Optional serialization precision.
|
|
115
|
-
* @returns A `px` length expression.
|
|
116
|
-
* @example
|
|
117
|
-
* ```ts
|
|
118
|
-
* Calc.serialize(Length.px(16)) // '16px'
|
|
119
|
-
* ```
|
|
120
|
-
* @since 0.2.0
|
|
121
|
-
*/
|
|
122
|
-
declare const px: (value: number, precision?: Precision) => Calc<never, 'length', Px>;
|
|
123
|
-
/**
|
|
124
|
-
* A length in `rem` (relative to the root font size).
|
|
125
|
-
*
|
|
126
|
-
* @param value - The multiple of the root font size.
|
|
127
|
-
* @param precision - Optional serialization precision.
|
|
128
|
-
* @returns A `rem` length expression.
|
|
129
|
-
* @since 0.2.0
|
|
130
|
-
*/
|
|
131
|
-
declare const rem: (value: number, precision?: Precision) => Calc<never, 'length', Rem>;
|
|
132
|
-
/**
|
|
133
|
-
* A length in `em` (relative to the element font size).
|
|
134
|
-
*
|
|
135
|
-
* @param value - The multiple of the element font size.
|
|
136
|
-
* @param precision - Optional serialization precision.
|
|
137
|
-
* @returns An `em` length expression.
|
|
138
|
-
* @since 0.2.0
|
|
139
|
-
*/
|
|
140
|
-
declare const em: (value: number, precision?: Precision) => Calc<never, 'length', Em>;
|
|
141
|
-
/**
|
|
142
|
-
* A length in `vw` (1% of the viewport width).
|
|
143
|
-
*
|
|
144
|
-
* @param value - The percentage of viewport width.
|
|
145
|
-
* @param precision - Optional serialization precision.
|
|
146
|
-
* @returns A `vw` length expression.
|
|
147
|
-
* @since 0.2.0
|
|
148
|
-
*/
|
|
149
|
-
declare const vw: (value: number, precision?: Precision) => Calc<never, 'length', Vw>;
|
|
150
|
-
/**
|
|
151
|
-
* A length in `vh` (1% of the viewport height).
|
|
152
|
-
*
|
|
153
|
-
* @param value - The percentage of viewport height.
|
|
154
|
-
* @param precision - Optional serialization precision.
|
|
155
|
-
* @returns A `vh` length expression.
|
|
156
|
-
* @since 0.2.0
|
|
157
|
-
*/
|
|
158
|
-
declare const vh: (value: number, precision?: Precision) => Calc<never, 'length', Vh>;
|
|
159
|
-
/**
|
|
160
|
-
* A length in `vmin` (1% of the smaller viewport axis).
|
|
161
|
-
*
|
|
162
|
-
* @param value - The percentage of the smaller viewport axis.
|
|
163
|
-
* @param precision - Optional serialization precision.
|
|
164
|
-
* @returns A `vmin` length expression.
|
|
165
|
-
* @since 0.2.0
|
|
166
|
-
*/
|
|
167
|
-
declare const vmin: (value: number, precision?: Precision) => Calc<never, 'length', Vmin>;
|
|
168
|
-
/**
|
|
169
|
-
* A length in `vmax` (1% of the larger viewport axis).
|
|
170
|
-
*
|
|
171
|
-
* @param value - The percentage of the larger viewport axis.
|
|
172
|
-
* @param precision - Optional serialization precision.
|
|
173
|
-
* @returns A `vmax` length expression.
|
|
174
|
-
* @since 0.2.0
|
|
175
|
-
*/
|
|
176
|
-
declare const vmax: (value: number, precision?: Precision) => Calc<never, 'length', Vmax>;
|
|
177
|
-
declare namespace percentage_d_exports {
|
|
178
|
-
export { Percentage, of };
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* A `<percentage>` expression: a `Calc` of percentage kind. Names the dimension
|
|
182
|
-
* without spelling `Calc<Refs, 'percentage', Unit.Percentage>` —
|
|
183
|
-
* `Percentage.of(40)` produces one, and it composes with every `Calc`
|
|
184
|
-
* combinator (adding two percentages is a percentage, one over another is a
|
|
185
|
-
* number). `Refs` unions the unbound reference names, as on `Calc`.
|
|
186
|
-
*
|
|
187
|
-
* @since 0.2.0
|
|
188
|
-
*/
|
|
189
|
-
type Percentage<Refs extends string = string> = Calc<Refs, 'percentage', Percentage$1>;
|
|
190
|
-
/**
|
|
191
|
-
* A percentage — a number rendered with a trailing `%`. `Percentage.of(40)`
|
|
192
|
-
* serializes as `40%`. The value passes through unrounded; the optional
|
|
193
|
-
* `Precision` pins serialization exactly as `Calc.of` does.
|
|
194
|
-
*
|
|
195
|
-
* @param value - The percentage magnitude (`40` for `40%`, not `0.4`).
|
|
196
|
-
* @param precision - Optional serialization precision.
|
|
197
|
-
* @returns A `<percentage>` expression.
|
|
198
|
-
* @example
|
|
199
|
-
* ```ts
|
|
200
|
-
* Calc.serialize(Percentage.of(40)) // '40%'
|
|
201
|
-
* Calc.serialize(Calc.add(Percentage.of(20), Percentage.of(5))) // '25%'
|
|
202
|
-
* ```
|
|
203
|
-
* @since 0.2.0
|
|
204
|
-
*/
|
|
205
|
-
declare const of: (value: number, precision?: Precision) => Calc<never, 'percentage', Percent>;
|
|
206
|
-
//#endregion
|
|
207
|
-
export { angle_d_exports as Angle, channels_d_exports as Channel, color_d_exports as Color, colorSpace_d_exports as ColorSpace, hueInterpolation_d_exports as HueInterpolation, keywords_d_exports as Keyword, length_d_exports as Length, percentage_d_exports as Percentage, units_d_exports as Unit };
|
|
208
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
import { O as unit_d_exports, _ as keywords_d_exports, b as channels_d_exports, d as percentage_d_exports, f as numeric_d_exports, g as color_d_exports, m as length_d_exports, o as angle_d_exports, p as lengthPercentage_d_exports, v as hueInterpolation_d_exports, y as colorSpace_d_exports } from "../shared/index-D-hVWDgZ.mjs";
|
|
2
|
+
export { angle_d_exports as Angle, channels_d_exports as Channel, color_d_exports as Color, colorSpace_d_exports as ColorSpace, hueInterpolation_d_exports as HueInterpolation, keywords_d_exports as Keyword, length_d_exports as Length, lengthPercentage_d_exports as LengthPercentage, numeric_d_exports as Numeric, percentage_d_exports as Percentage, unit_d_exports as Unit };
|
package/dist/data/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "../shared/rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { d as ident, u as dimension } from "../shared/calc-
|
|
3
|
-
import { A as oklab$1, C as shorter$1, D as hwb$1, E as hsl$1, F as srgbLinear$1, I as xyz$1, L as xyzD50$1, M as prophotoRgb$1, N as rec2020$1, O as lab$1, P as srgb$3, R as xyzD65$1, S as longer$1, T as displayP3$1, _ as isNone$1, a as isColor$1, b as increasing$1, c as named$1, d as refs
|
|
2
|
+
import { d as ident, u as dimension } from "../shared/calc-Uwbxd7CS.mjs";
|
|
3
|
+
import { A as oklab$1, C as shorter$1, D as hwb$1, E as hsl$1, F as srgbLinear$1, I as xyz$1, L as xyzD50$1, M as prophotoRgb$1, N as rec2020$1, O as lab$1, P as srgb$3, R as xyzD65$1, S as longer$1, T as displayP3$1, _ as isNone$1, a as isColor$1, b as increasing$1, c as named$1, d as refs, g as of$3, h as transparent$1, i as from$1, j as oklch$3, k as lch$1, l as oklch$2, m as srgb$2, n as channels$1, o as lightDark$1, p as serialize$1, r as equals$1, s as mix$1, t as bind$1, u as ref, v as none$1, w as a98Rgb$1, x as interpolate$1, y as decreasing$1 } from "../shared/color.internal-CxjlaRqR.mjs";
|
|
4
4
|
//#region src/data/angle.internal.ts
|
|
5
5
|
/** @internal */
|
|
6
6
|
const rad$1 = (value, precision) => dimension(value, "rad", "angle", precision);
|
|
@@ -122,11 +122,11 @@ var color_exports = /* @__PURE__ */ __exportAll({
|
|
|
122
122
|
mix: () => mix,
|
|
123
123
|
named: () => named,
|
|
124
124
|
oklch: () => oklch$1,
|
|
125
|
-
ref: () => ref,
|
|
126
|
-
refs: () => refs,
|
|
127
125
|
serialize: () => serialize,
|
|
128
126
|
srgb: () => srgb$1,
|
|
129
|
-
transparent: () => transparent
|
|
127
|
+
transparent: () => transparent,
|
|
128
|
+
var: () => _var,
|
|
129
|
+
vars: () => vars
|
|
130
130
|
});
|
|
131
131
|
/**
|
|
132
132
|
* Checks if a value is a `Color`.
|
|
@@ -151,10 +151,10 @@ const isColor = isColor$1;
|
|
|
151
151
|
* @param lightness - The lightness channel.
|
|
152
152
|
* @param chroma - The chroma channel.
|
|
153
153
|
* @param hue - The hue channel, in degrees.
|
|
154
|
-
* @returns A `Color` with the channels'
|
|
154
|
+
* @returns A `Color` with the channels' variables unioned.
|
|
155
155
|
* @example
|
|
156
156
|
* ```ts
|
|
157
|
-
* const accent = Color.oklch(Calc.
|
|
157
|
+
* const accent = Color.oklch(Calc.var('lightness'), 0.15, 220)
|
|
158
158
|
* Color.serialize(accent) // 'oklch(var(--lightness) 0.15 220)'
|
|
159
159
|
* ```
|
|
160
160
|
* @since 0.1.0
|
|
@@ -172,7 +172,7 @@ const oklch$1 = oklch$2;
|
|
|
172
172
|
* @param red - The red channel.
|
|
173
173
|
* @param green - The green channel.
|
|
174
174
|
* @param blue - The blue channel.
|
|
175
|
-
* @returns A `Color` with the channels'
|
|
175
|
+
* @returns A `Color` with the channels' variables unioned.
|
|
176
176
|
* @example
|
|
177
177
|
* ```ts
|
|
178
178
|
* const brand = Color.srgb(0.18, 0.34, 0.78)
|
|
@@ -184,7 +184,7 @@ const srgb$1 = srgb$2;
|
|
|
184
184
|
/**
|
|
185
185
|
* Creates a named color, rendered bare: `named('rebeccapurple')`
|
|
186
186
|
* serializes as `rebeccapurple`. The name is the whole value — a named
|
|
187
|
-
* color has no channels, contributes no
|
|
187
|
+
* color has no channels, contributes no variables, and binds nothing.
|
|
188
188
|
*
|
|
189
189
|
* That the name is one of the specification's named colors is not
|
|
190
190
|
* checked, matching the library's posture on identifiers — with one
|
|
@@ -205,27 +205,7 @@ const named = named$1;
|
|
|
205
205
|
* @since 0.2.0
|
|
206
206
|
*/
|
|
207
207
|
const transparent = transparent$1;
|
|
208
|
-
|
|
209
|
-
* Creates a color-valued custom-property reference — `ref('accent')`
|
|
210
|
-
* serializes as `var(--accent)`. Use it where a whole color is read from a
|
|
211
|
-
* custom property: as a standalone value, or as the origin of a relative color
|
|
212
|
-
* (`from`).
|
|
213
|
-
*
|
|
214
|
-
* The reference is the whole value, so it carries `name` as its one unbound
|
|
215
|
-
* reference — a dependency, exactly as an unbound `Calc.ref` does — but has no
|
|
216
|
-
* channels. `bind` substitutes channel expressions, not whole colors, so it
|
|
217
|
-
* leaves a color reference in place; the browser resolves it from the cascade.
|
|
218
|
-
*
|
|
219
|
-
* @param name - The custom-property name, without the `--` prefix. Must be non-empty.
|
|
220
|
-
* @returns A `Color` with `name` as its one unbound reference.
|
|
221
|
-
* @throws `Error` when `name` is empty.
|
|
222
|
-
* @example
|
|
223
|
-
* ```ts
|
|
224
|
-
* Color.serialize(Color.ref('accent')) // 'var(--accent)'
|
|
225
|
-
* ```
|
|
226
|
-
* @since 0.2.0
|
|
227
|
-
*/
|
|
228
|
-
const ref = ref$1;
|
|
208
|
+
const _var = ref;
|
|
229
209
|
/**
|
|
230
210
|
* Creates a scheme-conditional `light-dark(...)` color: the browser uses
|
|
231
211
|
* the first color under the light scheme and the second under dark.
|
|
@@ -239,7 +219,7 @@ const ref = ref$1;
|
|
|
239
219
|
*
|
|
240
220
|
* @param light - The color used under the light scheme.
|
|
241
221
|
* @param dark - The color used under the dark scheme.
|
|
242
|
-
* @returns A `Color` with both arms'
|
|
222
|
+
* @returns A `Color` with both arms' variables unioned.
|
|
243
223
|
* @example
|
|
244
224
|
* ```ts
|
|
245
225
|
* const accent = Color.lightDark(Color.srgb(0.85, 0.3, 0.4), Color.srgb(0.95, 0.5, 0.55))
|
|
@@ -268,12 +248,12 @@ const lightDark = lightDark$1;
|
|
|
268
248
|
* defaulting to `50%`, weights off `100%` rescaling with an alpha multiplier),
|
|
269
249
|
* which is computed-value behavior the browser owns. Like every `Color`, a mix
|
|
270
250
|
* binds and serializes but does not solve, and each arm and each percentage
|
|
271
|
-
* contributes its
|
|
251
|
+
* contributes its variables to the result.
|
|
272
252
|
*
|
|
273
253
|
* @param space - The interpolation `ColorSpace`; a polar one may be followed by a `HueInterpolation`.
|
|
274
254
|
* @param color1 - The first color, or a `[color, percentage]` tuple weighting it.
|
|
275
255
|
* @param color2 - The second color, or a `[color, percentage]` tuple weighting it.
|
|
276
|
-
* @returns A `Color` unioning both arms' and both percentages'
|
|
256
|
+
* @returns A `Color` unioning both arms' and both percentages' variables.
|
|
277
257
|
* @example
|
|
278
258
|
* ```ts
|
|
279
259
|
* Color.serialize(Color.mix(ColorSpace.oklch, Color.named('red'), Color.named('blue')))
|
|
@@ -301,21 +281,21 @@ const mix = mix$1;
|
|
|
301
281
|
* `calc()` when arithmetic and bare when a lone keyword, and may be
|
|
302
282
|
* `Keyword.none`. A supplied `alpha` renders after a slash
|
|
303
283
|
* (`/ calc(alpha * 0.5)`); omitted, the origin's alpha carries through. The
|
|
304
|
-
* origin's own
|
|
284
|
+
* origin's own variables union into the result; the channel keywords
|
|
305
285
|
* contribute none, since the browser resolves them from the origin.
|
|
306
286
|
*
|
|
307
|
-
* @param origin - The color to derive from — any `Color`, commonly a `
|
|
287
|
+
* @param origin - The color to derive from — any `Color`, commonly a `var`.
|
|
308
288
|
* @param space - The destination `ColorSpace`, fixing the function form and the channels in scope.
|
|
309
289
|
* @param channel1 - The first channel (`l`/`r`), in the space's order.
|
|
310
290
|
* @param channel2 - The second channel (`c`/`g`).
|
|
311
291
|
* @param channel3 - The third channel (`h`/`b`).
|
|
312
292
|
* @param alpha - The optional alpha channel; omitted, the origin's alpha is kept.
|
|
313
|
-
* @returns A `Color` unioning the origin's and the channels'
|
|
293
|
+
* @returns A `Color` unioning the origin's and the channels' variables.
|
|
314
294
|
* @example
|
|
315
295
|
* ```ts
|
|
316
|
-
* const hover = Color.from(Color.
|
|
296
|
+
* const hover = Color.from(Color.var('accent'), ColorSpace.oklch, Calc.multiply(Channel.L, 0.8), Channel.C, Channel.H)
|
|
317
297
|
* Color.serialize(hover) // 'oklch(from var(--accent) calc(l * 0.8) c h)'
|
|
318
|
-
* const faded = Color.from(Color.
|
|
298
|
+
* const faded = Color.from(Color.var('brand'), ColorSpace.srgb, Channel.R, Channel.G, Channel.B, Calc.multiply(Channel.Alpha, 0.5))
|
|
319
299
|
* Color.serialize(faded) // 'color(from var(--brand) srgb r g b / calc(alpha * 0.5))'
|
|
320
300
|
* ```
|
|
321
301
|
* @since 0.2.0
|
|
@@ -336,38 +316,38 @@ const bind = bind$1;
|
|
|
336
316
|
* @returns Deterministic CSS text.
|
|
337
317
|
* @example
|
|
338
318
|
* ```ts
|
|
339
|
-
* const surface = Color.oklch(Calc.add(Calc.
|
|
319
|
+
* const surface = Color.oklch(Calc.add(Calc.var('l'), 0.1), 0.04, 250)
|
|
340
320
|
* Color.serialize(surface) // 'oklch(calc(var(--l) + 0.1) 0.04 250)'
|
|
341
321
|
* ```
|
|
342
322
|
* @since 0.1.0
|
|
343
323
|
*/
|
|
344
324
|
const serialize = serialize$1;
|
|
345
325
|
/**
|
|
346
|
-
* The color's unbound
|
|
326
|
+
* The color's unbound variable names, unioned across channels.
|
|
347
327
|
*
|
|
348
328
|
* @param color - The color to inspect.
|
|
349
|
-
* @returns The set of unbound
|
|
329
|
+
* @returns The set of unbound variable names.
|
|
350
330
|
* @since 0.1.0
|
|
351
331
|
*/
|
|
352
|
-
const
|
|
332
|
+
const vars = refs;
|
|
353
333
|
/**
|
|
354
334
|
* The origin-channel keyword tokens the color reads — the `Channel` keywords a
|
|
355
335
|
* relative color's channels reference (`l`, `c`, `h`, ...), gathered across its
|
|
356
336
|
* channels and any nested colors. Empty for a color with no relative parts.
|
|
357
337
|
*
|
|
358
|
-
* The `Color` companion to `Calc.
|
|
359
|
-
* `
|
|
338
|
+
* The `Color` companion to `Calc.idents`, and the mirror of `vars`: where
|
|
339
|
+
* `vars` reports the custom properties a color depends on, `channels` reports
|
|
360
340
|
* the origin channels a relative color reads. They are disjoint — a channel
|
|
361
|
-
* keyword is never a
|
|
341
|
+
* keyword is never a variable — so a channel token never appears in `vars` nor
|
|
362
342
|
* reaches a `Stylesheet`'s dependency report.
|
|
363
343
|
*
|
|
364
344
|
* @param color - The color to inspect.
|
|
365
345
|
* @returns The set of channel-keyword tokens the color reads.
|
|
366
346
|
* @example
|
|
367
347
|
* ```ts
|
|
368
|
-
* const hover = Color.from(Color.
|
|
348
|
+
* const hover = Color.from(Color.var('accent'), ColorSpace.oklch, Calc.multiply(Channel.L, 0.8), Channel.C, Channel.H)
|
|
369
349
|
* Color.channels(hover) // Set { 'l', 'c', 'h' }
|
|
370
|
-
* Color.
|
|
350
|
+
* Color.vars(hover) // Set { 'accent' }
|
|
371
351
|
* ```
|
|
372
352
|
* @since 0.2.0
|
|
373
353
|
*/
|
|
@@ -534,16 +514,16 @@ const decreasing = decreasing$1;
|
|
|
534
514
|
* (at `to`). `shorter` and `longer` take the short or long arc between the hues;
|
|
535
515
|
* `increasing`/`decreasing` force the direction. The result is unwrapped — it may
|
|
536
516
|
* fall outside `[0, 360)`, which the browser resolves as a hue — and unions the
|
|
537
|
-
* arguments'
|
|
517
|
+
* arguments' variables. Drop it straight into a hue channel (`Color.oklch`).
|
|
538
518
|
*
|
|
539
519
|
* @param strategy - The traversal strategy (`shorter`, `longer`, ...).
|
|
540
520
|
* @param from - The start hue, in degrees: a number or a `Calc`.
|
|
541
521
|
* @param to - The end hue, in degrees: a number or a `Calc`.
|
|
542
522
|
* @param t - The interpolation parameter, `0` to `1`: a number or a `Calc`.
|
|
543
|
-
* @returns The interpolated hue in degrees, a `Calc` unioning the arguments'
|
|
523
|
+
* @returns The interpolated hue in degrees, a `Calc` unioning the arguments' variables.
|
|
544
524
|
* @example
|
|
545
525
|
* ```ts
|
|
546
|
-
* const hue = HueInterpolation.interpolate(HueInterpolation.shorter, 30, Calc.
|
|
526
|
+
* const hue = HueInterpolation.interpolate(HueInterpolation.shorter, 30, Calc.var('to'), Calc.var('t'))
|
|
547
527
|
* Calc.serialize(hue) // 'calc(30 + (mod(var(--to) - 30 + 180, 360) - 180) * var(--t))'
|
|
548
528
|
* Calc.serialize(HueInterpolation.interpolate(HueInterpolation.increasing, 20, 350, 0.5)) // '185'
|
|
549
529
|
* ```
|
|
@@ -669,6 +649,44 @@ const vmin = vmin$1;
|
|
|
669
649
|
*/
|
|
670
650
|
const vmax = vmax$1;
|
|
671
651
|
//#endregion
|
|
652
|
+
//#region src/data/lengthPercentage.internal.ts
|
|
653
|
+
/**
|
|
654
|
+
* The runtime is the identity: widening is a type-level anchor, and the
|
|
655
|
+
* expression tree already carries its units structurally. The bottom
|
|
656
|
+
* return is the usual widening discipline; the public signature carries
|
|
657
|
+
* the real vars/requires threading.
|
|
658
|
+
*
|
|
659
|
+
* @internal
|
|
660
|
+
*/
|
|
661
|
+
const of$2 = (value) => value;
|
|
662
|
+
//#endregion
|
|
663
|
+
//#region src/data/lengthPercentage.ts
|
|
664
|
+
var lengthPercentage_exports = /* @__PURE__ */ __exportAll({ of: () => of$1 });
|
|
665
|
+
/**
|
|
666
|
+
* Widens a length or percentage expression to a `<length-percentage>` —
|
|
667
|
+
* the identity at runtime, an anchor at the type level. Widening is what
|
|
668
|
+
* unlocks mixing: the combinators key their operand family on the first
|
|
669
|
+
* argument, so `Calc.subtract(LengthPercentage.of(Percentage.of(100)),
|
|
670
|
+
* Length.px(24))` builds `calc(100% - 24px)` where the unwidened spelling
|
|
671
|
+
* is a cross-family type error.
|
|
672
|
+
*
|
|
673
|
+
* A `<length-percentage>` read (`Calc.var(Var.lengthPercentage('inset'))`)
|
|
674
|
+
* is already this wide; `of` serves values built from concrete units.
|
|
675
|
+
*
|
|
676
|
+
* @param value - A length, percentage, or already-mixed expression.
|
|
677
|
+
* @returns The same expression, typed as a `<length-percentage>`.
|
|
678
|
+
* @example
|
|
679
|
+
* ```ts
|
|
680
|
+
* const inset = LengthPercentage.of(Percentage.of(100))
|
|
681
|
+
* Calc.serialize(Calc.subtract(inset, Length.px(24))) // 'calc(100% - 24px)'
|
|
682
|
+
* ```
|
|
683
|
+
* @since 0.4.0
|
|
684
|
+
*/
|
|
685
|
+
const of$1 = of$2;
|
|
686
|
+
//#endregion
|
|
687
|
+
//#region src/data/numeric.ts
|
|
688
|
+
var numeric_exports = /* @__PURE__ */ __exportAll({});
|
|
689
|
+
//#endregion
|
|
672
690
|
//#region src/data/percentage.ts
|
|
673
691
|
var percentage_exports = /* @__PURE__ */ __exportAll({ of: () => of });
|
|
674
692
|
/**
|
|
@@ -683,14 +701,15 @@ var percentage_exports = /* @__PURE__ */ __exportAll({ of: () => of });
|
|
|
683
701
|
* ```ts
|
|
684
702
|
* Calc.serialize(Percentage.of(40)) // '40%'
|
|
685
703
|
* Calc.serialize(Calc.add(Percentage.of(20), Percentage.of(5))) // '25%'
|
|
704
|
+
* Calc.solve(Percentage.of(50), { units: { '%': 320 / 100 } }) // 160
|
|
686
705
|
* ```
|
|
687
706
|
* @since 0.2.0
|
|
688
707
|
*/
|
|
689
|
-
const of = of$
|
|
708
|
+
const of = of$3;
|
|
690
709
|
//#endregion
|
|
691
|
-
//#region src/data/
|
|
692
|
-
var
|
|
710
|
+
//#region src/data/unit.ts
|
|
711
|
+
var unit_exports = /* @__PURE__ */ __exportAll({});
|
|
693
712
|
//#endregion
|
|
694
|
-
export { angle_exports as Angle, channels_exports as Channel, color_exports as Color, colorSpace_exports as ColorSpace, hueInterpolation_exports as HueInterpolation, keywords_exports as Keyword, length_exports as Length, percentage_exports as Percentage,
|
|
713
|
+
export { angle_exports as Angle, channels_exports as Channel, color_exports as Color, colorSpace_exports as ColorSpace, hueInterpolation_exports as HueInterpolation, keywords_exports as Keyword, length_exports as Length, lengthPercentage_exports as LengthPercentage, numeric_exports as Numeric, percentage_exports as Percentage, unit_exports as Unit };
|
|
695
714
|
|
|
696
715
|
//# sourceMappingURL=index.mjs.map
|