@kolkrabbi/design-editor 0.34.0 → 0.36.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.
@@ -1,4 +1,4 @@
1
- import { D as e, L as t, Sn as n, j as r, pn as i, vn as a, yn as o } from "./rolls-CEQmdcp3.js";
1
+ import { D as e, Dn as t, In as n, L as r, Mn as i, Nn as a, j as o } from "./rolls-5hhrWX96.js";
2
2
  import { ParamBindDot as s } from "@kolkrabbi/kol-component";
3
3
  import { useEffect as c, useState as l } from "react";
4
4
  import { jsx as u } from "react/jsx-runtime";
@@ -25,9 +25,9 @@ function h() {
25
25
  //#endregion
26
26
  //#region src/editor/params/BindDot.jsx
27
27
  function g({ layer: c, param: l, setProp: d }) {
28
- let f = t(), p = h(), m = c[l.key], g = e(m), _ = g ? m.bind === "track" ? "track" : m.source : "none";
28
+ let f = r(), p = h(), m = c[l.key], g = e(m), _ = g ? m.bind === "track" ? "track" : m.source : "none";
29
29
  if (!p && !g) return null;
30
- let v = () => r(m, i.getCtx(), c) ?? l.default ?? 0, y = () => l.min != null && l.max != null ? [l.min, l.max] : [0, 1], b = (e) => {
30
+ let v = () => o(m, t.getCtx(), c) ?? l.default ?? 0, y = () => l.min != null && l.max != null ? [l.min, l.max] : [0, 1], b = (e) => {
31
31
  if (e === "none") d(l.key, v());
32
32
  else if (e === "track") {
33
33
  let e = v();
@@ -43,12 +43,12 @@ function g({ layer: c, param: l, setProp: d }) {
43
43
  easing: "linear"
44
44
  }]
45
45
  });
46
- } else a(e)?.ensure?.().catch(() => {}), d(l.key, {
46
+ } else i(e)?.ensure?.().catch(() => {}), d(l.key, {
47
47
  bind: "mod",
48
48
  source: e,
49
49
  transform: { range: y() }
50
50
  });
51
- }, x = l.type === "color" ? [] : o().filter((e) => !e.hidden), S = x.find((e) => n(e.id)), C = [
51
+ }, x = l.type === "color" ? [] : a().filter((e) => !e.hidden), S = x.find((e) => n(e.id)), C = [
52
52
  {
53
53
  value: "none",
54
54
  label: "Constant"
@@ -1,5 +1,5 @@
1
- import { D as e, J as t, M as n, N as r, On as i, mn as a, pn as o } from "./rolls-CEQmdcp3.js";
2
- import { m as s, s as c, u as l } from "./morphStore-B5081ohW.js";
1
+ import { D as e, Dn as t, Hn as n, J as r, M as i, N as a, On as o } from "./rolls-5hhrWX96.js";
2
+ import { m as s, s as c, u as l } from "./morphStore-CidzL7wV.js";
3
3
  import { Button as u, Dropdown as d, Input as f, Tooltip as p, floatSurfaceClass as m, useGrabEdge as h } from "@kolkrabbi/kol-component";
4
4
  import { Fragment as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
5
5
  import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
@@ -399,8 +399,8 @@ function q({ view: e, now: t }) {
399
399
  })]
400
400
  });
401
401
  }
402
- var J = (e) => Array.isArray(e) ? e : n[e] ?? null, Y = 132, X = 14;
403
- function se({ track: e, writeKeys: t, selected: r, setSelected: i }) {
402
+ var J = (e) => Array.isArray(e) ? e : i[e] ?? null, Y = 132, X = 14;
403
+ function se({ track: e, writeKeys: t, selected: n, setSelected: r }) {
404
404
  let a = y(null), [o, s] = b(0), [c, l] = b(null), u = y(null);
405
405
  _(() => {
406
406
  let e = a.current;
@@ -420,14 +420,14 @@ function se({ track: e, writeKeys: t, selected: r, setSelected: i }) {
420
420
  i: t,
421
421
  a: e,
422
422
  b: d[t + 1],
423
- bez: e.easing === "hold" ? null : J(e.easing ?? "linear") ?? n.linear
424
- })), w = (t, n) => (r) => {
425
- r.stopPropagation(), r.currentTarget.setPointerCapture(r.pointerId), u.current = {
423
+ bez: e.easing === "hold" ? null : J(e.easing ?? "linear") ?? i.linear
424
+ })), w = (t, n) => (i) => {
425
+ i.stopPropagation(), i.currentTarget.setPointerCapture(i.pointerId), u.current = {
426
426
  kind: t,
427
427
  i: n,
428
428
  range: [p, m],
429
429
  moved: !1
430
- }, t === "key" && i({
430
+ }, t === "key" && r({
431
431
  trackId: e.id,
432
432
  index: n
433
433
  });
@@ -435,26 +435,26 @@ function se({ track: e, writeKeys: t, selected: r, setSelected: i }) {
435
435
  let t = u.current;
436
436
  if (!t) return;
437
437
  t.moved = !0;
438
- let r = v(e), i = d.map((e) => ({ ...e }));
438
+ let n = v(e), r = d.map((e) => ({ ...e }));
439
439
  if (t.kind === "key") {
440
- let e = i[t.i - 1]?.t ?? 0, n = i[t.i + 1]?.t ?? 1;
441
- i[t.i].t = Math.min(n, Math.max(e, r.t)), i[t.i].v = r.v;
440
+ let e = r[t.i - 1]?.t ?? 0, i = r[t.i + 1]?.t ?? 1;
441
+ r[t.i].t = Math.min(i, Math.max(e, n.t)), r[t.i].v = n.v;
442
442
  } else {
443
- let e = i[t.i], a = i[t.i + 1], o = a.t - e.t || 1e-6, s = Math.abs(a.v - e.v) > 1e-9 ? a.v - e.v : m - p, c = Math.min(1, Math.max(0, (r.t - e.t) / o)), l = (r.v - e.v) / s, u = [...J(e.easing ?? "linear") ?? n.linear];
443
+ let e = r[t.i], a = r[t.i + 1], o = a.t - e.t || 1e-6, s = Math.abs(a.v - e.v) > 1e-9 ? a.v - e.v : m - p, c = Math.min(1, Math.max(0, (n.t - e.t) / o)), l = (n.v - e.v) / s, u = [...J(e.easing ?? "linear") ?? i.linear];
444
444
  t.kind === "out" ? (u[0] = c, u[1] = l) : (u[2] = c, u[3] = l), e.easing = u.map((e) => Math.round(e * 1e3) / 1e3);
445
445
  }
446
- l(i);
446
+ l(r);
447
447
  }, E = () => {
448
448
  let n = u.current;
449
449
  if (u.current = null, n?.moved && c) {
450
- let r = c[n.i];
451
- t(e, c), n.kind === "key" && i({
450
+ let i = c[n.i];
451
+ t(e, c), n.kind === "key" && r({
452
452
  trackId: e.id,
453
- index: [...c].sort((e, t) => e.t - t.t).indexOf(r)
453
+ index: [...c].sort((e, t) => e.t - t.t).indexOf(i)
454
454
  });
455
455
  }
456
456
  l(null);
457
- }, D = r?.trackId === e.id ? r.index : -1, O = (e, t, n, r, i, a) => /* @__PURE__ */ C("g", { children: [/* @__PURE__ */ S("line", {
457
+ }, D = n?.trackId === e.id ? n.index : -1, O = (e, t, n, r, i, a) => /* @__PURE__ */ C("g", { children: [/* @__PURE__ */ S("line", {
458
458
  x1: n,
459
459
  y1: r,
460
460
  x2: e,
@@ -528,16 +528,16 @@ function se({ track: e, writeKeys: t, selected: r, setSelected: i }) {
528
528
  })]
529
529
  });
530
530
  }
531
- var ce = [...r, {
531
+ var ce = [...a, {
532
532
  value: "custom",
533
533
  label: "Custom"
534
534
  }];
535
- function le({ tracks: e, selected: t, setSelected: r, writeKeys: i, len: a }) {
535
+ function le({ tracks: e, selected: t, setSelected: n, writeKeys: r, len: a }) {
536
536
  if (!t) return null;
537
537
  let o = e.find((e) => e.id === t.trackId), s = o?.keys[t.index];
538
538
  if (!s || o.readOnly) return null;
539
539
  let c = (e) => {
540
- i(o, o.keys.map((n, r) => r === t.index ? {
540
+ r(o, o.keys.map((n, r) => r === t.index ? {
541
541
  ...n,
542
542
  ...e
543
543
  } : n));
@@ -568,14 +568,14 @@ function le({ tracks: e, selected: t, setSelected: r, writeKeys: i, len: a }) {
568
568
  size: "sm",
569
569
  options: ce,
570
570
  value: p,
571
- onChange: (e) => c({ easing: e === "custom" ? [...J(s.easing) ?? n["in-out"]] : e })
571
+ onChange: (e) => c({ easing: e === "custom" ? [...J(s.easing) ?? i["in-out"]] : e })
572
572
  }),
573
573
  /* @__PURE__ */ S(u, {
574
574
  variant: "float",
575
575
  tone: "ghost",
576
576
  size: "sm",
577
577
  onClick: () => {
578
- o.keys.length > 1 && i(o, o.keys.filter((e, n) => n !== t.index)), r(null);
578
+ o.keys.length > 1 && r(o, o.keys.filter((e, n) => n !== t.index)), n(null);
579
579
  },
580
580
  children: "Delete key"
581
581
  }),
@@ -584,7 +584,7 @@ function le({ tracks: e, selected: t, setSelected: r, writeKeys: i, len: a }) {
584
584
  tone: "ghost",
585
585
  size: "sm",
586
586
  className: "ml-auto",
587
- onClick: () => r(null),
587
+ onClick: () => n(null),
588
588
  children: "Close"
589
589
  })
590
590
  ]
@@ -623,11 +623,11 @@ function fe({ onDrag: e, onEnd: t, onReset: n }) {
623
623
  });
624
624
  }
625
625
  function pe() {
626
- let { layers: e } = t(), n = l(), r = N();
627
- return v(() => z(e).length > 0, [e]) || !!n.active || r;
626
+ let { layers: e } = r(), t = l(), n = N();
627
+ return v(() => z(e).length > 0, [e]) || !!t.active || n;
628
628
  }
629
629
  function me({ surface: e = "solid" }) {
630
- let { layers: n, updateLayer: r, selectedIds: s, select: c, toggleLayer: u, toggleLayerLock: d, currentPresetName: f } = t(), { t: p, loopSeconds: m, seek: h } = a(), g = l(), x = N(), w = v(() => z(n), [n]), T = v(() => g.active && !w.some((e) => e.header) ? [{
630
+ let { layers: i, updateLayer: a, selectedIds: s, select: c, toggleLayer: u, toggleLayerLock: d, currentPresetName: f } = r(), { t: p, loopSeconds: m, seek: h } = o(), g = l(), x = N(), w = v(() => z(i), [i]), T = v(() => g.active && !w.some((e) => e.header) ? [{
631
631
  id: "morph:empty",
632
632
  layerId: null,
633
633
  key: "morphT",
@@ -647,11 +647,11 @@ function me({ surface: e = "solid" }) {
647
647
  P ? localStorage.setItem(Z, String(P)) : localStorage.removeItem(Z);
648
648
  } catch {}
649
649
  }, [P]);
650
- let B = y(Array(R).fill(0)), V = v(() => te(n), [n]);
651
- if (V.some(ne) && (B.current.push(i().level), B.current.shift()), T.length === 0 && !x) return null;
650
+ let B = y(Array(R).fill(0)), V = v(() => te(i), [i]);
651
+ if (V.some(ne) && (B.current.push(n().level), B.current.shift()), T.length === 0 && !x) return null;
652
652
  let H = p * m, re = he(m, j, H), U = (e, t) => {
653
653
  let n = [...t].sort((e, t) => e.t - t.t);
654
- r(e.layerId, { [e.key]: {
654
+ a(e.layerId, { [e.key]: {
655
655
  bind: "track",
656
656
  keys: n
657
657
  } });
@@ -693,7 +693,7 @@ function me({ surface: e = "solid" }) {
693
693
  layer: null,
694
694
  track: e
695
695
  });
696
- let oe = K.filter((e) => !(e.track?.under && k.has(e.track.under))), q = (e) => !!e && s.includes(e.id), J = !!(E && T.find((e) => e.id === E.trackId && !e.header && !e.readOnly)), Y = !!o.clock.state.looping, X = oe.map((e) => ({
696
+ let oe = K.filter((e) => !(e.track?.under && k.has(e.track.under))), q = (e) => !!e && s.includes(e.id), J = !!(E && T.find((e) => e.id === E.trackId && !e.header && !e.readOnly)), Y = !!t.clock.state.looping, X = oe.map((e) => ({
697
697
  ...e,
698
698
  lit: q(e.layer) || !!e.track && E?.trackId === e.track.id,
699
699
  labelLit: q(e.layer),
@@ -733,7 +733,7 @@ function me({ surface: e = "solid" }) {
733
733
  onAdd: W ? ae : void 0,
734
734
  mode: J ? "Curve" : "Keyframes",
735
735
  looping: Y,
736
- onLoop: () => o.clock.set({ looping: !Y }),
736
+ onLoop: () => t.clock.set({ looping: !Y }),
737
737
  zoom: j,
738
738
  onZoom: () => M(L[(L.indexOf(j) + 1) % L.length]),
739
739
  onFit: () => M(1),
@@ -1,5 +1,5 @@
1
- import { F as e, L as t } from "./rolls-CEQmdcp3.js";
2
- import { Dropdown as n, LabeledControl as r, SettingsRow as i, embedFontFace as a } from "@kolkrabbi/kol-component";
1
+ import { F as e, L as t, dn as n, hn as r, pn as i } from "./rolls-5hhrWX96.js";
2
+ import { embedFontFace as a } from "@kolkrabbi/kol-component";
3
3
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
4
4
  //#region src/kinetic/fonts.js
5
5
  var l = [
@@ -114,12 +114,12 @@ function S({ label: t, options: n, value: a, onChange: o, children: c, inline: l
114
114
  value: a,
115
115
  onChange: o
116
116
  });
117
- return l ? /* @__PURE__ */ s(i, {
117
+ return l ? /* @__PURE__ */ s(r, {
118
118
  label: t,
119
119
  align: "fill",
120
120
  labelWidth: e,
121
121
  children: u
122
- }) : /* @__PURE__ */ s(r, {
122
+ }) : /* @__PURE__ */ s(i, {
123
123
  label: t,
124
124
  children: u
125
125
  });