@gradient-ui/gradient-engine 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +208 -0
  2. package/dist/animation.cjs +60 -0
  3. package/dist/animation.mjs +89 -0
  4. package/dist/core.cjs +1 -0
  5. package/dist/core.mjs +16 -0
  6. package/dist/css-CaOuUhfh.js +17 -0
  7. package/dist/css-YuAJQW13.cjs +1 -0
  8. package/dist/effects.cjs +96 -0
  9. package/dist/effects.mjs +321 -0
  10. package/dist/formatters.cjs +1 -0
  11. package/dist/formatters.mjs +37 -0
  12. package/dist/index.cjs +1 -0
  13. package/dist/index.mjs +45 -0
  14. package/dist/material.cjs +1 -0
  15. package/dist/material.mjs +6 -0
  16. package/dist/presets-55krt4L_.js +354 -0
  17. package/dist/presets-UIJJyagu.cjs +1 -0
  18. package/dist/svg-BVcl24Cf.cjs +32 -0
  19. package/dist/svg-CZThYPKf.js +118 -0
  20. package/dist/tokens-DMGI7_df.cjs +9 -0
  21. package/dist/tokens-OfSofVKl.js +204 -0
  22. package/dist/types/animation/css.d.ts +12 -0
  23. package/dist/types/animation/index.d.ts +1 -0
  24. package/dist/types/color.d.ts +10 -0
  25. package/dist/types/colorMath.d.ts +3 -0
  26. package/dist/types/constants.d.ts +3 -0
  27. package/dist/types/core.d.ts +9 -0
  28. package/dist/types/effects/index.d.ts +2 -0
  29. package/dist/types/effects/morph.d.ts +5 -0
  30. package/dist/types/effects/shadow.d.ts +3 -0
  31. package/dist/types/formatters/canvas.d.ts +2 -0
  32. package/dist/types/formatters/css.d.ts +3 -0
  33. package/dist/types/formatters/index.d.ts +3 -0
  34. package/dist/types/formatters/svg.d.ts +5 -0
  35. package/dist/types/index.d.ts +7 -0
  36. package/dist/types/material.d.ts +1 -0
  37. package/dist/types/model.d.ts +5 -0
  38. package/dist/types/palette.d.ts +6 -0
  39. package/dist/types/presets.d.ts +239 -0
  40. package/dist/types/recipes.d.ts +14 -0
  41. package/dist/types/tokens.d.ts +99 -0
  42. package/dist/types/types.d.ts +117 -0
  43. package/dist/types/utils.d.ts +10 -0
  44. package/dist/utils-6iJ6IpZZ.cjs +1 -0
  45. package/dist/utils-B_VQDGMy.js +67 -0
  46. package/package.json +114 -0
@@ -0,0 +1,204 @@
1
+ import { h as w, b as $, g as v, c as p, s as u, j as x, k as y } from "./presets-55krt4L_.js";
2
+ import { toGradientAnimationValue as k, toGradientAnimationKeyframes as G, toGradientAnimationCSS as C } from "./animation.mjs";
3
+ import { createGradientMorphBlobs as V, toGradientMorphFilter as j, toGradientMorphFilterMarkup as T, toGradientDropShadow as A, toGradientBoxShadow as O } from "./effects.mjs";
4
+ import { t as E } from "./css-CaOuUhfh.js";
5
+ import { t as P } from "./svg-CZThYPKf.js";
6
+ const M = ["glare", "soft", "mesh"], N = (a) => a.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`), B = (a) => N(a), I = (a, r, e) => `${a}-${r}`, g = (a) => Object.entries(a).map(([r, e]) => `${r}: ${e};`).join(`
7
+ `), D = (a) => a.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`), F = (a) => Object.entries(a).map(([r, e]) => `${D(r)}: ${e};`).join(`
8
+ `), h = (a) => a === null || typeof a != "object" ? JSON.stringify(a) : Array.isArray(a) ? `[${a.map(h).join(",")}]` : `{${Object.entries(a).filter(([, r]) => r !== void 0).sort(([r], [e]) => r.localeCompare(e)).map(
9
+ ([r, e]) => `${JSON.stringify(r)}:${h(e)}`
10
+ ).join(",")}}`, K = (a) => {
11
+ let r = 5381;
12
+ for (let e = 0; e < a.length; e += 1)
13
+ r = r * 33 ^ a.charCodeAt(e);
14
+ return (r >>> 0).toString(36);
15
+ }, L = (a, r, e, n) => {
16
+ const o = g(r), s = F(e), t = [o, s].filter(Boolean).join(`
17
+ `);
18
+ return [`.${a} {
19
+ ${t}
20
+ }`, n].filter(Boolean).join(`
21
+
22
+ `);
23
+ }, J = (a, r) => a in r, S = (a, r) => J(a, r) ? v(a, r) : a === "soft" ? {
24
+ label: "Soft",
25
+ description: "Quiet monochrome radial gradient.",
26
+ gradient: {
27
+ recipe: "monochrome",
28
+ type: "radial",
29
+ position: "center",
30
+ shape: "ellipse"
31
+ },
32
+ shadow: {
33
+ layers: 2,
34
+ opacity: 0.18,
35
+ blur: 18,
36
+ y: 7,
37
+ spread: -4
38
+ },
39
+ dropShadow: {
40
+ layers: 2,
41
+ opacity: 0.26,
42
+ blur: 16,
43
+ y: 6
44
+ },
45
+ animation: {
46
+ preset: "pulse",
47
+ duration: 7200,
48
+ easing: "ease-in-out"
49
+ }
50
+ } : a === "mesh" ? null : {
51
+ label: a,
52
+ gradient: {
53
+ recipe: a,
54
+ type: "linear",
55
+ direction: a === "glare" ? 135 : 145
56
+ }
57
+ }, Z = (a) => {
58
+ const r = [
59
+ `radial-gradient(circle at 16% 18%, ${u(a, -42, 72, 1.05)} 0%, transparent 34%)`,
60
+ `radial-gradient(circle at 86% 20%, ${x(a)} 0%, transparent 32%)`,
61
+ `radial-gradient(circle at 50% 84%, ${u(a, 56, 64, 1.08)} 0%, transparent 38%)`,
62
+ `linear-gradient(135deg, ${y(a, 94)}, ${y(a, 28)})`
63
+ ];
64
+ return {
65
+ layers: r,
66
+ value: r.join(", ")
67
+ };
68
+ }, _ = (a, r, e, n, o) => {
69
+ if (r === "mesh") {
70
+ const f = Z(a);
71
+ return {
72
+ cssVar: e,
73
+ layers: f.layers,
74
+ value: f.value
75
+ };
76
+ }
77
+ const s = S(r, o), t = $(a), l = p(t, {
78
+ ...s == null ? void 0 : s.gradient,
79
+ ...n
80
+ });
81
+ return {
82
+ cssVar: e,
83
+ model: l,
84
+ stops: l.stops,
85
+ svg: P(l, { id: e.replace(/^--/, "") }),
86
+ value: E(l)
87
+ };
88
+ }, z = (a, r, e, n) => {
89
+ var t;
90
+ if (!a) return {};
91
+ const o = `${r.replace(/^--/, "")}-morph`, s = {
92
+ ...n == null ? void 0 : n.morph,
93
+ id: ((t = n == null ? void 0 : n.morph) == null ? void 0 : t.id) ?? o
94
+ };
95
+ return {
96
+ boxShadow: {
97
+ cssVar: `${r}-shadow`,
98
+ value: O(a, (n == null ? void 0 : n.shadow) ?? (e == null ? void 0 : e.shadow))
99
+ },
100
+ dropShadow: {
101
+ cssVar: `${r}-drop-shadow`,
102
+ value: A(
103
+ a,
104
+ (n == null ? void 0 : n.dropShadow) ?? (e == null ? void 0 : e.dropShadow)
105
+ )
106
+ },
107
+ morph: {
108
+ cssVar: `${r}-morph`,
109
+ svg: T(s),
110
+ value: j(s)
111
+ }
112
+ };
113
+ }, H = (a, r, e, n) => {
114
+ var s;
115
+ const o = {
116
+ ...e == null ? void 0 : e.animation,
117
+ ...n,
118
+ name: `g-gradient-${a}-${(n == null ? void 0 : n.preset) ?? ((s = e == null ? void 0 : e.animation) == null ? void 0 : s.preset) ?? "shift"}`,
119
+ selector: `.g-gradient-${a}`
120
+ };
121
+ return {
122
+ css: C(o),
123
+ cssVar: `${r}-animation`,
124
+ keyframes: G(o),
125
+ name: o.name,
126
+ value: k(o)
127
+ };
128
+ }, b = (a, r = "glare", e = {}) => {
129
+ const n = e.registry ?? w, o = B(r), s = I(e.prefix ?? "--g-gradient", o), t = S(r, n), f = $(a)[500], c = _(
130
+ f,
131
+ r,
132
+ s,
133
+ e,
134
+ n
135
+ ), d = {
136
+ [s]: c.value
137
+ }, i = e.effects ? z(c.model, s, t, {
138
+ dropShadow: e.dropShadow,
139
+ morph: e.morph,
140
+ shadow: e.shadow
141
+ }) : void 0, m = e.animations ? H(o, s, t, e.animation) : void 0;
142
+ return i != null && i.boxShadow && (d[i.boxShadow.cssVar] = i.boxShadow.value), i != null && i.dropShadow && (d[i.dropShadow.cssVar] = i.dropShadow.value), i != null && i.morph && (d[i.morph.cssVar] = i.morph.value), m && (d[m.cssVar] = m.value), {
143
+ animation: m,
144
+ cssText: g(d),
145
+ cssVars: d,
146
+ description: t == null ? void 0 : t.description,
147
+ effects: i,
148
+ gradient: c,
149
+ keyframes: (m == null ? void 0 : m.keyframes) ?? "",
150
+ label: (t == null ? void 0 : t.label) ?? o,
151
+ name: o
152
+ };
153
+ }, X = (a, r = {}) => {
154
+ const e = r.recipes ?? M, n = {}, o = {}, s = {}, t = {}, l = [];
155
+ for (const f of e) {
156
+ const c = b(a, f, {
157
+ animations: r.animations,
158
+ effects: r.effects,
159
+ morph: r.morph,
160
+ prefix: r.prefix,
161
+ registry: r.registry
162
+ });
163
+ n[c.name] = c.gradient, Object.assign(t, c.cssVars), c.effects && (o[c.name] = c.effects), c.animation && (s[c.name] = c.animation, l.push(c.animation.keyframes));
164
+ }
165
+ return {
166
+ animations: s,
167
+ cssText: g(t),
168
+ cssVars: t,
169
+ effects: o,
170
+ gradients: n,
171
+ keyframes: l.join(`
172
+ `)
173
+ };
174
+ }, Y = (a, r = {}) => {
175
+ var i, m;
176
+ const { className: e, id: n, recipe: o = "glare", ...s } = r, t = b(a, o, s), l = t.gradient.model && r.effects && r.morph ? V(t.gradient.model, r.morph) : void 0, f = n ?? `g-gradient-${t.name}-${K(
177
+ h({ options: r, seed: a })
178
+ )}`, c = e ?? f, d = {
179
+ backgroundImage: `var(${t.gradient.cssVar})`
180
+ };
181
+ return (i = t.effects) != null && i.boxShadow && (d.boxShadow = `var(${t.effects.boxShadow.cssVar})`), (m = t.effects) != null && m.dropShadow && (d.filter = `var(${t.effects.dropShadow.cssVar})`), t.animation && (d.animation = `var(${t.animation.cssVar})`), {
182
+ animation: t.animation,
183
+ className: c,
184
+ cssText: L(
185
+ c,
186
+ t.cssVars,
187
+ d,
188
+ t.keyframes
189
+ ),
190
+ cssVars: t.cssVars,
191
+ effects: t.effects,
192
+ gradient: t.gradient,
193
+ id: f,
194
+ keyframes: t.keyframes,
195
+ morphBlobs: l,
196
+ preset: t,
197
+ style: d
198
+ };
199
+ };
200
+ export {
201
+ b as a,
202
+ X as b,
203
+ Y as c
204
+ };
@@ -0,0 +1,12 @@
1
+ import type { GradientAnimationOptions } from '../types';
2
+ export declare const getGradientAnimationOptions: (options?: GradientAnimationOptions) => {
3
+ duration: string;
4
+ easing: string;
5
+ name: string;
6
+ preset: import("..").GradientAnimationPreset;
7
+ selector: string;
8
+ };
9
+ export declare const toGradientAnimationKeyframes: (options?: GradientAnimationOptions) => string;
10
+ export declare const toGradientAnimationValue: (options?: GradientAnimationOptions) => string;
11
+ export declare const toGradientAnimationStyles: (options?: GradientAnimationOptions) => string;
12
+ export declare const toGradientAnimationCSS: (options?: GradientAnimationOptions) => string;
@@ -0,0 +1 @@
1
+ export { getGradientAnimationOptions, toGradientAnimationCSS, toGradientAnimationKeyframes, toGradientAnimationStyles, toGradientAnimationValue } from './css';
@@ -0,0 +1,10 @@
1
+ export type ColorInput = string | number;
2
+ export interface RgbColor {
3
+ r: number;
4
+ g: number;
5
+ b: number;
6
+ }
7
+ export declare const parseColor: (input: ColorInput) => RgbColor | null;
8
+ export declare const rgbToHex: ({ r, g, b }: RgbColor) => string;
9
+ export declare const rgbToChannels: ({ r, g, b }: RgbColor) => string;
10
+ export declare const colorToHex: (input: ColorInput, fallback: string) => string;
@@ -0,0 +1,3 @@
1
+ export declare const changeTone: (hex: string, tone: number) => string;
2
+ export declare const shiftHue: (hex: string, hueShift: number, tone: number, chromaMultiplier?: number) => string;
3
+ export declare const getComplementaryColor: (hex: string) => string;
@@ -0,0 +1,3 @@
1
+ export declare const DEFAULT_GRADIENT_DIRECTION = 135;
2
+ export declare const DEFAULT_GRADIENT_POSITION = "center";
3
+ export declare const DEFAULT_GRADIENT_SIZE = "farthest-corner";
@@ -0,0 +1,9 @@
1
+ import { type ColorPalette } from './palette';
2
+ import type { ColorInput } from './color';
3
+ import type { GradientOptions } from './types';
4
+ export * from './types';
5
+ export { createGradientModel, createGradientModelFromColor } from './model';
6
+ export { createRecipeStops, gradientRecipes } from './recipes';
7
+ export { defineGradientPreset, defineGradientPresetRegistry, getGradientPreset, gradientPresets, type GradientPreset, type GradientPresetName, type GradientPresetRegistry } from './presets';
8
+ export declare const createGradient: (palette: ColorPalette, options?: GradientOptions) => string;
9
+ export declare const createGradientFromColor: (color: ColorInput, options?: GradientOptions) => string;
@@ -0,0 +1,2 @@
1
+ export { createGradientMorphBlobs, toGradientMorphCSS, toGradientMorphFilter, toGradientMorphFilterMarkup } from './morph';
2
+ export { toGradientBoxShadow, toGradientDropShadow } from './shadow';
@@ -0,0 +1,5 @@
1
+ import type { GradientModel, GradientMorphBlob, GradientMorphOptions } from '../types';
2
+ export declare const createGradientMorphBlobs: (model: GradientModel, options?: GradientMorphOptions) => GradientMorphBlob[];
3
+ export declare const toGradientMorphFilter: (options?: GradientMorphOptions) => string;
4
+ export declare const toGradientMorphFilterMarkup: (options?: GradientMorphOptions) => string;
5
+ export declare const toGradientMorphCSS: (model: GradientModel, options?: GradientMorphOptions) => string;
@@ -0,0 +1,3 @@
1
+ import type { GradientModel, GradientShadowOptions } from '../types';
2
+ export declare const toGradientBoxShadow: (model: GradientModel, options?: GradientShadowOptions) => string;
3
+ export declare const toGradientDropShadow: (model: GradientModel, options?: GradientShadowOptions) => string;
@@ -0,0 +1,2 @@
1
+ import type { CanvasGradientOptions, GradientModel } from '../types';
2
+ export declare const toCanvasGradient: (context: CanvasRenderingContext2D, model: GradientModel, options?: CanvasGradientOptions) => CanvasGradient;
@@ -0,0 +1,3 @@
1
+ import type { GradientDirection, GradientModel } from '../types';
2
+ export declare const createLinearGradient: (stops: readonly string[], direction?: GradientDirection) => string;
3
+ export declare const toCssGradient: (model: GradientModel) => string;
@@ -0,0 +1,3 @@
1
+ export { createLinearGradient, toCssGradient } from './css';
2
+ export { toCanvasGradient } from './canvas';
3
+ export { toSvgGradient, toSvgGradientMarkup, toSvgPathAnimationMarkup, toSvgSourceAnimationMarkup } from './svg';
@@ -0,0 +1,5 @@
1
+ import type { GradientModel, SvgGradientOptions, SvgPathAnimationOptions, SvgSourceAnimationOptions } from '../types';
2
+ export declare const toSvgGradient: (model: GradientModel, options?: SvgGradientOptions) => string;
3
+ export declare const toSvgGradientMarkup: (model: GradientModel, options?: SvgGradientOptions) => string;
4
+ export declare const toSvgSourceAnimationMarkup: (sourceSvg: string, model: GradientModel, options?: SvgSourceAnimationOptions) => string;
5
+ export declare const toSvgPathAnimationMarkup: (model: GradientModel, options?: SvgPathAnimationOptions) => string;
@@ -0,0 +1,7 @@
1
+ export * from './core';
2
+ export * from './color';
3
+ export * from './palette';
4
+ export * from './formatters';
5
+ export * from './effects';
6
+ export { toGradientAnimationCSS } from './animation';
7
+ export * from './material';
@@ -0,0 +1 @@
1
+ export { createGradientMaterial, createGradientPreset, createGradientTokens, type CreatedGradientMaterial, type CreatedGradientPreset, type CreatedGradientTokens, type GradientAnimationTokenEntry, type GradientEffectTokenEntry, type GradientMaterialOptions, type GradientTokenEntry, type GradientTokenOptions, type GradientTokenRecipe } from './tokens';
@@ -0,0 +1,5 @@
1
+ import { type ColorPalette } from './palette';
2
+ import type { GradientModel, GradientOptions } from './types';
3
+ import type { ColorInput } from './color';
4
+ export declare const createGradientModel: (palette: ColorPalette, options?: GradientOptions) => GradientModel;
5
+ export declare const createGradientModelFromColor: (color: ColorInput, options?: GradientOptions) => GradientModel;
@@ -0,0 +1,6 @@
1
+ import { type ColorInput } from './color';
2
+ export declare const COLOR_SHADES: readonly [50, 100, 200, 300, 400, 500, 600, 700, 800, 900];
3
+ export type ColorShade = (typeof COLOR_SHADES)[number];
4
+ export type ColorPalette = Record<ColorShade, string>;
5
+ export declare const SHADE_TONES: Record<ColorShade, number>;
6
+ export declare const createPalette: (seed: ColorInput) => ColorPalette;
@@ -0,0 +1,239 @@
1
+ import type { GradientAnimationOptions, GradientAnimationPreset, GradientOptions, GradientRecipe, GradientShadowOptions, GradientType } from './types';
2
+ export interface GradientPreset {
3
+ label: string;
4
+ description?: string;
5
+ gradient: Omit<GradientOptions, 'shade' | 'colors'> & {
6
+ recipe: GradientRecipe;
7
+ type?: GradientType;
8
+ };
9
+ shadow?: GradientShadowOptions;
10
+ dropShadow?: GradientShadowOptions;
11
+ animation?: Omit<GradientAnimationOptions, 'name' | 'selector'> & {
12
+ preset: GradientAnimationPreset;
13
+ };
14
+ }
15
+ export type GradientPresetRegistry = Record<string, GradientPreset>;
16
+ export declare const defineGradientPreset: <T extends GradientPreset>(preset: T) => T;
17
+ export declare const defineGradientPresetRegistry: <T extends GradientPresetRegistry>(presets: T) => T;
18
+ export declare const gradientPresets: {
19
+ materialBorder: {
20
+ label: string;
21
+ description: string;
22
+ gradient: {
23
+ recipe: "glare";
24
+ type: "linear";
25
+ direction: number;
26
+ };
27
+ shadow: {
28
+ layers: number;
29
+ opacity: number;
30
+ blur: number;
31
+ y: number;
32
+ spread: number;
33
+ };
34
+ dropShadow: {
35
+ layers: number;
36
+ opacity: number;
37
+ blur: number;
38
+ y: number;
39
+ };
40
+ animation: {
41
+ preset: "shift";
42
+ duration: number;
43
+ easing: string;
44
+ };
45
+ };
46
+ materialAction: {
47
+ label: string;
48
+ description: string;
49
+ gradient: {
50
+ recipe: "glare";
51
+ type: "linear";
52
+ direction: number;
53
+ };
54
+ shadow: {
55
+ layers: number;
56
+ opacity: number;
57
+ blur: number;
58
+ y: number;
59
+ spread: number;
60
+ };
61
+ dropShadow: {
62
+ layers: number;
63
+ opacity: number;
64
+ blur: number;
65
+ y: number;
66
+ };
67
+ animation: {
68
+ preset: "shift";
69
+ duration: number;
70
+ easing: string;
71
+ };
72
+ };
73
+ materialSurface: {
74
+ label: string;
75
+ description: string;
76
+ gradient: {
77
+ recipe: "monochrome";
78
+ type: "linear";
79
+ direction: number;
80
+ };
81
+ shadow: {
82
+ layers: number;
83
+ opacity: number;
84
+ blur: number;
85
+ y: number;
86
+ spread: number;
87
+ };
88
+ dropShadow: {
89
+ layers: number;
90
+ opacity: number;
91
+ blur: number;
92
+ y: number;
93
+ };
94
+ animation: {
95
+ preset: "pulse";
96
+ duration: number;
97
+ easing: string;
98
+ };
99
+ };
100
+ brandGlare: {
101
+ label: string;
102
+ description: string;
103
+ gradient: {
104
+ recipe: "glare";
105
+ type: "linear";
106
+ direction: number;
107
+ };
108
+ shadow: {
109
+ layers: number;
110
+ opacity: number;
111
+ blur: number;
112
+ y: number;
113
+ spread: number;
114
+ };
115
+ dropShadow: {
116
+ layers: number;
117
+ opacity: number;
118
+ blur: number;
119
+ y: number;
120
+ };
121
+ animation: {
122
+ preset: "shift";
123
+ duration: number;
124
+ easing: string;
125
+ };
126
+ };
127
+ softMono: {
128
+ label: string;
129
+ description: string;
130
+ gradient: {
131
+ recipe: "monochrome";
132
+ type: "linear";
133
+ direction: number;
134
+ };
135
+ shadow: {
136
+ layers: number;
137
+ opacity: number;
138
+ blur: number;
139
+ y: number;
140
+ spread: number;
141
+ };
142
+ dropShadow: {
143
+ layers: number;
144
+ opacity: number;
145
+ blur: number;
146
+ y: number;
147
+ };
148
+ animation: {
149
+ preset: "pulse";
150
+ duration: number;
151
+ easing: string;
152
+ };
153
+ };
154
+ neonDuo: {
155
+ label: string;
156
+ description: string;
157
+ gradient: {
158
+ recipe: "duotone";
159
+ type: "linear";
160
+ direction: number;
161
+ };
162
+ shadow: {
163
+ layers: number;
164
+ opacity: number;
165
+ blur: number;
166
+ y: number;
167
+ spread: number;
168
+ };
169
+ dropShadow: {
170
+ layers: number;
171
+ opacity: number;
172
+ blur: number;
173
+ y: number;
174
+ };
175
+ animation: {
176
+ preset: "shift";
177
+ duration: number;
178
+ easing: string;
179
+ };
180
+ };
181
+ orbitalConic: {
182
+ label: string;
183
+ description: string;
184
+ gradient: {
185
+ recipe: "triadic";
186
+ type: "conic";
187
+ direction: number;
188
+ position: string;
189
+ };
190
+ shadow: {
191
+ layers: number;
192
+ opacity: number;
193
+ blur: number;
194
+ y: number;
195
+ spread: number;
196
+ };
197
+ dropShadow: {
198
+ layers: number;
199
+ opacity: number;
200
+ blur: number;
201
+ y: number;
202
+ };
203
+ animation: {
204
+ preset: "rotate";
205
+ duration: number;
206
+ };
207
+ };
208
+ auroraRadial: {
209
+ label: string;
210
+ description: string;
211
+ gradient: {
212
+ recipe: "analogous";
213
+ type: "radial";
214
+ direction: number;
215
+ position: string;
216
+ shape: "circle";
217
+ };
218
+ shadow: {
219
+ layers: number;
220
+ opacity: number;
221
+ blur: number;
222
+ y: number;
223
+ spread: number;
224
+ };
225
+ dropShadow: {
226
+ layers: number;
227
+ opacity: number;
228
+ blur: number;
229
+ y: number;
230
+ };
231
+ animation: {
232
+ preset: "hue-rotate";
233
+ duration: number;
234
+ easing: string;
235
+ };
236
+ };
237
+ };
238
+ export type GradientPresetName = keyof typeof gradientPresets;
239
+ export declare const getGradientPreset: (name: GradientPresetName | string, registry?: GradientPresetRegistry) => GradientPreset;
@@ -0,0 +1,14 @@
1
+ import type { GradientRecipe } from './types';
2
+ export declare const gradientRecipes: {
3
+ glare: (base: string) => import("./types").GradientStop[];
4
+ monochrome: (base: string) => import("./types").GradientStop[];
5
+ complementary: (base: string) => import("./types").GradientStop[];
6
+ 'split-complementary': (base: string) => import("./types").GradientStop[];
7
+ analogous: (base: string) => import("./types").GradientStop[];
8
+ triadic: (base: string) => import("./types").GradientStop[];
9
+ tetradic: (base: string) => import("./types").GradientStop[];
10
+ rectangle: (base: string) => import("./types").GradientStop[];
11
+ square: (base: string) => import("./types").GradientStop[];
12
+ duotone: (base: string, colors: readonly string[] | undefined) => import("./types").GradientStop[];
13
+ };
14
+ export declare const createRecipeStops: (base: string, recipe: GradientRecipe, colors?: readonly string[]) => import("./types").GradientStop[];
@@ -0,0 +1,99 @@
1
+ import type { ColorInput } from './color';
2
+ import { type GradientPresetName, type GradientPresetRegistry } from './presets';
3
+ import type { GradientAnimationOptions, GradientMorphBlob, GradientMorphOptions, GradientModel, GradientOptions, GradientRecipe, GradientShadowOptions, GradientStop } from './types';
4
+ export type GradientTokenRecipe = GradientRecipe | GradientPresetName | 'mesh' | 'soft';
5
+ export interface GradientTokenEntry {
6
+ value: string;
7
+ cssVar: string;
8
+ model?: GradientModel;
9
+ layers?: string[];
10
+ stops?: GradientStop[];
11
+ svg?: string;
12
+ }
13
+ export interface GradientEffectTokenEntry {
14
+ boxShadow?: {
15
+ value: string;
16
+ cssVar: string;
17
+ };
18
+ dropShadow?: {
19
+ value: string;
20
+ cssVar: string;
21
+ };
22
+ morph?: {
23
+ value: string;
24
+ cssVar: string;
25
+ svg: string;
26
+ };
27
+ }
28
+ export interface GradientAnimationTokenEntry {
29
+ name: string;
30
+ value: string;
31
+ css: string;
32
+ keyframes: string;
33
+ cssVar: string;
34
+ }
35
+ export interface CreatedGradientPreset {
36
+ name: string;
37
+ label: string;
38
+ description?: string;
39
+ gradient: GradientTokenEntry;
40
+ effects?: GradientEffectTokenEntry;
41
+ animation?: GradientAnimationTokenEntry;
42
+ cssVars: Record<string, string>;
43
+ cssText: string;
44
+ keyframes: string;
45
+ }
46
+ export interface GradientTokenOptions {
47
+ recipes?: readonly GradientTokenRecipe[];
48
+ effects?: boolean;
49
+ animations?: boolean;
50
+ morph?: GradientMorphOptions;
51
+ registry?: GradientPresetRegistry;
52
+ prefix?: string;
53
+ }
54
+ export interface CreatedGradientTokens {
55
+ gradients: Record<string, GradientTokenEntry>;
56
+ effects: Record<string, GradientEffectTokenEntry>;
57
+ animations: Record<string, GradientAnimationTokenEntry>;
58
+ cssVars: Record<string, string>;
59
+ cssText: string;
60
+ keyframes: string;
61
+ }
62
+ export interface GradientMaterialOptions extends Omit<GradientOptions, 'recipe'> {
63
+ animation?: GradientAnimationOptions;
64
+ animations?: boolean;
65
+ className?: string;
66
+ dropShadow?: GradientShadowOptions;
67
+ effects?: boolean;
68
+ id?: string;
69
+ morph?: GradientMorphOptions;
70
+ prefix?: string;
71
+ recipe?: GradientTokenRecipe;
72
+ registry?: GradientPresetRegistry;
73
+ shadow?: GradientShadowOptions;
74
+ }
75
+ export interface CreatedGradientMaterial {
76
+ id: string;
77
+ className: string;
78
+ style: Record<string, string>;
79
+ cssVars: Record<string, string>;
80
+ cssText: string;
81
+ keyframes: string;
82
+ preset: CreatedGradientPreset;
83
+ gradient: GradientTokenEntry;
84
+ effects?: GradientEffectTokenEntry;
85
+ animation?: GradientAnimationTokenEntry;
86
+ morphBlobs?: GradientMorphBlob[];
87
+ }
88
+ export declare const createGradientPreset: (seed: ColorInput, recipe?: GradientTokenRecipe, options?: GradientOptions & {
89
+ animation?: GradientAnimationOptions;
90
+ dropShadow?: GradientShadowOptions;
91
+ effects?: boolean;
92
+ morph?: GradientMorphOptions;
93
+ prefix?: string;
94
+ registry?: GradientPresetRegistry;
95
+ shadow?: GradientShadowOptions;
96
+ animations?: boolean;
97
+ }) => CreatedGradientPreset;
98
+ export declare const createGradientTokens: (seed: ColorInput, options?: GradientTokenOptions) => CreatedGradientTokens;
99
+ export declare const createGradientMaterial: (seed: ColorInput, options?: GradientMaterialOptions) => CreatedGradientMaterial;