@kolkrabbi/design-editor 0.14.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-D0nV-GvB.js → RuleRow-4eAy_jzf.js} +104 -101
- package/dist/{TreePicker-DlEXH2kw.js → TreePicker-D5XZT0Zi.js} +1 -1
- package/dist/{core-EQZBciYo.js → core-Dr8KZNAY.js} +3395 -5332
- package/dist/core.js +3 -3
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +643 -618
- package/dist/{effects-C0ojfSm8.js → effects-DzHdDgL4.js} +509 -499
- package/dist/effects.js +1 -1
- package/dist/{generators-RjXuwET7.js → generators-DG5yqNy1.js} +487 -866
- package/dist/generators.js +1 -1
- package/dist/{host-BMD1sgpp.js → host-DiI1hniH.js} +4 -4
- package/dist/{motion-ejcDWbeh.js → motion-DtxlM5Bu.js} +619 -718
- package/dist/motion.js +1 -1
- package/dist/{registry-C7rLJN2U.js → registry-CSOtIU7o.js} +35 -35
- package/dist/{EditorIcon-BbFMmc1G.js → rolls-CkmuE-Ya.js} +1826 -1914
- package/dist/{src-BOZt8ciR.js → src-DFtETCsY.js} +1 -1
- package/dist/{useLayerEdit-BElo4uVW.js → useLayerEdit-BDXtPeAP.js} +69 -67
- package/package.json +5 -5
- package/dist/BindDot-xnv1FDLI.js +0 -125
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _, a as
|
|
3
|
-
import { t as
|
|
4
|
-
import { Button as O, Dropdown as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { Fragment as
|
|
1
|
+
import { A as e, It as t, S as n, Zt as r, c as i, ct as a, dt as o, f as s, ft as c, j as l, l as u, lt as d, m as f, t as p, ut as m, y as h } from "./rolls-CkmuE-Ya.js";
|
|
2
|
+
import { _ as g, a as _, d as v, f as y, g as b, h as x, i as S, l as C, m as w, p as ee, r as te, s as ne, u as T, y as E } from "./TreePicker-D5XZT0Zi.js";
|
|
3
|
+
import { t as D } from "./labels-B10g9Um5.js";
|
|
4
|
+
import { Button as O, Dropdown as re, Input as ie, LabeledControl as k, MenuDropdownItem as ae, PopoverPanel as oe, SegmentedToggle as se, Slider as A, Textarea as ce, TimelineDock as le, ToggleCheckbox as ue, Tooltip as j, ViewToggle as de, usePopover as fe } from "@kolkrabbi/kol-component";
|
|
5
|
+
import { Fragment as pe, useEffect as me, useMemo as he, useRef as ge, useState as M } from "react";
|
|
6
|
+
import { Fragment as _e, jsx as N, jsxs as P } from "react/jsx-runtime";
|
|
7
|
+
import { Icon as F } from "@kolkrabbi/kol-icons";
|
|
7
8
|
//#region src/kinetic/paths.js
|
|
8
|
-
var
|
|
9
|
-
function
|
|
9
|
+
var ve = Math.PI * 2, I = (e) => Math.round(e * 100) / 100;
|
|
10
|
+
function ye(e) {
|
|
10
11
|
return e.map((e, t) => `${t === 0 ? "M" : "L"} ${I(e[0])} ${I(e[1])}`).join(" ");
|
|
11
12
|
}
|
|
12
|
-
var
|
|
13
|
+
var be = [
|
|
13
14
|
[.12, .55],
|
|
14
15
|
[.37, .32],
|
|
15
16
|
[.63, .68],
|
|
16
17
|
[.88, .45]
|
|
17
18
|
];
|
|
18
|
-
function
|
|
19
|
+
function xe(e, t, n) {
|
|
19
20
|
let r = e.map(([e, r]) => [e * t, r * n]);
|
|
20
21
|
if (r.length < 2) return `M ${I(t / 2)} ${I(n / 2)} L ${I(t / 2 + 1)} ${I(n / 2)}`;
|
|
21
22
|
let i = `M ${I(r[0][0])} ${I(r[0][1])}`;
|
|
@@ -25,7 +26,7 @@ function ye(e, t, n) {
|
|
|
25
26
|
}
|
|
26
27
|
return i;
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
+
var Se = (e) => e === "array", L = (e) => e === "radial", Ce = (e) => e === "rings", we = {
|
|
29
30
|
amp: .4,
|
|
30
31
|
freq: 2,
|
|
31
32
|
turns: 3,
|
|
@@ -38,8 +39,8 @@ var be = (e) => e === "array", xe = (e) => e === "radial", L = (e) => e === "rin
|
|
|
38
39
|
twist: .5,
|
|
39
40
|
grow: .6
|
|
40
41
|
};
|
|
41
|
-
function
|
|
42
|
-
let i = t / 2, a = n / 2, o = Math.min(t, n) * .12, s = r.amp ??
|
|
42
|
+
function Te(e, t, n, r = {}) {
|
|
43
|
+
let i = t / 2, a = n / 2, o = Math.min(t, n) * .12, s = r.amp ?? we.amp, c = Math.max(1, Math.round(r.freq ?? we.freq)), l = Math.max(1, Math.round(r.turns ?? we.turns)), u = r.radius ?? we.radius;
|
|
43
44
|
switch (e) {
|
|
44
45
|
case "arc": {
|
|
45
46
|
let e = n * .62, r = e - s * n * .7;
|
|
@@ -66,21 +67,21 @@ function Ce(e, t, n, r = {}) {
|
|
|
66
67
|
let e = [];
|
|
67
68
|
for (let r = 0; r <= 120; r++) {
|
|
68
69
|
let i = r / 120;
|
|
69
|
-
e.push([o + i * (t - 2 * o), a + s * n * .32 * Math.sin(i * c *
|
|
70
|
+
e.push([o + i * (t - 2 * o), a + s * n * .32 * Math.sin(i * c * ve)]);
|
|
70
71
|
}
|
|
71
72
|
return {
|
|
72
|
-
d:
|
|
73
|
+
d: ye(e),
|
|
73
74
|
closed: !1
|
|
74
75
|
};
|
|
75
76
|
}
|
|
76
77
|
case "spiral": {
|
|
77
78
|
let e = Math.min(t, n) * .45 * u, r = [];
|
|
78
79
|
for (let t = 0; t <= 420; t++) {
|
|
79
|
-
let n = t / 420, o = n * l *
|
|
80
|
+
let n = t / 420, o = n * l * ve, s = n * e;
|
|
80
81
|
r.push([i + Math.cos(o) * s, a + Math.sin(o) * s]);
|
|
81
82
|
}
|
|
82
83
|
return {
|
|
83
|
-
d:
|
|
84
|
+
d: ye(r),
|
|
84
85
|
closed: !1
|
|
85
86
|
};
|
|
86
87
|
}
|
|
@@ -91,12 +92,12 @@ function Ce(e, t, n, r = {}) {
|
|
|
91
92
|
r.push([o + c * (t - 2 * o), a + (i % 2 == 0 ? -1 : 1) * s * n * .28]);
|
|
92
93
|
}
|
|
93
94
|
return {
|
|
94
|
-
d:
|
|
95
|
+
d: ye(r),
|
|
95
96
|
closed: !1
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
99
|
case "custom": return {
|
|
99
|
-
d:
|
|
100
|
+
d: xe(Array.isArray(r.points) && r.points.length >= 2 ? r.points : be, t, n),
|
|
100
101
|
closed: !1
|
|
101
102
|
};
|
|
102
103
|
default: {
|
|
@@ -110,7 +111,7 @@ function Ce(e, t, n, r = {}) {
|
|
|
110
111
|
}
|
|
111
112
|
//#endregion
|
|
112
113
|
//#region src/kinetic/presets.js
|
|
113
|
-
var
|
|
114
|
+
var Ee = "#0b0d12", De = "#e8e4dc", R = {
|
|
114
115
|
text: "Kinetic",
|
|
115
116
|
font: "gullhamrar",
|
|
116
117
|
fontSize: 120,
|
|
@@ -133,7 +134,7 @@ var we = "#0b0d12", Te = "#e8e4dc", R = {
|
|
|
133
134
|
showPath: !1,
|
|
134
135
|
path: {
|
|
135
136
|
type: "line",
|
|
136
|
-
...
|
|
137
|
+
...we
|
|
137
138
|
},
|
|
138
139
|
motion: {
|
|
139
140
|
mode: "none",
|
|
@@ -161,12 +162,12 @@ var we = "#0b0d12", Te = "#e8e4dc", R = {
|
|
|
161
162
|
}
|
|
162
163
|
}
|
|
163
164
|
};
|
|
164
|
-
function
|
|
165
|
-
let n =
|
|
165
|
+
function Oe(e, t = {}) {
|
|
166
|
+
let n = v(e), r = T(n);
|
|
166
167
|
for (let e of n.axes) t[e.tag] != null && (r[e.tag] = t[e.tag]);
|
|
167
168
|
return r;
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
+
function ke(e = {}, t = 0) {
|
|
170
171
|
let n = {
|
|
171
172
|
id: e.id || `i${t}`,
|
|
172
173
|
...R,
|
|
@@ -194,21 +195,21 @@ function De(e = {}, t = 0) {
|
|
|
194
195
|
vf2: { ...e.morph?.vf2 || {} }
|
|
195
196
|
}
|
|
196
197
|
};
|
|
197
|
-
return n.vf =
|
|
198
|
+
return n.vf = Oe(n.font, e.vf), n;
|
|
198
199
|
}
|
|
199
200
|
var z = (e) => ({
|
|
200
|
-
bg:
|
|
201
|
-
instances: [
|
|
201
|
+
bg: Ee,
|
|
202
|
+
instances: [ke({
|
|
202
203
|
font: "rot",
|
|
203
|
-
fill:
|
|
204
|
+
fill: De,
|
|
204
205
|
...e
|
|
205
206
|
}, 0)]
|
|
206
|
-
}),
|
|
207
|
-
bg:
|
|
208
|
-
instances: e.map((e, t) =>
|
|
209
|
-
}),
|
|
207
|
+
}), Ae = "#16202E", B = (...e) => ({
|
|
208
|
+
bg: Ae,
|
|
209
|
+
instances: e.map((e, t) => ke(e, t))
|
|
210
|
+
}), je = (e, ...t) => ({
|
|
210
211
|
bg: e,
|
|
211
|
-
instances: t.map((e, t) =>
|
|
212
|
+
instances: t.map((e, t) => ke(e, t))
|
|
212
213
|
}), V = [
|
|
213
214
|
{
|
|
214
215
|
id: "sunburst",
|
|
@@ -672,7 +673,7 @@ var z = (e) => ({
|
|
|
672
673
|
id: "baseline-light",
|
|
673
674
|
label: "On paper",
|
|
674
675
|
sub: "Lines",
|
|
675
|
-
comp:
|
|
676
|
+
comp: je("#f4f1ea", {
|
|
676
677
|
text: "Reykjavik",
|
|
677
678
|
font: "malromur",
|
|
678
679
|
fontSize: 130,
|
|
@@ -1010,7 +1011,7 @@ var z = (e) => ({
|
|
|
1010
1011
|
id: "malromur-heavy",
|
|
1011
1012
|
label: "Heavy swing",
|
|
1012
1013
|
sub: "Weight",
|
|
1013
|
-
comp:
|
|
1014
|
+
comp: je("#f4f1ea", {
|
|
1014
1015
|
text: "Malromur",
|
|
1015
1016
|
font: "malromur",
|
|
1016
1017
|
fontSize: 130,
|
|
@@ -1926,7 +1927,7 @@ var z = (e) => ({
|
|
|
1926
1927
|
id: "grid-and-ring",
|
|
1927
1928
|
label: "Grid + ring",
|
|
1928
1929
|
sub: "Composite",
|
|
1929
|
-
comp:
|
|
1930
|
+
comp: je("#0a0b14", {
|
|
1930
1931
|
id: "a",
|
|
1931
1932
|
text: "echo",
|
|
1932
1933
|
font: "rot",
|
|
@@ -1961,24 +1962,24 @@ var z = (e) => ({
|
|
|
1961
1962
|
}
|
|
1962
1963
|
})
|
|
1963
1964
|
}
|
|
1964
|
-
],
|
|
1965
|
+
], Me = (e) => V.find((t) => t.id === e) || V[0], Ne = [
|
|
1965
1966
|
"Radial",
|
|
1966
1967
|
"Rings",
|
|
1967
1968
|
"Path"
|
|
1968
|
-
],
|
|
1969
|
+
], Pe = [{
|
|
1969
1970
|
label: "Type",
|
|
1970
|
-
subs:
|
|
1971
|
+
subs: Ne
|
|
1971
1972
|
}, {
|
|
1972
1973
|
label: "Kinetic",
|
|
1973
|
-
subs: [...new Set(V.map((e) => e.sub))].filter((e) => !
|
|
1974
|
-
}],
|
|
1974
|
+
subs: [...new Set(V.map((e) => e.sub))].filter((e) => !Ne.includes(e))
|
|
1975
|
+
}], Fe = (e) => structuredClone(e.comp), H = {
|
|
1975
1976
|
dLen: 0,
|
|
1976
1977
|
dNormal: 0,
|
|
1977
1978
|
scale: 1,
|
|
1978
1979
|
dRot: 0,
|
|
1979
1980
|
opacity: 1,
|
|
1980
1981
|
vf: null
|
|
1981
|
-
},
|
|
1982
|
+
}, Ie = {
|
|
1982
1983
|
none: () => H,
|
|
1983
1984
|
march: (e) => ({
|
|
1984
1985
|
...H,
|
|
@@ -1989,79 +1990,79 @@ var z = (e) => ({
|
|
|
1989
1990
|
dLen: e.u * e.pathLen * Math.max(1, Math.round(e.m.cycles || 1))
|
|
1990
1991
|
}),
|
|
1991
1992
|
vfwave: (e) => {
|
|
1992
|
-
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u *
|
|
1993
|
+
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * b * t - e.i * (e.m.phase ?? .5));
|
|
1993
1994
|
return {
|
|
1994
1995
|
...H,
|
|
1995
|
-
vf: { [e.axisTag]:
|
|
1996
|
+
vf: { [e.axisTag]: E(e.axisMin, e.axisMax, n) }
|
|
1996
1997
|
};
|
|
1997
1998
|
},
|
|
1998
1999
|
glyphwave: (e) => {
|
|
1999
|
-
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u *
|
|
2000
|
+
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = Math.sin(e.u * b * t - e.i * (e.m.phase ?? .5));
|
|
2000
2001
|
return {
|
|
2001
2002
|
...H,
|
|
2002
2003
|
dNormal: (e.m.amp ?? .3) * e.sizePx * n
|
|
2003
2004
|
};
|
|
2004
2005
|
},
|
|
2005
2006
|
cascade: (e) => {
|
|
2006
|
-
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u *
|
|
2007
|
+
let t = Math.max(1, Math.round(e.m.cycles || 1)), n = .5 + .5 * Math.sin(e.u * b * t - e.i * (e.m.phase ?? .6));
|
|
2007
2008
|
return {
|
|
2008
2009
|
...H,
|
|
2009
|
-
scale:
|
|
2010
|
-
opacity:
|
|
2010
|
+
scale: E(.25, 1, n),
|
|
2011
|
+
opacity: E(.15, 1, n)
|
|
2011
2012
|
};
|
|
2012
2013
|
},
|
|
2013
2014
|
sweep: (e) => {
|
|
2014
|
-
let t =
|
|
2015
|
+
let t = Be(e);
|
|
2015
2016
|
return {
|
|
2016
2017
|
...H,
|
|
2017
|
-
scale:
|
|
2018
|
-
opacity:
|
|
2018
|
+
scale: E(.25, 1, t),
|
|
2019
|
+
opacity: E(.12, 1, t)
|
|
2019
2020
|
};
|
|
2020
2021
|
},
|
|
2021
2022
|
sweepWeight: (e) => {
|
|
2022
|
-
let t =
|
|
2023
|
+
let t = Be(e);
|
|
2023
2024
|
return {
|
|
2024
2025
|
...H,
|
|
2025
|
-
vf: { [e.axisTag]:
|
|
2026
|
+
vf: { [e.axisTag]: E(e.axisMin, e.axisMax, t) }
|
|
2026
2027
|
};
|
|
2027
2028
|
},
|
|
2028
2029
|
sweepShift: (e) => {
|
|
2029
|
-
let t =
|
|
2030
|
+
let t = Be(e);
|
|
2030
2031
|
return {
|
|
2031
2032
|
...H,
|
|
2032
2033
|
dNormal: t * .6 * e.sizePx
|
|
2033
2034
|
};
|
|
2034
2035
|
}
|
|
2035
|
-
},
|
|
2036
|
-
function
|
|
2036
|
+
}, Le = (e) => e - Math.floor(e);
|
|
2037
|
+
function Re(e, t) {
|
|
2037
2038
|
if (t <= 0) return 0;
|
|
2038
2039
|
let n = Math.min(1, e / t);
|
|
2039
2040
|
return 1 - n * n * (3 - 2 * n);
|
|
2040
2041
|
}
|
|
2041
|
-
function
|
|
2042
|
-
let o =
|
|
2043
|
-
let t = Math.abs(
|
|
2044
|
-
return
|
|
2042
|
+
function ze(e, t, n, r, i, a) {
|
|
2043
|
+
let o = Le(r * i), s = Math.max(.02, a * .5), c = (e) => {
|
|
2044
|
+
let t = Math.abs(Le(e) - o);
|
|
2045
|
+
return Re(Math.min(t, 1 - t), s);
|
|
2045
2046
|
};
|
|
2046
2047
|
switch (e) {
|
|
2047
2048
|
case "y": return c(n);
|
|
2048
2049
|
case "diagonal": return c(.5 + (t - .5) * .7071 + (n - .5) * .7071);
|
|
2049
2050
|
case "radial": return c(Math.hypot(t - .5, n - .5) / .7071);
|
|
2050
|
-
case "angular": return c(Math.atan2(n - .5, t - .5) /
|
|
2051
|
+
case "angular": return c(Math.atan2(n - .5, t - .5) / b + .5);
|
|
2051
2052
|
case "wave": {
|
|
2052
2053
|
let e = Math.max(1, Math.round(1 + (1 - a) * 6));
|
|
2053
|
-
return .5 + .5 * Math.sin((t * e - r * i) *
|
|
2054
|
+
return .5 + .5 * Math.sin((t * e - r * i) * b);
|
|
2054
2055
|
}
|
|
2055
2056
|
default: return c(t);
|
|
2056
2057
|
}
|
|
2057
2058
|
}
|
|
2058
|
-
var
|
|
2059
|
-
function
|
|
2060
|
-
return (
|
|
2059
|
+
var Be = (e) => ze(e.m.field || "x", e.nx ?? .5, e.ny ?? .5, e.u, Math.max(1, Math.round(e.m.cycles || 1)), e.m.amp ?? .35);
|
|
2060
|
+
function Ve(e, t) {
|
|
2061
|
+
return (Ie[e] || Ie.none)(t);
|
|
2061
2062
|
}
|
|
2062
2063
|
//#endregion
|
|
2063
2064
|
//#region src/kinetic/features.js
|
|
2064
|
-
var
|
|
2065
|
+
var He = [
|
|
2065
2066
|
{
|
|
2066
2067
|
tag: "liga",
|
|
2067
2068
|
label: "Ligatures"
|
|
@@ -2103,7 +2104,7 @@ var Be = [
|
|
|
2103
2104
|
label: "Stylistic set 2"
|
|
2104
2105
|
}
|
|
2105
2106
|
];
|
|
2106
|
-
function
|
|
2107
|
+
function Ue(e) {
|
|
2107
2108
|
if (!e) return "normal";
|
|
2108
2109
|
let t = [];
|
|
2109
2110
|
for (let [n, r] of Object.entries(e)) t.push(`"${n}" ${+!!r}`);
|
|
@@ -2111,11 +2112,11 @@ function Ve(e) {
|
|
|
2111
2112
|
}
|
|
2112
2113
|
//#endregion
|
|
2113
2114
|
//#region src/kinetic/KineticType.js
|
|
2114
|
-
var
|
|
2115
|
-
function
|
|
2115
|
+
var We = "http://www.w3.org/2000/svg", U = (e) => e - Math.floor(e), W = (e) => document.createElementNS(We, e);
|
|
2116
|
+
function Ge(e, t) {
|
|
2116
2117
|
return !e || !t || t === "none" ? e || "" : t === "upper" ? e.toUpperCase() : t === "lower" ? e.toLowerCase() : t === "title" ? e.replace(/\b\w/g, (e) => e.toUpperCase()) : e;
|
|
2117
2118
|
}
|
|
2118
|
-
function
|
|
2119
|
+
function Ke(e) {
|
|
2119
2120
|
if (!e) return {
|
|
2120
2121
|
bg: "#16202E",
|
|
2121
2122
|
instances: []
|
|
@@ -2130,11 +2131,11 @@ function We(e) {
|
|
|
2130
2131
|
}]
|
|
2131
2132
|
};
|
|
2132
2133
|
}
|
|
2133
|
-
var
|
|
2134
|
+
var qe = class {
|
|
2134
2135
|
constructor(e) {
|
|
2135
|
-
this.host = e, this.params =
|
|
2136
|
+
this.host = e, this.params = Ke(null), this.w = 0, this.h = 0, this._rt = /* @__PURE__ */ new Map(), this._instSig = "", this._needsRemeasure = !1;
|
|
2136
2137
|
let t = W("svg");
|
|
2137
|
-
t.setAttribute("xmlns",
|
|
2138
|
+
t.setAttribute("xmlns", We), t.style.display = "block", t.style.maxWidth = "100%", t.style.maxHeight = "100%", t.style.pointerEvents = "none", t.style.overflow = "hidden", this._clipApplied = !0, this.bg = W("rect"), this.layer = W("g"), this.measEl = W("text"), this.measEl.setAttribute("x", "0"), this.measEl.setAttribute("y", "0"), this.measEl.style.visibility = "hidden", t.append(this.bg, this.layer, this.measEl), e.appendChild(t), this.svg = t, e.__kolKineticEngine = this, typeof document < "u" && document.fonts && document.fonts.ready.then(() => {
|
|
2138
2139
|
this._needsRemeasure = !0;
|
|
2139
2140
|
}).catch(() => {});
|
|
2140
2141
|
}
|
|
@@ -2143,10 +2144,10 @@ var Ge = class {
|
|
|
2143
2144
|
for (let e of this._rt.values()) e.cache = null;
|
|
2144
2145
|
}
|
|
2145
2146
|
setComposition(e) {
|
|
2146
|
-
this.params =
|
|
2147
|
+
this.params = Ke(e);
|
|
2147
2148
|
}
|
|
2148
2149
|
renderAt(e) {
|
|
2149
|
-
!this.w || !this.h || this._render(
|
|
2150
|
+
!this.w || !this.h || this._render(g(e));
|
|
2150
2151
|
}
|
|
2151
2152
|
getInstanceRect(e) {
|
|
2152
2153
|
let t = this._rt.get(e);
|
|
@@ -2227,7 +2228,7 @@ var Ge = class {
|
|
|
2227
2228
|
}
|
|
2228
2229
|
}
|
|
2229
2230
|
_measure(e, t, n, r) {
|
|
2230
|
-
let i = t.letterSpacing || 0, a =
|
|
2231
|
+
let i = t.letterSpacing || 0, a = Ue(t.opentype), o = `${r}|${n.family}|${t.fontSize}|${i}|${w(t.vf)}|${a}`;
|
|
2231
2232
|
if (e.cache && e.cache.key === o) return e.cache;
|
|
2232
2233
|
let s = this.measEl;
|
|
2233
2234
|
s.style.fontFamily = `'${n.family}'`, s.style.fontSize = `${t.fontSize}px`, s.style.letterSpacing = `${i}px`, s.style.fontVariationSettings = w(t.vf), s.style.fontFeatureSettings = a, s.textContent = r;
|
|
@@ -2248,43 +2249,43 @@ var Ge = class {
|
|
|
2248
2249
|
}, e.cache;
|
|
2249
2250
|
}
|
|
2250
2251
|
_renderInstance(e, t, n) {
|
|
2251
|
-
let r =
|
|
2252
|
-
if (t.group.setAttribute("transform", `translate(${d.toFixed(2)} ${f.toFixed(2)})`), e.morph?.on && !
|
|
2253
|
-
let n = r.url,
|
|
2252
|
+
let r = v(e.font), i = e.phase ? U(n + e.phase) : n, a = Ge(e.text || "", e.case), s = Math.max(1, Math.round(e.multiply || 1)), l = s > 1 && a ? Array(s).fill(a).join(" ") : a, u = e.path?.type || "line", d = (e.offset?.x || 0) * this.w, f = (e.offset?.y || 0) * this.h;
|
|
2253
|
+
if (t.group.setAttribute("transform", `translate(${d.toFixed(2)} ${f.toFixed(2)})`), e.morph?.on && !L(u) && !Ce(u)) {
|
|
2254
|
+
let n = r.url, a = e.morph.face2 ? v(e.morph.face2) : null, s = a ? a.url : n, d = c(n), f = c(s);
|
|
2254
2255
|
if (d && f) {
|
|
2255
2256
|
this._setKind(t, "morph"), this._renderMorph(e, t, i, d, f, r, l, u);
|
|
2256
2257
|
return;
|
|
2257
2258
|
}
|
|
2258
|
-
d ||
|
|
2259
|
+
d || o(n).catch(() => {}), !f && s !== n && o(s).catch(() => {});
|
|
2259
2260
|
}
|
|
2260
|
-
if (this._setKind(t, "text"),
|
|
2261
|
+
if (this._setKind(t, "text"), Se(u)) {
|
|
2261
2262
|
t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
|
|
2262
2263
|
let n = Math.max(1, Math.round(e.path?.rows ?? 2)), a = Math.max(1, Math.round(e.path?.cols ?? 3));
|
|
2263
2264
|
if (this._ensureGlyphs(t, l, r, n * a), !l.length) return;
|
|
2264
2265
|
this._measure(t, e, r, l), this._placeArray(e, t, r, i, t.glyphEls, n, a);
|
|
2265
2266
|
return;
|
|
2266
2267
|
}
|
|
2267
|
-
if (
|
|
2268
|
+
if (L(u) || Ce(u)) {
|
|
2268
2269
|
t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
|
|
2269
2270
|
let n = Math.max(1, Math.round(e.path?.count ?? 12));
|
|
2270
2271
|
if (this._ensureGlyphs(t, l, r, n), !l.length) return;
|
|
2271
|
-
this._measure(t, e, r, l),
|
|
2272
|
+
this._measure(t, e, r, l), L(u) ? this._placeRadial(e, t, r, i, t.glyphEls, n) : this._placeRings(e, t, r, i, t.glyphEls, n);
|
|
2272
2273
|
return;
|
|
2273
2274
|
}
|
|
2274
|
-
let p =
|
|
2275
|
+
let p = Te(u, this.w, this.h, e.path || {});
|
|
2275
2276
|
t.closed = p.closed, t.pathEl.setAttribute("d", p.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._ensureGlyphs(t, l, r, 1), l.length && (this._measure(t, e, r, l), this._placeOnPath(e, t, r, i, t.glyphEls));
|
|
2276
2277
|
}
|
|
2277
2278
|
_styleGlyph(e, t, n, r) {
|
|
2278
2279
|
e.style.fontFamily = `'${n.family}'`, e.style.fontSize = `${t.fontSize}px`, e.style.fontStyle = t.italic ? "italic" : "normal", e.style.fontVariationSettings = w(r.vf ? {
|
|
2279
2280
|
...t.vf,
|
|
2280
2281
|
...r.vf
|
|
2281
|
-
} : t.vf), e.style.fontFeatureSettings =
|
|
2282
|
+
} : t.vf), e.style.fontFeatureSettings = Ue(t.opentype), e.setAttribute("fill", t.fill || "#e8e4dc"), e.setAttribute("opacity", r.opacity);
|
|
2282
2283
|
}
|
|
2283
2284
|
_anim(e, t, n) {
|
|
2284
2285
|
let r = e.motions && e.motions.length ? [e.motion, ...e.motions] : [e.motion], i = 0, a = 0, o = 0, s = 1, c = 1, l = null;
|
|
2285
2286
|
for (let e of r) {
|
|
2286
2287
|
if (!e || (e.mode || "none") === "none") continue;
|
|
2287
|
-
let r = n.axes.find((t) => t.tag === (e.axis || n.axes[0] && n.axes[0].tag)), u =
|
|
2288
|
+
let r = n.axes.find((t) => t.tag === (e.axis || n.axes[0] && n.axes[0].tag)), u = Ve(e.mode, {
|
|
2288
2289
|
...t,
|
|
2289
2290
|
m: e,
|
|
2290
2291
|
axisTag: r ? r.tag : "wght",
|
|
@@ -2321,8 +2322,8 @@ var Ge = class {
|
|
|
2321
2322
|
};
|
|
2322
2323
|
}
|
|
2323
2324
|
return t.pathEl.getPointAtLength(m(e));
|
|
2324
|
-
},
|
|
2325
|
-
for (let t = 0; t <
|
|
2325
|
+
}, _ = Math.min(i.length, s.length), v = g(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (s.length + 2) / y;
|
|
2326
|
+
for (let t = 0; t < _; t++) {
|
|
2326
2327
|
let a = u + s[t], c = h(a), l = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
|
|
2327
2328
|
i: t,
|
|
2328
2329
|
n: s.length,
|
|
@@ -2340,7 +2341,7 @@ var Ge = class {
|
|
|
2340
2341
|
if (!s) return;
|
|
2341
2342
|
let { centers: c, total: l } = s, u = c.length;
|
|
2342
2343
|
if (!u) return;
|
|
2343
|
-
let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m =
|
|
2344
|
+
let d = Math.min(this.w, this.h) * .08, f = (this.w - 2 * d) / o, p = (this.h - 2 * d) / a, m = g(e.stagger || 0), h = a * o;
|
|
2344
2345
|
for (let t = 0; t < h; t++) {
|
|
2345
2346
|
let a = Math.floor(t / o), s = d + t % o * f + f / 2, g = d + a * p + p / 2, _ = s - l / 2, v = m ? U(r + m * t / h) : r;
|
|
2346
2347
|
for (let r = 0; r < u; r++) {
|
|
@@ -2364,13 +2365,13 @@ var Ge = class {
|
|
|
2364
2365
|
if (!o) return;
|
|
2365
2366
|
let { centers: s } = o, c = s.length;
|
|
2366
2367
|
if (!c) return;
|
|
2367
|
-
let l = this.w / 2, u = this.h / 2, d = Math.min(this.w, this.h) * .5, f = d * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), p = Math.round(e.path?.spin ?? 1), m =
|
|
2368
|
+
let l = this.w / 2, u = this.h / 2, d = Math.min(this.w, this.h) * .5, f = d * Math.max(0, Math.min(.95, e.path?.inner ?? .12)), p = Math.round(e.path?.spin ?? 1), m = g(e.stagger || 0);
|
|
2368
2369
|
for (let t = 0; t < a; t++) {
|
|
2369
|
-
let o = a > 1 ? t / (a - 1) : 0, h = p + (m ? Math.round(m * 2 * o) : 0), g = t / a *
|
|
2370
|
+
let o = a > 1 ? t / (a - 1) : 0, h = p + (m ? Math.round(m * 2 * o) : 0), g = t / a * b + r * b * h, _ = m ? U(r + m * t / a) : r, v = Math.cos(g), y = Math.sin(g), x = g * 180 / Math.PI;
|
|
2370
2371
|
for (let r = 0; r < c; r++) {
|
|
2371
2372
|
let o = t * c + r, p = i[o];
|
|
2372
2373
|
if (!p) continue;
|
|
2373
|
-
let m = f + s[r], h = l + v * m, g = u + y * m,
|
|
2374
|
+
let m = f + s[r], h = l + v * m, g = u + y * m, b = this._anim(e, {
|
|
2374
2375
|
i: o,
|
|
2375
2376
|
n: a * c,
|
|
2376
2377
|
u: _,
|
|
@@ -2378,8 +2379,8 @@ var Ge = class {
|
|
|
2378
2379
|
pathLen: d,
|
|
2379
2380
|
nx: this.w ? h / this.w : .5,
|
|
2380
2381
|
ny: this.h ? g / this.h : .5
|
|
2381
|
-
}, n), S = m +
|
|
2382
|
-
p.setAttribute("transform", `translate(${
|
|
2382
|
+
}, n), S = m + b.dLen, C = l + v * S, w = u + y * S;
|
|
2383
|
+
p.setAttribute("transform", `translate(${C.toFixed(2)} ${w.toFixed(2)}) rotate(${(x + b.dRot).toFixed(2)}) translate(0 ${(-b.dNormal).toFixed(2)}) scale(${b.scale.toFixed(3)})`), this._styleGlyph(p, e, n, b);
|
|
2383
2384
|
}
|
|
2384
2385
|
}
|
|
2385
2386
|
}
|
|
@@ -2388,22 +2389,22 @@ var Ge = class {
|
|
|
2388
2389
|
if (!o) return;
|
|
2389
2390
|
let { centers: s, total: c } = o, l = s.length;
|
|
2390
2391
|
if (!l) return;
|
|
2391
|
-
let u = this.w / 2, d = this.h / 2, f = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), p = f * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), m = Math.round(e.path?.spin ?? 1), h = e.path?.twist ?? .5,
|
|
2392
|
+
let u = this.w / 2, d = this.h / 2, f = Math.min(this.w, this.h) * .5 * Math.max(.1, Math.min(1, e.path?.radius ?? .92)), p = f * Math.max(.02, Math.min(.95, e.path?.inner ?? .14)), m = Math.round(e.path?.spin ?? 1), h = e.path?.twist ?? .5, _ = e.path?.grow ?? .6, v = g(e.stagger || 0);
|
|
2392
2393
|
for (let t = 0; t < a; t++) {
|
|
2393
|
-
let o = a > 1 ? t / (a - 1) : 0,
|
|
2394
|
+
let o = a > 1 ? t / (a - 1) : 0, g = Math.max(1, p + o * (f - p)), y = m + (v ? Math.round(v * 2 * o) : 0), x = r * b * y + o * h * b, S = v ? U(r + v * t / a) : r, C = 1 + _ * o;
|
|
2394
2395
|
for (let r = 0; r < l; r++) {
|
|
2395
2396
|
let o = t * l + r, f = i[o];
|
|
2396
2397
|
if (!f) continue;
|
|
2397
|
-
let p =
|
|
2398
|
+
let p = x + (s[r] - c / 2) / g, m = u + Math.cos(p) * g, h = d + Math.sin(p) * g, _ = this._anim(e, {
|
|
2398
2399
|
i: o,
|
|
2399
2400
|
n: a * l,
|
|
2400
2401
|
u: S,
|
|
2401
2402
|
sizePx: e.fontSize,
|
|
2402
|
-
pathLen:
|
|
2403
|
+
pathLen: b * g,
|
|
2403
2404
|
nx: this.w ? m / this.w : .5,
|
|
2404
2405
|
ny: this.h ? h / this.h : .5
|
|
2405
|
-
}, n), v = p +
|
|
2406
|
-
f.setAttribute("transform", `translate(${
|
|
2406
|
+
}, n), v = p + _.dLen / g, y = g - _.dNormal, w = u + Math.cos(v) * y, ee = d + Math.sin(v) * y, te = v * 180 / Math.PI + 90 + _.dRot;
|
|
2407
|
+
f.setAttribute("transform", `translate(${w.toFixed(2)} ${ee.toFixed(2)}) rotate(${te.toFixed(2)}) scale(${(_.scale * C).toFixed(3)})`), this._styleGlyph(f, e, n, _);
|
|
2407
2408
|
}
|
|
2408
2409
|
}
|
|
2409
2410
|
}
|
|
@@ -2411,11 +2412,11 @@ var Ge = class {
|
|
|
2411
2412
|
e.kind !== t && (e.kind = t, e.glyphG.textContent = "", e.glyphEls = [], e.morphEls = [], e.glyphKey = "", e.morphKey = "", e.morphPoolKey = "", e.cache = null);
|
|
2412
2413
|
}
|
|
2413
2414
|
_renderMorph(e, t, n, r, i, a, o, s) {
|
|
2414
|
-
let c = e.fontSize, l = a.axes || [],
|
|
2415
|
-
for (let t of l)
|
|
2416
|
-
let
|
|
2417
|
-
if (!
|
|
2418
|
-
let
|
|
2415
|
+
let c = e.fontSize, l = a.axes || [], u = {};
|
|
2416
|
+
for (let t of l) u[t.tag] = e.vf?.[t.tag] ?? t.def;
|
|
2417
|
+
let d = !!e.morph.face2, f = {};
|
|
2418
|
+
if (!d) for (let t of l) f[t.tag] = e.morph.vf2?.[t.tag] ?? t.max;
|
|
2419
|
+
let p = c * .12 + (e.letterSpacing || 0), h = e.morph.mode || "morph", g = e.morph.blend ?? .5, _ = e.morph.curve || "flat", v = e.morph.cp1 || {
|
|
2419
2420
|
x: .33,
|
|
2420
2421
|
y: .33
|
|
2421
2422
|
}, y = e.morph.cp2 || {
|
|
@@ -2426,8 +2427,8 @@ var Ge = class {
|
|
|
2426
2427
|
e.font,
|
|
2427
2428
|
e.morph.face2 || "",
|
|
2428
2429
|
c,
|
|
2429
|
-
|
|
2430
|
-
|
|
2430
|
+
u,
|
|
2431
|
+
f,
|
|
2431
2432
|
h,
|
|
2432
2433
|
g,
|
|
2433
2434
|
_,
|
|
@@ -2438,33 +2439,33 @@ var Ge = class {
|
|
|
2438
2439
|
]), S = x !== t.morphKey;
|
|
2439
2440
|
if (S) {
|
|
2440
2441
|
t.morphKey = x;
|
|
2441
|
-
let e =
|
|
2442
|
+
let e = m(r, i, o, c, {
|
|
2442
2443
|
mode: h,
|
|
2443
2444
|
blend: g,
|
|
2444
2445
|
curve: _,
|
|
2445
2446
|
cp1: v,
|
|
2446
2447
|
cp2: y,
|
|
2447
|
-
coordsA:
|
|
2448
|
-
coordsB:
|
|
2448
|
+
coordsA: u,
|
|
2449
|
+
coordsB: f,
|
|
2449
2450
|
axes: l,
|
|
2450
|
-
gap:
|
|
2451
|
+
gap: p
|
|
2451
2452
|
});
|
|
2452
2453
|
t.morphData = e;
|
|
2453
2454
|
let n = [], a = 0;
|
|
2454
2455
|
for (let t of e.glyphs) n.push(a + t.advance / 2), a += t.advance;
|
|
2455
2456
|
t.morphCenters = n, t.morphTotal = e.totalAdvance;
|
|
2456
2457
|
}
|
|
2457
|
-
let
|
|
2458
|
-
if (!o.length || !
|
|
2458
|
+
let C = t.morphData?.glyphs.length || 0;
|
|
2459
|
+
if (!o.length || !C) {
|
|
2459
2460
|
t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0;
|
|
2460
2461
|
return;
|
|
2461
2462
|
}
|
|
2462
|
-
let
|
|
2463
|
-
if ((S || T) && this._refreshMorphPaths(t, ne, h, b),
|
|
2464
|
-
t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0, this._placeMorphArray(e, t, a, n,
|
|
2463
|
+
let w = Se(s), ee = w ? Math.max(1, Math.round(e.path?.rows ?? 2)) : 1, te = w ? Math.max(1, Math.round(e.path?.cols ?? 3)) : 1, ne = w ? ee * te : 1, T = this._ensureMorphPool(t, C, ne, h);
|
|
2464
|
+
if ((S || T) && this._refreshMorphPaths(t, ne, h, b), w) {
|
|
2465
|
+
t.pathEl.setAttribute("d", ""), t.pathEl.style.opacity = 0, this._placeMorphArray(e, t, a, n, ee, te);
|
|
2465
2466
|
return;
|
|
2466
2467
|
}
|
|
2467
|
-
let E =
|
|
2468
|
+
let E = Te(s, this.w, this.h, e.path || {});
|
|
2468
2469
|
t.closed = E.closed, t.pathEl.setAttribute("d", E.d), t.pathEl.setAttribute("stroke", e.showPath ? e.fill || "#888" : "none"), t.pathEl.setAttribute("stroke-width", +!!e.showPath), t.pathEl.style.opacity = e.showPath ? .25 : 0, this._placeMorphOnPath(e, t, a, n);
|
|
2469
2470
|
}
|
|
2470
2471
|
_ensureMorphPool(e, t, n, r) {
|
|
@@ -2509,8 +2510,8 @@ var Ge = class {
|
|
|
2509
2510
|
};
|
|
2510
2511
|
}
|
|
2511
2512
|
return t.pathEl.getPointAtLength(p(e));
|
|
2512
|
-
}, h = e.italic ? " skewX(-12)" : "",
|
|
2513
|
-
for (let t = 0; t <
|
|
2513
|
+
}, h = e.italic ? " skewX(-12)" : "", _ = Math.min(i.length, a.length), v = g(e.stagger || 0), y = Math.max(1, Math.round(e.multiply || 1)), b = (a.length + 2) / y;
|
|
2514
|
+
for (let t = 0; t < _; t++) {
|
|
2514
2515
|
let o = l + a[t], c = m(o), d = v && y > 1 ? U(r + v * Math.floor(t / b) / y) : r, f = this._anim(e, {
|
|
2515
2516
|
i: t,
|
|
2516
2517
|
n: a.length,
|
|
@@ -2528,7 +2529,7 @@ var Ge = class {
|
|
|
2528
2529
|
if (!s || !o) return;
|
|
2529
2530
|
let l = s.length;
|
|
2530
2531
|
if (!l) return;
|
|
2531
|
-
let u = Math.min(this.w, this.h) * .08, d = (this.w - 2 * u) / a, f = (this.h - 2 * u) / i, p = e.italic ? " skewX(-12)" : "", m =
|
|
2532
|
+
let u = Math.min(this.w, this.h) * .08, d = (this.w - 2 * u) / a, f = (this.h - 2 * u) / i, p = e.italic ? " skewX(-12)" : "", m = g(e.stagger || 0), h = i * a;
|
|
2532
2533
|
for (let t = 0; t < h; t++) {
|
|
2533
2534
|
let i = Math.floor(t / a), g = u + t % a * d + d / 2, _ = u + i * f + f / 2, v = g - c / 2, y = m ? U(r + m * t / h) : r;
|
|
2534
2535
|
for (let r = 0; r < l; r++) {
|
|
@@ -2553,7 +2554,7 @@ var Ge = class {
|
|
|
2553
2554
|
...e,
|
|
2554
2555
|
...t
|
|
2555
2556
|
} : e)
|
|
2556
|
-
}),
|
|
2557
|
+
}), Je = (e, t) => ({
|
|
2557
2558
|
...e,
|
|
2558
2559
|
instances: (e.instances ?? []).map((e, n, r) => ({
|
|
2559
2560
|
...e,
|
|
@@ -2565,11 +2566,11 @@ var Ge = class {
|
|
|
2565
2566
|
} }, n), J = (e, t, n = 0) => K(e, { motion: {
|
|
2566
2567
|
...G(e, n)?.motion ?? {},
|
|
2567
2568
|
...t
|
|
2568
|
-
} }, n), Y = (e, t = 0) => G(e, t)?.path?.type ?? "line",
|
|
2569
|
+
} }, n), Y = (e, t = 0) => G(e, t)?.path?.type ?? "line", Ye = (e, t = 0) => G(e, t)?.motion?.mode ?? "none", Xe = (e, t = 0) => ![
|
|
2569
2570
|
"radial",
|
|
2570
2571
|
"rings",
|
|
2571
2572
|
"array"
|
|
2572
|
-
].includes(Y(e, t)),
|
|
2573
|
+
].includes(Y(e, t)), Ze = [
|
|
2573
2574
|
{
|
|
2574
2575
|
value: "line",
|
|
2575
2576
|
label: "Line"
|
|
@@ -2614,24 +2615,24 @@ var Ge = class {
|
|
|
2614
2615
|
value: "rings",
|
|
2615
2616
|
label: "Rings"
|
|
2616
2617
|
}
|
|
2617
|
-
],
|
|
2618
|
+
], X = (e, t = 0) => G(e, t)?.morph ?? {}, Z = (e, t, n = 0) => K(e, { morph: {
|
|
2618
2619
|
...G(e, n)?.morph ?? {},
|
|
2619
2620
|
...t
|
|
2620
|
-
} }, n),
|
|
2621
|
-
...
|
|
2621
|
+
} }, n), Qe = (e, t, n, r = 0) => Z(e, { vf2: {
|
|
2622
|
+
...X(e, r).vf2 ?? {},
|
|
2622
2623
|
[t]: n
|
|
2623
|
-
} }, r),
|
|
2624
|
+
} }, r), $e = (e, t = 0) => !["radial", "rings"].includes(Y(e, t)), Q = (e, t = 0) => $e(e, t) && !!X(e, t).on, et = (e, t = 0) => X(e, t).mode ?? "morph", tt = (e, t = 0) => Q(e, t) && ["morph", "fade"].includes(et(e, t)), $ = (e, t, n = 0) => v(G(e, n)?.font).axes.find((e) => e.tag === t), nt = (e, t, n, r = 0) => {
|
|
2624
2625
|
let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
|
|
2625
|
-
return
|
|
2626
|
-
},
|
|
2626
|
+
return Qe(e, t, Math.round(a), r);
|
|
2627
|
+
}, rt = (e, t, n, r = 0) => {
|
|
2627
2628
|
let i = $(e, t, r), a = i ? Math.min(i.max, Math.max(i.min, n)) : n;
|
|
2628
2629
|
return K(e, { vf: {
|
|
2629
2630
|
...G(e, r)?.vf ?? {},
|
|
2630
2631
|
[t]: Math.round(a)
|
|
2631
2632
|
} }, r);
|
|
2632
|
-
},
|
|
2633
|
+
}, it = (e) => ({
|
|
2633
2634
|
key: `vf${e[0].toUpperCase()}${e.slice(1)}`,
|
|
2634
|
-
label:
|
|
2635
|
+
label: ne[e] || e,
|
|
2635
2636
|
tab: "style",
|
|
2636
2637
|
section: "Axes",
|
|
2637
2638
|
type: "range",
|
|
@@ -2640,8 +2641,8 @@ var Ge = class {
|
|
|
2640
2641
|
max: (t, n = 0) => $(t, e, n)?.max ?? 1e3,
|
|
2641
2642
|
when: (t, n = 0) => !!$(t, e, n),
|
|
2642
2643
|
get: (t, n = 0) => G(t, n)?.vf?.[e] ?? $(t, e, n)?.def ?? 0,
|
|
2643
|
-
set: (t, n, r = 0) =>
|
|
2644
|
-
}),
|
|
2644
|
+
set: (t, n, r = 0) => rt(t, e, n, r)
|
|
2645
|
+
}), at = (e, t = 0) => Q(e, t) && et(e, t) === "morph" && (X(e, t).curve ?? "flat") === "custom", ot = (e, t) => ({
|
|
2645
2646
|
key: `morphC${e}${t}`,
|
|
2646
2647
|
label: `P${e} ${t.toUpperCase()}`,
|
|
2647
2648
|
tab: "style",
|
|
@@ -2651,16 +2652,16 @@ var Ge = class {
|
|
|
2651
2652
|
max: 1,
|
|
2652
2653
|
step: .01,
|
|
2653
2654
|
noRandom: !0,
|
|
2654
|
-
when:
|
|
2655
|
-
get: (n, r = 0) =>
|
|
2656
|
-
set: (n, r, i = 0) =>
|
|
2657
|
-
...
|
|
2655
|
+
when: at,
|
|
2656
|
+
get: (n, r = 0) => X(n, r)[`cp${e}`]?.[t] ?? (e === 1 ? .33 : .66),
|
|
2657
|
+
set: (n, r, i = 0) => Z(n, { [`cp${e}`]: {
|
|
2658
|
+
...X(n, i)[`cp${e}`] ?? {
|
|
2658
2659
|
x: e === 1 ? .33 : .66,
|
|
2659
2660
|
y: e === 1 ? .33 : .66
|
|
2660
2661
|
},
|
|
2661
2662
|
[t]: r
|
|
2662
2663
|
} }, i)
|
|
2663
|
-
}),
|
|
2664
|
+
}), st = [
|
|
2664
2665
|
{
|
|
2665
2666
|
key: "bg",
|
|
2666
2667
|
label: "Background",
|
|
@@ -2692,7 +2693,7 @@ var Ge = class {
|
|
|
2692
2693
|
get: (e, t = 0) => G(e, t)?.font,
|
|
2693
2694
|
set: (e, t, n = 0) => K(e, {
|
|
2694
2695
|
font: t,
|
|
2695
|
-
vf:
|
|
2696
|
+
vf: Oe(t, G(e, n)?.vf)
|
|
2696
2697
|
}, n)
|
|
2697
2698
|
},
|
|
2698
2699
|
{
|
|
@@ -2770,7 +2771,7 @@ var Ge = class {
|
|
|
2770
2771
|
tab: "style",
|
|
2771
2772
|
type: "select",
|
|
2772
2773
|
noRandom: !0,
|
|
2773
|
-
when:
|
|
2774
|
+
when: Xe,
|
|
2774
2775
|
options: [
|
|
2775
2776
|
{
|
|
2776
2777
|
value: "start",
|
|
@@ -2797,12 +2798,12 @@ var Ge = class {
|
|
|
2797
2798
|
max: 24,
|
|
2798
2799
|
step: 1,
|
|
2799
2800
|
noRandom: !0,
|
|
2800
|
-
when:
|
|
2801
|
+
when: Xe,
|
|
2801
2802
|
get: (e, t = 0) => G(e, t)?.multiply ?? 1,
|
|
2802
2803
|
set: (e, t, n = 0) => K(e, { multiply: Math.round(t) }, n)
|
|
2803
2804
|
},
|
|
2804
|
-
|
|
2805
|
-
|
|
2805
|
+
it("wdth"),
|
|
2806
|
+
it("wght"),
|
|
2806
2807
|
{
|
|
2807
2808
|
key: "arrangement",
|
|
2808
2809
|
label: "Arrangement",
|
|
@@ -2810,7 +2811,7 @@ var Ge = class {
|
|
|
2810
2811
|
section: "Arrangement",
|
|
2811
2812
|
type: "select",
|
|
2812
2813
|
noRandom: !0,
|
|
2813
|
-
options:
|
|
2814
|
+
options: Ze,
|
|
2814
2815
|
get: Y,
|
|
2815
2816
|
set: (e, t, n = 0) => q(e, { type: t }, n)
|
|
2816
2817
|
},
|
|
@@ -3009,7 +3010,7 @@ var Ge = class {
|
|
|
3009
3010
|
section: "Arrangement",
|
|
3010
3011
|
type: "select",
|
|
3011
3012
|
noRandom: !0,
|
|
3012
|
-
when:
|
|
3013
|
+
when: Xe,
|
|
3013
3014
|
options: [{
|
|
3014
3015
|
value: "flow",
|
|
3015
3016
|
label: "Flow"
|
|
@@ -3027,7 +3028,7 @@ var Ge = class {
|
|
|
3027
3028
|
section: "Arrangement",
|
|
3028
3029
|
type: "select",
|
|
3029
3030
|
noRandom: !0,
|
|
3030
|
-
when:
|
|
3031
|
+
when: Xe,
|
|
3031
3032
|
options: [{
|
|
3032
3033
|
value: "off",
|
|
3033
3034
|
label: "Off"
|
|
@@ -3077,7 +3078,7 @@ var Ge = class {
|
|
|
3077
3078
|
section: "Morph",
|
|
3078
3079
|
type: "select",
|
|
3079
3080
|
noRandom: !0,
|
|
3080
|
-
when:
|
|
3081
|
+
when: $e,
|
|
3081
3082
|
options: [{
|
|
3082
3083
|
value: "off",
|
|
3083
3084
|
label: "Off"
|
|
@@ -3085,8 +3086,8 @@ var Ge = class {
|
|
|
3085
3086
|
value: "on",
|
|
3086
3087
|
label: "On"
|
|
3087
3088
|
}],
|
|
3088
|
-
get: (e, t = 0) =>
|
|
3089
|
-
set: (e, t, n = 0) =>
|
|
3089
|
+
get: (e, t = 0) => X(e, t).on ? "on" : "off",
|
|
3090
|
+
set: (e, t, n = 0) => Z(e, { on: t === "on" }, n)
|
|
3090
3091
|
},
|
|
3091
3092
|
{
|
|
3092
3093
|
key: "morphMode",
|
|
@@ -3094,10 +3095,10 @@ var Ge = class {
|
|
|
3094
3095
|
tab: "style",
|
|
3095
3096
|
section: "Morph",
|
|
3096
3097
|
type: "select",
|
|
3097
|
-
when:
|
|
3098
|
-
options:
|
|
3099
|
-
get:
|
|
3100
|
-
set: (e, t, n = 0) =>
|
|
3098
|
+
when: Q,
|
|
3099
|
+
options: d,
|
|
3100
|
+
get: et,
|
|
3101
|
+
set: (e, t, n = 0) => Z(e, { mode: t }, n)
|
|
3101
3102
|
},
|
|
3102
3103
|
{
|
|
3103
3104
|
key: "morphFace2",
|
|
@@ -3106,13 +3107,13 @@ var Ge = class {
|
|
|
3106
3107
|
section: "Morph",
|
|
3107
3108
|
type: "select",
|
|
3108
3109
|
noRandom: !0,
|
|
3109
|
-
when:
|
|
3110
|
+
when: tt,
|
|
3110
3111
|
options: (e, t = 0) => [{
|
|
3111
3112
|
value: "",
|
|
3112
3113
|
label: "Off"
|
|
3113
3114
|
}, ...C.filter((n) => n.value !== G(e, t)?.font)],
|
|
3114
|
-
get: (e, t = 0) =>
|
|
3115
|
-
set: (e, t, n = 0) =>
|
|
3115
|
+
get: (e, t = 0) => X(e, t).face2 ?? "",
|
|
3116
|
+
set: (e, t, n = 0) => Z(e, { face2: t }, n)
|
|
3116
3117
|
},
|
|
3117
3118
|
{
|
|
3118
3119
|
key: "morphVf2Wdth",
|
|
@@ -3123,9 +3124,9 @@ var Ge = class {
|
|
|
3123
3124
|
min: 64,
|
|
3124
3125
|
max: 172,
|
|
3125
3126
|
step: 1,
|
|
3126
|
-
when: (e, t = 0) =>
|
|
3127
|
-
get: (e, t = 0) =>
|
|
3128
|
-
set: (e, t, n = 0) =>
|
|
3127
|
+
when: (e, t = 0) => tt(e, t) && !X(e, t).face2 && !!$(e, "wdth", t),
|
|
3128
|
+
get: (e, t = 0) => X(e, t).vf2?.wdth ?? $(e, "wdth", t)?.max ?? 172,
|
|
3129
|
+
set: (e, t, n = 0) => nt(e, "wdth", t, n)
|
|
3129
3130
|
},
|
|
3130
3131
|
{
|
|
3131
3132
|
key: "morphVf2Wght",
|
|
@@ -3136,9 +3137,9 @@ var Ge = class {
|
|
|
3136
3137
|
min: 100,
|
|
3137
3138
|
max: 900,
|
|
3138
3139
|
step: 1,
|
|
3139
|
-
when: (e, t = 0) =>
|
|
3140
|
-
get: (e, t = 0) =>
|
|
3141
|
-
set: (e, t, n = 0) =>
|
|
3140
|
+
when: (e, t = 0) => tt(e, t) && !X(e, t).face2 && !!$(e, "wght", t),
|
|
3141
|
+
get: (e, t = 0) => X(e, t).vf2?.wght ?? $(e, "wght", t)?.max ?? 900,
|
|
3142
|
+
set: (e, t, n = 0) => nt(e, "wght", t, n)
|
|
3142
3143
|
},
|
|
3143
3144
|
{
|
|
3144
3145
|
key: "morphCurve",
|
|
@@ -3146,15 +3147,15 @@ var Ge = class {
|
|
|
3146
3147
|
tab: "style",
|
|
3147
3148
|
section: "Morph",
|
|
3148
3149
|
type: "select",
|
|
3149
|
-
when: (e, t = 0) =>
|
|
3150
|
-
options:
|
|
3151
|
-
get: (e, t = 0) =>
|
|
3152
|
-
set: (e, t, n = 0) =>
|
|
3150
|
+
when: (e, t = 0) => Q(e, t) && et(e, t) === "morph",
|
|
3151
|
+
options: a,
|
|
3152
|
+
get: (e, t = 0) => X(e, t).curve ?? "flat",
|
|
3153
|
+
set: (e, t, n = 0) => Z(e, { curve: t }, n)
|
|
3153
3154
|
},
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3155
|
+
ot(1, "x"),
|
|
3156
|
+
ot(1, "y"),
|
|
3157
|
+
ot(2, "x"),
|
|
3158
|
+
ot(2, "y"),
|
|
3158
3159
|
{
|
|
3159
3160
|
key: "morphBlend",
|
|
3160
3161
|
label: "Blend",
|
|
@@ -3164,9 +3165,9 @@ var Ge = class {
|
|
|
3164
3165
|
min: 0,
|
|
3165
3166
|
max: 1,
|
|
3166
3167
|
step: .01,
|
|
3167
|
-
when: (e, t = 0) =>
|
|
3168
|
-
get: (e, t = 0) =>
|
|
3169
|
-
set: (e, t, n = 0) =>
|
|
3168
|
+
when: (e, t = 0) => Q(e, t) && et(e, t) !== "random",
|
|
3169
|
+
get: (e, t = 0) => X(e, t).blend ?? .5,
|
|
3170
|
+
set: (e, t, n = 0) => Z(e, { blend: t }, n)
|
|
3170
3171
|
},
|
|
3171
3172
|
{
|
|
3172
3173
|
key: "morphSeed",
|
|
@@ -3177,9 +3178,9 @@ var Ge = class {
|
|
|
3177
3178
|
min: 0,
|
|
3178
3179
|
max: 1,
|
|
3179
3180
|
step: .01,
|
|
3180
|
-
when: (e, t = 0) =>
|
|
3181
|
-
get: (e, t = 0) =>
|
|
3182
|
-
set: (e, t, n = 0) =>
|
|
3181
|
+
when: (e, t = 0) => Q(e, t) && et(e, t) === "random",
|
|
3182
|
+
get: (e, t = 0) => X(e, t).blend ?? .5,
|
|
3183
|
+
set: (e, t, n = 0) => Z(e, { blend: t }, n)
|
|
3183
3184
|
},
|
|
3184
3185
|
{
|
|
3185
3186
|
key: "mode",
|
|
@@ -3225,7 +3226,7 @@ var Ge = class {
|
|
|
3225
3226
|
label: "Sweep shift"
|
|
3226
3227
|
}
|
|
3227
3228
|
],
|
|
3228
|
-
get:
|
|
3229
|
+
get: Ye,
|
|
3229
3230
|
set: (e, t, n = 0) => J(e, { mode: t }, n)
|
|
3230
3231
|
},
|
|
3231
3232
|
{
|
|
@@ -3238,7 +3239,7 @@ var Ge = class {
|
|
|
3238
3239
|
step: 1,
|
|
3239
3240
|
rMin: 1,
|
|
3240
3241
|
rMax: 3,
|
|
3241
|
-
when: (e, t = 0) =>
|
|
3242
|
+
when: (e, t = 0) => Ye(e, t) !== "none",
|
|
3242
3243
|
get: (e, t = 0) => G(e, t)?.motion?.cycles ?? 1,
|
|
3243
3244
|
set: (e, t, n = 0) => J(e, { cycles: Math.round(t) }, n)
|
|
3244
3245
|
},
|
|
@@ -3257,7 +3258,7 @@ var Ge = class {
|
|
|
3257
3258
|
"sweep",
|
|
3258
3259
|
"sweepWeight",
|
|
3259
3260
|
"sweepShift"
|
|
3260
|
-
].includes(
|
|
3261
|
+
].includes(Ye(e, t)),
|
|
3261
3262
|
get: (e, t = 0) => G(e, t)?.motion?.amp ?? .3,
|
|
3262
3263
|
set: (e, t, n = 0) => J(e, { amp: t }, n)
|
|
3263
3264
|
},
|
|
@@ -3275,7 +3276,7 @@ var Ge = class {
|
|
|
3275
3276
|
"vfwave",
|
|
3276
3277
|
"glyphwave",
|
|
3277
3278
|
"cascade"
|
|
3278
|
-
].includes(
|
|
3279
|
+
].includes(Ye(e, t)),
|
|
3279
3280
|
get: (e, t = 0) => G(e, t)?.motion?.phase ?? .5,
|
|
3280
3281
|
set: (e, t, n = 0) => J(e, { phase: t }, n)
|
|
3281
3282
|
},
|
|
@@ -3284,10 +3285,10 @@ var Ge = class {
|
|
|
3284
3285
|
label: "Axis",
|
|
3285
3286
|
tab: "anim",
|
|
3286
3287
|
type: "select",
|
|
3287
|
-
when: (e, t = 0) => ["vfwave", "sweepWeight"].includes(
|
|
3288
|
-
options: (e, t = 0) =>
|
|
3288
|
+
when: (e, t = 0) => ["vfwave", "sweepWeight"].includes(Ye(e, t)) && v(G(e, t)?.font).axes.length > 1,
|
|
3289
|
+
options: (e, t = 0) => v(G(e, t)?.font).axes.map((e) => ({
|
|
3289
3290
|
value: e.tag,
|
|
3290
|
-
label:
|
|
3291
|
+
label: ne[e.tag] || e.tag
|
|
3291
3292
|
})),
|
|
3292
3293
|
get: (e, t = 0) => G(e, t)?.motion?.axis ?? "wght",
|
|
3293
3294
|
set: (e, t, n = 0) => J(e, { axis: t }, n)
|
|
@@ -3301,7 +3302,7 @@ var Ge = class {
|
|
|
3301
3302
|
"sweep",
|
|
3302
3303
|
"sweepWeight",
|
|
3303
3304
|
"sweepShift"
|
|
3304
|
-
].includes(
|
|
3305
|
+
].includes(Ye(e, t)),
|
|
3305
3306
|
options: [
|
|
3306
3307
|
{
|
|
3307
3308
|
value: "x",
|
|
@@ -3340,7 +3341,7 @@ var Ge = class {
|
|
|
3340
3341
|
max: 1,
|
|
3341
3342
|
step: .01,
|
|
3342
3343
|
get: (e) => G(e)?.stagger ?? 0,
|
|
3343
|
-
set: (e, t) =>
|
|
3344
|
+
set: (e, t) => Je(e, (e, n, r) => ({
|
|
3344
3345
|
stagger: t,
|
|
3345
3346
|
phase: r > 1 ? n / r * t : 0
|
|
3346
3347
|
}))
|
|
@@ -3359,18 +3360,18 @@ var Ge = class {
|
|
|
3359
3360
|
get: (e, t = 0) => G(e, t)?.path?.spin ?? 1,
|
|
3360
3361
|
set: (e, t, n = 0) => q(e, { spin: Math.round(t) }, n)
|
|
3361
3362
|
}
|
|
3362
|
-
],
|
|
3363
|
+
], ct = (e, t, n = 0) => typeof e.options == "function" ? e.options(t, n) : e.options ?? [], lt = (e, t, n = 0) => ({
|
|
3363
3364
|
min: typeof e.min == "function" ? e.min(t, n) : e.min,
|
|
3364
3365
|
max: typeof e.max == "function" ? e.max(t, n) : e.max
|
|
3365
3366
|
});
|
|
3366
|
-
function
|
|
3367
|
+
function ut(e, t = 0, n = Math.random) {
|
|
3367
3368
|
let r = e;
|
|
3368
|
-
for (let e of
|
|
3369
|
+
for (let e of st) if (!(e.noRandom || e.type === "color") && !(e.when && !e.when(r, t))) {
|
|
3369
3370
|
if (e.type === "range") {
|
|
3370
|
-
let i =
|
|
3371
|
+
let i = lt(e, r, t), a = e.rMin ?? i.min, o = e.rMax ?? i.max, s = e.step ?? 1, c = a + n() * (o - a);
|
|
3371
3372
|
r = e.set(r, Math.min(o, Math.max(a, Number((Math.round(c / s) * s).toFixed(4)))), t);
|
|
3372
3373
|
} else if (e.type === "select") {
|
|
3373
|
-
let i =
|
|
3374
|
+
let i = ct(e, r, t);
|
|
3374
3375
|
i.length && (r = e.set(r, i[Math.floor(n() * i.length)].value, t));
|
|
3375
3376
|
}
|
|
3376
3377
|
}
|
|
@@ -3378,7 +3379,7 @@ function ct(e, t = 0, n = Math.random) {
|
|
|
3378
3379
|
}
|
|
3379
3380
|
//#endregion
|
|
3380
3381
|
//#region src/editor/compose/inspectors/KineticPanel.jsx
|
|
3381
|
-
var
|
|
3382
|
+
var dt = {
|
|
3382
3383
|
key: "morphBlend",
|
|
3383
3384
|
label: "Morph blend",
|
|
3384
3385
|
type: "range",
|
|
@@ -3386,21 +3387,21 @@ var lt = {
|
|
|
3386
3387
|
max: 1,
|
|
3387
3388
|
step: .01,
|
|
3388
3389
|
default: .5
|
|
3389
|
-
},
|
|
3390
|
+
}, ft = new Set([
|
|
3390
3391
|
"mode",
|
|
3391
3392
|
"cycles",
|
|
3392
3393
|
"motionAmp",
|
|
3393
3394
|
"motionPhase",
|
|
3394
3395
|
"axis",
|
|
3395
3396
|
"field"
|
|
3396
|
-
]),
|
|
3397
|
+
]), pt = {
|
|
3397
3398
|
mode: "glyphwave",
|
|
3398
3399
|
cycles: 1,
|
|
3399
3400
|
phase: .5,
|
|
3400
3401
|
amp: .3,
|
|
3401
3402
|
axis: "wght",
|
|
3402
3403
|
field: "x"
|
|
3403
|
-
},
|
|
3404
|
+
}, mt = new Set([
|
|
3404
3405
|
"align",
|
|
3405
3406
|
"italic",
|
|
3406
3407
|
"fill",
|
|
@@ -3408,187 +3409,190 @@ var lt = {
|
|
|
3408
3409
|
"vfWght",
|
|
3409
3410
|
"offsetX",
|
|
3410
3411
|
"offsetY"
|
|
3411
|
-
]),
|
|
3412
|
+
]), ht = {
|
|
3412
3413
|
lineHeight: 0,
|
|
3413
3414
|
display: "inline-flex",
|
|
3414
3415
|
alignItems: "center",
|
|
3415
3416
|
justifyContent: "center"
|
|
3416
|
-
},
|
|
3417
|
-
function
|
|
3418
|
-
let
|
|
3417
|
+
}, gt = (e, t) => e ? String.fromCharCode(97 + t.indexOf(e) % 26) : null;
|
|
3418
|
+
function _t({ layer: t, setProp: r, updateLayer: a, palette: o, renderAnimate: c, tab: l, tabStrip: d, picker: f = !0 }) {
|
|
3419
|
+
let m = n(), h = t.comp ?? {
|
|
3419
3420
|
bg: "#0b0d12",
|
|
3420
3421
|
instances: []
|
|
3421
|
-
},
|
|
3422
|
-
y(
|
|
3423
|
-
id:
|
|
3424
|
-
index:
|
|
3422
|
+
}, g = h.instances ?? [], [v, y] = M(0), b = Math.min(v, Math.max(0, g.length - 1)), x = (e) => {
|
|
3423
|
+
y(e), window.dispatchEvent(new CustomEvent("kol:kinetic-element", { detail: {
|
|
3424
|
+
id: t.id,
|
|
3425
|
+
index: e,
|
|
3425
3426
|
from: "panel"
|
|
3426
3427
|
} }));
|
|
3427
3428
|
};
|
|
3428
|
-
|
|
3429
|
-
let
|
|
3430
|
-
|
|
3429
|
+
me(() => {
|
|
3430
|
+
let e = (e) => {
|
|
3431
|
+
e.detail?.id === t.id && e.detail.from === "canvas" && y(e.detail.index);
|
|
3431
3432
|
};
|
|
3432
|
-
return window.addEventListener("kol:kinetic-element",
|
|
3433
|
-
}, [
|
|
3434
|
-
let [
|
|
3435
|
-
let t =
|
|
3436
|
-
return t ?
|
|
3437
|
-
}, [ne, T] =
|
|
3433
|
+
return window.addEventListener("kol:kinetic-element", e), () => window.removeEventListener("kol:kinetic-element", e);
|
|
3434
|
+
}, [t.id]);
|
|
3435
|
+
let [C, w] = M([]), ee = (e) => w((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]), te = (e) => {
|
|
3436
|
+
let t = g[e]?.group;
|
|
3437
|
+
return t ? g.reduce((e, n, r) => n.group === t ? [...e, r] : e, []) : [e];
|
|
3438
|
+
}, [ne, T] = M(0), E = g[b]?.motions ?? [], D = Math.min(ne, E.length), ie = (e) => ({
|
|
3438
3439
|
...e,
|
|
3439
3440
|
instances: (e.instances ?? []).map((e, t) => t === b ? {
|
|
3440
3441
|
...e,
|
|
3441
3442
|
motion: { ...e.motions?.[D - 1] ?? {} }
|
|
3442
3443
|
} : e)
|
|
3443
|
-
}), ae = (e) =>
|
|
3444
|
-
|
|
3445
|
-
presetId:
|
|
3446
|
-
presetLabel:
|
|
3447
|
-
comp:
|
|
3444
|
+
}), ae = (e) => ft.has(e.key) && D > 0 ? ie(h) : h, oe = (e) => {
|
|
3445
|
+
e && (a(t.id, {
|
|
3446
|
+
presetId: e.id,
|
|
3447
|
+
presetLabel: e.label,
|
|
3448
|
+
comp: Fe(e)
|
|
3448
3449
|
}), y(0), T(0));
|
|
3449
|
-
}, se = (e) =>
|
|
3450
|
-
...
|
|
3451
|
-
instances:
|
|
3452
|
-
} }),
|
|
3453
|
-
...
|
|
3454
|
-
instances:
|
|
3450
|
+
}, se = (e) => r("comp", e), A = (e) => a(t.id, { comp: {
|
|
3451
|
+
...h,
|
|
3452
|
+
instances: e
|
|
3453
|
+
} }), le = (e, t) => se({
|
|
3454
|
+
...h,
|
|
3455
|
+
instances: g.map((n, r) => r === e ? {
|
|
3455
3456
|
...n,
|
|
3456
3457
|
...t
|
|
3457
3458
|
} : n)
|
|
3458
|
-
}),
|
|
3459
|
-
if (
|
|
3460
|
-
let e = new Set(
|
|
3459
|
+
}), ue = () => {
|
|
3460
|
+
if (C.length < 2) return;
|
|
3461
|
+
let e = new Set(g.map((e) => e.group).filter(Boolean)), t = 1;
|
|
3461
3462
|
for (; e.has(`g${t}`);) t++;
|
|
3462
|
-
A(
|
|
3463
|
+
A(g.map((e) => C.includes(e.id) ? {
|
|
3463
3464
|
...e,
|
|
3464
3465
|
group: `g${t}`
|
|
3465
|
-
} : e)),
|
|
3466
|
-
},
|
|
3467
|
-
|
|
3466
|
+
} : e)), w([]);
|
|
3467
|
+
}, fe = () => {
|
|
3468
|
+
C.length && (A(g.map((e) => C.includes(e.id) ? {
|
|
3468
3469
|
...e,
|
|
3469
3470
|
group: null
|
|
3470
|
-
} : e)),
|
|
3471
|
-
},
|
|
3472
|
-
if (
|
|
3473
|
-
let n = e.set(
|
|
3474
|
-
|
|
3471
|
+
} : e)), w([]));
|
|
3472
|
+
}, he = (e, t) => {
|
|
3473
|
+
if (ft.has(e.key) && D > 0) {
|
|
3474
|
+
let n = e.set(ie(h), t, b).instances?.[b]?.motion ?? {};
|
|
3475
|
+
le(b, { motions: E.map((e, t) => t === D - 1 ? n : e) });
|
|
3475
3476
|
return;
|
|
3476
3477
|
}
|
|
3477
3478
|
let n = te(b);
|
|
3478
|
-
if (n.length > 1 &&
|
|
3479
|
-
let r =
|
|
3479
|
+
if (n.length > 1 && mt.has(e.key)) {
|
|
3480
|
+
let r = h;
|
|
3480
3481
|
if (e.key === "fontSize") {
|
|
3481
|
-
let i = Number(e.get(
|
|
3482
|
+
let i = Number(e.get(h, b)) || 1, a = t / i;
|
|
3482
3483
|
for (let t of n) {
|
|
3483
|
-
let n = Number(e.get(
|
|
3484
|
+
let n = Number(e.get(h, t)) || i;
|
|
3484
3485
|
r = e.set(r, Math.max(8, Math.min(1200, Math.round(n * a))), t);
|
|
3485
3486
|
}
|
|
3486
3487
|
} else if (e.key === "offsetX" || e.key === "offsetY") {
|
|
3487
|
-
let i = t - (Number(e.get(
|
|
3488
|
-
for (let t of n) r = e.set(r, (Number(e.get(
|
|
3488
|
+
let i = t - (Number(e.get(h, b)) || 0);
|
|
3489
|
+
for (let t of n) r = e.set(r, (Number(e.get(h, t)) || 0) + i, t);
|
|
3489
3490
|
} else for (let i of n) r = e.set(r, t, i);
|
|
3490
3491
|
se(r);
|
|
3491
3492
|
return;
|
|
3492
3493
|
}
|
|
3493
|
-
se(e.set(
|
|
3494
|
-
},
|
|
3495
|
-
let
|
|
3496
|
-
|
|
3497
|
-
comp:
|
|
3498
|
-
_rollSeed:
|
|
3494
|
+
se(e.set(h, t, b));
|
|
3495
|
+
}, ge = i(t), F = () => {
|
|
3496
|
+
let e = ge.take();
|
|
3497
|
+
a(t.id, {
|
|
3498
|
+
comp: ut(h, b, u(e >>> 0)),
|
|
3499
|
+
_rollSeed: e
|
|
3499
3500
|
});
|
|
3500
|
-
},
|
|
3501
|
-
let
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
}),
|
|
3505
|
-
comp:
|
|
3506
|
-
_rollSeed:
|
|
3501
|
+
}, ve = () => {
|
|
3502
|
+
let e = ge.take(), n = u(e >>> 0), r = h;
|
|
3503
|
+
g.forEach((e, t) => {
|
|
3504
|
+
r = ut(r, t, n);
|
|
3505
|
+
}), a(t.id, {
|
|
3506
|
+
comp: r,
|
|
3507
|
+
_rollSeed: e
|
|
3507
3508
|
});
|
|
3508
|
-
},
|
|
3509
|
-
let
|
|
3510
|
-
|
|
3511
|
-
themeId:
|
|
3509
|
+
}, I = (e, n) => {
|
|
3510
|
+
let r = _(e, n);
|
|
3511
|
+
a(t.id, {
|
|
3512
|
+
themeId: e,
|
|
3512
3513
|
themeInvert: n,
|
|
3513
3514
|
comp: {
|
|
3514
|
-
...
|
|
3515
|
-
bg:
|
|
3516
|
-
instances:
|
|
3515
|
+
...h,
|
|
3516
|
+
bg: r.bg,
|
|
3517
|
+
instances: g.map((e) => ({
|
|
3517
3518
|
...e,
|
|
3518
|
-
fill:
|
|
3519
|
+
fill: r.fg
|
|
3519
3520
|
}))
|
|
3520
3521
|
}
|
|
3521
3522
|
});
|
|
3522
|
-
},
|
|
3523
|
-
...
|
|
3524
|
-
instances:
|
|
3523
|
+
}, ye = (e) => se({
|
|
3524
|
+
...h,
|
|
3525
|
+
instances: g.map((t) => ({
|
|
3525
3526
|
...t,
|
|
3526
3527
|
fill: e
|
|
3527
3528
|
}))
|
|
3528
|
-
}),
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
|
|
3531
|
-
layer:
|
|
3529
|
+
}), be = l === "labs-effect" ? "style" : l, xe = st.filter((e) => e.tab === be && (!e.when || e.when(ae(e), b))), Se = g.some((e) => e?.morph?.on), L = g[b];
|
|
3530
|
+
return /* @__PURE__ */ P(_e, { children: [
|
|
3531
|
+
f && /* @__PURE__ */ N(vt, {
|
|
3532
|
+
layer: t,
|
|
3532
3533
|
onPreset: oe
|
|
3533
3534
|
}),
|
|
3534
|
-
/* @__PURE__ */
|
|
3535
|
+
/* @__PURE__ */ P("div", {
|
|
3535
3536
|
className: "flex flex-col gap-1",
|
|
3536
3537
|
children: [
|
|
3537
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ N("span", {
|
|
3538
3539
|
className: "kol-helper-10 text-meta",
|
|
3539
3540
|
children: "Elements"
|
|
3540
3541
|
}),
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
insts:
|
|
3542
|
+
/* @__PURE__ */ N(yt, {
|
|
3543
|
+
insts: g,
|
|
3543
3544
|
idx: b,
|
|
3544
3545
|
onSelect: x,
|
|
3545
3546
|
onWrite: A,
|
|
3546
|
-
marked:
|
|
3547
|
-
onMark:
|
|
3548
|
-
onGroup:
|
|
3549
|
-
onUngroup:
|
|
3547
|
+
marked: C,
|
|
3548
|
+
onMark: ee,
|
|
3549
|
+
onGroup: ue,
|
|
3550
|
+
onUngroup: fe
|
|
3550
3551
|
}),
|
|
3551
|
-
/* @__PURE__ */
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3552
|
+
/* @__PURE__ */ N(j, {
|
|
3553
|
+
label: "Edit elements on the canvas (click to select, drag to move, corners to scale)",
|
|
3554
|
+
children: /* @__PURE__ */ N(O, {
|
|
3555
|
+
"aria-label": "Edit elements on the canvas (click to select, drag to move, corners to scale)",
|
|
3556
|
+
variant: "primary",
|
|
3557
|
+
size: m,
|
|
3558
|
+
className: "w-full",
|
|
3559
|
+
onClick: () => window.dispatchEvent(new CustomEvent("kol:kinetic-edit", { detail: {
|
|
3560
|
+
id: t.id,
|
|
3561
|
+
index: b
|
|
3562
|
+
} })),
|
|
3563
|
+
children: "Edit on canvas"
|
|
3564
|
+
})
|
|
3561
3565
|
})
|
|
3562
3566
|
]
|
|
3563
3567
|
}),
|
|
3564
|
-
|
|
3565
|
-
(
|
|
3566
|
-
/* @__PURE__ */
|
|
3568
|
+
d,
|
|
3569
|
+
(l === "generate" || l === "labs-effect") && /* @__PURE__ */ P(_e, { children: [
|
|
3570
|
+
/* @__PURE__ */ N(k, {
|
|
3567
3571
|
label: "Text",
|
|
3568
|
-
children: /* @__PURE__ */
|
|
3572
|
+
children: /* @__PURE__ */ N(ce, {
|
|
3569
3573
|
variant: "filled",
|
|
3570
|
-
size:
|
|
3574
|
+
size: m,
|
|
3571
3575
|
rows: 2,
|
|
3572
3576
|
axis: "y",
|
|
3573
|
-
value:
|
|
3574
|
-
onChange: (e) =>
|
|
3577
|
+
value: g[b]?.text ?? "",
|
|
3578
|
+
onChange: (e) => le(b, { text: e.target.value })
|
|
3575
3579
|
})
|
|
3576
3580
|
}),
|
|
3577
|
-
/* @__PURE__ */
|
|
3581
|
+
/* @__PURE__ */ P("div", {
|
|
3578
3582
|
className: "grid grid-cols-2 gap-2",
|
|
3579
|
-
children: [/* @__PURE__ */
|
|
3583
|
+
children: [/* @__PURE__ */ N(k, {
|
|
3580
3584
|
label: "Theme",
|
|
3581
|
-
children: /* @__PURE__ */
|
|
3585
|
+
children: /* @__PURE__ */ N(re, {
|
|
3582
3586
|
variant: "subtle",
|
|
3583
|
-
size:
|
|
3587
|
+
size: m,
|
|
3584
3588
|
className: "w-full",
|
|
3585
|
-
options:
|
|
3586
|
-
value:
|
|
3587
|
-
onChange: (
|
|
3589
|
+
options: S,
|
|
3590
|
+
value: t.themeId ?? "kol",
|
|
3591
|
+
onChange: (e) => I(e, !!t.themeInvert)
|
|
3588
3592
|
})
|
|
3589
|
-
}), /* @__PURE__ */
|
|
3593
|
+
}), /* @__PURE__ */ N(k, {
|
|
3590
3594
|
label: "Invert",
|
|
3591
|
-
children: /* @__PURE__ */
|
|
3595
|
+
children: /* @__PURE__ */ N(de, {
|
|
3592
3596
|
options: [{
|
|
3593
3597
|
value: "off",
|
|
3594
3598
|
label: "Off"
|
|
@@ -3596,108 +3600,108 @@ function ht({ layer: e, setProp: n, updateLayer: r, palette: i, renderAnimate: a
|
|
|
3596
3600
|
value: "on",
|
|
3597
3601
|
label: "On"
|
|
3598
3602
|
}],
|
|
3599
|
-
viewMode:
|
|
3600
|
-
onViewChange: (
|
|
3603
|
+
viewMode: t.themeInvert ? "on" : "off",
|
|
3604
|
+
onViewChange: (e) => I(t.themeId ?? "kol", e === "on")
|
|
3601
3605
|
})
|
|
3602
3606
|
})]
|
|
3603
3607
|
}),
|
|
3604
|
-
/* @__PURE__ */
|
|
3608
|
+
/* @__PURE__ */ N(s, {
|
|
3605
3609
|
label: "Text colour",
|
|
3606
|
-
value:
|
|
3607
|
-
onChange: (
|
|
3608
|
-
palette:
|
|
3610
|
+
value: g[0]?.fill,
|
|
3611
|
+
onChange: (t) => ye(e(t, o) ?? t),
|
|
3612
|
+
palette: o
|
|
3609
3613
|
}),
|
|
3610
|
-
/* @__PURE__ */
|
|
3614
|
+
/* @__PURE__ */ P("div", {
|
|
3611
3615
|
className: "grid grid-cols-2 gap-2",
|
|
3612
|
-
children: [/* @__PURE__ */
|
|
3616
|
+
children: [/* @__PURE__ */ N(O, {
|
|
3613
3617
|
variant: "primary",
|
|
3614
|
-
size:
|
|
3615
|
-
onClick:
|
|
3618
|
+
size: m,
|
|
3619
|
+
onClick: F,
|
|
3616
3620
|
children: "Randomise"
|
|
3617
|
-
}), /* @__PURE__ */
|
|
3621
|
+
}), /* @__PURE__ */ N(O, {
|
|
3618
3622
|
variant: "primary",
|
|
3619
|
-
size:
|
|
3620
|
-
onClick:
|
|
3623
|
+
size: m,
|
|
3624
|
+
onClick: ve,
|
|
3621
3625
|
children: "All elements"
|
|
3622
3626
|
})]
|
|
3623
3627
|
}),
|
|
3624
|
-
/* @__PURE__ */
|
|
3628
|
+
/* @__PURE__ */ N(p, { seed: ge })
|
|
3625
3629
|
] }),
|
|
3626
|
-
|
|
3630
|
+
l === "anim" && /* @__PURE__ */ N(xt, {
|
|
3627
3631
|
motions: E,
|
|
3628
3632
|
mIdx: D,
|
|
3629
3633
|
onSelect: T,
|
|
3630
3634
|
onAdd: () => {
|
|
3631
|
-
A(
|
|
3635
|
+
A(g.map((e, t) => t === b ? {
|
|
3632
3636
|
...e,
|
|
3633
|
-
motions: [...E, { ...
|
|
3637
|
+
motions: [...E, { ...pt }]
|
|
3634
3638
|
} : e)), T(E.length + 1);
|
|
3635
3639
|
},
|
|
3636
3640
|
onRemove: () => {
|
|
3637
|
-
D !== 0 && (A(
|
|
3641
|
+
D !== 0 && (A(g.map((e, t) => t === b ? {
|
|
3638
3642
|
...e,
|
|
3639
3643
|
motions: E.filter((e, t) => t !== D - 1)
|
|
3640
3644
|
} : e)), T(D - 1));
|
|
3641
3645
|
}
|
|
3642
3646
|
}),
|
|
3643
|
-
|
|
3644
|
-
|
|
3647
|
+
l !== "generate" && xe.map((e, n) => /* @__PURE__ */ P(pe, { children: [
|
|
3648
|
+
e.key === "arrangement" && /* @__PURE__ */ P(_e, { children: [/* @__PURE__ */ N("span", {
|
|
3645
3649
|
className: "kol-helper-10 text-meta",
|
|
3646
3650
|
children: "OpenType"
|
|
3647
|
-
}), /* @__PURE__ */
|
|
3651
|
+
}), /* @__PURE__ */ N(St, {
|
|
3648
3652
|
value: L?.opentype ?? {},
|
|
3649
|
-
onToggle: (e, t) =>
|
|
3653
|
+
onToggle: (e, t) => le(b, { opentype: {
|
|
3650
3654
|
...L?.opentype ?? {},
|
|
3651
3655
|
[e]: t
|
|
3652
3656
|
} })
|
|
3653
3657
|
})] }),
|
|
3654
|
-
|
|
3658
|
+
e.section && e.section !== xe[n - 1]?.section && /* @__PURE__ */ N("span", {
|
|
3655
3659
|
className: "kol-helper-10 text-meta",
|
|
3656
|
-
children:
|
|
3660
|
+
children: e.section
|
|
3657
3661
|
}),
|
|
3658
|
-
/* @__PURE__ */
|
|
3659
|
-
knob:
|
|
3660
|
-
comp: ae(
|
|
3662
|
+
/* @__PURE__ */ N(bt, {
|
|
3663
|
+
knob: e,
|
|
3664
|
+
comp: ae(e),
|
|
3661
3665
|
idx: b,
|
|
3662
|
-
palette:
|
|
3663
|
-
onWrite:
|
|
3666
|
+
palette: o,
|
|
3667
|
+
onWrite: he
|
|
3664
3668
|
}),
|
|
3665
|
-
|
|
3669
|
+
e.key === "showPath" && L?.path?.type === "custom" && /* @__PURE__ */ N(Ct, {
|
|
3666
3670
|
inst: L,
|
|
3667
|
-
layer:
|
|
3668
|
-
onPoints: (e) =>
|
|
3671
|
+
layer: t,
|
|
3672
|
+
onPoints: (e) => le(b, { path: {
|
|
3669
3673
|
...L?.path ?? {},
|
|
3670
3674
|
points: e
|
|
3671
3675
|
} })
|
|
3672
3676
|
})
|
|
3673
|
-
] },
|
|
3674
|
-
|
|
3675
|
-
layer:
|
|
3676
|
-
setProp:
|
|
3677
|
-
insts:
|
|
3678
|
-
renderAnimate:
|
|
3677
|
+
] }, e.key)),
|
|
3678
|
+
l === "anim" && Se && /* @__PURE__ */ N(wt, {
|
|
3679
|
+
layer: t,
|
|
3680
|
+
setProp: r,
|
|
3681
|
+
insts: g,
|
|
3682
|
+
renderAnimate: c
|
|
3679
3683
|
})
|
|
3680
3684
|
] });
|
|
3681
3685
|
}
|
|
3682
|
-
function
|
|
3683
|
-
return /* @__PURE__ */
|
|
3684
|
-
tree:
|
|
3686
|
+
function vt({ layer: e, onPreset: t }) {
|
|
3687
|
+
return /* @__PURE__ */ N(te, {
|
|
3688
|
+
tree: Pe,
|
|
3685
3689
|
presets: V,
|
|
3686
3690
|
current: V.find((t) => t.id === e.presetId) ?? V[0],
|
|
3687
3691
|
onPick: t
|
|
3688
3692
|
});
|
|
3689
3693
|
}
|
|
3690
|
-
function
|
|
3691
|
-
let l =
|
|
3694
|
+
function yt({ insts: e, idx: t, onSelect: r, onWrite: i, marked: a, onMark: o, onGroup: s, onUngroup: c }) {
|
|
3695
|
+
let l = n(), u = () => {
|
|
3692
3696
|
let t = e.length;
|
|
3693
3697
|
for (; e.some((e) => e.id === `i${t}`);) t++;
|
|
3694
3698
|
return `i${t}`;
|
|
3695
3699
|
}, d = () => {
|
|
3696
|
-
let
|
|
3700
|
+
let n = {
|
|
3697
3701
|
id: u(),
|
|
3698
3702
|
text: "Text"
|
|
3699
3703
|
};
|
|
3700
|
-
e[
|
|
3704
|
+
e[t]?.fill && (n.fill = e[t].fill), i([...e, ke(n, e.length)]), r(e.length);
|
|
3701
3705
|
}, f = (t) => {
|
|
3702
3706
|
let n = {
|
|
3703
3707
|
...structuredClone(e[t]),
|
|
@@ -3706,82 +3710,84 @@ function _t({ insts: e, idx: n, onSelect: r, onWrite: i, marked: a, onMark: o, o
|
|
|
3706
3710
|
a.splice(t + 1, 0, n), i(a), r(t + 1);
|
|
3707
3711
|
}, p = (t) => {
|
|
3708
3712
|
e.length <= 1 || (i(e.filter((e, n) => n !== t)), r(Math.min(t, e.length - 2)));
|
|
3709
|
-
},
|
|
3710
|
-
let a =
|
|
3713
|
+
}, m = (n) => {
|
|
3714
|
+
let a = t + n;
|
|
3711
3715
|
if (a < 0 || a >= e.length) return;
|
|
3712
|
-
let o = [...e], [s] = o.splice(
|
|
3716
|
+
let o = [...e], [s] = o.splice(t, 1);
|
|
3713
3717
|
o.splice(a, 0, s), i(o), r(a);
|
|
3714
|
-
},
|
|
3715
|
-
return /* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3718
|
+
}, h = [...new Set(e.map((e) => e.group).filter(Boolean))];
|
|
3719
|
+
return /* @__PURE__ */ P(_e, { children: [
|
|
3720
|
+
/* @__PURE__ */ N("div", {
|
|
3717
3721
|
className: "flex flex-col gap-1",
|
|
3718
|
-
children: e.map((
|
|
3719
|
-
let s =
|
|
3720
|
-
return /* @__PURE__ */
|
|
3722
|
+
children: e.map((n, i) => {
|
|
3723
|
+
let s = gt(n.group, h);
|
|
3724
|
+
return /* @__PURE__ */ P("div", {
|
|
3721
3725
|
onClick: () => r(i),
|
|
3722
|
-
className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${i ===
|
|
3726
|
+
className: `flex items-center gap-2 pl-2 pr-1 py-1 rounded cursor-pointer kol-helper-12 ${i === t ? "bg-[color-mix(in_srgb,var(--kol-accent-primary)_26%,transparent)] text-emphasis" : "text-body hover:bg-fg-04 hover:text-emphasis"}`,
|
|
3723
3727
|
children: [
|
|
3724
|
-
/* @__PURE__ */
|
|
3728
|
+
/* @__PURE__ */ N("span", {
|
|
3725
3729
|
onClick: (e) => e.stopPropagation(),
|
|
3726
3730
|
className: "shrink-0",
|
|
3727
3731
|
style: { lineHeight: 0 },
|
|
3728
|
-
children: /* @__PURE__ */
|
|
3729
|
-
checked: a.includes(
|
|
3730
|
-
onChange: () => o(
|
|
3732
|
+
children: /* @__PURE__ */ N(ue, {
|
|
3733
|
+
checked: a.includes(n.id),
|
|
3734
|
+
onChange: () => o(n.id)
|
|
3731
3735
|
})
|
|
3732
3736
|
}),
|
|
3733
|
-
/* @__PURE__ */
|
|
3737
|
+
/* @__PURE__ */ N("span", {
|
|
3734
3738
|
className: "kol-helper-10 text-meta shrink-0",
|
|
3735
3739
|
children: i + 1
|
|
3736
3740
|
}),
|
|
3737
|
-
/* @__PURE__ */
|
|
3741
|
+
/* @__PURE__ */ N("span", {
|
|
3738
3742
|
className: "truncate flex-1 min-w-0",
|
|
3739
|
-
children:
|
|
3743
|
+
children: n.text || "—"
|
|
3740
3744
|
}),
|
|
3741
|
-
s && /* @__PURE__ */
|
|
3745
|
+
s && /* @__PURE__ */ P("span", {
|
|
3742
3746
|
className: "shrink-0 kol-helper-10 text-meta",
|
|
3743
3747
|
children: ["grp ", s]
|
|
3744
3748
|
}),
|
|
3745
|
-
/* @__PURE__ */
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3749
|
+
/* @__PURE__ */ N(j, {
|
|
3750
|
+
label: "Duplicate element",
|
|
3751
|
+
children: /* @__PURE__ */ N(O, {
|
|
3752
|
+
variant: "ghost",
|
|
3753
|
+
size: l,
|
|
3754
|
+
quiet: !0,
|
|
3755
|
+
iconOnly: "copy",
|
|
3756
|
+
iconSize: 12,
|
|
3757
|
+
"aria-label": "Duplicate element",
|
|
3758
|
+
onClick: (e) => {
|
|
3759
|
+
e.stopPropagation(), f(i);
|
|
3760
|
+
}
|
|
3761
|
+
})
|
|
3757
3762
|
}),
|
|
3758
|
-
/* @__PURE__ */
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3763
|
+
/* @__PURE__ */ N(j, {
|
|
3764
|
+
label: "Remove element",
|
|
3765
|
+
children: /* @__PURE__ */ N(O, {
|
|
3766
|
+
variant: "ghost",
|
|
3767
|
+
size: l,
|
|
3768
|
+
quiet: !0,
|
|
3769
|
+
iconOnly: "x",
|
|
3770
|
+
iconSize: 10,
|
|
3771
|
+
"aria-label": "Remove element",
|
|
3772
|
+
disabled: e.length <= 1,
|
|
3773
|
+
onClick: (e) => {
|
|
3774
|
+
e.stopPropagation(), p(i);
|
|
3775
|
+
}
|
|
3776
|
+
})
|
|
3771
3777
|
})
|
|
3772
3778
|
]
|
|
3773
|
-
},
|
|
3779
|
+
}, n.id ?? i);
|
|
3774
3780
|
})
|
|
3775
3781
|
}),
|
|
3776
|
-
/* @__PURE__ */
|
|
3782
|
+
/* @__PURE__ */ P("div", {
|
|
3777
3783
|
className: "grid grid-cols-2 gap-1",
|
|
3778
|
-
children: [/* @__PURE__ */
|
|
3784
|
+
children: [/* @__PURE__ */ N(O, {
|
|
3779
3785
|
variant: "primary",
|
|
3780
3786
|
size: l,
|
|
3781
3787
|
disabled: a.length < 2,
|
|
3782
3788
|
onClick: s,
|
|
3783
3789
|
children: "Group"
|
|
3784
|
-
}), /* @__PURE__ */
|
|
3790
|
+
}), /* @__PURE__ */ N(O, {
|
|
3785
3791
|
variant: "primary",
|
|
3786
3792
|
size: l,
|
|
3787
3793
|
disabled: !a.length,
|
|
@@ -3789,11 +3795,10 @@ function _t({ insts: e, idx: n, onSelect: r, onWrite: i, marked: a, onMark: o, o
|
|
|
3789
3795
|
children: "Ungroup"
|
|
3790
3796
|
})]
|
|
3791
3797
|
}),
|
|
3792
|
-
/* @__PURE__ */
|
|
3798
|
+
/* @__PURE__ */ P("div", {
|
|
3793
3799
|
className: "flex items-center gap-1",
|
|
3794
3800
|
children: [
|
|
3795
|
-
/* @__PURE__ */
|
|
3796
|
-
iconComponent: m,
|
|
3801
|
+
/* @__PURE__ */ N(O, {
|
|
3797
3802
|
variant: "primary",
|
|
3798
3803
|
size: l,
|
|
3799
3804
|
className: "flex-1",
|
|
@@ -3802,123 +3807,130 @@ function _t({ insts: e, idx: n, onSelect: r, onWrite: i, marked: a, onMark: o, o
|
|
|
3802
3807
|
onClick: d,
|
|
3803
3808
|
children: "Add element"
|
|
3804
3809
|
}),
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3810
|
+
/* @__PURE__ */ N(j, {
|
|
3811
|
+
label: "Move element up",
|
|
3812
|
+
children: /* @__PURE__ */ N(O, {
|
|
3813
|
+
variant: "ghost",
|
|
3814
|
+
size: l,
|
|
3815
|
+
quiet: !0,
|
|
3816
|
+
style: ht,
|
|
3817
|
+
"aria-label": "Move element up",
|
|
3818
|
+
disabled: t <= 0,
|
|
3819
|
+
onClick: () => m(-1),
|
|
3820
|
+
children: /* @__PURE__ */ N(F, {
|
|
3821
|
+
name: "chevron-down",
|
|
3822
|
+
size: 12,
|
|
3823
|
+
style: { transform: "rotate(180deg)" }
|
|
3824
|
+
})
|
|
3818
3825
|
})
|
|
3819
3826
|
}),
|
|
3820
|
-
/* @__PURE__ */
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3827
|
+
/* @__PURE__ */ N(j, {
|
|
3828
|
+
label: "Move element down",
|
|
3829
|
+
children: /* @__PURE__ */ N(O, {
|
|
3830
|
+
variant: "ghost",
|
|
3831
|
+
size: l,
|
|
3832
|
+
quiet: !0,
|
|
3833
|
+
style: ht,
|
|
3834
|
+
"aria-label": "Move element down",
|
|
3835
|
+
disabled: t >= e.length - 1,
|
|
3836
|
+
onClick: () => m(1),
|
|
3837
|
+
children: /* @__PURE__ */ N(F, {
|
|
3838
|
+
name: "chevron-down",
|
|
3839
|
+
size: 12
|
|
3840
|
+
})
|
|
3832
3841
|
})
|
|
3833
3842
|
})
|
|
3834
3843
|
]
|
|
3835
3844
|
})
|
|
3836
3845
|
] });
|
|
3837
3846
|
}
|
|
3838
|
-
function
|
|
3839
|
-
let
|
|
3840
|
-
if (
|
|
3841
|
-
label:
|
|
3842
|
-
value:
|
|
3843
|
-
onChange: (
|
|
3844
|
-
palette:
|
|
3847
|
+
function bt({ knob: t, comp: r, idx: i, palette: a, onWrite: o }) {
|
|
3848
|
+
let c = n(), l = t.get(r, i), u = (e) => o(t, e);
|
|
3849
|
+
if (t.type === "color") return /* @__PURE__ */ N(s, {
|
|
3850
|
+
label: t.label,
|
|
3851
|
+
value: l,
|
|
3852
|
+
onChange: (t) => u(e(t, a) ?? t),
|
|
3853
|
+
palette: a
|
|
3845
3854
|
});
|
|
3846
|
-
if (
|
|
3847
|
-
label:
|
|
3848
|
-
children: /* @__PURE__ */
|
|
3855
|
+
if (t.type === "select") return /* @__PURE__ */ N(k, {
|
|
3856
|
+
label: t.label,
|
|
3857
|
+
children: /* @__PURE__ */ N(re, {
|
|
3849
3858
|
variant: "subtle",
|
|
3850
|
-
size:
|
|
3859
|
+
size: c,
|
|
3851
3860
|
className: "w-full",
|
|
3852
|
-
options:
|
|
3853
|
-
value:
|
|
3854
|
-
onChange:
|
|
3861
|
+
options: ct(t, r, i),
|
|
3862
|
+
value: l,
|
|
3863
|
+
onChange: u
|
|
3855
3864
|
})
|
|
3856
3865
|
});
|
|
3857
|
-
let { min:
|
|
3858
|
-
return /* @__PURE__ */
|
|
3859
|
-
label:
|
|
3860
|
-
children: /* @__PURE__ */
|
|
3861
|
-
min:
|
|
3862
|
-
max:
|
|
3863
|
-
step:
|
|
3864
|
-
value: typeof
|
|
3865
|
-
onChange:
|
|
3866
|
+
let { min: d, max: f } = lt(t, r, i);
|
|
3867
|
+
return /* @__PURE__ */ N(k, {
|
|
3868
|
+
label: t.label,
|
|
3869
|
+
children: /* @__PURE__ */ N(A, {
|
|
3870
|
+
min: d,
|
|
3871
|
+
max: f,
|
|
3872
|
+
step: t.step ?? 1,
|
|
3873
|
+
value: typeof l == "number" ? l : d,
|
|
3874
|
+
onChange: u
|
|
3866
3875
|
})
|
|
3867
3876
|
});
|
|
3868
3877
|
}
|
|
3869
|
-
function
|
|
3870
|
-
let o =
|
|
3878
|
+
function xt({ motions: e, mIdx: t, onSelect: r, onAdd: i, onRemove: a }) {
|
|
3879
|
+
let o = n(), s = [{
|
|
3871
3880
|
value: "0",
|
|
3872
3881
|
label: "1"
|
|
3873
3882
|
}, ...e.map((e, t) => ({
|
|
3874
3883
|
value: String(t + 1),
|
|
3875
3884
|
label: String(t + 2)
|
|
3876
3885
|
}))];
|
|
3877
|
-
return /* @__PURE__ */
|
|
3886
|
+
return /* @__PURE__ */ P("div", {
|
|
3878
3887
|
className: "flex flex-col gap-1",
|
|
3879
|
-
children: [/* @__PURE__ */
|
|
3888
|
+
children: [/* @__PURE__ */ N("span", {
|
|
3880
3889
|
className: "kol-helper-10 text-meta",
|
|
3881
3890
|
children: "Motion layers"
|
|
3882
|
-
}), /* @__PURE__ */
|
|
3891
|
+
}), /* @__PURE__ */ P("div", {
|
|
3883
3892
|
className: "flex items-center gap-1",
|
|
3884
3893
|
children: [
|
|
3885
|
-
/* @__PURE__ */
|
|
3894
|
+
/* @__PURE__ */ N("div", {
|
|
3886
3895
|
className: "flex-1 min-w-0",
|
|
3887
|
-
children: /* @__PURE__ */
|
|
3888
|
-
|
|
3896
|
+
children: /* @__PURE__ */ N(se, {
|
|
3897
|
+
variant: "filled",
|
|
3898
|
+
value: String(t),
|
|
3889
3899
|
onChange: (e) => r(Number(e)),
|
|
3890
3900
|
options: s
|
|
3891
3901
|
})
|
|
3892
3902
|
}),
|
|
3893
|
-
/* @__PURE__ */
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
+
/* @__PURE__ */ N(j, {
|
|
3904
|
+
label: "Add motion layer",
|
|
3905
|
+
children: /* @__PURE__ */ N(O, {
|
|
3906
|
+
variant: "ghost",
|
|
3907
|
+
size: o,
|
|
3908
|
+
quiet: !0,
|
|
3909
|
+
iconOnly: "plus",
|
|
3910
|
+
iconSize: 12,
|
|
3911
|
+
"aria-label": "Add motion layer",
|
|
3912
|
+
onClick: i
|
|
3913
|
+
})
|
|
3903
3914
|
}),
|
|
3904
|
-
/* @__PURE__ */
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
+
/* @__PURE__ */ N(j, {
|
|
3916
|
+
label: "Remove motion layer (the primary can only be set to None)",
|
|
3917
|
+
children: /* @__PURE__ */ N(O, {
|
|
3918
|
+
variant: "ghost",
|
|
3919
|
+
size: o,
|
|
3920
|
+
quiet: !0,
|
|
3921
|
+
iconOnly: "x",
|
|
3922
|
+
iconSize: 10,
|
|
3923
|
+
"aria-label": "Remove motion layer",
|
|
3924
|
+
disabled: t === 0,
|
|
3925
|
+
onClick: a
|
|
3926
|
+
})
|
|
3915
3927
|
})
|
|
3916
3928
|
]
|
|
3917
3929
|
})]
|
|
3918
3930
|
});
|
|
3919
3931
|
}
|
|
3920
|
-
function
|
|
3921
|
-
let [n, r] =
|
|
3932
|
+
function St({ value: e = {}, onToggle: t }) {
|
|
3933
|
+
let [n, r] = M(!1), i = fe({
|
|
3922
3934
|
open: n,
|
|
3923
3935
|
onOpenChange: r,
|
|
3924
3936
|
placement: "bottom-start",
|
|
@@ -3926,10 +3938,10 @@ function bt({ value: e = {}, onToggle: t }) {
|
|
|
3926
3938
|
flip: !1,
|
|
3927
3939
|
matchReferenceWidth: !0,
|
|
3928
3940
|
role: "listbox"
|
|
3929
|
-
}), a =
|
|
3930
|
-
return /* @__PURE__ */
|
|
3941
|
+
}), a = He.filter((t) => e[t.tag]).length;
|
|
3942
|
+
return /* @__PURE__ */ P("div", {
|
|
3931
3943
|
className: "relative w-full",
|
|
3932
|
-
children: [/* @__PURE__ */
|
|
3944
|
+
children: [/* @__PURE__ */ P("button", {
|
|
3933
3945
|
ref: i.refs.setReference,
|
|
3934
3946
|
...i.getReferenceProps(),
|
|
3935
3947
|
type: "button",
|
|
@@ -3944,7 +3956,7 @@ function bt({ value: e = {}, onToggle: t }) {
|
|
|
3944
3956
|
},
|
|
3945
3957
|
"aria-haspopup": "listbox",
|
|
3946
3958
|
"aria-expanded": n,
|
|
3947
|
-
children: [/* @__PURE__ */
|
|
3959
|
+
children: [/* @__PURE__ */ N("span", { children: a ? `${a} feature${a > 1 ? "s" : ""}` : "None" }), /* @__PURE__ */ N(F, {
|
|
3948
3960
|
name: "chevron-down",
|
|
3949
3961
|
size: 10,
|
|
3950
3962
|
className: "ml-auto",
|
|
@@ -3953,7 +3965,7 @@ function bt({ value: e = {}, onToggle: t }) {
|
|
|
3953
3965
|
transition: "transform 300ms"
|
|
3954
3966
|
}
|
|
3955
3967
|
})]
|
|
3956
|
-
}), /* @__PURE__ */
|
|
3968
|
+
}), /* @__PURE__ */ N(oe, {
|
|
3957
3969
|
popover: i,
|
|
3958
3970
|
panel: !1,
|
|
3959
3971
|
focus: !1,
|
|
@@ -3963,12 +3975,12 @@ function bt({ value: e = {}, onToggle: t }) {
|
|
|
3963
3975
|
borderRadius: "0 0 4px 4px",
|
|
3964
3976
|
zIndex: 200
|
|
3965
3977
|
},
|
|
3966
|
-
children: /* @__PURE__ */
|
|
3978
|
+
children: /* @__PURE__ */ N("div", {
|
|
3967
3979
|
className: "flex max-h-[300px] flex-col items-stretch overflow-y-auto",
|
|
3968
3980
|
role: "listbox",
|
|
3969
|
-
children:
|
|
3981
|
+
children: He.map((n) => /* @__PURE__ */ N(ae, {
|
|
3970
3982
|
onClick: () => t(n.tag, !e[n.tag]),
|
|
3971
|
-
shortcut: e[n.tag] ? /* @__PURE__ */
|
|
3983
|
+
shortcut: e[n.tag] ? /* @__PURE__ */ N(F, {
|
|
3972
3984
|
name: "check",
|
|
3973
3985
|
size: 11
|
|
3974
3986
|
}) : void 0,
|
|
@@ -3978,8 +3990,8 @@ function bt({ value: e = {}, onToggle: t }) {
|
|
|
3978
3990
|
})]
|
|
3979
3991
|
});
|
|
3980
3992
|
}
|
|
3981
|
-
function
|
|
3982
|
-
let i =
|
|
3993
|
+
function Ct({ inst: e, layer: t, onPoints: r }) {
|
|
3994
|
+
let i = n(), a = ge(null), o = ge(null), s = e?.path?.points, c = Array.isArray(s) && s.length >= 2 ? s : be, l = t.w > 0 && t.h > 0 ? t.w / t.h : 1, u = Te("custom", 100, 100, { points: c }).d, d = (e) => (t) => {
|
|
3983
3995
|
t.preventDefault(), t.stopPropagation(), t.currentTarget.setPointerCapture(t.pointerId), o.current = { i: e };
|
|
3984
3996
|
}, f = (e) => {
|
|
3985
3997
|
let t = o.current, n = a.current;
|
|
@@ -3994,24 +4006,24 @@ function xt({ inst: e, layer: n, onPoints: r }) {
|
|
|
3994
4006
|
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
3995
4007
|
} catch {}
|
|
3996
4008
|
};
|
|
3997
|
-
return /* @__PURE__ */
|
|
4009
|
+
return /* @__PURE__ */ P("div", {
|
|
3998
4010
|
className: "flex flex-col gap-2",
|
|
3999
|
-
children: [/* @__PURE__ */
|
|
4011
|
+
children: [/* @__PURE__ */ P("div", {
|
|
4000
4012
|
ref: a,
|
|
4001
4013
|
className: "relative w-full rounded border border-oq-08 overflow-hidden",
|
|
4002
4014
|
style: { aspectRatio: `${l}` },
|
|
4003
|
-
children: [/* @__PURE__ */
|
|
4015
|
+
children: [/* @__PURE__ */ N("svg", {
|
|
4004
4016
|
className: "absolute inset-0 w-full h-full",
|
|
4005
4017
|
viewBox: "0 0 100 100",
|
|
4006
4018
|
preserveAspectRatio: "none",
|
|
4007
|
-
children: /* @__PURE__ */
|
|
4019
|
+
children: /* @__PURE__ */ N("path", {
|
|
4008
4020
|
d: u,
|
|
4009
4021
|
fill: "none",
|
|
4010
4022
|
stroke: "var(--kol-accent-primary)",
|
|
4011
4023
|
strokeWidth: 1.5,
|
|
4012
4024
|
vectorEffect: "non-scaling-stroke"
|
|
4013
4025
|
})
|
|
4014
|
-
}), c.map((e, t) => /* @__PURE__ */
|
|
4026
|
+
}), c.map((e, t) => /* @__PURE__ */ N("div", {
|
|
4015
4027
|
onPointerDown: d(t),
|
|
4016
4028
|
onPointerMove: f,
|
|
4017
4029
|
onPointerUp: p,
|
|
@@ -4028,14 +4040,14 @@ function xt({ inst: e, layer: n, onPoints: r }) {
|
|
|
4028
4040
|
boxShadow: "0 0 0 1px rgba(0,0,0,0.5)"
|
|
4029
4041
|
}
|
|
4030
4042
|
}, t))]
|
|
4031
|
-
}), /* @__PURE__ */
|
|
4043
|
+
}), /* @__PURE__ */ P("div", {
|
|
4032
4044
|
className: "grid grid-cols-2 gap-2",
|
|
4033
|
-
children: [/* @__PURE__ */
|
|
4045
|
+
children: [/* @__PURE__ */ N(O, {
|
|
4034
4046
|
variant: "primary",
|
|
4035
4047
|
size: i,
|
|
4036
4048
|
onClick: () => r([...c, [.5, .5]]),
|
|
4037
4049
|
children: "Add point"
|
|
4038
|
-
}), /* @__PURE__ */
|
|
4050
|
+
}), /* @__PURE__ */ N(O, {
|
|
4039
4051
|
variant: "primary",
|
|
4040
4052
|
size: i,
|
|
4041
4053
|
disabled: c.length <= 2,
|
|
@@ -4045,258 +4057,146 @@ function xt({ inst: e, layer: n, onPoints: r }) {
|
|
|
4045
4057
|
})]
|
|
4046
4058
|
});
|
|
4047
4059
|
}
|
|
4048
|
-
function
|
|
4049
|
-
let i =
|
|
4060
|
+
function wt({ layer: e, setProp: t, insts: n, renderAnimate: r }) {
|
|
4061
|
+
let i = dt, a = e[i.key], o = f(a), s = n.find((e) => e?.morph?.on)?.morph?.blend ?? i.default, c = typeof a == "number" ? a : s, l = o ? /* @__PURE__ */ N("div", {
|
|
4050
4062
|
className: "kol-helper-12 text-meta italic px-1",
|
|
4051
4063
|
children: "animated"
|
|
4052
|
-
}) : /* @__PURE__ */
|
|
4064
|
+
}) : /* @__PURE__ */ N(A, {
|
|
4053
4065
|
min: i.min,
|
|
4054
4066
|
max: i.max,
|
|
4055
4067
|
step: i.step,
|
|
4056
|
-
value:
|
|
4068
|
+
value: c,
|
|
4057
4069
|
onChange: (e) => t(i.key, e)
|
|
4058
4070
|
});
|
|
4059
|
-
return /* @__PURE__ */
|
|
4071
|
+
return /* @__PURE__ */ N(k, {
|
|
4060
4072
|
label: i.label,
|
|
4061
|
-
children: /* @__PURE__ */
|
|
4073
|
+
children: /* @__PURE__ */ P("div", {
|
|
4062
4074
|
className: "flex items-center gap-2",
|
|
4063
|
-
children: [/* @__PURE__ */
|
|
4075
|
+
children: [/* @__PURE__ */ N("div", {
|
|
4064
4076
|
className: "flex-1 min-w-0",
|
|
4065
|
-
children:
|
|
4077
|
+
children: l
|
|
4066
4078
|
}), r(i)]
|
|
4067
4079
|
})
|
|
4068
4080
|
});
|
|
4069
4081
|
}
|
|
4070
4082
|
//#endregion
|
|
4071
4083
|
//#region src/editor/params/TimelineDock.jsx
|
|
4072
|
-
function
|
|
4084
|
+
function Tt(e, t = []) {
|
|
4073
4085
|
for (let n of e) {
|
|
4074
4086
|
for (let e in n) {
|
|
4075
4087
|
let r = n[e];
|
|
4076
|
-
|
|
4077
|
-
|
|
4088
|
+
f(r) && r.bind === "track" && t.push({
|
|
4089
|
+
id: `${n.id}:${e}`,
|
|
4090
|
+
layerId: n.id,
|
|
4078
4091
|
key: e,
|
|
4092
|
+
label: `${D(n)} · ${e}`,
|
|
4079
4093
|
keys: r.keys
|
|
4080
4094
|
});
|
|
4081
4095
|
}
|
|
4082
|
-
Array.isArray(n.children) &&
|
|
4096
|
+
Array.isArray(n.children) && Tt(n.children, t);
|
|
4083
4097
|
}
|
|
4084
4098
|
return t;
|
|
4085
4099
|
}
|
|
4086
|
-
function
|
|
4087
|
-
let { layers:
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
/* @__PURE__ */ P(Tt, {
|
|
4101
|
-
t: i,
|
|
4102
|
-
seek: a
|
|
4103
|
-
}),
|
|
4104
|
-
o.map((e) => /* @__PURE__ */ P(Dt, {
|
|
4105
|
-
track: e,
|
|
4106
|
-
t: i,
|
|
4107
|
-
selected: s,
|
|
4108
|
-
setSelected: c,
|
|
4109
|
-
writeKeys: l
|
|
4110
|
-
}, `${e.layer.id}:${e.key}`)),
|
|
4111
|
-
/* @__PURE__ */ P(kt, {
|
|
4112
|
-
tracks: o,
|
|
4113
|
-
selected: s,
|
|
4114
|
-
setSelected: c,
|
|
4115
|
-
writeKeys: l
|
|
4116
|
-
})
|
|
4117
|
-
]
|
|
4100
|
+
function Et() {
|
|
4101
|
+
let { layers: e, updateLayer: n } = l(), { t: r, seek: i } = t(), a = he(() => Tt(e), [e]);
|
|
4102
|
+
return /* @__PURE__ */ N(le, {
|
|
4103
|
+
tracks: a,
|
|
4104
|
+
t: r,
|
|
4105
|
+
onSeek: i,
|
|
4106
|
+
onChange: (e, t) => {
|
|
4107
|
+
let r = a.find((t) => t.id === e);
|
|
4108
|
+
r && n(r.layerId, { [r.key]: {
|
|
4109
|
+
bind: "track",
|
|
4110
|
+
keys: t
|
|
4111
|
+
} });
|
|
4112
|
+
},
|
|
4113
|
+
easingOptions: h
|
|
4118
4114
|
});
|
|
4119
4115
|
}
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4116
|
+
//#endregion
|
|
4117
|
+
//#region src/editor/params/TransportBar.jsx
|
|
4118
|
+
function Dt({ seconds: e, onCommit: t, size: n }) {
|
|
4119
|
+
let r = String(e), [i, a] = M(r), [o, s] = M(!1);
|
|
4120
|
+
return me(() => {
|
|
4121
|
+
o || a(r);
|
|
4122
|
+
}, [r, o]), /* @__PURE__ */ N(j, {
|
|
4123
|
+
label: "Loop length",
|
|
4124
|
+
children: /* @__PURE__ */ N(ie, {
|
|
4125
|
+
type: "text",
|
|
4126
|
+
inputMode: "decimal",
|
|
4127
|
+
variant: "property",
|
|
4128
|
+
size: n,
|
|
4129
|
+
affordance: "Loop /",
|
|
4130
|
+
unit: "s",
|
|
4131
|
+
chars: 3,
|
|
4132
|
+
"aria-label": "Loop length in seconds",
|
|
4133
|
+
value: i,
|
|
4134
|
+
onFocus: (e) => {
|
|
4135
|
+
s(!0), e.target.select();
|
|
4137
4136
|
},
|
|
4138
|
-
|
|
4139
|
-
|
|
4137
|
+
onChange: (e) => a(e.target.value),
|
|
4138
|
+
onBlur: () => {
|
|
4139
|
+
s(!1);
|
|
4140
|
+
let e = Number(i.trim());
|
|
4141
|
+
if (i.trim() === "" || !Number.isFinite(e)) {
|
|
4142
|
+
a(r);
|
|
4143
|
+
return;
|
|
4144
|
+
}
|
|
4145
|
+
t(e);
|
|
4140
4146
|
},
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
return /* @__PURE__ */ P("span", {
|
|
4147
|
-
"aria-hidden": "true",
|
|
4148
|
-
className: "absolute top-0 bottom-0",
|
|
4149
|
-
style: {
|
|
4150
|
-
left: `${e * 100}%`,
|
|
4151
|
-
width: 1.5,
|
|
4152
|
-
background: "var(--kol-accent-primary)"
|
|
4153
|
-
}
|
|
4147
|
+
onKeyDown: (e) => {
|
|
4148
|
+
e.key === "Enter" && e.currentTarget.blur(), e.key === "Escape" && (a(r), s(!1), e.currentTarget.blur());
|
|
4149
|
+
},
|
|
4150
|
+
inputClassName: "text-center"
|
|
4151
|
+
})
|
|
4154
4152
|
});
|
|
4155
4153
|
}
|
|
4156
|
-
function
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
key: e.key,
|
|
4170
|
-
index: o.findIndex((e) => e.t === n)
|
|
4171
|
-
});
|
|
4172
|
-
}, d = (t) => (n) => {
|
|
4173
|
-
if (n.stopPropagation(), n.altKey) {
|
|
4174
|
-
e.keys.length > 1 && (i(e, e.keys.filter((e, n) => n !== t)), r(null));
|
|
4175
|
-
return;
|
|
4176
|
-
}
|
|
4177
|
-
n.currentTarget.setPointerCapture(n.pointerId), o.current = {
|
|
4178
|
-
index: t,
|
|
4179
|
-
t: e.keys[t].t
|
|
4180
|
-
}, r({
|
|
4181
|
-
layerId: e.layer.id,
|
|
4182
|
-
key: e.key,
|
|
4183
|
-
index: t
|
|
4184
|
-
});
|
|
4185
|
-
}, f = (e) => (t) => {
|
|
4186
|
-
!o.current || o.current.index !== e || (o.current.t = c(t), s((e) => e + 1));
|
|
4187
|
-
}, p = (t) => () => {
|
|
4188
|
-
if (!o.current || o.current.index !== t) return;
|
|
4189
|
-
let n = {
|
|
4190
|
-
...e.keys[t],
|
|
4191
|
-
t: o.current.t
|
|
4192
|
-
}, a = e.keys.map((e, r) => r === t ? n : e);
|
|
4193
|
-
o.current = null, i(e, a), r(null);
|
|
4194
|
-
};
|
|
4195
|
-
return /* @__PURE__ */ F("div", {
|
|
4196
|
-
className: "flex items-center gap-3",
|
|
4197
|
-
children: [/* @__PURE__ */ F("span", {
|
|
4198
|
-
className: "kol-helper-10 text-meta truncate shrink-0 text-right",
|
|
4199
|
-
style: { width: 120 },
|
|
4200
|
-
title: `${re(e.layer)} · ${e.key}`,
|
|
4201
|
-
children: [
|
|
4202
|
-
re(e.layer),
|
|
4203
|
-
" · ",
|
|
4204
|
-
e.key
|
|
4205
|
-
]
|
|
4206
|
-
}), /* @__PURE__ */ F("div", {
|
|
4207
|
-
ref: a,
|
|
4208
|
-
className: "relative flex-1 h-5 rounded cursor-copy",
|
|
4209
|
-
style: { background: "var(--kol-fg-04)" },
|
|
4210
|
-
onPointerDown: u,
|
|
4211
|
-
children: [/* @__PURE__ */ P(Et, { t }), e.keys.map((e, t) => {
|
|
4212
|
-
let n = o.current?.index === t ? o.current.t : e.t;
|
|
4213
|
-
return /* @__PURE__ */ P("span", {
|
|
4214
|
-
"data-diamond": "",
|
|
4215
|
-
onPointerDown: d(t),
|
|
4216
|
-
onPointerMove: f(t),
|
|
4217
|
-
onPointerUp: p(t),
|
|
4218
|
-
title: `t=${n.toFixed(2)} v=${typeof e.v == "number" ? Math.round(e.v * 100) / 100 : e.v} (alt-click deletes)`,
|
|
4219
|
-
className: "absolute top-1/2 cursor-grab",
|
|
4220
|
-
style: {
|
|
4221
|
-
left: `${n * 100}%`,
|
|
4222
|
-
width: 9,
|
|
4223
|
-
height: 9,
|
|
4224
|
-
transform: "translate(-50%, -50%) rotate(45deg)",
|
|
4225
|
-
background: l(t) ? "var(--kol-accent-primary)" : "var(--kol-fg-emphasis)",
|
|
4226
|
-
borderRadius: 1.5
|
|
4227
|
-
}
|
|
4228
|
-
}, t);
|
|
4229
|
-
})]
|
|
4230
|
-
})]
|
|
4154
|
+
function Ot({ icon: e, label: t, shortcut: n, onClick: r, size: i, pressed: a }) {
|
|
4155
|
+
return /* @__PURE__ */ N(j, {
|
|
4156
|
+
label: t,
|
|
4157
|
+
shortcut: n,
|
|
4158
|
+
children: /* @__PURE__ */ N(O, {
|
|
4159
|
+
variant: "ghost",
|
|
4160
|
+
size: i,
|
|
4161
|
+
iconOnly: e,
|
|
4162
|
+
iconComponent: F,
|
|
4163
|
+
"aria-label": t,
|
|
4164
|
+
pressed: a,
|
|
4165
|
+
onClick: r
|
|
4166
|
+
})
|
|
4231
4167
|
});
|
|
4232
4168
|
}
|
|
4233
|
-
function
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
if (t >= n.t) return n.v;
|
|
4238
|
-
let r = 0;
|
|
4239
|
-
for (; r < e.length - 1 && e[r + 1].t <= t;) r++;
|
|
4240
|
-
let i = e[r], a = e[r + 1];
|
|
4241
|
-
if (typeof i.v != "number" || typeof a.v != "number") return i.v;
|
|
4242
|
-
let o = a.t - i.t || 1;
|
|
4243
|
-
return i.v + (a.v - i.v) * ((t - i.t) / o);
|
|
4244
|
-
}
|
|
4245
|
-
function kt({ tracks: e, selected: t, setSelected: n, writeKeys: i }) {
|
|
4246
|
-
if (!t) return null;
|
|
4247
|
-
let a = e.find((e) => e.layer.id === t.layerId && e.key === t.key), o = a?.keys[t.index];
|
|
4248
|
-
if (!o) return null;
|
|
4249
|
-
let s = (e) => {
|
|
4250
|
-
i(a, a.keys.map((n, r) => r === t.index ? {
|
|
4251
|
-
...n,
|
|
4252
|
-
...e
|
|
4253
|
-
} : n));
|
|
4254
|
-
}, c = typeof o.v == "number";
|
|
4255
|
-
return /* @__PURE__ */ F("div", {
|
|
4256
|
-
className: "flex items-center gap-2 pt-1",
|
|
4169
|
+
function kt({ size: e = "sm" }) {
|
|
4170
|
+
let { playing: n, loopSeconds: r, play: i, pause: a, stop: o, rewind: s, setLoopSeconds: c } = t();
|
|
4171
|
+
return /* @__PURE__ */ P("div", {
|
|
4172
|
+
className: "flex items-center gap-1",
|
|
4257
4173
|
children: [
|
|
4258
|
-
/* @__PURE__ */
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
variant: "ghost",
|
|
4264
|
-
size: "sm",
|
|
4265
|
-
chars: 7,
|
|
4266
|
-
type: c ? "number" : "text",
|
|
4267
|
-
value: String(o.v),
|
|
4268
|
-
onChange: (e) => s({ v: c ? Number(e.target.value) || 0 : e.target.value })
|
|
4174
|
+
/* @__PURE__ */ N(Ot, {
|
|
4175
|
+
icon: "rewind",
|
|
4176
|
+
label: "Rewind",
|
|
4177
|
+
onClick: s,
|
|
4178
|
+
size: e
|
|
4269
4179
|
}),
|
|
4270
|
-
/* @__PURE__ */
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4180
|
+
/* @__PURE__ */ N(Ot, {
|
|
4181
|
+
icon: n ? "pause" : "play",
|
|
4182
|
+
label: n ? "Pause" : "Play",
|
|
4183
|
+
shortcut: "Space",
|
|
4184
|
+
onClick: n ? a : i,
|
|
4185
|
+
size: e
|
|
4276
4186
|
}),
|
|
4277
|
-
/* @__PURE__ */
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
border: "none",
|
|
4283
|
-
cursor: "pointer"
|
|
4284
|
-
},
|
|
4285
|
-
onClick: () => {
|
|
4286
|
-
a.keys.length > 1 && i(a, a.keys.filter((e, n) => n !== t.index)), n(null);
|
|
4287
|
-
},
|
|
4288
|
-
children: "Delete key"
|
|
4187
|
+
/* @__PURE__ */ N(Ot, {
|
|
4188
|
+
icon: "stop",
|
|
4189
|
+
label: "Stop",
|
|
4190
|
+
onClick: o,
|
|
4191
|
+
size: e
|
|
4289
4192
|
}),
|
|
4290
|
-
/* @__PURE__ */
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
},
|
|
4298
|
-
onClick: () => n(null),
|
|
4299
|
-
children: "Close"
|
|
4193
|
+
/* @__PURE__ */ N("div", {
|
|
4194
|
+
className: "ml-auto",
|
|
4195
|
+
children: /* @__PURE__ */ N(Dt, {
|
|
4196
|
+
seconds: r,
|
|
4197
|
+
onCommit: c,
|
|
4198
|
+
size: e
|
|
4199
|
+
})
|
|
4300
4200
|
})
|
|
4301
4201
|
]
|
|
4302
4202
|
});
|
|
@@ -4305,15 +4205,16 @@ function kt({ tracks: e, selected: t, setSelected: n, writeKeys: i }) {
|
|
|
4305
4205
|
//#region src/packs/motion.js
|
|
4306
4206
|
var At = {
|
|
4307
4207
|
layerTypes: ["kinetic"],
|
|
4308
|
-
kineticPresetById:
|
|
4309
|
-
presetComp:
|
|
4310
|
-
KineticType:
|
|
4311
|
-
loadFonts:
|
|
4312
|
-
warmFontCss:
|
|
4313
|
-
kineticFontCss:
|
|
4314
|
-
KineticPanel:
|
|
4315
|
-
TimelineDock:
|
|
4208
|
+
kineticPresetById: Me,
|
|
4209
|
+
presetComp: Fe,
|
|
4210
|
+
KineticType: qe,
|
|
4211
|
+
loadFonts: ee,
|
|
4212
|
+
warmFontCss: x,
|
|
4213
|
+
kineticFontCss: y,
|
|
4214
|
+
KineticPanel: _t,
|
|
4215
|
+
TimelineDock: Et,
|
|
4216
|
+
TransportBar: kt
|
|
4316
4217
|
};
|
|
4317
|
-
|
|
4218
|
+
r("motion", At);
|
|
4318
4219
|
//#endregion
|
|
4319
|
-
export { V as a,
|
|
4220
|
+
export { V as a, ut as i, Et as n, Pe as o, _t as r, Fe as s, At as t };
|