@gradient-ui/gradient-engine 0.6.0 → 2.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.
- package/README.md +0 -6
- package/dist/animation.cjs +13 -13
- package/dist/animation.mjs +36 -36
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +17 -17
- package/dist/css-B3xGfmW1.js +17 -0
- package/dist/css-CREh0Awz.cjs +1 -0
- package/dist/design-tokens.cjs +1 -1
- package/dist/design-tokens.mjs +5 -5
- package/dist/designTokens-Bw-HZ1f1.js +116 -0
- package/dist/designTokens-DsIk5RSi.cjs +1 -0
- package/dist/effects.cjs +67 -67
- package/dist/effects.mjs +153 -153
- package/dist/formatters.cjs +1 -1
- package/dist/formatters.mjs +33 -33
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +63 -63
- package/dist/material.cjs +8 -8
- package/dist/material.mjs +170 -170
- package/dist/presets-DA-6KYJh.cjs +316 -0
- package/dist/presets-Du6aTLtD.js +4025 -0
- package/dist/svg-B2CaHCLv.js +118 -0
- package/dist/svg-BtMrj3fP.cjs +32 -0
- package/dist/types/animation/css.d.ts +2 -2
- package/dist/types/animation/index.d.ts +1 -1
- package/dist/types/colorSystem.d.ts +3 -3
- package/dist/types/core.d.ts +7 -7
- package/dist/types/designTokens.d.ts +4 -4
- package/dist/types/effects/index.d.ts +2 -2
- package/dist/types/effects/morph.d.ts +1 -1
- package/dist/types/effects/shadow.d.ts +1 -1
- package/dist/types/formatters/canvas.d.ts +1 -1
- package/dist/types/formatters/css.d.ts +1 -1
- package/dist/types/formatters/index.d.ts +3 -3
- package/dist/types/formatters/svg.d.ts +1 -1
- package/dist/types/index.d.ts +11 -11
- package/dist/types/material.d.ts +1 -1
- package/dist/types/model.d.ts +3 -3
- package/dist/types/palette.d.ts +1 -1
- package/dist/types/presets.d.ts +1 -1
- package/dist/types/recipes.d.ts +12 -12
- package/dist/types/tokens.d.ts +3 -3
- package/dist/types/types.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/{types-BFr1fN-7.js → types-B0eCazk8.js} +4 -4
- package/dist/types-BFkUlDkW.cjs +1 -0
- package/dist/types-cjs/animation/css.d.cts +12 -0
- package/dist/types-cjs/animation/index.d.cts +1 -0
- package/dist/types-cjs/color.d.cts +11 -0
- package/dist/types-cjs/colorMath.d.cts +3 -0
- package/dist/types-cjs/colorSeeds.d.cts +22 -0
- package/dist/types-cjs/colorSystem.d.cts +20 -0
- package/dist/types-cjs/constants.d.cts +3 -0
- package/dist/types-cjs/core.d.cts +9 -0
- package/dist/types-cjs/designTokens.d.cts +24 -0
- package/dist/types-cjs/effects/index.d.cts +2 -0
- package/dist/types-cjs/effects/morph.d.cts +8 -0
- package/dist/types-cjs/effects/shadow.d.cts +3 -0
- package/dist/types-cjs/formatters/canvas.d.cts +2 -0
- package/dist/types-cjs/formatters/css.d.cts +3 -0
- package/dist/types-cjs/formatters/index.d.cts +3 -0
- package/dist/types-cjs/formatters/svg.d.cts +5 -0
- package/dist/types-cjs/index.d.cts +11 -0
- package/dist/types-cjs/material.d.cts +1 -0
- package/dist/types-cjs/model.d.cts +5 -0
- package/dist/types-cjs/package.json +3 -0
- package/dist/types-cjs/palette.d.cts +13 -0
- package/dist/types-cjs/presets.d.cts +239 -0
- package/dist/types-cjs/recipes.d.cts +14 -0
- package/dist/types-cjs/scheme.d.cts +3 -0
- package/dist/types-cjs/tokens.d.cts +107 -0
- package/dist/types-cjs/types.d.cts +127 -0
- package/dist/types-cjs/utils.d.cts +10 -0
- package/dist/utils-Bry9BTmj.cjs +1 -0
- package/dist/utils-VaqPefmS.js +76 -0
- package/package.json +59 -23
- package/dist/css-BVHXLMRl.cjs +0 -1
- package/dist/css-DVaTTIqS.js +0 -17
- package/dist/designTokens-BnzZfRES.js +0 -116
- package/dist/designTokens-C1WdzS3v.cjs +0 -1
- package/dist/presets-BBLdqUE4.cjs +0 -316
- package/dist/presets-DYXLx_nN.js +0 -4025
- package/dist/svg-dGtLYnIJ.cjs +0 -32
- package/dist/svg-hZus3ztj.js +0 -118
- package/dist/types-BMLEvdee.cjs +0 -1
- package/dist/utils-BzSNCfat.js +0 -76
- package/dist/utils-D83DMCMa.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gradient-ui/gradient-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.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,39 +46,74 @@
|
|
|
46
46
|
},
|
|
47
47
|
"exports": {
|
|
48
48
|
".": {
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
"
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
}
|
|
77
107
|
},
|
|
78
108
|
"./design-tokens": {
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
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
|
+
}
|
|
82
117
|
},
|
|
83
118
|
"./package.json": "./package.json"
|
|
84
119
|
},
|
|
@@ -108,8 +143,9 @@
|
|
|
108
143
|
}
|
|
109
144
|
},
|
|
110
145
|
"scripts": {
|
|
111
|
-
"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",
|
|
112
147
|
"pack:dry": "npm pack --dry-run",
|
|
148
|
+
"prepack": "npm run build",
|
|
113
149
|
"type-check": "tsc -p tsconfig.json --noEmit"
|
|
114
150
|
},
|
|
115
151
|
"dependencies": {
|
package/dist/css-BVHXLMRl.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./utils-D83DMCMa.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;
|
package/dist/css-DVaTTIqS.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { D as p, n as c, f as a, d as e, e as r, h as D } from "./utils-BzSNCfat.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,116 +0,0 @@
|
|
|
1
|
-
import { p as f, r as u, g as h, c as F } from "./utils-BzSNCfat.js";
|
|
2
|
-
import { createGradient as c, createGradientFromColor as S } from "./core.mjs";
|
|
3
|
-
import { e as m, C as T, t as $, l as k, m as y } from "./presets-DYXLx_nN.js";
|
|
4
|
-
import { createGradientTokens as E } from "./material.mjs";
|
|
5
|
-
const p = {
|
|
6
|
-
red: "#F44336",
|
|
7
|
-
pink: "#E91E63",
|
|
8
|
-
purple: "#9C27B0",
|
|
9
|
-
deepPurple: "#673AB7",
|
|
10
|
-
indigo: "#3F51B5",
|
|
11
|
-
blue: "#2196F3",
|
|
12
|
-
lightBlue: "#03A9F4",
|
|
13
|
-
cyan: "#00BCD4",
|
|
14
|
-
teal: "#009688",
|
|
15
|
-
green: "#4CAF50",
|
|
16
|
-
lightGreen: "#8BC34A",
|
|
17
|
-
lime: "#CDDC39",
|
|
18
|
-
yellow: "#FFEB3B",
|
|
19
|
-
amber: "#FFC107",
|
|
20
|
-
orange: "#FF9800",
|
|
21
|
-
deepOrange: "#FF5722",
|
|
22
|
-
brown: "#795548",
|
|
23
|
-
grey: "#9E9E9E",
|
|
24
|
-
blueGrey: "#607D8B"
|
|
25
|
-
}, l = (e) => {
|
|
26
|
-
const n = f(e);
|
|
27
|
-
if (!n)
|
|
28
|
-
throw new Error(`Unsupported generated color: ${String(e)}`);
|
|
29
|
-
return u(n);
|
|
30
|
-
}, D = (e) => `${e.charAt(0).toUpperCase()}${e.slice(1)}`, i = (e) => `on${D(e)}`, O = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), w = (e) => e.replace(
|
|
31
|
-
/-([a-z0-9])/g,
|
|
32
|
-
(n, o) => o.toUpperCase()
|
|
33
|
-
), b = (e, n, o, r) => {
|
|
34
|
-
const { colors: t, onColors: a } = r;
|
|
35
|
-
for (const s of T) {
|
|
36
|
-
const C = t[s];
|
|
37
|
-
e[`${o}${s}`] = l(C), e[`${i(o)}${s}`] = l(a[s]), n[`${o}${s}`] = c(t, { shade: s });
|
|
38
|
-
}
|
|
39
|
-
e[o] = e[`${o}500`], e[i(o)] = e[`${i(o)}500`], n[o] = n[`${o}500`];
|
|
40
|
-
}, P = (e) => typeof e == "object" && e !== null && "color" in e, A = (e) => P(e) ? e : { color: e }, B = (e, n, o, r) => {
|
|
41
|
-
e[o] = l(r.color), e[i(o)] = l(
|
|
42
|
-
r.onColor ?? h(r.color)
|
|
43
|
-
), r.gradient !== !1 && (n[o] = r.gradient ?? S(r.color));
|
|
44
|
-
}, j = (e, n, o, r, t) => {
|
|
45
|
-
const a = w(O(r)), s = A(t);
|
|
46
|
-
if (s.palette === !1) {
|
|
47
|
-
B(e, n, a, s);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const C = m(s.color);
|
|
51
|
-
o[a] = C, b(e, n, a, C), s.onColor && (e[i(a)] = l(s.onColor)), s.gradient && (n[a] = s.gradient);
|
|
52
|
-
}, z = (e, n = {}) => {
|
|
53
|
-
const o = {}, r = {}, t = {
|
|
54
|
-
source: m(e)
|
|
55
|
-
};
|
|
56
|
-
for (const [a, s] of Object.entries(p))
|
|
57
|
-
t[a] = m(s);
|
|
58
|
-
for (const [a, s] of Object.entries(t))
|
|
59
|
-
b(o, r, a, s);
|
|
60
|
-
for (const [a, s] of Object.entries(n.colors ?? {}))
|
|
61
|
-
j(o, r, t, a, s);
|
|
62
|
-
return r.main = c(t.source.colors), r.error = c(t.red.colors, { shade: 600 }), r.warning = c(t.amber.colors, { shade: 600 }), r.success = c(t.green.colors, { shade: 600 }), {
|
|
63
|
-
colors: o,
|
|
64
|
-
gradients: r,
|
|
65
|
-
palettes: t
|
|
66
|
-
};
|
|
67
|
-
}, G = (e) => {
|
|
68
|
-
const n = f(e);
|
|
69
|
-
if (!n)
|
|
70
|
-
throw new Error(`Unsupported generated color: ${String(e)}`);
|
|
71
|
-
return u(n);
|
|
72
|
-
}, g = (e, n) => {
|
|
73
|
-
const o = $(k(e)).schemes[n].toJSON();
|
|
74
|
-
return Object.fromEntries(
|
|
75
|
-
Object.entries(o).map(([r, t]) => [
|
|
76
|
-
r,
|
|
77
|
-
G(y(t))
|
|
78
|
-
])
|
|
79
|
-
);
|
|
80
|
-
}, U = (e, n) => {
|
|
81
|
-
const o = g(e, n), r = g(p.amber, n), t = g(p.green, n);
|
|
82
|
-
return {
|
|
83
|
-
...o,
|
|
84
|
-
warning: r.primary,
|
|
85
|
-
onWarning: r.onPrimary,
|
|
86
|
-
warningContainer: r.primaryContainer,
|
|
87
|
-
onWarningContainer: r.onPrimaryContainer,
|
|
88
|
-
success: t.primary,
|
|
89
|
-
onSuccess: t.onPrimary,
|
|
90
|
-
successContainer: t.primaryContainer,
|
|
91
|
-
onSuccessContainer: t.onPrimaryContainer
|
|
92
|
-
};
|
|
93
|
-
}, d = "#4e51ff", x = (e = d) => F(e, d), R = (e = {}) => {
|
|
94
|
-
const n = e.mode ?? "light", o = x(e.seed), r = z(o, {
|
|
95
|
-
colors: e.colors
|
|
96
|
-
});
|
|
97
|
-
return {
|
|
98
|
-
colorSystem: r,
|
|
99
|
-
gradientTokens: E(o, e.gradientTokens),
|
|
100
|
-
mode: n,
|
|
101
|
-
seed: o,
|
|
102
|
-
tokens: {
|
|
103
|
-
theme: U(o, n),
|
|
104
|
-
colors: r.colors,
|
|
105
|
-
gradients: r.gradients
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
export {
|
|
110
|
-
p as C,
|
|
111
|
-
d as D,
|
|
112
|
-
R as a,
|
|
113
|
-
U as b,
|
|
114
|
-
z as c,
|
|
115
|
-
x as n
|
|
116
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const l=require("./utils-D83DMCMa.cjs"),i=require("./core.cjs"),c=require("./presets-BBLdqUE4.cjs"),E=require("./material.cjs"),m={red:"#F44336",pink:"#E91E63",purple:"#9C27B0",deepPurple:"#673AB7",indigo:"#3F51B5",blue:"#2196F3",lightBlue:"#03A9F4",cyan:"#00BCD4",teal:"#009688",green:"#4CAF50",lightGreen:"#8BC34A",lime:"#CDDC39",yellow:"#FFEB3B",amber:"#FFC107",orange:"#FF9800",deepOrange:"#FF5722",brown:"#795548",grey:"#9E9E9E",blueGrey:"#607D8B"},g=e=>{const n=l.parseColor(e);if(!n)throw new Error(`Unsupported generated color: ${String(e)}`);return l.rgbToChannels(n)},F=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,C=e=>`on${F(e)}`,f=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),k=e=>e.replace(/-([a-z0-9])/g,(n,r)=>r.toUpperCase()),S=(e,n,r,o)=>{const{colors:t,onColors:a}=o;for(const s of c.COLOR_SHADES){const d=t[s];e[`${r}${s}`]=g(d),e[`${C(r)}${s}`]=g(a[s]),n[`${r}${s}`]=i.createGradient(t,{shade:s})}e[r]=e[`${r}500`],e[C(r)]=e[`${C(r)}500`],n[r]=n[`${r}500`]},D=e=>typeof e=="object"&&e!==null&&"color"in e,$=e=>D(e)?e:{color:e},y=(e,n,r,o)=>{e[r]=g(o.color),e[C(r)]=g(o.onColor??l.getContrastingColor(o.color)),o.gradient!==!1&&(n[r]=o.gradient??i.createGradientFromColor(o.color))},O=(e,n,r,o,t)=>{const a=k(f(o)),s=$(t);if(s.palette===!1){y(e,n,a,s);return}const d=c.createPalettePair(s.color);r[a]=d,S(e,n,a,d),s.onColor&&(e[C(a)]=g(s.onColor)),s.gradient&&(n[a]=s.gradient)},T=(e,n={})=>{const r={},o={},t={source:c.createPalettePair(e)};for(const[a,s]of Object.entries(m))t[a]=c.createPalettePair(s);for(const[a,s]of Object.entries(t))S(r,o,a,s);for(const[a,s]of Object.entries(n.colors??{}))O(r,o,t,a,s);return o.main=i.createGradient(t.source.colors),o.error=i.createGradient(t.red.colors,{shade:600}),o.warning=i.createGradient(t.amber.colors,{shade:600}),o.success=i.createGradient(t.green.colors,{shade:600}),{colors:r,gradients:o,palettes:t}},P=e=>{const n=l.parseColor(e);if(!n)throw new Error(`Unsupported generated color: ${String(e)}`);return l.rgbToChannels(n)},p=(e,n)=>{const r=c.themeFromSourceColor(c.argbFromHex(e)).schemes[n].toJSON();return Object.fromEntries(Object.entries(r).map(([o,t])=>[o,P(c.hexFromArgb(t))]))},b=(e,n)=>{const r=p(e,n),o=p(m.amber,n),t=p(m.green,n);return{...r,warning:o.primary,onWarning:o.onPrimary,warningContainer:o.primaryContainer,onWarningContainer:o.onPrimaryContainer,success:t.primary,onSuccess:t.onPrimary,successContainer:t.primaryContainer,onSuccessContainer:t.onPrimaryContainer}},u="#4e51ff",h=(e=u)=>l.colorToHex(e,u),w=(e={})=>{const n=e.mode??"light",r=h(e.seed),o=T(r,{colors:e.colors});return{colorSystem:o,gradientTokens:E.createGradientTokens(r,e.gradientTokens),mode:n,seed:r,tokens:{theme:b(r,n),colors:o.colors,gradients:o.gradients}}};exports.COLOR_SEEDS=m;exports.DEFAULT_SEED=u;exports.createColorSystem=T;exports.createDesignTokens=w;exports.createSemanticTokens=b;exports.normalizeDesignTokenSeed=h;
|