@kolkrabbi/design-editor 0.13.0 → 0.15.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-CuCS4LS-.js +127 -0
- package/dist/RuleRow-4eAy_jzf.js +587 -0
- package/dist/TreePicker-D5XZT0Zi.js +303 -0
- package/dist/core-Dr8KZNAY.js +12176 -0
- package/dist/core.js +3 -0
- package/dist/design-editor.css +1 -2
- package/dist/design-editor.js +777 -77813
- package/dist/effects-DzHdDgL4.js +4558 -0
- package/dist/effects.js +2 -0
- package/dist/generators-DG5yqNy1.js +2579 -0
- package/dist/generators.js +2 -0
- package/dist/{host-CVR9RL_W.js → host-DiI1hniH.js} +89 -86
- package/dist/labels-B10g9Um5.js +40 -0
- package/dist/motion-DtxlM5Bu.js +4220 -0
- package/dist/motion.js +2 -0
- package/dist/registry-CSOtIU7o.js +28794 -0
- package/dist/rolls-CkmuE-Ya.js +22831 -0
- package/dist/{src-QwKcYKfv.js → src-DFtETCsY.js} +1 -1
- package/dist/useLayerEdit-BDXtPeAP.js +258 -0
- package/package.json +26 -14
- package/dist/phase-t_DhU5Nm.js +0 -1719
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { S as e } from "./rolls-CkmuE-Ya.js";
|
|
2
|
+
import { Dropdown as t, LabeledControl as n, SettingsRow as r, embedFontFace as i } from "@kolkrabbi/kol-component";
|
|
3
|
+
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
|
+
//#region src/loops/lib/util.js
|
|
5
|
+
var c = Math.PI * 2, l = (e) => Math.max(0, Math.min(1, e)), u = (e, t, n) => e + (t - e) * n, d = (e) => parseInt(e, 16);
|
|
6
|
+
function f(e) {
|
|
7
|
+
let t = String(e || "").replace("#", ""), n = t.length === 3 ? t.split("").map((e) => e + e).join("") : t;
|
|
8
|
+
return n.length < 6 ? [
|
|
9
|
+
0,
|
|
10
|
+
0,
|
|
11
|
+
0
|
|
12
|
+
] : [
|
|
13
|
+
d(n.slice(0, 2)),
|
|
14
|
+
d(n.slice(2, 4)),
|
|
15
|
+
d(n.slice(4, 6))
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
function p(e, t, n) {
|
|
19
|
+
let r = f(e), i = f(t);
|
|
20
|
+
return `rgb(${Math.round(u(r[0], i[0], n))}, ${Math.round(u(r[1], i[1], n))}, ${Math.round(u(r[2], i[2], n))})`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/kinetic/fonts.js
|
|
24
|
+
var m = [
|
|
25
|
+
{
|
|
26
|
+
key: "rot",
|
|
27
|
+
label: "Rot",
|
|
28
|
+
family: "TG Rot",
|
|
29
|
+
url: "/fonts/TG/TGRotVF.ttf",
|
|
30
|
+
axes: [{
|
|
31
|
+
tag: "wdth",
|
|
32
|
+
min: 64,
|
|
33
|
+
max: 172,
|
|
34
|
+
def: 100
|
|
35
|
+
}, {
|
|
36
|
+
tag: "wght",
|
|
37
|
+
min: 100,
|
|
38
|
+
max: 900,
|
|
39
|
+
def: 400
|
|
40
|
+
}]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
key: "malromur",
|
|
44
|
+
label: "Malromur",
|
|
45
|
+
family: "TG Malromur",
|
|
46
|
+
url: "/fonts/TG/TGMalromurRomanVF.ttf",
|
|
47
|
+
axes: [{
|
|
48
|
+
tag: "wght",
|
|
49
|
+
min: 300,
|
|
50
|
+
max: 900,
|
|
51
|
+
def: 300
|
|
52
|
+
}]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: "gullhamrar",
|
|
56
|
+
label: "Gullhamrar",
|
|
57
|
+
family: "TG Gullhamrar",
|
|
58
|
+
url: "/fonts/TG/TGGullhamrarVF.ttf",
|
|
59
|
+
axes: [{
|
|
60
|
+
tag: "wght",
|
|
61
|
+
min: 300,
|
|
62
|
+
max: 900,
|
|
63
|
+
def: 300
|
|
64
|
+
}]
|
|
65
|
+
}
|
|
66
|
+
], h = m.map((e) => ({
|
|
67
|
+
value: e.key,
|
|
68
|
+
label: e.label
|
|
69
|
+
})), g = {
|
|
70
|
+
wght: "Weight",
|
|
71
|
+
wdth: "Width",
|
|
72
|
+
ital: "Italic",
|
|
73
|
+
slnt: "Slant",
|
|
74
|
+
opsz: "Optical size"
|
|
75
|
+
}, _ = (e) => m.find((t) => t.key === e) || m[0];
|
|
76
|
+
function v(e) {
|
|
77
|
+
let t = {};
|
|
78
|
+
for (let n of e.axes) t[n.tag] = n.def;
|
|
79
|
+
return t;
|
|
80
|
+
}
|
|
81
|
+
function y(e) {
|
|
82
|
+
let t = Object.entries(e || {}).map(([e, t]) => `'${e}' ${Math.round(t * 100) / 100}`);
|
|
83
|
+
return t.length ? t.join(", ") : "normal";
|
|
84
|
+
}
|
|
85
|
+
var b = !1;
|
|
86
|
+
async function x() {
|
|
87
|
+
if (!(b || typeof FontFace > "u")) {
|
|
88
|
+
b = !0;
|
|
89
|
+
for (let e of m) {
|
|
90
|
+
let t = {}, n = e.axes.find((e) => e.tag === "wght"), r = e.axes.find((e) => e.tag === "wdth");
|
|
91
|
+
n && (t.weight = `${n.min} ${n.max}`), r && (t.stretch = `${r.min}% ${r.max}%`);
|
|
92
|
+
try {
|
|
93
|
+
let n = new FontFace(e.family, `url(${e.url})`, t);
|
|
94
|
+
document.fonts.add(n), n.load().catch(() => {});
|
|
95
|
+
} catch {}
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
await document.fonts.ready;
|
|
99
|
+
} catch {}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
var S = /* @__PURE__ */ new Map(), C = null;
|
|
103
|
+
function w() {
|
|
104
|
+
return C || (C = Promise.all(m.map(async (e) => {
|
|
105
|
+
if (!S.has(e.url)) try {
|
|
106
|
+
S.set(e.url, await i({
|
|
107
|
+
family: e.family,
|
|
108
|
+
url: e.url
|
|
109
|
+
}));
|
|
110
|
+
} catch (t) {
|
|
111
|
+
console.warn(`[design-editor] font not embedded, export will fall back for ${e.family}:`, t);
|
|
112
|
+
}
|
|
113
|
+
})), C);
|
|
114
|
+
}
|
|
115
|
+
function T(e) {
|
|
116
|
+
let t = /* @__PURE__ */ new Set();
|
|
117
|
+
for (let n of e?.instances ?? []) t.add(_(n.font).url);
|
|
118
|
+
return [...t].map((e) => S.get(e)).filter(Boolean).join("\n");
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/loops/lib/themes.js
|
|
122
|
+
var E = [
|
|
123
|
+
{
|
|
124
|
+
id: "dark",
|
|
125
|
+
label: "Dark",
|
|
126
|
+
bg: "#050506",
|
|
127
|
+
fg: "#9ec1ff",
|
|
128
|
+
accent: "#9ec1ff",
|
|
129
|
+
dim: "#4a4d60",
|
|
130
|
+
warm: "#f3c9c4",
|
|
131
|
+
grid: "#ffffff",
|
|
132
|
+
gridOpacity: .1
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "paper",
|
|
136
|
+
label: "Paper",
|
|
137
|
+
bg: "#f4f1ea",
|
|
138
|
+
fg: "#16202e",
|
|
139
|
+
accent: "#3b5b8a",
|
|
140
|
+
dim: "#6b7280",
|
|
141
|
+
warm: "#b0623a",
|
|
142
|
+
grid: "#16202e",
|
|
143
|
+
gridOpacity: .14
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: "blueprint",
|
|
147
|
+
label: "Blueprint",
|
|
148
|
+
bg: "#0b1d3a",
|
|
149
|
+
fg: "#8fd3ff",
|
|
150
|
+
accent: "#8fd3ff",
|
|
151
|
+
dim: "#3f5a78",
|
|
152
|
+
warm: "#e3a054",
|
|
153
|
+
grid: "#8fd3ff",
|
|
154
|
+
gridOpacity: .2
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: "mono",
|
|
158
|
+
label: "Mono",
|
|
159
|
+
bg: "#0a0a0a",
|
|
160
|
+
fg: "#ededed",
|
|
161
|
+
accent: "#ededed",
|
|
162
|
+
dim: "#8a8a8a",
|
|
163
|
+
warm: "#d8c4a0",
|
|
164
|
+
grid: "#ffffff",
|
|
165
|
+
gridOpacity: .08
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
id: "amber",
|
|
169
|
+
label: "Amber",
|
|
170
|
+
bg: "#0c0a06",
|
|
171
|
+
fg: "#ffb35c",
|
|
172
|
+
accent: "#ffcf8a",
|
|
173
|
+
dim: "#8a6a3a",
|
|
174
|
+
warm: "#ffd8a0",
|
|
175
|
+
grid: "#ffcf8a",
|
|
176
|
+
gridOpacity: .12
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
id: "ink",
|
|
180
|
+
label: "Ink",
|
|
181
|
+
bg: "#0a0b14",
|
|
182
|
+
fg: "#f0ead8",
|
|
183
|
+
accent: "#8b8fd6",
|
|
184
|
+
dim: "#4a4d60",
|
|
185
|
+
warm: "#f3c9c4",
|
|
186
|
+
grid: "#f0ead8",
|
|
187
|
+
gridOpacity: .07
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "slate",
|
|
191
|
+
label: "Slate",
|
|
192
|
+
bg: "#12161d",
|
|
193
|
+
fg: "#e7eef5",
|
|
194
|
+
accent: "#7fb0d8",
|
|
195
|
+
dim: "#566273",
|
|
196
|
+
warm: "#cfe0ee",
|
|
197
|
+
grid: "#e7eef5",
|
|
198
|
+
gridOpacity: .07
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: "plum",
|
|
202
|
+
label: "Plum",
|
|
203
|
+
bg: "#120a17",
|
|
204
|
+
fg: "#f0e6f3",
|
|
205
|
+
accent: "#c08bd6",
|
|
206
|
+
dim: "#5e4a66",
|
|
207
|
+
warm: "#f3c9e8",
|
|
208
|
+
grid: "#f0e6f3",
|
|
209
|
+
gridOpacity: .07
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
id: "kol",
|
|
213
|
+
label: "KOL",
|
|
214
|
+
bg: "#121215",
|
|
215
|
+
fg: "#FAF7F0",
|
|
216
|
+
accent: "#FFCF33",
|
|
217
|
+
dim: "#3F6485",
|
|
218
|
+
warm: "#E3A054",
|
|
219
|
+
grid: "#FAF7F0",
|
|
220
|
+
gridOpacity: .1
|
|
221
|
+
}
|
|
222
|
+
], D = E.map((e) => ({
|
|
223
|
+
value: e.id,
|
|
224
|
+
label: e.label
|
|
225
|
+
}));
|
|
226
|
+
function O(e) {
|
|
227
|
+
return E.find((t) => t.id === e) || E[0];
|
|
228
|
+
}
|
|
229
|
+
function k(e, t = !1) {
|
|
230
|
+
let n = O(e);
|
|
231
|
+
return t ? {
|
|
232
|
+
...n,
|
|
233
|
+
bg: n.fg,
|
|
234
|
+
fg: n.bg,
|
|
235
|
+
grid: n.bg
|
|
236
|
+
} : { ...n };
|
|
237
|
+
}
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/editor/compose/inspectors/TreePicker.jsx
|
|
240
|
+
function A(n) {
|
|
241
|
+
return /* @__PURE__ */ o(t, {
|
|
242
|
+
variant: "subtle",
|
|
243
|
+
size: e(),
|
|
244
|
+
className: "w-full",
|
|
245
|
+
...n
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
function j({ label: e, options: t, value: i, onChange: a, children: s, inline: c = !1 }) {
|
|
249
|
+
let l = s ?? /* @__PURE__ */ o(A, {
|
|
250
|
+
options: t,
|
|
251
|
+
value: i,
|
|
252
|
+
onChange: a
|
|
253
|
+
});
|
|
254
|
+
return c ? /* @__PURE__ */ o(r, {
|
|
255
|
+
label: e,
|
|
256
|
+
align: "fill",
|
|
257
|
+
labelWidth: 96,
|
|
258
|
+
children: l
|
|
259
|
+
}) : /* @__PURE__ */ o(n, {
|
|
260
|
+
label: e,
|
|
261
|
+
children: l
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function M({ tree: e, presets: t, current: n, onPick: r, inline: i = !1 }) {
|
|
265
|
+
let c = e.find((e) => e.subs.includes(n.sub)) ?? e[0], l = t.filter((e) => e.sub === n.sub), u = (e) => t.find((t) => t.sub === e);
|
|
266
|
+
return /* @__PURE__ */ s(a, { children: [
|
|
267
|
+
/* @__PURE__ */ o(j, {
|
|
268
|
+
inline: i,
|
|
269
|
+
label: "Type",
|
|
270
|
+
options: e.map((e) => ({
|
|
271
|
+
value: e.label,
|
|
272
|
+
label: e.label
|
|
273
|
+
})),
|
|
274
|
+
value: c.label,
|
|
275
|
+
onChange: (t) => {
|
|
276
|
+
let n = e.find((e) => e.label === t);
|
|
277
|
+
n && r(u(n.subs[0]));
|
|
278
|
+
}
|
|
279
|
+
}),
|
|
280
|
+
/* @__PURE__ */ o(j, {
|
|
281
|
+
inline: i,
|
|
282
|
+
label: "Category",
|
|
283
|
+
options: c.subs.map((e) => ({
|
|
284
|
+
value: e,
|
|
285
|
+
label: e
|
|
286
|
+
})),
|
|
287
|
+
value: n.sub,
|
|
288
|
+
onChange: (e) => r(u(e))
|
|
289
|
+
}),
|
|
290
|
+
/* @__PURE__ */ o(j, {
|
|
291
|
+
inline: i,
|
|
292
|
+
label: "Preset",
|
|
293
|
+
options: l.map((e) => ({
|
|
294
|
+
value: e.id,
|
|
295
|
+
label: e.label
|
|
296
|
+
})),
|
|
297
|
+
value: n.id,
|
|
298
|
+
onChange: (e) => r(t.find((t) => t.id === e))
|
|
299
|
+
})
|
|
300
|
+
] });
|
|
301
|
+
}
|
|
302
|
+
//#endregion
|
|
303
|
+
export { l as _, k as a, p as b, m as c, _ as d, T as f, c as g, w as h, D as i, h as l, y as m, j as n, O as o, x as p, M as r, g as s, A as t, v as u, f as v, u as y };
|