@kolkrabbi/design-editor 0.29.0 → 0.31.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-CaZu6Uuz.js → BindDot-Don6fG00.js} +5 -5
- package/dist/{Timeline-BxVRu-R0.js → Timeline-BKYyRqYg.js} +2 -2
- package/dist/{TreePicker-BQYPaQv3.js → TreePicker-1_NZG8GB.js} +1 -1
- package/dist/{core-CLlanqLg.js → core-DBXPNsjJ.js} +5422 -6412
- package/dist/core.js +5 -5
- package/dist/design-editor.css +1 -1
- package/dist/design-editor.js +1060 -714
- package/dist/{effectCategories-DJrQJ7vg.js → effectCategories-BGIW_dEc.js} +438 -438
- package/dist/{effects-dbxBWOCp.js → effects-RqPdJrRb.js} +115 -115
- package/dist/effects.js +1 -1
- package/dist/generators-BnuRmK-x.js +11148 -0
- package/dist/generators.js +1 -1
- package/dist/{host-DBTmkJuu.js → host-BUVR9I4S.js} +1 -1
- package/dist/{host-DXizGh-A.js → host-DJ8bDKO7.js} +4 -4
- package/dist/{morphStore-DaOLa9oj.js → morphStore-B5081ohW.js} +1 -1
- package/dist/{motion-CeoqVj9I.js → motion-DKZGyk14.js} +285 -285
- package/dist/motion.js +1 -1
- package/dist/{previewScale-DsG-A1ZC.js → previewScale-CA0ComGv.js} +8 -8
- package/dist/{rolls-CGma4Bua.js → rolls-CEQmdcp3.js} +865 -300
- package/dist/{src-CMdJeS6j.js → src-CzKMsyZO.js} +1 -1
- package/dist/{ColorModesWindow-D65R5YR5.js → store-D6Si8cRD.js} +407 -369
- package/dist/{useLayerEdit-CnPxtfWc.js → useLayerEdit-BF9wI5pX.js} +4 -4
- package/package.json +8 -8
- package/dist/generators-CQQxNX9W.js +0 -3200
|
@@ -21737,40 +21737,478 @@ function wi(e) {
|
|
|
21737
21737
|
return Array.isArray(e?.filters) ? e.filters.some((e) => e && e.enabled !== !1 && e.id) : !!e?.filterId;
|
|
21738
21738
|
}
|
|
21739
21739
|
//#endregion
|
|
21740
|
-
//#region src/
|
|
21741
|
-
var Ti = () =>
|
|
21740
|
+
//#region src/generate/geom.js
|
|
21741
|
+
var Ti = (e) => Math.round(e * 100) / 100;
|
|
21742
|
+
function Ei() {
|
|
21743
|
+
return {
|
|
21744
|
+
polys: [],
|
|
21745
|
+
circles: [],
|
|
21746
|
+
compounds: []
|
|
21747
|
+
};
|
|
21748
|
+
}
|
|
21749
|
+
var Di = (e) => {
|
|
21750
|
+
let t = 0;
|
|
21751
|
+
for (let n = 0, r = e.length - 1; n < e.length; r = n++) t += (e[r][0] - e[n][0]) * (e[r][1] + e[n][1]);
|
|
21752
|
+
return t / 2;
|
|
21753
|
+
};
|
|
21754
|
+
function Oi(e, t) {
|
|
21755
|
+
let n = t.filter((e) => e.length >= 3);
|
|
21756
|
+
if (!n.length) return;
|
|
21757
|
+
n.sort((e, t) => Math.abs(Di(t)) - Math.abs(Di(e)));
|
|
21758
|
+
let r = n.map((e, t) => Di(e) > 0 == (t === 0) ? e : [...e].reverse());
|
|
21759
|
+
e.compounds.push(r);
|
|
21760
|
+
}
|
|
21761
|
+
function ki(e, t, n, r, i) {
|
|
21762
|
+
r <= 0 || i <= 0 || e.polys.push([
|
|
21763
|
+
[t, n],
|
|
21764
|
+
[t + r, n],
|
|
21765
|
+
[t + r, n + i],
|
|
21766
|
+
[t, n + i]
|
|
21767
|
+
]);
|
|
21768
|
+
}
|
|
21769
|
+
function Ai(e, t, n, r, i, a) {
|
|
21770
|
+
if (r <= 0 || i <= 0) return;
|
|
21771
|
+
let o = Math.cos(a), s = Math.sin(a), c = r / 2, l = i / 2;
|
|
21772
|
+
e.polys.push([
|
|
21773
|
+
[-c, -l],
|
|
21774
|
+
[c, -l],
|
|
21775
|
+
[c, l],
|
|
21776
|
+
[-c, l]
|
|
21777
|
+
].map(([e, r]) => [t + e * o - r * s, n + e * s + r * o]));
|
|
21778
|
+
}
|
|
21779
|
+
function ji(e, t, n, r, i) {
|
|
21780
|
+
r > .05 && e.circles.push(i != null && i !== r ? [
|
|
21781
|
+
t,
|
|
21782
|
+
n,
|
|
21783
|
+
r,
|
|
21784
|
+
i
|
|
21785
|
+
] : [
|
|
21786
|
+
t,
|
|
21787
|
+
n,
|
|
21788
|
+
r
|
|
21789
|
+
]);
|
|
21790
|
+
}
|
|
21791
|
+
function Mi(e, t) {
|
|
21792
|
+
t.length >= 3 && e.polys.push(t);
|
|
21793
|
+
}
|
|
21794
|
+
function Ni(e, t) {
|
|
21795
|
+
let n = [
|
|
21796
|
+
(e) => e[0] >= t.x,
|
|
21797
|
+
(e) => e[0] <= t.x + t.w,
|
|
21798
|
+
(e) => e[1] >= t.y,
|
|
21799
|
+
(e) => e[1] <= t.y + t.h
|
|
21800
|
+
], r = [
|
|
21801
|
+
(e, n) => {
|
|
21802
|
+
let r = (t.x - e[0]) / (n[0] - e[0]);
|
|
21803
|
+
return [t.x, e[1] + r * (n[1] - e[1])];
|
|
21804
|
+
},
|
|
21805
|
+
(e, n) => {
|
|
21806
|
+
let r = (t.x + t.w - e[0]) / (n[0] - e[0]);
|
|
21807
|
+
return [t.x + t.w, e[1] + r * (n[1] - e[1])];
|
|
21808
|
+
},
|
|
21809
|
+
(e, n) => {
|
|
21810
|
+
let r = (t.y - e[1]) / (n[1] - e[1]);
|
|
21811
|
+
return [e[0] + r * (n[0] - e[0]), t.y];
|
|
21812
|
+
},
|
|
21813
|
+
(e, n) => {
|
|
21814
|
+
let r = (t.y + t.h - e[1]) / (n[1] - e[1]);
|
|
21815
|
+
return [e[0] + r * (n[0] - e[0]), t.y + t.h];
|
|
21816
|
+
}
|
|
21817
|
+
], i = e;
|
|
21818
|
+
for (let e = 0; e < 4 && i.length; e++) {
|
|
21819
|
+
let t = i;
|
|
21820
|
+
i = [];
|
|
21821
|
+
for (let a = 0; a < t.length; a++) {
|
|
21822
|
+
let o = t[(a + t.length - 1) % t.length], s = t[a], c = n[e](o);
|
|
21823
|
+
n[e](s) ? (c || i.push(r[e](o, s)), i.push(s)) : c && i.push(r[e](o, s));
|
|
21824
|
+
}
|
|
21825
|
+
}
|
|
21826
|
+
return i;
|
|
21827
|
+
}
|
|
21828
|
+
function Pi(e) {
|
|
21829
|
+
return e.polys.length + e.circles.length + (e.compounds?.length ?? 0);
|
|
21830
|
+
}
|
|
21831
|
+
function Fi(e) {
|
|
21832
|
+
let t = "";
|
|
21833
|
+
for (let n of e.polys) {
|
|
21834
|
+
t += `M${Ti(n[0][0])} ${Ti(n[0][1])}`;
|
|
21835
|
+
for (let e = 1; e < n.length; e++) t += `L${Ti(n[e][0])} ${Ti(n[e][1])}`;
|
|
21836
|
+
t += "Z";
|
|
21837
|
+
}
|
|
21838
|
+
for (let n of e.compounds ?? []) for (let e of n) {
|
|
21839
|
+
t += `M${Ti(e[0][0])} ${Ti(e[0][1])}`;
|
|
21840
|
+
for (let n = 1; n < e.length; n++) t += `L${Ti(e[n][0])} ${Ti(e[n][1])}`;
|
|
21841
|
+
t += "Z";
|
|
21842
|
+
}
|
|
21843
|
+
for (let [n, r, i, a = i] of e.circles) {
|
|
21844
|
+
let e = Ti(i), o = Ti(a);
|
|
21845
|
+
t += `M${Ti(n - i)} ${Ti(r)}a${e} ${o} 0 1 0 ${Ti(2 * i)} 0a${e} ${o} 0 1 0 ${Ti(-2 * i)} 0Z`;
|
|
21846
|
+
}
|
|
21847
|
+
return t;
|
|
21848
|
+
}
|
|
21849
|
+
var Ii = .5523;
|
|
21850
|
+
function Li(e, t, n, r = n) {
|
|
21851
|
+
let i = n * Ii, a = r * Ii;
|
|
21852
|
+
return [
|
|
21853
|
+
{
|
|
21854
|
+
x: e + n,
|
|
21855
|
+
y: t,
|
|
21856
|
+
in: {
|
|
21857
|
+
x: e + n,
|
|
21858
|
+
y: t - a
|
|
21859
|
+
},
|
|
21860
|
+
out: {
|
|
21861
|
+
x: e + n,
|
|
21862
|
+
y: t + a
|
|
21863
|
+
}
|
|
21864
|
+
},
|
|
21865
|
+
{
|
|
21866
|
+
x: e,
|
|
21867
|
+
y: t + r,
|
|
21868
|
+
in: {
|
|
21869
|
+
x: e + i,
|
|
21870
|
+
y: t + r
|
|
21871
|
+
},
|
|
21872
|
+
out: {
|
|
21873
|
+
x: e - i,
|
|
21874
|
+
y: t + r
|
|
21875
|
+
}
|
|
21876
|
+
},
|
|
21877
|
+
{
|
|
21878
|
+
x: e - n,
|
|
21879
|
+
y: t,
|
|
21880
|
+
in: {
|
|
21881
|
+
x: e - n,
|
|
21882
|
+
y: t + a
|
|
21883
|
+
},
|
|
21884
|
+
out: {
|
|
21885
|
+
x: e - n,
|
|
21886
|
+
y: t - a
|
|
21887
|
+
}
|
|
21888
|
+
},
|
|
21889
|
+
{
|
|
21890
|
+
x: e,
|
|
21891
|
+
y: t - r,
|
|
21892
|
+
in: {
|
|
21893
|
+
x: e - i,
|
|
21894
|
+
y: t - r
|
|
21895
|
+
},
|
|
21896
|
+
out: {
|
|
21897
|
+
x: e + i,
|
|
21898
|
+
y: t - r
|
|
21899
|
+
}
|
|
21900
|
+
}
|
|
21901
|
+
];
|
|
21902
|
+
}
|
|
21903
|
+
var Ri = (e) => e.map(([e, t]) => ({
|
|
21904
|
+
x: e,
|
|
21905
|
+
y: t,
|
|
21906
|
+
in: null,
|
|
21907
|
+
out: null
|
|
21908
|
+
}));
|
|
21909
|
+
function zi(e) {
|
|
21910
|
+
return [
|
|
21911
|
+
...e.polys.map((e) => ({
|
|
21912
|
+
nodes: Ri(e),
|
|
21913
|
+
holes: null
|
|
21914
|
+
})),
|
|
21915
|
+
...(e.compounds ?? []).map(([e, ...t]) => ({
|
|
21916
|
+
nodes: Ri(e),
|
|
21917
|
+
holes: t.length ? t.map(Ri) : null
|
|
21918
|
+
})),
|
|
21919
|
+
...e.circles.map(([e, t, n, r]) => ({
|
|
21920
|
+
nodes: Li(e, t, n, r),
|
|
21921
|
+
holes: null
|
|
21922
|
+
}))
|
|
21923
|
+
];
|
|
21924
|
+
}
|
|
21925
|
+
//#endregion
|
|
21926
|
+
//#region src/generate/repeat.js
|
|
21927
|
+
var Bi = (e, t) => [
|
|
21928
|
+
e[0] * t[0] + e[2] * t[1],
|
|
21929
|
+
e[1] * t[0] + e[3] * t[1],
|
|
21930
|
+
e[0] * t[2] + e[2] * t[3],
|
|
21931
|
+
e[1] * t[2] + e[3] * t[3],
|
|
21932
|
+
e[0] * t[4] + e[2] * t[5] + e[4],
|
|
21933
|
+
e[1] * t[4] + e[3] * t[5] + e[5]
|
|
21934
|
+
], Vi = (e, t) => [
|
|
21935
|
+
1,
|
|
21936
|
+
0,
|
|
21937
|
+
0,
|
|
21938
|
+
1,
|
|
21939
|
+
e,
|
|
21940
|
+
t
|
|
21941
|
+
], Hi = (e) => {
|
|
21942
|
+
let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
|
|
21943
|
+
return [
|
|
21944
|
+
n,
|
|
21945
|
+
r,
|
|
21946
|
+
-r,
|
|
21947
|
+
n,
|
|
21948
|
+
0,
|
|
21949
|
+
0
|
|
21950
|
+
];
|
|
21951
|
+
}, Ui = (e, t = e) => [
|
|
21952
|
+
e,
|
|
21953
|
+
0,
|
|
21954
|
+
0,
|
|
21955
|
+
t,
|
|
21956
|
+
0,
|
|
21957
|
+
0
|
|
21958
|
+
], Wi = (e, t, n) => Bi(Vi(e, t), Bi(n, Vi(-e, -t))), Gi = (e, t, n) => [e[0] * t + e[2] * n + e[4], e[1] * t + e[3] * n + e[5]], Ki = {
|
|
21959
|
+
repMode: "radial",
|
|
21960
|
+
repCount: 8,
|
|
21961
|
+
repRadius: 200,
|
|
21962
|
+
repPivotAngle: 90,
|
|
21963
|
+
repSpan: 360,
|
|
21964
|
+
repRotate: 0,
|
|
21965
|
+
repScale: 1,
|
|
21966
|
+
repCols: 3,
|
|
21967
|
+
repRows: 3,
|
|
21968
|
+
repGapX: 20,
|
|
21969
|
+
repGapY: 20,
|
|
21970
|
+
repRowShift: 0,
|
|
21971
|
+
repColShift: 0,
|
|
21972
|
+
repAxisAngle: 90,
|
|
21973
|
+
repAxisX: 0,
|
|
21974
|
+
repAxisY: 0,
|
|
21975
|
+
repPoint: !1,
|
|
21976
|
+
repReverse: !1
|
|
21977
|
+
};
|
|
21978
|
+
function qi(e, t) {
|
|
21979
|
+
let n = {
|
|
21980
|
+
...Ki,
|
|
21981
|
+
...e
|
|
21982
|
+
}, r = t.x + t.w / 2, i = t.y + t.h / 2, a = (e) => Wi(r, i, Bi(Hi((n.repRotate ?? 0) * e), Ui((n.repScale ?? 1) ** e))), o = [];
|
|
21983
|
+
if (n.repMode === "mirror") {
|
|
21984
|
+
let e = r + (n.repAxisX ?? 0), t = i + (n.repAxisY ?? 0), a = n.repAxisAngle ?? 90;
|
|
21985
|
+
o.push(n.repPoint ? Wi(e, t, Hi(180)) : Wi(e, t, Bi(Hi(a), Bi(Ui(1, -1), Hi(-a)))));
|
|
21986
|
+
} else if (n.repMode === "grid") {
|
|
21987
|
+
let e = Math.max(1, Math.round(n.repCols)), r = Math.max(1, Math.round(n.repRows));
|
|
21988
|
+
for (let i = 0; i < r; i++) for (let r = 0; r < e; r++) {
|
|
21989
|
+
if (!r && !i) continue;
|
|
21990
|
+
let s = i * e + r, c = r * (t.w + n.repGapX) + i * n.repRowShift, l = i * (t.h + n.repGapY) + r * n.repColShift;
|
|
21991
|
+
o.push(Bi(Vi(c, l), a(s)));
|
|
21992
|
+
}
|
|
21993
|
+
} else {
|
|
21994
|
+
let e = Math.max(1, Math.round(n.repCount)), t = (n.repPivotAngle ?? 90) * Math.PI / 180, s = r + Math.cos(t) * n.repRadius, c = i + Math.sin(t) * n.repRadius, l = (n.repSpan ?? 360) >= 360 ? 360 / e : (n.repSpan ?? 360) / Math.max(1, e - 1);
|
|
21995
|
+
for (let t = 1; t < e; t++) o.push(Bi(Wi(s, c, Hi(l * t)), a(t)));
|
|
21996
|
+
}
|
|
21997
|
+
return n.repReverse ? o.reverse() : o;
|
|
21998
|
+
}
|
|
21999
|
+
function Ji(e) {
|
|
22000
|
+
let t = e[0] * e[3] - e[1] * e[2], n = Math.sqrt(Math.abs(t));
|
|
22001
|
+
return {
|
|
22002
|
+
rotation: Math.atan2(e[1], e[0]) * 180 / Math.PI,
|
|
22003
|
+
scale: n,
|
|
22004
|
+
mirror: t < 0
|
|
22005
|
+
};
|
|
22006
|
+
}
|
|
22007
|
+
var Yi = (e) => (t) => (t.repMode ?? "radial") === e, Xi = {
|
|
22008
|
+
min: -180,
|
|
22009
|
+
max: 180,
|
|
22010
|
+
step: 1,
|
|
22011
|
+
format: (e) => `${e}°`
|
|
22012
|
+
}, Zi = [
|
|
22013
|
+
{
|
|
22014
|
+
key: "repCount",
|
|
22015
|
+
label: "Count",
|
|
22016
|
+
type: "range",
|
|
22017
|
+
min: 2,
|
|
22018
|
+
max: 64,
|
|
22019
|
+
step: 1,
|
|
22020
|
+
default: 8,
|
|
22021
|
+
when: Yi("radial")
|
|
22022
|
+
},
|
|
22023
|
+
{
|
|
22024
|
+
key: "repRadius",
|
|
22025
|
+
label: "Radius",
|
|
22026
|
+
type: "range",
|
|
22027
|
+
min: 0,
|
|
22028
|
+
max: 2e3,
|
|
22029
|
+
step: 1,
|
|
22030
|
+
default: 200,
|
|
22031
|
+
format: (e) => `${e}px`,
|
|
22032
|
+
when: Yi("radial")
|
|
22033
|
+
},
|
|
22034
|
+
{
|
|
22035
|
+
key: "repPivotAngle",
|
|
22036
|
+
label: "Pivot angle",
|
|
22037
|
+
type: "range",
|
|
22038
|
+
...Xi,
|
|
22039
|
+
default: 90,
|
|
22040
|
+
when: Yi("radial")
|
|
22041
|
+
},
|
|
22042
|
+
{
|
|
22043
|
+
key: "repSpan",
|
|
22044
|
+
label: "Span",
|
|
22045
|
+
type: "range",
|
|
22046
|
+
min: 1,
|
|
22047
|
+
max: 360,
|
|
22048
|
+
step: 1,
|
|
22049
|
+
default: 360,
|
|
22050
|
+
format: (e) => `${e}°`,
|
|
22051
|
+
when: Yi("radial")
|
|
22052
|
+
},
|
|
22053
|
+
{
|
|
22054
|
+
key: "repCols",
|
|
22055
|
+
label: "Columns",
|
|
22056
|
+
type: "range",
|
|
22057
|
+
min: 1,
|
|
22058
|
+
max: 40,
|
|
22059
|
+
step: 1,
|
|
22060
|
+
default: 3,
|
|
22061
|
+
when: Yi("grid")
|
|
22062
|
+
},
|
|
22063
|
+
{
|
|
22064
|
+
key: "repRows",
|
|
22065
|
+
label: "Rows",
|
|
22066
|
+
type: "range",
|
|
22067
|
+
min: 1,
|
|
22068
|
+
max: 40,
|
|
22069
|
+
step: 1,
|
|
22070
|
+
default: 3,
|
|
22071
|
+
when: Yi("grid")
|
|
22072
|
+
},
|
|
22073
|
+
{
|
|
22074
|
+
key: "repGapX",
|
|
22075
|
+
label: "Gap X",
|
|
22076
|
+
type: "range",
|
|
22077
|
+
min: -1e3,
|
|
22078
|
+
max: 1e3,
|
|
22079
|
+
step: 1,
|
|
22080
|
+
default: 20,
|
|
22081
|
+
format: (e) => `${e}px`,
|
|
22082
|
+
when: Yi("grid")
|
|
22083
|
+
},
|
|
22084
|
+
{
|
|
22085
|
+
key: "repGapY",
|
|
22086
|
+
label: "Gap Y",
|
|
22087
|
+
type: "range",
|
|
22088
|
+
min: -1e3,
|
|
22089
|
+
max: 1e3,
|
|
22090
|
+
step: 1,
|
|
22091
|
+
default: 20,
|
|
22092
|
+
format: (e) => `${e}px`,
|
|
22093
|
+
when: Yi("grid")
|
|
22094
|
+
},
|
|
22095
|
+
{
|
|
22096
|
+
key: "repRowShift",
|
|
22097
|
+
label: "Row shift",
|
|
22098
|
+
type: "range",
|
|
22099
|
+
min: -1e3,
|
|
22100
|
+
max: 1e3,
|
|
22101
|
+
step: 1,
|
|
22102
|
+
default: 0,
|
|
22103
|
+
format: (e) => `${e}px`,
|
|
22104
|
+
when: Yi("grid")
|
|
22105
|
+
},
|
|
22106
|
+
{
|
|
22107
|
+
key: "repColShift",
|
|
22108
|
+
label: "Column shift",
|
|
22109
|
+
type: "range",
|
|
22110
|
+
min: -1e3,
|
|
22111
|
+
max: 1e3,
|
|
22112
|
+
step: 1,
|
|
22113
|
+
default: 0,
|
|
22114
|
+
format: (e) => `${e}px`,
|
|
22115
|
+
when: Yi("grid")
|
|
22116
|
+
},
|
|
22117
|
+
{
|
|
22118
|
+
key: "repRotate",
|
|
22119
|
+
label: "Rotate per step",
|
|
22120
|
+
type: "range",
|
|
22121
|
+
...Xi,
|
|
22122
|
+
default: 0,
|
|
22123
|
+
when: (e) => !Yi("mirror")(e)
|
|
22124
|
+
},
|
|
22125
|
+
{
|
|
22126
|
+
key: "repScale",
|
|
22127
|
+
label: "Scale per step",
|
|
22128
|
+
type: "range",
|
|
22129
|
+
min: .5,
|
|
22130
|
+
max: 1.5,
|
|
22131
|
+
step: .005,
|
|
22132
|
+
default: 1,
|
|
22133
|
+
format: (e) => `${Math.round(e * 100)}%`,
|
|
22134
|
+
when: (e) => !Yi("mirror")(e)
|
|
22135
|
+
},
|
|
22136
|
+
{
|
|
22137
|
+
key: "repAxisAngle",
|
|
22138
|
+
label: "Axis angle",
|
|
22139
|
+
type: "range",
|
|
22140
|
+
...Xi,
|
|
22141
|
+
default: 90,
|
|
22142
|
+
when: Yi("mirror")
|
|
22143
|
+
},
|
|
22144
|
+
{
|
|
22145
|
+
key: "repAxisX",
|
|
22146
|
+
label: "Axis offset X",
|
|
22147
|
+
type: "range",
|
|
22148
|
+
min: -2e3,
|
|
22149
|
+
max: 2e3,
|
|
22150
|
+
step: 1,
|
|
22151
|
+
default: 0,
|
|
22152
|
+
format: (e) => `${e}px`,
|
|
22153
|
+
when: Yi("mirror")
|
|
22154
|
+
},
|
|
22155
|
+
{
|
|
22156
|
+
key: "repAxisY",
|
|
22157
|
+
label: "Axis offset Y",
|
|
22158
|
+
type: "range",
|
|
22159
|
+
min: -2e3,
|
|
22160
|
+
max: 2e3,
|
|
22161
|
+
step: 1,
|
|
22162
|
+
default: 0,
|
|
22163
|
+
format: (e) => `${e}px`,
|
|
22164
|
+
when: Yi("mirror")
|
|
22165
|
+
},
|
|
22166
|
+
{
|
|
22167
|
+
key: "repPoint",
|
|
22168
|
+
label: "Point mirror",
|
|
22169
|
+
type: "toggle",
|
|
22170
|
+
default: !1,
|
|
22171
|
+
when: Yi("mirror")
|
|
22172
|
+
},
|
|
22173
|
+
{
|
|
22174
|
+
key: "repReverse",
|
|
22175
|
+
label: "Reverse overlap",
|
|
22176
|
+
type: "toggle",
|
|
22177
|
+
default: !1
|
|
22178
|
+
}
|
|
22179
|
+
], Qi = () => P("generators"), $i = () => P("motion"), ea = (e) => P("effects")?.filterById(e) ?? null, ta = new Set([
|
|
21742
22180
|
"background",
|
|
21743
22181
|
"pattern",
|
|
21744
22182
|
"shape",
|
|
21745
22183
|
"text",
|
|
21746
22184
|
"path",
|
|
21747
22185
|
"bool"
|
|
21748
|
-
]),
|
|
22186
|
+
]), na = "kol.editor.draft", ra = new Set([
|
|
21749
22187
|
"mouseX",
|
|
21750
22188
|
"mouseY",
|
|
21751
22189
|
"layerX",
|
|
21752
22190
|
"layerY"
|
|
21753
|
-
]),
|
|
21754
|
-
for (let t in e) if (
|
|
22191
|
+
]), ia = (e) => typeof e == "object" && !!e && e.bind === "mod" && ra.has(e.source), aa = (e) => e.some((e) => {
|
|
22192
|
+
for (let t in e) if (ia(e[t])) return !0;
|
|
21755
22193
|
if (Array.isArray(e.filters)) for (let t of e.filters) {
|
|
21756
22194
|
let e = t?.params;
|
|
21757
22195
|
if (e) {
|
|
21758
|
-
for (let t in e) if (
|
|
22196
|
+
for (let t in e) if (ia(e[t])) return !0;
|
|
21759
22197
|
}
|
|
21760
22198
|
}
|
|
21761
|
-
return Array.isArray(e.children) &&
|
|
21762
|
-
}),
|
|
22199
|
+
return Array.isArray(e.children) && aa(e.children);
|
|
22200
|
+
}), oa = [
|
|
21763
22201
|
!1,
|
|
21764
22202
|
!1,
|
|
21765
22203
|
!1,
|
|
21766
22204
|
!1,
|
|
21767
22205
|
!1,
|
|
21768
22206
|
!1
|
|
21769
|
-
],
|
|
21770
|
-
let i =
|
|
22207
|
+
], sa = (e) => Kt.find((t) => t.id === e) ?? Kt[0], ca = (e, t, n, r) => {
|
|
22208
|
+
let i = sa(e), a = i.isSeed ? n[0] : void 0;
|
|
21771
22209
|
return an(i.colors, t, n, r, a);
|
|
21772
|
-
},
|
|
21773
|
-
function
|
|
22210
|
+
}, la = (e) => `${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
22211
|
+
function ua(e, t, n) {
|
|
21774
22212
|
let r = !1, i = e.map((e) => {
|
|
21775
22213
|
if (e.id === t) {
|
|
21776
22214
|
r = !0;
|
|
@@ -21781,7 +22219,7 @@ function Li(e, t, n) {
|
|
|
21781
22219
|
return t.type === "bool" && ("op" in n || "children" in n) ? ni(t) : t;
|
|
21782
22220
|
}
|
|
21783
22221
|
if (Array.isArray(e.children)) {
|
|
21784
|
-
let i =
|
|
22222
|
+
let i = ua(e.children, t, n);
|
|
21785
22223
|
if (i !== e.children) {
|
|
21786
22224
|
r = !0;
|
|
21787
22225
|
let t = {
|
|
@@ -21795,12 +22233,12 @@ function Li(e, t, n) {
|
|
|
21795
22233
|
});
|
|
21796
22234
|
return r ? i : e;
|
|
21797
22235
|
}
|
|
21798
|
-
function
|
|
22236
|
+
function da(e, t = []) {
|
|
21799
22237
|
if (!e) return t;
|
|
21800
|
-
if ((e.srcType === "video" || e.srcType === "image") && t.push(e.id), Array.isArray(e.children)) for (let n of e.children)
|
|
22238
|
+
if ((e.srcType === "video" || e.srcType === "image") && t.push(e.id), Array.isArray(e.children)) for (let n of e.children) da(n, t);
|
|
21801
22239
|
return t;
|
|
21802
22240
|
}
|
|
21803
|
-
function
|
|
22241
|
+
function fa(e, t) {
|
|
21804
22242
|
let n = !1, r = [];
|
|
21805
22243
|
for (let i of e) {
|
|
21806
22244
|
if (i.id === t) {
|
|
@@ -21808,7 +22246,7 @@ function zi(e, t) {
|
|
|
21808
22246
|
continue;
|
|
21809
22247
|
}
|
|
21810
22248
|
if (Array.isArray(i.children)) {
|
|
21811
|
-
let e =
|
|
22249
|
+
let e = fa(i.children, t);
|
|
21812
22250
|
if (e !== i.children) {
|
|
21813
22251
|
n = !0;
|
|
21814
22252
|
let t = {
|
|
@@ -21823,7 +22261,7 @@ function zi(e, t) {
|
|
|
21823
22261
|
}
|
|
21824
22262
|
return n ? r : e;
|
|
21825
22263
|
}
|
|
21826
|
-
function
|
|
22264
|
+
function pa(e, t, n, r) {
|
|
21827
22265
|
if (t == null) {
|
|
21828
22266
|
let t = [...e];
|
|
21829
22267
|
return t.splice(Math.max(0, Math.min(t.length, n)), 0, r), t;
|
|
@@ -21840,7 +22278,7 @@ function Bi(e, t, n, r) {
|
|
|
21840
22278
|
return e.type === "bool" ? ni(a) : a;
|
|
21841
22279
|
}
|
|
21842
22280
|
if (Array.isArray(e.children)) {
|
|
21843
|
-
let a =
|
|
22281
|
+
let a = pa(e.children, t, n, r);
|
|
21844
22282
|
if (a !== e.children) {
|
|
21845
22283
|
i = !0;
|
|
21846
22284
|
let t = {
|
|
@@ -21854,11 +22292,11 @@ function Bi(e, t, n, r) {
|
|
|
21854
22292
|
});
|
|
21855
22293
|
return i ? a : e;
|
|
21856
22294
|
}
|
|
21857
|
-
function
|
|
22295
|
+
function ma(e, t, n) {
|
|
21858
22296
|
let r = !1, i = e.map((e) => {
|
|
21859
22297
|
if (e.id === t) return r = !0, n;
|
|
21860
22298
|
if (Array.isArray(e.children)) {
|
|
21861
|
-
let i =
|
|
22299
|
+
let i = ma(e.children, t, n);
|
|
21862
22300
|
if (i !== e.children) {
|
|
21863
22301
|
r = !0;
|
|
21864
22302
|
let t = {
|
|
@@ -21872,7 +22310,7 @@ function Vi(e, t, n) {
|
|
|
21872
22310
|
});
|
|
21873
22311
|
return r ? i : e;
|
|
21874
22312
|
}
|
|
21875
|
-
function
|
|
22313
|
+
function ha(e, t, n = 0, r = 0, i = null) {
|
|
21876
22314
|
for (let a = 0; a < e.length; a++) {
|
|
21877
22315
|
let o = e[a];
|
|
21878
22316
|
if (o.id === t) return {
|
|
@@ -21883,13 +22321,13 @@ function Hi(e, t, n = 0, r = 0, i = null) {
|
|
|
21883
22321
|
originY: r
|
|
21884
22322
|
};
|
|
21885
22323
|
if (Array.isArray(o.children)) {
|
|
21886
|
-
let e =
|
|
22324
|
+
let e = ha(o.children, t, n + (o.x ?? 0), r + (o.y ?? 0), o);
|
|
21887
22325
|
if (e) return e;
|
|
21888
22326
|
}
|
|
21889
22327
|
}
|
|
21890
22328
|
return null;
|
|
21891
22329
|
}
|
|
21892
|
-
function
|
|
22330
|
+
function ga(e, t) {
|
|
21893
22331
|
let n = {
|
|
21894
22332
|
...t,
|
|
21895
22333
|
x: (t.x ?? 0) + (e.x ?? 0),
|
|
@@ -21909,7 +22347,7 @@ function Ui(e, t) {
|
|
|
21909
22347
|
} else i && (n.flipX = !t.flipX), a && (n.flipY = !t.flipY);
|
|
21910
22348
|
return n;
|
|
21911
22349
|
}
|
|
21912
|
-
function
|
|
22350
|
+
function _a(e) {
|
|
21913
22351
|
let t = Math.min(...e.map((e) => e.x ?? 0)), n = Math.min(...e.map((e) => e.y ?? 0));
|
|
21914
22352
|
return {
|
|
21915
22353
|
x: t,
|
|
@@ -21918,24 +22356,24 @@ function Wi(e) {
|
|
|
21918
22356
|
h: Math.max(1, Math.max(...e.map((e) => (e.y ?? 0) + (e.h ?? 0))) - n)
|
|
21919
22357
|
};
|
|
21920
22358
|
}
|
|
21921
|
-
var
|
|
21922
|
-
function
|
|
21923
|
-
let i =
|
|
22359
|
+
var va = 1080, ya = 1080, ba = ["background"], xa = 80;
|
|
22360
|
+
function Sa(e, t, n, r = ya) {
|
|
22361
|
+
let i = va - t - xa, a = r - n - xa, o = (va - t) / 2, s = (r - n) / 2;
|
|
21924
22362
|
switch (e) {
|
|
21925
22363
|
case "TL": return {
|
|
21926
|
-
x:
|
|
21927
|
-
y:
|
|
22364
|
+
x: xa,
|
|
22365
|
+
y: xa
|
|
21928
22366
|
};
|
|
21929
22367
|
case "TC": return {
|
|
21930
22368
|
x: o,
|
|
21931
|
-
y:
|
|
22369
|
+
y: xa
|
|
21932
22370
|
};
|
|
21933
22371
|
case "TR": return {
|
|
21934
22372
|
x: i,
|
|
21935
|
-
y:
|
|
22373
|
+
y: xa
|
|
21936
22374
|
};
|
|
21937
22375
|
case "ML": return {
|
|
21938
|
-
x:
|
|
22376
|
+
x: xa,
|
|
21939
22377
|
y: s
|
|
21940
22378
|
};
|
|
21941
22379
|
case "C": return {
|
|
@@ -21947,7 +22385,7 @@ function Yi(e, t, n, r = Ki) {
|
|
|
21947
22385
|
y: s
|
|
21948
22386
|
};
|
|
21949
22387
|
case "BL": return {
|
|
21950
|
-
x:
|
|
22388
|
+
x: xa,
|
|
21951
22389
|
y: a
|
|
21952
22390
|
};
|
|
21953
22391
|
case "BC": return {
|
|
@@ -21964,7 +22402,7 @@ function Yi(e, t, n, r = Ki) {
|
|
|
21964
22402
|
};
|
|
21965
22403
|
}
|
|
21966
22404
|
}
|
|
21967
|
-
var
|
|
22405
|
+
var Ca = {
|
|
21968
22406
|
family: "right-grotesk",
|
|
21969
22407
|
width: "Tight",
|
|
21970
22408
|
weight: 600,
|
|
@@ -21992,7 +22430,7 @@ var Xi = {
|
|
|
21992
22430
|
},
|
|
21993
22431
|
randomWidthLock: "",
|
|
21994
22432
|
randomWeightLock: ""
|
|
21995
|
-
},
|
|
22433
|
+
}, wa = {
|
|
21996
22434
|
shapeId: cn,
|
|
21997
22435
|
customSvg: "",
|
|
21998
22436
|
cols: 4,
|
|
@@ -22006,24 +22444,24 @@ var Xi = {
|
|
|
22006
22444
|
rules: [],
|
|
22007
22445
|
scale: 256
|
|
22008
22446
|
};
|
|
22009
|
-
function
|
|
22447
|
+
function Ta(e = {}, { color: t = "palette:secondary" } = {}) {
|
|
22010
22448
|
return {
|
|
22011
|
-
shapeId: e.shapeId ??
|
|
22012
|
-
customSvg: e.customSvg ??
|
|
22013
|
-
cols: e.cols ??
|
|
22014
|
-
rows: e.rows ??
|
|
22015
|
-
gap: e.gap ??
|
|
22016
|
-
padding: e.padding ??
|
|
22017
|
-
stretch: e.stretch ??
|
|
22018
|
-
overflow: e.overflow ??
|
|
22449
|
+
shapeId: e.shapeId ?? wa.shapeId,
|
|
22450
|
+
customSvg: e.customSvg ?? wa.customSvg,
|
|
22451
|
+
cols: e.cols ?? wa.cols,
|
|
22452
|
+
rows: e.rows ?? wa.rows,
|
|
22453
|
+
gap: e.gap ?? wa.gap,
|
|
22454
|
+
padding: e.padding ?? wa.padding,
|
|
22455
|
+
stretch: e.stretch ?? wa.stretch,
|
|
22456
|
+
overflow: e.overflow ?? wa.overflow,
|
|
22019
22457
|
bgOn: e.bg != null,
|
|
22020
|
-
bg: e.bg ??
|
|
22021
|
-
rules: e.rules ??
|
|
22022
|
-
scale: e.scale ??
|
|
22458
|
+
bg: e.bg ?? wa.bg,
|
|
22459
|
+
rules: e.rules ?? wa.rules,
|
|
22460
|
+
scale: e.scale ?? wa.scale,
|
|
22023
22461
|
color: e.color ?? t
|
|
22024
22462
|
};
|
|
22025
22463
|
}
|
|
22026
|
-
var
|
|
22464
|
+
var Ea = [], Da = [
|
|
22027
22465
|
{
|
|
22028
22466
|
id: "pattern",
|
|
22029
22467
|
label: "Pattern"
|
|
@@ -22055,28 +22493,33 @@ var $i = [], ea = [
|
|
|
22055
22493
|
{
|
|
22056
22494
|
id: "group",
|
|
22057
22495
|
label: "Empty layer"
|
|
22496
|
+
},
|
|
22497
|
+
{
|
|
22498
|
+
id: "generate",
|
|
22499
|
+
label: "Generate"
|
|
22058
22500
|
}
|
|
22059
|
-
],
|
|
22501
|
+
], Oa = {
|
|
22060
22502
|
loop: "generators",
|
|
22061
22503
|
misc: "generators",
|
|
22504
|
+
generate: "generators",
|
|
22062
22505
|
kinetic: "motion"
|
|
22063
|
-
},
|
|
22506
|
+
}, ka = () => Da.filter((e) => !Oa[e.id] || P(Oa[e.id])), Aa = (e, t = ya) => {
|
|
22064
22507
|
let n = (e) => ({ ...e }), r = (e, n, r) => ({
|
|
22065
|
-
...
|
|
22508
|
+
...Sa("C", e, n, t),
|
|
22066
22509
|
w: e,
|
|
22067
22510
|
h: n,
|
|
22068
22511
|
...r
|
|
22069
22512
|
}), i = (e) => ({
|
|
22070
22513
|
x: 0,
|
|
22071
22514
|
y: 0,
|
|
22072
|
-
w:
|
|
22515
|
+
w: va,
|
|
22073
22516
|
h: t,
|
|
22074
22517
|
...e
|
|
22075
22518
|
});
|
|
22076
22519
|
switch (e) {
|
|
22077
22520
|
case "background": return n({ color: "palette:primary" });
|
|
22078
22521
|
case "pattern": return i({
|
|
22079
|
-
...
|
|
22522
|
+
...wa,
|
|
22080
22523
|
color: "palette:secondary"
|
|
22081
22524
|
});
|
|
22082
22525
|
case "photo": return i({
|
|
@@ -22090,37 +22533,37 @@ var $i = [], ea = [
|
|
|
22090
22533
|
color: "palette:dark"
|
|
22091
22534
|
});
|
|
22092
22535
|
case "loop": {
|
|
22093
|
-
let e =
|
|
22536
|
+
let e = Qi().presetById();
|
|
22094
22537
|
return i({
|
|
22095
22538
|
loopGroup: "shape",
|
|
22096
22539
|
presetId: e.id,
|
|
22097
22540
|
presetLabel: e.label,
|
|
22098
22541
|
loopId: e.loop,
|
|
22099
|
-
...
|
|
22542
|
+
...Qi().presetParams(e),
|
|
22100
22543
|
themeId: oe().defaultTheme
|
|
22101
22544
|
});
|
|
22102
22545
|
}
|
|
22103
22546
|
case "misc": {
|
|
22104
|
-
let e =
|
|
22547
|
+
let e = Qi().presetById("paratype-o");
|
|
22105
22548
|
return i({
|
|
22106
22549
|
loopGroup: "paratype",
|
|
22107
22550
|
presetId: e.id,
|
|
22108
22551
|
presetLabel: e.label,
|
|
22109
22552
|
loopId: e.loop,
|
|
22110
|
-
...
|
|
22553
|
+
...Qi().presetParams(e),
|
|
22111
22554
|
themeId: oe().defaultTheme
|
|
22112
22555
|
});
|
|
22113
22556
|
}
|
|
22114
22557
|
case "kinetic": {
|
|
22115
|
-
let e =
|
|
22558
|
+
let e = $i().kineticPresetById();
|
|
22116
22559
|
return i({
|
|
22117
22560
|
presetId: e.id,
|
|
22118
22561
|
presetLabel: e.label,
|
|
22119
|
-
comp:
|
|
22562
|
+
comp: $i().presetComp(e)
|
|
22120
22563
|
});
|
|
22121
22564
|
}
|
|
22122
22565
|
case "text": return r(600, 120, {
|
|
22123
|
-
...
|
|
22566
|
+
...Ca,
|
|
22124
22567
|
text: "New text",
|
|
22125
22568
|
color: "palette:dark"
|
|
22126
22569
|
});
|
|
@@ -22128,6 +22571,11 @@ var $i = [], ea = [
|
|
|
22128
22571
|
children: [],
|
|
22129
22572
|
name: "Layer"
|
|
22130
22573
|
});
|
|
22574
|
+
case "generate": return i(Qi().generateParamsFor("lineScreen", "eclipse"));
|
|
22575
|
+
case "repeat": return i({
|
|
22576
|
+
...Ki,
|
|
22577
|
+
name: "Repeat"
|
|
22578
|
+
});
|
|
22131
22579
|
case "path": return {
|
|
22132
22580
|
nodes: [],
|
|
22133
22581
|
closed: !1,
|
|
@@ -22142,9 +22590,9 @@ var $i = [], ea = [
|
|
|
22142
22590
|
default: return {};
|
|
22143
22591
|
}
|
|
22144
22592
|
};
|
|
22145
|
-
function
|
|
22146
|
-
let [r, i] = D("4:5"), [a, o] = D(1080), [s, c] = D(1080), l = a / s, u = E(
|
|
22147
|
-
u.current =
|
|
22593
|
+
function ja({ children: e, persistDraft: t = !0, draftKey: n = na }) {
|
|
22594
|
+
let [r, i] = D("4:5"), [a, o] = D(1080), [s, c] = D(1080), l = a / s, u = E(ya);
|
|
22595
|
+
u.current = va / l;
|
|
22148
22596
|
let d = S((e) => {
|
|
22149
22597
|
i(e);
|
|
22150
22598
|
let t = dn[e];
|
|
@@ -22155,7 +22603,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22155
22603
|
}, []), [h, y] = D(!1), x = S(() => y((e) => !e), []), [C, O] = D(!0), k = S(() => O((e) => !e), []), [j, M] = D({
|
|
22156
22604
|
h: [],
|
|
22157
22605
|
v: []
|
|
22158
|
-
}), [N, P] = D("single"), [F, I] = D("var(--kol-surface-ab-split)"), [L, R] = D(1), [z, B] = D("var(--kol-surface-secondary)"), [V, ee] = D("fill"), [te, H] = D("#FFFFFF"), [U, ne] = D(null), [W, re] = D("brand"), [ie, G] = D("random"), [K, ae] = D(() =>
|
|
22606
|
+
}), [N, P] = D("single"), [F, I] = D("var(--kol-surface-ab-split)"), [L, R] = D(1), [z, B] = D("var(--kol-surface-secondary)"), [V, ee] = D("fill"), [te, H] = D("#FFFFFF"), [U, ne] = D(null), [W, re] = D("brand"), [ie, G] = D("random"), [K, ae] = D(() => sa("brand").defaults), [oe, se] = D(oa), [ce, le] = D(oa), [ue, de] = D(!1), [fe, q] = D(!1), [pe, me] = D(Ea), [he, ge] = D([]), _e = he[0] ?? null, [ve, ye] = D(null), [be, xe] = D(null), [Se, J] = D(!0), Ce = S(() => J((e) => !e), []), we = S((e) => {
|
|
22159
22607
|
ge(e == null ? [] : [e]);
|
|
22160
22608
|
}, []), Te = S(() => {
|
|
22161
22609
|
ge(["canvas", ...Ne.current.map((e) => e.id)]);
|
|
@@ -22187,7 +22635,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22187
22635
|
}
|
|
22188
22636
|
}, []), Le = E(null);
|
|
22189
22637
|
w(() => {
|
|
22190
|
-
let e =
|
|
22638
|
+
let e = va / (a / s), t = Le.current;
|
|
22191
22639
|
if (Le.current = e, t == null || Math.abs(t - e) < .5) return;
|
|
22192
22640
|
let n = (e) => e.x === 0 && e.y === 0 && e.w === 1080 && Math.abs(e.h - t) < .5;
|
|
22193
22641
|
X((t) => t.some(n) ? t.map((t) => n(t) ? {
|
|
@@ -22222,7 +22670,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22222
22670
|
if (e.length === 0) return;
|
|
22223
22671
|
let t = e[0], n = [...Fe.current, Ie()].slice(-100), r = e.slice(1);
|
|
22224
22672
|
Fe.current = n, Y.current = r, Ne.current = t.layers, Pe.current = t.selectedIds, ke(n), je(r), me(t.layers), ge(t.selectedIds);
|
|
22225
|
-
}, []), Ue =
|
|
22673
|
+
}, []), Ue = sa(W).isSeed, We = Ue && !fe, Ge = T(() => {
|
|
22226
22674
|
let e = K[0];
|
|
22227
22675
|
return {
|
|
22228
22676
|
primary: K[0] ?? e,
|
|
@@ -22241,14 +22689,14 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22241
22689
|
return;
|
|
22242
22690
|
}
|
|
22243
22691
|
let e = tr(Ke.current, _e);
|
|
22244
|
-
!e || !
|
|
22692
|
+
!e || !ta.has(e.type) || (e.color !== void 0 && H(Na(e.color, qe.current) ?? null), e.stroke !== void 0 && ne(Na(e.stroke, qe.current) ?? null));
|
|
22245
22693
|
}, [_e]), w(() => {
|
|
22246
|
-
wt.setPointerInterest(
|
|
22694
|
+
wt.setPointerInterest(aa(pe));
|
|
22247
22695
|
}, [pe]);
|
|
22248
22696
|
let Ye = E(te), Xe = E(U);
|
|
22249
22697
|
Ye.current = te, Xe.current = U;
|
|
22250
22698
|
let Ze = S((e, t = {}) => {
|
|
22251
|
-
let n =
|
|
22699
|
+
let n = la(e), r = ta.has(e) ? e === "background" ? { color: Ye.current } : {
|
|
22252
22700
|
color: Ye.current,
|
|
22253
22701
|
stroke: Xe.current
|
|
22254
22702
|
} : {};
|
|
@@ -22258,13 +22706,13 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22258
22706
|
visible: !0,
|
|
22259
22707
|
opacity: 1,
|
|
22260
22708
|
blend: "normal",
|
|
22261
|
-
...
|
|
22709
|
+
...Aa(e, u.current),
|
|
22262
22710
|
...r,
|
|
22263
22711
|
...t
|
|
22264
22712
|
}]), ge([n]), n;
|
|
22265
22713
|
}, [X]), Qe = S((e) => {
|
|
22266
22714
|
let t = tr(Ne.current, e);
|
|
22267
|
-
t &&
|
|
22715
|
+
t && da(t).forEach((e) => sr(e)), X((t) => fa(t, e)), ge((t) => t.includes(e) ? t.filter((t) => t !== e) : t);
|
|
22268
22716
|
}, [X]), $e = S(() => {
|
|
22269
22717
|
let e = he.filter((e) => e !== "canvas");
|
|
22270
22718
|
e.length !== 0 && (Re(), e.forEach(Qe), ze());
|
|
@@ -22274,19 +22722,19 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22274
22722
|
Re,
|
|
22275
22723
|
ze
|
|
22276
22724
|
]), et = S((e, t) => {
|
|
22277
|
-
X((n) =>
|
|
22725
|
+
X((n) => ua(n, e, t));
|
|
22278
22726
|
}, [X]), tt = S((e, t) => {
|
|
22279
22727
|
X((n) => {
|
|
22280
22728
|
let r = tr(n, e);
|
|
22281
22729
|
if (!r) return n;
|
|
22282
22730
|
let i = yi(r), a = t(i, r);
|
|
22283
|
-
return !a || a === i ? n :
|
|
22731
|
+
return !a || a === i ? n : ua(n, e, { filters: a });
|
|
22284
22732
|
});
|
|
22285
22733
|
}, [X]), nt = S((e, t) => {
|
|
22286
|
-
let n =
|
|
22734
|
+
let n = ea(t);
|
|
22287
22735
|
n && tt(e, (e) => {
|
|
22288
22736
|
if (e.length >= 8) return null;
|
|
22289
|
-
let r = e.findIndex((e) =>
|
|
22737
|
+
let r = e.findIndex((e) => ea(e.id)?.kind === "engine");
|
|
22290
22738
|
if (n.kind === "engine") return r >= 0 ? null : [...e, pi(t)];
|
|
22291
22739
|
let i;
|
|
22292
22740
|
if (n.first) {
|
|
@@ -22295,7 +22743,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22295
22743
|
} else if (n.kind === "pixi") i = r >= 0 ? r : e.length;
|
|
22296
22744
|
else {
|
|
22297
22745
|
let t = e.findIndex((e) => {
|
|
22298
|
-
let t =
|
|
22746
|
+
let t = ea(e.id)?.kind;
|
|
22299
22747
|
return t === "pixi" || t === "engine";
|
|
22300
22748
|
});
|
|
22301
22749
|
i = t >= 0 ? t : e.length;
|
|
@@ -22315,7 +22763,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22315
22763
|
if (t === n || t < 0 || t >= e.length || n < 0 || n >= e.length) return null;
|
|
22316
22764
|
let r = [...e], [i] = r.splice(t, 1);
|
|
22317
22765
|
r.splice(n, 0, i);
|
|
22318
|
-
let a = r.findIndex((e) =>
|
|
22766
|
+
let a = r.findIndex((e) => ea(e.id)?.kind === "engine");
|
|
22319
22767
|
return a >= 0 && a !== r.length - 1 ? null : r;
|
|
22320
22768
|
});
|
|
22321
22769
|
}, [tt]), ot = S((e, t, n) => {
|
|
@@ -22327,10 +22775,10 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22327
22775
|
}
|
|
22328
22776
|
} : e) : null);
|
|
22329
22777
|
}, [tt]), st = S((e, t, n) => {
|
|
22330
|
-
let r =
|
|
22778
|
+
let r = ea(n);
|
|
22331
22779
|
r && tt(e, (e) => {
|
|
22332
22780
|
if (t < 0 || t >= e.length) return null;
|
|
22333
|
-
let i = e.some((e, n) => n !== t &&
|
|
22781
|
+
let i = e.some((e, n) => n !== t && ea(e.id)?.kind === "engine");
|
|
22334
22782
|
return r.kind === "engine" && (i || t !== e.length - 1) ? null : e.map((e, r) => r === t ? {
|
|
22335
22783
|
...pi(n),
|
|
22336
22784
|
key: e.key,
|
|
@@ -22350,15 +22798,15 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22350
22798
|
}, [X]), ut = S((e, t) => {
|
|
22351
22799
|
X((n) => {
|
|
22352
22800
|
let r = tr(n, e);
|
|
22353
|
-
if (!r || r.locked ||
|
|
22801
|
+
if (!r || r.locked || ba.includes(r.type)) return n;
|
|
22354
22802
|
if (r.type === "path" && Array.isArray(r.nodes)) {
|
|
22355
22803
|
let i = t === "h" ? -1 : 1, a = t === "v" ? -1 : 1, o = m(_(r.nodes, i, a), r.holes?.map((e) => _(e, i, a)));
|
|
22356
|
-
return
|
|
22804
|
+
return ua(n, e, {
|
|
22357
22805
|
nodes: o.nodes,
|
|
22358
22806
|
holes: o.holes
|
|
22359
22807
|
});
|
|
22360
22808
|
}
|
|
22361
|
-
return r.x == null || r.w == null ? n :
|
|
22809
|
+
return r.x == null || r.w == null ? n : ua(n, e, t === "h" ? { flipX: !r.flipX } : { flipY: !r.flipY });
|
|
22362
22810
|
});
|
|
22363
22811
|
}, [X]), dt = S((e) => {
|
|
22364
22812
|
let t = he.filter((e) => e !== "canvas");
|
|
@@ -22371,7 +22819,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22371
22819
|
]), ft = S((e) => {
|
|
22372
22820
|
let t = Ne.current.filter((e) => he.includes(e.id) && Wr(e));
|
|
22373
22821
|
if (t.length < 2) return;
|
|
22374
|
-
let n = t[0], r = Qr(t, e)?.bounds ??
|
|
22822
|
+
let n = t[0], r = Qr(t, e)?.bounds ?? _a(t), i = la("bool"), a = !1;
|
|
22375
22823
|
X((o) => {
|
|
22376
22824
|
let s = new Set(t.map((e) => e.id)), c = Math.max(...o.map((e, t) => s.has(e.id) ? t : -1));
|
|
22377
22825
|
if (c < 0) return o;
|
|
@@ -22404,7 +22852,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22404
22852
|
if (e.length === 0 || e.length === 1 && e[0].type !== "bool") return;
|
|
22405
22853
|
let t = Xr(e, "unite");
|
|
22406
22854
|
if (!t || (t.nodes?.length ?? 0) < 2) return;
|
|
22407
|
-
let n = m(t.nodes, t.holes), r = e[0], i =
|
|
22855
|
+
let n = m(t.nodes, t.holes), r = e[0], i = la("path"), a = !1;
|
|
22408
22856
|
X((t) => {
|
|
22409
22857
|
let o = new Set(e.map((e) => e.id)), s = Math.max(...t.map((e, t) => o.has(e.id) ? t : -1));
|
|
22410
22858
|
if (s < 0) return t;
|
|
@@ -22461,21 +22909,21 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22461
22909
|
};
|
|
22462
22910
|
}));
|
|
22463
22911
|
}, [X]), ht = S((e, { offset: t = 24 } = {}) => {
|
|
22464
|
-
let n =
|
|
22912
|
+
let n = ha(Ne.current, e), r = n ? la(n.layer.type) : null;
|
|
22465
22913
|
return r ? (X((n) => {
|
|
22466
|
-
let i =
|
|
22914
|
+
let i = ha(n, e);
|
|
22467
22915
|
if (!i) return n;
|
|
22468
22916
|
let a = {
|
|
22469
22917
|
...i.layer,
|
|
22470
22918
|
id: r
|
|
22471
22919
|
};
|
|
22472
|
-
return Array.isArray(a.children) && (a.children =
|
|
22920
|
+
return Array.isArray(a.children) && (a.children = kt(a.children)), a.x != null && (a.x += t, a.y += t), pa(n, i.parent?.id ?? null, i.index + 1, a);
|
|
22473
22921
|
}), r) : null;
|
|
22474
22922
|
}, [X]), gt = S(() => {
|
|
22475
22923
|
X(() => []), ge([]), ye(null), xe(null);
|
|
22476
22924
|
}, [X]), _t = S((e) => {
|
|
22477
22925
|
if (!Array.isArray(e) || e.length < 2) return;
|
|
22478
|
-
let t =
|
|
22926
|
+
let t = la("group"), n = !1;
|
|
22479
22927
|
X((r) => {
|
|
22480
22928
|
let i = new Set(e), a = [], o = (e, t, n) => {
|
|
22481
22929
|
for (let r of e) {
|
|
@@ -22496,7 +22944,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22496
22944
|
x: e.x - d,
|
|
22497
22945
|
y: e.y - f
|
|
22498
22946
|
})), g = r;
|
|
22499
|
-
for (let e of a) g =
|
|
22947
|
+
for (let e of a) g = fa(g, e.id);
|
|
22500
22948
|
let _ = {
|
|
22501
22949
|
id: t,
|
|
22502
22950
|
type: "group",
|
|
@@ -22518,7 +22966,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22518
22966
|
if (r < 0) return n;
|
|
22519
22967
|
let i = n[r];
|
|
22520
22968
|
if (i.type !== "group") return n;
|
|
22521
|
-
let a = (i.children ?? []).map((e) =>
|
|
22969
|
+
let a = (i.children ?? []).map((e) => ga(i, e));
|
|
22522
22970
|
t = a.map((e) => e.id);
|
|
22523
22971
|
let o = [...n];
|
|
22524
22972
|
return o.splice(r, 1, ...a), o;
|
|
@@ -22530,7 +22978,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22530
22978
|
if (r < 0) return n;
|
|
22531
22979
|
let i = n[r];
|
|
22532
22980
|
if (i.type !== "bool") return n;
|
|
22533
|
-
let a = (i.children ?? []).map((e) =>
|
|
22981
|
+
let a = (i.children ?? []).map((e) => ga(i, e));
|
|
22534
22982
|
t = a.map((e) => e.id);
|
|
22535
22983
|
let o = [...n];
|
|
22536
22984
|
return o.splice(r, 1, ...a), o;
|
|
@@ -22539,20 +22987,20 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22539
22987
|
if (!e || e === "canvas" || e === t) return;
|
|
22540
22988
|
let r = !1;
|
|
22541
22989
|
X((i) => {
|
|
22542
|
-
let a =
|
|
22990
|
+
let a = ha(i, e);
|
|
22543
22991
|
if (!a) return i;
|
|
22544
22992
|
let o = a.layer;
|
|
22545
22993
|
if (t != null) {
|
|
22546
22994
|
let e = tr(i, t);
|
|
22547
22995
|
if (!e || e.type !== "group" && e.type !== "bool" || tr([o], t) || e.type === "bool" && !Ur(o)) return i;
|
|
22548
22996
|
}
|
|
22549
|
-
let s = a.originX + (o.x ?? 0), c = a.originY + (o.y ?? 0), l =
|
|
22997
|
+
let s = a.originX + (o.x ?? 0), c = a.originY + (o.y ?? 0), l = fa(i, e), u = 0, d = 0;
|
|
22550
22998
|
if (t != null) {
|
|
22551
|
-
let e =
|
|
22999
|
+
let e = ha(l, t);
|
|
22552
23000
|
if (!e) return i;
|
|
22553
23001
|
u = e.originX + (e.layer.x ?? 0), d = e.originY + (e.layer.y ?? 0);
|
|
22554
23002
|
}
|
|
22555
|
-
return r = !0,
|
|
23003
|
+
return r = !0, pa(l, t, n, {
|
|
22556
23004
|
...o,
|
|
22557
23005
|
x: s - u,
|
|
22558
23006
|
y: c - d
|
|
@@ -22560,9 +23008,9 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22560
23008
|
}), r && ge([e]);
|
|
22561
23009
|
}, [X]), xt = S((e, t) => {
|
|
22562
23010
|
X((n) => {
|
|
22563
|
-
let r = Pe.current.filter((e) => e !== "canvas").map((e) =>
|
|
23011
|
+
let r = Pe.current.filter((e) => e !== "canvas").map((e) => ha(n, e)).filter((e) => e && typeof e.layer.x == "number" && typeof e.layer.y == "number" && !e.layer.locked);
|
|
22564
23012
|
if (r.length < 1) return n;
|
|
22565
|
-
let i = r.map((e) => e.originX + e.layer.x), a = r.map((e) => e.originY + e.layer.y), o = r.map((e, t) => i[t] + (e.layer.w ?? 0)), s = r.map((e, t) => a[t] + (e.layer.h ?? 0)), c = r.length === 1, l = c ? 0 : Math.min(...i), d = c ? 0 : Math.min(...a), f = c ?
|
|
23013
|
+
let i = r.map((e) => e.originX + e.layer.x), a = r.map((e) => e.originY + e.layer.y), o = r.map((e, t) => i[t] + (e.layer.w ?? 0)), s = r.map((e, t) => a[t] + (e.layer.h ?? 0)), c = r.length === 1, l = c ? 0 : Math.min(...i), d = c ? 0 : Math.min(...a), f = c ? va : Math.max(...o) - l, p = c ? u.current : Math.max(...s) - d, m = null;
|
|
22566
23014
|
if (t === "distribute") {
|
|
22567
23015
|
if (r.length < 3) return n;
|
|
22568
23016
|
let t = e === "h" ? i : a, o = r.map((t) => e === "h" ? t.layer.w ?? 0 : t.layer.h ?? 0), s = r.map((e, t) => t).sort((e, n) => t[e] - t[n]), c = s[0], l = s[s.length - 1], u = (t[l] + o[l] - t[c] - o.reduce((e, t) => e + t, 0)) / (s.length - 1);
|
|
@@ -22576,10 +23024,10 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22576
23024
|
return r.forEach((n, r) => {
|
|
22577
23025
|
let o = n.layer, s = i[r], c = a[r];
|
|
22578
23026
|
m ? e === "h" ? s = m[r] : c = m[r] : e === "h" ? (t === "start" && (s = l), t === "center" && (s = l + (f - (o.w ?? 0)) / 2), t === "end" && (s = l + f - (o.w ?? 0))) : e === "v" && (t === "start" && (c = d), t === "center" && (c = d + (p - (o.h ?? 0)) / 2), t === "end" && (c = d + p - (o.h ?? 0)));
|
|
22579
|
-
let u =
|
|
23027
|
+
let u = ha(h, o.id);
|
|
22580
23028
|
if (!u) return;
|
|
22581
23029
|
let g = s - u.originX, _ = c - u.originY;
|
|
22582
|
-
e === "h" && g !== u.layer.x && (h =
|
|
23030
|
+
e === "h" && g !== u.layer.x && (h = ua(h, o.id, { x: g })), e === "v" && _ !== u.layer.y && (h = ua(h, o.id, { y: _ }));
|
|
22583
23031
|
}), h;
|
|
22584
23032
|
});
|
|
22585
23033
|
}, [X]), St = S((e) => {
|
|
@@ -22588,7 +23036,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22588
23036
|
if (!n || n.type !== "pattern") return t;
|
|
22589
23037
|
let r = ln(n.shapeId, n.customSvg);
|
|
22590
23038
|
if (!r) return t;
|
|
22591
|
-
let i =
|
|
23039
|
+
let i = Na(n.color, Ge) ?? "#FFFFFF", a = n.bgOn ? Na(n.bg, Ge) ?? null : null, o = Na(n.stroke, Ge), s = n.strokeWidth ?? 0, c = vn({
|
|
22592
23040
|
shapeSvg: r,
|
|
22593
23041
|
cols: n.cols,
|
|
22594
23042
|
rows: n.rows,
|
|
@@ -22602,7 +23050,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22602
23050
|
stroke: s > 0 ? o : null,
|
|
22603
23051
|
strokeWidth: s,
|
|
22604
23052
|
size: n.scale ?? 256
|
|
22605
|
-
}), l =
|
|
23053
|
+
}), l = la("shape"), u = la("group"), d = {
|
|
22606
23054
|
id: l,
|
|
22607
23055
|
type: "shape",
|
|
22608
23056
|
kind: "flatten",
|
|
@@ -22616,7 +23064,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22616
23064
|
opacity: 1,
|
|
22617
23065
|
blend: "normal"
|
|
22618
23066
|
};
|
|
22619
|
-
return
|
|
23067
|
+
return ma(t, e, {
|
|
22620
23068
|
id: u,
|
|
22621
23069
|
type: "group",
|
|
22622
23070
|
x: n.x ?? 0,
|
|
@@ -22629,10 +23077,123 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22629
23077
|
children: [d]
|
|
22630
23078
|
});
|
|
22631
23079
|
});
|
|
22632
|
-
}, [X, Ge]), Ct = S(
|
|
23080
|
+
}, [X, Ge]), Ct = S((e) => {
|
|
23081
|
+
X((t) => {
|
|
23082
|
+
let n = tr(t, e);
|
|
23083
|
+
if (!n || n.type !== "generate") return t;
|
|
23084
|
+
let { generateMarks: r, generateBody: i } = Qi(), a = r(n), o = Na(n.color, Ge) ?? "#FFFFFF", s = n.bg == null ? null : Na(n.bg, Ge), c = n.x ?? 0, l = n.y ?? 0, u = n.w ?? 1080, d = n.h ?? 1080, f = {
|
|
23085
|
+
visible: !0,
|
|
23086
|
+
opacity: 1,
|
|
23087
|
+
blend: "normal"
|
|
23088
|
+
}, p = [];
|
|
23089
|
+
if (s && p.push({
|
|
23090
|
+
...f,
|
|
23091
|
+
id: la("shape"),
|
|
23092
|
+
type: "shape",
|
|
23093
|
+
kind: "rect",
|
|
23094
|
+
x: c,
|
|
23095
|
+
y: l,
|
|
23096
|
+
w: u,
|
|
23097
|
+
h: d,
|
|
23098
|
+
color: s,
|
|
23099
|
+
name: "Ground"
|
|
23100
|
+
}), Pi(a) <= 2e3) for (let e of zi(a)) {
|
|
23101
|
+
let t = m(e.nodes, e.holes), n = Math.floor(c + t.dx), r = Math.floor(l + t.dy), i = c + t.dx - n, a = l + t.dy - r, s = (e) => e.map((e) => v(e, i, a));
|
|
23102
|
+
p.push({
|
|
23103
|
+
...f,
|
|
23104
|
+
id: la("path"),
|
|
23105
|
+
type: "path",
|
|
23106
|
+
nodes: s(t.nodes),
|
|
23107
|
+
holes: t.holes?.length ? t.holes.map(s) : void 0,
|
|
23108
|
+
closed: !0,
|
|
23109
|
+
x: n,
|
|
23110
|
+
y: r,
|
|
23111
|
+
w: Math.ceil(t.w + i),
|
|
23112
|
+
h: Math.ceil(t.h + a),
|
|
23113
|
+
color: o,
|
|
23114
|
+
stroke: null,
|
|
23115
|
+
strokeWidth: 0
|
|
23116
|
+
});
|
|
23117
|
+
}
|
|
23118
|
+
else {
|
|
23119
|
+
let e = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${u} ${d}">${i(n, {
|
|
23120
|
+
ink: o,
|
|
23121
|
+
bg: null
|
|
23122
|
+
}, a)}</svg>`;
|
|
23123
|
+
p.push({
|
|
23124
|
+
...f,
|
|
23125
|
+
id: la("shape"),
|
|
23126
|
+
type: "shape",
|
|
23127
|
+
kind: "flatten",
|
|
23128
|
+
svg: e,
|
|
23129
|
+
fit: "fill",
|
|
23130
|
+
x: c,
|
|
23131
|
+
y: l,
|
|
23132
|
+
w: u,
|
|
23133
|
+
h: d,
|
|
23134
|
+
name: "Marks"
|
|
23135
|
+
});
|
|
23136
|
+
}
|
|
23137
|
+
return ma(t, e, {
|
|
23138
|
+
id: la("group"),
|
|
23139
|
+
type: "group",
|
|
23140
|
+
name: n.genLabel ?? "Generate",
|
|
23141
|
+
x: c,
|
|
23142
|
+
y: l,
|
|
23143
|
+
w: u,
|
|
23144
|
+
h: d,
|
|
23145
|
+
visible: n.visible ?? !0,
|
|
23146
|
+
opacity: n.opacity ?? 1,
|
|
23147
|
+
blend: n.blend ?? "normal",
|
|
23148
|
+
children: p
|
|
23149
|
+
});
|
|
23150
|
+
});
|
|
23151
|
+
}, [X, Ge]), Tt = S((e) => {
|
|
23152
|
+
X((t) => {
|
|
23153
|
+
let n = tr(t, e);
|
|
23154
|
+
if (!n || n.type !== "repeat") return t;
|
|
23155
|
+
let r = n.sourceId ? tr(t, n.sourceId) : null;
|
|
23156
|
+
if (!r || r.w == null) return t;
|
|
23157
|
+
let i = {
|
|
23158
|
+
x: r.x ?? 0,
|
|
23159
|
+
y: r.y ?? 0,
|
|
23160
|
+
w: r.w,
|
|
23161
|
+
h: r.h
|
|
23162
|
+
}, a = i.x + i.w / 2, o = i.y + i.h / 2, s = (e) => ({
|
|
23163
|
+
...e,
|
|
23164
|
+
id: la(e.type),
|
|
23165
|
+
...e.children ? { children: e.children.map(s) } : {}
|
|
23166
|
+
}), c = qi(n, i).map((e) => {
|
|
23167
|
+
let { rotation: t, scale: n, mirror: c } = Ji(e), [l, u] = Gi(e, a, o), d = i.w * n, f = i.h * n, p = r.rotation ?? 0, m = s(r), h = m.nodes;
|
|
23168
|
+
return m.type === "path" && h && n !== 1 && (h = _(h, n, n)), {
|
|
23169
|
+
...m,
|
|
23170
|
+
...h ? { nodes: h } : {},
|
|
23171
|
+
x: l - d / 2,
|
|
23172
|
+
y: u - f / 2,
|
|
23173
|
+
w: d,
|
|
23174
|
+
h: f,
|
|
23175
|
+
rotation: c ? t - p : p + t,
|
|
23176
|
+
...c ? { flipY: !r.flipY } : {}
|
|
23177
|
+
};
|
|
23178
|
+
});
|
|
23179
|
+
return ma(t, e, {
|
|
23180
|
+
id: la("group"),
|
|
23181
|
+
type: "group",
|
|
23182
|
+
name: n.name ?? "Repeat",
|
|
23183
|
+
x: 0,
|
|
23184
|
+
y: 0,
|
|
23185
|
+
w: va,
|
|
23186
|
+
h: u.current ?? 1080,
|
|
23187
|
+
visible: n.visible ?? !0,
|
|
23188
|
+
opacity: n.opacity ?? 1,
|
|
23189
|
+
blend: n.blend ?? "normal",
|
|
23190
|
+
children: c
|
|
23191
|
+
});
|
|
23192
|
+
});
|
|
23193
|
+
}, [X]), Et = S(async (e) => {
|
|
22633
23194
|
let t = tr(Ne.current, e);
|
|
22634
23195
|
if (!t || t.type !== "text") return;
|
|
22635
|
-
let n =
|
|
23196
|
+
let n = Na(t.color, Ge) ?? "#FFFFFF", { glyphs: r, offset: i } = await er({
|
|
22636
23197
|
...t,
|
|
22637
23198
|
x: 0,
|
|
22638
23199
|
y: 0,
|
|
@@ -22642,7 +23203,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22642
23203
|
let o = t.size ?? 96, s = o, c = a.map((e) => {
|
|
22643
23204
|
let { x1: t, y1: r, x2: a, y2: o } = e.bbox, c = Math.max(a - t, 4), l = Math.max(o - r, 4), u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c.toFixed(2)} ${l.toFixed(2)}" preserveAspectRatio="none"><path d="${e.d}" transform="translate(${(-t).toFixed(2)} ${(-r).toFixed(2)})" fill="currentColor" fill-rule="evenodd"/></svg>`;
|
|
22644
23205
|
return {
|
|
22645
|
-
id:
|
|
23206
|
+
id: la("shape"),
|
|
22646
23207
|
type: "shape",
|
|
22647
23208
|
kind: "flatten",
|
|
22648
23209
|
svg: u,
|
|
@@ -22657,7 +23218,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22657
23218
|
blend: "normal"
|
|
22658
23219
|
};
|
|
22659
23220
|
}), l = {
|
|
22660
|
-
id:
|
|
23221
|
+
id: la("group"),
|
|
22661
23222
|
type: "group",
|
|
22662
23223
|
x: t.x ?? 0,
|
|
22663
23224
|
y: t.y ?? 0,
|
|
@@ -22668,19 +23229,19 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22668
23229
|
blend: t.blend ?? "normal",
|
|
22669
23230
|
children: c
|
|
22670
23231
|
};
|
|
22671
|
-
X((t) =>
|
|
22672
|
-
}, [X, Ge]),
|
|
23232
|
+
X((t) => ma(t, e, l));
|
|
23233
|
+
}, [X, Ge]), Dt = S((e) => {
|
|
22673
23234
|
X((t) => {
|
|
22674
23235
|
let n = tr(t, e);
|
|
22675
23236
|
if (!n) return t;
|
|
22676
23237
|
let r = {
|
|
22677
|
-
fg:
|
|
22678
|
-
bg: n.bgOn === !1 ? null :
|
|
22679
|
-
}, i =
|
|
22680
|
-
return i ?
|
|
23238
|
+
fg: Na(n.fg, Ge) ?? "#e8e4dc",
|
|
23239
|
+
bg: n.bgOn === !1 ? null : Na(n.bg, Ge) ?? "#0b0b0e"
|
|
23240
|
+
}, i = Qi()?.buildParatypeFlattenGroup(n, r, la);
|
|
23241
|
+
return i ? ma(t, e, i) : t;
|
|
22681
23242
|
});
|
|
22682
|
-
}, [X, Ge]),
|
|
22683
|
-
let t =
|
|
23243
|
+
}, [X, Ge]), Ot = S(async (e) => {
|
|
23244
|
+
let t = Na(e.color, Ge) ?? "#FFFFFF", { glyphs: n, offset: r } = await er({
|
|
22684
23245
|
...e,
|
|
22685
23246
|
x: 0,
|
|
22686
23247
|
y: 0,
|
|
@@ -22690,7 +23251,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22690
23251
|
let a = e.size ?? 96, o = a, s = i.map((e) => {
|
|
22691
23252
|
let { x1: n, y1: i, x2: a, y2: s } = e.bbox, c = Math.max(a - n, 4), l = Math.max(s - i, 4), u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${c.toFixed(2)} ${l.toFixed(2)}" preserveAspectRatio="none"><path d="${e.d}" transform="translate(${(-n).toFixed(2)} ${(-i).toFixed(2)})" fill="currentColor" fill-rule="evenodd"/></svg>`;
|
|
22692
23253
|
return {
|
|
22693
|
-
id:
|
|
23254
|
+
id: la("shape"),
|
|
22694
23255
|
type: "shape",
|
|
22695
23256
|
kind: "flatten",
|
|
22696
23257
|
svg: u,
|
|
@@ -22704,8 +23265,8 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22704
23265
|
opacity: 1,
|
|
22705
23266
|
blend: "normal"
|
|
22706
23267
|
};
|
|
22707
|
-
}), c = e.w ?? 600, l = e.h ?? a * 1.2, { x: d, y: f } =
|
|
22708
|
-
id:
|
|
23268
|
+
}), c = e.w ?? 600, l = e.h ?? a * 1.2, { x: d, y: f } = Sa("C", c, l, u.current), p = {
|
|
23269
|
+
id: la("group"),
|
|
22709
23270
|
type: "group",
|
|
22710
23271
|
x: d,
|
|
22711
23272
|
y: f,
|
|
@@ -22717,14 +23278,14 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22717
23278
|
children: s
|
|
22718
23279
|
};
|
|
22719
23280
|
X((e) => [...e, p]), ge([p.id]);
|
|
22720
|
-
}, [X, Ge]),
|
|
23281
|
+
}, [X, Ge]), kt = (e) => vi(Array.isArray(e) ? e : []).map((e) => ({
|
|
22721
23282
|
...e,
|
|
22722
|
-
id:
|
|
22723
|
-
...Array.isArray(e.children) ? { children:
|
|
22724
|
-
})),
|
|
23283
|
+
id: la(e.type ?? "layer"),
|
|
23284
|
+
...Array.isArray(e.children) ? { children: kt(e.children) } : {}
|
|
23285
|
+
})), At = S((e) => {
|
|
22725
23286
|
if (!e) return;
|
|
22726
23287
|
e.aspect && i(e.aspect), typeof e.canvasW == "number" && typeof e.canvasH == "number" ? (o(e.canvasW), c(e.canvasH)) : e.aspect && dn[e.aspect] && (o(dn[e.aspect].w), c(dn[e.aspect].h)), e.palette && (e.palette.poolId && re(e.palette.poolId), e.palette.modeId && G(e.palette.modeId), Array.isArray(e.palette.colors) && ae(e.palette.colors), Array.isArray(e.palette.locks) && se(e.palette.locks));
|
|
22727
|
-
let t =
|
|
23288
|
+
let t = kt(e.layers), n = [], r = (e, t) => (e ?? []).forEach((e, i) => {
|
|
22728
23289
|
n.push([e, t[i]]), Array.isArray(e?.children) && r(e.children, t[i]?.children);
|
|
22729
23290
|
});
|
|
22730
23291
|
r(e.layers, t);
|
|
@@ -22741,10 +23302,10 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22741
23302
|
me((e) => r(e));
|
|
22742
23303
|
});
|
|
22743
23304
|
e.intent === "partial" ? X((e) => [...e, ...t]) : (X(() => t), ye(e.shipped ? null : e.id ?? null), xe(e.name ?? null)), ge([]);
|
|
22744
|
-
}, [X]),
|
|
23305
|
+
}, [X]), jt = S((e, t, n = null) => {
|
|
22745
23306
|
if (t) {
|
|
22746
23307
|
if (e === "preset" && Array.isArray(t.layers)) {
|
|
22747
|
-
let e =
|
|
23308
|
+
let e = kt(t.layers), r = n && e[0] != null ? {
|
|
22748
23309
|
dx: n.vx - (e[0].x ?? 0) - (e[0].w ?? 0) / 2,
|
|
22749
23310
|
dy: n.vy - (e[0].y ?? 0) - (e[0].h ?? 0) / 2
|
|
22750
23311
|
} : null, i = r ? e.map((e) => e.x == null ? e : {
|
|
@@ -22757,16 +23318,16 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22757
23318
|
}
|
|
22758
23319
|
if (e === "pattern") {
|
|
22759
23320
|
let e = {
|
|
22760
|
-
id:
|
|
23321
|
+
id: la("pattern"),
|
|
22761
23322
|
type: "pattern",
|
|
22762
23323
|
visible: !0,
|
|
22763
23324
|
opacity: 1,
|
|
22764
23325
|
blend: "normal",
|
|
22765
23326
|
x: 0,
|
|
22766
23327
|
y: 0,
|
|
22767
|
-
w:
|
|
23328
|
+
w: va,
|
|
22768
23329
|
h: u.current,
|
|
22769
|
-
...
|
|
23330
|
+
...Ta(t)
|
|
22770
23331
|
};
|
|
22771
23332
|
X((t) => [...t, e]), ge([e.id]);
|
|
22772
23333
|
return;
|
|
@@ -22775,8 +23336,8 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22775
23336
|
let e = n ? {
|
|
22776
23337
|
x: n.vx - 600 / 2,
|
|
22777
23338
|
y: n.vy - 120 / 2
|
|
22778
|
-
} :
|
|
22779
|
-
id:
|
|
23339
|
+
} : Sa("C", 600, 120, u.current), r = {
|
|
23340
|
+
id: la("text"),
|
|
22780
23341
|
type: "text",
|
|
22781
23342
|
visible: !0,
|
|
22782
23343
|
opacity: 1,
|
|
@@ -22799,11 +23360,11 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22799
23360
|
X((e) => [...e, r]), ge([r.id]);
|
|
22800
23361
|
}
|
|
22801
23362
|
}
|
|
22802
|
-
}, [X]),
|
|
23363
|
+
}, [X]), Mt = b(), Nt = E(!1), Pt = E(!1);
|
|
22803
23364
|
w(() => {
|
|
22804
|
-
if (
|
|
23365
|
+
if (Nt.current || (Nt.current = !0, !t)) return;
|
|
22805
23366
|
let e = (e) => {
|
|
22806
|
-
|
|
23367
|
+
Pt.current = !0, cr(e);
|
|
22807
23368
|
};
|
|
22808
23369
|
{
|
|
22809
23370
|
let t = new URLSearchParams(window.location.search);
|
|
@@ -22816,7 +23377,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22816
23377
|
try {
|
|
22817
23378
|
r = localStorage.getItem(n);
|
|
22818
23379
|
} catch {
|
|
22819
|
-
|
|
23380
|
+
Pt.current = !0;
|
|
22820
23381
|
return;
|
|
22821
23382
|
}
|
|
22822
23383
|
if (!r) {
|
|
@@ -22841,7 +23402,7 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22841
23402
|
return;
|
|
22842
23403
|
}
|
|
22843
23404
|
(async () => {
|
|
22844
|
-
if (await
|
|
23405
|
+
if (await Mt.confirm("Restore your last canvas?", {
|
|
22845
23406
|
okLabel: "Restore",
|
|
22846
23407
|
cancelLabel: "New file"
|
|
22847
23408
|
})) {
|
|
@@ -22860,8 +23421,8 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22860
23421
|
e(Ne.current);
|
|
22861
23422
|
}
|
|
22862
23423
|
})();
|
|
22863
|
-
}, [
|
|
22864
|
-
if (!
|
|
23424
|
+
}, [Mt]), w(() => {
|
|
23425
|
+
if (!Pt.current) return;
|
|
22865
23426
|
let e = setTimeout(() => {
|
|
22866
23427
|
try {
|
|
22867
23428
|
if (pe.length === 0) {
|
|
@@ -22916,25 +23477,25 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22916
23477
|
U,
|
|
22917
23478
|
V
|
|
22918
23479
|
]);
|
|
22919
|
-
let
|
|
23480
|
+
let Ft = S((e, t) => {
|
|
22920
23481
|
X((n) => {
|
|
22921
|
-
let r =
|
|
23482
|
+
let r = ha(n, e);
|
|
22922
23483
|
if (!r) return n;
|
|
22923
23484
|
let i = [...r.parent ? r.parent.children ?? [] : n];
|
|
22924
23485
|
i.splice(r.index, 1);
|
|
22925
23486
|
let a = Math.max(0, Math.min(i.length, t));
|
|
22926
|
-
return a === r.index ? n : (i.splice(a, 0, r.layer), r.parent ?
|
|
23487
|
+
return a === r.index ? n : (i.splice(a, 0, r.layer), r.parent ? ua(n, r.parent.id, { children: i }) : i);
|
|
22927
23488
|
});
|
|
22928
|
-
}, [X]),
|
|
22929
|
-
re(e), ae(
|
|
22930
|
-
}, []),
|
|
22931
|
-
G(e),
|
|
22932
|
-
}, [W, K]),
|
|
23489
|
+
}, [X]), It = S((e) => {
|
|
23490
|
+
re(e), ae(sa(e).defaults), se(oa), le(oa), q(!1);
|
|
23491
|
+
}, []), Lt = S((e) => {
|
|
23492
|
+
G(e), sa(W).isSeed || (ae(ca(W, e, K, oa)), se(oa), le(oa));
|
|
23493
|
+
}, [W, K]), Rt = S((e) => {
|
|
22933
23494
|
se((t) => t.map((t, n) => n === e ? !t : t));
|
|
22934
|
-
}, []),
|
|
23495
|
+
}, []), zt = S((e, t) => {
|
|
22935
23496
|
ae((n) => n.map((n, r) => r === e ? t : n)), We && e === 0 || le((t) => t.map((t, n) => n === e ? !0 : t));
|
|
22936
|
-
}, [We]),
|
|
22937
|
-
let e =
|
|
23497
|
+
}, [We]), Bt = S(() => {
|
|
23498
|
+
let e = ca(W, ie, K, oe), t = e.map((e, t) => t).filter((e) => !oe[e]), n = t.map((t) => e[t]);
|
|
22938
23499
|
for (let e = n.length - 1; e > 0; e--) {
|
|
22939
23500
|
let t = Math.floor(Math.random() * (e + 1));
|
|
22940
23501
|
[n[e], n[t]] = [n[t], n[e]];
|
|
@@ -22949,11 +23510,11 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
22949
23510
|
K,
|
|
22950
23511
|
oe,
|
|
22951
23512
|
Ue
|
|
22952
|
-
]),
|
|
22953
|
-
se(
|
|
22954
|
-
}, [W]),
|
|
22955
|
-
e && (e.poolId && re(e.poolId), e.modeId && G(e.modeId), Array.isArray(e.colors) && ae(e.colors), typeof e.bgEnabled == "boolean" && de(e.bgEnabled), se(
|
|
22956
|
-
}, []),
|
|
23513
|
+
]), Ht = S(() => {
|
|
23514
|
+
se(oa), ae(sa(W).defaults), le(oa), q(!1);
|
|
23515
|
+
}, [W]), Ut = S(() => de((e) => !e), []), Z = S((e) => {
|
|
23516
|
+
e && (e.poolId && re(e.poolId), e.modeId && G(e.modeId), Array.isArray(e.colors) && ae(e.colors), typeof e.bgEnabled == "boolean" && de(e.bgEnabled), se(oa), le(oa), q(!1));
|
|
23517
|
+
}, []), Wt = Oe.length > 0, Gt = Ae.length > 0, Kt = T(() => ({
|
|
22957
23518
|
selectedId: _e,
|
|
22958
23519
|
selectedIds: he,
|
|
22959
23520
|
select: we,
|
|
@@ -23002,21 +23563,21 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
23002
23563
|
isSeedPool: Ue,
|
|
23003
23564
|
isSeedSeeding: We,
|
|
23004
23565
|
palette: Ge,
|
|
23005
|
-
setPoolId:
|
|
23006
|
-
setModeId:
|
|
23007
|
-
toggleLock:
|
|
23008
|
-
setColorAt:
|
|
23009
|
-
randomize:
|
|
23010
|
-
reset:
|
|
23011
|
-
toggleBg:
|
|
23012
|
-
loadPalette:
|
|
23566
|
+
setPoolId: It,
|
|
23567
|
+
setModeId: Lt,
|
|
23568
|
+
toggleLock: Rt,
|
|
23569
|
+
setColorAt: zt,
|
|
23570
|
+
randomize: Bt,
|
|
23571
|
+
reset: Ht,
|
|
23572
|
+
toggleBg: Ut,
|
|
23573
|
+
loadPalette: Z,
|
|
23013
23574
|
layers: pe,
|
|
23014
23575
|
addLayer: Ze,
|
|
23015
23576
|
removeLayer: Qe,
|
|
23016
23577
|
updateLayer: et,
|
|
23017
23578
|
toggleLayer: ct,
|
|
23018
23579
|
toggleLayerLock: lt,
|
|
23019
|
-
moveLayer:
|
|
23580
|
+
moveLayer: Ft,
|
|
23020
23581
|
duplicateLayer: ht,
|
|
23021
23582
|
clearLayers: gt,
|
|
23022
23583
|
deleteSelected: $e,
|
|
@@ -23038,13 +23599,15 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
23038
23599
|
reparentLayer: bt,
|
|
23039
23600
|
alignSelected: xt,
|
|
23040
23601
|
flattenPattern: St,
|
|
23041
|
-
|
|
23042
|
-
|
|
23043
|
-
|
|
23044
|
-
|
|
23045
|
-
|
|
23046
|
-
|
|
23047
|
-
|
|
23602
|
+
flattenGenerate: Ct,
|
|
23603
|
+
flattenRepeat: Tt,
|
|
23604
|
+
flattenText: Et,
|
|
23605
|
+
flattenParatype: Dt,
|
|
23606
|
+
addFlattenedFromFrame: Ot,
|
|
23607
|
+
loadPreset: At,
|
|
23608
|
+
insertFromLibrary: jt,
|
|
23609
|
+
canUndo: Wt,
|
|
23610
|
+
canRedo: Gt,
|
|
23048
23611
|
undo: Ve,
|
|
23049
23612
|
redo: He,
|
|
23050
23613
|
clearHistory: Be,
|
|
@@ -23090,21 +23653,21 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
23090
23653
|
Ue,
|
|
23091
23654
|
We,
|
|
23092
23655
|
Ge,
|
|
23093
|
-
Pt,
|
|
23094
|
-
Ft,
|
|
23095
23656
|
It,
|
|
23096
23657
|
Lt,
|
|
23097
23658
|
Rt,
|
|
23098
23659
|
zt,
|
|
23099
23660
|
Bt,
|
|
23100
23661
|
Ht,
|
|
23662
|
+
Ut,
|
|
23663
|
+
Z,
|
|
23101
23664
|
pe,
|
|
23102
23665
|
Ze,
|
|
23103
23666
|
Qe,
|
|
23104
23667
|
et,
|
|
23105
23668
|
ct,
|
|
23106
23669
|
lt,
|
|
23107
|
-
|
|
23670
|
+
Ft,
|
|
23108
23671
|
ht,
|
|
23109
23672
|
gt,
|
|
23110
23673
|
$e,
|
|
@@ -23128,10 +23691,12 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
23128
23691
|
Ct,
|
|
23129
23692
|
Tt,
|
|
23130
23693
|
Et,
|
|
23694
|
+
Dt,
|
|
23131
23695
|
Ot,
|
|
23132
|
-
|
|
23133
|
-
|
|
23134
|
-
|
|
23696
|
+
At,
|
|
23697
|
+
jt,
|
|
23698
|
+
Wt,
|
|
23699
|
+
Gt,
|
|
23135
23700
|
Ve,
|
|
23136
23701
|
He,
|
|
23137
23702
|
Be,
|
|
@@ -23141,44 +23706,44 @@ function ia({ children: e, persistDraft: t = !0, draftKey: n = ki }) {
|
|
|
23141
23706
|
Ae
|
|
23142
23707
|
]);
|
|
23143
23708
|
return /* @__PURE__ */ A(Vt.Provider, {
|
|
23144
|
-
value:
|
|
23709
|
+
value: Kt,
|
|
23145
23710
|
children: e
|
|
23146
23711
|
});
|
|
23147
23712
|
}
|
|
23148
|
-
function
|
|
23713
|
+
function Ma() {
|
|
23149
23714
|
let e = C(Vt);
|
|
23150
23715
|
if (!e) throw Error("useComposeState must be inside <ComposeStateProvider>");
|
|
23151
23716
|
return e;
|
|
23152
23717
|
}
|
|
23153
|
-
function
|
|
23718
|
+
function Na(e, t) {
|
|
23154
23719
|
return !e || typeof e != "string" ? null : e.startsWith("palette:") ? t?.[e.slice(8)] ?? null : e;
|
|
23155
23720
|
}
|
|
23156
23721
|
//#endregion
|
|
23157
23722
|
//#region src/editor/params/controlSize.js
|
|
23158
|
-
var
|
|
23723
|
+
var Pa = x("sm"), Fa = () => C(Pa), Ia = "[&_.kol-seg-cell]:min-w-0 [&_.kol-seg-cell]:px-1 [&_.kol-seg-cell]:overflow-hidden [@media(hover:none)]:[&_.kol-seg-cell:hover:not(.is-active)]:text-[var(--kol-oq-48)]", La = (e) => e === "sm" ? void 0 : Ia, Ra = "var(--fxr-label-w, 112px)", za = ".kol-compose-inspector-body, .kol-inspector-rail-body", Ba = "[style*=\"--fxr-label-w\"]", Va = (e) => {
|
|
23159
23724
|
let t = document.createRange();
|
|
23160
23725
|
return t.selectNodeContents(e), t.getBoundingClientRect().width;
|
|
23161
23726
|
};
|
|
23162
|
-
function
|
|
23163
|
-
for (let t of e.querySelectorAll(
|
|
23727
|
+
function Ha(e = document) {
|
|
23728
|
+
for (let t of e.querySelectorAll(za)) {
|
|
23164
23729
|
let e = t.style.getPropertyValue("--fxr-label-w");
|
|
23165
23730
|
t.style.removeProperty("--fxr-label-w");
|
|
23166
23731
|
let n = 0;
|
|
23167
|
-
for (let e of t.querySelectorAll(
|
|
23732
|
+
for (let e of t.querySelectorAll(Ba)) e.closest(za) === t && (n = Math.max(n, Va(e)));
|
|
23168
23733
|
let r = t.querySelector("[data-label-scope]")?.dataset.labelScope ?? "";
|
|
23169
23734
|
t._labelScope === r && (n = Math.max(n, t._labelMax ?? 0)), t._labelScope = r, t._labelMax = n;
|
|
23170
23735
|
let i = n ? `${Math.min(112, Math.max(40, Math.ceil(n) + 4))}px` : "";
|
|
23171
23736
|
i ? t.style.setProperty("--fxr-label-w", i) : e && t.style.removeProperty("--fxr-label-w");
|
|
23172
23737
|
}
|
|
23173
23738
|
}
|
|
23174
|
-
function
|
|
23739
|
+
function Ua() {
|
|
23175
23740
|
w(() => {
|
|
23176
23741
|
let e = 0, t = () => {
|
|
23177
23742
|
e ||= setTimeout(() => {
|
|
23178
|
-
e = 0,
|
|
23743
|
+
e = 0, Ha();
|
|
23179
23744
|
}, 200);
|
|
23180
23745
|
}, n = new MutationObserver((e) => {
|
|
23181
|
-
e.some((e) => e.target.closest?.(
|
|
23746
|
+
e.some((e) => e.target.closest?.(za)) && t();
|
|
23182
23747
|
});
|
|
23183
23748
|
return n.observe(document.body, {
|
|
23184
23749
|
childList: !0,
|
|
@@ -23190,7 +23755,7 @@ function ga() {
|
|
|
23190
23755
|
}
|
|
23191
23756
|
//#endregion
|
|
23192
23757
|
//#region src/editor/params/easing.js
|
|
23193
|
-
var
|
|
23758
|
+
var Wa = {
|
|
23194
23759
|
linear: [
|
|
23195
23760
|
0,
|
|
23196
23761
|
0,
|
|
@@ -23221,7 +23786,7 @@ var _a = {
|
|
|
23221
23786
|
.58,
|
|
23222
23787
|
1
|
|
23223
23788
|
]
|
|
23224
|
-
},
|
|
23789
|
+
}, Ga = [
|
|
23225
23790
|
{
|
|
23226
23791
|
value: "linear",
|
|
23227
23792
|
label: "Linear"
|
|
@@ -23247,7 +23812,7 @@ var _a = {
|
|
|
23247
23812
|
label: "Hold"
|
|
23248
23813
|
}
|
|
23249
23814
|
];
|
|
23250
|
-
function
|
|
23815
|
+
function Ka(e, t, n) {
|
|
23251
23816
|
if (n <= 0) return 0;
|
|
23252
23817
|
if (n >= 1) return 1;
|
|
23253
23818
|
let r = 3 * e, i = 3 * (t - e) - r, a = 1 - r - i, o = (e) => ((a * e + i) * e + r) * e, s = (e) => (3 * a * e + 2 * i) * e + r, c = n;
|
|
@@ -23260,29 +23825,29 @@ function ya(e, t, n) {
|
|
|
23260
23825
|
}
|
|
23261
23826
|
return c;
|
|
23262
23827
|
}
|
|
23263
|
-
function
|
|
23828
|
+
function qa(e, t) {
|
|
23264
23829
|
if (e === "hold") return 0;
|
|
23265
|
-
let [n, r, i, a] = Array.isArray(e) ? e :
|
|
23830
|
+
let [n, r, i, a] = Array.isArray(e) ? e : Wa[e] ?? Wa.linear, o = Ka(n, i, Math.min(1, Math.max(0, t))), s = 3 * r, c = 3 * (a - r) - s;
|
|
23266
23831
|
return (((1 - s - c) * o + c) * o + s) * o;
|
|
23267
23832
|
}
|
|
23268
23833
|
//#endregion
|
|
23269
23834
|
//#region src/editor/params/resolve.js
|
|
23270
|
-
function
|
|
23835
|
+
function Ja(e) {
|
|
23271
23836
|
return typeof e == "object" && !!e && typeof e.bind == "string";
|
|
23272
23837
|
}
|
|
23273
|
-
function
|
|
23274
|
-
for (let t in e) if (
|
|
23838
|
+
function Ya(e) {
|
|
23839
|
+
for (let t in e) if (Ja(e[t])) return !0;
|
|
23275
23840
|
if (Array.isArray(e.filters)) for (let t of e.filters) {
|
|
23276
23841
|
let e = t?.params;
|
|
23277
23842
|
if (e) {
|
|
23278
|
-
for (let t in e) if (
|
|
23843
|
+
for (let t in e) if (Ja(e[t])) return !0;
|
|
23279
23844
|
}
|
|
23280
23845
|
}
|
|
23281
23846
|
return !1;
|
|
23282
23847
|
}
|
|
23283
|
-
function
|
|
23848
|
+
function Xa(e) {
|
|
23284
23849
|
if (!e?.length) return e;
|
|
23285
|
-
let t =
|
|
23850
|
+
let t = eo(e, 0), n = e.filter((e) => e.t > 0 && e.t < 1);
|
|
23286
23851
|
return [
|
|
23287
23852
|
{
|
|
23288
23853
|
...e.find((e) => e.t <= 0) ?? {
|
|
@@ -23300,31 +23865,31 @@ function Ca(e) {
|
|
|
23300
23865
|
}
|
|
23301
23866
|
];
|
|
23302
23867
|
}
|
|
23303
|
-
function
|
|
23304
|
-
if (!
|
|
23305
|
-
if (e.bind === "track") return
|
|
23306
|
-
if (e.bind === "mod") return
|
|
23868
|
+
function Za(e, t, n) {
|
|
23869
|
+
if (!Ja(e)) return e;
|
|
23870
|
+
if (e.bind === "track") return eo(n?.morph?.syncLoop ? Xa(e.keys) : e.keys, t?.t ?? 0);
|
|
23871
|
+
if (e.bind === "mod") return ao(e, t, n);
|
|
23307
23872
|
}
|
|
23308
|
-
function
|
|
23309
|
-
if (!
|
|
23873
|
+
function Qa(e, t) {
|
|
23874
|
+
if (!Ya(e)) return e;
|
|
23310
23875
|
let n = { ...e };
|
|
23311
|
-
for (let r in e)
|
|
23876
|
+
for (let r in e) Ja(e[r]) && (n[r] = Za(e[r], t, e));
|
|
23312
23877
|
return Array.isArray(e.filters) && (n.filters = e.filters.map((n) => {
|
|
23313
23878
|
let r = n?.params;
|
|
23314
23879
|
if (!r) return n;
|
|
23315
23880
|
let i = !1, a = { ...r };
|
|
23316
|
-
for (let n in r)
|
|
23881
|
+
for (let n in r) Ja(r[n]) && (a[n] = Za(r[n], t, e), i = !0);
|
|
23317
23882
|
return i ? {
|
|
23318
23883
|
...n,
|
|
23319
23884
|
params: a
|
|
23320
23885
|
} : n;
|
|
23321
23886
|
})), n;
|
|
23322
23887
|
}
|
|
23323
|
-
function
|
|
23888
|
+
function $a(e, t) {
|
|
23324
23889
|
return e.map((e) => {
|
|
23325
|
-
let n =
|
|
23890
|
+
let n = Qa(e, t);
|
|
23326
23891
|
if (Array.isArray(e.children)) {
|
|
23327
|
-
let r =
|
|
23892
|
+
let r = $a(e.children, t);
|
|
23328
23893
|
return r.some((t, n) => t !== e.children[n]) || n !== e ? {
|
|
23329
23894
|
...n,
|
|
23330
23895
|
children: r
|
|
@@ -23333,27 +23898,27 @@ function Ea(e, t) {
|
|
|
23333
23898
|
return n;
|
|
23334
23899
|
});
|
|
23335
23900
|
}
|
|
23336
|
-
function
|
|
23901
|
+
function eo(e, t) {
|
|
23337
23902
|
if (!e || e.length === 0) return;
|
|
23338
23903
|
if (e.length === 1 || t <= e[0].t) return e[0].v;
|
|
23339
23904
|
let n = e[e.length - 1];
|
|
23340
23905
|
if (t >= n.t) return n.v;
|
|
23341
23906
|
let r = 0;
|
|
23342
23907
|
for (; r < e.length - 1 && e[r + 1].t <= t;) r++;
|
|
23343
|
-
let i = e[r], a = e[r + 1], o = a.t - i.t || 1, s =
|
|
23344
|
-
return
|
|
23908
|
+
let i = e[r], a = e[r + 1], o = a.t - i.t || 1, s = qa(i.easing, (t - i.t) / o);
|
|
23909
|
+
return no(i.v, a.v, s);
|
|
23345
23910
|
}
|
|
23346
|
-
var
|
|
23347
|
-
function
|
|
23911
|
+
var to = /^#[0-9a-f]{6}$/i;
|
|
23912
|
+
function no(e, t, n) {
|
|
23348
23913
|
if (typeof e == "number" && typeof t == "number") return e + (t - e) * n;
|
|
23349
|
-
if (typeof e == "string" && typeof t == "string" &&
|
|
23914
|
+
if (typeof e == "string" && typeof t == "string" && to.test(e) && to.test(t)) {
|
|
23350
23915
|
let r = parseInt(e.slice(1), 16), i = parseInt(t.slice(1), 16), a = (e) => Math.round((r >> e & 255) + ((i >> e & 255) - (r >> e & 255)) * n);
|
|
23351
23916
|
return `#${(a(16) << 16 | a(8) << 8 | a(0)).toString(16).padStart(6, "0")}`;
|
|
23352
23917
|
}
|
|
23353
23918
|
return e;
|
|
23354
23919
|
}
|
|
23355
|
-
var
|
|
23356
|
-
function
|
|
23920
|
+
var ro = /* @__PURE__ */ new WeakMap(), io = () => /* @__PURE__ */ new WeakMap();
|
|
23921
|
+
function ao(e, t, n) {
|
|
23357
23922
|
let r = e.transform, i = ct(e.source, t, {
|
|
23358
23923
|
transform: r,
|
|
23359
23924
|
layer: n
|
|
@@ -23361,7 +23926,7 @@ function Ma(e, t, n) {
|
|
|
23361
23926
|
r?.invert && (i = 1 - i);
|
|
23362
23927
|
let a = r?.smooth;
|
|
23363
23928
|
if (a > 0) {
|
|
23364
|
-
let n = t?.smoothState ??
|
|
23929
|
+
let n = t?.smoothState ?? ro, r = n.get(e);
|
|
23365
23930
|
i = r == null ? i : r + (i - r) * (1 - Math.min(.95, a)), n.set(e, i);
|
|
23366
23931
|
}
|
|
23367
23932
|
let o = r?.curve;
|
|
@@ -23371,7 +23936,7 @@ function Ma(e, t, n) {
|
|
|
23371
23936
|
}
|
|
23372
23937
|
//#endregion
|
|
23373
23938
|
//#region src/editor/compose/inspectors/ColorField.jsx
|
|
23374
|
-
var
|
|
23939
|
+
var oo = [
|
|
23375
23940
|
{
|
|
23376
23941
|
value: "palette:primary",
|
|
23377
23942
|
label: "Primary"
|
|
@@ -23397,8 +23962,8 @@ var Na = [
|
|
|
23397
23962
|
label: "Background"
|
|
23398
23963
|
}
|
|
23399
23964
|
];
|
|
23400
|
-
function
|
|
23401
|
-
let f =
|
|
23965
|
+
function so({ value: e, onChange: t, palette: a, label: c = "Color", hideLabel: l = !1, autoValue: u = null, inline: d = !1 }) {
|
|
23966
|
+
let f = Fa(), p = typeof e == "string" && e.startsWith("palette:"), m = e == null, h = typeof e == "string" && e.startsWith("var("), g = Na(e, a) ?? "#FFFFFF", _ = m ? "None" : h ? "Theme" : p ? oo.find((t) => t.value === e)?.label ?? e : g.toUpperCase(), v = c === "Stroke", y = m || h ? "" : g.replace(/^#/, "").toUpperCase(), [b, x] = D(y);
|
|
23402
23967
|
w(() => {
|
|
23403
23968
|
x(y);
|
|
23404
23969
|
}, [y]);
|
|
@@ -23425,8 +23990,8 @@ function Pa({ value: e, onChange: t, palette: a, label: c = "Color", hideLabel:
|
|
|
23425
23990
|
className: "flex flex-col gap-2",
|
|
23426
23991
|
children: [/* @__PURE__ */ A("div", {
|
|
23427
23992
|
className: "grid grid-cols-6 gap-1",
|
|
23428
|
-
children:
|
|
23429
|
-
hex:
|
|
23993
|
+
children: oo.map((n) => /* @__PURE__ */ A(i, {
|
|
23994
|
+
hex: Na(n.value, a) ?? "#000000",
|
|
23430
23995
|
size: "fill",
|
|
23431
23996
|
selected: e === n.value,
|
|
23432
23997
|
title: n.label,
|
|
@@ -23494,7 +24059,7 @@ function Pa({ value: e, onChange: t, palette: a, label: c = "Color", hideLabel:
|
|
|
23494
24059
|
}
|
|
23495
24060
|
//#endregion
|
|
23496
24061
|
//#region src/editor/compose/inspectors/NumberField.jsx
|
|
23497
|
-
function
|
|
24062
|
+
function co({ value: e, onCommit: t, ...n }) {
|
|
23498
24063
|
let [r, i] = D(String(e));
|
|
23499
24064
|
return w(() => {
|
|
23500
24065
|
i(String(e));
|
|
@@ -23516,13 +24081,13 @@ function Fa({ value: e, onCommit: t, ...n }) {
|
|
|
23516
24081
|
}
|
|
23517
24082
|
//#endregion
|
|
23518
24083
|
//#region src/editor/color/palette.js
|
|
23519
|
-
var
|
|
24084
|
+
var lo = [
|
|
23520
24085
|
"bg",
|
|
23521
24086
|
"fg",
|
|
23522
24087
|
"accent",
|
|
23523
24088
|
"dim",
|
|
23524
24089
|
"warm"
|
|
23525
|
-
],
|
|
24090
|
+
], uo = [
|
|
23526
24091
|
...a.map((e) => ({
|
|
23527
24092
|
id: e.id,
|
|
23528
24093
|
label: e.label
|
|
@@ -23535,7 +24100,7 @@ var Ia = [
|
|
|
23535
24100
|
id: "random",
|
|
23536
24101
|
label: "Random"
|
|
23537
24102
|
}
|
|
23538
|
-
],
|
|
24103
|
+
], fo = (e) => ({
|
|
23539
24104
|
id: `theme:${e.id}`,
|
|
23540
24105
|
name: e.label,
|
|
23541
24106
|
source: "theme",
|
|
@@ -23554,54 +24119,54 @@ var Ia = [
|
|
|
23554
24119
|
e.warm ?? e.accent
|
|
23555
24120
|
]
|
|
23556
24121
|
});
|
|
23557
|
-
function
|
|
24122
|
+
function po(e, { id: t, name: n, source: r }) {
|
|
23558
24123
|
return {
|
|
23559
24124
|
id: t,
|
|
23560
24125
|
name: n,
|
|
23561
24126
|
source: r,
|
|
23562
24127
|
colors: e,
|
|
23563
|
-
roles:
|
|
24128
|
+
roles: bo(e)
|
|
23564
24129
|
};
|
|
23565
24130
|
}
|
|
23566
|
-
var
|
|
24131
|
+
var mo = () => {
|
|
23567
24132
|
try {
|
|
23568
24133
|
return JSON.parse(localStorage.getItem("kol.editor.swatches") ?? "[]");
|
|
23569
24134
|
} catch {
|
|
23570
24135
|
return [];
|
|
23571
24136
|
}
|
|
23572
24137
|
};
|
|
23573
|
-
function
|
|
23574
|
-
let t =
|
|
24138
|
+
function ho(e = {}) {
|
|
24139
|
+
let t = mo().map((e) => typeof e == "string" ? e : e?.hex).filter(Boolean);
|
|
23575
24140
|
return [
|
|
23576
|
-
...Pt.map(
|
|
23577
|
-
...t.length >= 2 ? [
|
|
24141
|
+
...Pt.map(fo),
|
|
24142
|
+
...t.length >= 2 ? [po(t, {
|
|
23578
24143
|
id: "swatches",
|
|
23579
24144
|
name: "Swatches",
|
|
23580
24145
|
source: "editor"
|
|
23581
24146
|
})] : [],
|
|
23582
|
-
...(e.palette ?? []).filter((e) => Array.isArray(e.colors) && e.colors.length).map((e) =>
|
|
24147
|
+
...(e.palette ?? []).filter((e) => Array.isArray(e.colors) && e.colors.length).map((e) => po(e.colors.map((e) => typeof e == "string" ? e : e.hex), {
|
|
23583
24148
|
id: e.id,
|
|
23584
24149
|
name: e.name || "Palette",
|
|
23585
24150
|
source: "local"
|
|
23586
24151
|
}))
|
|
23587
24152
|
];
|
|
23588
24153
|
}
|
|
23589
|
-
var
|
|
24154
|
+
var go = (e, t, n) => {
|
|
23590
24155
|
let r = t * Math.cos(n * Math.PI / 180), i = t * Math.sin(n * Math.PI / 180), a = (e + .3963377774 * r + .2158037573 * i) ** 3, o = (e - .1055613458 * r - .0638541728 * i) ** 3, s = (e - .0894841775 * r - 1.291485548 * i) ** 3;
|
|
23591
24156
|
return [
|
|
23592
24157
|
4.0767416621 * a - 3.3077115913 * o + .2309699292 * s,
|
|
23593
24158
|
-1.2684380046 * a + 2.6097574011 * o - .3413193965 * s,
|
|
23594
24159
|
-.0041960863 * a - .7034186147 * o + 1.707614701 * s
|
|
23595
24160
|
];
|
|
23596
|
-
},
|
|
23597
|
-
function
|
|
23598
|
-
let r = 0, i = t, a =
|
|
23599
|
-
if (!
|
|
24161
|
+
}, _o = (e) => e.every((e) => e >= -1e-4 && e <= 1.0001);
|
|
24162
|
+
function vo(e, t, n) {
|
|
24163
|
+
let r = 0, i = t, a = go(e, t, n);
|
|
24164
|
+
if (!_o(a)) {
|
|
23600
24165
|
for (let t = 0; t < 20; t++) {
|
|
23601
24166
|
let t = (r + i) / 2;
|
|
23602
|
-
|
|
24167
|
+
_o(go(e, t, n)) ? r = t : i = t;
|
|
23603
24168
|
}
|
|
23604
|
-
a =
|
|
24169
|
+
a = go(e, r, n);
|
|
23605
24170
|
}
|
|
23606
24171
|
let o = (e) => {
|
|
23607
24172
|
let t = Math.min(1, Math.max(0, e));
|
|
@@ -23609,7 +24174,7 @@ function Wa(e, t, n) {
|
|
|
23609
24174
|
};
|
|
23610
24175
|
return "#" + a.map((e) => o(e).toString(16).padStart(2, "0")).join("");
|
|
23611
24176
|
}
|
|
23612
|
-
function
|
|
24177
|
+
function yo(e) {
|
|
23613
24178
|
let [t, n, r] = [
|
|
23614
24179
|
1,
|
|
23615
24180
|
3,
|
|
@@ -23621,9 +24186,9 @@ function Ga(e) {
|
|
|
23621
24186
|
(Math.atan2(l, c) * 180 / Math.PI + 360) % 360
|
|
23622
24187
|
];
|
|
23623
24188
|
}
|
|
23624
|
-
function
|
|
24189
|
+
function bo(e) {
|
|
23625
24190
|
let t = e.map((e, t) => {
|
|
23626
|
-
let [n, r] =
|
|
24191
|
+
let [n, r] = yo(e);
|
|
23627
24192
|
return {
|
|
23628
24193
|
hex: e,
|
|
23629
24194
|
i: t,
|
|
@@ -23639,9 +24204,9 @@ function Ka(e) {
|
|
|
23639
24204
|
warm: u.hex
|
|
23640
24205
|
};
|
|
23641
24206
|
}
|
|
23642
|
-
var
|
|
23643
|
-
function
|
|
23644
|
-
let i = Math.min(8, Math.max(2, Math.round(r))), [a, o, s] =
|
|
24207
|
+
var xo = (e) => [...new Set(a.find((t) => t.id === e)?.roleOffsets ?? [0])];
|
|
24208
|
+
function So(e, { base: t, relation: n = "analogous", count: r = 5 }) {
|
|
24209
|
+
let i = Math.min(8, Math.max(2, Math.round(r))), [a, o, s] = yo(t), c = Math.min(.2, Math.max(.06, o)) * (.85 + e() * .3), l = n === "monochromatic" ? [0] : xo(n), u = (t) => n === "random" ? e() * 360 : s + l[t % l.length], d = [t.toLowerCase()], f = i - 1;
|
|
23645
24210
|
for (let t = 0; t < f; t++) {
|
|
23646
24211
|
let n = u(t + 1), r, o;
|
|
23647
24212
|
if (i >= 3 && t === 0) r = .14 + e() * .05, o = c * .3;
|
|
@@ -23651,23 +24216,23 @@ function Ja(e, { base: t, relation: n = "analogous", count: r = 5 }) {
|
|
|
23651
24216
|
let n = f - 2, i = t - 2;
|
|
23652
24217
|
r = .4 + (n === 1 ? .25 : .4 * i / (n - 1)) + (e() - .5) * .06, o = c * (.7 + e() * .3);
|
|
23653
24218
|
}
|
|
23654
|
-
d.push(
|
|
24219
|
+
d.push(vo(r, o, n));
|
|
23655
24220
|
}
|
|
23656
24221
|
return d;
|
|
23657
24222
|
}
|
|
23658
|
-
var
|
|
24223
|
+
var Co = (e) => {
|
|
23659
24224
|
let t = [
|
|
23660
24225
|
1,
|
|
23661
24226
|
3,
|
|
23662
24227
|
5
|
|
23663
24228
|
].map((t) => parseInt(e.slice(t, t + 2), 16) / 255).map((e) => e <= .03928 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4);
|
|
23664
24229
|
return .2126 * t[0] + .7152 * t[1] + .0722 * t[2];
|
|
23665
|
-
},
|
|
23666
|
-
let [n, r] = [
|
|
24230
|
+
}, wo = (e, t) => {
|
|
24231
|
+
let [n, r] = [Co(e), Co(t)].sort((e, t) => t - e);
|
|
23667
24232
|
return (n + .05) / (r + .05);
|
|
23668
24233
|
};
|
|
23669
|
-
function
|
|
23670
|
-
let n = t ??
|
|
24234
|
+
function To(e, t) {
|
|
24235
|
+
let n = t ?? uo[Math.floor(e() * uo.length)].id, r = e() * 360, i = .09 + e() * .1, a = .62 + e() * .08, o = e() < .7, s;
|
|
23671
24236
|
s = n === "monochromatic" ? [
|
|
23672
24237
|
,
|
|
23673
24238
|
,
|
|
@@ -23679,11 +24244,11 @@ function Za(e, t) {
|
|
|
23679
24244
|
lightness: 55
|
|
23680
24245
|
}).map((e) => d(e).h);
|
|
23681
24246
|
let [c, l, f, p, m] = s, h = {
|
|
23682
|
-
bg:
|
|
23683
|
-
fg:
|
|
23684
|
-
accent:
|
|
23685
|
-
dim:
|
|
23686
|
-
warm:
|
|
24247
|
+
bg: vo(o ? .14 + e() * .05 : .95 + e() * .03, i * .25, c),
|
|
24248
|
+
fg: vo(o ? .93 + e() * .04 : .2 + e() * .05, i * .2, l ?? c),
|
|
24249
|
+
accent: vo(a, i, f ?? c),
|
|
24250
|
+
dim: vo(o ? .4 + e() * .06 : .74 + e() * .06, i * .6, p ?? c),
|
|
24251
|
+
warm: vo(o ? a + .1 : a - .1, i, m ?? c)
|
|
23687
24252
|
};
|
|
23688
24253
|
return {
|
|
23689
24254
|
id: "rolled",
|
|
@@ -23691,18 +24256,18 @@ function Za(e, t) {
|
|
|
23691
24256
|
source: "generated",
|
|
23692
24257
|
relation: n,
|
|
23693
24258
|
roles: h,
|
|
23694
|
-
colors:
|
|
23695
|
-
contrastOk:
|
|
24259
|
+
colors: lo.map((e) => h[e]),
|
|
24260
|
+
contrastOk: wo(h.bg, h.fg) >= 4.5
|
|
23696
24261
|
};
|
|
23697
24262
|
}
|
|
23698
|
-
function
|
|
24263
|
+
function Eo(e, t, n, { rotate: r = !1 } = {}) {
|
|
23699
24264
|
let i = { ...e }, a = 0;
|
|
23700
24265
|
for (let e of t || []) e?.type === "color" && (e.role && n.roles?.[e.role] ? i[e.key] = n.roles[e.role] : r && n.colors?.length && (i[e.key] = n.colors[a++ % n.colors.length]));
|
|
23701
24266
|
return i;
|
|
23702
24267
|
}
|
|
23703
24268
|
//#endregion
|
|
23704
24269
|
//#region src/editor/lib/rng.js
|
|
23705
|
-
function
|
|
24270
|
+
function Do(e) {
|
|
23706
24271
|
let t = e >>> 0;
|
|
23707
24272
|
return function() {
|
|
23708
24273
|
t |= 0, t = t + 1831565813 | 0;
|
|
@@ -23710,10 +24275,10 @@ function $a(e) {
|
|
|
23710
24275
|
return e = e + Math.imul(e ^ e >>> 7, 61 | e) ^ e, ((e ^ e >>> 14) >>> 0) / 4294967296;
|
|
23711
24276
|
};
|
|
23712
24277
|
}
|
|
23713
|
-
function
|
|
24278
|
+
function Oo() {
|
|
23714
24279
|
return Math.floor(Math.random() * 1e9);
|
|
23715
24280
|
}
|
|
23716
|
-
function
|
|
24281
|
+
function ko(e, t) {
|
|
23717
24282
|
let n = {};
|
|
23718
24283
|
if (!Array.isArray(e)) return n;
|
|
23719
24284
|
let r = null, i = 0;
|
|
@@ -23730,11 +24295,11 @@ function to(e, t) {
|
|
|
23730
24295
|
if (!e.length) continue;
|
|
23731
24296
|
let r = e[Math.floor(t() * e.length)];
|
|
23732
24297
|
n[a.key] = r && typeof r == "object" ? r.value : r;
|
|
23733
|
-
} else a.type === "toggle" || a.type === "boolean" ? n[a.key] = t() > .5 : a.type === "color" && (r ??=
|
|
24298
|
+
} else a.type === "toggle" || a.type === "boolean" ? n[a.key] = t() > .5 : a.type === "color" && (r ??= To(t), n[a.key] = a.role && r.roles[a.role] || r.colors[i++ % r.colors.length]);
|
|
23734
24299
|
}
|
|
23735
24300
|
return n;
|
|
23736
24301
|
}
|
|
23737
|
-
function
|
|
24302
|
+
function Ao(e, t) {
|
|
23738
24303
|
let n = { ...e };
|
|
23739
24304
|
for (let [r, i] of Object.entries(t)) {
|
|
23740
24305
|
let t = e?.[r];
|
|
@@ -23744,55 +24309,55 @@ function no(e, t) {
|
|
|
23744
24309
|
}
|
|
23745
24310
|
//#endregion
|
|
23746
24311
|
//#region src/editor/params/rolls.jsx
|
|
23747
|
-
var
|
|
24312
|
+
var jo = new Set([
|
|
23748
24313
|
"Motion",
|
|
23749
24314
|
"Frame",
|
|
23750
24315
|
"Form"
|
|
23751
|
-
]),
|
|
23752
|
-
[
|
|
24316
|
+
]), Mo = new Set(["theme", "invert"]), No = "__color", Po = {
|
|
24317
|
+
[No]: "Color",
|
|
23753
24318
|
Frame: "Motion Frame",
|
|
23754
24319
|
Form: "Motion Form"
|
|
23755
24320
|
};
|
|
23756
|
-
function
|
|
24321
|
+
function Fo(e, t) {
|
|
23757
24322
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
23758
24323
|
for (let i of ai(e ?? [], t)) {
|
|
23759
|
-
if (
|
|
23760
|
-
let e = i.type === "color" ?
|
|
24324
|
+
if (Mo.has(i.key)) continue;
|
|
24325
|
+
let e = i.type === "color" ? No : i.section;
|
|
23761
24326
|
if (!e) continue;
|
|
23762
|
-
let t =
|
|
24327
|
+
let t = Po[e] ?? e, a = r.get(t);
|
|
23763
24328
|
a || (a = {
|
|
23764
24329
|
id: e,
|
|
23765
24330
|
label: t,
|
|
23766
|
-
motion:
|
|
24331
|
+
motion: jo.has(e),
|
|
23767
24332
|
params: []
|
|
23768
24333
|
}, r.set(t, a), n.push(a)), a.params.push(i);
|
|
23769
24334
|
}
|
|
23770
24335
|
return n;
|
|
23771
24336
|
}
|
|
23772
|
-
function
|
|
24337
|
+
function Io(e, t) {
|
|
23773
24338
|
let n = new Set(t.map((e) => e.key)), r = (e) => e.params.length === n.size && e.params.every((e) => n.has(e.key)), i = e.filter((e) => !r(e));
|
|
23774
24339
|
return i.length || t.length < 2 || t.length > 6 ? i : t.map((e) => ({
|
|
23775
24340
|
id: e.key,
|
|
23776
24341
|
label: e.label,
|
|
23777
|
-
motion:
|
|
24342
|
+
motion: jo.has(e.section),
|
|
23778
24343
|
params: [e]
|
|
23779
24344
|
}));
|
|
23780
24345
|
}
|
|
23781
|
-
var
|
|
24346
|
+
var Lo = (e) => !jo.has(e) && e !== "Camera", Ro = (e) => {
|
|
23782
24347
|
let t = oe().rollScopes?.[e];
|
|
23783
|
-
return typeof t == "boolean" ? t :
|
|
23784
|
-
},
|
|
24348
|
+
return typeof t == "boolean" ? t : Lo(e);
|
|
24349
|
+
}, zo = (e, t) => se("rollScopes", {
|
|
23785
24350
|
...oe().rollScopes ?? {},
|
|
23786
24351
|
[e]: !!t
|
|
23787
|
-
}),
|
|
23788
|
-
function
|
|
23789
|
-
return ai(e ?? [], t).filter((e) => !
|
|
24352
|
+
}), Bo = () => oe().rollEffects !== !1;
|
|
24353
|
+
function Vo(e, t) {
|
|
24354
|
+
return ai(e ?? [], t).filter((e) => !Mo.has(e.key) && Ro(e.type === "color" ? No : e.section));
|
|
23790
24355
|
}
|
|
23791
|
-
function
|
|
24356
|
+
function Ho(e, t, n, { stripNoRandom: r = !1, withFilters: i = !1 } = {}) {
|
|
23792
24357
|
let a = r ? t.map((e) => e.noRandom ? {
|
|
23793
24358
|
...e,
|
|
23794
24359
|
noRandom: !1
|
|
23795
|
-
} : e) : t, o =
|
|
24360
|
+
} : e) : t, o = ko(a, Do(n >>> 0));
|
|
23796
24361
|
for (let t of a) {
|
|
23797
24362
|
if (t.type !== "range" || t.key in o) continue;
|
|
23798
24363
|
let n = e[t.key];
|
|
@@ -23803,49 +24368,49 @@ function ho(e, t, n, { stripNoRandom: r = !1, withFilters: i = !1 } = {}) {
|
|
|
23803
24368
|
let s = {};
|
|
23804
24369
|
for (let t of Object.keys(o)) s[t] = e[t];
|
|
23805
24370
|
let c = {
|
|
23806
|
-
...
|
|
24371
|
+
...Ao(s, o),
|
|
23807
24372
|
_rollSeed: n
|
|
23808
24373
|
};
|
|
23809
|
-
if (i &&
|
|
23810
|
-
let t =
|
|
24374
|
+
if (i && Bo()) {
|
|
24375
|
+
let t = Uo(e, n);
|
|
23811
24376
|
t && (c.filters = t);
|
|
23812
24377
|
}
|
|
23813
24378
|
return c;
|
|
23814
24379
|
}
|
|
23815
|
-
function
|
|
24380
|
+
function Uo(e, t) {
|
|
23816
24381
|
let n = bi(e);
|
|
23817
24382
|
if (!n.length) return null;
|
|
23818
|
-
let r =
|
|
24383
|
+
let r = Do(t + 2654435769 >>> 0);
|
|
23819
24384
|
return n.map(({ def: e, ...t }) => e ? {
|
|
23820
24385
|
...t,
|
|
23821
|
-
params:
|
|
24386
|
+
params: Ao(t.params, ko(e.params, r))
|
|
23822
24387
|
} : t);
|
|
23823
24388
|
}
|
|
23824
|
-
function
|
|
24389
|
+
function Wo(e) {
|
|
23825
24390
|
let t = P("generators");
|
|
23826
24391
|
return t ? t.presetsInGroup(e.loopGroup).filter((n) => n.id !== e.presetId && !t.isToolPreset(n)) : [];
|
|
23827
24392
|
}
|
|
23828
|
-
function
|
|
23829
|
-
let n =
|
|
24393
|
+
function Go(e, t) {
|
|
24394
|
+
let n = Wo(e);
|
|
23830
24395
|
if (!n.length) return null;
|
|
23831
|
-
let r = n[Math.floor(
|
|
24396
|
+
let r = n[Math.floor(Do(t >>> 0)() * n.length)];
|
|
23832
24397
|
return {
|
|
23833
24398
|
...P("generators").presetLayerPatch(r, e.loopGroup),
|
|
23834
24399
|
_rollSeed: t
|
|
23835
24400
|
};
|
|
23836
24401
|
}
|
|
23837
|
-
function
|
|
24402
|
+
function Ko(e) {
|
|
23838
24403
|
let [t, n] = D(null);
|
|
23839
24404
|
return {
|
|
23840
24405
|
value: t ?? e?._rollSeed ?? 0,
|
|
23841
24406
|
commit: n,
|
|
23842
|
-
take: () => t == null ?
|
|
24407
|
+
take: () => t == null ? Oo() : (n(null), t)
|
|
23843
24408
|
};
|
|
23844
24409
|
}
|
|
23845
|
-
function
|
|
23846
|
-
let n = /* @__PURE__ */ A(
|
|
24410
|
+
function qo({ seed: e, inline: t = !0 }) {
|
|
24411
|
+
let n = /* @__PURE__ */ A(co, {
|
|
23847
24412
|
variant: "filled",
|
|
23848
|
-
size:
|
|
24413
|
+
size: Fa(),
|
|
23849
24414
|
chars: 10,
|
|
23850
24415
|
value: e.value,
|
|
23851
24416
|
onCommit: (t) => {
|
|
@@ -23856,7 +24421,7 @@ function bo({ seed: e, inline: t = !0 }) {
|
|
|
23856
24421
|
return t ? /* @__PURE__ */ A(c, {
|
|
23857
24422
|
label: "Seed",
|
|
23858
24423
|
align: "fill",
|
|
23859
|
-
labelWidth:
|
|
24424
|
+
labelWidth: Ra,
|
|
23860
24425
|
children: n
|
|
23861
24426
|
}) : /* @__PURE__ */ A(s, {
|
|
23862
24427
|
label: "Seed",
|
|
@@ -23864,4 +24429,4 @@ function bo({ seed: e, inline: t = !0 }) {
|
|
|
23864
24429
|
});
|
|
23865
24430
|
}
|
|
23866
24431
|
//#endregion
|
|
23867
|
-
export {
|
|
24432
|
+
export { ji as $, bn as $t, $a as A, se as An, p as At, va as B, P as Bn, Yn as Bt, fo as C, Ze as Cn, Ir as Ct, Ja as D, Te as Dn, _r as Dt, Ya as E, Ee as En, br as Et, Ra as F, L as Fn, v as Ft, ka as G, jn as Gt, ba as H, Zn as Ht, La as I, I as In, y as It, Ma as J, Dn as Jt, Ta as K, An as Kt, Fa as L, B as Ln, ar as Lt, Wa as M, de as Mn, h as Mt, Ga as N, ne as Nn, g as Nt, io as O, De as On, l as Ot, Pa as P, F as Pn, _ as Pt, qi as Q, xn as Qt, Ua as R, R as Rn, tr as Rt, To as S, qe as Sn, Lr as St, so as T, ke as Tn, Dr as Tt, ja as U, Rn as Ut, ta as V, N as Vn, Xn as Vt, Ca as W, Ln as Wt, Zi as X, Sn as Xt, Ki as Y, Cn as Yt, Gi as Z, yn as Zt, bo as _, Mt as _n, ei as _t, Ho as a, ln as an, ki as at, vo as b, rt as bn, Br as bt, Ro as c, Bt as cn, xi as ct, Ko as d, Lt as dn, Si as dt, vn as en, Ni as et, Do as f, It as fn, bi as ft, ho as g, Nt as gn, ai as gt, lo as h, Ot as hn, ci as ht, Go as i, sn as in, Mi as it, Za as j, le as jn, m as jt, Qa as k, oe as kn, f as kt, zo as l, zt as ln, Ci as lt, uo as m, kt as mn, li as mt, Vo as n, dn as nn, Ei as nt, Fo as o, Ht as on, Ai as ot, Oo as p, wt as pn, si as pt, Na as q, En as qt, Uo as r, cn as rn, Fi as rt, Bo as s, Ut as sn, yi as st, qo as t, un as tn, Oi as tt, Io as u, Ft as un, wi as ut, wo as v, ot as vn, Wr as vt, co as w, Re as wn, mr as wt, Eo as x, Qe as xn, zr as xt, So as y, st as yn, ri as yt, ya as z, V as zn, er as zt };
|