fashionable 0.0.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +276 -0
  3. package/dist/calc/index.d.mts +2 -0
  4. package/dist/calc/index.mjs +2 -0
  5. package/dist/data/index.d.mts +208 -0
  6. package/dist/data/index.mjs +696 -0
  7. package/dist/data/index.mjs.map +1 -0
  8. package/dist/declaration/index.d.mts +2 -0
  9. package/dist/declaration/index.mjs +74 -0
  10. package/dist/declaration/index.mjs.map +1 -0
  11. package/dist/fontFace/index.d.mts +2 -0
  12. package/dist/fontFace/index.mjs +102 -0
  13. package/dist/fontFace/index.mjs.map +1 -0
  14. package/dist/property/index.d.mts +2 -0
  15. package/dist/property/index.mjs +293 -0
  16. package/dist/property/index.mjs.map +1 -0
  17. package/dist/query/index.d.mts +2 -0
  18. package/dist/query/index.mjs +62 -0
  19. package/dist/query/index.mjs.map +1 -0
  20. package/dist/rule/index.d.mts +2 -0
  21. package/dist/rule/index.mjs +234 -0
  22. package/dist/rule/index.mjs.map +1 -0
  23. package/dist/selector/index.d.mts +2 -0
  24. package/dist/selector/index.mjs +178 -0
  25. package/dist/selector/index.mjs.map +1 -0
  26. package/dist/shared/calc-Cih4o2r7.mjs +1145 -0
  27. package/dist/shared/calc-Cih4o2r7.mjs.map +1 -0
  28. package/dist/shared/color-BvNJ2YqL.d.mts +590 -0
  29. package/dist/shared/color.internal-Dts5ycTm.mjs +450 -0
  30. package/dist/shared/color.internal-Dts5ycTm.mjs.map +1 -0
  31. package/dist/shared/declaration-1DlO_ltT.d.mts +166 -0
  32. package/dist/shared/declaration.internal-wLB4ssxC.mjs +73 -0
  33. package/dist/shared/declaration.internal-wLB4ssxC.mjs.map +1 -0
  34. package/dist/shared/equal-U9G5LhtL.mjs +71 -0
  35. package/dist/shared/equal-U9G5LhtL.mjs.map +1 -0
  36. package/dist/shared/fontFaceRule-C7nYgH6X.d.mts +294 -0
  37. package/dist/shared/fontFaceRule.internal-D5u48TUO.mjs +214 -0
  38. package/dist/shared/fontFaceRule.internal-D5u48TUO.mjs.map +1 -0
  39. package/dist/shared/format-B9jsmCER.mjs +53 -0
  40. package/dist/shared/format-B9jsmCER.mjs.map +1 -0
  41. package/dist/shared/index-BvtwY4FQ.d.mts +841 -0
  42. package/dist/shared/mediaQuery-BYR1z-iD.d.mts +145 -0
  43. package/dist/shared/mediaQuery.internal-B6iuMd75.mjs +100 -0
  44. package/dist/shared/mediaQuery.internal-B6iuMd75.mjs.map +1 -0
  45. package/dist/shared/mediaRule-BDB4WCYy.d.mts +558 -0
  46. package/dist/shared/precision.internal-0lv1nEpF.mjs +40 -0
  47. package/dist/shared/precision.internal-0lv1nEpF.mjs.map +1 -0
  48. package/dist/shared/propertyRule-BbkFh9b9.d.mts +466 -0
  49. package/dist/shared/propertyRule.internal-Bc_HrfcL.mjs +246 -0
  50. package/dist/shared/propertyRule.internal-Bc_HrfcL.mjs.map +1 -0
  51. package/dist/shared/render-BqcFH9Vr.mjs +9 -0
  52. package/dist/shared/render-BqcFH9Vr.mjs.map +1 -0
  53. package/dist/shared/rolldown-runtime-D7D4PA-g.mjs +13 -0
  54. package/dist/shared/ruleSet.internal-DodzVMUU.mjs +218 -0
  55. package/dist/shared/ruleSet.internal-DodzVMUU.mjs.map +1 -0
  56. package/dist/shared/selector-HZY-W6l6.d.mts +346 -0
  57. package/dist/shared/selector.internal-ESe9s0IH.mjs +290 -0
  58. package/dist/shared/selector.internal-ESe9s0IH.mjs.map +1 -0
  59. package/dist/shared/utils-BKm298I-.d.mts +179 -0
  60. package/dist/stylesheet/index.d.mts +316 -0
  61. package/dist/stylesheet/index.mjs +296 -0
  62. package/dist/stylesheet/index.mjs.map +1 -0
  63. package/dist/utils.d.mts +2 -0
  64. package/dist/utils.mjs +131 -0
  65. package/dist/utils.mjs.map +1 -0
  66. package/package.json +96 -8
  67. package/index.js +0 -1
@@ -0,0 +1,590 @@
1
+ import { f as ChannelLeaf, i as Input, n as Bindings, o as SerializeOptions, r as Calc, t as ApplyBindings } from "./index-BvtwY4FQ.mjs";
2
+ import { t as Pipeable } from "./utils-BKm298I-.mjs";
3
+ declare namespace colorSpace_d_exports {
4
+ export { ColorSpace, Polar, PolarSpace, a98Rgb, displayP3, hsl, hwb, lab, lch, oklab, oklch$1 as oklch, prophotoRgb, rec2020, srgb$1 as srgb, srgbLinear, xyz, xyzD50, xyzD65 };
5
+ }
6
+ declare const ColorSpaceChannels: unique symbol;
7
+ declare const PolarId: unique symbol;
8
+ /**
9
+ * The trait a polar color space carries — one with a hue channel. `Color.mix`
10
+ * requires it to take a `HueInterpolation`, and `PolarSpace` is the space type
11
+ * that has it. Composes by intersection with future space traits, as curvy's
12
+ * brands do.
13
+ *
14
+ * @since 0.2.0
15
+ */
16
+ type Polar = {
17
+ readonly [PolarId]: 'polar';
18
+ };
19
+ /**
20
+ * A color space. `Channels` carries the origin-channel keyword brands
21
+ * (`Channel`) valid for `Color.from`; `Trait` accumulates the space's
22
+ * capability brands (`Polar`), defaulting to `unknown` — a space with no
23
+ * capability claims. A position requires a capability by naming its brand in
24
+ * `Trait` (`ColorSpace<Channels, Polar>`).
25
+ *
26
+ * @since 0.2.0
27
+ */
28
+ interface ColorSpace<out Channels = ChannelLeaf<string>, out Trait = unknown> {
29
+ readonly [ColorSpaceTypeId]: ColorSpaceTypeId;
30
+ readonly [ColorSpaceChannels]?: Channels;
31
+ readonly [ColorSpaceTraits]?: Trait;
32
+ }
33
+ /**
34
+ * A polar color space — one carrying the `Polar` trait, so `Color.mix` may take
35
+ * a `HueInterpolation` after it.
36
+ *
37
+ * @since 0.2.0
38
+ */
39
+ type PolarSpace<Channels = ChannelLeaf<string>> = ColorSpace<Channels, Polar>;
40
+ /**
41
+ * The `oklch` space: a polar interpolation space, and an `oklch(from ...)`
42
+ * destination with `Channel.L`/`C`/`H` (and `Alpha`) in scope.
43
+ *
44
+ * @since 0.2.0
45
+ */
46
+ declare const oklch$1: ColorSpace<ChannelLeaf<'l'> | ChannelLeaf<'c'> | ChannelLeaf<'h'> | ChannelLeaf<'alpha'>, Polar>;
47
+ /**
48
+ * The `srgb` space: a rectangular interpolation space, and a
49
+ * `color(from ... srgb ...)` destination with `Channel.R`/`G`/`B` (and `Alpha`)
50
+ * in scope.
51
+ *
52
+ * @since 0.2.0
53
+ */
54
+ declare const srgb$1: ColorSpace<ChannelLeaf<'r'> | ChannelLeaf<'g'> | ChannelLeaf<'b'> | ChannelLeaf<'alpha'>>;
55
+ /**
56
+ * The `srgb-linear` space (rectangular).
57
+ *
58
+ * @since 0.2.0
59
+ */
60
+ declare const srgbLinear: ColorSpace<never>;
61
+ /**
62
+ * The `display-p3` space (rectangular).
63
+ *
64
+ * @since 0.2.0
65
+ */
66
+ declare const displayP3: ColorSpace<never>;
67
+ /**
68
+ * The `a98-rgb` space (rectangular).
69
+ *
70
+ * @since 0.2.0
71
+ */
72
+ declare const a98Rgb: ColorSpace<never>;
73
+ /**
74
+ * The `prophoto-rgb` space (rectangular).
75
+ *
76
+ * @since 0.2.0
77
+ */
78
+ declare const prophotoRgb: ColorSpace<never>;
79
+ /**
80
+ * The `rec2020` space (rectangular).
81
+ *
82
+ * @since 0.2.0
83
+ */
84
+ declare const rec2020: ColorSpace<never>;
85
+ /**
86
+ * The `lab` space (rectangular).
87
+ *
88
+ * @since 0.2.0
89
+ */
90
+ declare const lab: ColorSpace<never>;
91
+ /**
92
+ * The `oklab` space (rectangular).
93
+ *
94
+ * @since 0.2.0
95
+ */
96
+ declare const oklab: ColorSpace<never>;
97
+ /**
98
+ * The `xyz` space (rectangular; an alias for `xyz-d65`).
99
+ *
100
+ * @since 0.2.0
101
+ */
102
+ declare const xyz: ColorSpace<never>;
103
+ /**
104
+ * The `xyz-d50` space (rectangular).
105
+ *
106
+ * @since 0.2.0
107
+ */
108
+ declare const xyzD50: ColorSpace<never>;
109
+ /**
110
+ * The `xyz-d65` space (rectangular).
111
+ *
112
+ * @since 0.2.0
113
+ */
114
+ declare const xyzD65: ColorSpace<never>;
115
+ /**
116
+ * The `hsl` space (polar).
117
+ *
118
+ * @since 0.2.0
119
+ */
120
+ declare const hsl: ColorSpace<never, Polar>;
121
+ /**
122
+ * The `hwb` space (polar).
123
+ *
124
+ * @since 0.2.0
125
+ */
126
+ declare const hwb: ColorSpace<never, Polar>;
127
+ /**
128
+ * The `lch` space (polar).
129
+ *
130
+ * @since 0.2.0
131
+ */
132
+ declare const lch: ColorSpace<never, Polar>;
133
+ //#endregion
134
+ //#region src/data/colorSpace.internal.d.ts
135
+ declare const ColorSpaceTypeId: unique symbol;
136
+ type ColorSpaceTypeId = typeof ColorSpaceTypeId;
137
+ /**
138
+ * Phantom key holding a `ColorSpace`'s `Trait` parameter. The runtime value
139
+ * never has a value here — traits are type-level brands, so a space is
140
+ * identical at runtime whatever its traits (the curvy trait pattern).
141
+ *
142
+ * @internal
143
+ */
144
+ declare const ColorSpaceTraits: unique symbol;
145
+ type ColorSpaceTraits = typeof ColorSpaceTraits;
146
+ //#endregion
147
+ //#region src/data/hueInterpolation.internal.d.ts
148
+ declare const HueInterpolationTypeId: unique symbol;
149
+ type HueInterpolationTypeId = typeof HueInterpolationTypeId;
150
+ declare namespace hueInterpolation_d_exports {
151
+ export { HueInterpolation, decreasing, increasing, interpolate, longer, shorter };
152
+ }
153
+ declare const HueInterpolationStrategy: unique symbol;
154
+ /**
155
+ * A hue-interpolation strategy. The `Strategy` parameter names the specific
156
+ * one (`'longer'`), letting a position accept a particular strategy where it
157
+ * matters; `Color.mix` accepts any.
158
+ *
159
+ * @since 0.2.0
160
+ */
161
+ interface HueInterpolation<Strategy extends string = string> {
162
+ readonly [HueInterpolationTypeId]: HueInterpolationTypeId;
163
+ readonly [HueInterpolationStrategy]?: Strategy;
164
+ }
165
+ /**
166
+ * The `shorter` strategy — the short arc between the two hues (the browser
167
+ * default). Serializes as `shorter hue`.
168
+ *
169
+ * @since 0.2.0
170
+ */
171
+ declare const shorter: HueInterpolation<'shorter'>;
172
+ /**
173
+ * The `longer` strategy — the long arc between the two hues. Serializes as
174
+ * `longer hue`.
175
+ *
176
+ * @since 0.2.0
177
+ */
178
+ declare const longer: HueInterpolation<'longer'>;
179
+ /**
180
+ * The `increasing` strategy — hues traversed in increasing order, wrapping past
181
+ * `360` if needed. Serializes as `increasing hue`.
182
+ *
183
+ * @since 0.2.0
184
+ */
185
+ declare const increasing: HueInterpolation<'increasing'>;
186
+ /**
187
+ * The `decreasing` strategy — hues traversed in decreasing order, wrapping past
188
+ * `0` if needed. Serializes as `decreasing hue`.
189
+ *
190
+ * @since 0.2.0
191
+ */
192
+ declare const decreasing: HueInterpolation<'decreasing'>;
193
+ /**
194
+ * Builds the hue at `t` along the arc from `from` to `to` under `strategy` — the
195
+ * JS side of what a polar `Color.mix` emits for the browser. Hues are numbers of
196
+ * degrees (as an oklch/lch hue channel is), and `from`, `to`, and `t` are each a
197
+ * number or a `Calc`, so the result is a `Calc` too: fully symbolic when any
198
+ * argument is, folding to a constant when all are numbers.
199
+ *
200
+ * The hue math is the CSS Color 4 fixup, written branchlessly with `mod`: each
201
+ * strategy is a signed delta added to `from` as `t` runs `0` (at `from`) to `1`
202
+ * (at `to`). `shorter` and `longer` take the short or long arc between the hues;
203
+ * `increasing`/`decreasing` force the direction. The result is unwrapped — it may
204
+ * fall outside `[0, 360)`, which the browser resolves as a hue — and unions the
205
+ * arguments' references. Drop it straight into a hue channel (`Color.oklch`).
206
+ *
207
+ * @param strategy - The traversal strategy (`shorter`, `longer`, ...).
208
+ * @param from - The start hue, in degrees: a number or a `Calc`.
209
+ * @param to - The end hue, in degrees: a number or a `Calc`.
210
+ * @param t - The interpolation parameter, `0` to `1`: a number or a `Calc`.
211
+ * @returns The interpolated hue in degrees, a `Calc` unioning the arguments' references.
212
+ * @example
213
+ * ```ts
214
+ * const hue = HueInterpolation.interpolate(HueInterpolation.shorter, 30, Calc.ref('to'), Calc.ref('t'))
215
+ * Calc.serialize(hue) // 'calc(30 + (mod(var(--to) - 30 + 180, 360) - 180) * var(--t))'
216
+ * Calc.serialize(HueInterpolation.interpolate(HueInterpolation.increasing, 20, 350, 0.5)) // '185'
217
+ * ```
218
+ * @since 0.2.0
219
+ */
220
+ declare const interpolate: <F extends string = never, T extends string = never, P extends string = never>(strategy: HueInterpolation, from: Input<F>, to: Input<T>, t: Input<P>) => Calc<F | T | P>;
221
+ //#endregion
222
+ //#region src/data/keywords.internal.d.ts
223
+ declare const NoneTypeId: unique symbol;
224
+ type NoneTypeId = typeof NoneTypeId;
225
+ declare namespace keywords_d_exports {
226
+ export { None, isNone, none };
227
+ }
228
+ /**
229
+ * The type of `none` alone. Naming it lets accepting positions spell
230
+ * their signatures (`Input<R> | Keyword.None`) and overloads recognize
231
+ * the keyword.
232
+ *
233
+ * @since 0.2.0
234
+ */
235
+ interface None extends Pipeable {
236
+ readonly [NoneTypeId]: NoneTypeId;
237
+ }
238
+ /**
239
+ * The `none` keyword — CSS's missing-component value. Accepted where a
240
+ * position declares it: color channels today (`oklch(0 0 none)`), other
241
+ * slots as they arrive.
242
+ *
243
+ * @since 0.2.0
244
+ */
245
+ declare const none: None;
246
+ /**
247
+ * Checks if a value is the `none` keyword.
248
+ *
249
+ * True only for `none` itself, which carries the brand.
250
+ *
251
+ * @param u - The value to check.
252
+ * @returns `true` if the value is `none`, `false` otherwise.
253
+ * @since 0.2.0
254
+ */
255
+ declare const isNone: (u: unknown) => u is None;
256
+ //#endregion
257
+ //#region src/data/color.internal.d.ts
258
+ declare const ColorTypeId: unique symbol;
259
+ type ColorTypeId = typeof ColorTypeId;
260
+ declare namespace color_d_exports {
261
+ export { Color, RelativeChannel, bind, channels, equals, from, isColor, lightDark, mix, named, oklch, ref, refs, serialize, srgb, transparent };
262
+ }
263
+ declare const ColorRefs: unique symbol;
264
+ /**
265
+ * A CSS color expression whose channels are `Calc` number expressions.
266
+ *
267
+ * A color is not a number: it can be bound and serialized, but not
268
+ * solved. The `Refs` parameter unions the channels' unbound reference
269
+ * names, exactly as on `Calc`.
270
+ *
271
+ * `oklch(...)`, `color(srgb ...)`, `light-dark(...)`, `color-mix(...)`,
272
+ * relative colors (`oklch(from ...)`, `color(from ...)`), a color-valued
273
+ * `var(...)`, and named colors are modeled today; other color functions
274
+ * arrive as a consumer needs them. Channels accept `Keyword.none`, CSS's
275
+ * missing-component value.
276
+ *
277
+ * Construct via `oklch`, `srgb`, `lightDark`, `mix`, `named`, `from`, and
278
+ * `ref` (or the `transparent` constant).
279
+ *
280
+ * @since 0.1.0
281
+ */
282
+ interface Color<out Refs extends string = string> extends Pipeable {
283
+ readonly [ColorTypeId]: ColorTypeId;
284
+ readonly [ColorRefs]?: Refs;
285
+ }
286
+ /**
287
+ * Checks if a value is a `Color`.
288
+ *
289
+ * True only for values built by this module's constructors, which carry
290
+ * the brand.
291
+ *
292
+ * @param u - The value to check.
293
+ * @returns `true` if the value is a `Color`, `false` otherwise.
294
+ * @since 0.1.0
295
+ */
296
+ declare const isColor: (u: unknown) => u is Color<string>;
297
+ /**
298
+ * Creates an `oklch(...)` color from three channel expressions: lightness
299
+ * (`0` to `1`), chroma (`0` upward), and hue (degrees). A channel may be
300
+ * `Keyword.none` — the missing-component keyword, the conventional hue
301
+ * for achromatic colors: `oklch(0 0 none)`.
302
+ *
303
+ * Each channel serializes independently, wrapped in `calc()` when it is
304
+ * arithmetic: `oklch(var(--l) calc(var(--c) * 0.5) 220)`.
305
+ *
306
+ * @param lightness - The lightness channel.
307
+ * @param chroma - The chroma channel.
308
+ * @param hue - The hue channel, in degrees.
309
+ * @returns A `Color` with the channels' references unioned.
310
+ * @example
311
+ * ```ts
312
+ * const accent = Color.oklch(Calc.ref('lightness'), 0.15, 220)
313
+ * Color.serialize(accent) // 'oklch(var(--lightness) 0.15 220)'
314
+ * ```
315
+ * @since 0.1.0
316
+ */
317
+ declare const oklch: <L extends string = never, C extends string = never, H extends string = never>(lightness: Input<L> | None, chroma: Input<C> | None, hue: Input<H> | None) => Color<L | C | H>;
318
+ /**
319
+ * Creates a `color(srgb ...)` color from three channel expressions, each
320
+ * `0` to `1`. A channel may be `Keyword.none`, the missing-component
321
+ * keyword.
322
+ *
323
+ * Each channel serializes independently, wrapped in `calc()` when it is
324
+ * arithmetic, inside the `color()` function's `srgb` colorspace:
325
+ * `color(srgb 0.18 0.34 0.78)`.
326
+ *
327
+ * @param red - The red channel.
328
+ * @param green - The green channel.
329
+ * @param blue - The blue channel.
330
+ * @returns A `Color` with the channels' references unioned.
331
+ * @example
332
+ * ```ts
333
+ * const brand = Color.srgb(0.18, 0.34, 0.78)
334
+ * Color.serialize(brand) // 'color(srgb 0.18 0.34 0.78)'
335
+ * ```
336
+ * @since 0.2.0
337
+ */
338
+ declare const srgb: <R extends string = never, G extends string = never, B extends string = never>(red: Input<R> | None, green: Input<G> | None, blue: Input<B> | None) => Color<R | G | B>;
339
+ /**
340
+ * Creates a named color, rendered bare: `named('rebeccapurple')`
341
+ * serializes as `rebeccapurple`. The name is the whole value — a named
342
+ * color has no channels, contributes no references, and binds nothing.
343
+ *
344
+ * That the name is one of the specification's named colors is not
345
+ * checked, matching the library's posture on identifiers — with one
346
+ * exception: the CSS-wide keywords (`inherit`, `initial`, ...) are
347
+ * whole-declaration values, not colors (`light-dark(inherit, ...)` is
348
+ * invalid CSS), and are rejected.
349
+ *
350
+ * @param name - The color name. Must be non-empty and not a CSS-wide keyword.
351
+ * @returns A `Color<never>`.
352
+ * @throws `Error` when `name` is empty or a CSS-wide keyword.
353
+ * @since 0.2.0
354
+ */
355
+ declare const named: (name: string) => Color<never>;
356
+ /**
357
+ * The `transparent` named color — `rgb(0 0 0 / 0)` by definition, and
358
+ * the conventional "no color" value.
359
+ *
360
+ * @since 0.2.0
361
+ */
362
+ declare const transparent: Color<never>;
363
+ /**
364
+ * Creates a color-valued custom-property reference — `ref('accent')`
365
+ * serializes as `var(--accent)`. Use it where a whole color is read from a
366
+ * custom property: as a standalone value, or as the origin of a relative color
367
+ * (`from`).
368
+ *
369
+ * The reference is the whole value, so it carries `name` as its one unbound
370
+ * reference — a dependency, exactly as an unbound `Calc.ref` does — but has no
371
+ * channels. `bind` substitutes channel expressions, not whole colors, so it
372
+ * leaves a color reference in place; the browser resolves it from the cascade.
373
+ *
374
+ * @param name - The custom-property name, without the `--` prefix. Must be non-empty.
375
+ * @returns A `Color` with `name` as its one unbound reference.
376
+ * @throws `Error` when `name` is empty.
377
+ * @example
378
+ * ```ts
379
+ * Color.serialize(Color.ref('accent')) // 'var(--accent)'
380
+ * ```
381
+ * @since 0.2.0
382
+ */
383
+ declare const ref: <Name extends string>(name: Name) => Color<Name>;
384
+ /**
385
+ * Creates a scheme-conditional `light-dark(...)` color: the browser uses
386
+ * the first color under the light scheme and the second under dark.
387
+ *
388
+ * The arms are whole colors and positional — `lightDark(a, b)` and
389
+ * `lightDark(b, a)` are different colors. Any `Color` is accepted,
390
+ * including another `lightDark` (grammatically an arm is any `<color>`;
391
+ * nesting is redundant but legal, and simplification is not this type's
392
+ * job). Note the resolution context: `light-dark()` requires
393
+ * `color-scheme` to be set — that contract is the consumer's.
394
+ *
395
+ * @param light - The color used under the light scheme.
396
+ * @param dark - The color used under the dark scheme.
397
+ * @returns A `Color` with both arms' references unioned.
398
+ * @example
399
+ * ```ts
400
+ * const accent = Color.lightDark(Color.srgb(0.85, 0.3, 0.4), Color.srgb(0.95, 0.5, 0.55))
401
+ * Color.serialize(accent) // 'light-dark(color(srgb 0.85 0.3 0.4), color(srgb 0.95 0.5 0.55))'
402
+ * ```
403
+ * @since 0.2.0
404
+ */
405
+ declare const lightDark: <A extends string = never, B extends string = never>(light: Color<A>, dark: Color<B>) => Color<A | B>;
406
+ type MixArm<C extends string, P extends string> = Color<C> | readonly [Color<C>, number | Calc<P, 'percentage', unknown>];
407
+ /**
408
+ * Creates a `color-mix(...)`: the browser mixes `color1` and `color2` in the
409
+ * interpolation `space`. Each arm is a bare `Color` or a `[color, percentage]`
410
+ * tuple giving its weight — a bare number reads as a percent (`20` is `20%`,
411
+ * the `<percentage>` convention), a `Percentage` expression an annotated or
412
+ * computed weight (`Percentage.of(20)`, `Calc.multiply(Percentage.of(50), ...)`);
413
+ * a plain number-kind `Calc` is rejected, a weight being a `<percentage>`.
414
+ *
415
+ * A polar `space` (`ColorSpace.oklch`, `ColorSpace.lch`, ...) may take a
416
+ * `HueInterpolation` strategy between the space and the colors — the second
417
+ * overload — for how the hue circle is traversed; omit it and the browser
418
+ * defaults to `shorter`. A rectangular space has no hue channel, so passing a
419
+ * strategy is a compile error, mirroring the grammar where
420
+ * `<hue-interpolation-method>` follows only a polar space.
421
+ *
422
+ * Percentages are optional and preserved verbatim — fashionable emits the
423
+ * authored form and never runs the spec's mixing normalization (omitted weights
424
+ * defaulting to `50%`, weights off `100%` rescaling with an alpha multiplier),
425
+ * which is computed-value behavior the browser owns. Like every `Color`, a mix
426
+ * binds and serializes but does not solve, and each arm and each percentage
427
+ * contributes its references to the result.
428
+ *
429
+ * @param space - The interpolation `ColorSpace`; a polar one may be followed by a `HueInterpolation`.
430
+ * @param color1 - The first color, or a `[color, percentage]` tuple weighting it.
431
+ * @param color2 - The second color, or a `[color, percentage]` tuple weighting it.
432
+ * @returns A `Color` unioning both arms' and both percentages' references.
433
+ * @example
434
+ * ```ts
435
+ * Color.serialize(Color.mix(ColorSpace.oklch, Color.named('red'), Color.named('blue')))
436
+ * // 'color-mix(in oklch, red, blue)'
437
+ * Color.serialize(Color.mix(ColorSpace.srgb, [Color.named('white'), 20], Color.named('black')))
438
+ * // 'color-mix(in srgb, white 20%, black)'
439
+ * Color.serialize(Color.mix(ColorSpace.oklch, HueInterpolation.longer, Color.named('red'), Color.named('blue')))
440
+ * // 'color-mix(in oklch longer hue, red, blue)'
441
+ * ```
442
+ * @since 0.2.0
443
+ */
444
+ declare const mix: {
445
+ <C1 extends string = never, P1 extends string = never, C2 extends string = never, P2 extends string = never>(space: ColorSpace, color1: MixArm<C1, P1>, color2: MixArm<C2, P2>): Color<C1 | P1 | C2 | P2>;
446
+ <C1 extends string = never, P1 extends string = never, C2 extends string = never, P2 extends string = never>(space: PolarSpace, hue: HueInterpolation, color1: MixArm<C1, P1>, color2: MixArm<C2, P2>): Color<C1 | P1 | C2 | P2>;
447
+ };
448
+ /**
449
+ * A channel slot of a relative color: a bare number, `Keyword.none`, or a
450
+ * `Calc` number expression. `Channels` is the set of origin-channel keyword
451
+ * brands (`Channel`) the expression may read — the space's own channels — so a
452
+ * keyword from another color space (`Channel.R` in an `oklch` slot) is a
453
+ * compile error. A plain expression (a constant, a `Calc.ref`, a `clamp`)
454
+ * carries no channel keyword and fits any slot.
455
+ *
456
+ * @since 0.2.0
457
+ */
458
+ type RelativeChannel<Refs extends string, Channels> = number | None | Calc<Refs, 'number', Channels>;
459
+ type ChannelsOf<Space> = Space extends ColorSpace<infer Channels> ? Channels : never;
460
+ /**
461
+ * Creates a relative color from an origin and a destination `ColorSpace`:
462
+ * `Color.from(origin, ColorSpace.oklch, l, c, h)` is `oklch(from origin l c h)`
463
+ * and `Color.from(origin, ColorSpace.srgb, r, g, b)` is
464
+ * `color(from origin srgb r g b)`. The browser converts `origin` into the
465
+ * space and exposes its channels as the `Channel` keywords the space names
466
+ * (`Channel.L`/`C`/`H` for `oklch`, `Channel.R`/`G`/`B` for `srgb`, `Channel.Alpha`
467
+ * for both); passing them straight through reproduces the origin, and
468
+ * arithmetic on them derives a related color.
469
+ *
470
+ * The `space` scopes the channel arguments — a keyword the space does not name
471
+ * is a compile error. Each channel serializes independently, wrapped in
472
+ * `calc()` when arithmetic and bare when a lone keyword, and may be
473
+ * `Keyword.none`. A supplied `alpha` renders after a slash
474
+ * (`/ calc(alpha * 0.5)`); omitted, the origin's alpha carries through. The
475
+ * origin's own references union into the result; the channel keywords
476
+ * contribute none, since the browser resolves them from the origin.
477
+ *
478
+ * @param origin - The color to derive from — any `Color`, commonly a `ref`.
479
+ * @param space - The destination `ColorSpace`, fixing the function form and the channels in scope.
480
+ * @param channel1 - The first channel (`l`/`r`), in the space's order.
481
+ * @param channel2 - The second channel (`c`/`g`).
482
+ * @param channel3 - The third channel (`h`/`b`).
483
+ * @param alpha - The optional alpha channel; omitted, the origin's alpha is kept.
484
+ * @returns A `Color` unioning the origin's and the channels' references.
485
+ * @example
486
+ * ```ts
487
+ * const hover = Color.from(Color.ref('accent'), ColorSpace.oklch, Calc.multiply(Channel.L, 0.8), Channel.C, Channel.H)
488
+ * Color.serialize(hover) // 'oklch(from var(--accent) calc(l * 0.8) c h)'
489
+ * const faded = Color.from(Color.ref('brand'), ColorSpace.srgb, Channel.R, Channel.G, Channel.B, Calc.multiply(Channel.Alpha, 0.5))
490
+ * Color.serialize(faded) // 'color(from var(--brand) srgb r g b / calc(alpha * 0.5))'
491
+ * ```
492
+ * @since 0.2.0
493
+ */
494
+ declare const from: <O extends string = never, Space extends ColorSpace = ColorSpace, C1 extends string = never, C2 extends string = never, C3 extends string = never, A extends string = never>(origin: Color<O>, space: Space, channel1: RelativeChannel<C1, ChannelsOf<Space>>, channel2: RelativeChannel<C2, ChannelsOf<Space>>, channel3: RelativeChannel<C3, ChannelsOf<Space>>, alpha?: RelativeChannel<A, ChannelsOf<Space>>) => Color<O | C1 | C2 | C3 | A>;
495
+ declare const bind: {
496
+ /**
497
+ * Returns a function that binds the given names in a color's channels.
498
+ *
499
+ * @param bindings - Reference names to values or expressions.
500
+ * @returns A function replacing bound references in its argument.
501
+ * @since 0.1.0
502
+ */
503
+ <const B extends Bindings>(bindings: B): <Refs extends string>(color: Color<Refs>) => Color<ApplyBindings<Refs, B>>;
504
+ /**
505
+ * Replaces references in the color's channels with values or other
506
+ * expressions, re-folding constant subtrees. Semantics match
507
+ * `Calc.bind`: unreferenced names and `undefined` values are ignored,
508
+ * and expression-valued bindings contribute their own references.
509
+ *
510
+ * @param color - The color to bind.
511
+ * @param bindings - Reference names to values or expressions.
512
+ * @returns The bound color.
513
+ * @since 0.1.0
514
+ */
515
+ <Refs extends string, const B extends Bindings>(color: Color<Refs>, bindings: B): Color<ApplyBindings<Refs, B>>;
516
+ };
517
+ /**
518
+ * Renders a color as CSS text. Channels render space-separated inside
519
+ * the color's own function form — `oklch(...)` or `color(srgb ...)` —
520
+ * each wrapped in `calc()` when it is arithmetic; a `lightDark` renders
521
+ * both arms in full, comma-separated.
522
+ *
523
+ * Options match `Calc.serialize`: partial bindings applied first, and a
524
+ * precision context for unannotated constants.
525
+ *
526
+ * @param color - The color to render.
527
+ * @param options - Optional bindings and precision context.
528
+ * @returns Deterministic CSS text.
529
+ * @example
530
+ * ```ts
531
+ * const surface = Color.oklch(Calc.add(Calc.ref('l'), 0.1), 0.04, 250)
532
+ * Color.serialize(surface) // 'oklch(calc(var(--l) + 0.1) 0.04 250)'
533
+ * ```
534
+ * @since 0.1.0
535
+ */
536
+ declare const serialize: <Refs extends string>(color: Color<Refs>, options?: SerializeOptions<Refs>) => string;
537
+ /**
538
+ * The color's unbound reference names, unioned across channels.
539
+ *
540
+ * @param color - The color to inspect.
541
+ * @returns The set of unbound reference names.
542
+ * @since 0.1.0
543
+ */
544
+ declare const refs: <Refs extends string>(color: Color<Refs>) => ReadonlySet<Refs>;
545
+ /**
546
+ * The origin-channel keyword tokens the color reads — the `Channel` keywords a
547
+ * relative color's channels reference (`l`, `c`, `h`, ...), gathered across its
548
+ * channels and any nested colors. Empty for a color with no relative parts.
549
+ *
550
+ * The `Color` companion to `Calc.channels`, and the mirror of `refs`: where
551
+ * `refs` reports the custom properties a color depends on, `channels` reports
552
+ * the origin channels a relative color reads. They are disjoint — a channel
553
+ * keyword is never a reference — so a channel token never appears in `refs` nor
554
+ * reaches a `Stylesheet`'s dependency report.
555
+ *
556
+ * @param color - The color to inspect.
557
+ * @returns The set of channel-keyword tokens the color reads.
558
+ * @example
559
+ * ```ts
560
+ * const hover = Color.from(Color.ref('accent'), ColorSpace.oklch, Calc.multiply(Channel.L, 0.8), Channel.C, Channel.H)
561
+ * Color.channels(hover) // Set { 'l', 'c', 'h' }
562
+ * Color.refs(hover) // Set { 'accent' }
563
+ * ```
564
+ * @since 0.2.0
565
+ */
566
+ declare const channels: (color: Color<string>) => ReadonlySet<string>;
567
+ declare const equals: {
568
+ /**
569
+ * Returns a function that checks structural equality against `that`.
570
+ *
571
+ * @param that - The color to compare against.
572
+ * @returns A function testing its argument for structural equality with `that`.
573
+ * @since 0.1.0
574
+ */
575
+ (that: Color<string>): (self: Color<string>) => boolean;
576
+ /**
577
+ * Structural equality over colors: channel trees compare node for node,
578
+ * as in `Calc.equals`. Different color functions never compare equal,
579
+ * even where they would name the same point in color space.
580
+ *
581
+ * @param self - The first color.
582
+ * @param that - The second color.
583
+ * @returns `true` if the colors are structurally equal.
584
+ * @since 0.1.0
585
+ */
586
+ (self: Color<string>, that: Color<string>): boolean;
587
+ };
588
+ //#endregion
589
+ export { colorSpace_d_exports as a, hueInterpolation_d_exports as i, color_d_exports as n, keywords_d_exports as r, Color as t };
590
+ //# sourceMappingURL=color-BvNJ2YqL.d.mts.map