@gradient-ui/gradient-engine 0.5.0 → 1.0.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 (89) hide show
  1. package/README.md +19 -5
  2. package/dist/animation.cjs +13 -13
  3. package/dist/animation.mjs +36 -36
  4. package/dist/core.cjs +1 -1
  5. package/dist/core.mjs +17 -14
  6. package/dist/css-B3xGfmW1.js +17 -0
  7. package/dist/css-CREh0Awz.cjs +1 -0
  8. package/dist/design-tokens.cjs +1 -0
  9. package/dist/design-tokens.mjs +8 -0
  10. package/dist/designTokens-Bw-HZ1f1.js +116 -0
  11. package/dist/designTokens-DsIk5RSi.cjs +1 -0
  12. package/dist/effects.cjs +137 -32
  13. package/dist/effects.mjs +225 -108
  14. package/dist/formatters.cjs +1 -1
  15. package/dist/formatters.mjs +33 -33
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.mjs +63 -43
  18. package/dist/material.cjs +9 -1
  19. package/dist/material.mjs +236 -4
  20. package/dist/presets-DA-6KYJh.cjs +316 -0
  21. package/dist/presets-Du6aTLtD.js +4025 -0
  22. package/dist/svg-B2CaHCLv.js +118 -0
  23. package/dist/svg-BtMrj3fP.cjs +32 -0
  24. package/dist/types/animation/css.d.ts +2 -2
  25. package/dist/types/animation/index.d.ts +1 -1
  26. package/dist/types/color.d.ts +1 -0
  27. package/dist/types/colorSeeds.d.ts +22 -0
  28. package/dist/types/colorSystem.d.ts +20 -0
  29. package/dist/types/core.d.ts +7 -7
  30. package/dist/types/designTokens.d.ts +24 -0
  31. package/dist/types/effects/index.d.ts +2 -2
  32. package/dist/types/effects/morph.d.ts +4 -1
  33. package/dist/types/effects/shadow.d.ts +1 -1
  34. package/dist/types/formatters/canvas.d.ts +1 -1
  35. package/dist/types/formatters/css.d.ts +1 -1
  36. package/dist/types/formatters/index.d.ts +3 -3
  37. package/dist/types/formatters/svg.d.ts +1 -1
  38. package/dist/types/index.d.ts +11 -7
  39. package/dist/types/material.d.ts +1 -1
  40. package/dist/types/model.d.ts +3 -3
  41. package/dist/types/palette.d.ts +8 -1
  42. package/dist/types/presets.d.ts +1 -1
  43. package/dist/types/recipes.d.ts +12 -12
  44. package/dist/types/scheme.d.ts +3 -0
  45. package/dist/types/tokens.d.ts +11 -3
  46. package/dist/types/types.d.ts +11 -1
  47. package/dist/types/utils.d.ts +1 -1
  48. package/dist/types-B0eCazk8.js +22 -0
  49. package/dist/types-BFkUlDkW.cjs +1 -0
  50. package/dist/types-cjs/animation/css.d.cts +12 -0
  51. package/dist/types-cjs/animation/index.d.cts +1 -0
  52. package/dist/types-cjs/color.d.cts +11 -0
  53. package/dist/types-cjs/colorMath.d.cts +3 -0
  54. package/dist/types-cjs/colorSeeds.d.cts +22 -0
  55. package/dist/types-cjs/colorSystem.d.cts +20 -0
  56. package/dist/types-cjs/constants.d.cts +3 -0
  57. package/dist/types-cjs/core.d.cts +9 -0
  58. package/dist/types-cjs/designTokens.d.cts +24 -0
  59. package/dist/types-cjs/effects/index.d.cts +2 -0
  60. package/dist/types-cjs/effects/morph.d.cts +8 -0
  61. package/dist/types-cjs/effects/shadow.d.cts +3 -0
  62. package/dist/types-cjs/formatters/canvas.d.cts +2 -0
  63. package/dist/types-cjs/formatters/css.d.cts +3 -0
  64. package/dist/types-cjs/formatters/index.d.cts +3 -0
  65. package/dist/types-cjs/formatters/svg.d.cts +5 -0
  66. package/dist/types-cjs/index.d.cts +11 -0
  67. package/dist/types-cjs/material.d.cts +1 -0
  68. package/dist/types-cjs/model.d.cts +5 -0
  69. package/dist/types-cjs/package.json +3 -0
  70. package/dist/types-cjs/palette.d.cts +13 -0
  71. package/dist/types-cjs/presets.d.cts +239 -0
  72. package/dist/types-cjs/recipes.d.cts +14 -0
  73. package/dist/types-cjs/scheme.d.cts +3 -0
  74. package/dist/types-cjs/tokens.d.cts +107 -0
  75. package/dist/types-cjs/types.d.cts +127 -0
  76. package/dist/types-cjs/utils.d.cts +10 -0
  77. package/dist/utils-Bry9BTmj.cjs +1 -0
  78. package/dist/utils-VaqPefmS.js +76 -0
  79. package/package.json +64 -20
  80. package/dist/css-CaOuUhfh.js +0 -17
  81. package/dist/css-YuAJQW13.cjs +0 -1
  82. package/dist/presets-55krt4L_.js +0 -354
  83. package/dist/presets-UIJJyagu.cjs +0 -1
  84. package/dist/svg-BVcl24Cf.cjs +0 -32
  85. package/dist/svg-CZThYPKf.js +0 -118
  86. package/dist/tokens-DMGI7_df.cjs +0 -9
  87. package/dist/tokens-OfSofVKl.js +0 -204
  88. package/dist/utils-6iJ6IpZZ.cjs +0 -1
  89. package/dist/utils-B_VQDGMy.js +0 -67
@@ -0,0 +1,76 @@
1
+ const clamp$1 = (value, min = 0, max = 1) => Math.min(max, Math.max(min, value)), toLinear = (value) => {
2
+ const channel = value / 255;
3
+ return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
4
+ }, parseHex = (value) => {
5
+ const hex = value.slice(1), normalized = hex.length === 3 || hex.length === 4 ? hex.slice(0, 3).split("").map((character) => character.repeat(2)).join("") : hex.slice(0, 6);
6
+ return normalized.length !== 6 || !/^[\da-f]{6}$/i.test(normalized) ? null : {
7
+ r: parseInt(normalized.slice(0, 2), 16),
8
+ g: parseInt(normalized.slice(2, 4), 16),
9
+ b: parseInt(normalized.slice(4, 6), 16)
10
+ };
11
+ }, parseRgb = (value) => {
12
+ const match = value.match(
13
+ /^rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:\s*[,/]\s*[\d.]+%?)?\s*\)$/i
14
+ );
15
+ return match ? {
16
+ r: clamp$1(Number(match[1]), 0, 255),
17
+ g: clamp$1(Number(match[2]), 0, 255),
18
+ b: clamp$1(Number(match[3]), 0, 255)
19
+ } : null;
20
+ }, parseColor = (input) => {
21
+ if (typeof input == "number") {
22
+ const value2 = input & 16777215;
23
+ return {
24
+ r: value2 >> 16 & 255,
25
+ g: value2 >> 8 & 255,
26
+ b: value2 & 255
27
+ };
28
+ }
29
+ const value = input.trim();
30
+ return value.startsWith("#") ? parseHex(value) : value.toLowerCase().startsWith("rgb") ? parseRgb(value) : null;
31
+ }, rgbToHex = ({ r, g, b }) => `#${[r, g, b].map((channel) => Math.round(channel).toString(16).padStart(2, "0")).join("")}`, rgbToChannels = ({ r, g, b }) => `${Math.round(r)}, ${Math.round(g)}, ${Math.round(b)}`, colorToHex = (input, fallback) => {
32
+ const color = parseColor(input) ?? parseColor(fallback);
33
+ if (!color)
34
+ throw new Error(`Invalid fallback color: ${fallback}`);
35
+ return rgbToHex(color);
36
+ }, relativeLuminance = (color) => 0.2126 * toLinear(color.r) + 0.7152 * toLinear(color.g) + 0.0722 * toLinear(color.b), getContrastingColor = (color) => {
37
+ const parsed = parseColor(color);
38
+ if (!parsed) return "#ffffff";
39
+ const luminance = relativeLuminance(parsed), whiteContrast = 1.05 / (luminance + 0.05), darkContrast = (luminance + 0.05) / 0.055;
40
+ return whiteContrast >= darkContrast ? "#ffffff" : "#0d0d12";
41
+ }, DEFAULT_GRADIENT_DIRECTION = 135, DEFAULT_GRADIENT_POSITION = "center", DEFAULT_GRADIENT_SIZE = "farthest-corner", normalizeDirection = (direction = 135) => typeof direction == "number" ? `${direction}deg` : direction, toCssLength = (value) => typeof value == "number" ? `${value}px` : value, toCssDuration = (value) => typeof value == "number" ? `${value}ms` : value, clamp = (value, min = 0, max = 1) => Math.min(max, Math.max(min, value)), toCssColor = (color, opacity) => {
42
+ if (opacity === void 0) return color;
43
+ const parsed = parseColor(color);
44
+ return parsed ? `rgb(${rgbToChannels(parsed).replace(/,/g, "")} / ${clamp(opacity)})` : color;
45
+ }, formatStop = ({ color, opacity, position }) => `${toCssColor(color, opacity)} ${position}%`, createStop = (color, position, opacity) => ({
46
+ color,
47
+ position
48
+ }), getConicStops = (stops) => {
49
+ if (stops.length <= 1) return stops;
50
+ const firstHalf = stops.map((stop) => ({
51
+ ...stop,
52
+ position: stop.position / 2
53
+ })), secondHalf = [...stops].reverse().map((stop) => ({
54
+ ...stop,
55
+ position: 100 - stop.position / 2
56
+ }));
57
+ return [...firstHalf, ...secondHalf];
58
+ };
59
+ export {
60
+ DEFAULT_GRADIENT_DIRECTION as D,
61
+ rgbToHex as a,
62
+ clamp as b,
63
+ colorToHex as c,
64
+ DEFAULT_GRADIENT_SIZE as d,
65
+ DEFAULT_GRADIENT_POSITION as e,
66
+ formatStop as f,
67
+ getContrastingColor as g,
68
+ getConicStops as h,
69
+ createStop as i,
70
+ toCssLength as j,
71
+ toCssColor as k,
72
+ normalizeDirection as n,
73
+ parseColor as p,
74
+ rgbToChannels as r,
75
+ toCssDuration as t
76
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gradient-ui/gradient-engine",
3
- "version": "0.5.0",
3
+ "version": "1.0.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Framework-free gradient generation engine for CSS, SVG, canvas, effects and material tokens.",
@@ -46,34 +46,74 @@
46
46
  },
47
47
  "exports": {
48
48
  ".": {
49
- "types": "./dist/types/index.d.ts",
50
- "import": "./dist/index.mjs",
51
- "require": "./dist/index.cjs"
49
+ "import": {
50
+ "types": "./dist/types/index.d.ts",
51
+ "default": "./dist/index.mjs"
52
+ },
53
+ "require": {
54
+ "types": "./dist/types-cjs/index.d.cts",
55
+ "default": "./dist/index.cjs"
56
+ }
52
57
  },
53
58
  "./core": {
54
- "types": "./dist/types/core.d.ts",
55
- "import": "./dist/core.mjs",
56
- "require": "./dist/core.cjs"
59
+ "import": {
60
+ "types": "./dist/types/core.d.ts",
61
+ "default": "./dist/core.mjs"
62
+ },
63
+ "require": {
64
+ "types": "./dist/types-cjs/core.d.cts",
65
+ "default": "./dist/core.cjs"
66
+ }
57
67
  },
58
68
  "./formatters": {
59
- "types": "./dist/types/formatters/index.d.ts",
60
- "import": "./dist/formatters.mjs",
61
- "require": "./dist/formatters.cjs"
69
+ "import": {
70
+ "types": "./dist/types/formatters/index.d.ts",
71
+ "default": "./dist/formatters.mjs"
72
+ },
73
+ "require": {
74
+ "types": "./dist/types-cjs/formatters/index.d.cts",
75
+ "default": "./dist/formatters.cjs"
76
+ }
62
77
  },
63
78
  "./effects": {
64
- "types": "./dist/types/effects/index.d.ts",
65
- "import": "./dist/effects.mjs",
66
- "require": "./dist/effects.cjs"
79
+ "import": {
80
+ "types": "./dist/types/effects/index.d.ts",
81
+ "default": "./dist/effects.mjs"
82
+ },
83
+ "require": {
84
+ "types": "./dist/types-cjs/effects/index.d.cts",
85
+ "default": "./dist/effects.cjs"
86
+ }
67
87
  },
68
88
  "./animation": {
69
- "types": "./dist/types/animation/index.d.ts",
70
- "import": "./dist/animation.mjs",
71
- "require": "./dist/animation.cjs"
89
+ "import": {
90
+ "types": "./dist/types/animation/index.d.ts",
91
+ "default": "./dist/animation.mjs"
92
+ },
93
+ "require": {
94
+ "types": "./dist/types-cjs/animation/index.d.cts",
95
+ "default": "./dist/animation.cjs"
96
+ }
72
97
  },
73
98
  "./material": {
74
- "types": "./dist/types/material.d.ts",
75
- "import": "./dist/material.mjs",
76
- "require": "./dist/material.cjs"
99
+ "import": {
100
+ "types": "./dist/types/material.d.ts",
101
+ "default": "./dist/material.mjs"
102
+ },
103
+ "require": {
104
+ "types": "./dist/types-cjs/material.d.cts",
105
+ "default": "./dist/material.cjs"
106
+ }
107
+ },
108
+ "./design-tokens": {
109
+ "import": {
110
+ "types": "./dist/types/designTokens.d.ts",
111
+ "default": "./dist/design-tokens.mjs"
112
+ },
113
+ "require": {
114
+ "types": "./dist/types-cjs/designTokens.d.cts",
115
+ "default": "./dist/design-tokens.cjs"
116
+ }
77
117
  },
78
118
  "./package.json": "./package.json"
79
119
  },
@@ -94,14 +134,18 @@
94
134
  "material": [
95
135
  "dist/types/material.d.ts"
96
136
  ],
137
+ "design-tokens": [
138
+ "dist/types/designTokens.d.ts"
139
+ ],
97
140
  "*": [
98
141
  "dist/types/index.d.ts"
99
142
  ]
100
143
  }
101
144
  },
102
145
  "scripts": {
103
- "build": "vite build --config vite.config.ts && tsc -p tsconfig.json --emitDeclarationOnly",
146
+ "build": "node ../../scripts/clean-build-output.mjs dist && vite build --config vite.config.ts && tsc -p tsconfig.json --emitDeclarationOnly && node ../../scripts/prepare-dual-declarations.mjs dist --node-extensions",
104
147
  "pack:dry": "npm pack --dry-run",
148
+ "prepack": "npm run build",
105
149
  "type-check": "tsc -p tsconfig.json --noEmit"
106
150
  },
107
151
  "dependencies": {
@@ -1,17 +0,0 @@
1
- import { D as p, n as c, f as a, d as e, e as r, g as D } from "./utils-B_VQDGMy.js";
2
- const $ = (t, i = p) => `linear-gradient(${c(i)}, ${t.join(", ")})`, I = (t) => {
3
- const i = t.stops.map(a).join(", ");
4
- if (t.type === "radial") {
5
- const s = t.shape ?? "ellipse", n = t.size ?? e, o = t.position ?? r;
6
- return `radial-gradient(${s} ${n} at ${o}, ${i})`;
7
- }
8
- if (t.type === "conic") {
9
- const s = c(t.direction), n = t.position ?? r, o = D(t.stops).map(a).join(", ");
10
- return `conic-gradient(from ${s} at ${n}, ${o})`;
11
- }
12
- return $(t.stops.map(a), t.direction);
13
- };
14
- export {
15
- $ as c,
16
- I as t
17
- };
@@ -1 +0,0 @@
1
- "use strict";const i=require("./utils-6iJ6IpZZ.cjs"),a=(t,n=i.DEFAULT_GRADIENT_DIRECTION)=>`linear-gradient(${i.normalizeDirection(n)}, ${t.join(", ")})`,e=t=>{const n=t.stops.map(i.formatStop).join(", ");if(t.type==="radial"){const o=t.shape??"ellipse",s=t.size??i.DEFAULT_GRADIENT_SIZE,r=t.position??i.DEFAULT_GRADIENT_POSITION;return`radial-gradient(${o} ${s} at ${r}, ${n})`}if(t.type==="conic"){const o=i.normalizeDirection(t.direction),s=t.position??i.DEFAULT_GRADIENT_POSITION,r=i.getConicStops(t.stops).map(i.formatStop).join(", ");return`conic-gradient(from ${o} at ${s}, ${r})`}return a(t.stops.map(i.formatStop),t.direction)};exports.createLinearGradient=a;exports.toCssGradient=e;
@@ -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,32 +0,0 @@
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;