@eightshift/ui-components 7.1.0 → 7.2.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/dist/assets/fonts/geist-latin-400-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-latin-500-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-latin-700-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-latin-ext-400-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-latin-ext-500-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-latin-ext-700-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-400-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-500-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-700-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-ext-400-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-ext-500-normal.woff2 +0 -0
- package/dist/assets/fonts/geist-mono-latin-ext-700-normal.woff2 +0 -0
- package/dist/assets/fonts/google-sans-flex-latin-ext-full-normal.woff2 +0 -0
- package/dist/assets/fonts/google-sans-flex-latin-full-normal.woff2 +0 -0
- package/dist/assets/fonts/google-sans-flex-symbols-full-normal.woff2 +0 -0
- package/dist/assets/style-admin.css +3 -12528
- package/dist/assets/style-editor.css +3 -12492
- package/dist/assets/style.css +3 -12498
- package/dist/assets/wp-overrides/allow-full-width-blocks.css +1 -5
- package/dist/assets/wp-overrides/fix-label-text-case.css +1 -28
- package/dist/assets/wp-overrides/increase-sidebar-width.css +1 -3
- package/dist/assets/wp-overrides/make-block-messages-nicer.css +1 -154
- package/dist/assets/wp-overrides/replace-fonts.css +1 -7
- package/dist/assets/wp-overrides/restyle-tooltips.css +1 -193
- package/dist/assets/wp-overrides/round-corners.css +1 -199
- package/dist/assets/wp-overrides/unify-button-sizes.css +1 -4
- package/dist/{button-COTeluL8.js → button-D9cbyHeZ.js} +2 -2
- package/dist/{checkbox-D0AWkLhp.js → checkbox-BO5RZmO8.js} +1 -1
- package/dist/{color-swatch-CBYsO_Zs.js → color-swatch-D2ZBkuTt.js} +1 -1
- package/dist/components/base-control/container.js +1 -1
- package/dist/components/button/button.js +1 -2
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +2 -2
- package/dist/components/color-pickers/color-swatch.js +1 -2
- package/dist/components/color-pickers/gradient-editor.js +1 -3
- package/dist/components/color-pickers/solid-color-picker.js +1 -2
- package/dist/components/component-toggle/component-toggle.js +4 -4
- package/dist/components/container-panel/container-panel.js +2 -3
- package/dist/components/draggable/draggable-handle.js +1 -1
- package/dist/components/draggable/draggable.js +1 -2
- package/dist/components/draggable-list/draggable-list-item.js +1 -1
- package/dist/components/draggable-list/draggable-list.js +2 -2
- package/dist/components/expandable/expandable.js +2 -2
- package/dist/components/index.js +14 -16
- package/dist/components/input-field/input-field.js +1 -1
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +1 -2
- package/dist/components/matrix-align/matrix-align.js +1 -1
- package/dist/components/menu/menu.js +2 -2
- package/dist/components/modal/modal.js +1 -2
- package/dist/components/number-picker/number-picker.js +1 -2
- package/dist/components/option-select/option-select.js +3 -3
- package/dist/components/placeholders/file-picker-shell.js +1 -2
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +2 -2
- package/dist/components/radio/radio.js +1 -1
- package/dist/components/repeater/repeater-item.js +2 -2
- package/dist/components/repeater/repeater.js +3 -3
- package/dist/components/responsive/mini-responsive.js +2 -2
- package/dist/components/responsive/responsive-legacy.js +3 -3
- package/dist/components/responsive/responsive.js +3 -3
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/select/async-multi-select.js +2 -2
- package/dist/components/select/async-select.js +2 -2
- package/dist/components/select/multi-select.js +2 -2
- package/dist/components/select/shared.js +1 -2
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +1 -1
- package/dist/components/slider/slider.js +1 -2
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/smart-image/smart-image.js +1 -2
- package/dist/components/tabs/tabs.js +1 -2
- package/dist/components/toggle/switch.js +1 -1
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +1 -1
- package/dist/{draggable-CYQyD9gG.js → draggable-CTDVJ4zd.js} +1 -1
- package/dist/gradient-editor-xfxA_s9a.js +1583 -0
- package/dist/icons/index.js +1 -1
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +14 -16
- package/dist/{input-field-UCZL5bqv.js → input-field-_OCWbftf.js} +1 -1
- package/dist/{link-input-D7iDRpOM.js → link-input-Bh8G7Urm.js} +2 -2
- package/dist/{modal-DbVLYMkH.js → modal-snrElwty.js} +2 -2
- package/dist/{number-picker-CkA1iJNZ.js → number-picker-Dhtx4409.js} +3 -2
- package/dist/{shared-D_OXizRt.js → shared-BiWZjrGF.js} +1 -1
- package/dist/{smart-image-CbSsEASF.js → smart-image-CBNbxJ57.js} +1 -1
- package/dist/{solid-color-picker-DbT-aoVx.js → solid-color-picker-DukArNH-.js} +2 -2
- package/dist/{switch-L8dFSQWQ.js → switch-DmsvyQPa.js} +1 -1
- package/dist/{tabs-BrdyBER5.js → tabs-DaIUEc0g.js} +2 -2
- package/dist/{toggle-button-DJ8jNQ-9.js → toggle-button-BlzUGfGy.js} +1 -1
- package/dist/utilities/general.js +25 -2
- package/dist/utilities/index.js +3 -3
- package/package.json +4 -7
- package/dist/general-BKOvs-AO.js +0 -4276
- package/dist/gradient-editor-BAd_Gzx4.js +0 -604
- package/dist/workers/image-analysis.worker.js +0 -60
- /package/dist/{List-CMK5qsNF.js → List-DWlgW2Ex.js} +0 -0
- /package/dist/{build-module-sxK3nxOK.js → build-module-Bsx62nlm.js} +0 -0
- /package/dist/{dist-DIK9pFxO.js → dist-2gkv7_1U.js} +0 -0
- /package/dist/{jsx-svg-OBADs_Qs.js → jsx-svg-BRJ4n3pD.js} +0 -0
- /package/dist/{utilities-CPFDXC3B.js → utilities-lwX686oD.js} +0 -0
|
@@ -0,0 +1,1583 @@
|
|
|
1
|
+
import { t as clsx } from "./clsx-BUU5J41u.js";
|
|
2
|
+
import { n as ButtonGroup, t as Button } from "./button-D9cbyHeZ.js";
|
|
3
|
+
import { n as $251c695a52d94a8d$export$cae13e90592f246a } from "./color-swatch-D2ZBkuTt.js";
|
|
4
|
+
import { t as SolidColorPicker } from "./solid-color-picker-DukArNH-.js";
|
|
5
|
+
import { t as NumberPicker } from "./number-picker-Dhtx4409.js";
|
|
6
|
+
import { BaseControl } from "./components/base-control/base-control.js";
|
|
7
|
+
import { isColorDark } from "./utilities/general.js";
|
|
8
|
+
import { r as sprintf, t as __ } from "./build-module-Bsx62nlm.js";
|
|
9
|
+
import { add } from "./icons/ui-icons/add.js";
|
|
10
|
+
import { angle } from "./icons/ui-icons/angle.js";
|
|
11
|
+
import { centerPoint } from "./icons/ui-icons/center-point.js";
|
|
12
|
+
import { genericShapesAlt } from "./icons/ui-icons/generic-shapes-alt.js";
|
|
13
|
+
import { gradientRepeat } from "./icons/ui-icons/gradient-repeat.js";
|
|
14
|
+
import { gradientStop } from "./icons/ui-icons/gradient-stop.js";
|
|
15
|
+
import { sliders } from "./icons/ui-icons/sliders.js";
|
|
16
|
+
import { trash } from "./icons/ui-icons/trash.js";
|
|
17
|
+
import { TriggeredPopover } from "./components/popover/popover.js";
|
|
18
|
+
import { Menu, MenuItem } from "./components/menu/menu.js";
|
|
19
|
+
import { Container, ContainerGroup } from "./components/base-control/container.js";
|
|
20
|
+
import { DraggableList } from "./components/draggable-list/draggable-list.js";
|
|
21
|
+
import { DraggableListItem } from "./components/draggable-list/draggable-list-item.js";
|
|
22
|
+
import { Slider } from "./components/slider/slider.js";
|
|
23
|
+
import { MatrixAlign } from "./components/matrix-align/matrix-align.js";
|
|
24
|
+
import { Toggle } from "./components/toggle/toggle.js";
|
|
25
|
+
import { OptionSelect } from "./components/option-select/option-select.js";
|
|
26
|
+
import { useMemo, useState } from "react";
|
|
27
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
28
|
+
//#region node_modules/css-gradient-parser/dist/index.js
|
|
29
|
+
function c$1(e, o = ",") {
|
|
30
|
+
let t = [], n = 0, i = 0;
|
|
31
|
+
o = new RegExp(o);
|
|
32
|
+
for (let r = 0; r < e.length; r++) e[r] === "(" ? i++ : e[r] === ")" && i--, i === 0 && o.test(e[r]) && (t.push(e.slice(n, r).trim()), n = r + 1);
|
|
33
|
+
return t.push(e.slice(n).trim()), t;
|
|
34
|
+
}
|
|
35
|
+
function g(e) {
|
|
36
|
+
let o = [];
|
|
37
|
+
for (let t = 0, n = e.length; t < n;) {
|
|
38
|
+
let [i, r] = c$1(e[t], /\s+/);
|
|
39
|
+
m(e[t + 1]) ? (o.push({
|
|
40
|
+
color: i,
|
|
41
|
+
offset: l(r),
|
|
42
|
+
hint: l(e[t + 1])
|
|
43
|
+
}), t += 2) : (o.push({
|
|
44
|
+
color: i,
|
|
45
|
+
offset: l(r)
|
|
46
|
+
}), t++);
|
|
47
|
+
}
|
|
48
|
+
return o;
|
|
49
|
+
}
|
|
50
|
+
var u = /^(-?\d+\.?\d*)(%|vw|vh|px|em|rem|deg|rad|grad|turn|ch|vmin|vmax)?$/;
|
|
51
|
+
function m(e) {
|
|
52
|
+
return u.test(e);
|
|
53
|
+
}
|
|
54
|
+
function l(e) {
|
|
55
|
+
if (!e) return;
|
|
56
|
+
let [, o, t] = e.trim().match(u) || [];
|
|
57
|
+
return {
|
|
58
|
+
value: o,
|
|
59
|
+
unit: t ?? "px"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function P(e) {
|
|
63
|
+
if (!/^(repeating-)?linear-gradient/.test(e)) throw new SyntaxError(`could not find syntax for this item: ${e}`);
|
|
64
|
+
let [, o, t] = e.match(/(repeating-)?linear-gradient\((.+)\)/), n = {
|
|
65
|
+
orientation: {
|
|
66
|
+
type: "directional",
|
|
67
|
+
value: "bottom"
|
|
68
|
+
},
|
|
69
|
+
repeating: !!o,
|
|
70
|
+
stops: []
|
|
71
|
+
}, i = c$1(t), r = x(i[0]);
|
|
72
|
+
return r && (n.orientation = r, i.shift()), {
|
|
73
|
+
...n,
|
|
74
|
+
stops: g(i)
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function x(e) {
|
|
78
|
+
return e.startsWith("to ") ? {
|
|
79
|
+
type: "directional",
|
|
80
|
+
value: e.replace("to ", "")
|
|
81
|
+
} : [
|
|
82
|
+
"turn",
|
|
83
|
+
"deg",
|
|
84
|
+
"grad",
|
|
85
|
+
"rad"
|
|
86
|
+
].some((o) => e.endsWith(o)) ? {
|
|
87
|
+
type: "angular",
|
|
88
|
+
value: l(e)
|
|
89
|
+
} : null;
|
|
90
|
+
}
|
|
91
|
+
var v = new Set([
|
|
92
|
+
"closest-corner",
|
|
93
|
+
"closest-side",
|
|
94
|
+
"farthest-corner",
|
|
95
|
+
"farthest-side"
|
|
96
|
+
]), w = new Set([
|
|
97
|
+
"center",
|
|
98
|
+
"left",
|
|
99
|
+
"top",
|
|
100
|
+
"right",
|
|
101
|
+
"bottom"
|
|
102
|
+
]);
|
|
103
|
+
function d$1(e) {
|
|
104
|
+
return v.has(e);
|
|
105
|
+
}
|
|
106
|
+
function h(e) {
|
|
107
|
+
return w.has(e);
|
|
108
|
+
}
|
|
109
|
+
function R(e) {
|
|
110
|
+
let o = Array(2).fill("");
|
|
111
|
+
for (let t = 0; t < 2; t++) e[t] ? o[t] = e[t] : o[t] = "center";
|
|
112
|
+
return o;
|
|
113
|
+
}
|
|
114
|
+
function K(e) {
|
|
115
|
+
if (!/(repeating-)?radial-gradient/.test(e)) throw new SyntaxError(`could not find syntax for this item: ${e}`);
|
|
116
|
+
let [, o, t] = e.match(/(repeating-)?radial-gradient\((.+)\)/), n = {
|
|
117
|
+
shape: "ellipse",
|
|
118
|
+
repeating: !!o,
|
|
119
|
+
size: [{
|
|
120
|
+
type: "keyword",
|
|
121
|
+
value: "farthest-corner"
|
|
122
|
+
}],
|
|
123
|
+
position: {
|
|
124
|
+
x: {
|
|
125
|
+
type: "keyword",
|
|
126
|
+
value: "center"
|
|
127
|
+
},
|
|
128
|
+
y: {
|
|
129
|
+
type: "keyword",
|
|
130
|
+
value: "center"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
stops: []
|
|
134
|
+
}, i = c$1(t);
|
|
135
|
+
if (S(i[0])) return {
|
|
136
|
+
...n,
|
|
137
|
+
stops: g(i)
|
|
138
|
+
};
|
|
139
|
+
let r = i[0].split("at").map((f) => f.trim()), p = ((r[0] || "").match(/(circle|ellipse)/) || [])[1], a = (r[0] || "").match(/(-?\d+\.?\d*(vw|vh|px|em|rem|%|rad|grad|turn|deg)?|closest-corner|closest-side|farthest-corner|farthest-side)/g) || [], s = R((r[1] || "").split(" "));
|
|
140
|
+
return p ? n.shape = p : a.length === 1 && !d$1(a[0]) ? n.shape = "circle" : n.shape = "ellipse", a.length === 0 && a.push("farthest-corner"), n.size = a.map((f) => d$1(f) ? {
|
|
141
|
+
type: "keyword",
|
|
142
|
+
value: f
|
|
143
|
+
} : {
|
|
144
|
+
type: "length",
|
|
145
|
+
value: l(f)
|
|
146
|
+
}), n.position.x = h(s[0]) ? {
|
|
147
|
+
type: "keyword",
|
|
148
|
+
value: s[0]
|
|
149
|
+
} : {
|
|
150
|
+
type: "length",
|
|
151
|
+
value: l(s[0])
|
|
152
|
+
}, n.position.y = h(s[1]) ? {
|
|
153
|
+
type: "keyword",
|
|
154
|
+
value: s[1]
|
|
155
|
+
} : {
|
|
156
|
+
type: "length",
|
|
157
|
+
value: l(s[1])
|
|
158
|
+
}, (p || a.length > 0 || r[1]) && i.shift(), {
|
|
159
|
+
...n,
|
|
160
|
+
stops: g(i)
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function S(e) {
|
|
164
|
+
return /(circle|ellipse|at)/.test(e) ? !1 : /^(rgba?|hwb|hsla?|lab|lch|oklab|color|#|[a-zA-Z]+)/.test(e);
|
|
165
|
+
}
|
|
166
|
+
var C = new Set([
|
|
167
|
+
"from",
|
|
168
|
+
"in",
|
|
169
|
+
"at"
|
|
170
|
+
]);
|
|
171
|
+
function j(e) {
|
|
172
|
+
if (!/(repeating-)?conic-gradient/.test(e)) throw new SyntaxError(`could not find syntax for this item: ${e}`);
|
|
173
|
+
let [, o, t] = e.match(/(repeating-)?conic-gradient\((.+)\)/), n = {
|
|
174
|
+
angle: "0deg",
|
|
175
|
+
repeating: !!o,
|
|
176
|
+
position: "center",
|
|
177
|
+
stops: []
|
|
178
|
+
}, i = c$1(t).map((s) => s.trim()), r = c$1(i[0], /\s+/), p = "", a = 0;
|
|
179
|
+
for (let s = 0, f = r.length; s < f; s++) C.has(r[s]) && (s > 0 && Object.assign(n, y(p, r, a, s)), p = r[s], a = s + 1);
|
|
180
|
+
return p && (Object.assign(n, y(p, r, a, r.length)), i.shift()), {
|
|
181
|
+
...n,
|
|
182
|
+
stops: g(i)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function y(e, o, t, n) {
|
|
186
|
+
switch (e) {
|
|
187
|
+
case "from": return { angle: o.slice(t, n).join(" ") };
|
|
188
|
+
case "at": return { position: o.slice(t, n).join(" ") };
|
|
189
|
+
case "in": {
|
|
190
|
+
let [i, ...r] = o.slice(t, n);
|
|
191
|
+
return { color: {
|
|
192
|
+
space: i,
|
|
193
|
+
method: r.length > 0 ? r.join(" ") : void 0
|
|
194
|
+
} };
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region node_modules/@thi.ng/color/api.js
|
|
200
|
+
var ParsedColor = class {
|
|
201
|
+
constructor(mode, value) {
|
|
202
|
+
this.mode = mode;
|
|
203
|
+
this.value = value;
|
|
204
|
+
}
|
|
205
|
+
deref() {
|
|
206
|
+
return this.value;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region node_modules/@thi.ng/memoize/memoizej.js
|
|
211
|
+
function memoizeJ(fn, cache = Object.create(null)) {
|
|
212
|
+
return (...args) => {
|
|
213
|
+
const key = JSON.stringify(args);
|
|
214
|
+
if (key !== void 0) return key in cache ? cache[key] : cache[key] = fn.apply(null, args);
|
|
215
|
+
return fn.apply(null, args);
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region node_modules/@thi.ng/memoize/memoizeo.js
|
|
220
|
+
function memoizeO(fn, cache = Object.create(null)) {
|
|
221
|
+
return (...xs) => {
|
|
222
|
+
const key = xs.join("-");
|
|
223
|
+
return key in cache ? cache[key] : cache[key] = fn(...xs);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region node_modules/@thi.ng/strings/repeat.js
|
|
228
|
+
var repeat = memoizeO((ch, n) => ch.repeat(n));
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region node_modules/@thi.ng/strings/pad-left.js
|
|
231
|
+
var padLeft = memoizeO((n, ch = " ") => {
|
|
232
|
+
const buf = repeat(String(ch), n);
|
|
233
|
+
return (x, len) => {
|
|
234
|
+
if (x == null) return buf;
|
|
235
|
+
x = x.toString();
|
|
236
|
+
len = len !== void 0 ? len : x.length;
|
|
237
|
+
return len < n ? buf.substring(len) + x : x;
|
|
238
|
+
};
|
|
239
|
+
});
|
|
240
|
+
var Z2 = padLeft(2, "0");
|
|
241
|
+
var Z3 = padLeft(3, "0");
|
|
242
|
+
var Z4 = padLeft(4, "0");
|
|
243
|
+
//#endregion
|
|
244
|
+
//#region node_modules/@thi.ng/strings/float.js
|
|
245
|
+
var float = memoizeJ((prec, special = false) => special ? (x) => __nanOrInf(x) || x.toFixed(prec) : (x) => x.toFixed(prec));
|
|
246
|
+
var floatFixedWidth = memoizeJ((width, prec = 3) => {
|
|
247
|
+
const l = width - prec - 1;
|
|
248
|
+
const pl = Math.pow(10, l);
|
|
249
|
+
const pln = -Math.pow(10, l - 1);
|
|
250
|
+
const pr = Math.pow(10, -(prec - 1));
|
|
251
|
+
const pad = padLeft(width);
|
|
252
|
+
return (x) => {
|
|
253
|
+
const ax = Math.abs(x);
|
|
254
|
+
return pad(__nanOrInf(x) || (x === 0 ? "0" : ax < pr || ax >= pl ? __exp(x, width) : x.toFixed(prec - (x < pln ? 1 : 0))));
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
var __exp = (x, w) => x.toExponential(Math.max(w - 4 - (Math.log(Math.abs(x)) / Math.LN10 >= 10 ? 2 : 1) - (x < 0 ? 1 : 0), 0));
|
|
258
|
+
var __nanOrInf = (x) => isNaN(x) ? "NaN" : x === Infinity ? "+∞" : x === -Infinity ? "-∞" : void 0;
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region node_modules/@thi.ng/strings/percent.js
|
|
261
|
+
var percent = (prec = 0) => (x) => (x * 100).toFixed(prec) + "%";
|
|
262
|
+
//#endregion
|
|
263
|
+
//#region node_modules/@thi.ng/color/api/constants.js
|
|
264
|
+
var BLACK = Object.freeze([
|
|
265
|
+
0,
|
|
266
|
+
0,
|
|
267
|
+
0,
|
|
268
|
+
1
|
|
269
|
+
]);
|
|
270
|
+
var WHITE = Object.freeze([
|
|
271
|
+
1,
|
|
272
|
+
1,
|
|
273
|
+
1,
|
|
274
|
+
1
|
|
275
|
+
]);
|
|
276
|
+
var RED = Object.freeze([
|
|
277
|
+
1,
|
|
278
|
+
0,
|
|
279
|
+
0,
|
|
280
|
+
1
|
|
281
|
+
]);
|
|
282
|
+
var GREEN = Object.freeze([
|
|
283
|
+
0,
|
|
284
|
+
1,
|
|
285
|
+
0,
|
|
286
|
+
1
|
|
287
|
+
]);
|
|
288
|
+
var BLUE = Object.freeze([
|
|
289
|
+
0,
|
|
290
|
+
0,
|
|
291
|
+
1,
|
|
292
|
+
1
|
|
293
|
+
]);
|
|
294
|
+
var CYAN = Object.freeze([
|
|
295
|
+
0,
|
|
296
|
+
1,
|
|
297
|
+
1,
|
|
298
|
+
1
|
|
299
|
+
]);
|
|
300
|
+
var MAGENTA = Object.freeze([
|
|
301
|
+
1,
|
|
302
|
+
0,
|
|
303
|
+
1,
|
|
304
|
+
1
|
|
305
|
+
]);
|
|
306
|
+
var YELLOW = Object.freeze([
|
|
307
|
+
1,
|
|
308
|
+
1,
|
|
309
|
+
0,
|
|
310
|
+
1
|
|
311
|
+
]);
|
|
312
|
+
var RGB_LUMINANCE_REC709 = [
|
|
313
|
+
.2126,
|
|
314
|
+
.7152,
|
|
315
|
+
.0722
|
|
316
|
+
];
|
|
317
|
+
var FF = float(3);
|
|
318
|
+
var PC = percent(3);
|
|
319
|
+
var INV8BIT = 1 / 255;
|
|
320
|
+
var EPS$1 = 1 / 256;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region node_modules/@thi.ng/color/api/names.js
|
|
323
|
+
var CSS_NAMES = {
|
|
324
|
+
aliceblue: "f0f8ff",
|
|
325
|
+
antiquewhite: "faebd7",
|
|
326
|
+
aqua: "0ff",
|
|
327
|
+
aquamarine: "7fffd4",
|
|
328
|
+
azure: "f0ffff",
|
|
329
|
+
beige: "f5f5dc",
|
|
330
|
+
bisque: "ffe4c4",
|
|
331
|
+
black: "000",
|
|
332
|
+
blanchedalmond: "ffebcd",
|
|
333
|
+
blue: "00f",
|
|
334
|
+
blueviolet: "8a2be2",
|
|
335
|
+
brown: "a52a2a",
|
|
336
|
+
burlywood: "deb887",
|
|
337
|
+
cadetblue: "5f9ea0",
|
|
338
|
+
chartreuse: "7fff00",
|
|
339
|
+
chocolate: "d2691e",
|
|
340
|
+
coral: "ff7f50",
|
|
341
|
+
cornflowerblue: "6495ed",
|
|
342
|
+
cornsilk: "fff8dc",
|
|
343
|
+
crimson: "dc143c",
|
|
344
|
+
cyan: "0ff",
|
|
345
|
+
darkblue: "00008b",
|
|
346
|
+
darkcyan: "008b8b",
|
|
347
|
+
darkgoldenrod: "b8860b",
|
|
348
|
+
darkgray: "a9a9a9",
|
|
349
|
+
darkgreen: "006400",
|
|
350
|
+
darkgrey: "a9a9a9",
|
|
351
|
+
darkkhaki: "bdb76b",
|
|
352
|
+
darkmagenta: "8b008b",
|
|
353
|
+
darkolivegreen: "556b2f",
|
|
354
|
+
darkorange: "ff8c00",
|
|
355
|
+
darkorchid: "9932cc",
|
|
356
|
+
darkred: "8b0000",
|
|
357
|
+
darksalmon: "e9967a",
|
|
358
|
+
darkseagreen: "8fbc8f",
|
|
359
|
+
darkslateblue: "483d8b",
|
|
360
|
+
darkslategray: "2f4f4f",
|
|
361
|
+
darkslategrey: "2f4f4f",
|
|
362
|
+
darkturquoise: "00ced1",
|
|
363
|
+
darkviolet: "9400d3",
|
|
364
|
+
deeppink: "ff1493",
|
|
365
|
+
deepskyblue: "00bfff",
|
|
366
|
+
dimgray: "696969",
|
|
367
|
+
dimgrey: "696969",
|
|
368
|
+
dodgerblue: "1e90ff",
|
|
369
|
+
firebrick: "b22222",
|
|
370
|
+
floralwhite: "fffaf0",
|
|
371
|
+
forestgreen: "228b22",
|
|
372
|
+
fuchsia: "f0f",
|
|
373
|
+
gainsboro: "dcdcdc",
|
|
374
|
+
ghostwhite: "f8f8ff",
|
|
375
|
+
gold: "ffd700",
|
|
376
|
+
goldenrod: "daa520",
|
|
377
|
+
gray: "808080",
|
|
378
|
+
grey: "808080",
|
|
379
|
+
green: "008000",
|
|
380
|
+
greenyellow: "adff2f",
|
|
381
|
+
honeydew: "f0fff0",
|
|
382
|
+
hotpink: "ff69b4",
|
|
383
|
+
indianred: "cd5c5c",
|
|
384
|
+
indigo: "4b0082",
|
|
385
|
+
ivory: "fffff0",
|
|
386
|
+
khaki: "f0e68c",
|
|
387
|
+
lavender: "e6e6fa",
|
|
388
|
+
lavenderblush: "fff0f5",
|
|
389
|
+
lawngreen: "7cfc00",
|
|
390
|
+
lemonchiffon: "fffacd",
|
|
391
|
+
lightblue: "add8e6",
|
|
392
|
+
lightcoral: "f08080",
|
|
393
|
+
lightcyan: "e0ffff",
|
|
394
|
+
lightgoldenrodyellow: "fafad2",
|
|
395
|
+
lightgray: "d3d3d3",
|
|
396
|
+
lightgreen: "90ee90",
|
|
397
|
+
lightgrey: "d3d3d3",
|
|
398
|
+
lightpink: "ffb6c1",
|
|
399
|
+
lightsalmon: "ffa07a",
|
|
400
|
+
lightseagreen: "20b2aa",
|
|
401
|
+
lightskyblue: "87cefa",
|
|
402
|
+
lightslategray: "789",
|
|
403
|
+
lightslategrey: "789",
|
|
404
|
+
lightsteelblue: "b0c4de",
|
|
405
|
+
lightyellow: "ffffe0",
|
|
406
|
+
lime: "0f0",
|
|
407
|
+
limegreen: "32cd32",
|
|
408
|
+
linen: "faf0e6",
|
|
409
|
+
magenta: "f0f",
|
|
410
|
+
maroon: "800000",
|
|
411
|
+
mediumaquamarine: "66cdaa",
|
|
412
|
+
mediumblue: "0000cd",
|
|
413
|
+
mediumorchid: "ba55d3",
|
|
414
|
+
mediumpurple: "9370db",
|
|
415
|
+
mediumseagreen: "3cb371",
|
|
416
|
+
mediumslateblue: "7b68ee",
|
|
417
|
+
mediumspringgreen: "00fa9a",
|
|
418
|
+
mediumturquoise: "48d1cc",
|
|
419
|
+
mediumvioletred: "c71585",
|
|
420
|
+
midnightblue: "191970",
|
|
421
|
+
mintcream: "f5fffa",
|
|
422
|
+
mistyrose: "ffe4e1",
|
|
423
|
+
moccasin: "ffe4b5",
|
|
424
|
+
navajowhite: "ffdead",
|
|
425
|
+
navy: "000080",
|
|
426
|
+
oldlace: "fdf5e6",
|
|
427
|
+
olive: "808000",
|
|
428
|
+
olivedrab: "6b8e23",
|
|
429
|
+
orange: "ffa500",
|
|
430
|
+
orangered: "ff4500",
|
|
431
|
+
orchid: "da70d6",
|
|
432
|
+
palegoldenrod: "eee8aa",
|
|
433
|
+
palegreen: "98fb98",
|
|
434
|
+
paleturquoise: "afeeee",
|
|
435
|
+
palevioletred: "db7093",
|
|
436
|
+
papayawhip: "ffefd5",
|
|
437
|
+
peachpuff: "ffdab9",
|
|
438
|
+
peru: "cd853f",
|
|
439
|
+
pink: "ffc0cb",
|
|
440
|
+
plum: "dda0dd",
|
|
441
|
+
powderblue: "b0e0e6",
|
|
442
|
+
purple: "800080",
|
|
443
|
+
red: "f00",
|
|
444
|
+
rosybrown: "bc8f8f",
|
|
445
|
+
royalblue: "4169e1",
|
|
446
|
+
saddlebrown: "8b4513",
|
|
447
|
+
salmon: "fa8072",
|
|
448
|
+
sandybrown: "f4a460",
|
|
449
|
+
seagreen: "2e8b57",
|
|
450
|
+
seashell: "fff5ee",
|
|
451
|
+
sienna: "a0522d",
|
|
452
|
+
silver: "c0c0c0",
|
|
453
|
+
skyblue: "87ceeb",
|
|
454
|
+
slateblue: "6a5acd",
|
|
455
|
+
slategray: "708090",
|
|
456
|
+
slategrey: "708090",
|
|
457
|
+
snow: "fffafa",
|
|
458
|
+
springgreen: "00ff7f",
|
|
459
|
+
steelblue: "4682b4",
|
|
460
|
+
tan: "d2b48c",
|
|
461
|
+
teal: "008080",
|
|
462
|
+
thistle: "d8bfd8",
|
|
463
|
+
tomato: "ff6347",
|
|
464
|
+
turquoise: "40e0d0",
|
|
465
|
+
violet: "ee82ee",
|
|
466
|
+
wheat: "f5deb3",
|
|
467
|
+
white: "fff",
|
|
468
|
+
whitesmoke: "f5f5f5",
|
|
469
|
+
yellow: "ff0",
|
|
470
|
+
yellowgreen: "9acd32",
|
|
471
|
+
transparent: "0000",
|
|
472
|
+
rebeccapurple: "639"
|
|
473
|
+
};
|
|
474
|
+
//#endregion
|
|
475
|
+
//#region node_modules/@thi.ng/color/api/system.js
|
|
476
|
+
var CSS_SYSTEM_COLORS = {
|
|
477
|
+
canvas: "fff",
|
|
478
|
+
canvastext: "000",
|
|
479
|
+
linktext: "001ee4",
|
|
480
|
+
visitedtext: "4e2386",
|
|
481
|
+
activetext: "eb3323",
|
|
482
|
+
buttonface: "ddd",
|
|
483
|
+
buttontext: "000",
|
|
484
|
+
buttonborder: "000",
|
|
485
|
+
field: "fff",
|
|
486
|
+
fieldtext: "000",
|
|
487
|
+
highlight: "bbd5fb",
|
|
488
|
+
highlighttext: "000",
|
|
489
|
+
mark: "000",
|
|
490
|
+
marktext: "fff",
|
|
491
|
+
graytext: "808080"
|
|
492
|
+
};
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region node_modules/@thi.ng/vectors/setc.js
|
|
495
|
+
var setC3 = (out, x, y, z) => {
|
|
496
|
+
!out && (out = []);
|
|
497
|
+
out[0] = x;
|
|
498
|
+
out[1] = y;
|
|
499
|
+
out[2] = z;
|
|
500
|
+
return out;
|
|
501
|
+
};
|
|
502
|
+
var setC4 = (out, x, y, z, w) => {
|
|
503
|
+
!out && (out = []);
|
|
504
|
+
out[0] = x;
|
|
505
|
+
out[1] = y;
|
|
506
|
+
out[2] = z;
|
|
507
|
+
out[3] = w;
|
|
508
|
+
return out;
|
|
509
|
+
};
|
|
510
|
+
//#endregion
|
|
511
|
+
//#region node_modules/@thi.ng/errors/deferror.js
|
|
512
|
+
var defError = (prefix, suffix = (msg) => msg !== void 0 ? ": " + msg : "") => class extends Error {
|
|
513
|
+
origMessage;
|
|
514
|
+
constructor(msg) {
|
|
515
|
+
super(prefix(msg) + suffix(msg));
|
|
516
|
+
this.origMessage = msg !== void 0 ? String(msg) : "";
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region node_modules/@thi.ng/errors/unsupported.js
|
|
521
|
+
var UnsupportedOperationError = defError(() => "unsupported operation");
|
|
522
|
+
var unsupportedOp = (msg) => {
|
|
523
|
+
throw new UnsupportedOperationError(msg);
|
|
524
|
+
};
|
|
525
|
+
var UnsupportedFeatureError = defError(() => "unsupported feature");
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region node_modules/@thi.ng/math/interval.js
|
|
528
|
+
var clamp = (x, min, max) => x < min ? min : x > max ? max : x;
|
|
529
|
+
var clamp01 = (x) => x < 0 ? 0 : x > 1 ? 1 : x;
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region node_modules/@thi.ng/math/api.js
|
|
532
|
+
var PI = Math.PI;
|
|
533
|
+
var TAU = PI * 2;
|
|
534
|
+
var HALF_PI = PI / 2;
|
|
535
|
+
var THIRD_PI = PI / 3;
|
|
536
|
+
var QUARTER_PI = PI / 4;
|
|
537
|
+
var SIXTH_PI = PI / 6;
|
|
538
|
+
var INV_PI = 1 / PI;
|
|
539
|
+
var INV_TAU = 1 / TAU;
|
|
540
|
+
var INV_HALF_PI = 1 / HALF_PI;
|
|
541
|
+
var DEG2RAD = PI / 180;
|
|
542
|
+
var RAD2DEG = 180 / PI;
|
|
543
|
+
var PHI = (1 + Math.sqrt(5)) / 2;
|
|
544
|
+
var SQRT2 = Math.SQRT2;
|
|
545
|
+
var SQRT3 = Math.sqrt(3);
|
|
546
|
+
var SQRT2_2 = SQRT2 / 2;
|
|
547
|
+
var SQRT3_2 = SQRT3 / 2;
|
|
548
|
+
var THIRD = 1 / 3;
|
|
549
|
+
var TWO_THIRD = 2 / 3;
|
|
550
|
+
var SIXTH = 1 / 6;
|
|
551
|
+
var EPS = 1e-6;
|
|
552
|
+
//#endregion
|
|
553
|
+
//#region node_modules/@thi.ng/math/prec.js
|
|
554
|
+
var fract = (x) => x - Math.floor(x);
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region node_modules/@thi.ng/random/arandom.js
|
|
557
|
+
var INV_MAX = 1 / 2 ** 32;
|
|
558
|
+
var ARandom = class {
|
|
559
|
+
float(norm = 1) {
|
|
560
|
+
return this.int() * INV_MAX * norm;
|
|
561
|
+
}
|
|
562
|
+
probability(p) {
|
|
563
|
+
return this.float() < p;
|
|
564
|
+
}
|
|
565
|
+
norm(norm = 1) {
|
|
566
|
+
return (this.int() * INV_MAX - .5) * 2 * norm;
|
|
567
|
+
}
|
|
568
|
+
normMinMax(min, max) {
|
|
569
|
+
const x = this.minmax(min, max);
|
|
570
|
+
return this.float() < .5 ? x : -x;
|
|
571
|
+
}
|
|
572
|
+
minmax(min, max) {
|
|
573
|
+
return this.float() * (max - min) + min;
|
|
574
|
+
}
|
|
575
|
+
minmaxInt(min, max) {
|
|
576
|
+
min |= 0;
|
|
577
|
+
const range = (max | 0) - min;
|
|
578
|
+
return range ? min + this.int() % range : min;
|
|
579
|
+
}
|
|
580
|
+
minmaxUint(min, max) {
|
|
581
|
+
min >>>= 0;
|
|
582
|
+
const range = (max >>> 0) - min;
|
|
583
|
+
return range ? min + this.int() % range : min;
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
//#endregion
|
|
587
|
+
//#region node_modules/@thi.ng/random/wrapped.js
|
|
588
|
+
var WrappedRandom = class extends ARandom {
|
|
589
|
+
constructor(rnd) {
|
|
590
|
+
super();
|
|
591
|
+
this.rnd = rnd;
|
|
592
|
+
}
|
|
593
|
+
float(norm = 1) {
|
|
594
|
+
return this.rnd() * norm;
|
|
595
|
+
}
|
|
596
|
+
norm(norm = 1) {
|
|
597
|
+
return (this.rnd() - .5) * 2 * norm;
|
|
598
|
+
}
|
|
599
|
+
int() {
|
|
600
|
+
return this.rnd() * 4294967296 >>> 0;
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region node_modules/@thi.ng/random/system.js
|
|
605
|
+
var SYSTEM = new WrappedRandom(Math.random);
|
|
606
|
+
//#endregion
|
|
607
|
+
//#region node_modules/@thi.ng/color/internal/ensure.js
|
|
608
|
+
var __ensureAlpha = (x, def = 1) => x != void 0 ? clamp01(x) : def;
|
|
609
|
+
var __ensureArgs = (args) => {
|
|
610
|
+
if (typeof args[0] === "number") switch (args.length) {
|
|
611
|
+
case 1: return args.push(0, 0, 1), [args];
|
|
612
|
+
case 2: return args.push(0, 1), [args];
|
|
613
|
+
case 3: return args.push(1), [args];
|
|
614
|
+
default: return [args];
|
|
615
|
+
}
|
|
616
|
+
return args;
|
|
617
|
+
};
|
|
618
|
+
//#endregion
|
|
619
|
+
//#region node_modules/@thi.ng/color/clamp.js
|
|
620
|
+
var clampH = (out, src, alpha = 1) => setC4(out || src, fract(src[0]), clamp01(src[1]), clamp01(src[2]), __ensureAlpha(src[3], alpha));
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region node_modules/@thi.ng/checks/is-array.js
|
|
623
|
+
var isArray = Array.isArray;
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region node_modules/@thi.ng/checks/is-number.js
|
|
626
|
+
var isNumber = (x) => typeof x === "number";
|
|
627
|
+
//#endregion
|
|
628
|
+
//#region node_modules/@thi.ng/checks/is-string.js
|
|
629
|
+
var isString = (x) => typeof x === "string";
|
|
630
|
+
//#endregion
|
|
631
|
+
//#region node_modules/@thi.ng/errors/illegal-arguments.js
|
|
632
|
+
var IllegalArgumentError = defError(() => "illegal argument(s)");
|
|
633
|
+
var illegalArgs = (msg) => {
|
|
634
|
+
throw new IllegalArgumentError(msg);
|
|
635
|
+
};
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region node_modules/@thi.ng/errors/assert.js
|
|
638
|
+
var AssertionError = defError(() => "Assertion failed");
|
|
639
|
+
var assert = (typeof process !== "undefined" && process.env !== void 0 ? process.env.NODE_ENV !== "production" || !!process.env.UMBRELLA_ASSERTS : false) ? (test, msg) => {
|
|
640
|
+
if (typeof test === "function" && !test() || !test) throw new AssertionError(typeof msg === "function" ? msg() : msg);
|
|
641
|
+
} : () => {};
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region node_modules/@thi.ng/binary/rotate.js
|
|
644
|
+
var rotateRight = (x, n) => (x >>> n | x << 32 - n) >>> 0;
|
|
645
|
+
//#endregion
|
|
646
|
+
//#region node_modules/@thi.ng/binary/splat.js
|
|
647
|
+
var interleave4_12_24 = (x) => (x & 3840) * 4352 | (x & 240) * 272 | (x & 15) * 17;
|
|
648
|
+
var interleave4_16_32 = (x) => ((x & 61440) * 69632 | (x & 3840) * 4352 | (x & 240) * 272 | (x & 15) * 17) >>> 0;
|
|
649
|
+
//#endregion
|
|
650
|
+
//#region node_modules/@thi.ng/color/int/int-srgb.js
|
|
651
|
+
var intArgb32Srgb = (out, src) => setC4(out || [], (src >>> 16 & 255) * INV8BIT, (src >>> 8 & 255) * INV8BIT, (src & 255) * INV8BIT, (src >>> 24) * INV8BIT);
|
|
652
|
+
var intAbgr32Srgb = (out, src) => setC4(out || [], (src & 255) * INV8BIT, (src >>> 8 & 255) * INV8BIT, (src >>> 16 & 255) * INV8BIT, (src >>> 24) * INV8BIT);
|
|
653
|
+
//#endregion
|
|
654
|
+
//#region node_modules/@thi.ng/color/css/parse-css.js
|
|
655
|
+
var parseCss = (src) => {
|
|
656
|
+
src = (isString(src) ? src : src.deref()).toLowerCase();
|
|
657
|
+
const named = CSS_NAMES[src] || CSS_SYSTEM_COLORS[src];
|
|
658
|
+
if (named || src[0] === "#") return new ParsedColor("srgb", intArgb32Srgb([], parseHex(named || src)));
|
|
659
|
+
const parts = src.split(/[(),/ ]+/);
|
|
660
|
+
const [mode, a, b, c, d] = parts;
|
|
661
|
+
assert(parts.length === 5 || parts.length === 6, `invalid color: ${src}`);
|
|
662
|
+
switch (mode) {
|
|
663
|
+
case "rgb":
|
|
664
|
+
case "rgba": return new ParsedColor("srgb", [
|
|
665
|
+
__numOrPercent(a, 1, INV8BIT, true),
|
|
666
|
+
__numOrPercent(b, 1, INV8BIT, true),
|
|
667
|
+
__numOrPercent(c, 1, INV8BIT, true),
|
|
668
|
+
__alpha(d)
|
|
669
|
+
]);
|
|
670
|
+
case "hsl":
|
|
671
|
+
case "hsla": return new ParsedColor("hsl", [
|
|
672
|
+
__hue(a),
|
|
673
|
+
__percent(b),
|
|
674
|
+
__percent(c),
|
|
675
|
+
__alpha(d)
|
|
676
|
+
]);
|
|
677
|
+
case "lab": return new ParsedColor("lab50", [
|
|
678
|
+
__numOrPercent(a),
|
|
679
|
+
__numOrPercent(b, 1.25),
|
|
680
|
+
__numOrPercent(c, 1.25),
|
|
681
|
+
__alpha(d)
|
|
682
|
+
]);
|
|
683
|
+
case "lch": return new ParsedColor(mode, [
|
|
684
|
+
__numOrPercent(a),
|
|
685
|
+
__numOrPercent(b, 1.5),
|
|
686
|
+
__hue(c),
|
|
687
|
+
__alpha(d)
|
|
688
|
+
]);
|
|
689
|
+
case "oklab": return new ParsedColor(mode, [
|
|
690
|
+
__numOrPercent(a, 1, 1),
|
|
691
|
+
__numOrPercent(b, .4, 1),
|
|
692
|
+
__numOrPercent(c, .4, 1),
|
|
693
|
+
__alpha(d)
|
|
694
|
+
]);
|
|
695
|
+
case "oklch": return new ParsedColor(mode, [
|
|
696
|
+
__numOrPercent(a, 1, 1),
|
|
697
|
+
__numOrPercent(b, .4, 1),
|
|
698
|
+
__hue(c),
|
|
699
|
+
__alpha(d)
|
|
700
|
+
]);
|
|
701
|
+
default: unsupportedOp(`color mode: ${mode}`);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
var HUE_NORMS = {
|
|
705
|
+
rad: TAU,
|
|
706
|
+
grad: 400,
|
|
707
|
+
turn: 1,
|
|
708
|
+
deg: 360
|
|
709
|
+
};
|
|
710
|
+
var __hue = (x) => {
|
|
711
|
+
const match = /^(-?[0-9.]+)(deg|rad|grad|turn)?$/.exec(x);
|
|
712
|
+
assert(!!match, `expected hue, got: ${x}`);
|
|
713
|
+
return fract(parseFloat(match[1]) / (HUE_NORMS[match[2]] || 360));
|
|
714
|
+
};
|
|
715
|
+
var __alpha = (x) => x ? __numOrPercent(x, 1, 1, true) : 1;
|
|
716
|
+
var __percent = (x, clamp = true) => {
|
|
717
|
+
assert(/^([0-9.]+)%$/.test(x), `expected percentage, got: ${x}`);
|
|
718
|
+
const res = parseFloat(x) / 100;
|
|
719
|
+
return clamp ? clamp01(res) : res;
|
|
720
|
+
};
|
|
721
|
+
var __numOrPercent = (x, scalePerc = 1, scale = .01, clamp = false) => {
|
|
722
|
+
assert(/^-?[0-9.]+%?$/.test(x), `expected number or percentage, got: ${x}`);
|
|
723
|
+
const res = parseFloat(x) * (x.endsWith("%") ? .01 * scalePerc : scale);
|
|
724
|
+
return clamp ? clamp01(res) : res;
|
|
725
|
+
};
|
|
726
|
+
var parseHex = (src) => {
|
|
727
|
+
const match = /^#?([0-9a-f]{3,8})$/i.exec(src);
|
|
728
|
+
if (match) {
|
|
729
|
+
const hex = match[1];
|
|
730
|
+
const val = parseInt(hex, 16);
|
|
731
|
+
switch (hex.length) {
|
|
732
|
+
case 3: return (interleave4_12_24(val) | 4278190080) >>> 0;
|
|
733
|
+
case 4: return rotateRight(interleave4_16_32(val), 8);
|
|
734
|
+
case 6: return (val | 4278190080) >>> 0;
|
|
735
|
+
case 8: return rotateRight(val, 8);
|
|
736
|
+
default:
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return illegalArgs(`invalid hex color: "${src}"`);
|
|
740
|
+
};
|
|
741
|
+
//#endregion
|
|
742
|
+
//#region node_modules/@thi.ng/vectors/vop.js
|
|
743
|
+
var vop = (dispatch = 1, fallback, ...optimized) => {
|
|
744
|
+
const impls = [, ,].concat(optimized);
|
|
745
|
+
const fn = (...args) => {
|
|
746
|
+
const g = impls[args[dispatch].length] || fallback;
|
|
747
|
+
return g ? g(...args) : unsupportedOp(`no impl for vec size ${args[dispatch].length}`);
|
|
748
|
+
};
|
|
749
|
+
fn.add = (dim, fn2) => impls[dim] = fn2;
|
|
750
|
+
fn.default = (fn2) => fallback = fn2;
|
|
751
|
+
fn.impl = (dim) => dim != null ? impls[dim] || fallback : fallback;
|
|
752
|
+
return fn;
|
|
753
|
+
};
|
|
754
|
+
//#endregion
|
|
755
|
+
//#region node_modules/@thi.ng/vectors/set.js
|
|
756
|
+
var set2 = (o, a) => {
|
|
757
|
+
!o && (o = []);
|
|
758
|
+
o[0] = a[0];
|
|
759
|
+
o[1] = a[1];
|
|
760
|
+
return o;
|
|
761
|
+
};
|
|
762
|
+
var set3 = (o, a) => {
|
|
763
|
+
!o && (o = []);
|
|
764
|
+
o[0] = a[0];
|
|
765
|
+
o[1] = a[1];
|
|
766
|
+
o[2] = a[2];
|
|
767
|
+
return o;
|
|
768
|
+
};
|
|
769
|
+
var set4 = (o, a) => {
|
|
770
|
+
!o && (o = []);
|
|
771
|
+
o[0] = a[0];
|
|
772
|
+
o[1] = a[1];
|
|
773
|
+
o[2] = a[2];
|
|
774
|
+
o[3] = a[3];
|
|
775
|
+
return o;
|
|
776
|
+
};
|
|
777
|
+
var set = vop(1, (o, a) => {
|
|
778
|
+
!o && (o = []);
|
|
779
|
+
for (let i = a.length; i-- > 0;) o[i] = a[i];
|
|
780
|
+
return o;
|
|
781
|
+
}, set2, set3, set4);
|
|
782
|
+
//#endregion
|
|
783
|
+
//#region node_modules/@thi.ng/checks/implements-function.js
|
|
784
|
+
var implementsFunction = (x, fn) => typeof x?.[fn] === "function";
|
|
785
|
+
//#endregion
|
|
786
|
+
//#region node_modules/@thi.ng/checks/is-arraylike.js
|
|
787
|
+
var isArrayLike = (x) => x != null && typeof x !== "function" && x.length !== void 0;
|
|
788
|
+
//#endregion
|
|
789
|
+
//#region node_modules/@thi.ng/strings/vector.js
|
|
790
|
+
var vector = memoizeJ((size, prec = 3, d = ",", pre = "[", post = "]") => {
|
|
791
|
+
const f = typeof prec === "number" ? float(prec) : prec;
|
|
792
|
+
switch (size) {
|
|
793
|
+
case 1: return (v) => `${pre}${f(v[0])}${post}`;
|
|
794
|
+
case 2: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${post}`;
|
|
795
|
+
case 3: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${d}${f(v[2])}${post}`;
|
|
796
|
+
case 4: return (v) => `${pre}${f(v[0])}${d}${f(v[1])}${d}${f(v[2])}${d}${f(v[3])}${post}`;
|
|
797
|
+
default: return (v) => {
|
|
798
|
+
const res = [];
|
|
799
|
+
for (let i = 0; i < v.length; i++) res.push(f(v[i]));
|
|
800
|
+
return `${pre}${res.join(d)}${post}`;
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
//#endregion
|
|
805
|
+
//#region node_modules/@thi.ng/vectors/buffer.js
|
|
806
|
+
var mapStridedBuffer = (ctor, buf, num, start, cstride, estride) => {
|
|
807
|
+
const res = [];
|
|
808
|
+
while (num-- > 0) {
|
|
809
|
+
res.push(new ctor(buf, start, cstride));
|
|
810
|
+
start += estride;
|
|
811
|
+
}
|
|
812
|
+
return res;
|
|
813
|
+
};
|
|
814
|
+
//#endregion
|
|
815
|
+
//#region node_modules/@thi.ng/vectors/defopvvv.js
|
|
816
|
+
var defOpVVV = (op, dispatch = 1, outA = true) => {
|
|
817
|
+
const a = outA ? (o, a2, b2, c2) => {
|
|
818
|
+
!o && (o = a2);
|
|
819
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i], c2[i]);
|
|
820
|
+
return o;
|
|
821
|
+
} : (o, a2, b2, c2) => {
|
|
822
|
+
!o && (o = c2);
|
|
823
|
+
for (let i = a2.length; i-- > 0;) o[i] = op(a2[i], b2[i], c2[i]);
|
|
824
|
+
return o;
|
|
825
|
+
};
|
|
826
|
+
const b = outA ? (o, a2, b2, c2) => {
|
|
827
|
+
!o && (o = a2);
|
|
828
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
829
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
830
|
+
return o;
|
|
831
|
+
} : (o, a2, b2, c2) => {
|
|
832
|
+
!o && (o = c2);
|
|
833
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
834
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
835
|
+
return o;
|
|
836
|
+
};
|
|
837
|
+
const c = outA ? (o, a2, b2, c2) => {
|
|
838
|
+
!o && (o = a2);
|
|
839
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
840
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
841
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
842
|
+
return o;
|
|
843
|
+
} : (o, a2, b2, c2) => {
|
|
844
|
+
!o && (o = c2);
|
|
845
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
846
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
847
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
848
|
+
return o;
|
|
849
|
+
};
|
|
850
|
+
const d = outA ? (o, a2, b2, c2) => {
|
|
851
|
+
!o && (o = a2);
|
|
852
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
853
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
854
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
855
|
+
o[3] = op(a2[3], b2[3], c2[3]);
|
|
856
|
+
return o;
|
|
857
|
+
} : (o, a2, b2, c2) => {
|
|
858
|
+
!o && (o = c2);
|
|
859
|
+
o[0] = op(a2[0], b2[0], c2[0]);
|
|
860
|
+
o[1] = op(a2[1], b2[1], c2[1]);
|
|
861
|
+
o[2] = op(a2[2], b2[2], c2[2]);
|
|
862
|
+
o[3] = op(a2[3], b2[3], c2[3]);
|
|
863
|
+
return o;
|
|
864
|
+
};
|
|
865
|
+
return [
|
|
866
|
+
vop(dispatch, a, b, c, d),
|
|
867
|
+
b,
|
|
868
|
+
c,
|
|
869
|
+
d
|
|
870
|
+
];
|
|
871
|
+
};
|
|
872
|
+
//#endregion
|
|
873
|
+
//#region node_modules/@thi.ng/vectors/clamp.js
|
|
874
|
+
var [a, b, c, d] = defOpVVV(clamp);
|
|
875
|
+
var clamp4 = d;
|
|
876
|
+
//#endregion
|
|
877
|
+
//#region node_modules/@thi.ng/vectors/accessors.js
|
|
878
|
+
var declareIndex = (proto, id, idx, strided = true, defNumeric = true) => {
|
|
879
|
+
const get = idx > 0 ? strided ? function() {
|
|
880
|
+
return this.buf[this.offset + idx * this.stride];
|
|
881
|
+
} : function() {
|
|
882
|
+
return this.buf[this.offset + idx];
|
|
883
|
+
} : function() {
|
|
884
|
+
return this.buf[this.offset];
|
|
885
|
+
};
|
|
886
|
+
const set = idx > 0 ? strided ? function(n) {
|
|
887
|
+
this.buf[this.offset + idx * this.stride] = n;
|
|
888
|
+
} : function(n) {
|
|
889
|
+
this.buf[this.offset + idx] = n;
|
|
890
|
+
} : function(n) {
|
|
891
|
+
this.buf[this.offset] = n;
|
|
892
|
+
};
|
|
893
|
+
defNumeric && Object.defineProperty(proto, idx, {
|
|
894
|
+
get,
|
|
895
|
+
set,
|
|
896
|
+
enumerable: true
|
|
897
|
+
});
|
|
898
|
+
Object.defineProperty(proto, id, {
|
|
899
|
+
get,
|
|
900
|
+
set,
|
|
901
|
+
enumerable: true
|
|
902
|
+
});
|
|
903
|
+
};
|
|
904
|
+
var declareIndices = (proto, props, strided, defNumeric) => props.forEach((id, i) => declareIndex(proto, id, i, strided, defNumeric));
|
|
905
|
+
//#endregion
|
|
906
|
+
//#region node_modules/@thi.ng/math/eqdelta.js
|
|
907
|
+
var abs = Math.abs;
|
|
908
|
+
var eqDelta$1 = (a, b, eps = EPS) => abs(a - b) <= eps;
|
|
909
|
+
//#endregion
|
|
910
|
+
//#region node_modules/@thi.ng/vectors/eqdelta.js
|
|
911
|
+
var eqDelta2 = (a, b, eps = EPS) => {
|
|
912
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps);
|
|
913
|
+
};
|
|
914
|
+
var eqDelta3 = (a, b, eps = EPS) => {
|
|
915
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps) && eqDelta$1(a[2], b[2], eps);
|
|
916
|
+
};
|
|
917
|
+
var eqDelta4 = (a, b, eps = EPS) => {
|
|
918
|
+
return a.length === b.length && eqDelta$1(a[0], b[0], eps) && eqDelta$1(a[1], b[1], eps) && eqDelta$1(a[2], b[2], eps) && eqDelta$1(a[3], b[3], eps);
|
|
919
|
+
};
|
|
920
|
+
var eqDelta = vop(0, (v1, v2, eps = EPS) => {
|
|
921
|
+
if (implementsFunction(v1, "eqDelta")) return v1.eqDelta(v2, eps);
|
|
922
|
+
if (implementsFunction(v2, "eqDelta")) return v2.eqDelta(v1, eps);
|
|
923
|
+
return eqDeltaS(v1, v2, v1.length, eps);
|
|
924
|
+
}, eqDelta2, eqDelta3, eqDelta4);
|
|
925
|
+
var eqDeltaS = (a, b, n, eps = EPS, ia = 0, ib = 0, sa = 1, sb = 1) => {
|
|
926
|
+
for (; n > 0; n--, ia += sa, ib += sb) if (!eqDelta$1(a[ia], b[ib], eps)) return false;
|
|
927
|
+
return true;
|
|
928
|
+
};
|
|
929
|
+
//#endregion
|
|
930
|
+
//#region node_modules/@thi.ng/vectors/iterator.js
|
|
931
|
+
function* stridedValues(buf, num, start, stride) {
|
|
932
|
+
while (num-- > 0) {
|
|
933
|
+
yield buf[start];
|
|
934
|
+
start += stride;
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
//#endregion
|
|
938
|
+
//#region node_modules/@thi.ng/vectors/rand-minmax.js
|
|
939
|
+
var randMinMax = vop(1, (o, a, b, rnd = SYSTEM) => {
|
|
940
|
+
!o && (o = a);
|
|
941
|
+
for (let i = a.length; i-- > 0;) o[i] = rnd.minmax(a[i], b[i]);
|
|
942
|
+
return o;
|
|
943
|
+
});
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region node_modules/@thi.ng/color/convert.js
|
|
946
|
+
var CONVERSIONS = {};
|
|
947
|
+
var defConversions = (mode, spec) => {
|
|
948
|
+
for (const id in spec) {
|
|
949
|
+
const val = spec[id];
|
|
950
|
+
if (isArray(val)) {
|
|
951
|
+
const [a, b, c, d] = val;
|
|
952
|
+
spec[id] = val.length === 2 ? (out, src) => b(out, a(out, src)) : val.length === 3 ? (out, src) => c(out, b(out, a(out, src))) : (out, src) => d(out, c(out, b(out, a(out, src))));
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
CONVERSIONS[mode] = {
|
|
956
|
+
...CONVERSIONS[mode],
|
|
957
|
+
...spec
|
|
958
|
+
};
|
|
959
|
+
};
|
|
960
|
+
var convert = (res, src, destMode, srcMode) => {
|
|
961
|
+
const spec = CONVERSIONS[destMode];
|
|
962
|
+
assert(!!spec, `no conversions available for ${destMode}`);
|
|
963
|
+
let $convert = spec[srcMode];
|
|
964
|
+
return $convert ? $convert(res, src) : CONVERSIONS.rgb[srcMode] ? spec.rgb(res, CONVERSIONS.rgb[srcMode]([], src)) : unsupportedOp(`can't convert: ${srcMode} -> ${destMode}`);
|
|
965
|
+
};
|
|
966
|
+
//#endregion
|
|
967
|
+
//#region node_modules/@thi.ng/color/defcolor.js
|
|
968
|
+
var defColor = (spec) => {
|
|
969
|
+
const channels = spec.channels || {};
|
|
970
|
+
const order = spec.order;
|
|
971
|
+
const numChannels = order.length;
|
|
972
|
+
order.reduce((acc, id) => {
|
|
973
|
+
acc[id] = {
|
|
974
|
+
range: [0, 1],
|
|
975
|
+
...channels[id]
|
|
976
|
+
};
|
|
977
|
+
return acc;
|
|
978
|
+
}, channels);
|
|
979
|
+
const min = Object.freeze(order.map((id) => channels[id].range[0]));
|
|
980
|
+
const max = Object.freeze(order.map((id) => channels[id].range[1]));
|
|
981
|
+
const minR = set4([], min);
|
|
982
|
+
const maxR = set4([], max);
|
|
983
|
+
minR[numChannels - 1] = 1;
|
|
984
|
+
const hueChanID = order.findIndex((id) => !!channels[id].hue);
|
|
985
|
+
const $Color = class {
|
|
986
|
+
constructor(buf, offset = 0, stride = 1) {
|
|
987
|
+
this.offset = offset;
|
|
988
|
+
this.stride = stride;
|
|
989
|
+
this.buf = buf || [
|
|
990
|
+
0,
|
|
991
|
+
0,
|
|
992
|
+
0,
|
|
993
|
+
0
|
|
994
|
+
];
|
|
995
|
+
this.offset = offset;
|
|
996
|
+
this.stride = stride;
|
|
997
|
+
}
|
|
998
|
+
buf;
|
|
999
|
+
get mode() {
|
|
1000
|
+
return spec.mode;
|
|
1001
|
+
}
|
|
1002
|
+
get length() {
|
|
1003
|
+
return numChannels;
|
|
1004
|
+
}
|
|
1005
|
+
get range() {
|
|
1006
|
+
return [min, max];
|
|
1007
|
+
}
|
|
1008
|
+
get [Symbol.toStringTag]() {
|
|
1009
|
+
return spec.mode;
|
|
1010
|
+
}
|
|
1011
|
+
get xyz() {
|
|
1012
|
+
return [
|
|
1013
|
+
this[0],
|
|
1014
|
+
this[1],
|
|
1015
|
+
this[2]
|
|
1016
|
+
];
|
|
1017
|
+
}
|
|
1018
|
+
[Symbol.iterator]() {
|
|
1019
|
+
return stridedValues(this.buf, this.length, this.offset, this.stride);
|
|
1020
|
+
}
|
|
1021
|
+
copy() {
|
|
1022
|
+
return new $Color(this.deref());
|
|
1023
|
+
}
|
|
1024
|
+
copyView() {
|
|
1025
|
+
return new $Color(this.buf, this.offset, this.stride);
|
|
1026
|
+
}
|
|
1027
|
+
empty() {
|
|
1028
|
+
return new $Color();
|
|
1029
|
+
}
|
|
1030
|
+
deref() {
|
|
1031
|
+
return [
|
|
1032
|
+
this[0],
|
|
1033
|
+
this[1],
|
|
1034
|
+
this[2],
|
|
1035
|
+
this[3]
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
set(src) {
|
|
1039
|
+
return set4(this, src);
|
|
1040
|
+
}
|
|
1041
|
+
clamp() {
|
|
1042
|
+
hueChanID >= 0 && (this[hueChanID] = fract(this[hueChanID]));
|
|
1043
|
+
clamp4(null, this, min, max);
|
|
1044
|
+
return this;
|
|
1045
|
+
}
|
|
1046
|
+
eqDelta(o, eps = EPS) {
|
|
1047
|
+
return eqDelta4(this, o, eps);
|
|
1048
|
+
}
|
|
1049
|
+
randomize(rnd) {
|
|
1050
|
+
return randMinMax(this, minR, maxR, rnd);
|
|
1051
|
+
}
|
|
1052
|
+
toJSON() {
|
|
1053
|
+
return this.deref();
|
|
1054
|
+
}
|
|
1055
|
+
toString() {
|
|
1056
|
+
return vector(4, 4)(this);
|
|
1057
|
+
}
|
|
1058
|
+
};
|
|
1059
|
+
declareIndices($Color.prototype, order);
|
|
1060
|
+
defConversions(spec.mode, spec.from);
|
|
1061
|
+
defConversions("rgb", { [spec.mode]: spec.toRgb });
|
|
1062
|
+
const fromColor = (src, mode, args) => {
|
|
1063
|
+
const res = new $Color(...args);
|
|
1064
|
+
return mode !== spec.mode ? convert(res, src, spec.mode, mode) : res.set(src);
|
|
1065
|
+
};
|
|
1066
|
+
const factory = (src, ...args) => src == null ? new $Color() : isString(src) ? factory(parseCss(src), ...args) : isArrayLike(src) ? isString(src.mode) ? fromColor(src, src.mode, args) : new $Color(src, ...args) : implementsFunction(src, "deref") ? fromColor(src.deref(), src.mode, args) : isNumber(src) ? args.length && args.every(isNumber) ? new $Color(...__ensureArgs([src, ...args])) : fromColor(intArgb32Srgb([], src), "srgb", args) : illegalArgs(`can't create a ${spec.mode} color from: ${src}`);
|
|
1067
|
+
factory.class = $Color;
|
|
1068
|
+
factory.range = [min, max];
|
|
1069
|
+
factory.random = (rnd, buf, idx, stride) => new $Color(buf, idx, stride).randomize(rnd);
|
|
1070
|
+
factory.mapBuffer = (buf, num = buf.length / numChannels | 0, start = 0, cstride = 1, estride = numChannels) => mapStridedBuffer($Color, buf, num, start, cstride, estride);
|
|
1071
|
+
return factory;
|
|
1072
|
+
};
|
|
1073
|
+
//#endregion
|
|
1074
|
+
//#region node_modules/@thi.ng/vectors/dot.js
|
|
1075
|
+
var dot2 = (a, b) => a[0] * b[0] + a[1] * b[1];
|
|
1076
|
+
var dot3 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
1077
|
+
var dot4 = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
|
|
1078
|
+
var dot = vop(0, (a, b) => {
|
|
1079
|
+
let sum = 0;
|
|
1080
|
+
for (let i = a.length; i-- > 0;) sum += a[i] * b[i];
|
|
1081
|
+
return sum;
|
|
1082
|
+
}, dot2, dot3, dot4);
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region node_modules/@thi.ng/color/luminance-rgb.js
|
|
1085
|
+
var luminanceRgb = (rgb, weights = RGB_LUMINANCE_REC709) => dot3(rgb, weights);
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region node_modules/@thi.ng/color/rgb/hue-rgb.js
|
|
1088
|
+
var hueRgb = (out, hue, alpha = 1) => {
|
|
1089
|
+
hue = fract(hue) * 6;
|
|
1090
|
+
return setC4(out || [], clamp01(Math.abs(hue - 3) - 1), clamp01(2 - Math.abs(hue - 2)), clamp01(2 - Math.abs(hue - 4)), alpha);
|
|
1091
|
+
};
|
|
1092
|
+
//#endregion
|
|
1093
|
+
//#region node_modules/@thi.ng/color/hcy/hcy-rgb.js
|
|
1094
|
+
var hcyRgb = (out, src) => {
|
|
1095
|
+
const h = src[0];
|
|
1096
|
+
let c = src[1];
|
|
1097
|
+
const y = src[2];
|
|
1098
|
+
const rgb = hueRgb(out || src, h, __ensureAlpha(src[3]));
|
|
1099
|
+
const lum = luminanceRgb(rgb);
|
|
1100
|
+
if (y < lum) c *= y / lum;
|
|
1101
|
+
else if (lum < 1) c *= (1 - y) / (1 - lum);
|
|
1102
|
+
return setC3(rgb, clamp01((rgb[0] - lum) * c + y), clamp01((rgb[1] - lum) * c + y), clamp01((rgb[2] - lum) * c + y));
|
|
1103
|
+
};
|
|
1104
|
+
//#endregion
|
|
1105
|
+
//#region node_modules/@thi.ng/color/hsi/hsi-rgb.js
|
|
1106
|
+
var hsiRgb = (out, src) => {
|
|
1107
|
+
out = clampH(out || src, src);
|
|
1108
|
+
const s = out[1];
|
|
1109
|
+
const i = out[2];
|
|
1110
|
+
if (s < 1e-6) return setC3(out, i, i, i);
|
|
1111
|
+
const h = out[0] * 6 % 6;
|
|
1112
|
+
const m = i * (1 - s);
|
|
1113
|
+
const z = 1 - Math.abs(h % 2 - 1);
|
|
1114
|
+
let c = 3 * i * s / (1 + z);
|
|
1115
|
+
const x = c * z + m;
|
|
1116
|
+
c += m;
|
|
1117
|
+
switch (h | 0) {
|
|
1118
|
+
case 0: return setC3(out, c, x, m);
|
|
1119
|
+
case 1: return setC3(out, x, c, m);
|
|
1120
|
+
case 2: return setC3(out, m, c, x);
|
|
1121
|
+
case 3: return setC3(out, m, x, c);
|
|
1122
|
+
case 4: return setC3(out, x, m, c);
|
|
1123
|
+
case 5: return setC3(out, c, m, x);
|
|
1124
|
+
default: return setC3(out, m, m, m);
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
//#endregion
|
|
1128
|
+
//#region node_modules/@thi.ng/color/hsl/hsl-rgb.js
|
|
1129
|
+
var hslRgb = (out, src) => {
|
|
1130
|
+
const s = clamp01(src[1]);
|
|
1131
|
+
const l = clamp01(src[2]);
|
|
1132
|
+
out = hueRgb(out || src, src[0], __ensureAlpha(src[3]));
|
|
1133
|
+
const c = (1 - Math.abs(2 * l - 1)) * s;
|
|
1134
|
+
return setC3(out, (out[0] - .5) * c + l, (out[1] - .5) * c + l, (out[2] - .5) * c + l);
|
|
1135
|
+
};
|
|
1136
|
+
//#endregion
|
|
1137
|
+
//#region node_modules/@thi.ng/color/hsv/hsv-rgb.js
|
|
1138
|
+
var hsvRgb = (out, src) => {
|
|
1139
|
+
out = clampH(out || src, src);
|
|
1140
|
+
const s = out[1];
|
|
1141
|
+
const v = out[2];
|
|
1142
|
+
hueRgb(out, src[0], out[3]);
|
|
1143
|
+
return setC3(out, ((out[0] - 1) * s + 1) * v, ((out[1] - 1) * s + 1) * v, ((out[2] - 1) * s + 1) * v);
|
|
1144
|
+
};
|
|
1145
|
+
//#endregion
|
|
1146
|
+
//#region node_modules/@thi.ng/color/linear.js
|
|
1147
|
+
var linearSrgb = (x) => x <= .0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - .055;
|
|
1148
|
+
var srgbLinear = (x) => x <= .04045 ? x / 12.92 : Math.pow((x + .055) / 1.055, 2.4);
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region node_modules/@thi.ng/color/srgb/srgb-rgb.js
|
|
1151
|
+
var srgbRgb = (out, src) => setC4(out || src, srgbLinear(src[0]), srgbLinear(src[1]), srgbLinear(src[2]), __ensureAlpha(src[3]));
|
|
1152
|
+
//#endregion
|
|
1153
|
+
//#region node_modules/@thi.ng/color/rgb/rgb-srgb.js
|
|
1154
|
+
var rgbSrgb = (out, src) => setC4(out || src, linearSrgb(src[0]), linearSrgb(src[1]), linearSrgb(src[2]), __ensureAlpha(src[3]));
|
|
1155
|
+
var GAMMA = 1 / 2.2;
|
|
1156
|
+
//#endregion
|
|
1157
|
+
//#region node_modules/@thi.ng/color/srgb/srgb.js
|
|
1158
|
+
var srgb = defColor({
|
|
1159
|
+
mode: "srgb",
|
|
1160
|
+
order: [
|
|
1161
|
+
"r",
|
|
1162
|
+
"g",
|
|
1163
|
+
"b",
|
|
1164
|
+
"alpha"
|
|
1165
|
+
],
|
|
1166
|
+
from: {
|
|
1167
|
+
abgr32: (out, src) => intAbgr32Srgb(out, src[0]),
|
|
1168
|
+
argb32: (out, src) => intArgb32Srgb(out, src[0]),
|
|
1169
|
+
hcy: hcyRgb,
|
|
1170
|
+
hsi: hsiRgb,
|
|
1171
|
+
hsl: hslRgb,
|
|
1172
|
+
hsv: hsvRgb,
|
|
1173
|
+
rgb: rgbSrgb
|
|
1174
|
+
},
|
|
1175
|
+
toRgb: srgbRgb
|
|
1176
|
+
});
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region lib/components/color-pickers/gradient-editor.jsx
|
|
1179
|
+
var getGradientResult = (input, type) => {
|
|
1180
|
+
if (!input || !type) return "";
|
|
1181
|
+
if (typeof input === "string" || !input?.stops) return "";
|
|
1182
|
+
let output = "";
|
|
1183
|
+
const { repeating } = input;
|
|
1184
|
+
if (repeating) output += "repeating-";
|
|
1185
|
+
output += `${type}-gradient(`;
|
|
1186
|
+
if (type === "linear") {
|
|
1187
|
+
const { orientation } = input;
|
|
1188
|
+
if (orientation?.type === "angular") output += `${orientation.value.value}${orientation.value.unit}, `;
|
|
1189
|
+
else if (orientation?.type === "directional") output += `to ${orientation.value}, `;
|
|
1190
|
+
}
|
|
1191
|
+
if (type === "radial") {
|
|
1192
|
+
const { shape, position } = input;
|
|
1193
|
+
output += `${shape ?? "circle"} at ${position?.x?.value ?? "center"} ${position?.y?.value ?? "center"}, `;
|
|
1194
|
+
}
|
|
1195
|
+
if (type === "conic") {
|
|
1196
|
+
const { angle, position } = input;
|
|
1197
|
+
output += `from ${angle ?? "0deg"} at ${position ?? "center"}, `;
|
|
1198
|
+
}
|
|
1199
|
+
output += input.stops.map((stop) => {
|
|
1200
|
+
return `${stop.color} ${stop.offset?.value ?? ""}${stop.offset?.unit ?? ""}`.trim();
|
|
1201
|
+
}).join(", ");
|
|
1202
|
+
output += ")";
|
|
1203
|
+
return output;
|
|
1204
|
+
};
|
|
1205
|
+
var gradientTypes = [
|
|
1206
|
+
{
|
|
1207
|
+
label: __("Linear"),
|
|
1208
|
+
value: "linear",
|
|
1209
|
+
icon: jsx("div", { className: "es:transparent es:size-4 es:rounded-full es:bg-linear-to-br es:from-current" })
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
label: __("Radial"),
|
|
1213
|
+
value: "radial",
|
|
1214
|
+
icon: jsx("div", { className: "es:transparent es:size-4 es:rounded-full es:bg-radial es:from-current/75 es:to-current/10" })
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
label: __("Conic"),
|
|
1218
|
+
value: "conic",
|
|
1219
|
+
icon: jsx("div", { className: "es:transparent es:size-4 es:rounded-full es:bg-conic es:from-current" })
|
|
1220
|
+
}
|
|
1221
|
+
];
|
|
1222
|
+
var linearDirections = [
|
|
1223
|
+
{
|
|
1224
|
+
label: __("Right"),
|
|
1225
|
+
value: "right",
|
|
1226
|
+
iconClass: "es:bg-linear-to-r",
|
|
1227
|
+
valueDegrees: 90
|
|
1228
|
+
},
|
|
1229
|
+
{
|
|
1230
|
+
label: __("Left"),
|
|
1231
|
+
value: "left",
|
|
1232
|
+
iconClass: "es:bg-linear-to-l",
|
|
1233
|
+
valueDegrees: 180
|
|
1234
|
+
},
|
|
1235
|
+
{
|
|
1236
|
+
label: __("Top"),
|
|
1237
|
+
value: "top",
|
|
1238
|
+
iconClass: "es:bg-linear-to-t",
|
|
1239
|
+
valueDegrees: 270
|
|
1240
|
+
},
|
|
1241
|
+
{
|
|
1242
|
+
label: __("Bottom"),
|
|
1243
|
+
value: "bottom",
|
|
1244
|
+
iconClass: "es:bg-linear-to-b",
|
|
1245
|
+
valueDegrees: 90
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
label: __("Top-right"),
|
|
1249
|
+
value: "top right",
|
|
1250
|
+
iconClass: "es:bg-linear-to-tr",
|
|
1251
|
+
valueDegrees: 45
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
label: __("Top-left"),
|
|
1255
|
+
value: "top left",
|
|
1256
|
+
iconClass: "es:bg-linear-to-tl",
|
|
1257
|
+
valueDegrees: 315
|
|
1258
|
+
},
|
|
1259
|
+
{
|
|
1260
|
+
label: __("Bottom-right"),
|
|
1261
|
+
value: "bottom right",
|
|
1262
|
+
iconClass: "es:bg-linear-to-br",
|
|
1263
|
+
valueDegrees: 135
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
label: __("Bottom-left"),
|
|
1267
|
+
value: "bottom left",
|
|
1268
|
+
iconClass: "es:bg-linear-to-bl",
|
|
1269
|
+
valueDegrees: 225
|
|
1270
|
+
}
|
|
1271
|
+
];
|
|
1272
|
+
/**
|
|
1273
|
+
* A simple gradient editor.
|
|
1274
|
+
* Allows editing linear, radial, and conic gradients.
|
|
1275
|
+
*
|
|
1276
|
+
* @component
|
|
1277
|
+
* @param {Object} props - Component props.
|
|
1278
|
+
* @param {string} props.value - The gradient definition.
|
|
1279
|
+
* @param {Function} props.onChange - Function to run when the gradient changes.
|
|
1280
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
1281
|
+
*
|
|
1282
|
+
* @returns {JSX.Element} The GradientEditor component.
|
|
1283
|
+
*
|
|
1284
|
+
* @example
|
|
1285
|
+
* <GradientEditor
|
|
1286
|
+
* value='linear-gradient(90deg, #000000 0%, #ffffff 100%)'
|
|
1287
|
+
* onChange={setGradient}
|
|
1288
|
+
* />
|
|
1289
|
+
*/
|
|
1290
|
+
var GradientEditor = (props) => {
|
|
1291
|
+
const { value, onChange, hidden } = props;
|
|
1292
|
+
const gradientData = useMemo(() => {
|
|
1293
|
+
if (value?.startsWith("radial-gradient") || value?.startsWith("repeating-radial-gradient")) return K(value ?? "");
|
|
1294
|
+
if (value?.startsWith("conic-gradient") || value?.startsWith("repeating-conic-gradient")) return j(value ?? "");
|
|
1295
|
+
return P(value ?? "");
|
|
1296
|
+
}, [value]);
|
|
1297
|
+
const gradientType = useMemo(() => {
|
|
1298
|
+
if (typeof value === "string" && value?.startsWith("radial-gradient") || value?.startsWith("repeating-radial-gradient")) return "radial";
|
|
1299
|
+
if (typeof value === "string" && value?.startsWith("conic-gradient") || value?.startsWith("repeating-conic-gradient")) return "conic";
|
|
1300
|
+
return "linear";
|
|
1301
|
+
}, [value]);
|
|
1302
|
+
const setGradientData = (data) => {
|
|
1303
|
+
onChange(getGradientResult(data, gradientType));
|
|
1304
|
+
};
|
|
1305
|
+
const outputGradient = useMemo(() => getGradientResult(gradientData, gradientType), [gradientData, gradientType]);
|
|
1306
|
+
const [squarePreview, setSquarePreview] = useState(false);
|
|
1307
|
+
if (hidden) return null;
|
|
1308
|
+
return jsxs("div", {
|
|
1309
|
+
className: "es:w-full es:space-y-2.5",
|
|
1310
|
+
children: [
|
|
1311
|
+
jsx(ContainerGroup, { children: jsxs(Container, { children: [jsx("button", {
|
|
1312
|
+
className: clsx("es:shadow-sm, es:mx-auto es:block es:h-40 es:rounded-lg es:border es:border-secondary-300 es:transition-[width] es:duration-300 es:ease-spring-snappy", "es:mb-2", squarePreview ? "es:w-40" : "es:w-full"),
|
|
1313
|
+
style: { backgroundImage: outputGradient },
|
|
1314
|
+
onClick: () => setSquarePreview((prev) => !prev),
|
|
1315
|
+
"aria-label": __("Toggle preview size", "eightshift-ui-components")
|
|
1316
|
+
}), jsx(Slider, {
|
|
1317
|
+
className: "es:mb-5",
|
|
1318
|
+
"aria-label": __("Stop positions", "eightshift-ui-components"),
|
|
1319
|
+
min: 0,
|
|
1320
|
+
max: 100,
|
|
1321
|
+
step: 1,
|
|
1322
|
+
value: gradientData?.stops?.map(({ offset }, i) => {
|
|
1323
|
+
if (!offset) return i * 100 / (gradientData.stops.length - 1);
|
|
1324
|
+
return parseInt(offset?.value);
|
|
1325
|
+
}),
|
|
1326
|
+
onChange: (value) => {
|
|
1327
|
+
setGradientData({
|
|
1328
|
+
...gradientData,
|
|
1329
|
+
stops: gradientData.stops.map((stop, i) => {
|
|
1330
|
+
return {
|
|
1331
|
+
...stop,
|
|
1332
|
+
offset: {
|
|
1333
|
+
value: value[i],
|
|
1334
|
+
unit: "%"
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
})
|
|
1338
|
+
});
|
|
1339
|
+
},
|
|
1340
|
+
thumbContent: (index) => {
|
|
1341
|
+
const colorData = srgb(gradientData.stops[index]?.color);
|
|
1342
|
+
let foregroundColor = "black";
|
|
1343
|
+
if (colorData.alpha >= .5 && isColorDark(colorData.r, colorData.g, colorData.b)) foregroundColor = "white";
|
|
1344
|
+
return jsx("div", {
|
|
1345
|
+
className: "es:pointer-events-none es:absolute es:-bottom-4.5 es:-translate-x-1/3 es:flex es:w-3 es:items-center es:justify-center es:text-center es:text-12 es:leading-none es:py-px es:rounded-sm es:font-semibold es:tabular-nums es:font-mono es:ring es:ring-accent-600",
|
|
1346
|
+
style: {
|
|
1347
|
+
backgroundColor: gradientData.stops[index]?.color,
|
|
1348
|
+
color: foregroundColor
|
|
1349
|
+
},
|
|
1350
|
+
children: index + 1
|
|
1351
|
+
});
|
|
1352
|
+
},
|
|
1353
|
+
noActiveHighlight: true,
|
|
1354
|
+
tooltipContent: (value) => `${Math.round(value)}%`
|
|
1355
|
+
})] }) }),
|
|
1356
|
+
jsxs(ContainerGroup, { children: [
|
|
1357
|
+
jsx(Container, { children: jsx(OptionSelect, {
|
|
1358
|
+
label: __("Type", "eightshift-ui-components"),
|
|
1359
|
+
value: gradientType,
|
|
1360
|
+
onChange: (value) => onChange(getGradientResult({ stops: gradientData.stops }, value)),
|
|
1361
|
+
options: gradientTypes,
|
|
1362
|
+
type: "toggleButtons",
|
|
1363
|
+
inline: true
|
|
1364
|
+
}) }),
|
|
1365
|
+
jsx(Container, {
|
|
1366
|
+
hidden: gradientType !== "linear",
|
|
1367
|
+
children: jsx(NumberPicker, {
|
|
1368
|
+
inline: true,
|
|
1369
|
+
icon: angle,
|
|
1370
|
+
label: __("Angle", "eightshift-ui-components"),
|
|
1371
|
+
min: 0,
|
|
1372
|
+
max: 360,
|
|
1373
|
+
step: 1,
|
|
1374
|
+
value: gradientData?.orientation?.type === "angular" ? gradientData?.orientation?.value?.value : null,
|
|
1375
|
+
onChange: (angle) => {
|
|
1376
|
+
setGradientData({
|
|
1377
|
+
...gradientData,
|
|
1378
|
+
orientation: {
|
|
1379
|
+
type: "angular",
|
|
1380
|
+
value: {
|
|
1381
|
+
value: angle,
|
|
1382
|
+
unit: "deg"
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
});
|
|
1386
|
+
},
|
|
1387
|
+
suffix: "°",
|
|
1388
|
+
size: "medium",
|
|
1389
|
+
className: "es:grow",
|
|
1390
|
+
placeholder: linearDirections.find(({ value }) => value === gradientData?.orientation?.value)?.valueDegrees ?? "",
|
|
1391
|
+
children: jsx(Menu, {
|
|
1392
|
+
triggerIcon: sliders,
|
|
1393
|
+
triggerProps: {
|
|
1394
|
+
tooltip: __("Presets", "eightshift-ui-components"),
|
|
1395
|
+
slot: null
|
|
1396
|
+
},
|
|
1397
|
+
keepOpen: true,
|
|
1398
|
+
children: linearDirections.map(({ label, value, iconClass }) => {
|
|
1399
|
+
return jsx(MenuItem, {
|
|
1400
|
+
icon: jsx("div", { className: clsx("es:size-5 es:rounded-sm es:from-secondary-700 es:to-secondary-200", iconClass) }),
|
|
1401
|
+
onClick: () => {
|
|
1402
|
+
setGradientData({
|
|
1403
|
+
...gradientData,
|
|
1404
|
+
orientation: {
|
|
1405
|
+
type: "directional",
|
|
1406
|
+
value
|
|
1407
|
+
}
|
|
1408
|
+
});
|
|
1409
|
+
},
|
|
1410
|
+
children: label
|
|
1411
|
+
}, value);
|
|
1412
|
+
})
|
|
1413
|
+
})
|
|
1414
|
+
})
|
|
1415
|
+
}),
|
|
1416
|
+
jsx(Container, {
|
|
1417
|
+
hidden: gradientType !== "radial",
|
|
1418
|
+
children: jsx(OptionSelect, {
|
|
1419
|
+
label: __("Shape", "eightshift-ui-components"),
|
|
1420
|
+
icon: genericShapesAlt,
|
|
1421
|
+
inline: true,
|
|
1422
|
+
options: [{
|
|
1423
|
+
label: __("Circle", "eightshift-ui-components"),
|
|
1424
|
+
value: "circle"
|
|
1425
|
+
}, {
|
|
1426
|
+
label: __("Ellipse", "eightshift-ui-components"),
|
|
1427
|
+
value: "ellipse"
|
|
1428
|
+
}],
|
|
1429
|
+
value: gradientData.shape,
|
|
1430
|
+
onChange: (value) => {
|
|
1431
|
+
setGradientData({
|
|
1432
|
+
...gradientData,
|
|
1433
|
+
shape: value
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
})
|
|
1437
|
+
}),
|
|
1438
|
+
jsx(Container, {
|
|
1439
|
+
hidden: gradientType !== "radial",
|
|
1440
|
+
children: jsx(MatrixAlign, {
|
|
1441
|
+
icon: centerPoint,
|
|
1442
|
+
label: __("Center point", "eightshift-ui-components"),
|
|
1443
|
+
value: `${gradientData?.position?.y?.value ?? "center"} ${gradientData?.position?.x?.value ?? "center"}`,
|
|
1444
|
+
onChange: (position) => {
|
|
1445
|
+
const [x, y] = position.split(" ");
|
|
1446
|
+
setGradientData({
|
|
1447
|
+
...gradientData,
|
|
1448
|
+
position: {
|
|
1449
|
+
x: {
|
|
1450
|
+
type: "keyword",
|
|
1451
|
+
value: x
|
|
1452
|
+
},
|
|
1453
|
+
y: {
|
|
1454
|
+
type: "keyword",
|
|
1455
|
+
value: y
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
})
|
|
1461
|
+
}),
|
|
1462
|
+
jsx(Container, {
|
|
1463
|
+
hidden: gradientType !== "conic",
|
|
1464
|
+
children: jsx(NumberPicker, {
|
|
1465
|
+
inline: true,
|
|
1466
|
+
icon: angle,
|
|
1467
|
+
label: __("Angle", "eightshift-ui-components"),
|
|
1468
|
+
min: 0,
|
|
1469
|
+
max: 360,
|
|
1470
|
+
step: 1,
|
|
1471
|
+
value: parseInt(gradientData?.angle?.replace("deg", "")),
|
|
1472
|
+
onChange: (value) => {
|
|
1473
|
+
setGradientData({
|
|
1474
|
+
...gradientData,
|
|
1475
|
+
angle: `${value}deg`
|
|
1476
|
+
});
|
|
1477
|
+
},
|
|
1478
|
+
size: "medium",
|
|
1479
|
+
suffix: "°"
|
|
1480
|
+
})
|
|
1481
|
+
}),
|
|
1482
|
+
jsx(Container, {
|
|
1483
|
+
hidden: gradientType !== "conic",
|
|
1484
|
+
children: jsx(MatrixAlign, {
|
|
1485
|
+
icon: centerPoint,
|
|
1486
|
+
label: __("Center point", "eightshift-ui-components"),
|
|
1487
|
+
value: `${gradientData?.position?.y?.value ?? "center"} ${gradientData?.position?.x?.value ?? "center"}`,
|
|
1488
|
+
onChange: (value) => {
|
|
1489
|
+
setGradientData({
|
|
1490
|
+
...gradientData,
|
|
1491
|
+
position: value
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
})
|
|
1495
|
+
}),
|
|
1496
|
+
jsx(Container, { children: jsx(Toggle, {
|
|
1497
|
+
checked: gradientData.repeating,
|
|
1498
|
+
onChange: (value) => {
|
|
1499
|
+
setGradientData({
|
|
1500
|
+
...gradientData,
|
|
1501
|
+
repeating: value
|
|
1502
|
+
});
|
|
1503
|
+
},
|
|
1504
|
+
label: __("Repeating", "eightshift-ui-components"),
|
|
1505
|
+
icon: gradientRepeat
|
|
1506
|
+
}) })
|
|
1507
|
+
] }),
|
|
1508
|
+
jsx(BaseControl, {
|
|
1509
|
+
icon: gradientStop,
|
|
1510
|
+
label: __("Gradient stops", "eightshift-ui-components"),
|
|
1511
|
+
inline: true,
|
|
1512
|
+
children: jsx(Button, {
|
|
1513
|
+
icon: add,
|
|
1514
|
+
size: "small",
|
|
1515
|
+
onPress: () => {
|
|
1516
|
+
setGradientData({
|
|
1517
|
+
...gradientData,
|
|
1518
|
+
stops: [...gradientData.stops, { color: "#000000FF" }]
|
|
1519
|
+
});
|
|
1520
|
+
},
|
|
1521
|
+
type: "simple",
|
|
1522
|
+
"aria-label": __("Add stop", "eightshift-ui-components")
|
|
1523
|
+
})
|
|
1524
|
+
}),
|
|
1525
|
+
jsx(ContainerGroup, { children: jsx(DraggableList, {
|
|
1526
|
+
items: gradientData?.stops,
|
|
1527
|
+
onChange: (items) => {
|
|
1528
|
+
setGradientData({
|
|
1529
|
+
...gradientData,
|
|
1530
|
+
stops: items.map(({ color }, i) => ({
|
|
1531
|
+
...gradientData.stops[i] ?? {},
|
|
1532
|
+
color
|
|
1533
|
+
}))
|
|
1534
|
+
});
|
|
1535
|
+
},
|
|
1536
|
+
orientation: "vertical",
|
|
1537
|
+
className: "es:contents",
|
|
1538
|
+
children: (item) => {
|
|
1539
|
+
const { color, updateData, itemIndex } = item;
|
|
1540
|
+
return jsx(DraggableListItem, {
|
|
1541
|
+
label: sprintf(__("Stop %s", "eightshift-ui-components"), itemIndex + 1),
|
|
1542
|
+
subtitle: color,
|
|
1543
|
+
icon: jsx(TriggeredPopover, {
|
|
1544
|
+
triggerButtonIcon: jsx($251c695a52d94a8d$export$cae13e90592f246a, {
|
|
1545
|
+
className: "es:size-5.5 es:rounded-full es:border es:border-white es:ring-1 es:ring-black",
|
|
1546
|
+
color
|
|
1547
|
+
}),
|
|
1548
|
+
triggerButtonProps: {
|
|
1549
|
+
size: "small",
|
|
1550
|
+
type: "ghost",
|
|
1551
|
+
className: "es:p-0!"
|
|
1552
|
+
},
|
|
1553
|
+
className: "es:p-2.5",
|
|
1554
|
+
children: jsx(SolidColorPicker, {
|
|
1555
|
+
value: color,
|
|
1556
|
+
onChange: (color) => {
|
|
1557
|
+
updateData({ color });
|
|
1558
|
+
},
|
|
1559
|
+
allowTransparency: true,
|
|
1560
|
+
outputFormat: "rgba"
|
|
1561
|
+
})
|
|
1562
|
+
}),
|
|
1563
|
+
children: jsx(ButtonGroup, { children: jsx(Button, {
|
|
1564
|
+
onPress: () => {
|
|
1565
|
+
setGradientData({
|
|
1566
|
+
...gradientData,
|
|
1567
|
+
stops: gradientData.stops.filter((_, i) => i !== itemIndex)
|
|
1568
|
+
});
|
|
1569
|
+
},
|
|
1570
|
+
icon: trash,
|
|
1571
|
+
size: "small",
|
|
1572
|
+
"aria-label": __("Delete stop", "eightshift-ui-components"),
|
|
1573
|
+
disabled: gradientData.stops.length <= 2,
|
|
1574
|
+
type: "dangerGhost"
|
|
1575
|
+
}) })
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
}) })
|
|
1579
|
+
]
|
|
1580
|
+
});
|
|
1581
|
+
};
|
|
1582
|
+
//#endregion
|
|
1583
|
+
export { GradientEditor as t };
|