@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,354 @@
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
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,32 @@
1
+ "use strict";const $=require("./utils-6iJ6IpZZ.cjs"),B=require("./css-YuAJQW13.cjs"),p="http://www.w3.org/2000/svg",G="http://www.w3.org/1999/xhtml",c=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),x=e=>{const t=e.opacity===void 0?"":` stop-opacity="${$.clamp(e.opacity)}"`;return`<stop offset="${e.position}%" stop-color="${e.color}"${t} />`},P=(e,t)=>{var r,a,i;return{active:t.activeStroke??((r=e.stops[Math.max(0,Math.floor(e.stops.length/2))])==null?void 0:r.color)??((a=e.stops[0])==null?void 0:a.color)??"currentColor",background:t.backgroundStroke??((i=e.stops[0])==null?void 0:i.color)??t.activeStroke??"currentColor"}},A=(e,t)=>{var n;const r=(n=e.match(/\bviewBox=(["'])(.*?)\1/i))==null?void 0:n[2];if(r)return r;const a=t.width??240,i=t.height??120;return`0 0 ${a} ${i}`},N=e=>{var t;return((t=e.replace(/<\?xml[\s\S]*?\?>/gi,"").replace(/<!doctype[\s\S]*?>/gi,"").match(/<svg\b[^>]*>([\s\S]*?)<\/svg>/i))==null?void 0:t[1].trim())??e},j=e=>{const t=e.trim().split(/(?=M\s*[-+.\d])/).map(r=>r.trim()).filter(Boolean);return t.length>1?t:[e]},O=e=>[...e.matchAll(/<path\b[^>]*\sd=(["'])([\s\S]*?)\1/gi)].flatMap(t=>j(t[2])),v=e=>{var t;return Math.max(1,((t=e.match(/[LlHhVvCcSsQqTtAaZz]/g))==null?void 0:t.length)??0)},T=(e,t)=>{const a=.5+(1-v(e)/t)*.22;return Math.round(a*1e3)/1e3},k=e=>{const[t="0",r="0",a="240",i="120"]=e.trim().split(/[\s,]+/);return{height:Number(i)||120,width:Number(a)||240,x:Number(t)||0,y:Number(r)||0}},V=(e,t,r)=>{if(r.viewBoxPadding===!1)return e;const a=k(e),i=Math.max(t*2,Math.min(a.width,a.height)*.02),n=r.viewBoxPadding??i;return[a.x-n,a.y-n,a.width+n*2,a.height+n*2].join(" ")},W=e=>{const{height:t,width:r}=k(e);return{height:Number(t)||120,width:Number(r)||240}},U=(e,t,r)=>{if(r.normalizeStrokeWidth===!1)return e;const{height:a,width:i}=W(t),n=r.strokeWidthBase??180;return e*(Math.min(i,a)/n)},S=(e,t={})=>{const r=t.id??"g-gradient",a=e.stops.map(x).join("");return e.type==="radial"?`<radialGradient id="${r}" cx="${t.cx??"50%"}" cy="${t.cy??"50%"}" r="${t.r??"75%"}">${a}</radialGradient>`:e.type==="conic"?`<pattern id="${r}" patternUnits="objectBoundingBox" width="1" height="1"><foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="${G}" style="width:100%;height:100%;background:${c(B.toCssGradient(e))};"></div></foreignObject></pattern>`:`<linearGradient id="${r}" x1="${t.x1??"0%"}" y1="${t.y1??"0%"}" x2="${t.x2??"100%"}" y2="${t.y2??"100%"}">${a}</linearGradient>`},q=(e,t={})=>{const r=t.id??"g-gradient",a=t.width??240,i=t.height??120,n=t.rx??18;return`<svg xmlns="${p}" viewBox="0 0 ${a} ${i}" role="img">
2
+ <defs>
3
+ ${S(e,t)}
4
+ </defs>
5
+ <rect width="${a}" height="${i}" rx="${n}" fill="url(#${r})" />
6
+ </svg>`},z=(e,t,r={})=>{const i=`${r.id??"g-gradient-source"}-stroke`,n=A(e,r),d=N(e),o=O(e),s=U(r.strokeWidth??1.4,n,r),h=V(n,s,r),{width:m,x:g}=k(h),l=r.linecap??"round",u=$.toCssDuration(r.duration??3600),w=r.repeatCount??"indefinite",b=r.sourceOpacity??.22,M=t.stops.map(x).join(""),C=Math.max(...o.map(v));return`<svg xmlns="${p}" viewBox="${c(h)}" role="img">
7
+ <defs>
8
+ <linearGradient id="${i}" gradientUnits="userSpaceOnUse" x1="${g}" y1="0" x2="${g+m}" y2="0">
9
+ ${M}
10
+ </linearGradient>
11
+ </defs>
12
+ <g opacity="${$.clamp(b)}">
13
+ ${d}
14
+ </g>
15
+ <g fill="none" stroke="url(#${i})" stroke-width="${s}" stroke-linecap="${l}" stroke-linejoin="round">
16
+ ${o.map(y=>{const f=T(y,C);return`<path d="${c(y)}" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="0">
17
+ <animate attributeName="stroke-dasharray" values="0 100;100 100;0 100" keyTimes="0;${f};1" dur="${u}" repeatCount="${w}" calcMode="linear" />
18
+ <animate attributeName="stroke-dashoffset" values="0;0;-100" keyTimes="0;${f};1" dur="${u}" repeatCount="${w}" calcMode="linear" />
19
+ </path>`}).join(`
20
+ `)}
21
+ </g>
22
+ </svg>`},E=(e,t={})=>{const a=`${t.id??"g-gradient-path"}-stroke`,i=t.width??240,n=t.height??120,d=t.path??`M 20 ${n*.64} C ${i*.28} ${n*.18}, ${i*.58} ${n*.18}, ${i-20} ${n*.64}`,o=t.strokeWidth??12,s=t.linecap??"round",h=$.toCssDuration(t.duration??2800),m=t.repeatCount??"indefinite",g=t.backgroundOpacity??.24,l=P(e,t),u=e.stops.map(x).join("");return`<svg xmlns="${p}" viewBox="0 0 ${i} ${n}" role="img">
23
+ <defs>
24
+ <linearGradient id="${a}" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="${i}" y2="0">
25
+ ${u}
26
+ </linearGradient>
27
+ </defs>
28
+ <path d="${c(d)}" fill="none" stroke="${l.background}" stroke-width="${o}" stroke-linecap="${s}" opacity="${g}" />
29
+ <path d="${c(d)}" fill="none" stroke="${t.activeStroke?l.active:`url(#${a})`}" stroke-width="${o}" stroke-linecap="${s}" pathLength="100" stroke-dasharray="100 100" stroke-dashoffset="100">
30
+ <animate attributeName="stroke-dashoffset" values="100;0;-100" dur="${h}" repeatCount="${m}" />
31
+ </path>
32
+ </svg>`};exports.toSvgGradient=S;exports.toSvgGradientMarkup=q;exports.toSvgPathAnimationMarkup=E;exports.toSvgSourceAnimationMarkup=z;
@@ -0,0 +1,118 @@
1
+ import { t as y, b as v } from "./utils-B_VQDGMy.js";
2
+ import { t as C } from "./css-CaOuUhfh.js";
3
+ const m = "http://www.w3.org/2000/svg", G = "http://www.w3.org/1999/xhtml", c = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), p = (e) => {
4
+ const t = e.opacity === void 0 ? "" : ` stop-opacity="${v(e.opacity)}"`;
5
+ return `<stop offset="${e.position}%" stop-color="${e.color}"${t} />`;
6
+ }, N = (e, t) => {
7
+ var r, a, i;
8
+ return {
9
+ active: t.activeStroke ?? ((r = e.stops[Math.max(0, Math.floor(e.stops.length / 2))]) == null ? void 0 : r.color) ?? ((a = e.stops[0]) == null ? void 0 : a.color) ?? "currentColor",
10
+ background: t.backgroundStroke ?? ((i = e.stops[0]) == null ? void 0 : i.color) ?? t.activeStroke ?? "currentColor"
11
+ };
12
+ }, P = (e, t) => {
13
+ var n;
14
+ const r = (n = e.match(/\bviewBox=(["'])(.*?)\1/i)) == null ? void 0 : n[2];
15
+ if (r) return r;
16
+ const a = t.width ?? 240, i = t.height ?? 120;
17
+ return `0 0 ${a} ${i}`;
18
+ }, A = (e) => {
19
+ var t;
20
+ return ((t = e.replace(/<\?xml[\s\S]*?\?>/gi, "").replace(/<!doctype[\s\S]*?>/gi, "").match(/<svg\b[^>]*>([\s\S]*?)<\/svg>/i)) == null ? void 0 : t[1].trim()) ?? e;
21
+ }, j = (e) => {
22
+ const t = e.trim().split(/(?=M\s*[-+.\d])/).map((r) => r.trim()).filter(Boolean);
23
+ return t.length > 1 ? t : [e];
24
+ }, O = (e) => [...e.matchAll(/<path\b[^>]*\sd=(["'])([\s\S]*?)\1/gi)].flatMap(
25
+ (t) => j(t[2])
26
+ ), b = (e) => {
27
+ var t;
28
+ return Math.max(1, ((t = e.match(/[LlHhVvCcSsQqTtAaZz]/g)) == null ? void 0 : t.length) ?? 0);
29
+ }, T = (e, t) => {
30
+ const a = 0.5 + (1 - b(e) / t) * 0.22;
31
+ return Math.round(a * 1e3) / 1e3;
32
+ }, x = (e) => {
33
+ const [t = "0", r = "0", a = "240", i = "120"] = e.trim().split(/[\s,]+/);
34
+ return {
35
+ height: Number(i) || 120,
36
+ width: Number(a) || 240,
37
+ x: Number(t) || 0,
38
+ y: Number(r) || 0
39
+ };
40
+ }, V = (e, t, r) => {
41
+ if (r.viewBoxPadding === !1) return e;
42
+ const a = x(e), i = Math.max(
43
+ t * 2,
44
+ Math.min(a.width, a.height) * 0.02
45
+ ), n = r.viewBoxPadding ?? i;
46
+ return [
47
+ a.x - n,
48
+ a.y - n,
49
+ a.width + n * 2,
50
+ a.height + n * 2
51
+ ].join(" ");
52
+ }, W = (e) => {
53
+ const { height: t, width: r } = x(e);
54
+ return {
55
+ height: Number(t) || 120,
56
+ width: Number(r) || 240
57
+ };
58
+ }, U = (e, t, r) => {
59
+ if (r.normalizeStrokeWidth === !1) return e;
60
+ const { height: a, width: i } = W(t), n = r.strokeWidthBase ?? 180;
61
+ return e * (Math.min(i, a) / n);
62
+ }, z = (e, t = {}) => {
63
+ const r = t.id ?? "g-gradient", a = e.stops.map(p).join("");
64
+ return e.type === "radial" ? `<radialGradient id="${r}" cx="${t.cx ?? "50%"}" cy="${t.cy ?? "50%"}" r="${t.r ?? "75%"}">${a}</radialGradient>` : e.type === "conic" ? `<pattern id="${r}" patternUnits="objectBoundingBox" width="1" height="1"><foreignObject x="0" y="0" width="100%" height="100%"><div xmlns="${G}" style="width:100%;height:100%;background:${c(C(e))};"></div></foreignObject></pattern>` : `<linearGradient id="${r}" x1="${t.x1 ?? "0%"}" y1="${t.y1 ?? "0%"}" x2="${t.x2 ?? "100%"}" y2="${t.y2 ?? "100%"}">${a}</linearGradient>`;
65
+ }, q = (e, t = {}) => {
66
+ const r = t.id ?? "g-gradient", a = t.width ?? 240, i = t.height ?? 120, n = t.rx ?? 18;
67
+ return `<svg xmlns="${m}" viewBox="0 0 ${a} ${i}" role="img">
68
+ <defs>
69
+ ${z(e, t)}
70
+ </defs>
71
+ <rect width="${a}" height="${i}" rx="${n}" fill="url(#${r})" />
72
+ </svg>`;
73
+ }, D = (e, t, r = {}) => {
74
+ const i = `${r.id ?? "g-gradient-source"}-stroke`, n = P(e, r), d = A(e), s = O(e), o = U(
75
+ r.strokeWidth ?? 1.4,
76
+ n,
77
+ r
78
+ ), h = V(n, o, r), { width: $, x: g } = x(h), l = r.linecap ?? "round", u = y(r.duration ?? 3600), k = r.repeatCount ?? "indefinite", S = r.sourceOpacity ?? 0.22, M = t.stops.map(p).join(""), B = Math.max(...s.map(b));
79
+ return `<svg xmlns="${m}" viewBox="${c(h)}" role="img">
80
+ <defs>
81
+ <linearGradient id="${i}" gradientUnits="userSpaceOnUse" x1="${g}" y1="0" x2="${g + $}" y2="0">
82
+ ${M}
83
+ </linearGradient>
84
+ </defs>
85
+ <g opacity="${v(S)}">
86
+ ${d}
87
+ </g>
88
+ <g fill="none" stroke="url(#${i})" stroke-width="${o}" stroke-linecap="${l}" stroke-linejoin="round">
89
+ ${s.map((w) => {
90
+ const f = T(w, B);
91
+ return `<path d="${c(w)}" pathLength="100" stroke-dasharray="0 100" stroke-dashoffset="0">
92
+ <animate attributeName="stroke-dasharray" values="0 100;100 100;0 100" keyTimes="0;${f};1" dur="${u}" repeatCount="${k}" calcMode="linear" />
93
+ <animate attributeName="stroke-dashoffset" values="0;0;-100" keyTimes="0;${f};1" dur="${u}" repeatCount="${k}" calcMode="linear" />
94
+ </path>`;
95
+ }).join(`
96
+ `)}
97
+ </g>
98
+ </svg>`;
99
+ }, H = (e, t = {}) => {
100
+ const a = `${t.id ?? "g-gradient-path"}-stroke`, i = t.width ?? 240, n = t.height ?? 120, d = t.path ?? `M 20 ${n * 0.64} C ${i * 0.28} ${n * 0.18}, ${i * 0.58} ${n * 0.18}, ${i - 20} ${n * 0.64}`, s = t.strokeWidth ?? 12, o = t.linecap ?? "round", h = y(t.duration ?? 2800), $ = t.repeatCount ?? "indefinite", g = t.backgroundOpacity ?? 0.24, l = N(e, t), u = e.stops.map(p).join("");
101
+ return `<svg xmlns="${m}" viewBox="0 0 ${i} ${n}" role="img">
102
+ <defs>
103
+ <linearGradient id="${a}" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="${i}" y2="0">
104
+ ${u}
105
+ </linearGradient>
106
+ </defs>
107
+ <path d="${c(d)}" fill="none" stroke="${l.background}" stroke-width="${s}" stroke-linecap="${o}" opacity="${g}" />
108
+ <path d="${c(d)}" fill="none" stroke="${t.activeStroke ? l.active : `url(#${a})`}" stroke-width="${s}" stroke-linecap="${o}" pathLength="100" stroke-dasharray="100 100" stroke-dashoffset="100">
109
+ <animate attributeName="stroke-dashoffset" values="100;0;-100" dur="${h}" repeatCount="${$}" />
110
+ </path>
111
+ </svg>`;
112
+ };
113
+ export {
114
+ q as a,
115
+ H as b,
116
+ D as c,
117
+ z as t
118
+ };
@@ -0,0 +1,9 @@
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;