@gradient-ui/gradient-engine 0.5.0 → 0.6.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 +22 -2
  2. package/dist/animation.cjs +1 -1
  3. package/dist/animation.mjs +1 -1
  4. package/dist/core.cjs +1 -1
  5. package/dist/core.mjs +12 -9
  6. package/dist/{css-YuAJQW13.cjs → css-BVHXLMRl.cjs} +1 -1
  7. package/dist/{css-CaOuUhfh.js → css-DVaTTIqS.js} +1 -1
  8. package/dist/design-tokens.cjs +1 -0
  9. package/dist/design-tokens.mjs +8 -0
  10. package/dist/designTokens-BnzZfRES.js +116 -0
  11. package/dist/designTokens-C1WdzS3v.cjs +1 -0
  12. package/dist/effects.cjs +137 -32
  13. package/dist/effects.mjs +221 -104
  14. package/dist/formatters.cjs +1 -1
  15. package/dist/formatters.mjs +3 -3
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.mjs +61 -41
  18. package/dist/material.cjs +9 -1
  19. package/dist/material.mjs +236 -4
  20. package/dist/presets-BBLdqUE4.cjs +316 -0
  21. package/dist/presets-DYXLx_nN.js +4025 -0
  22. package/dist/{svg-BVcl24Cf.cjs → svg-dGtLYnIJ.cjs} +1 -1
  23. package/dist/{svg-CZThYPKf.js → svg-hZus3ztj.js} +2 -2
  24. package/dist/types/color.d.ts +1 -0
  25. package/dist/types/colorSeeds.d.ts +22 -0
  26. package/dist/types/colorSystem.d.ts +20 -0
  27. package/dist/types/designTokens.d.ts +24 -0
  28. package/dist/types/effects/index.d.ts +1 -1
  29. package/dist/types/effects/morph.d.ts +4 -1
  30. package/dist/types/index.d.ts +4 -0
  31. package/dist/types/material.d.ts +1 -1
  32. package/dist/types/palette.d.ts +7 -0
  33. package/dist/types/scheme.d.ts +3 -0
  34. package/dist/types/tokens.d.ts +9 -1
  35. package/dist/types/types.d.ts +10 -0
  36. package/dist/types-BFr1fN-7.js +22 -0
  37. package/dist/types-BMLEvdee.cjs +1 -0
  38. package/dist/utils-BzSNCfat.js +76 -0
  39. package/dist/utils-D83DMCMa.cjs +1 -0
  40. package/package.json +9 -1
  41. package/dist/presets-55krt4L_.js +0 -354
  42. package/dist/presets-UIJJyagu.cjs +0 -1
  43. package/dist/tokens-DMGI7_df.cjs +0 -9
  44. package/dist/tokens-OfSofVKl.js +0 -204
  45. package/dist/utils-6iJ6IpZZ.cjs +0 -1
  46. package/dist/utils-B_VQDGMy.js +0 -67
@@ -1,354 +0,0 @@
1
- import { hexFromArgb as p, themeFromSourceColor as g, argbFromHex as u, Hct as s } from "@material/material-color-utilities";
2
- import { c as S, h as r, d as f, e as w, D as I } from "./utils-B_VQDGMy.js";
3
- const T = [
4
- 50,
5
- 100,
6
- 200,
7
- 300,
8
- 400,
9
- 500,
10
- 600,
11
- 700,
12
- 800,
13
- 900
14
- ], D = {
15
- 50: 90,
16
- 100: 80,
17
- 200: 70,
18
- 300: 60,
19
- 400: 50,
20
- 500: 40,
21
- 600: 35,
22
- 700: 30,
23
- 800: 20,
24
- 900: 10
25
- }, G = (e) => {
26
- const t = S(e, "#000000");
27
- return g(u(t)).palettes.primary;
28
- }, b = (e) => {
29
- const t = G(e);
30
- return Object.fromEntries(
31
- T.map((o) => [
32
- o,
33
- p(t.tone(D[o]))
34
- ])
35
- );
36
- }, n = (e, t) => {
37
- const o = s.fromInt(u(e));
38
- return p(s.from(o.hue, o.chroma, t).toInt());
39
- }, a = (e, t, o, c = 1) => {
40
- const l = s.fromInt(u(e)), y = (l.hue + t + 360) % 360, h = Math.min(l.chroma * c, 100);
41
- return p(s.from(y, h, o).toInt());
42
- }, d = (e) => {
43
- const t = s.fromInt(u(e)), o = (t.hue + 110) % 360, c = Math.min(t.chroma * 1.2, 100), l = t.tone < 50 ? 65 : Math.min(t.tone + 10, 75);
44
- return p(s.from(o, c, l).toInt());
45
- }, A = (e) => {
46
- const t = d(e);
47
- return [
48
- r(n(t, 95), 0),
49
- r(t, 25),
50
- r(e, 50),
51
- r(n(e, 80), 75),
52
- r(n(e, 20), 100)
53
- ];
54
- }, C = (e) => [
55
- r(n(e, 94), 0),
56
- r(n(e, 72), 28),
57
- r(e, 55),
58
- r(n(e, 24), 100)
59
- ], E = (e) => [
60
- r(n(d(e), 88), 0),
61
- r(e, 50),
62
- r(n(d(e), 32), 100)
63
- ], R = (e) => [
64
- r(a(e, 148, 82, 0.95), 0),
65
- r(a(e, -148, 70, 1.05), 28),
66
- r(e, 56),
67
- r(a(e, 150, 34, 1.08), 100)
68
- ], M = (e) => [
69
- r(a(e, -34, 72, 0.95), 0),
70
- r(e, 50),
71
- r(a(e, 34, 34, 1.05), 100)
72
- ], P = (e) => [
73
- r(a(e, -120, 78, 0.9), 0),
74
- r(e, 50),
75
- r(a(e, 120, 36, 1.05), 100)
76
- ], O = (e) => [
77
- r(a(e, -90, 78, 0.92), 0),
78
- r(e, 32),
79
- r(a(e, 90, 62, 1), 58),
80
- r(a(e, 180, 34, 1.08), 100)
81
- ], _ = (e) => [
82
- r(a(e, -28, 82, 0.96), 0),
83
- r(e, 27),
84
- r(a(e, 152, 66, 1.02), 62),
85
- r(a(e, 180, 34, 1.08), 100)
86
- ], F = (e) => [
87
- r(a(e, -90, 78, 0.94), 0),
88
- r(e, 30),
89
- r(a(e, 90, 62, 1), 62),
90
- r(a(e, 180, 36, 1.08), 100)
91
- ], N = (e, t) => {
92
- const o = (t == null ? void 0 : t[0]) ?? n(e, 84), c = (t == null ? void 0 : t[1]) ?? d(e);
93
- return [
94
- r(o, 0),
95
- r(e, 48),
96
- r(c, 100)
97
- ];
98
- }, H = {
99
- glare: A,
100
- monochrome: C,
101
- complementary: E,
102
- "split-complementary": R,
103
- analogous: M,
104
- triadic: P,
105
- tetradic: O,
106
- rectangle: _,
107
- square: F,
108
- duotone: N
109
- }, x = (e, t, o) => H[t](e, o), U = (e, t = {}) => {
110
- const o = t.shade ?? 500, c = t.recipe ?? "glare";
111
- return {
112
- type: t.type ?? "linear",
113
- stops: x(e[o], c, t.colors),
114
- direction: t.direction ?? I,
115
- shape: t.shape ?? "ellipse",
116
- position: t.position ?? w,
117
- size: t.size ?? f
118
- };
119
- }, q = (e, t = {}) => U(b(e), t), i = (e) => e, L = (e) => e, m = L({
120
- materialBorder: i({
121
- label: "Material border",
122
- description: "Default Gradient UI border material.",
123
- gradient: {
124
- recipe: "glare",
125
- type: "linear",
126
- direction: 135
127
- },
128
- shadow: {
129
- layers: 2,
130
- opacity: 0.22,
131
- blur: 12,
132
- y: 4,
133
- spread: -3
134
- },
135
- dropShadow: {
136
- layers: 2,
137
- opacity: 0.32,
138
- blur: 12,
139
- y: 5
140
- },
141
- animation: {
142
- preset: "shift",
143
- duration: 6400,
144
- easing: "ease-in-out"
145
- }
146
- }),
147
- materialAction: i({
148
- label: "Material action",
149
- description: "Compact action material for buttons, chips and controls.",
150
- gradient: {
151
- recipe: "glare",
152
- type: "linear",
153
- direction: 135
154
- },
155
- shadow: {
156
- layers: 2,
157
- opacity: 0.2,
158
- blur: 10,
159
- y: 3,
160
- spread: -2
161
- },
162
- dropShadow: {
163
- layers: 2,
164
- opacity: 0.28,
165
- blur: 10,
166
- y: 4
167
- },
168
- animation: {
169
- preset: "shift",
170
- duration: 6800,
171
- easing: "ease-in-out"
172
- }
173
- }),
174
- materialSurface: i({
175
- label: "Material surface",
176
- description: "Soft surface material for calm gradient backgrounds.",
177
- gradient: {
178
- recipe: "monochrome",
179
- type: "linear",
180
- direction: 145
181
- },
182
- shadow: {
183
- layers: 2,
184
- opacity: 0.18,
185
- blur: 14,
186
- y: 5,
187
- spread: -3
188
- },
189
- dropShadow: {
190
- layers: 2,
191
- opacity: 0.22,
192
- blur: 14,
193
- y: 5
194
- },
195
- animation: {
196
- preset: "pulse",
197
- duration: 7600,
198
- easing: "ease-in-out"
199
- }
200
- }),
201
- brandGlare: i({
202
- label: "Brand glare",
203
- description: "Classic Gradient UI glare with a vivid complementary highlight.",
204
- gradient: {
205
- recipe: "glare",
206
- type: "linear",
207
- direction: 135
208
- },
209
- shadow: {
210
- layers: 2,
211
- opacity: 0.24,
212
- blur: 16,
213
- y: 6,
214
- spread: -3
215
- },
216
- dropShadow: {
217
- layers: 3,
218
- opacity: 0.38,
219
- blur: 16,
220
- y: 6
221
- },
222
- animation: {
223
- preset: "shift",
224
- duration: 6e3,
225
- easing: "ease-in-out"
226
- }
227
- }),
228
- softMono: i({
229
- label: "Soft mono",
230
- description: "Quiet monochrome ramp for subtle surfaces.",
231
- gradient: {
232
- recipe: "monochrome",
233
- type: "linear",
234
- direction: 145
235
- },
236
- shadow: {
237
- layers: 2,
238
- opacity: 0.18,
239
- blur: 18,
240
- y: 7,
241
- spread: -4
242
- },
243
- dropShadow: {
244
- layers: 2,
245
- opacity: 0.26,
246
- blur: 16,
247
- y: 6
248
- },
249
- animation: {
250
- preset: "pulse",
251
- duration: 7200,
252
- easing: "ease-in-out"
253
- }
254
- }),
255
- neonDuo: i({
256
- label: "Neon duo",
257
- description: "Punchy duotone setup with stronger glow defaults.",
258
- gradient: {
259
- recipe: "duotone",
260
- type: "linear",
261
- direction: 120
262
- },
263
- shadow: {
264
- layers: 2,
265
- opacity: 0.32,
266
- blur: 18,
267
- y: 7,
268
- spread: -3
269
- },
270
- dropShadow: {
271
- layers: 3,
272
- opacity: 0.52,
273
- blur: 18,
274
- y: 7
275
- },
276
- animation: {
277
- preset: "shift",
278
- duration: 5200,
279
- easing: "ease-in-out"
280
- }
281
- }),
282
- orbitalConic: i({
283
- label: "Orbital conic",
284
- description: "Smooth mirrored conic gradient for badges and marks.",
285
- gradient: {
286
- recipe: "triadic",
287
- type: "conic",
288
- direction: 35,
289
- position: "center"
290
- },
291
- shadow: {
292
- layers: 2,
293
- opacity: 0.24,
294
- blur: 16,
295
- y: 6,
296
- spread: -3
297
- },
298
- dropShadow: {
299
- layers: 3,
300
- opacity: 0.36,
301
- blur: 16,
302
- y: 6
303
- },
304
- animation: {
305
- preset: "rotate",
306
- duration: 9e3
307
- }
308
- }),
309
- auroraRadial: i({
310
- label: "Aurora radial",
311
- description: "Radial analogous gradient with slow hue motion.",
312
- gradient: {
313
- recipe: "analogous",
314
- type: "radial",
315
- direction: 0,
316
- position: "top left",
317
- shape: "circle"
318
- },
319
- shadow: {
320
- layers: 2,
321
- opacity: 0.22,
322
- blur: 18,
323
- y: 7,
324
- spread: -4
325
- },
326
- dropShadow: {
327
- layers: 3,
328
- opacity: 0.32,
329
- blur: 18,
330
- y: 7
331
- },
332
- animation: {
333
- preset: "hue-rotate",
334
- duration: 8e3,
335
- easing: "ease-in-out"
336
- }
337
- })
338
- }), v = (e, t = m) => t[e] ?? m.brandGlare;
339
- export {
340
- T as C,
341
- D as S,
342
- q as a,
343
- b,
344
- U as c,
345
- x as d,
346
- i as e,
347
- L as f,
348
- v as g,
349
- m as h,
350
- H as i,
351
- d as j,
352
- n as k,
353
- a as s
354
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("@material/material-color-utilities"),t=require("./utils-6iJ6IpZZ.cjs"),u=[50,100,200,300,400,500,600,700,800,900],m={50:90,100:80,200:70,300:60,400:50,500:40,600:35,700:30,800:20,900:10},b=e=>{const r=t.colorToHex(e,"#000000");return i.themeFromSourceColor(i.argbFromHex(r)).palettes.primary},S=e=>{const r=b(e);return Object.fromEntries(u.map(a=>[a,i.hexFromArgb(r.tone(m[a]))]))},n=(e,r)=>{const a=i.Hct.fromInt(i.argbFromHex(e));return i.hexFromArgb(i.Hct.from(a.hue,a.chroma,r).toInt())},o=(e,r,a,p=1)=>{const s=i.Hct.fromInt(i.argbFromHex(e)),w=(s.hue+r+360)%360,G=Math.min(s.chroma*p,100);return i.hexFromArgb(i.Hct.from(w,G,a).toInt())},l=e=>{const r=i.Hct.fromInt(i.argbFromHex(e)),a=(r.hue+110)%360,p=Math.min(r.chroma*1.2,100),s=r.tone<50?65:Math.min(r.tone+10,75);return i.hexFromArgb(i.Hct.from(a,p,s).toInt())},A=e=>{const r=l(e);return[t.createStop(n(r,95),0),t.createStop(r,25),t.createStop(e,50),t.createStop(n(e,80),75),t.createStop(n(e,20),100)]},H=e=>[t.createStop(n(e,94),0),t.createStop(n(e,72),28),t.createStop(e,55),t.createStop(n(e,24),100)],C=e=>[t.createStop(n(l(e),88),0),t.createStop(e,50),t.createStop(n(l(e),32),100)],I=e=>[t.createStop(o(e,148,82,.95),0),t.createStop(o(e,-148,70,1.05),28),t.createStop(e,56),t.createStop(o(e,150,34,1.08),100)],T=e=>[t.createStop(o(e,-34,72,.95),0),t.createStop(e,50),t.createStop(o(e,34,34,1.05),100)],E=e=>[t.createStop(o(e,-120,78,.9),0),t.createStop(e,50),t.createStop(o(e,120,36,1.05),100)],R=e=>[t.createStop(o(e,-90,78,.92),0),t.createStop(e,32),t.createStop(o(e,90,62,1),58),t.createStop(o(e,180,34,1.08),100)],D=e=>[t.createStop(o(e,-28,82,.96),0),t.createStop(e,27),t.createStop(o(e,152,66,1.02),62),t.createStop(o(e,180,34,1.08),100)],F=e=>[t.createStop(o(e,-90,78,.94),0),t.createStop(e,30),t.createStop(o(e,90,62,1),62),t.createStop(o(e,180,36,1.08),100)],P=(e,r)=>{const a=(r==null?void 0:r[0])??n(e,84),p=(r==null?void 0:r[1])??l(e);return[t.createStop(a,0),t.createStop(e,48),t.createStop(p,100)]},y={glare:A,monochrome:H,complementary:C,"split-complementary":I,analogous:T,triadic:E,tetradic:R,rectangle:D,square:F,duotone:P},h=(e,r,a)=>y[r](e,a),g=(e,r={})=>{const a=r.shade??500,p=r.recipe??"glare";return{type:r.type??"linear",stops:h(e[a],p,r.colors),direction:r.direction??t.DEFAULT_GRADIENT_DIRECTION,shape:r.shape??"ellipse",position:r.position??t.DEFAULT_GRADIENT_POSITION,size:r.size??t.DEFAULT_GRADIENT_SIZE}},M=(e,r={})=>g(S(e),r),c=e=>e,f=e=>e,d=f({materialBorder:c({label:"Material border",description:"Default Gradient UI border material.",gradient:{recipe:"glare",type:"linear",direction:135},shadow:{layers:2,opacity:.22,blur:12,y:4,spread:-3},dropShadow:{layers:2,opacity:.32,blur:12,y:5},animation:{preset:"shift",duration:6400,easing:"ease-in-out"}}),materialAction:c({label:"Material action",description:"Compact action material for buttons, chips and controls.",gradient:{recipe:"glare",type:"linear",direction:135},shadow:{layers:2,opacity:.2,blur:10,y:3,spread:-2},dropShadow:{layers:2,opacity:.28,blur:10,y:4},animation:{preset:"shift",duration:6800,easing:"ease-in-out"}}),materialSurface:c({label:"Material surface",description:"Soft surface material for calm gradient backgrounds.",gradient:{recipe:"monochrome",type:"linear",direction:145},shadow:{layers:2,opacity:.18,blur:14,y:5,spread:-3},dropShadow:{layers:2,opacity:.22,blur:14,y:5},animation:{preset:"pulse",duration:7600,easing:"ease-in-out"}}),brandGlare:c({label:"Brand glare",description:"Classic Gradient UI glare with a vivid complementary highlight.",gradient:{recipe:"glare",type:"linear",direction:135},shadow:{layers:2,opacity:.24,blur:16,y:6,spread:-3},dropShadow:{layers:3,opacity:.38,blur:16,y:6},animation:{preset:"shift",duration:6e3,easing:"ease-in-out"}}),softMono:c({label:"Soft mono",description:"Quiet monochrome ramp for subtle surfaces.",gradient:{recipe:"monochrome",type:"linear",direction:145},shadow:{layers:2,opacity:.18,blur:18,y:7,spread:-4},dropShadow:{layers:2,opacity:.26,blur:16,y:6},animation:{preset:"pulse",duration:7200,easing:"ease-in-out"}}),neonDuo:c({label:"Neon duo",description:"Punchy duotone setup with stronger glow defaults.",gradient:{recipe:"duotone",type:"linear",direction:120},shadow:{layers:2,opacity:.32,blur:18,y:7,spread:-3},dropShadow:{layers:3,opacity:.52,blur:18,y:7},animation:{preset:"shift",duration:5200,easing:"ease-in-out"}}),orbitalConic:c({label:"Orbital conic",description:"Smooth mirrored conic gradient for badges and marks.",gradient:{recipe:"triadic",type:"conic",direction:35,position:"center"},shadow:{layers:2,opacity:.24,blur:16,y:6,spread:-3},dropShadow:{layers:3,opacity:.36,blur:16,y:6},animation:{preset:"rotate",duration:9e3}}),auroraRadial:c({label:"Aurora radial",description:"Radial analogous gradient with slow hue motion.",gradient:{recipe:"analogous",type:"radial",direction:0,position:"top left",shape:"circle"},shadow:{layers:2,opacity:.22,blur:18,y:7,spread:-4},dropShadow:{layers:3,opacity:.32,blur:18,y:7},animation:{preset:"hue-rotate",duration:8e3,easing:"ease-in-out"}})}),O=(e,r=d)=>r[e]??d.brandGlare;exports.COLOR_SHADES=u;exports.SHADE_TONES=m;exports.changeTone=n;exports.createGradientModel=g;exports.createGradientModelFromColor=M;exports.createPalette=S;exports.createRecipeStops=h;exports.defineGradientPreset=c;exports.defineGradientPresetRegistry=f;exports.getComplementaryColor=l;exports.getGradientPreset=O;exports.gradientPresets=d;exports.gradientRecipes=y;exports.shiftHue=o;
@@ -1,9 +0,0 @@
1
- "use strict";const f=require("./presets-UIJJyagu.cjs"),u=require("./animation.cjs"),g=require("./effects.cjs"),b=require("./css-YuAJQW13.cjs"),v=require("./svg-BVcl24Cf.cjs"),G=["glare","soft","mesh"],k=e=>e.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`),x=e=>k(e),C=(e,a,r)=>`${e}-${a}`,$=e=>Object.entries(e).map(([a,r])=>`${a}: ${r};`).join(`
2
- `),T=e=>e.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`),V=e=>Object.entries(e).map(([a,r])=>`${T(a)}: ${r};`).join(`
3
- `),y=e=>e===null||typeof e!="object"?JSON.stringify(e):Array.isArray(e)?`[${e.map(y).join(",")}]`:`{${Object.entries(e).filter(([,a])=>a!==void 0).sort(([a],[r])=>a.localeCompare(r)).map(([a,r])=>`${JSON.stringify(a)}:${y(r)}`).join(",")}}`,p=e=>{let a=5381;for(let r=0;r<e.length;r+=1)a=a*33^e.charCodeAt(r);return(a>>>0).toString(36)},j=(e,a,r,n)=>{const o=$(a),s=V(r),t=[o,s].filter(Boolean).join(`
4
- `);return[`.${e} {
5
- ${t}
6
- }`,n].filter(Boolean).join(`
7
-
8
- `)},A=(e,a)=>e in a,w=(e,a)=>A(e,a)?f.getGradientPreset(e,a):e==="soft"?{label:"Soft",description:"Quiet monochrome radial gradient.",gradient:{recipe:"monochrome",type:"radial",position:"center",shape:"ellipse"},shadow:{layers:2,opacity:.18,blur:18,y:7,spread:-4},dropShadow:{layers:2,opacity:.26,blur:16,y:6},animation:{preset:"pulse",duration:7200,easing:"ease-in-out"}}:e==="mesh"?null:{label:e,gradient:{recipe:e,type:"linear",direction:e==="glare"?135:145}},O=e=>{const a=[`radial-gradient(circle at 16% 18%, ${f.shiftHue(e,-42,72,1.05)} 0%, transparent 34%)`,`radial-gradient(circle at 86% 20%, ${f.getComplementaryColor(e)} 0%, transparent 32%)`,`radial-gradient(circle at 50% 84%, ${f.shiftHue(e,56,64,1.08)} 0%, transparent 38%)`,`linear-gradient(135deg, ${f.changeTone(e,94)}, ${f.changeTone(e,28)})`];return{layers:a,value:a.join(", ")}},P=(e,a,r,n,o)=>{if(a==="mesh"){const h=O(e);return{cssVar:r,layers:h.layers,value:h.value}}const s=w(a,o),t=f.createPalette(e),l=f.createGradientModel(t,{...s==null?void 0:s.gradient,...n});return{cssVar:r,model:l,stops:l.stops,svg:v.toSvgGradient(l,{id:r.replace(/^--/,"")}),value:b.toCssGradient(l)}},E=(e,a,r,n)=>{var t;if(!e)return{};const o=`${a.replace(/^--/,"")}-morph`,s={...n==null?void 0:n.morph,id:((t=n==null?void 0:n.morph)==null?void 0:t.id)??o};return{boxShadow:{cssVar:`${a}-shadow`,value:g.toGradientBoxShadow(e,(n==null?void 0:n.shadow)??(r==null?void 0:r.shadow))},dropShadow:{cssVar:`${a}-drop-shadow`,value:g.toGradientDropShadow(e,(n==null?void 0:n.dropShadow)??(r==null?void 0:r.dropShadow))},morph:{cssVar:`${a}-morph`,svg:g.toGradientMorphFilterMarkup(s),value:g.toGradientMorphFilter(s)}}},M=(e,a,r,n)=>{var s;const o={...r==null?void 0:r.animation,...n,name:`g-gradient-${e}-${(n==null?void 0:n.preset)??((s=r==null?void 0:r.animation)==null?void 0:s.preset)??"shift"}`,selector:`.g-gradient-${e}`};return{css:u.toGradientAnimationCSS(o),cssVar:`${a}-animation`,keyframes:u.toGradientAnimationKeyframes(o),name:o.name,value:u.toGradientAnimationValue(o)}},S=(e,a="glare",r={})=>{const n=r.registry??f.gradientPresets,o=x(a),s=C(r.prefix??"--g-gradient",o),t=w(a,n),h=f.createPalette(e)[500],c=P(h,a,s,r,n),d={[s]:c.value},i=r.effects?E(c.model,s,t,{dropShadow:r.dropShadow,morph:r.morph,shadow:r.shadow}):void 0,m=r.animations?M(o,s,t,r.animation):void 0;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),{animation:m,cssText:$(d),cssVars:d,description:t==null?void 0:t.description,effects:i,gradient:c,keyframes:(m==null?void 0:m.keyframes)??"",label:(t==null?void 0:t.label)??o,name:o}},N=(e,a={})=>{const r=a.recipes??G,n={},o={},s={},t={},l=[];for(const h of r){const c=S(e,h,{animations:a.animations,effects:a.effects,morph:a.morph,prefix:a.prefix,registry:a.registry});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))}return{animations:s,cssText:$(t),cssVars:t,effects:o,gradients:n,keyframes:l.join(`
9
- `)}},q=(e,a={})=>{var i,m;const{className:r,id:n,recipe:o="glare",...s}=a,t=S(e,o,s),l=t.gradient.model&&a.effects&&a.morph?g.createGradientMorphBlobs(t.gradient.model,a.morph):void 0,h=n??`g-gradient-${t.name}-${p(y({options:a,seed:e}))}`,c=r??h,d={backgroundImage:`var(${t.gradient.cssVar})`};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})`),{animation:t.animation,className:c,cssText:j(c,t.cssVars,d,t.keyframes),cssVars:t.cssVars,effects:t.effects,gradient:t.gradient,id:h,keyframes:t.keyframes,morphBlobs:l,preset:t,style:d}};exports.createGradientMaterial=q;exports.createGradientPreset=S;exports.createGradientTokens=N;
@@ -1,204 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- "use strict";const s=(t,r=0,o=1)=>Math.min(o,Math.max(r,t)),T=t=>{const r=t.slice(1),o=r.length===3||r.length===4?r.slice(0,3).split("").map(n=>n.repeat(2)).join(""):r.slice(0,6);return o.length!==6||!/^[\da-f]{6}$/i.test(o)?null:{r:parseInt(o.slice(0,2),16),g:parseInt(o.slice(2,4),16),b:parseInt(o.slice(4,6),16)}},m=t=>{const r=t.match(/^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i);return r?{r:s(Number(r[1]),0,255),g:s(Number(r[2]),0,255),b:s(Number(r[3]),0,255)}:null},e=t=>{if(typeof t=="number"){const o=t&16777215;return{r:o>>16&255,g:o>>8&255,b:o&255}}const r=t.trim();return r.startsWith("#")?T(r):r.toLowerCase().startsWith("rgb")?m(r):null},a=({r:t,g:r,b:o})=>`#${[t,r,o].map(n=>Math.round(n).toString(16).padStart(2,"0")).join("")}`,c=({r:t,g:r,b:o})=>`${Math.round(t)}, ${Math.round(r)}, ${Math.round(o)}`,p=(t,r)=>{const o=e(t)??e(r);if(!o)throw new Error(`Invalid fallback color: ${r}`);return a(o)};const u="center",I="farthest-corner",D=(t=135)=>typeof t=="number"?`${t}deg`:t,h=t=>typeof t=="number"?`${t}px`:t,E=t=>typeof t=="number"?`${t}ms`:t,i=(t,r=0,o=1)=>Math.min(o,Math.max(r,t)),l=(t,r)=>{if(r===void 0)return t;const o=e(t);return o?`rgb(${c(o).replace(/,/g,"")} / ${i(r)})`:t},g=({color:t,opacity:r,position:o})=>`${l(t,r)} ${o}%`,f=(t,r,o)=>({color:t,position:r}),C=t=>{if(t.length<=1)return t;const r=t.map(n=>({...n,position:n.position/2})),o=[...t].reverse().map(n=>({...n,position:100-n.position/2}));return[...r,...o]};exports.DEFAULT_GRADIENT_DIRECTION=135;exports.DEFAULT_GRADIENT_POSITION=u;exports.DEFAULT_GRADIENT_SIZE=I;exports.clamp=i;exports.colorToHex=p;exports.createStop=f;exports.formatStop=g;exports.getConicStops=C;exports.normalizeDirection=D;exports.parseColor=e;exports.rgbToChannels=c;exports.rgbToHex=a;exports.toCssColor=l;exports.toCssDuration=E;exports.toCssLength=h;
@@ -1,67 +0,0 @@
1
- const e = (t, r = 0, n = 1) => Math.min(n, Math.max(r, t)), a = (t) => {
2
- const r = t.slice(1), n = r.length === 3 || r.length === 4 ? r.slice(0, 3).split("").map((s) => s.repeat(2)).join("") : r.slice(0, 6);
3
- return n.length !== 6 || !/^[\da-f]{6}$/i.test(n) ? null : {
4
- r: parseInt(n.slice(0, 2), 16),
5
- g: parseInt(n.slice(2, 4), 16),
6
- b: parseInt(n.slice(4, 6), 16)
7
- };
8
- }, c = (t) => {
9
- const r = t.match(
10
- /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i
11
- );
12
- return r ? {
13
- r: e(Number(r[1]), 0, 255),
14
- g: e(Number(r[2]), 0, 255),
15
- b: e(Number(r[3]), 0, 255)
16
- } : null;
17
- }, o = (t) => {
18
- if (typeof t == "number") {
19
- const n = t & 16777215;
20
- return {
21
- r: n >> 16 & 255,
22
- g: n >> 8 & 255,
23
- b: n & 255
24
- };
25
- }
26
- const r = t.trim();
27
- return r.startsWith("#") ? a(r) : r.toLowerCase().startsWith("rgb") ? c(r) : null;
28
- }, i = ({ r: t, g: r, b: n }) => `#${[t, r, n].map((s) => Math.round(s).toString(16).padStart(2, "0")).join("")}`, l = ({ r: t, g: r, b: n }) => `${Math.round(t)}, ${Math.round(r)}, ${Math.round(n)}`, p = (t, r) => {
29
- const n = o(t) ?? o(r);
30
- if (!n)
31
- throw new Error(`Invalid fallback color: ${r}`);
32
- return i(n);
33
- }, h = 135, f = "center", g = "farthest-corner", b = (t = 135) => typeof t == "number" ? `${t}deg` : t, d = (t) => typeof t == "number" ? `${t}px` : t, I = (t) => typeof t == "number" ? `${t}ms` : t, u = (t, r = 0, n = 1) => Math.min(n, Math.max(r, t)), m = (t, r) => {
34
- if (r === void 0) return t;
35
- const n = o(t);
36
- return n ? `rgb(${l(n).replace(/,/g, "")} / ${u(r)})` : t;
37
- }, $ = ({ color: t, opacity: r, position: n }) => `${m(t, r)} ${n}%`, T = (t, r, n) => ({
38
- color: t,
39
- position: r
40
- }), D = (t) => {
41
- if (t.length <= 1) return t;
42
- const r = t.map((s) => ({
43
- ...s,
44
- position: s.position / 2
45
- })), n = [...t].reverse().map((s) => ({
46
- ...s,
47
- position: 100 - s.position / 2
48
- }));
49
- return [...r, ...n];
50
- };
51
- export {
52
- h as D,
53
- i as a,
54
- u as b,
55
- p as c,
56
- g as d,
57
- f as e,
58
- $ as f,
59
- D as g,
60
- T as h,
61
- m as i,
62
- d as j,
63
- b as n,
64
- o as p,
65
- l as r,
66
- I as t
67
- };