@kolkrabbi/design-editor 0.27.0 → 0.28.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/{BindDot-CMUtpJPX.js → BindDot-CaZu6Uuz.js} +5 -5
- package/dist/{ColorModesWindow-CWhL6nfm.js → ColorModesWindow-D65R5YR5.js} +289 -359
- package/dist/Timeline-OZsY9CvR.js +910 -0
- package/dist/TreePicker-BQYPaQv3.js +166 -0
- package/dist/{core-EWu8GfXL.js → core-nPy-QtEz.js} +5533 -4608
- package/dist/core.js +5 -5
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +1223 -799
- package/dist/{useLayerEdit-BFcZhiNX.js → effectCategories-DJrQJ7vg.js} +3683 -3931
- package/dist/{effects-DZEmfY7a.js → effects-dbxBWOCp.js} +115 -114
- package/dist/effects.js +1 -1
- package/dist/{generators-D1tFSZgG.js → generators-CQQxNX9W.js} +721 -482
- package/dist/generators.js +1 -1
- package/dist/{host-ZLJKCZ54.js → host-DBTmkJuu.js} +1 -1
- package/dist/{host-CRsCCafL.js → host-DXizGh-A.js} +36 -36
- package/dist/morphStore-DaOLa9oj.js +145 -0
- package/dist/motion-yfgCBe5u.js +4261 -0
- package/dist/motion.js +1 -1
- package/dist/{previewScale-BMkeLc6w.js → previewScale-DsG-A1ZC.js} +1 -1
- package/dist/{rolls-BGtqxVYq.js → rolls-CGma4Bua.js} +1809 -2107
- package/dist/{src-BpTckTDZ.js → src-CMdJeS6j.js} +1 -1
- package/dist/useLayerEdit-CnPxtfWc.js +453 -0
- package/package.json +13 -10
- package/dist/Timeline-BObvcdXF.js +0 -3014
- package/dist/TreePicker-nMf17QGH.js +0 -68
- package/dist/motion-C_u7tsis.js +0 -2295
|
@@ -1,80 +1,10 @@
|
|
|
1
|
-
import { D as e, Et as t, J as n, L as r,
|
|
2
|
-
import {
|
|
3
|
-
import { Button as _, CloseButton as v, ColorPickerPopover as y, Dropdown as b, FullscreenOverlay as x, FunctionPlot as S, Input as C, LabeledControl as w, MenuDropdownItem as ie, Section as T, SegmentedToggle as E, Slider as D, Stepper as ae, Tooltip as O } from "@kolkrabbi/kol-component";
|
|
1
|
+
import { D as e, Et as t, J as n, L as r, On as i, _ as a, b as o, cn as s, dn as c, f as l, fn as u, g as d, h as f, m as p, on as m, p as h, tn as g, un as _, v, x as ee, y as te } from "./rolls-CGma4Bua.js";
|
|
2
|
+
import { Button as y, CloseButton as b, ColorPickerPopover as ne, Dropdown as x, FullscreenOverlay as S, FunctionPlot as re, Input as C, LabeledControl as w, MenuDropdownItem as T, Section as E, SegmentedToggle as ie, Slider as D, Stepper as ae, Tooltip as O } from "@kolkrabbi/kol-component";
|
|
4
3
|
import { createContext as k, useCallback as A, useContext as oe, useEffect as j, useMemo as se, useRef as ce, useState as M, useSyncExternalStore as le } from "react";
|
|
5
4
|
import { Fragment as ue, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
6
5
|
import { Icon as de } from "@kolkrabbi/kol-icons";
|
|
7
|
-
//#region src/
|
|
6
|
+
//#region src/editor/params/ModulationEditor.jsx
|
|
8
7
|
var fe = [
|
|
9
|
-
{
|
|
10
|
-
label: "Scanline",
|
|
11
|
-
groups: ["scanline"]
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
label: "Pattern",
|
|
15
|
-
groups: [
|
|
16
|
-
"pattern",
|
|
17
|
-
"patternloop",
|
|
18
|
-
"field"
|
|
19
|
-
],
|
|
20
|
-
labels: { pattern: "Rules" }
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: "Loops",
|
|
24
|
-
groups: ["shape"]
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: "Math",
|
|
28
|
-
groups: ["math"]
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
label: "Penrose",
|
|
32
|
-
groups: ["penrose"]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
label: "Flow",
|
|
36
|
-
groups: ["flow"]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
label: "Letter Gap",
|
|
40
|
-
groups: ["lettergap"]
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
label: "Drift",
|
|
44
|
-
groups: ["drift"]
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
label: "Gradients",
|
|
48
|
-
groups: ["gradients"]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
label: "Soft Forms",
|
|
52
|
-
groups: ["softforms"]
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
label: "3D Scene",
|
|
56
|
-
groups: [
|
|
57
|
-
"scene",
|
|
58
|
-
"ribbon",
|
|
59
|
-
"forms",
|
|
60
|
-
"environment",
|
|
61
|
-
"abstract",
|
|
62
|
-
"softforms3d"
|
|
63
|
-
],
|
|
64
|
-
labels: {
|
|
65
|
-
scene: "Primitive",
|
|
66
|
-
softforms3d: "Soft forms"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
], pe = [{
|
|
70
|
-
label: "Para Type",
|
|
71
|
-
groups: ["paratype"]
|
|
72
|
-
}], me = fe, F = {
|
|
73
|
-
optic: "Pattern · Effects",
|
|
74
|
-
paratype: "Para Type · Misc",
|
|
75
|
-
distress: "Distressor · Vector",
|
|
76
|
-
modulator: "Modulator · Vector"
|
|
77
|
-
}, I = [
|
|
78
8
|
{
|
|
79
9
|
code: "wave(t*2)",
|
|
80
10
|
desc: "Fast sine"
|
|
@@ -107,50 +37,50 @@ var fe = [
|
|
|
107
37
|
code: "rand()",
|
|
108
38
|
desc: "Noise"
|
|
109
39
|
}
|
|
110
|
-
],
|
|
111
|
-
function
|
|
40
|
+
], pe = 196, F = 64;
|
|
41
|
+
function I({ expr: e }) {
|
|
112
42
|
let [t, n] = M(0);
|
|
113
43
|
j(() => {
|
|
114
44
|
let e = 0, t = () => {
|
|
115
|
-
n(
|
|
45
|
+
n(g.getCtx().t ?? 0), e = requestAnimationFrame(t);
|
|
116
46
|
};
|
|
117
47
|
return e = requestAnimationFrame(t), () => cancelAnimationFrame(e);
|
|
118
48
|
}, []);
|
|
119
|
-
let r =
|
|
120
|
-
return /* @__PURE__ */ N(
|
|
49
|
+
let r = s(e), i = g.getLoopSeconds(), a = pe, o = Array.from({ length: 197 }, (e, t) => r.ok ? r.fn(t / a * i) : 0);
|
|
50
|
+
return /* @__PURE__ */ N(re, {
|
|
121
51
|
samples: o,
|
|
122
52
|
min: Math.min(0, ...o),
|
|
123
53
|
max: Math.max(1, ...o),
|
|
124
54
|
cursor: t,
|
|
125
|
-
height:
|
|
55
|
+
height: F,
|
|
126
56
|
ariaLabel: "Expression plot over one loop"
|
|
127
57
|
});
|
|
128
58
|
}
|
|
129
|
-
function
|
|
130
|
-
let
|
|
131
|
-
if (!e(
|
|
132
|
-
let
|
|
133
|
-
...
|
|
59
|
+
function me({ layer: t, param: n, setProp: i }) {
|
|
60
|
+
let a = r(), o = t[n.key], [s, l] = M(null), [d, f] = M(!1), [p, h] = M(!1);
|
|
61
|
+
if (!e(o) || o.bind !== "mod") return null;
|
|
62
|
+
let g = o.source, v = o.transform ?? {}, ee = g.startsWith("lfo-"), te = g === "midi", b = _(g), ne = g === "expr", x = v.expr ?? "wave(t)", S = (e) => i(n.key, {
|
|
63
|
+
...o,
|
|
134
64
|
transform: {
|
|
135
|
-
...
|
|
65
|
+
...v,
|
|
136
66
|
...e
|
|
137
67
|
}
|
|
138
|
-
}),
|
|
139
|
-
|
|
68
|
+
}), re = (e) => {
|
|
69
|
+
l(null);
|
|
140
70
|
let t = String(e).trim();
|
|
141
|
-
t && t !==
|
|
142
|
-
},
|
|
71
|
+
t && t !== x && S({ expr: t });
|
|
72
|
+
}, E = async () => {
|
|
143
73
|
f(!0);
|
|
144
|
-
let e = await
|
|
145
|
-
f(!1), e != null &&
|
|
74
|
+
let e = await u();
|
|
75
|
+
f(!1), e != null && S({ cc: e });
|
|
146
76
|
}, ae = async () => {
|
|
147
|
-
|
|
148
|
-
let e = await
|
|
149
|
-
|
|
150
|
-
...
|
|
77
|
+
h(!0);
|
|
78
|
+
let e = await c();
|
|
79
|
+
h(!1), e && i(n.key, {
|
|
80
|
+
...o,
|
|
151
81
|
source: e
|
|
152
82
|
});
|
|
153
|
-
}, O =
|
|
83
|
+
}, O = v.range ?? (n.min != null && n.max != null ? [n.min, n.max] : [0, 1]), k = (e, t) => {
|
|
154
84
|
let n = Number(e);
|
|
155
85
|
return Number.isFinite(n) ? n : t;
|
|
156
86
|
};
|
|
@@ -166,11 +96,11 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
166
96
|
className: "flex-1 min-w-0",
|
|
167
97
|
children: /* @__PURE__ */ N(C, {
|
|
168
98
|
variant: "filled",
|
|
169
|
-
size:
|
|
99
|
+
size: a,
|
|
170
100
|
type: "number",
|
|
171
101
|
width: "100%",
|
|
172
102
|
value: O[0],
|
|
173
|
-
onChange: (e) =>
|
|
103
|
+
onChange: (e) => S({ range: [k(e.target.value, O[0]), O[1]] })
|
|
174
104
|
})
|
|
175
105
|
}),
|
|
176
106
|
/* @__PURE__ */ N("span", {
|
|
@@ -181,11 +111,11 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
181
111
|
className: "flex-1 min-w-0",
|
|
182
112
|
children: /* @__PURE__ */ N(C, {
|
|
183
113
|
variant: "filled",
|
|
184
|
-
size:
|
|
114
|
+
size: a,
|
|
185
115
|
type: "number",
|
|
186
116
|
width: "100%",
|
|
187
117
|
value: O[1],
|
|
188
|
-
onChange: (e) =>
|
|
118
|
+
onChange: (e) => S({ range: [O[0], k(e.target.value, O[1])] })
|
|
189
119
|
})
|
|
190
120
|
})
|
|
191
121
|
]
|
|
@@ -195,8 +125,8 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
195
125
|
className: "grid grid-cols-2 gap-2",
|
|
196
126
|
children: [/* @__PURE__ */ N(w, {
|
|
197
127
|
label: "Invert",
|
|
198
|
-
children: /* @__PURE__ */ N(
|
|
199
|
-
size:
|
|
128
|
+
children: /* @__PURE__ */ N(ie, {
|
|
129
|
+
size: a,
|
|
200
130
|
className: "w-full",
|
|
201
131
|
options: [{
|
|
202
132
|
value: "off",
|
|
@@ -205,8 +135,8 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
205
135
|
value: "on",
|
|
206
136
|
label: "On"
|
|
207
137
|
}],
|
|
208
|
-
value:
|
|
209
|
-
onChange: (e) =>
|
|
138
|
+
value: v?.invert ? "on" : "off",
|
|
139
|
+
onChange: (e) => S({ invert: e === "on" })
|
|
210
140
|
})
|
|
211
141
|
}), /* @__PURE__ */ N(w, {
|
|
212
142
|
label: "Smooth",
|
|
@@ -214,8 +144,8 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
214
144
|
min: 0,
|
|
215
145
|
max: .95,
|
|
216
146
|
step: .05,
|
|
217
|
-
value:
|
|
218
|
-
onChange: (e) =>
|
|
147
|
+
value: v?.smooth ?? 0,
|
|
148
|
+
onChange: (e) => S({ smooth: e })
|
|
219
149
|
})
|
|
220
150
|
})]
|
|
221
151
|
}),
|
|
@@ -225,11 +155,11 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
225
155
|
min: .25,
|
|
226
156
|
max: 4,
|
|
227
157
|
step: .05,
|
|
228
|
-
value:
|
|
229
|
-
onChange: (e) =>
|
|
158
|
+
value: v?.curve ?? 1,
|
|
159
|
+
onChange: (e) => S({ curve: e })
|
|
230
160
|
})
|
|
231
161
|
}),
|
|
232
|
-
|
|
162
|
+
ee && /* @__PURE__ */ P("div", {
|
|
233
163
|
className: "grid grid-cols-2 gap-2",
|
|
234
164
|
children: [/* @__PURE__ */ N(w, {
|
|
235
165
|
label: "Rate",
|
|
@@ -237,8 +167,8 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
237
167
|
min: .25,
|
|
238
168
|
max: 16,
|
|
239
169
|
step: .25,
|
|
240
|
-
value:
|
|
241
|
-
onChange: (e) =>
|
|
170
|
+
value: v?.rate ?? 1,
|
|
171
|
+
onChange: (e) => S({ rate: e })
|
|
242
172
|
})
|
|
243
173
|
}), /* @__PURE__ */ N(w, {
|
|
244
174
|
label: "Phase",
|
|
@@ -246,30 +176,30 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
246
176
|
min: 0,
|
|
247
177
|
max: 1,
|
|
248
178
|
step: .01,
|
|
249
|
-
value:
|
|
250
|
-
onChange: (e) =>
|
|
179
|
+
value: v?.phase ?? 0,
|
|
180
|
+
onChange: (e) => S({ phase: e })
|
|
251
181
|
})
|
|
252
182
|
})]
|
|
253
183
|
}),
|
|
254
|
-
|
|
184
|
+
ne && /* @__PURE__ */ P(ue, { children: [
|
|
255
185
|
/* @__PURE__ */ N(w, {
|
|
256
186
|
label: "Expression",
|
|
257
187
|
children: /* @__PURE__ */ N(C, {
|
|
258
188
|
variant: "ghost",
|
|
259
|
-
size:
|
|
260
|
-
value:
|
|
261
|
-
onChange: (e) =>
|
|
262
|
-
onBlur: (e) =>
|
|
189
|
+
size: a,
|
|
190
|
+
value: s ?? x,
|
|
191
|
+
onChange: (e) => l(e.target.value),
|
|
192
|
+
onBlur: (e) => re(e.target.value),
|
|
263
193
|
onKeyDown: (e) => {
|
|
264
194
|
e.key === "Enter" && e.currentTarget.blur();
|
|
265
195
|
}
|
|
266
196
|
})
|
|
267
197
|
}),
|
|
268
|
-
/* @__PURE__ */ N(
|
|
198
|
+
/* @__PURE__ */ N(I, { expr: x }),
|
|
269
199
|
/* @__PURE__ */ N("div", {
|
|
270
200
|
className: "flex flex-col",
|
|
271
|
-
children:
|
|
272
|
-
onClick: () =>
|
|
201
|
+
children: fe.map((e) => /* @__PURE__ */ N(T, {
|
|
202
|
+
onClick: () => S({ expr: e.code }),
|
|
273
203
|
rowClass: "kol-mono-10 h-6",
|
|
274
204
|
shortcut: /* @__PURE__ */ N("span", {
|
|
275
205
|
className: "kol-helper-10 text-meta",
|
|
@@ -279,20 +209,20 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
279
209
|
}, e.code))
|
|
280
210
|
})
|
|
281
211
|
] }),
|
|
282
|
-
|
|
283
|
-
label:
|
|
284
|
-
children: /* @__PURE__ */ N(
|
|
212
|
+
te && /* @__PURE__ */ N(w, {
|
|
213
|
+
label: v?.cc == null ? "MIDI · no CC yet" : `MIDI · CC ${v.cc}`,
|
|
214
|
+
children: /* @__PURE__ */ N(y, {
|
|
285
215
|
tone: "outline",
|
|
286
|
-
size:
|
|
287
|
-
onClick:
|
|
288
|
-
children:
|
|
216
|
+
size: a,
|
|
217
|
+
onClick: E,
|
|
218
|
+
children: d ? "Move a knob…" : "Learn"
|
|
289
219
|
})
|
|
290
220
|
}),
|
|
291
|
-
|
|
292
|
-
label:
|
|
293
|
-
children: /* @__PURE__ */ N(
|
|
221
|
+
b && /* @__PURE__ */ N(w, {
|
|
222
|
+
label: m(g)?.label ?? "Gamepad",
|
|
223
|
+
children: /* @__PURE__ */ N(y, {
|
|
294
224
|
tone: "outline",
|
|
295
|
-
size:
|
|
225
|
+
size: a,
|
|
296
226
|
onClick: ae,
|
|
297
227
|
children: p ? "Move a control…" : "Learn"
|
|
298
228
|
})
|
|
@@ -300,7 +230,7 @@ function R({ layer: t, param: n, setProp: i }) {
|
|
|
300
230
|
]
|
|
301
231
|
});
|
|
302
232
|
}
|
|
303
|
-
function
|
|
233
|
+
function L({ layer: t, schema: n, setProp: r }) {
|
|
304
234
|
let i = (n ?? []).filter((n) => {
|
|
305
235
|
let r = t[n.key];
|
|
306
236
|
return e(r) && r.bind === "mod";
|
|
@@ -311,7 +241,7 @@ function z({ layer: t, schema: n, setProp: r }) {
|
|
|
311
241
|
className: "kol-eyebrow text-fg-80",
|
|
312
242
|
children: "Modulation"
|
|
313
243
|
}), i.map((e) => {
|
|
314
|
-
let n =
|
|
244
|
+
let n = m(t[e.key].source);
|
|
315
245
|
return /* @__PURE__ */ P("div", {
|
|
316
246
|
className: "flex flex-col gap-2 pt-3 border-t border-oq-08",
|
|
317
247
|
children: [/* @__PURE__ */ P("div", {
|
|
@@ -323,7 +253,7 @@ function z({ layer: t, schema: n, setProp: r }) {
|
|
|
323
253
|
className: "kol-helper-10 text-meta",
|
|
324
254
|
children: n?.label ?? t[e.key].source
|
|
325
255
|
})]
|
|
326
|
-
}), /* @__PURE__ */ N(
|
|
256
|
+
}), /* @__PURE__ */ N(me, {
|
|
327
257
|
layer: t,
|
|
328
258
|
param: e,
|
|
329
259
|
setProp: r
|
|
@@ -334,7 +264,7 @@ function z({ layer: t, schema: n, setProp: r }) {
|
|
|
334
264
|
}
|
|
335
265
|
//#endregion
|
|
336
266
|
//#region src/editor/modes/pattern/RuleRow.jsx
|
|
337
|
-
var
|
|
267
|
+
var he = [
|
|
338
268
|
{
|
|
339
269
|
value: "all",
|
|
340
270
|
label: "All cells"
|
|
@@ -363,7 +293,7 @@ var _e = [
|
|
|
363
293
|
value: "expression",
|
|
364
294
|
label: "Expression…"
|
|
365
295
|
}
|
|
366
|
-
],
|
|
296
|
+
], R = [
|
|
367
297
|
{
|
|
368
298
|
value: 0,
|
|
369
299
|
label: "0°"
|
|
@@ -380,19 +310,19 @@ var _e = [
|
|
|
380
310
|
value: 270,
|
|
381
311
|
label: "270°"
|
|
382
312
|
}
|
|
383
|
-
],
|
|
313
|
+
], z = [
|
|
384
314
|
"every-col",
|
|
385
315
|
"every-row",
|
|
386
316
|
"both",
|
|
387
317
|
"every-nth",
|
|
388
318
|
"checker"
|
|
389
|
-
],
|
|
319
|
+
], ge = [
|
|
390
320
|
0,
|
|
391
321
|
90,
|
|
392
322
|
180,
|
|
393
323
|
270
|
|
394
|
-
],
|
|
395
|
-
id:
|
|
324
|
+
], _e = 1, ve = () => `r${_e++}`, ye = () => ({
|
|
325
|
+
id: ve(),
|
|
396
326
|
selectKind: "every-col",
|
|
397
327
|
n: 2,
|
|
398
328
|
offset: 0,
|
|
@@ -406,9 +336,9 @@ var _e = [
|
|
|
406
336
|
flipV: !1,
|
|
407
337
|
hide: !1,
|
|
408
338
|
opacity: 1
|
|
409
|
-
}),
|
|
410
|
-
id:
|
|
411
|
-
selectKind:
|
|
339
|
+
}), be = (e) => e[Math.floor(Math.random() * e.length)], xe = () => ({
|
|
340
|
+
id: ve(),
|
|
341
|
+
selectKind: be(z),
|
|
412
342
|
n: Math.floor(Math.random() * 5) + 2,
|
|
413
343
|
offset: Math.floor(Math.random() * 3),
|
|
414
344
|
n2: Math.floor(Math.random() * 5) + 2,
|
|
@@ -416,7 +346,7 @@ var _e = [
|
|
|
416
346
|
expression: "sin(col * 0.6) + cos(row * 0.6)",
|
|
417
347
|
groupW: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
418
348
|
groupH: Math.random() > .6 ? Math.floor(Math.random() * 3) + 1 : 1,
|
|
419
|
-
rotate:
|
|
349
|
+
rotate: be(ge),
|
|
420
350
|
flipH: Math.random() > .6,
|
|
421
351
|
flipV: Math.random() > .6,
|
|
422
352
|
hide: Math.random() > .85,
|
|
@@ -432,10 +362,10 @@ function B({ value: e, onChange: t, min: n = 0, max: r = 99 }) {
|
|
|
432
362
|
className: "w-full"
|
|
433
363
|
});
|
|
434
364
|
}
|
|
435
|
-
function
|
|
365
|
+
function V({ active: e, onClick: t, children: n, title: r }) {
|
|
436
366
|
return /* @__PURE__ */ N(O, {
|
|
437
367
|
label: r,
|
|
438
|
-
children: /* @__PURE__ */ N(
|
|
368
|
+
children: /* @__PURE__ */ N(y, {
|
|
439
369
|
"aria-label": r,
|
|
440
370
|
tone: e ? "primary" : "outline",
|
|
441
371
|
size: "sm",
|
|
@@ -445,7 +375,7 @@ function Ee({ active: e, onClick: t, children: n, title: r }) {
|
|
|
445
375
|
})
|
|
446
376
|
});
|
|
447
377
|
}
|
|
448
|
-
function
|
|
378
|
+
function Se({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
449
379
|
let i = (n) => t({
|
|
450
380
|
...e,
|
|
451
381
|
...n
|
|
@@ -458,18 +388,18 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
458
388
|
children: [
|
|
459
389
|
/* @__PURE__ */ N("div", {
|
|
460
390
|
className: "flex-1 min-w-0",
|
|
461
|
-
children: /* @__PURE__ */ N(
|
|
391
|
+
children: /* @__PURE__ */ N(x, {
|
|
462
392
|
variant: "subtle",
|
|
463
393
|
size: "sm",
|
|
464
394
|
className: "w-full",
|
|
465
|
-
options:
|
|
395
|
+
options: he,
|
|
466
396
|
value: e.selectKind,
|
|
467
397
|
onChange: (e) => i({ selectKind: e })
|
|
468
398
|
})
|
|
469
399
|
}),
|
|
470
400
|
/* @__PURE__ */ N(O, {
|
|
471
401
|
label: "Re-randomize this rule",
|
|
472
|
-
children: /* @__PURE__ */ N(
|
|
402
|
+
children: /* @__PURE__ */ N(y, {
|
|
473
403
|
tone: "ghost",
|
|
474
404
|
size: "sm",
|
|
475
405
|
iconOnly: "refresh",
|
|
@@ -482,7 +412,7 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
482
412
|
}),
|
|
483
413
|
/* @__PURE__ */ N(O, {
|
|
484
414
|
label: "Delete rule",
|
|
485
|
-
children: /* @__PURE__ */ N(
|
|
415
|
+
children: /* @__PURE__ */ N(y, {
|
|
486
416
|
tone: "ghost",
|
|
487
417
|
size: "sm",
|
|
488
418
|
iconOnly: "x",
|
|
@@ -497,14 +427,14 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
497
427
|
}),
|
|
498
428
|
a && /* @__PURE__ */ P("div", {
|
|
499
429
|
className: "grid grid-cols-2 gap-2",
|
|
500
|
-
children: [/* @__PURE__ */ N(
|
|
430
|
+
children: [/* @__PURE__ */ N(E, {
|
|
501
431
|
label: "N",
|
|
502
432
|
children: /* @__PURE__ */ N(B, {
|
|
503
433
|
value: e.n,
|
|
504
434
|
onChange: (e) => i({ n: e }),
|
|
505
435
|
min: 1
|
|
506
436
|
})
|
|
507
|
-
}), /* @__PURE__ */ N(
|
|
437
|
+
}), /* @__PURE__ */ N(E, {
|
|
508
438
|
label: "Offset",
|
|
509
439
|
children: /* @__PURE__ */ N(B, {
|
|
510
440
|
value: e.offset,
|
|
@@ -514,14 +444,14 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
514
444
|
}),
|
|
515
445
|
o && /* @__PURE__ */ P("div", {
|
|
516
446
|
className: "grid grid-cols-2 gap-2",
|
|
517
|
-
children: [/* @__PURE__ */ N(
|
|
447
|
+
children: [/* @__PURE__ */ N(E, {
|
|
518
448
|
label: "Row N",
|
|
519
449
|
children: /* @__PURE__ */ N(B, {
|
|
520
450
|
value: e.n2,
|
|
521
451
|
onChange: (e) => i({ n2: e }),
|
|
522
452
|
min: 1
|
|
523
453
|
})
|
|
524
|
-
}), /* @__PURE__ */ N(
|
|
454
|
+
}), /* @__PURE__ */ N(E, {
|
|
525
455
|
label: "Row offset",
|
|
526
456
|
children: /* @__PURE__ */ N(B, {
|
|
527
457
|
value: e.offset2,
|
|
@@ -529,7 +459,7 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
529
459
|
})
|
|
530
460
|
})]
|
|
531
461
|
}),
|
|
532
|
-
s && /* @__PURE__ */ P(
|
|
462
|
+
s && /* @__PURE__ */ P(E, {
|
|
533
463
|
label: "Expression",
|
|
534
464
|
hint: "matches when > 0",
|
|
535
465
|
children: [/* @__PURE__ */ N(C, {
|
|
@@ -545,14 +475,14 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
545
475
|
}),
|
|
546
476
|
/* @__PURE__ */ P("div", {
|
|
547
477
|
className: "grid grid-cols-2 gap-2",
|
|
548
|
-
children: [/* @__PURE__ */ N(
|
|
478
|
+
children: [/* @__PURE__ */ N(E, {
|
|
549
479
|
label: "Group W",
|
|
550
480
|
children: /* @__PURE__ */ N(B, {
|
|
551
481
|
value: e.groupW,
|
|
552
482
|
onChange: (e) => i({ groupW: Math.max(1, e) }),
|
|
553
483
|
min: 1
|
|
554
484
|
})
|
|
555
|
-
}), /* @__PURE__ */ N(
|
|
485
|
+
}), /* @__PURE__ */ N(E, {
|
|
556
486
|
label: "Group H",
|
|
557
487
|
children: /* @__PURE__ */ N(B, {
|
|
558
488
|
value: e.groupH,
|
|
@@ -564,26 +494,26 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
564
494
|
/* @__PURE__ */ P("div", {
|
|
565
495
|
className: "flex flex-wrap gap-1",
|
|
566
496
|
children: [
|
|
567
|
-
/* @__PURE__ */ N(
|
|
497
|
+
/* @__PURE__ */ N(x, {
|
|
568
498
|
variant: "subtle",
|
|
569
499
|
size: "sm",
|
|
570
|
-
options:
|
|
500
|
+
options: R,
|
|
571
501
|
value: e.rotate,
|
|
572
502
|
onChange: (e) => i({ rotate: Number(e) })
|
|
573
503
|
}),
|
|
574
|
-
/* @__PURE__ */ N(
|
|
504
|
+
/* @__PURE__ */ N(V, {
|
|
575
505
|
active: e.flipH,
|
|
576
506
|
onClick: () => i({ flipH: !e.flipH }),
|
|
577
507
|
title: "Flip horizontal",
|
|
578
508
|
children: "⇋"
|
|
579
509
|
}),
|
|
580
|
-
/* @__PURE__ */ N(
|
|
510
|
+
/* @__PURE__ */ N(V, {
|
|
581
511
|
active: e.flipV,
|
|
582
512
|
onClick: () => i({ flipV: !e.flipV }),
|
|
583
513
|
title: "Flip vertical",
|
|
584
514
|
children: "⇵"
|
|
585
515
|
}),
|
|
586
|
-
/* @__PURE__ */ N(
|
|
516
|
+
/* @__PURE__ */ N(V, {
|
|
587
517
|
active: e.hide,
|
|
588
518
|
onClick: () => i({ hide: !e.hide }),
|
|
589
519
|
title: "Hide cell",
|
|
@@ -591,7 +521,7 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
591
521
|
})
|
|
592
522
|
]
|
|
593
523
|
}),
|
|
594
|
-
/* @__PURE__ */ N(
|
|
524
|
+
/* @__PURE__ */ N(E, {
|
|
595
525
|
label: "Opacity",
|
|
596
526
|
hint: `${Math.round(e.opacity * 100)}%`,
|
|
597
527
|
children: /* @__PURE__ */ N(D, {
|
|
@@ -606,8 +536,8 @@ function De({ rule: e, onChange: t, onRemove: n, onReroll: r }) {
|
|
|
606
536
|
}
|
|
607
537
|
//#endregion
|
|
608
538
|
//#region src/editor/library/mergeRemote.js
|
|
609
|
-
var
|
|
610
|
-
function
|
|
539
|
+
var Ce = (e) => e?.updatedAt ?? e?.savedAt ?? 0, we = (e) => /^(Plan08 |Sync [A-Z] \d{13}|Morph [A-Z] \d{13})/.test(e?.name ?? "");
|
|
540
|
+
function Te(e, t) {
|
|
611
541
|
let n = {}, r = [], i = /* @__PURE__ */ new Map();
|
|
612
542
|
for (let e of t || []) i.has(e.kind) || i.set(e.kind, /* @__PURE__ */ new Map()), i.get(e.kind).set(e.id, e);
|
|
613
543
|
let a = new Set([...Object.keys(e || {}), ...i.keys()]);
|
|
@@ -619,7 +549,7 @@ function Ae(e, t) {
|
|
|
619
549
|
o.push(n);
|
|
620
550
|
continue;
|
|
621
551
|
}
|
|
622
|
-
if (
|
|
552
|
+
if (we(n)) {
|
|
623
553
|
s.add(n.id), e && !e.deleted && r.push({
|
|
624
554
|
op: "remove",
|
|
625
555
|
kind: t,
|
|
@@ -636,7 +566,7 @@ function Ae(e, t) {
|
|
|
636
566
|
continue;
|
|
637
567
|
}
|
|
638
568
|
if (e.deleted) {
|
|
639
|
-
if (e.updatedAt >
|
|
569
|
+
if (e.updatedAt > Ce(n)) continue;
|
|
640
570
|
o.push(n), r.push({
|
|
641
571
|
op: "put",
|
|
642
572
|
kind: t,
|
|
@@ -644,7 +574,7 @@ function Ae(e, t) {
|
|
|
644
574
|
});
|
|
645
575
|
continue;
|
|
646
576
|
}
|
|
647
|
-
e.updatedAt >
|
|
577
|
+
e.updatedAt > Ce(n) ? o.push(e.spec) : (o.push(n), e.updatedAt < Ce(n) && r.push({
|
|
648
578
|
op: "put",
|
|
649
579
|
kind: t,
|
|
650
580
|
item: n
|
|
@@ -652,7 +582,7 @@ function Ae(e, t) {
|
|
|
652
582
|
}
|
|
653
583
|
let c = new Set(o.map((e) => e.id));
|
|
654
584
|
for (let e of a.values()) if (!(e.deleted || c.has(e.id) || s.has(e.id))) {
|
|
655
|
-
if (
|
|
585
|
+
if (we(e.spec)) {
|
|
656
586
|
r.push({
|
|
657
587
|
op: "remove",
|
|
658
588
|
kind: t,
|
|
@@ -671,19 +601,19 @@ function Ae(e, t) {
|
|
|
671
601
|
}
|
|
672
602
|
//#endregion
|
|
673
603
|
//#region src/editor/library/libraryApi.js
|
|
674
|
-
var
|
|
675
|
-
function
|
|
676
|
-
|
|
604
|
+
var H = null;
|
|
605
|
+
function Ee(e) {
|
|
606
|
+
H = typeof e == "string" && e.trim() ? e.trim().replace(/\/+$/, "") : null, Ie();
|
|
677
607
|
}
|
|
678
|
-
function
|
|
679
|
-
return
|
|
608
|
+
function De() {
|
|
609
|
+
return H;
|
|
680
610
|
}
|
|
681
|
-
var
|
|
611
|
+
var U = class extends Error {
|
|
682
612
|
constructor() {
|
|
683
613
|
super("unauthorized"), this.name = "UnauthorizedError";
|
|
684
614
|
}
|
|
685
615
|
};
|
|
686
|
-
function
|
|
616
|
+
function Oe(e, t) {
|
|
687
617
|
let n = `Bearer ${t}`, r = async (t, r = {}) => {
|
|
688
618
|
let i = await fetch(`${e}${t}`, {
|
|
689
619
|
...r,
|
|
@@ -693,7 +623,7 @@ function Ne(e, t) {
|
|
|
693
623
|
...r.headers || {}
|
|
694
624
|
}
|
|
695
625
|
});
|
|
696
|
-
if (i.status === 401) throw new
|
|
626
|
+
if (i.status === 401) throw new U();
|
|
697
627
|
if (!i.ok) throw Error(`library api ${i.status}`);
|
|
698
628
|
return i.json();
|
|
699
629
|
};
|
|
@@ -717,33 +647,33 @@ function Ne(e, t) {
|
|
|
717
647
|
}
|
|
718
648
|
};
|
|
719
649
|
}
|
|
720
|
-
var
|
|
721
|
-
function
|
|
650
|
+
var ke = "kol.fxr.library-session", W = null, Ae = /* @__PURE__ */ new Set(), G = () => Ae.forEach((e) => e());
|
|
651
|
+
function je() {
|
|
722
652
|
return W;
|
|
723
653
|
}
|
|
724
|
-
var
|
|
654
|
+
var Me = () => le((e) => (Ae.add(e), () => Ae.delete(e)), je, je), Ne = () => Me()?.user ?? null;
|
|
725
655
|
function K(e) {
|
|
726
656
|
try {
|
|
727
|
-
e ? localStorage.setItem(
|
|
657
|
+
e ? localStorage.setItem(ke, JSON.stringify(e)) : localStorage.removeItem(ke);
|
|
728
658
|
} catch {}
|
|
729
659
|
}
|
|
730
|
-
var
|
|
660
|
+
var Pe = () => {
|
|
731
661
|
try {
|
|
732
|
-
return JSON.parse(localStorage.getItem(
|
|
662
|
+
return JSON.parse(localStorage.getItem(ke) || "null");
|
|
733
663
|
} catch {
|
|
734
664
|
return null;
|
|
735
665
|
}
|
|
736
666
|
};
|
|
737
|
-
function
|
|
738
|
-
let { next: n, pushes: r } =
|
|
739
|
-
|
|
667
|
+
function Fe(e, t) {
|
|
668
|
+
let { next: n, pushes: r } = Te(Q(), t);
|
|
669
|
+
st({
|
|
740
670
|
...Q(),
|
|
741
671
|
...n
|
|
742
672
|
});
|
|
743
673
|
for (let t of r) e.push(t).catch(() => {});
|
|
744
674
|
}
|
|
745
675
|
async function q(e, t = {}, n) {
|
|
746
|
-
let r = await fetch(`${
|
|
676
|
+
let r = await fetch(`${H}${e}`, {
|
|
747
677
|
...t,
|
|
748
678
|
headers: {
|
|
749
679
|
"content-type": "application/json",
|
|
@@ -751,16 +681,16 @@ async function q(e, t = {}, n) {
|
|
|
751
681
|
...t.headers || {}
|
|
752
682
|
}
|
|
753
683
|
});
|
|
754
|
-
if (r.status === 401) throw new
|
|
684
|
+
if (r.status === 401) throw new U();
|
|
755
685
|
let i = await r.json().catch(() => ({}));
|
|
756
686
|
if (!r.ok) throw Error(i.error || `library api ${r.status}`);
|
|
757
687
|
return i;
|
|
758
688
|
}
|
|
759
|
-
function
|
|
760
|
-
if (W || !
|
|
761
|
-
let e =
|
|
762
|
-
if (!e?.token || e.base !==
|
|
763
|
-
let t =
|
|
689
|
+
function Ie() {
|
|
690
|
+
if (W || !H) return;
|
|
691
|
+
let e = Pe();
|
|
692
|
+
if (!e?.token || e.base !== H || !(e.expiresAt > Date.now()) || !e.user) return;
|
|
693
|
+
let t = Oe(H, e.token);
|
|
764
694
|
W = {
|
|
765
695
|
backend: t,
|
|
766
696
|
user: e.user,
|
|
@@ -774,27 +704,27 @@ function Be() {
|
|
|
774
704
|
user: t
|
|
775
705
|
}), G());
|
|
776
706
|
}).catch((e) => {
|
|
777
|
-
e instanceof
|
|
778
|
-
}), t.hydrate().then((e) =>
|
|
779
|
-
e instanceof
|
|
707
|
+
e instanceof U && J();
|
|
708
|
+
}), t.hydrate().then((e) => Fe(t, e)).catch((e) => {
|
|
709
|
+
e instanceof U ? J() : console.warn("library sync: hydrate failed —", e?.message || e);
|
|
780
710
|
});
|
|
781
711
|
}
|
|
782
|
-
async function
|
|
783
|
-
let r =
|
|
784
|
-
return
|
|
712
|
+
async function Le({ token: e, expiresAt: t, user: n }) {
|
|
713
|
+
let r = Oe(H, e), i = await r.hydrate();
|
|
714
|
+
return Fe(r, i), W = {
|
|
785
715
|
backend: r,
|
|
786
716
|
user: n,
|
|
787
717
|
token: e
|
|
788
718
|
}, K({
|
|
789
|
-
base:
|
|
719
|
+
base: H,
|
|
790
720
|
token: e,
|
|
791
721
|
expiresAt: t,
|
|
792
722
|
user: n
|
|
793
723
|
}), G(), i.filter((e) => !e.deleted).length;
|
|
794
724
|
}
|
|
795
|
-
async function
|
|
796
|
-
if (!
|
|
797
|
-
return
|
|
725
|
+
async function Re({ email: e, password: t } = {}) {
|
|
726
|
+
if (!H) throw Error("no library api");
|
|
727
|
+
return Le(await q("/api/auth/signin", {
|
|
798
728
|
method: "POST",
|
|
799
729
|
body: JSON.stringify({
|
|
800
730
|
email: e,
|
|
@@ -802,22 +732,22 @@ async function He({ email: e, password: t } = {}) {
|
|
|
802
732
|
})
|
|
803
733
|
}));
|
|
804
734
|
}
|
|
805
|
-
async function
|
|
806
|
-
if (!
|
|
807
|
-
return
|
|
735
|
+
async function ze(e) {
|
|
736
|
+
if (!H) throw Error("no library api");
|
|
737
|
+
return Le(await q("/api/auth/signup", {
|
|
808
738
|
method: "POST",
|
|
809
739
|
body: JSON.stringify(e)
|
|
810
740
|
}));
|
|
811
741
|
}
|
|
812
742
|
function J() {
|
|
813
|
-
let e = W?.token ??
|
|
814
|
-
K(null), e &&
|
|
743
|
+
let e = W?.token ?? Pe()?.token;
|
|
744
|
+
K(null), e && H && q("/api/auth/signout", {
|
|
815
745
|
method: "POST",
|
|
816
746
|
body: "{}"
|
|
817
747
|
}, e).catch(() => {}), W && (W = null, G());
|
|
818
748
|
}
|
|
819
|
-
async function
|
|
820
|
-
if (!W) throw new
|
|
749
|
+
async function Be(e) {
|
|
750
|
+
if (!W) throw new U();
|
|
821
751
|
let { user: t } = await q("/api/me", {
|
|
822
752
|
method: "PATCH",
|
|
823
753
|
body: JSON.stringify(e)
|
|
@@ -826,12 +756,12 @@ async function We(e) {
|
|
|
826
756
|
...W,
|
|
827
757
|
user: t
|
|
828
758
|
}, K({
|
|
829
|
-
...
|
|
759
|
+
...Pe(),
|
|
830
760
|
user: t
|
|
831
761
|
}), G(), t;
|
|
832
762
|
}
|
|
833
|
-
async function
|
|
834
|
-
if (!W) throw new
|
|
763
|
+
async function Ve() {
|
|
764
|
+
if (!W) throw new U();
|
|
835
765
|
let { token: e, expiresAt: t } = await q("/api/invites", {
|
|
836
766
|
method: "POST",
|
|
837
767
|
body: "{}"
|
|
@@ -841,8 +771,8 @@ async function Ge() {
|
|
|
841
771
|
expiresAt: t
|
|
842
772
|
};
|
|
843
773
|
}
|
|
844
|
-
async function
|
|
845
|
-
if (!
|
|
774
|
+
async function He({ name: e, email: t }) {
|
|
775
|
+
if (!H) throw Error("no library api");
|
|
846
776
|
return q("/api/invite-requests", {
|
|
847
777
|
method: "POST",
|
|
848
778
|
body: JSON.stringify({
|
|
@@ -851,12 +781,12 @@ async function Ke({ name: e, email: t }) {
|
|
|
851
781
|
})
|
|
852
782
|
});
|
|
853
783
|
}
|
|
854
|
-
async function
|
|
855
|
-
if (!W) throw new
|
|
784
|
+
async function Ue() {
|
|
785
|
+
if (!W) throw new U();
|
|
856
786
|
return (await q("/api/invite-requests", {}, W.token)).requests;
|
|
857
787
|
}
|
|
858
|
-
async function
|
|
859
|
-
if (!W) throw new
|
|
788
|
+
async function We(e) {
|
|
789
|
+
if (!W) throw new U();
|
|
860
790
|
let { token: t, expiresAt: n, email: r, name: i } = await q(`/api/invite-requests/${encodeURIComponent(e)}/invite`, {
|
|
861
791
|
method: "POST",
|
|
862
792
|
body: "{}"
|
|
@@ -870,17 +800,17 @@ async function Je(e) {
|
|
|
870
800
|
}
|
|
871
801
|
//#endregion
|
|
872
802
|
//#region src/editor/library/LibraryProvider.jsx
|
|
873
|
-
var
|
|
803
|
+
var Ge = "kol.editor.library.v3", Y = [
|
|
874
804
|
"palette",
|
|
875
805
|
"pattern",
|
|
876
806
|
"type",
|
|
877
807
|
"preset"
|
|
878
|
-
], X = Y.reduce((e, t) => (e[t] = [], e), {}),
|
|
808
|
+
], X = Y.reduce((e, t) => (e[t] = [], e), {}), Ke = 1, qe = () => `i${Date.now().toString(36)}-${Ke++}`, Je = (e) => ({
|
|
879
809
|
...e,
|
|
880
|
-
id: e.id ??
|
|
810
|
+
id: e.id ?? qe(),
|
|
881
811
|
savedAt: e.savedAt ?? Date.now()
|
|
882
812
|
}), Z = (e) => typeof e == "number" && Number.isFinite(e);
|
|
883
|
-
function
|
|
813
|
+
function Ye(e) {
|
|
884
814
|
return !e || !Array.isArray(e.colors) || e.colors.length === 0 ? null : {
|
|
885
815
|
colors: e.colors,
|
|
886
816
|
bgEnabled: !!e.bgEnabled,
|
|
@@ -888,7 +818,7 @@ function $e(e) {
|
|
|
888
818
|
modeId: e.modeId ?? "random"
|
|
889
819
|
};
|
|
890
820
|
}
|
|
891
|
-
function
|
|
821
|
+
function Xe(e) {
|
|
892
822
|
return !e || typeof e.shapeId != "string" || e.shapeId === "type-composition" ? null : {
|
|
893
823
|
shapeId: e.shapeId,
|
|
894
824
|
customSvg: typeof e.customSvg == "string" ? e.customSvg : "",
|
|
@@ -904,7 +834,7 @@ function et(e) {
|
|
|
904
834
|
scale: Z(e.scale) ? e.scale : 256
|
|
905
835
|
};
|
|
906
836
|
}
|
|
907
|
-
function
|
|
837
|
+
function Ze(e) {
|
|
908
838
|
if (!e || typeof e.text != "string") return null;
|
|
909
839
|
let t = {
|
|
910
840
|
text: e.text,
|
|
@@ -920,7 +850,7 @@ function tt(e) {
|
|
|
920
850
|
};
|
|
921
851
|
return e.axisOn !== void 0 && (t.axisOn = e.axisOn, t.width2 = e.width2, t.weight2 = e.weight2, t.blend = e.blend), t;
|
|
922
852
|
}
|
|
923
|
-
function
|
|
853
|
+
function Qe(e) {
|
|
924
854
|
return !e || !Array.isArray(e.layers) ? null : {
|
|
925
855
|
intent: e.intent ?? "whole",
|
|
926
856
|
aspect: e.aspect ?? "1:1",
|
|
@@ -938,38 +868,38 @@ function nt(e) {
|
|
|
938
868
|
...typeof e.sub == "string" ? { sub: e.sub } : {}
|
|
939
869
|
};
|
|
940
870
|
}
|
|
941
|
-
var
|
|
942
|
-
palette:
|
|
943
|
-
pattern:
|
|
944
|
-
type:
|
|
945
|
-
preset:
|
|
946
|
-
},
|
|
871
|
+
var $e = {
|
|
872
|
+
palette: Ye,
|
|
873
|
+
pattern: Xe,
|
|
874
|
+
type: Ze,
|
|
875
|
+
preset: Qe
|
|
876
|
+
}, et = [
|
|
947
877
|
"id",
|
|
948
878
|
"savedAt",
|
|
949
879
|
"updatedAt",
|
|
950
880
|
"name"
|
|
951
881
|
];
|
|
952
|
-
function
|
|
882
|
+
function tt(e) {
|
|
953
883
|
let t = {};
|
|
954
|
-
for (let n of
|
|
884
|
+
for (let n of et) e?.[n] !== void 0 && (t[n] = e[n]);
|
|
955
885
|
return t;
|
|
956
886
|
}
|
|
957
|
-
function
|
|
887
|
+
function nt(e) {
|
|
958
888
|
let t = Y.reduce((e, t) => (e[t] = [], e), {});
|
|
959
889
|
for (let n of Y) {
|
|
960
|
-
let r =
|
|
890
|
+
let r = $e[n];
|
|
961
891
|
t[n] = (Array.isArray(e?.[n]) ? e[n] : []).map((e) => {
|
|
962
892
|
let t = r ? r(e) : e;
|
|
963
893
|
return t ? {
|
|
964
894
|
v: 1,
|
|
965
|
-
...
|
|
895
|
+
...tt(e),
|
|
966
896
|
...t
|
|
967
897
|
} : null;
|
|
968
898
|
}).filter(Boolean);
|
|
969
899
|
}
|
|
970
900
|
return t;
|
|
971
901
|
}
|
|
972
|
-
function
|
|
902
|
+
function rt(e) {
|
|
973
903
|
return Array.isArray(e) ? e.map((e) => e?.type ? e.type === "bg" ? {
|
|
974
904
|
...e,
|
|
975
905
|
type: "background"
|
|
@@ -982,7 +912,7 @@ function st(e) {
|
|
|
982
912
|
kind: "logo"
|
|
983
913
|
} : e : e) : e;
|
|
984
914
|
}
|
|
985
|
-
function
|
|
915
|
+
function it(e) {
|
|
986
916
|
let t = {};
|
|
987
917
|
for (let n of [
|
|
988
918
|
"palette",
|
|
@@ -993,37 +923,37 @@ function ct(e) {
|
|
|
993
923
|
"composition"
|
|
994
924
|
]) {
|
|
995
925
|
let r = e?.[n];
|
|
996
|
-
Array.isArray(r) ? t[n] = r : r && typeof r == "object" ? t[n] = [
|
|
926
|
+
Array.isArray(r) ? t[n] = r : r && typeof r == "object" ? t[n] = [Je(r)] : t[n] = [];
|
|
997
927
|
}
|
|
998
928
|
return t;
|
|
999
929
|
}
|
|
1000
|
-
function
|
|
1001
|
-
let t = Y.reduce((e, t) => (e[t] = [], e), {}), n = (e) => Array.isArray(e) ? e : e && typeof e == "object" ? [
|
|
930
|
+
function at(e) {
|
|
931
|
+
let t = Y.reduce((e, t) => (e[t] = [], e), {}), n = (e) => Array.isArray(e) ? e : e && typeof e == "object" ? [Je(e)] : [];
|
|
1002
932
|
t.palette = n(e?.palette), t.pattern = n(e?.pattern), t.type = n(e?.type);
|
|
1003
933
|
let r = n(e?.layout), i = n(e?.composition).map((e) => ({
|
|
1004
934
|
...e,
|
|
1005
|
-
layers:
|
|
935
|
+
layers: rt(e.layers)
|
|
1006
936
|
}));
|
|
1007
937
|
return t.preset = [...r, ...i], t;
|
|
1008
938
|
}
|
|
1009
939
|
function Q() {
|
|
1010
940
|
if (typeof window > "u") return X;
|
|
1011
941
|
try {
|
|
1012
|
-
let e = window.localStorage.getItem(
|
|
1013
|
-
if (e) return
|
|
942
|
+
let e = window.localStorage.getItem(Ge);
|
|
943
|
+
if (e) return nt(JSON.parse(e));
|
|
1014
944
|
let t = window.localStorage.getItem("kol.generator.library.v2");
|
|
1015
|
-
if (t) return window.localStorage.setItem("kol.generator.library.v2._backup", t),
|
|
945
|
+
if (t) return window.localStorage.setItem("kol.generator.library.v2._backup", t), nt(at(JSON.parse(t)));
|
|
1016
946
|
let n = window.localStorage.getItem("kol.generator.library.v1");
|
|
1017
|
-
return n ?
|
|
947
|
+
return n ? nt(at(it(JSON.parse(n)))) : X;
|
|
1018
948
|
} catch {
|
|
1019
949
|
return X;
|
|
1020
950
|
}
|
|
1021
951
|
}
|
|
1022
|
-
var
|
|
1023
|
-
function
|
|
952
|
+
var ot = (e) => e?.item?.shipped === !0 || String(e?.id ?? e?.item?.id ?? "").startsWith("ship:");
|
|
953
|
+
function st(e) {
|
|
1024
954
|
if (!(typeof window > "u")) {
|
|
1025
955
|
try {
|
|
1026
|
-
window.localStorage.setItem(
|
|
956
|
+
window.localStorage.setItem(Ge, JSON.stringify(e));
|
|
1027
957
|
} catch (e) {
|
|
1028
958
|
console.warn("library: could not save to this browser —", e?.message || e);
|
|
1029
959
|
return;
|
|
@@ -1031,23 +961,23 @@ function dt(e) {
|
|
|
1031
961
|
window.dispatchEvent(new CustomEvent("kol:library"));
|
|
1032
962
|
}
|
|
1033
963
|
}
|
|
1034
|
-
var
|
|
964
|
+
var ct = (e) => (window.addEventListener("kol:library", e), window.addEventListener("storage", e), () => {
|
|
1035
965
|
window.removeEventListener("kol:library", e), window.removeEventListener("storage", e);
|
|
1036
|
-
}),
|
|
966
|
+
}), lt = () => {
|
|
1037
967
|
try {
|
|
1038
|
-
return window.localStorage.getItem(
|
|
968
|
+
return window.localStorage.getItem(Ge);
|
|
1039
969
|
} catch {
|
|
1040
970
|
return null;
|
|
1041
971
|
}
|
|
1042
|
-
},
|
|
1043
|
-
function
|
|
972
|
+
}, ut = k(null);
|
|
973
|
+
function dt(e, t, n) {
|
|
1044
974
|
return e.map((e) => e.id === t ? {
|
|
1045
975
|
...e,
|
|
1046
976
|
name: String(n ?? "").trim() || null,
|
|
1047
977
|
updatedAt: Date.now()
|
|
1048
978
|
} : e);
|
|
1049
979
|
}
|
|
1050
|
-
function
|
|
980
|
+
function ft(e, t, n) {
|
|
1051
981
|
let r = e.findIndex((e) => e.id === t);
|
|
1052
982
|
if (r === -1) return e;
|
|
1053
983
|
let i = e[r], a = {
|
|
@@ -1062,19 +992,19 @@ function gt(e, t, n) {
|
|
|
1062
992
|
...e.slice(r + 1)
|
|
1063
993
|
];
|
|
1064
994
|
}
|
|
1065
|
-
function
|
|
995
|
+
function pt({ children: e }) {
|
|
1066
996
|
let [t, n] = M(Q);
|
|
1067
997
|
j(() => {
|
|
1068
|
-
|
|
998
|
+
st(t);
|
|
1069
999
|
}, [t]);
|
|
1070
1000
|
let r = ce(t);
|
|
1071
1001
|
r.current = t;
|
|
1072
1002
|
let i = ce(null), [a, o] = M("off"), s = A((e) => {
|
|
1073
1003
|
let t = i.current;
|
|
1074
|
-
!t ||
|
|
1075
|
-
e instanceof
|
|
1004
|
+
!t || ot(e) || t.push(e).catch((e) => {
|
|
1005
|
+
e instanceof U && J(), typeof console < "u" && console.warn("library sync: push failed —", e?.message || e);
|
|
1076
1006
|
});
|
|
1077
|
-
}, []), c =
|
|
1007
|
+
}, []), c = Me();
|
|
1078
1008
|
j(() => {
|
|
1079
1009
|
if (!c) {
|
|
1080
1010
|
i.current = null, o("off");
|
|
@@ -1083,23 +1013,23 @@ function _t({ children: e }) {
|
|
|
1083
1013
|
let e = !0;
|
|
1084
1014
|
return c.backend.hydrate().then((t) => {
|
|
1085
1015
|
if (!e) return;
|
|
1086
|
-
let { next: a, pushes: l } =
|
|
1016
|
+
let { next: a, pushes: l } = Te(r.current, t);
|
|
1087
1017
|
i.current = c.backend, n({
|
|
1088
1018
|
...X,
|
|
1089
1019
|
...a
|
|
1090
1020
|
}), o("on");
|
|
1091
1021
|
for (let e of l) s(e);
|
|
1092
1022
|
}).catch((e) => {
|
|
1093
|
-
e instanceof
|
|
1023
|
+
e instanceof U && J(), typeof console < "u" && console.warn("library sync: hydrate failed —", e?.message || e);
|
|
1094
1024
|
}), () => {
|
|
1095
1025
|
e = !1;
|
|
1096
1026
|
};
|
|
1097
1027
|
}, [c, s]);
|
|
1098
1028
|
let l = A((e, t) => {
|
|
1099
1029
|
if (!Y.includes(e) || !t) return null;
|
|
1100
|
-
let r =
|
|
1030
|
+
let r = $e[e], i = r ? r(t) : t;
|
|
1101
1031
|
if (!i) return null;
|
|
1102
|
-
let a =
|
|
1032
|
+
let a = qe(), o = {
|
|
1103
1033
|
v: 1,
|
|
1104
1034
|
id: a,
|
|
1105
1035
|
savedAt: Date.now(),
|
|
@@ -1123,9 +1053,9 @@ function _t({ children: e }) {
|
|
|
1123
1053
|
kind: e,
|
|
1124
1054
|
id: t
|
|
1125
1055
|
});
|
|
1126
|
-
}, [s]),
|
|
1056
|
+
}, [s]), d = A((e, t, i) => {
|
|
1127
1057
|
if (!Y.includes(e) || !t || !i) return;
|
|
1128
|
-
let a =
|
|
1058
|
+
let a = $e[e], o = a ? a(i) : i;
|
|
1129
1059
|
if (!o) return;
|
|
1130
1060
|
let c = Date.now(), l = (e) => ({
|
|
1131
1061
|
...e,
|
|
@@ -1145,19 +1075,19 @@ function _t({ children: e }) {
|
|
|
1145
1075
|
kind: e,
|
|
1146
1076
|
item: l(u)
|
|
1147
1077
|
});
|
|
1148
|
-
}, [s]),
|
|
1078
|
+
}, [s]), f = A((e, t, i) => {
|
|
1149
1079
|
if (!Y.includes(e) || !t) return;
|
|
1150
1080
|
n((n) => ({
|
|
1151
1081
|
...n,
|
|
1152
|
-
[e]:
|
|
1082
|
+
[e]: dt(n[e] ?? [], t, i)
|
|
1153
1083
|
}));
|
|
1154
|
-
let a =
|
|
1084
|
+
let a = dt(r.current[e] ?? [], t, i).find((e) => e.id === t);
|
|
1155
1085
|
a && s({
|
|
1156
1086
|
op: "put",
|
|
1157
1087
|
kind: e,
|
|
1158
1088
|
item: a
|
|
1159
1089
|
});
|
|
1160
|
-
}, [s]),
|
|
1090
|
+
}, [s]), p = A((e, t, i) => {
|
|
1161
1091
|
if (!Y.includes(e) || !t || typeof i != "string" || (r.current[e] ?? []).find((e) => e.id === t)?.shipped) return;
|
|
1162
1092
|
let a = (e) => e.map((e) => e.id === t ? {
|
|
1163
1093
|
...e,
|
|
@@ -1173,28 +1103,28 @@ function _t({ children: e }) {
|
|
|
1173
1103
|
kind: e,
|
|
1174
1104
|
item: o
|
|
1175
1105
|
});
|
|
1176
|
-
}, [s]),
|
|
1106
|
+
}, [s]), m = A((e, t) => {
|
|
1177
1107
|
if (!Y.includes(e) || !t) return null;
|
|
1178
|
-
let i =
|
|
1108
|
+
let i = qe();
|
|
1179
1109
|
n((n) => ({
|
|
1180
1110
|
...n,
|
|
1181
|
-
[e]:
|
|
1111
|
+
[e]: ft(n[e] ?? [], t, i)
|
|
1182
1112
|
}));
|
|
1183
|
-
let a =
|
|
1113
|
+
let a = ft(r.current[e] ?? [], t, i).find((e) => e.id === i);
|
|
1184
1114
|
return a && s({
|
|
1185
1115
|
op: "put",
|
|
1186
1116
|
kind: e,
|
|
1187
1117
|
item: a
|
|
1188
1118
|
}), i;
|
|
1189
|
-
}, [s]),
|
|
1119
|
+
}, [s]), h = A((e) => {
|
|
1190
1120
|
n((t) => ({
|
|
1191
1121
|
...t,
|
|
1192
1122
|
[e]: []
|
|
1193
1123
|
}));
|
|
1194
|
-
}, []),
|
|
1124
|
+
}, []), g = A(() => n(X), []), _ = A((e) => n({
|
|
1195
1125
|
...X,
|
|
1196
1126
|
...e
|
|
1197
|
-
}), []),
|
|
1127
|
+
}), []), v = {
|
|
1198
1128
|
library: t,
|
|
1199
1129
|
selected: se(() => Y.reduce((e, n) => {
|
|
1200
1130
|
let r = t[n] ?? [];
|
|
@@ -1202,26 +1132,26 @@ function _t({ children: e }) {
|
|
|
1202
1132
|
}, {}), [t]),
|
|
1203
1133
|
addItem: l,
|
|
1204
1134
|
removeItem: u,
|
|
1205
|
-
updateItem:
|
|
1206
|
-
renameItem:
|
|
1207
|
-
setThumb:
|
|
1208
|
-
duplicateItem:
|
|
1209
|
-
clearSlot:
|
|
1210
|
-
clearAll:
|
|
1211
|
-
replaceAll:
|
|
1135
|
+
updateItem: d,
|
|
1136
|
+
renameItem: f,
|
|
1137
|
+
setThumb: p,
|
|
1138
|
+
duplicateItem: m,
|
|
1139
|
+
clearSlot: h,
|
|
1140
|
+
clearAll: g,
|
|
1141
|
+
replaceAll: _,
|
|
1212
1142
|
syncState: a,
|
|
1213
1143
|
savePalette: (e) => l("palette", e),
|
|
1214
1144
|
savePattern: (e) => l("pattern", e),
|
|
1215
1145
|
saveType: (e) => l("type", e),
|
|
1216
1146
|
savePreset: (e) => l("preset", e)
|
|
1217
1147
|
};
|
|
1218
|
-
return /* @__PURE__ */ N(
|
|
1219
|
-
value:
|
|
1148
|
+
return /* @__PURE__ */ N(ut.Provider, {
|
|
1149
|
+
value: v,
|
|
1220
1150
|
children: e
|
|
1221
1151
|
});
|
|
1222
1152
|
}
|
|
1223
|
-
function
|
|
1224
|
-
return oe(
|
|
1153
|
+
function mt() {
|
|
1154
|
+
return oe(ut) || {
|
|
1225
1155
|
library: X,
|
|
1226
1156
|
selected: Y.reduce((e, t) => (e[t] = null, e), {}),
|
|
1227
1157
|
addItem: () => null,
|
|
@@ -1237,29 +1167,29 @@ function vt() {
|
|
|
1237
1167
|
savePreset: () => null
|
|
1238
1168
|
};
|
|
1239
1169
|
}
|
|
1240
|
-
var
|
|
1170
|
+
var ht = Y, gt = (e) => i("generators")?.loopById(e) ?? null, _t = {
|
|
1241
1171
|
bg: "Background",
|
|
1242
1172
|
fg: "Ink",
|
|
1243
1173
|
accent: "Accent",
|
|
1244
1174
|
dim: "Dim",
|
|
1245
1175
|
warm: "Warm"
|
|
1246
|
-
},
|
|
1176
|
+
}, vt = {
|
|
1247
1177
|
0: "fg",
|
|
1248
1178
|
1: "warm",
|
|
1249
1179
|
3: "dim",
|
|
1250
1180
|
4: "accent",
|
|
1251
1181
|
5: "bg"
|
|
1252
|
-
},
|
|
1253
|
-
function
|
|
1254
|
-
let e = r(), { layers:
|
|
1255
|
-
base:
|
|
1256
|
-
relation:
|
|
1182
|
+
}, $ = (e) => e.slice(0, 7).toLowerCase();
|
|
1183
|
+
function yt() {
|
|
1184
|
+
let e = r(), { layers: i, selectedId: s, updateLayer: c, setColorAt: u } = n(), { library: m, addItem: g } = mt(), [_, b] = M("analogous"), [S, re] = M(h), [C, w] = M(() => o(.62, .14, Math.random() * 360)), [T, E] = M(() => te(l(S), {
|
|
1185
|
+
base: C,
|
|
1186
|
+
relation: _,
|
|
1257
1187
|
count: 5
|
|
1258
1188
|
}).map((e) => ({
|
|
1259
1189
|
hex: e,
|
|
1260
1190
|
locked: !1
|
|
1261
|
-
}))), [
|
|
1262
|
-
let i =
|
|
1191
|
+
}))), [ie, D] = M(null), O = se(() => d(m), [m]), k = ({ b: e = C, rel: t = _, n = T.length, s: r = S } = {}) => {
|
|
1192
|
+
let i = te(l(r), {
|
|
1263
1193
|
base: e,
|
|
1264
1194
|
relation: t,
|
|
1265
1195
|
count: n
|
|
@@ -1267,58 +1197,58 @@ function Ct() {
|
|
|
1267
1197
|
E((e) => i.map((t, n) => e[n]?.locked ? e[n] : {
|
|
1268
1198
|
hex: t,
|
|
1269
1199
|
locked: !1
|
|
1270
|
-
})),
|
|
1271
|
-
},
|
|
1272
|
-
let e =
|
|
1273
|
-
|
|
1200
|
+
})), D(null);
|
|
1201
|
+
}, A = () => {
|
|
1202
|
+
let e = h();
|
|
1203
|
+
re(e), k({ s: e });
|
|
1204
|
+
}, oe = (e) => {
|
|
1205
|
+
let t = $(e);
|
|
1206
|
+
w(t), k({ b: t });
|
|
1274
1207
|
}, j = (e) => {
|
|
1275
|
-
|
|
1276
|
-
ie(t), A({ b: t });
|
|
1208
|
+
b(e), k({ rel: e });
|
|
1277
1209
|
}, ce = (e) => {
|
|
1278
|
-
x(e), A({ rel: e });
|
|
1279
|
-
}, le = (e) => {
|
|
1280
1210
|
let t = Number(e);
|
|
1281
|
-
Number.isInteger(t) && t >= 2 && t <= 8 &&
|
|
1282
|
-
},
|
|
1211
|
+
Number.isInteger(t) && t >= 2 && t <= 8 && k({ n: t });
|
|
1212
|
+
}, le = (e, t) => {
|
|
1283
1213
|
E((n) => n.map((n, r) => r === e ? {
|
|
1284
1214
|
...n,
|
|
1285
|
-
hex:
|
|
1286
|
-
} : n)),
|
|
1287
|
-
},
|
|
1215
|
+
hex: $(t)
|
|
1216
|
+
} : n)), D(null);
|
|
1217
|
+
}, ue = (e) => E((t) => t.map((t, n) => n === e ? {
|
|
1288
1218
|
...t,
|
|
1289
1219
|
locked: !t.locked
|
|
1290
|
-
} : t)),
|
|
1291
|
-
E((t) => t.filter((t, n) => n !== e)),
|
|
1292
|
-
},
|
|
1293
|
-
let t =
|
|
1220
|
+
} : t)), fe = (e) => {
|
|
1221
|
+
E((t) => t.filter((t, n) => n !== e)), D(null);
|
|
1222
|
+
}, pe = (e) => {
|
|
1223
|
+
let t = O.find((t) => t.id === e);
|
|
1294
1224
|
if (!t) return;
|
|
1295
1225
|
let n = t.colors.slice(0, 8);
|
|
1296
1226
|
E((n.length >= 2 ? n : [...n, ...n]).map((e) => ({
|
|
1297
|
-
hex:
|
|
1227
|
+
hex: $(e),
|
|
1298
1228
|
locked: !1
|
|
1299
|
-
}))),
|
|
1229
|
+
}))), D({
|
|
1300
1230
|
name: t.name,
|
|
1301
1231
|
roles: t.colors.length <= 8 ? t.roles : null
|
|
1302
1232
|
});
|
|
1303
|
-
}, F = T.map((e) => e.hex), I =
|
|
1304
|
-
name:
|
|
1305
|
-
relation:
|
|
1233
|
+
}, F = T.map((e) => e.hex), I = ie?.roles ?? a(F), me = p.find((e) => e.id === _)?.label ?? "Palette", L = {
|
|
1234
|
+
name: ie?.name ?? me,
|
|
1235
|
+
relation: _,
|
|
1306
1236
|
colors: F,
|
|
1307
1237
|
roles: I
|
|
1308
|
-
},
|
|
1238
|
+
}, he = (e) => f.filter((t) => I[t]?.toLowerCase() === e).map((e) => _t[e]).join(", "), R = s && s !== "canvas" ? t(i, s) : null, z = R?.type === "loop" ? gt(R.loopId)?.params : null, ge = () => {
|
|
1309
1239
|
if (!R || !z) return;
|
|
1310
|
-
let e =
|
|
1240
|
+
let e = ee(R, z, L, { rotate: !0 }), t = Object.fromEntries(z.filter((e) => e.type === "color").map((t) => [t.key, e[t.key]]));
|
|
1311
1241
|
c(R.id, t);
|
|
1312
|
-
},
|
|
1242
|
+
}, _e = () => Object.entries(vt).forEach(([e, t]) => u(Number(e), I[t]));
|
|
1313
1243
|
return /* @__PURE__ */ P("div", {
|
|
1314
1244
|
className: "p-4 flex flex-col gap-4",
|
|
1315
1245
|
children: [
|
|
1316
1246
|
/* @__PURE__ */ P("div", {
|
|
1317
1247
|
className: "flex items-center gap-2",
|
|
1318
1248
|
children: [
|
|
1319
|
-
/* @__PURE__ */ N(
|
|
1320
|
-
color:
|
|
1321
|
-
onChange:
|
|
1249
|
+
/* @__PURE__ */ N(ne, {
|
|
1250
|
+
color: C.toUpperCase(),
|
|
1251
|
+
onChange: oe,
|
|
1322
1252
|
size: "sm",
|
|
1323
1253
|
label: "Base"
|
|
1324
1254
|
}),
|
|
@@ -1328,7 +1258,7 @@ function Ct() {
|
|
|
1328
1258
|
}),
|
|
1329
1259
|
/* @__PURE__ */ N("span", {
|
|
1330
1260
|
className: "kol-mono-10 text-meta flex-1",
|
|
1331
|
-
children:
|
|
1261
|
+
children: C.toUpperCase()
|
|
1332
1262
|
}),
|
|
1333
1263
|
/* @__PURE__ */ N("span", {
|
|
1334
1264
|
className: "kol-helper-10 uppercase text-meta",
|
|
@@ -1339,7 +1269,7 @@ function Ct() {
|
|
|
1339
1269
|
min: 2,
|
|
1340
1270
|
max: 8,
|
|
1341
1271
|
value: T.length,
|
|
1342
|
-
onChange: (e) =>
|
|
1272
|
+
onChange: (e) => ce(e.target.value),
|
|
1343
1273
|
className: "w-16",
|
|
1344
1274
|
"aria-label": "Colors"
|
|
1345
1275
|
})
|
|
@@ -1347,20 +1277,20 @@ function Ct() {
|
|
|
1347
1277
|
}),
|
|
1348
1278
|
/* @__PURE__ */ P("div", {
|
|
1349
1279
|
className: "flex items-center gap-2",
|
|
1350
|
-
children: [/* @__PURE__ */ N(
|
|
1280
|
+
children: [/* @__PURE__ */ N(x, {
|
|
1351
1281
|
className: "flex-1 min-w-0",
|
|
1352
1282
|
size: e,
|
|
1353
1283
|
"aria-label": "Relationship",
|
|
1354
|
-
options:
|
|
1284
|
+
options: p.map((e) => ({
|
|
1355
1285
|
value: e.id,
|
|
1356
1286
|
label: e.label
|
|
1357
1287
|
})),
|
|
1358
|
-
value:
|
|
1359
|
-
onChange:
|
|
1360
|
-
}), /* @__PURE__ */ N(
|
|
1288
|
+
value: _,
|
|
1289
|
+
onChange: j
|
|
1290
|
+
}), /* @__PURE__ */ N(y, {
|
|
1361
1291
|
tone: "grey",
|
|
1362
1292
|
size: e,
|
|
1363
|
-
onClick:
|
|
1293
|
+
onClick: A,
|
|
1364
1294
|
children: "Roll"
|
|
1365
1295
|
})]
|
|
1366
1296
|
}),
|
|
@@ -1369,69 +1299,69 @@ function Ct() {
|
|
|
1369
1299
|
children: T.map((e, t) => /* @__PURE__ */ P("div", {
|
|
1370
1300
|
className: "flex items-center gap-2",
|
|
1371
1301
|
children: [
|
|
1372
|
-
/* @__PURE__ */ N(
|
|
1302
|
+
/* @__PURE__ */ N(ne, {
|
|
1373
1303
|
color: e.hex.toUpperCase(),
|
|
1374
|
-
onChange: (e) =>
|
|
1304
|
+
onChange: (e) => le(t, e),
|
|
1375
1305
|
size: "sm",
|
|
1376
1306
|
label: `Color ${t + 1}`
|
|
1377
1307
|
}),
|
|
1378
1308
|
/* @__PURE__ */ N("span", {
|
|
1379
1309
|
className: "kol-helper-10 uppercase text-meta flex-1 truncate",
|
|
1380
|
-
children:
|
|
1310
|
+
children: he(e.hex)
|
|
1381
1311
|
}),
|
|
1382
1312
|
/* @__PURE__ */ N("span", {
|
|
1383
1313
|
className: "kol-mono-10 text-meta",
|
|
1384
1314
|
children: e.hex.toUpperCase()
|
|
1385
1315
|
}),
|
|
1386
|
-
/* @__PURE__ */ N(
|
|
1316
|
+
/* @__PURE__ */ N(y, {
|
|
1387
1317
|
tone: "ghost",
|
|
1388
1318
|
quiet: !0,
|
|
1389
1319
|
size: "sm",
|
|
1390
1320
|
iconOnly: e.locked ? "lock" : "unlock",
|
|
1391
1321
|
"aria-label": `${e.locked ? "Unlock" : "Lock"} color ${t + 1}`,
|
|
1392
1322
|
pressed: e.locked,
|
|
1393
|
-
onClick: () =>
|
|
1323
|
+
onClick: () => ue(t)
|
|
1394
1324
|
}),
|
|
1395
1325
|
/* @__PURE__ */ N("span", {
|
|
1396
1326
|
className: T.length <= 2 ? "invisible pointer-events-none" : "contents",
|
|
1397
1327
|
"aria-hidden": T.length <= 2 || void 0,
|
|
1398
|
-
children: /* @__PURE__ */ N(
|
|
1328
|
+
children: /* @__PURE__ */ N(y, {
|
|
1399
1329
|
tone: "ghost",
|
|
1400
1330
|
quiet: !0,
|
|
1401
1331
|
size: "sm",
|
|
1402
1332
|
iconOnly: "trash",
|
|
1403
1333
|
"aria-label": `Delete color ${t + 1}`,
|
|
1404
1334
|
tabIndex: T.length <= 2 ? -1 : void 0,
|
|
1405
|
-
onClick: () =>
|
|
1335
|
+
onClick: () => fe(t)
|
|
1406
1336
|
})
|
|
1407
1337
|
})
|
|
1408
1338
|
]
|
|
1409
1339
|
}, t))
|
|
1410
1340
|
}),
|
|
1411
|
-
|
|
1341
|
+
v(I.bg, I.fg) < 4.5 && /* @__PURE__ */ P("span", {
|
|
1412
1342
|
className: "kol-helper-10 text-meta inline-flex items-center gap-1",
|
|
1413
1343
|
children: [/* @__PURE__ */ N(de, {
|
|
1414
1344
|
name: "info",
|
|
1415
1345
|
size: 12
|
|
1416
1346
|
}), "Ink on background is under 4.5:1"]
|
|
1417
1347
|
}),
|
|
1418
|
-
/* @__PURE__ */ N(
|
|
1348
|
+
/* @__PURE__ */ N(x, {
|
|
1419
1349
|
size: e,
|
|
1420
1350
|
"aria-label": "Load palette",
|
|
1421
1351
|
value: "",
|
|
1422
1352
|
options: [{
|
|
1423
1353
|
value: "",
|
|
1424
1354
|
label: "Load palette…"
|
|
1425
|
-
}, ...
|
|
1355
|
+
}, ...O.map((e) => ({
|
|
1426
1356
|
value: e.id,
|
|
1427
1357
|
label: e.name
|
|
1428
1358
|
}))],
|
|
1429
|
-
onChange: (e) => e &&
|
|
1359
|
+
onChange: (e) => e && pe(e)
|
|
1430
1360
|
}),
|
|
1431
|
-
/* @__PURE__ */ N(
|
|
1361
|
+
/* @__PURE__ */ N(y, {
|
|
1432
1362
|
tone: "grey",
|
|
1433
1363
|
size: e,
|
|
1434
|
-
onClick: () =>
|
|
1364
|
+
onClick: () => g("palette", {
|
|
1435
1365
|
name: L.name,
|
|
1436
1366
|
colors: F
|
|
1437
1367
|
}),
|
|
@@ -1439,17 +1369,17 @@ function Ct() {
|
|
|
1439
1369
|
}),
|
|
1440
1370
|
/* @__PURE__ */ P("div", {
|
|
1441
1371
|
className: "flex gap-2",
|
|
1442
|
-
children: [z && /* @__PURE__ */ N(
|
|
1372
|
+
children: [z && /* @__PURE__ */ N(y, {
|
|
1443
1373
|
tone: "grey",
|
|
1444
1374
|
size: e,
|
|
1445
1375
|
className: "flex-1",
|
|
1446
|
-
onClick:
|
|
1376
|
+
onClick: ge,
|
|
1447
1377
|
children: "Apply to layer"
|
|
1448
|
-
}), /* @__PURE__ */ N(
|
|
1378
|
+
}), /* @__PURE__ */ N(y, {
|
|
1449
1379
|
tone: "grey",
|
|
1450
1380
|
size: e,
|
|
1451
1381
|
className: "flex-1",
|
|
1452
|
-
onClick:
|
|
1382
|
+
onClick: _e,
|
|
1453
1383
|
children: "Apply to document"
|
|
1454
1384
|
})]
|
|
1455
1385
|
})
|
|
@@ -1458,15 +1388,15 @@ function Ct() {
|
|
|
1458
1388
|
}
|
|
1459
1389
|
//#endregion
|
|
1460
1390
|
//#region src/editor/color/ColorModesWindow.jsx
|
|
1461
|
-
var
|
|
1462
|
-
function
|
|
1391
|
+
var bt = "kol:open-color-modes", xt = () => window.dispatchEvent(new CustomEvent(bt));
|
|
1392
|
+
function St() {
|
|
1463
1393
|
let [e, t] = M(!1);
|
|
1464
1394
|
if (j(() => {
|
|
1465
1395
|
let e = () => t(!0);
|
|
1466
|
-
return window.addEventListener(
|
|
1396
|
+
return window.addEventListener(bt, e), () => window.removeEventListener(bt, e);
|
|
1467
1397
|
}, []), !e) return null;
|
|
1468
1398
|
let n = () => t(!1);
|
|
1469
|
-
return /* @__PURE__ */ N(
|
|
1399
|
+
return /* @__PURE__ */ N(S, {
|
|
1470
1400
|
open: !0,
|
|
1471
1401
|
onClose: n,
|
|
1472
1402
|
closeButton: !1,
|
|
@@ -1480,14 +1410,14 @@ function Tt() {
|
|
|
1480
1410
|
children: [/* @__PURE__ */ N("span", {
|
|
1481
1411
|
className: "font-sans text-[13px] text-emphasis",
|
|
1482
1412
|
children: "Color Modes"
|
|
1483
|
-
}), /* @__PURE__ */ N(
|
|
1413
|
+
}), /* @__PURE__ */ N(b, {
|
|
1484
1414
|
onClick: n,
|
|
1485
1415
|
size: "sm",
|
|
1486
1416
|
className: "!absolute right-3"
|
|
1487
1417
|
})]
|
|
1488
|
-
}), /* @__PURE__ */ N(
|
|
1418
|
+
}), /* @__PURE__ */ N(yt, {})]
|
|
1489
1419
|
})
|
|
1490
1420
|
});
|
|
1491
1421
|
}
|
|
1492
1422
|
//#endregion
|
|
1493
|
-
export {
|
|
1423
|
+
export { L as A, ze as C, Se as D, Me as E, ye as O, J as S, Ne as T, Ue as _, ft as a, Ee as b, Q as c, ct as d, mt as f, We as g, je as h, ht as i, xe as k, lt as l, De as m, xt as n, dt as o, U as p, pt as r, ot as s, St as t, st as u, Ve as v, Be as w, Re as x, He as y };
|