@ansh-ui/core 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 (100) hide show
  1. package/LICENSE +21 -0
  2. package/dist/behaviours.cjs +64 -0
  3. package/dist/behaviours.cjs.map +1 -0
  4. package/dist/behaviours.d.cts +3 -0
  5. package/dist/behaviours.d.ts +3 -0
  6. package/dist/behaviours.js +7 -0
  7. package/dist/behaviours.js.map +1 -0
  8. package/dist/chunk-23GSSIMK.cjs +439 -0
  9. package/dist/chunk-23GSSIMK.cjs.map +1 -0
  10. package/dist/chunk-56NNBIAO.js +2446 -0
  11. package/dist/chunk-56NNBIAO.js.map +1 -0
  12. package/dist/chunk-6PFYGJWD.cjs +136 -0
  13. package/dist/chunk-6PFYGJWD.cjs.map +1 -0
  14. package/dist/chunk-7MEIXWPH.js +313 -0
  15. package/dist/chunk-7MEIXWPH.js.map +1 -0
  16. package/dist/chunk-7MYTSAPR.js +83 -0
  17. package/dist/chunk-7MYTSAPR.js.map +1 -0
  18. package/dist/chunk-BOQQHICI.js +1036 -0
  19. package/dist/chunk-BOQQHICI.js.map +1 -0
  20. package/dist/chunk-C6XPQO2O.js +1170 -0
  21. package/dist/chunk-C6XPQO2O.js.map +1 -0
  22. package/dist/chunk-DXJ63QAR.cjs +723 -0
  23. package/dist/chunk-DXJ63QAR.cjs.map +1 -0
  24. package/dist/chunk-FAVIEION.js +705 -0
  25. package/dist/chunk-FAVIEION.js.map +1 -0
  26. package/dist/chunk-FNR35HTL.cjs +107 -0
  27. package/dist/chunk-FNR35HTL.cjs.map +1 -0
  28. package/dist/chunk-GHBRGMSO.cjs +91 -0
  29. package/dist/chunk-GHBRGMSO.cjs.map +1 -0
  30. package/dist/chunk-GJRIHN76.cjs +359 -0
  31. package/dist/chunk-GJRIHN76.cjs.map +1 -0
  32. package/dist/chunk-ILKUL7GD.cjs +115 -0
  33. package/dist/chunk-ILKUL7GD.cjs.map +1 -0
  34. package/dist/chunk-KTUBCQC3.js +409 -0
  35. package/dist/chunk-KTUBCQC3.js.map +1 -0
  36. package/dist/chunk-KU2C6GEA.js +90 -0
  37. package/dist/chunk-KU2C6GEA.js.map +1 -0
  38. package/dist/chunk-LGA3N3YJ.cjs +413 -0
  39. package/dist/chunk-LGA3N3YJ.cjs.map +1 -0
  40. package/dist/chunk-MMO7KO53.cjs +1060 -0
  41. package/dist/chunk-MMO7KO53.cjs.map +1 -0
  42. package/dist/chunk-NSXKCJJ7.js +109 -0
  43. package/dist/chunk-NSXKCJJ7.js.map +1 -0
  44. package/dist/chunk-QALZKHWH.js +387 -0
  45. package/dist/chunk-QALZKHWH.js.map +1 -0
  46. package/dist/chunk-R7UJ7MWP.cjs +2479 -0
  47. package/dist/chunk-R7UJ7MWP.cjs.map +1 -0
  48. package/dist/chunk-UJBXY6QC.cjs +1186 -0
  49. package/dist/chunk-UJBXY6QC.cjs.map +1 -0
  50. package/dist/chunk-YFQXRC5R.js +99 -0
  51. package/dist/chunk-YFQXRC5R.js.map +1 -0
  52. package/dist/color.cjs +257 -0
  53. package/dist/color.cjs.map +1 -0
  54. package/dist/color.d.cts +303 -0
  55. package/dist/color.d.ts +303 -0
  56. package/dist/color.js +8 -0
  57. package/dist/color.js.map +1 -0
  58. package/dist/easing.cjs +189 -0
  59. package/dist/easing.cjs.map +1 -0
  60. package/dist/easing.d.cts +134 -0
  61. package/dist/easing.d.ts +134 -0
  62. package/dist/easing.js +4 -0
  63. package/dist/easing.js.map +1 -0
  64. package/dist/effects.cjs +99 -0
  65. package/dist/effects.cjs.map +1 -0
  66. package/dist/effects.d.cts +5 -0
  67. package/dist/effects.d.ts +5 -0
  68. package/dist/effects.js +10 -0
  69. package/dist/effects.js.map +1 -0
  70. package/dist/index-CCdpefMp.d.ts +967 -0
  71. package/dist/index-CQEEPu-D.d.ts +435 -0
  72. package/dist/index-DHOfsEIn.d.cts +967 -0
  73. package/dist/index-Dl8GCsya.d.cts +435 -0
  74. package/dist/index.cjs +2206 -0
  75. package/dist/index.cjs.map +1 -0
  76. package/dist/index.d.cts +1122 -0
  77. package/dist/index.d.ts +1122 -0
  78. package/dist/index.js +1182 -0
  79. package/dist/index.js.map +1 -0
  80. package/dist/math.cjs +238 -0
  81. package/dist/math.cjs.map +1 -0
  82. package/dist/math.d.cts +120 -0
  83. package/dist/math.d.ts +120 -0
  84. package/dist/math.js +5 -0
  85. package/dist/math.js.map +1 -0
  86. package/dist/noise.cjs +78 -0
  87. package/dist/noise.cjs.map +1 -0
  88. package/dist/noise.d.cts +190 -0
  89. package/dist/noise.d.ts +190 -0
  90. package/dist/noise.js +5 -0
  91. package/dist/noise.js.map +1 -0
  92. package/dist/palette-6HkVltYU.d.cts +219 -0
  93. package/dist/palette-6HkVltYU.d.ts +219 -0
  94. package/dist/random--4mSc5Lp.d.cts +75 -0
  95. package/dist/random--4mSc5Lp.d.ts +75 -0
  96. package/dist/reduced-motion-D0LUgZle.d.cts +120 -0
  97. package/dist/reduced-motion-D0LUgZle.d.ts +120 -0
  98. package/dist/types-B1FLLf3-.d.cts +21 -0
  99. package/dist/types-B1FLLf3-.d.ts +21 -0
  100. package/package.json +78 -0
@@ -0,0 +1,303 @@
1
+ import { c as Hsl, R as Rgb, d as Hsv, L as LinearRgb, O as Oklab, f as Oklch, a as ColorInput, C as ColorSpace, e as HueDirection } from './palette-6HkVltYU.js';
2
+ export { b as ColorScale, H as HarmonyKind, P as PaletteName, g as PaletteOptions, S as ScaleOptions, h as createScale, i as expandPalette, j as generatePalette, k as harmony, l as invertForSurface, p as palettes, r as resolvePalette, s as sortByLightness } from './palette-6HkVltYU.js';
3
+ import { E as EasingInput } from './types-B1FLLf3-.js';
4
+
5
+ /**
6
+ * Colour space conversions.
7
+ *
8
+ * Matrices for OKLab are Björn Ottosson's published values. They are reproduced to full
9
+ * precision deliberately — truncating them introduces a visible hue shift in saturated blues.
10
+ */
11
+ /** Remove the sRGB gamma curve from a single channel. */
12
+ declare function srgbToLinearChannel(c: number): number;
13
+ /** Apply the sRGB gamma curve to a single channel. */
14
+ declare function linearToSrgbChannel(c: number): number;
15
+ declare function rgbToLinear(rgb: Rgb): LinearRgb;
16
+ declare function linearToRgb(lin: LinearRgb): Rgb;
17
+ declare function linearToOklab(lin: LinearRgb): Oklab;
18
+ declare function oklabToLinear(lab: Oklab): LinearRgb;
19
+ declare function rgbToOklab(rgb: Rgb): Oklab;
20
+ /**
21
+ * OKLab → sRGB.
22
+ *
23
+ * The result may fall outside the sRGB gamut, in which case channels are simply clipped.
24
+ * Use {@link import('./gamut').gamutMapOklch} when you need a perceptually sensible
25
+ * in-gamut colour rather than a clipped one.
26
+ */
27
+ declare function oklabToRgb(lab: Oklab): Rgb;
28
+ declare function oklabToOklch(lab: Oklab): Oklch;
29
+ declare function oklchToOklab(lch: Oklch): Oklab;
30
+ declare function rgbToOklch(rgb: Rgb): Oklch;
31
+ declare function oklchToRgb(lch: Oklch): Rgb;
32
+ declare function rgbToHsl(rgb: Rgb): Hsl;
33
+ declare function hslToRgb(hsl: Hsl): Rgb;
34
+ declare function rgbToHsv(rgb: Rgb): Hsv;
35
+ declare function hsvToRgb(hsv: Hsv): Rgb;
36
+ /**
37
+ * Relative luminance per WCAG 2.x — the Y component of CIEXYZ from linear sRGB.
38
+ * This is the quantity contrast ratios are built from.
39
+ */
40
+ declare function relativeLuminance(rgb: Rgb): number;
41
+
42
+ declare class ColorParseError extends Error {
43
+ readonly input: string;
44
+ constructor(input: string);
45
+ }
46
+ /**
47
+ * Parse any accepted colour into {@link Rgb}.
48
+ *
49
+ * @throws {ColorParseError} on unparseable input. Ansh throws here rather than falling back
50
+ * to black: a silently-black gradient is far harder to debug than a thrown error pointing at
51
+ * the offending string, and colour props are validated at mount, not inside a frame loop.
52
+ */
53
+ declare function parseColor(input: ColorInput): Rgb;
54
+ /** Like {@link parseColor} but returns `null` instead of throwing. */
55
+ declare function tryParseColor(input: ColorInput): Rgb | null;
56
+ /**
57
+ * Resolve a colour the parser can't handle itself by asking the browser.
58
+ *
59
+ * Covers `var(--token)`, `currentcolor`, `color-mix()`, `lab()` and anything else CSS gains
60
+ * in future. We set the value on a detached element and read back the computed style — the
61
+ * browser normalises it to `rgb()`/`rgba()`, which we can then parse.
62
+ *
63
+ * Returns `null` during SSR, where there is no document to consult. Callers should keep the
64
+ * original string in that case and let CSS resolve it at paint time; only effects that need
65
+ * numeric colour access (canvas gradients) require a resolved value, and those run client-side.
66
+ */
67
+ declare function resolveComputed(value: string): Rgb | null;
68
+ /**
69
+ * Resolve a CSS custom property against a specific element's cascade.
70
+ *
71
+ * Needed because `var(--surface)` means different things inside a `.dark` subtree. Effects
72
+ * pass their own host element so themed colours resolve correctly.
73
+ */
74
+ declare function resolveCssVariable(name: string, element?: Element | null): Rgb | null;
75
+ /** Clear the parse cache. Exposed for tests and for theme switches that change `var()` output. */
76
+ declare function clearColorCache(): void;
77
+
78
+ /** `#rrggbb`, or `#rrggbbaa` when not fully opaque (or when `forceAlpha` is set). */
79
+ declare function toHex(color: Rgb, forceAlpha?: boolean): string;
80
+ /**
81
+ * `rgb(r g b)` / `rgb(r g b / a)`.
82
+ *
83
+ * Uses the legacy comma form because it is what every canvas implementation and every
84
+ * browser back to 2015 accepts; the space-separated form is newer than our support target.
85
+ */
86
+ declare function toRgbString(color: Rgb): string;
87
+ declare function toHslString(color: Rgb): string;
88
+ /** `oklch(l% c h)` — the modern authoring form, and what the theme generator emits. */
89
+ declare function toOklchString(color: Rgb): string;
90
+ /**
91
+ * Pack into a 32-bit integer as `0xAABBGGRR`.
92
+ *
93
+ * This is the byte order a `Uint32Array` view over `ImageData` expects on little-endian
94
+ * machines, which is every platform we target. Effects that write pixels directly — the noise
95
+ * layer, the grain overlay — use this to fill a row with one store per pixel instead of four.
96
+ */
97
+ declare function toUint32(color: Rgb): number;
98
+ declare function fromUint32(packed: number): Rgb;
99
+ /** Replace a colour's alpha, leaving its hue and lightness untouched. */
100
+ declare function withAlpha(color: Rgb, alpha: number): Rgb;
101
+ /** Scale a colour's existing alpha — useful for fading a whole palette at once. */
102
+ declare function fadeBy(color: Rgb, factor: number): Rgb;
103
+
104
+ /** Is this OKLCH colour displayable in sRGB? */
105
+ declare function inSrgbGamut(lch: Oklch): boolean;
106
+ /**
107
+ * Reduce chroma until the colour fits in sRGB, preserving lightness and hue.
108
+ *
109
+ * Returns the input unchanged when it is already in gamut, so this is safe to call
110
+ * unconditionally.
111
+ */
112
+ declare function gamutMapOklch(lch: Oklch): Oklch;
113
+ /**
114
+ * The maximum chroma sRGB can display at a given lightness and hue.
115
+ *
116
+ * This is what makes "vivid" palette generation possible: rather than picking an arbitrary
117
+ * chroma and hoping, you can ask for the most saturated colour available at each hue and get
118
+ * a palette with consistent, maximal punch.
119
+ */
120
+ declare function maxChroma(l: number, h: number): number;
121
+ /** Gamut-map, then convert to sRGB. The safe path from OKLCH to a displayable colour. */
122
+ declare function oklchToRgbMapped(lch: Oklch): Rgb;
123
+ /**
124
+ * How far outside sRGB a colour sits, as a rough distance in chroma units.
125
+ * `0` means in gamut. Used by the docs site to warn about unrenderable theme colours.
126
+ */
127
+ declare function gamutError(lch: Oklch): number;
128
+ /** Does this sRGB colour survive a round trip through OKLCH unchanged? Diagnostic helper. */
129
+ declare function isGamutStable(rgb: Rgb): boolean;
130
+
131
+ /**
132
+ * Colour interpolation and gradient construction.
133
+ *
134
+ * The default space is OKLab, and that default is load-bearing — but it is worth being precise
135
+ * about *when* it matters, because the difference is not uniform.
136
+ *
137
+ * **Where sRGB fails badly: opposing hues.** Interpolating `#0000ff → #ffff00` in sRGB passes
138
+ * through exactly `#808080` — a dead grey — because the channels cancel. In OKLab the same
139
+ * transition keeps measurable chroma the whole way across. Any gradient spanning more than about a
140
+ * quadrant of the hue circle hits some version of this.
141
+ *
142
+ * **Where sRGB merely differs: neighbouring hues.** For `#0275f4 → #9f0550` (blue to crimson,
143
+ * ~104° apart) sRGB actually produces a *more* saturated midpoint, because it cuts the chord
144
+ * straight through the colour solid. What it does not preserve is perceived *lightness* — the sRGB
145
+ * path dips darker in the middle, so the transition reads as uneven even though it is vivid. OKLab
146
+ * holds lightness steady, which is what makes a gradient feel smooth rather than lumpy.
147
+ *
148
+ * Use `oklch` when you want maximum vividness across distant hues; it travels the hue circle rather
149
+ * than cutting across it, keeping chroma high throughout.
150
+ */
151
+ interface MixOptions {
152
+ /** Space to interpolate through. Default `'oklab'`. */
153
+ space?: ColorSpace;
154
+ /** Which way around the hue circle, for cylindrical spaces. Default `'shorter'`. */
155
+ hue?: HueDirection;
156
+ /**
157
+ * Gamut-map the result rather than clipping it.
158
+ *
159
+ * Slightly more expensive (a short binary search) but preserves hue and lightness for
160
+ * out-of-gamut intermediates. Default `true` for `oklch`, `false` otherwise — `oklch`
161
+ * interpolation is the one that routinely leaves the gamut.
162
+ */
163
+ gamutMap?: boolean;
164
+ }
165
+ /**
166
+ * Interpolate between two colours.
167
+ *
168
+ * `t` is clamped to `[0, 1]`. Alpha is always interpolated linearly, independent of space —
169
+ * premultiplying would darken transitions to transparent, which is almost never wanted for
170
+ * UI gradients.
171
+ */
172
+ declare function mixColors(from: ColorInput, to: ColorInput, t: number, options?: MixOptions): Rgb;
173
+ /** The allocation-light path used by gradients, which have already parsed their stops. */
174
+ declare function mixParsed(a: Rgb, b: Rgb, t: number, options?: MixOptions): Rgb;
175
+ /** Interpolate two hue angles, honouring the requested direction of travel. */
176
+ declare function lerpHue(from: number, to: number, t: number, direction: HueDirection): number;
177
+ interface GradientStop {
178
+ /** Position in `[0, 1]`. */
179
+ offset: number;
180
+ color: ColorInput;
181
+ }
182
+ interface GradientOptions extends MixOptions {
183
+ /**
184
+ * Easing applied to the position *within each segment*, not across the whole gradient.
185
+ *
186
+ * This is how you get a gradient that lingers near one colour: `easeInQuad` compresses
187
+ * the transition toward the end of each segment. Default linear.
188
+ */
189
+ easing?: EasingInput;
190
+ }
191
+ interface Gradient {
192
+ /** Colour at position `t` in `[0, 1]`. */
193
+ at(t: number): Rgb;
194
+ /** Colour at position `t`, formatted for `fillStyle`. */
195
+ cssAt(t: number): string;
196
+ /** Evenly sample the gradient into `count` colours. */
197
+ sample(count: number): Rgb[];
198
+ /** A `linear-gradient(...)` string with `count` stops, for CSS backgrounds. */
199
+ toCss(direction?: string, count?: number): string;
200
+ readonly stops: readonly GradientStop[];
201
+ }
202
+ /**
203
+ * Build a multi-stop gradient.
204
+ *
205
+ * Accepts either a flat list of colours (distributed evenly) or explicit stops. Any number of
206
+ * colours is supported — there is no cap, and no assumption of two.
207
+ */
208
+ declare function createGradient(input: readonly ColorInput[] | readonly GradientStop[], options?: GradientOptions): Gradient;
209
+ /**
210
+ * Apply the gradient's stops to a native canvas gradient object.
211
+ *
212
+ * We can't hand the canvas our stops directly — it would interpolate them in sRGB and undo
213
+ * the whole point. Instead we sample our own interpolation into `resolution` intermediate
214
+ * stops, so the browser only ever interpolates over tiny intervals where the space barely
215
+ * matters. 24 stops is visually indistinguishable from continuous.
216
+ */
217
+ declare function applyGradientStops(target: CanvasGradient, gradient: Gradient, resolution?: number): CanvasGradient;
218
+ /**
219
+ * Blend a colour toward another by a fixed amount, in a chosen space.
220
+ * Shorthand for the common "10% lighter" adjustment.
221
+ */
222
+ declare function blend(base: ColorInput, over: ColorInput, amount?: number, space?: ColorSpace): Rgb;
223
+ /**
224
+ * Composite `over` onto `base` using its alpha — the "source-over" Porter-Duff operator,
225
+ * evaluated in linear light so it matches what the GPU does.
226
+ */
227
+ declare function composite(base: ColorInput, over: ColorInput): Rgb;
228
+
229
+ /**
230
+ * Contrast and legibility.
231
+ *
232
+ * Animated backgrounds are the single most common way a design ends up failing WCAG: the text
233
+ * was legible against the mockup's midpoint and illegible against the animation's brightest
234
+ * frame. These helpers let components check contrast against the *extremes* of their own
235
+ * palette and adapt, rather than hoping.
236
+ */
237
+ type WcagLevel = 'AA' | 'AAA';
238
+ type TextSize = 'normal' | 'large';
239
+ /**
240
+ * WCAG 2.x contrast ratio, from 1 (identical) to 21 (black on white).
241
+ *
242
+ * Semi-transparent colours are composited over `background` first, because a ratio computed
243
+ * from a colour's own alpha is meaningless — what matters is what the eye actually receives.
244
+ */
245
+ declare function contrastRatio(foreground: ColorInput, background: ColorInput): number;
246
+ /** Minimum ratio required by WCAG 2.2 for the given level and text size. */
247
+ declare function requiredRatio(level: WcagLevel, size: TextSize): number;
248
+ interface ContrastResult {
249
+ ratio: number;
250
+ passes: boolean;
251
+ required: number;
252
+ level: WcagLevel;
253
+ size: TextSize;
254
+ }
255
+ /** Check a foreground/background pair against a WCAG threshold. */
256
+ declare function checkContrast(foreground: ColorInput, background: ColorInput, level?: WcagLevel, size?: TextSize): ContrastResult;
257
+ /**
258
+ * Pick whichever of `light`/`dark` reads better on `background`.
259
+ *
260
+ * This is the function to reach for when a component renders text over a user-supplied
261
+ * colour, which is most of them.
262
+ */
263
+ declare function pickReadable(background: ColorInput, light?: ColorInput, dark?: ColorInput): Rgb;
264
+ /**
265
+ * Adjust a colour's lightness until it meets a contrast target against `background`.
266
+ *
267
+ * Works in OKLCH so hue and chroma survive the adjustment — the brand colour stays
268
+ * recognisably itself, it just gets light or dark enough to read. Searches in whichever
269
+ * direction has more headroom, and returns the best achievable colour if the target is
270
+ * unreachable (a mid-grey background cannot support 7:1 with a saturated hue at any lightness).
271
+ */
272
+ declare function ensureContrast(foreground: ColorInput, background: ColorInput, target?: number): {
273
+ color: Rgb;
274
+ ratio: number;
275
+ achieved: boolean;
276
+ };
277
+ /**
278
+ * Worst-case contrast of a foreground against every colour in a set.
279
+ *
280
+ * An animated gradient background cycles through many colours; text must be legible against
281
+ * all of them. Components call this with their resolved palette and surface a dev warning when
282
+ * it fails, which turns an invisible accessibility bug into a console message during development.
283
+ */
284
+ declare function worstContrast(foreground: ColorInput, backgrounds: readonly ColorInput[]): {
285
+ ratio: number;
286
+ against: Rgb | null;
287
+ };
288
+ /**
289
+ * APCA-style perceptual lightness, used for ordering colours by visual weight.
290
+ *
291
+ * Not a WCAG 3 implementation — that specification is still in flux and we won't ship a
292
+ * moving target as if it were stable. This is OKLab's `L`, which is a better predictor of
293
+ * perceived lightness than WCAG's relative luminance and is entirely sufficient for the
294
+ * internal job of sorting a palette light-to-dark.
295
+ */
296
+ declare function perceivedLightness(color: ColorInput): number;
297
+
298
+ /** Resolve a CSS colour keyword to its hex value, or `undefined` if it isn't one. */
299
+ declare function namedColorToHex(name: string): string | undefined;
300
+ /** Every recognised colour keyword. Powers autocomplete in the docs playground. */
301
+ declare function listNamedColors(): string[];
302
+
303
+ export { ColorInput, ColorParseError, ColorSpace, type ContrastResult, type Gradient, type GradientOptions, type GradientStop, Hsl, Hsv, HueDirection, LinearRgb, type MixOptions, Oklab, Oklch, Rgb, type TextSize, type WcagLevel, applyGradientStops, blend, checkContrast, clearColorCache, composite, contrastRatio, createGradient, ensureContrast, fadeBy, fromUint32, gamutError, gamutMapOklch, hslToRgb, hsvToRgb, inSrgbGamut, isGamutStable, lerpHue, linearToOklab, linearToRgb, linearToSrgbChannel, listNamedColors, maxChroma, mixColors, mixParsed, namedColorToHex, oklabToLinear, oklabToOklch, oklabToRgb, oklchToOklab, oklchToRgb, oklchToRgbMapped, parseColor, perceivedLightness, pickReadable, relativeLuminance, requiredRatio, resolveComputed, resolveCssVariable, rgbToHsl, rgbToHsv, rgbToLinear, rgbToOklab, rgbToOklch, srgbToLinearChannel, toHex, toHslString, toOklchString, toRgbString, toUint32, tryParseColor, withAlpha, worstContrast };
package/dist/color.js ADDED
@@ -0,0 +1,8 @@
1
+ export { checkContrast, contrastRatio, ensureContrast, perceivedLightness, pickReadable, requiredRatio, worstContrast } from './chunk-7MYTSAPR.js';
2
+ export { applyGradientStops, blend, composite, createGradient, createScale, expandPalette, fadeBy, fromUint32, gamutError, gamutMapOklch, generatePalette, harmony, inSrgbGamut, invertForSurface, isGamutStable, lerpHue, maxChroma, mixColors, mixParsed, oklchToRgbMapped, palettes, resolvePalette, sortByLightness, toHex, toHslString, toOklchString, toRgbString, toUint32, withAlpha } from './chunk-KTUBCQC3.js';
3
+ import './chunk-YFQXRC5R.js';
4
+ export { ColorParseError, clearColorCache, hslToRgb, hsvToRgb, linearToOklab, linearToRgb, linearToSrgbChannel, listNamedColors, namedColorToHex, oklabToLinear, oklabToOklch, oklabToRgb, oklchToOklab, oklchToRgb, parseColor, relativeLuminance, resolveComputed, resolveCssVariable, rgbToHsl, rgbToHsv, rgbToLinear, rgbToOklab, rgbToOklch, srgbToLinearChannel, tryParseColor } from './chunk-QALZKHWH.js';
5
+ import './chunk-7MEIXWPH.js';
6
+ import './chunk-KU2C6GEA.js';
7
+ //# sourceMappingURL=color.js.map
8
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"color.js"}
@@ -0,0 +1,189 @@
1
+ 'use strict';
2
+
3
+ var chunkGJRIHN76_cjs = require('./chunk-GJRIHN76.cjs');
4
+ require('./chunk-ILKUL7GD.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "anticipate", {
9
+ enumerable: true,
10
+ get: function () { return chunkGJRIHN76_cjs.anticipate; }
11
+ });
12
+ Object.defineProperty(exports, "cubicBezier", {
13
+ enumerable: true,
14
+ get: function () { return chunkGJRIHN76_cjs.cubicBezier; }
15
+ });
16
+ Object.defineProperty(exports, "easeInBack", {
17
+ enumerable: true,
18
+ get: function () { return chunkGJRIHN76_cjs.easeInBack; }
19
+ });
20
+ Object.defineProperty(exports, "easeInBounce", {
21
+ enumerable: true,
22
+ get: function () { return chunkGJRIHN76_cjs.easeInBounce; }
23
+ });
24
+ Object.defineProperty(exports, "easeInCirc", {
25
+ enumerable: true,
26
+ get: function () { return chunkGJRIHN76_cjs.easeInCirc; }
27
+ });
28
+ Object.defineProperty(exports, "easeInCubic", {
29
+ enumerable: true,
30
+ get: function () { return chunkGJRIHN76_cjs.easeInCubic; }
31
+ });
32
+ Object.defineProperty(exports, "easeInElastic", {
33
+ enumerable: true,
34
+ get: function () { return chunkGJRIHN76_cjs.easeInElastic; }
35
+ });
36
+ Object.defineProperty(exports, "easeInExpo", {
37
+ enumerable: true,
38
+ get: function () { return chunkGJRIHN76_cjs.easeInExpo; }
39
+ });
40
+ Object.defineProperty(exports, "easeInOutBack", {
41
+ enumerable: true,
42
+ get: function () { return chunkGJRIHN76_cjs.easeInOutBack; }
43
+ });
44
+ Object.defineProperty(exports, "easeInOutBounce", {
45
+ enumerable: true,
46
+ get: function () { return chunkGJRIHN76_cjs.easeInOutBounce; }
47
+ });
48
+ Object.defineProperty(exports, "easeInOutCirc", {
49
+ enumerable: true,
50
+ get: function () { return chunkGJRIHN76_cjs.easeInOutCirc; }
51
+ });
52
+ Object.defineProperty(exports, "easeInOutCubic", {
53
+ enumerable: true,
54
+ get: function () { return chunkGJRIHN76_cjs.easeInOutCubic; }
55
+ });
56
+ Object.defineProperty(exports, "easeInOutElastic", {
57
+ enumerable: true,
58
+ get: function () { return chunkGJRIHN76_cjs.easeInOutElastic; }
59
+ });
60
+ Object.defineProperty(exports, "easeInOutExpo", {
61
+ enumerable: true,
62
+ get: function () { return chunkGJRIHN76_cjs.easeInOutExpo; }
63
+ });
64
+ Object.defineProperty(exports, "easeInOutQuad", {
65
+ enumerable: true,
66
+ get: function () { return chunkGJRIHN76_cjs.easeInOutQuad; }
67
+ });
68
+ Object.defineProperty(exports, "easeInOutQuart", {
69
+ enumerable: true,
70
+ get: function () { return chunkGJRIHN76_cjs.easeInOutQuart; }
71
+ });
72
+ Object.defineProperty(exports, "easeInOutQuint", {
73
+ enumerable: true,
74
+ get: function () { return chunkGJRIHN76_cjs.easeInOutQuint; }
75
+ });
76
+ Object.defineProperty(exports, "easeInOutSine", {
77
+ enumerable: true,
78
+ get: function () { return chunkGJRIHN76_cjs.easeInOutSine; }
79
+ });
80
+ Object.defineProperty(exports, "easeInQuad", {
81
+ enumerable: true,
82
+ get: function () { return chunkGJRIHN76_cjs.easeInQuad; }
83
+ });
84
+ Object.defineProperty(exports, "easeInQuart", {
85
+ enumerable: true,
86
+ get: function () { return chunkGJRIHN76_cjs.easeInQuart; }
87
+ });
88
+ Object.defineProperty(exports, "easeInQuint", {
89
+ enumerable: true,
90
+ get: function () { return chunkGJRIHN76_cjs.easeInQuint; }
91
+ });
92
+ Object.defineProperty(exports, "easeInSine", {
93
+ enumerable: true,
94
+ get: function () { return chunkGJRIHN76_cjs.easeInSine; }
95
+ });
96
+ Object.defineProperty(exports, "easeOutBack", {
97
+ enumerable: true,
98
+ get: function () { return chunkGJRIHN76_cjs.easeOutBack; }
99
+ });
100
+ Object.defineProperty(exports, "easeOutBounce", {
101
+ enumerable: true,
102
+ get: function () { return chunkGJRIHN76_cjs.easeOutBounce; }
103
+ });
104
+ Object.defineProperty(exports, "easeOutCirc", {
105
+ enumerable: true,
106
+ get: function () { return chunkGJRIHN76_cjs.easeOutCirc; }
107
+ });
108
+ Object.defineProperty(exports, "easeOutCubic", {
109
+ enumerable: true,
110
+ get: function () { return chunkGJRIHN76_cjs.easeOutCubic; }
111
+ });
112
+ Object.defineProperty(exports, "easeOutElastic", {
113
+ enumerable: true,
114
+ get: function () { return chunkGJRIHN76_cjs.easeOutElastic; }
115
+ });
116
+ Object.defineProperty(exports, "easeOutExpo", {
117
+ enumerable: true,
118
+ get: function () { return chunkGJRIHN76_cjs.easeOutExpo; }
119
+ });
120
+ Object.defineProperty(exports, "easeOutQuad", {
121
+ enumerable: true,
122
+ get: function () { return chunkGJRIHN76_cjs.easeOutQuad; }
123
+ });
124
+ Object.defineProperty(exports, "easeOutQuart", {
125
+ enumerable: true,
126
+ get: function () { return chunkGJRIHN76_cjs.easeOutQuart; }
127
+ });
128
+ Object.defineProperty(exports, "easeOutQuint", {
129
+ enumerable: true,
130
+ get: function () { return chunkGJRIHN76_cjs.easeOutQuint; }
131
+ });
132
+ Object.defineProperty(exports, "easeOutSine", {
133
+ enumerable: true,
134
+ get: function () { return chunkGJRIHN76_cjs.easeOutSine; }
135
+ });
136
+ Object.defineProperty(exports, "easings", {
137
+ enumerable: true,
138
+ get: function () { return chunkGJRIHN76_cjs.easings; }
139
+ });
140
+ Object.defineProperty(exports, "linear", {
141
+ enumerable: true,
142
+ get: function () { return chunkGJRIHN76_cjs.linear; }
143
+ });
144
+ Object.defineProperty(exports, "listEasings", {
145
+ enumerable: true,
146
+ get: function () { return chunkGJRIHN76_cjs.listEasings; }
147
+ });
148
+ Object.defineProperty(exports, "mirrorEasing", {
149
+ enumerable: true,
150
+ get: function () { return chunkGJRIHN76_cjs.mirrorEasing; }
151
+ });
152
+ Object.defineProperty(exports, "power", {
153
+ enumerable: true,
154
+ get: function () { return chunkGJRIHN76_cjs.power; }
155
+ });
156
+ Object.defineProperty(exports, "readEasingTable", {
157
+ enumerable: true,
158
+ get: function () { return chunkGJRIHN76_cjs.readEasingTable; }
159
+ });
160
+ Object.defineProperty(exports, "registerEasing", {
161
+ enumerable: true,
162
+ get: function () { return chunkGJRIHN76_cjs.registerEasing; }
163
+ });
164
+ Object.defineProperty(exports, "resolveEasing", {
165
+ enumerable: true,
166
+ get: function () { return chunkGJRIHN76_cjs.resolveEasing; }
167
+ });
168
+ Object.defineProperty(exports, "reverseEasing", {
169
+ enumerable: true,
170
+ get: function () { return chunkGJRIHN76_cjs.reverseEasing; }
171
+ });
172
+ Object.defineProperty(exports, "sampleEasing", {
173
+ enumerable: true,
174
+ get: function () { return chunkGJRIHN76_cjs.sampleEasing; }
175
+ });
176
+ Object.defineProperty(exports, "signature", {
177
+ enumerable: true,
178
+ get: function () { return chunkGJRIHN76_cjs.signature; }
179
+ });
180
+ Object.defineProperty(exports, "steps", {
181
+ enumerable: true,
182
+ get: function () { return chunkGJRIHN76_cjs.steps; }
183
+ });
184
+ Object.defineProperty(exports, "unregisterEasing", {
185
+ enumerable: true,
186
+ get: function () { return chunkGJRIHN76_cjs.unregisterEasing; }
187
+ });
188
+ //# sourceMappingURL=easing.cjs.map
189
+ //# sourceMappingURL=easing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"easing.cjs"}
@@ -0,0 +1,134 @@
1
+ import { a as EasingFn, E as EasingInput } from './types-B1FLLf3-.cjs';
2
+ export { b as EasingName } from './types-B1FLLf3-.cjs';
3
+
4
+ /**
5
+ * Build an easing function from four cubic-bézier control coordinates.
6
+ *
7
+ * @param x1 First control point's x, clamped to `[0,1]` (as CSS requires — an x outside
8
+ * that range makes the curve non-monotonic in time and thus not a valid timing
9
+ * function). y values are unconstrained, which is what allows overshoot curves
10
+ * like `easeOutBack`.
11
+ */
12
+ declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): EasingFn;
13
+ /**
14
+ * A stepped (staircase) timing function, matching CSS `steps()`.
15
+ *
16
+ * @param count Number of discrete steps. Must be >= 1.
17
+ * @param position Where the jump happens within each step, matching the CSS keywords.
18
+ */
19
+ declare function steps(count: number, position?: 'start' | 'end' | 'both' | 'none'): EasingFn;
20
+
21
+ /**
22
+ * The built-in easing library.
23
+ *
24
+ * Curves follow the Penner definitions, which is what CSS, GSAP and Framer Motion all
25
+ * converged on — so `easeOutCubic` here is numerically identical to `easeOutCubic` there.
26
+ * Every function is exact at both endpoints.
27
+ */
28
+ /** Turn an "in" curve into its mirrored "out" counterpart. */
29
+ declare function reverseEasing(easeIn: EasingFn): EasingFn;
30
+ /** Compose an "in" curve into a symmetric "in-out" curve. */
31
+ declare function mirrorEasing(easeIn: EasingFn): EasingFn;
32
+ /** Raise progress to a power — the family behind quad/cubic/quart/quint. */
33
+ declare function power(exponent: number): EasingFn;
34
+ declare const easeInSine: EasingFn;
35
+ declare const easeOutSine: EasingFn;
36
+ declare const easeInOutSine: EasingFn;
37
+ declare const easeInQuad: EasingFn;
38
+ declare const easeOutQuad: EasingFn;
39
+ declare const easeInOutQuad: EasingFn;
40
+ declare const easeInCubic: EasingFn;
41
+ declare const easeOutCubic: EasingFn;
42
+ declare const easeInOutCubic: EasingFn;
43
+ declare const easeInQuart: EasingFn;
44
+ declare const easeOutQuart: EasingFn;
45
+ declare const easeInOutQuart: EasingFn;
46
+ declare const easeInQuint: EasingFn;
47
+ declare const easeOutQuint: EasingFn;
48
+ declare const easeInOutQuint: EasingFn;
49
+ declare const easeInExpo: EasingFn;
50
+ declare const easeOutExpo: EasingFn;
51
+ declare const easeInOutExpo: EasingFn;
52
+ declare const easeInCirc: EasingFn;
53
+ declare const easeOutCirc: EasingFn;
54
+ declare const easeInOutCirc: EasingFn;
55
+ declare const easeInBack: EasingFn;
56
+ declare const easeOutBack: EasingFn;
57
+ declare const easeInOutBack: EasingFn;
58
+ /**
59
+ * A brief pull-back before moving forward. Reads as "gathering intent".
60
+ *
61
+ * The second half is an exponential decay, which approaches 1 asymptotically and never reaches it —
62
+ * at `t = 1` the raw expression gives `1 - 2⁻¹¹`. The explicit endpoint keeps the curve exact, which
63
+ * the animation driver relies on to land values on their targets rather than a fraction short.
64
+ */
65
+ declare const anticipate: EasingFn;
66
+ declare const easeInElastic: EasingFn;
67
+ declare const easeOutElastic: EasingFn;
68
+ declare const easeInOutElastic: EasingFn;
69
+ declare const easeOutBounce: EasingFn;
70
+ declare const easeInBounce: EasingFn;
71
+ declare const easeInOutBounce: EasingFn;
72
+ declare const linear: EasingFn;
73
+ /**
74
+ * Named curve lookup.
75
+ *
76
+ * Kept as a mutable record so `registerEasing()` can extend it. Consumers should go through
77
+ * `resolveEasing()` rather than reading this directly.
78
+ */
79
+ declare const easings: Record<string, EasingFn>;
80
+ /**
81
+ * Signature curves used by the design system's motion hierarchy.
82
+ *
83
+ * These are the ones you should reach for by default. They are named for intent rather than
84
+ * for maths, because "what is this motion communicating" is the useful question at a call site.
85
+ */
86
+ declare const signature: {
87
+ /** Entrances. Fast out of the gate, long gentle settle. The Ansh house curve. */
88
+ emphasized: EasingFn;
89
+ /** UI state changes that should feel instant but not abrupt. */
90
+ standard: EasingFn;
91
+ /** Exits. Accelerates away — the element is leaving, don't linger on it. */
92
+ exit: EasingFn;
93
+ /** Entrances from off-screen. Decelerates in. */
94
+ enter: EasingFn;
95
+ /** A confident, slightly springy overshoot without full elastic wobble. */
96
+ overshoot: EasingFn;
97
+ /** Long, cinematic reveals — hero sections, scroll-driven scenes. */
98
+ cinematic: EasingFn;
99
+ };
100
+ /**
101
+ * Register a custom named curve, making it resolvable everywhere an easing is accepted.
102
+ *
103
+ * @throws if the name collides with a built-in, to prevent one plugin silently changing
104
+ * the meaning of `easeOutCubic` for the whole application.
105
+ */
106
+ declare function registerEasing(name: string, fn: EasingFn): void;
107
+ /** Remove a previously registered custom curve. Built-ins cannot be removed. */
108
+ declare function unregisterEasing(name: string): void;
109
+ /** Every currently resolvable easing name, built-in and custom. */
110
+ declare function listEasings(): string[];
111
+
112
+ /**
113
+ * Sample a curve into a lookup table.
114
+ *
115
+ * Useful for expensive curves evaluated per-particle per-frame, and for rendering easing
116
+ * previews in the docs site.
117
+ */
118
+ declare function sampleEasing(easing: EasingFn, resolution?: number): Float32Array;
119
+ /** Read a table produced by {@link sampleEasing}, interpolating between samples. */
120
+ declare function readEasingTable(table: Float32Array, t: number): number;
121
+
122
+ /**
123
+ * Normalise any accepted easing shape into a callable function.
124
+ *
125
+ * This is the single entry point every part of the engine uses, so authors can pass a name,
126
+ * a function, or bézier coordinates interchangeably and it always works the same way.
127
+ *
128
+ * An unknown *name* is a developer mistake worth surfacing loudly — silently falling back to
129
+ * linear would produce motion that looks subtly wrong with no explanation. We warn and fall
130
+ * back rather than throw, because a bad easing name should never take down a page in production.
131
+ */
132
+ declare function resolveEasing(input: EasingInput | undefined | null): EasingFn;
133
+
134
+ export { EasingFn, EasingInput, anticipate, cubicBezier, easeInBack, easeInBounce, easeInCirc, easeInCubic, easeInElastic, easeInExpo, easeInOutBack, easeInOutBounce, easeInOutCirc, easeInOutCubic, easeInOutElastic, easeInOutExpo, easeInOutQuad, easeInOutQuart, easeInOutQuint, easeInOutSine, easeInQuad, easeInQuart, easeInQuint, easeInSine, easeOutBack, easeOutBounce, easeOutCirc, easeOutCubic, easeOutElastic, easeOutExpo, easeOutQuad, easeOutQuart, easeOutQuint, easeOutSine, easings, linear, listEasings, mirrorEasing, power, readEasingTable, registerEasing, resolveEasing, reverseEasing, sampleEasing, signature, steps, unregisterEasing };