@kolkrabbi/design-editor 0.46.0 → 0.48.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-B0VcuOag.js → BindDot-Cx-M0iQt.js} +9 -8
- package/dist/{BufferResource-BfLgK37S.js → BufferResource-Di5teicy.js} +2 -2
- package/dist/{CanvasPool-YNSF8hsR.js → CanvasPool-JdLj49b-.js} +1 -1
- package/dist/CanvasRenderer-fXDObOOi.js +2 -0
- package/dist/{FederatedEventTarget-BJgROaRQ.js → FederatedEventTarget-CH0bzxx1.js} +1 -1
- package/dist/{FilterSystem-BUrPNXx-.js → FilterSystem-C-ZoyuTO.js} +3 -3
- package/dist/{Geometry-C5s5KpWq.js → Geometry-D4tiuMOr.js} +1 -1
- package/dist/KolboxView-BjYfn_tl.js +21615 -0
- package/dist/{RenderTargetSystem-oFwWv5IW.js → RenderTargetSystem-Bom_vhlS.js} +1 -1
- package/dist/{Timeline-Ck1rBV8S.js → Timeline-CRr43b4B.js} +49 -53
- package/dist/TreePicker-DXsAlHK6.js +209 -0
- package/dist/WebGLRenderer-4hvrGmfW.js +2 -0
- package/dist/WebGPURenderer-BjzMV7Pg.js +2 -0
- package/dist/__vite-browser-external-y2xWjzgx.js +780 -0
- package/dist/browserAll-BFE0MRLW.js +6 -0
- package/dist/{canvasUtils-BoNfkAod.js → canvasUtils-DUNsu3ct.js} +1 -1
- package/dist/{core-BBb9Tk4Q.js → core-BbKj9Svq.js} +5877 -8206
- package/dist/core.js +6 -5
- package/dist/design-editor.css +2 -1
- package/dist/design-editor.js +7 -3644
- package/dist/{effectCategories-Ccye-8LP.js → effectCategories-wHY9ih8L.js} +8966 -4985
- package/dist/effects-D7J0e5xl.js +447 -0
- package/dist/effects.js +1 -1
- package/dist/{generators-BdVXv0jY.js → generators-BtRZ3Stj.js} +2473 -2538
- package/dist/generators.js +1 -1
- package/dist/{getTextureBatchBindGroup-CNWhZRbV.js → getTextureBatchBindGroup-ZMqkwiZS.js} +1 -1
- package/dist/{host-meUhieO9.js → host-0qv2SCjk.js} +1 -1
- package/dist/{host-9pJ7NvnR.js → host-II9SeVCH.js} +50 -50
- package/dist/init-DkGhdexn.js +4 -0
- package/dist/kolbox-sheet.js +0 -0
- package/dist/kolbox.css +3 -0
- package/dist/{morphStore-D6mkLJ-8.js → morphStore-s-rjCe-y.js} +1 -1
- package/dist/{motion-wsc6Qd7S.js → motion-CKtZAccJ.js} +765 -762
- package/dist/motion.js +1 -1
- package/dist/{pipeline-CMpuPUaX.js → pipeline-hZsOKbHd.js} +12 -12
- package/dist/{previewScale-SYKvfhUm.js → previewScale-C6EBx--U.js} +8 -8
- package/dist/{rolls-KpWCAeDv.js → rolls-Cnu6g8th.js} +10671 -4810
- package/dist/src-3UkpFoNW.js +3430 -0
- package/dist/{src-B5o6fGRJ.js → src-D-TQbBo2.js} +1 -2
- package/dist/{store-iBb0I6hk.js → store-YIW6P2zN.js} +289 -269
- package/dist/useLayerEdit-W_Tf3adq.js +455 -0
- package/dist/webworkerAll-0WBQ2FBr.js +2 -0
- package/package.json +16 -13
- package/dist/CanvasRenderer-Bl0rlqNq.js +0 -2
- package/dist/TreePicker-Dv0zpJwe.js +0 -166
- package/dist/WebGLRenderer-CXxpVIx3.js +0 -2
- package/dist/WebGPURenderer-BwLEUYBa.js +0 -2
- package/dist/browserAll-CAzdTUbR.js +0 -6
- package/dist/chunk-3b4jIN3o.js +0 -13
- package/dist/effects-B47bpwGh.js +0 -447
- package/dist/init-jApIMi04.js +0 -4
- package/dist/useLayerEdit-Ba7RA6qX.js +0 -454
- package/dist/webworkerAll-DEZhpG90.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, F as i, H as a, J as o, K as s, L as c, Q as l, T as u, U as d, W as f, X as p, Y as m, _ as h, at as g, c as _, d as v, et as y, f as b, h as ee, i as te, it as ne, j as re, m as ie, n as ae, o as oe, ot as x, q as se, r as S, rt as C, s as ce, t as le, tt as ue, u as w, v as de, w as fe, x as pe, y as me, z as he } from "./Geometry-
|
|
1
|
+
import { A as e, C as t, D as n, E as r, F as i, H as a, J as o, K as s, L as c, Q as l, T as u, U as d, W as f, X as p, Y as m, _ as h, at as g, c as _, d as v, et as y, f as b, h as ee, i as te, it as ne, j as re, m as ie, n as ae, o as oe, ot as x, q as se, r as S, rt as C, s as ce, t as le, tt as ue, u as w, v as de, w as fe, x as pe, y as me, z as he } from "./Geometry-D4tiuMOr.js";
|
|
2
2
|
//#region ../../node_modules/.pnpm/pixi.js@8.20.1/node_modules/pixi.js/lib/scene/container/CustomRenderPipe.mjs
|
|
3
3
|
var ge = class {
|
|
4
4
|
constructor(e) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { S as e, o as t, s as n } from "./__vite-browser-external-y2xWjzgx.js";
|
|
2
|
+
import { D as r, J as i, M as a, N as o } from "./rolls-Cnu6g8th.js";
|
|
3
|
+
import { m as s, s as c, u as l } from "./morphStore-s-rjCe-y.js";
|
|
3
4
|
import { Button as u, Dropdown as d, Input as f, Tooltip as p, floatSurfaceClass as m, useGrabEdge as h } from "@kolkrabbi/kol-component";
|
|
4
5
|
import { Fragment as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
|
|
5
6
|
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
@@ -16,7 +17,8 @@ var T = {
|
|
|
16
17
|
path: "Path",
|
|
17
18
|
loop: "Loop",
|
|
18
19
|
kinetic: "Kinetic type",
|
|
19
|
-
misc: "Misc"
|
|
20
|
+
misc: "Misc",
|
|
21
|
+
frame: "Frame"
|
|
20
22
|
}, E = {
|
|
21
23
|
unite: "Unite",
|
|
22
24
|
subtract: "Subtract",
|
|
@@ -65,8 +67,8 @@ var P = 268, F = 14, I = 25, L = [
|
|
|
65
67
|
1,
|
|
66
68
|
2,
|
|
67
69
|
4
|
|
68
|
-
],
|
|
69
|
-
function
|
|
70
|
+
], ee = 96;
|
|
71
|
+
function R(e, t) {
|
|
70
72
|
if (e.length === 0) return 0;
|
|
71
73
|
if (t <= e[0].t) return e[0].v;
|
|
72
74
|
let n = e[e.length - 1];
|
|
@@ -78,44 +80,44 @@ function ee(e, t) {
|
|
|
78
80
|
let o = a.t - i.t || 1;
|
|
79
81
|
return i.v + (a.v - i.v) * ((t - i.t) / o);
|
|
80
82
|
}
|
|
81
|
-
function z(
|
|
82
|
-
for (let
|
|
83
|
-
let
|
|
84
|
-
if (
|
|
85
|
-
let i =
|
|
86
|
-
|
|
87
|
-
id: `${
|
|
88
|
-
layerId:
|
|
83
|
+
function z(e, t = []) {
|
|
84
|
+
for (let n of e) {
|
|
85
|
+
let e = Array.isArray(n.morph?.steps) ? n.morph.steps : null;
|
|
86
|
+
if (e?.length) {
|
|
87
|
+
let i = n.morph.name || "Morph", a = (t) => t.map((t) => e[(Math.round(t.v) % e.length + e.length) % e.length]?.label ?? ""), o = r(n.morphT) && n.morphT.bind === "track" ? n.morphT : null, c = o ? o.keys : s(e.map((e, t) => t), n.morph.cycle ?? "loop", n.morph.curve ?? "in-out");
|
|
88
|
+
t.push({
|
|
89
|
+
id: `${n.id}:morph`,
|
|
90
|
+
layerId: n.id,
|
|
89
91
|
key: "morphT",
|
|
90
92
|
label: i,
|
|
91
93
|
keys: c,
|
|
92
94
|
header: !0,
|
|
93
95
|
readOnly: !o,
|
|
94
96
|
names: a(c),
|
|
95
|
-
steps:
|
|
97
|
+
steps: e.length
|
|
96
98
|
});
|
|
97
99
|
}
|
|
98
|
-
for (let i in
|
|
99
|
-
if (i === "morphT" &&
|
|
100
|
-
let a =
|
|
101
|
-
|
|
102
|
-
id: `${
|
|
103
|
-
layerId:
|
|
100
|
+
for (let i in n) {
|
|
101
|
+
if (i === "morphT" && e?.length) continue;
|
|
102
|
+
let a = n[i];
|
|
103
|
+
r(a) && a.bind === "track" && t.push({
|
|
104
|
+
id: `${n.id}:${i}`,
|
|
105
|
+
layerId: n.id,
|
|
104
106
|
key: i,
|
|
105
|
-
label: `${O(
|
|
107
|
+
label: `${O(n)} · ${i}`,
|
|
106
108
|
keys: a.keys,
|
|
107
|
-
under:
|
|
109
|
+
under: e?.length ? `${n.id}:morph` : null
|
|
108
110
|
});
|
|
109
111
|
}
|
|
110
|
-
Array.isArray(
|
|
112
|
+
Array.isArray(n.children) && z(n.children, t);
|
|
111
113
|
}
|
|
112
|
-
return
|
|
114
|
+
return t;
|
|
113
115
|
}
|
|
114
116
|
function te(e, t = []) {
|
|
115
117
|
for (let n of e) t.push(n), Array.isArray(n.children) && te(n.children, t);
|
|
116
118
|
return t;
|
|
117
119
|
}
|
|
118
|
-
var ne = (
|
|
120
|
+
var ne = (e) => Object.values(e).some((e) => r(e) && e.bind === "mod" && String(e.source).startsWith("audio")), B = {
|
|
119
121
|
background: "square",
|
|
120
122
|
pattern: "ptrn-dot",
|
|
121
123
|
photo: "image",
|
|
@@ -130,7 +132,6 @@ var ne = (t) => Object.values(t).some((t) => e(t) && t.bind === "mod" && String(
|
|
|
130
132
|
function U({ name: e, label: t, on: n = !0, toggle: r = !1, size: i = 14, onClick: a, disabled: o, className: s = "" }) {
|
|
131
133
|
return /* @__PURE__ */ S(p, {
|
|
132
134
|
label: t,
|
|
133
|
-
variant: "float",
|
|
134
135
|
asChild: !0,
|
|
135
136
|
children: /* @__PURE__ */ S("button", {
|
|
136
137
|
type: "button",
|
|
@@ -149,7 +150,7 @@ function U({ name: e, label: t, on: n = !0, toggle: r = !1, size: i = 14, onClic
|
|
|
149
150
|
function ie({ track: e, view: t, selected: n, setSelected: r, writeKeys: i, lit: a }) {
|
|
150
151
|
let o = y(null), s = y(null), [, l] = b(0), u = !!e.header, d = !!e.readOnly, { X: f, fracFromEvent: m } = t, h = (t) => n && n.trackId === e.id && n.index === t, g = (t) => {
|
|
151
152
|
if (t.target.closest("[data-diamond]") || t.target.closest("[data-name]") || d) return;
|
|
152
|
-
let n = m(t, o.current), a =
|
|
153
|
+
let n = m(t, o.current), a = R(e.keys, n), s = [...e.keys, {
|
|
153
154
|
t: n,
|
|
154
155
|
v: a,
|
|
155
156
|
easing: "linear"
|
|
@@ -204,7 +205,6 @@ function ie({ track: e, view: t, selected: n, setSelected: r, writeKeys: i, lit:
|
|
|
204
205
|
let i = s.current?.index === r ? s.current.t : n.t, a = u ? e.names?.[r] : null;
|
|
205
206
|
return /* @__PURE__ */ S(p, {
|
|
206
207
|
label: u ? `${a} · ${H(i, t.loop)} s` : `${H(i, t.loop)} s · v=${typeof n.v == "number" ? Math.round(n.v * 100) / 100 : n.v} (alt-click deletes)`,
|
|
207
|
-
variant: "float",
|
|
208
208
|
asChild: !0,
|
|
209
209
|
children: /* @__PURE__ */ S("span", {
|
|
210
210
|
"data-diamond": "",
|
|
@@ -280,7 +280,7 @@ function G({ view: e, lit: t, label: n, wave: r }) {
|
|
|
280
280
|
children: r.map((e, t) => /* @__PURE__ */ S("span", {
|
|
281
281
|
className: "absolute top-1/2 -translate-y-1/2 w-0.5 bg-oq-40",
|
|
282
282
|
style: {
|
|
283
|
-
left: `${t /
|
|
283
|
+
left: `${t / ee * 100}%`,
|
|
284
284
|
height: 2 + Math.round(e * 10)
|
|
285
285
|
}
|
|
286
286
|
}, t))
|
|
@@ -399,11 +399,11 @@ function q({ view: e, now: t }) {
|
|
|
399
399
|
})]
|
|
400
400
|
});
|
|
401
401
|
}
|
|
402
|
-
var J = (e) => Array.isArray(e) ? e :
|
|
402
|
+
var J = (e) => Array.isArray(e) ? e : a[e] ?? null, Y = 132, X = 14;
|
|
403
403
|
function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
404
|
-
let
|
|
404
|
+
let i = y(null), [o, s] = b(0), [c, l] = b(null), u = y(null);
|
|
405
405
|
_(() => {
|
|
406
|
-
let e =
|
|
406
|
+
let e = i.current;
|
|
407
407
|
if (!e) return;
|
|
408
408
|
let t = new ResizeObserver(([e]) => s(e.contentRect.width));
|
|
409
409
|
return t.observe(e), () => t.disconnect();
|
|
@@ -411,7 +411,7 @@ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
|
411
411
|
let d = c ?? e.keys, f = d.map((e) => e.v), p = Math.min(...f), m = Math.max(...f);
|
|
412
412
|
u.current?.range && ([p, m] = u.current.range), m - p < 1e-9 && (--p, m += 1);
|
|
413
413
|
let h = (e) => e * o, g = (e) => X + (1 - (e - p) / (m - p)) * (Y - 2 * X), v = (e) => {
|
|
414
|
-
let t =
|
|
414
|
+
let t = i.current.getBoundingClientRect();
|
|
415
415
|
return {
|
|
416
416
|
t: Math.min(1, Math.max(0, (e.clientX - t.left) / t.width)),
|
|
417
417
|
v: p + (1 - (e.clientY - t.top - X) / (Y - 2 * X)) * (m - p)
|
|
@@ -420,7 +420,7 @@ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
|
420
420
|
i: t,
|
|
421
421
|
a: e,
|
|
422
422
|
b: d[t + 1],
|
|
423
|
-
bez: e.easing === "hold" ? null : J(e.easing ?? "linear") ??
|
|
423
|
+
bez: e.easing === "hold" ? null : J(e.easing ?? "linear") ?? a.linear
|
|
424
424
|
})), w = (t, n) => (i) => {
|
|
425
425
|
i.stopPropagation(), i.currentTarget.setPointerCapture(i.pointerId), u.current = {
|
|
426
426
|
kind: t,
|
|
@@ -440,7 +440,7 @@ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
|
440
440
|
let e = r[t.i - 1]?.t ?? 0, i = r[t.i + 1]?.t ?? 1;
|
|
441
441
|
r[t.i].t = Math.min(i, Math.max(e, n.t)), r[t.i].v = n.v;
|
|
442
442
|
} else {
|
|
443
|
-
let e = r[t.i],
|
|
443
|
+
let e = r[t.i], i = r[t.i + 1], o = i.t - e.t || 1e-6, s = Math.abs(i.v - e.v) > 1e-9 ? i.v - e.v : m - p, c = Math.min(1, Math.max(0, (n.t - e.t) / o)), l = (n.v - e.v) / s, u = [...J(e.easing ?? "linear") ?? a.linear];
|
|
444
444
|
t.kind === "out" ? (u[0] = c, u[1] = l) : (u[2] = c, u[3] = l), e.easing = u.map((e) => Math.round(e * 1e3) / 1e3);
|
|
445
445
|
}
|
|
446
446
|
l(r);
|
|
@@ -482,7 +482,7 @@ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
|
482
482
|
style: { width: P },
|
|
483
483
|
children: [/* @__PURE__ */ S("span", { children: Math.round(m * 100) / 100 }), /* @__PURE__ */ S("span", { children: Math.round(p * 100) / 100 })]
|
|
484
484
|
}), /* @__PURE__ */ S("div", {
|
|
485
|
-
ref:
|
|
485
|
+
ref: i,
|
|
486
486
|
className: "relative flex-1 rounded-[5px] bg-[var(--kol-float-well)]",
|
|
487
487
|
style: {
|
|
488
488
|
height: Y,
|
|
@@ -528,11 +528,11 @@ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
|
|
|
528
528
|
})]
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
|
-
var ce = [...
|
|
531
|
+
var ce = [...o, {
|
|
532
532
|
value: "custom",
|
|
533
533
|
label: "Custom"
|
|
534
534
|
}];
|
|
535
|
-
function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len:
|
|
535
|
+
function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len: i }) {
|
|
536
536
|
if (!t) return null;
|
|
537
537
|
let o = e.find((e) => e.id === t.trackId), s = o?.keys[t.index];
|
|
538
538
|
if (!s || o.readOnly) return null;
|
|
@@ -551,12 +551,11 @@ function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len: a }) {
|
|
|
551
551
|
className: "kol-float-label text-meta shrink-0",
|
|
552
552
|
children: [
|
|
553
553
|
"key @ ",
|
|
554
|
-
H(s.t,
|
|
554
|
+
H(s.t, i),
|
|
555
555
|
" s"
|
|
556
556
|
]
|
|
557
557
|
}),
|
|
558
558
|
!o.header && /* @__PURE__ */ S(f, {
|
|
559
|
-
variant: "float",
|
|
560
559
|
size: "sm",
|
|
561
560
|
chars: 7,
|
|
562
561
|
type: l ? "number" : "text",
|
|
@@ -568,10 +567,9 @@ function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len: a }) {
|
|
|
568
567
|
size: "sm",
|
|
569
568
|
options: ce,
|
|
570
569
|
value: p,
|
|
571
|
-
onChange: (e) => c({ easing: e === "custom" ? [...J(s.easing) ??
|
|
570
|
+
onChange: (e) => c({ easing: e === "custom" ? [...J(s.easing) ?? a["in-out"]] : e })
|
|
572
571
|
}),
|
|
573
572
|
/* @__PURE__ */ S(u, {
|
|
574
|
-
variant: "float",
|
|
575
573
|
tone: "ghost",
|
|
576
574
|
size: "sm",
|
|
577
575
|
onClick: () => {
|
|
@@ -580,7 +578,6 @@ function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len: a }) {
|
|
|
580
578
|
children: "Delete key"
|
|
581
579
|
}),
|
|
582
580
|
/* @__PURE__ */ S(u, {
|
|
583
|
-
variant: "float",
|
|
584
581
|
tone: "ghost",
|
|
585
582
|
size: "sm",
|
|
586
583
|
className: "ml-auto",
|
|
@@ -623,11 +620,11 @@ function fe({ onDrag: e, onEnd: t, onReset: n }) {
|
|
|
623
620
|
});
|
|
624
621
|
}
|
|
625
622
|
function pe() {
|
|
626
|
-
let { layers: e } =
|
|
623
|
+
let { layers: e } = i(), t = l(), n = N();
|
|
627
624
|
return v(() => z(e).length > 0, [e]) || !!t.active || n;
|
|
628
625
|
}
|
|
629
|
-
function me({ surface:
|
|
630
|
-
let { layers:
|
|
626
|
+
function me({ surface: r = "solid" }) {
|
|
627
|
+
let { layers: a, updateLayer: o, selectedIds: s, select: c, toggleLayer: u, toggleLayerLock: d, currentPresetName: f } = i(), { t: p, loopSeconds: m, seek: h } = n(), g = l(), x = N(), w = v(() => z(a), [a]), T = v(() => g.active && !w.some((e) => e.header) ? [{
|
|
631
628
|
id: "morph:empty",
|
|
632
629
|
layerId: null,
|
|
633
630
|
key: "morphT",
|
|
@@ -647,11 +644,11 @@ function me({ surface: e = "solid" }) {
|
|
|
647
644
|
P ? localStorage.setItem(Z, String(P)) : localStorage.removeItem(Z);
|
|
648
645
|
} catch {}
|
|
649
646
|
}, [P]);
|
|
650
|
-
let B = y(Array(
|
|
651
|
-
if (V.some(ne) && (B.current.push(
|
|
647
|
+
let B = y(Array(ee).fill(0)), V = v(() => te(a), [a]);
|
|
648
|
+
if (V.some(ne) && (B.current.push(e().level), B.current.shift()), T.length === 0 && !x) return null;
|
|
652
649
|
let H = p * m, re = he(m, j, H), U = (e, t) => {
|
|
653
650
|
let n = [...t].sort((e, t) => e.t - t.t);
|
|
654
|
-
|
|
651
|
+
o(e.layerId, { [e.key]: {
|
|
655
652
|
bind: "track",
|
|
656
653
|
keys: n
|
|
657
654
|
} });
|
|
@@ -662,7 +659,7 @@ function me({ surface: e = "solid" }) {
|
|
|
662
659
|
if (!W) return;
|
|
663
660
|
let e = [...W.keys, {
|
|
664
661
|
t: p,
|
|
665
|
-
v:
|
|
662
|
+
v: R(W.keys, p),
|
|
666
663
|
easing: "linear"
|
|
667
664
|
}].sort((e, t) => e.t - t.t);
|
|
668
665
|
U(W, e), D({
|
|
@@ -726,7 +723,7 @@ function me({ surface: e = "solid" }) {
|
|
|
726
723
|
},
|
|
727
724
|
onReset: () => F(null)
|
|
728
725
|
}), /* @__PURE__ */ S(ge, {
|
|
729
|
-
surface:
|
|
726
|
+
surface: r,
|
|
730
727
|
className: "h-full min-h-0",
|
|
731
728
|
title: f || "Untitled",
|
|
732
729
|
count: V.length,
|
|
@@ -835,7 +832,6 @@ function ge({ surface: e = "solid", title: t, count: n = 0, onAdd: r, mode: i =
|
|
|
835
832
|
}),
|
|
836
833
|
/* @__PURE__ */ S(p, {
|
|
837
834
|
label: "Zoom the lanes",
|
|
838
|
-
variant: "float",
|
|
839
835
|
asChild: !0,
|
|
840
836
|
children: /* @__PURE__ */ C("button", {
|
|
841
837
|
type: "button",
|
|
@@ -907,4 +903,4 @@ function ge({ surface: e = "solid", title: t, count: n = 0, onAdd: r, mode: i =
|
|
|
907
903
|
});
|
|
908
904
|
}
|
|
909
905
|
//#endregion
|
|
910
|
-
export {
|
|
906
|
+
export { pe as a, E as c, he as i, O as l, ge as n, M as o, R as r, N as s, me as t };
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { F as e, L as t, Sr as n, Yn as r, Zn as i, br as a, gr as o, qn as s, vr as c } from "./rolls-Cnu6g8th.js";
|
|
2
|
+
import { embedFontFace as l } from "@kolkrabbi/kol-component";
|
|
3
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
4
|
+
//#region src/kinetic/fonts.js
|
|
5
|
+
var p = (e, t) => {
|
|
6
|
+
let n = a[e];
|
|
7
|
+
return {
|
|
8
|
+
key: e,
|
|
9
|
+
label: n.label,
|
|
10
|
+
family: n.css,
|
|
11
|
+
url: n.roman,
|
|
12
|
+
italicUrl: n.italic,
|
|
13
|
+
slnt: n.slnt,
|
|
14
|
+
outline: !0,
|
|
15
|
+
italicStyle: n.slnt == null ? "italic" : `oblique ${-n.slnt}deg`,
|
|
16
|
+
axes: [{
|
|
17
|
+
tag: "wght",
|
|
18
|
+
min: n.min,
|
|
19
|
+
max: n.max,
|
|
20
|
+
def: t
|
|
21
|
+
}]
|
|
22
|
+
};
|
|
23
|
+
}, m = {
|
|
24
|
+
key: "rot",
|
|
25
|
+
label: "Rot",
|
|
26
|
+
family: "TG Rot",
|
|
27
|
+
url: "/fonts/TG/TGRotVF.ttf",
|
|
28
|
+
italicUrl: "/fonts/TG/TGRotItalicVF.ttf",
|
|
29
|
+
axes: [{
|
|
30
|
+
tag: "wdth",
|
|
31
|
+
min: 64,
|
|
32
|
+
max: 172,
|
|
33
|
+
def: 100
|
|
34
|
+
}, {
|
|
35
|
+
tag: "wght",
|
|
36
|
+
min: 100,
|
|
37
|
+
max: 900,
|
|
38
|
+
def: 400
|
|
39
|
+
}]
|
|
40
|
+
}, h = {
|
|
41
|
+
key: "gullhamrar",
|
|
42
|
+
label: "Gullhamrar",
|
|
43
|
+
family: "TG Gullhamrar",
|
|
44
|
+
url: "/fonts/TG/TGGullhamrarVF.ttf",
|
|
45
|
+
axes: [{
|
|
46
|
+
tag: "wght",
|
|
47
|
+
min: 300,
|
|
48
|
+
max: 900,
|
|
49
|
+
def: 400
|
|
50
|
+
}]
|
|
51
|
+
}, g = [
|
|
52
|
+
p(o, 400),
|
|
53
|
+
p(c, 400),
|
|
54
|
+
m,
|
|
55
|
+
h
|
|
56
|
+
], _ = [
|
|
57
|
+
m,
|
|
58
|
+
g[1],
|
|
59
|
+
h
|
|
60
|
+
], v = g.map((e) => ({
|
|
61
|
+
value: e.key,
|
|
62
|
+
label: e.label
|
|
63
|
+
})), y = {
|
|
64
|
+
wght: "Weight",
|
|
65
|
+
wdth: "Width",
|
|
66
|
+
ital: "Italic",
|
|
67
|
+
slnt: "Slant",
|
|
68
|
+
opsz: "Optical size"
|
|
69
|
+
}, b = (e) => g.find((t) => t.key === e) || g[0];
|
|
70
|
+
function x(e) {
|
|
71
|
+
let t = {};
|
|
72
|
+
for (let n of e.axes) t[n.tag] = n.def;
|
|
73
|
+
return t;
|
|
74
|
+
}
|
|
75
|
+
function S(e) {
|
|
76
|
+
let t = Object.entries(e || {}).map(([e, t]) => `'${e}' ${Math.round(t * 100) / 100}`);
|
|
77
|
+
return t.length ? t.join(", ") : "normal";
|
|
78
|
+
}
|
|
79
|
+
var C = !1;
|
|
80
|
+
async function w() {
|
|
81
|
+
if (!(C || typeof FontFace > "u")) {
|
|
82
|
+
C = !0;
|
|
83
|
+
for (let e of g) e.outline && n(e.key);
|
|
84
|
+
for (let e of g) {
|
|
85
|
+
if (e.outline) continue;
|
|
86
|
+
let t = {}, n = e.axes.find((e) => e.tag === "wght"), r = e.axes.find((e) => e.tag === "wdth");
|
|
87
|
+
n && (t.weight = `${n.min} ${n.max}`), r && (t.stretch = `${r.min}% ${r.max}%`);
|
|
88
|
+
for (let [n, r] of [[e.url, "normal"], ...e.italicUrl ? [[e.italicUrl, "italic"]] : []]) try {
|
|
89
|
+
let i = new FontFace(e.family, `url(${n})`, {
|
|
90
|
+
...t,
|
|
91
|
+
style: r
|
|
92
|
+
});
|
|
93
|
+
document.fonts.add(i), i.load().catch(() => {});
|
|
94
|
+
} catch {}
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
await document.fonts.ready;
|
|
98
|
+
} catch {}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
var T = g.flatMap((e) => e.slnt == null ? e.italicUrl ? [{
|
|
102
|
+
font: e,
|
|
103
|
+
url: e.url,
|
|
104
|
+
style: "normal",
|
|
105
|
+
italic: !1
|
|
106
|
+
}, {
|
|
107
|
+
font: e,
|
|
108
|
+
url: e.italicUrl,
|
|
109
|
+
style: "italic",
|
|
110
|
+
italic: !0
|
|
111
|
+
}] : [{
|
|
112
|
+
font: e,
|
|
113
|
+
url: e.url,
|
|
114
|
+
style: "normal",
|
|
115
|
+
italic: null
|
|
116
|
+
}] : [{
|
|
117
|
+
font: e,
|
|
118
|
+
url: e.url,
|
|
119
|
+
style: `oblique 0deg ${-e.slnt}deg`,
|
|
120
|
+
italic: null
|
|
121
|
+
}]), E = (e) => `${e.url}|${e.style}`, D = /* @__PURE__ */ new Map(), O = null;
|
|
122
|
+
function k() {
|
|
123
|
+
return O || (O = Promise.all(T.map(async (e) => {
|
|
124
|
+
if (!D.has(E(e))) try {
|
|
125
|
+
let t = e.font.axes.find((e) => e.tag === "wght"), n = await l({
|
|
126
|
+
family: e.font.family,
|
|
127
|
+
url: e.url,
|
|
128
|
+
weight: `${t.min} ${t.max}`
|
|
129
|
+
});
|
|
130
|
+
D.set(E(e), n.replace(/}$/, `font-style:${e.style};}`));
|
|
131
|
+
} catch (t) {
|
|
132
|
+
console.warn(`[design-editor] font not embedded, export will fall back for ${e.font.family}:`, t);
|
|
133
|
+
}
|
|
134
|
+
})), O);
|
|
135
|
+
}
|
|
136
|
+
function A(e) {
|
|
137
|
+
let t = /* @__PURE__ */ new Set();
|
|
138
|
+
for (let n of e?.instances ?? []) {
|
|
139
|
+
let e = b(n.font);
|
|
140
|
+
for (let r of T) r.font === e && (r.italic === null || r.italic === !!n.italic) && t.add(E(r));
|
|
141
|
+
}
|
|
142
|
+
return [...t].map((e) => D.get(e)).filter(Boolean).join("\n");
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/editor/compose/inspectors/TreePicker.jsx
|
|
146
|
+
function j(e) {
|
|
147
|
+
return /* @__PURE__ */ d(s, {
|
|
148
|
+
variant: "subtle",
|
|
149
|
+
size: t(),
|
|
150
|
+
className: "w-full",
|
|
151
|
+
...e
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function M({ label: t, options: n, value: a, onChange: o, children: s, inline: c = !0 }) {
|
|
155
|
+
let l = s ?? /* @__PURE__ */ d(j, {
|
|
156
|
+
options: n,
|
|
157
|
+
value: a,
|
|
158
|
+
onChange: o
|
|
159
|
+
});
|
|
160
|
+
return c ? /* @__PURE__ */ d(i, {
|
|
161
|
+
label: t,
|
|
162
|
+
align: "fill",
|
|
163
|
+
labelWidth: e,
|
|
164
|
+
children: l
|
|
165
|
+
}) : /* @__PURE__ */ d(r, {
|
|
166
|
+
label: t,
|
|
167
|
+
children: l
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
function N({ tree: e, presets: t, current: n, onPick: r, inline: i = !0, subLabel: a = (e) => e }) {
|
|
171
|
+
let o = e.find((e) => e.label === n.typeLabel) ?? e.find((e) => e.subs.includes(n.sub)) ?? e[0], s = t.filter((e) => e.sub === n.sub), c = (e) => t.find((t) => t.sub === e);
|
|
172
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
173
|
+
/* @__PURE__ */ d(M, {
|
|
174
|
+
inline: i,
|
|
175
|
+
label: "Type",
|
|
176
|
+
options: e.map((e) => ({
|
|
177
|
+
value: e.label,
|
|
178
|
+
label: e.label
|
|
179
|
+
})),
|
|
180
|
+
value: o.label,
|
|
181
|
+
onChange: (t) => {
|
|
182
|
+
let n = e.find((e) => e.label === t);
|
|
183
|
+
n && r(c(n.subs[0]));
|
|
184
|
+
}
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ d(M, {
|
|
187
|
+
inline: i,
|
|
188
|
+
label: "Category",
|
|
189
|
+
options: o.subs.map((e) => ({
|
|
190
|
+
value: e,
|
|
191
|
+
label: a(e)
|
|
192
|
+
})),
|
|
193
|
+
value: n.sub,
|
|
194
|
+
onChange: (e) => r(c(e))
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ d(M, {
|
|
197
|
+
inline: i,
|
|
198
|
+
label: "Preset",
|
|
199
|
+
options: s.map((e) => ({
|
|
200
|
+
value: e.id,
|
|
201
|
+
label: e.label
|
|
202
|
+
})),
|
|
203
|
+
value: n.id,
|
|
204
|
+
onChange: (e) => r(t.find((t) => t.id === e))
|
|
205
|
+
})
|
|
206
|
+
] });
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
export { v as a, b as c, S as d, k as f, y as i, A as l, M as n, _ as o, N as r, x as s, j as t, w as u };
|