@kolkrabbi/design-editor 0.14.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/motion.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./motion-ejcDWbeh.js";
1
+ import { t as e } from "./motion-DtxlM5Bu.js";
2
2
  export { e as motion };
@@ -1,5 +1,5 @@
1
- import { $t as e, zt as t } from "./EditorIcon-BbFMmc1G.js";
2
- import { _ as n, b as r, c as i, g as a, o, p as s, v as c, y as l } from "./TreePicker-DlEXH2kw.js";
1
+ import { Ft as e, Yt as t } from "./rolls-CkmuE-Ya.js";
2
+ import { _ as n, b as r, c as i, g as a, o, p as s, v as c, y as l } from "./TreePicker-D5XZT0Zi.js";
3
3
  //#region src/loops/lib/viewport.js
4
4
  var u = Math.PI * 2, d = {
5
5
  vpZoom: 1,
@@ -1834,10 +1834,10 @@ function k(e, t = "") {
1834
1834
  //#endregion
1835
1835
  //#region src/loops/pattern/glyphTile.js
1836
1836
  var A = 1e3, j = /* @__PURE__ */ new Map(), M = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set(), P = /* @__PURE__ */ new Map(), F = (e, t) => `${e}-${t}`;
1837
- function I(t, n, r) {
1837
+ function I(e, n, r) {
1838
1838
  if (!r) return null;
1839
- let i = F(t, n), a = j.get(i);
1840
- if (!a) return !M.has(i) && !N.has(i) && (M.add(i), e(t, n, !1).then((e) => {
1839
+ let i = F(e, n), a = j.get(i);
1840
+ if (!a) return !M.has(i) && !N.has(i) && (M.add(i), t(e, n, !1).then((e) => {
1841
1841
  j.set(i, e);
1842
1842
  }).catch(() => {
1843
1843
  N.add(i);
@@ -5995,9 +5995,9 @@ function yn(e) {
5995
5995
  ].join("|");
5996
5996
  }
5997
5997
  var bn = /* @__PURE__ */ new Map(), xn = 4;
5998
- function Sn(e, n, r, i, a) {
5998
+ function Sn(t, n, r, i, a) {
5999
5999
  let o = [
6000
- e.id,
6000
+ t.id,
6001
6001
  a.shape ?? "none",
6002
6002
  a.glyph ?? "A",
6003
6003
  a.font ?? "",
@@ -6007,11 +6007,11 @@ function Sn(e, n, r, i, a) {
6007
6007
  a.resolution ?? dn,
6008
6008
  r | 0,
6009
6009
  i | 0,
6010
- t.getEpoch(),
6010
+ e.getEpoch(),
6011
6011
  ...n.map((e) => `${e}:${a[e]}`)
6012
6012
  ].join("|"), s = bn.get(o);
6013
6013
  if (s) return bn.delete(o), bn.set(o, s), s;
6014
- for (s = Cn(e, r, i, a), bn.set(o, s); bn.size > xn;) {
6014
+ for (s = Cn(t, r, i, a), bn.set(o, s); bn.size > xn;) {
6015
6015
  let e = bn.keys().next().value, t = bn.get(e);
6016
6016
  t.dead = !0;
6017
6017
  try {
@@ -6021,7 +6021,7 @@ function Sn(e, n, r, i, a) {
6021
6021
  }
6022
6022
  return s;
6023
6023
  }
6024
- function Cn(e, n, r, i) {
6024
+ function Cn(t, n, r, i) {
6025
6025
  let a = Math.max(1, n | 0), o = Math.max(1, r | 0), c = document.createElement("canvas");
6026
6026
  c.width = a, c.height = o;
6027
6027
  let l = c.getContext("2d"), u = {
@@ -6044,9 +6044,9 @@ function Cn(e, n, r, i) {
6044
6044
  isPaused: () => !1,
6045
6045
  speed: un
6046
6046
  }, u.layerBox = null, u.ptrSm = null, u.pointer = () => {
6047
- let e = t.getCtx().stage, n = u.layerBox;
6048
- if (!e || !n || !n.w || !n.h) return u.ptrSm = null, null;
6049
- let r = (e.x - n.x) / n.w, i = (e.y - n.y) / n.h;
6047
+ let t = e.getCtx().stage, n = u.layerBox;
6048
+ if (!t || !n || !n.w || !n.h) return u.ptrSm = null, null;
6049
+ let r = (t.x - n.x) / n.w, i = (t.y - n.y) / n.h;
6050
6050
  if (r < 0 || r > 1 || i < 0 || i > 1) return u.ptrSm = null, null;
6051
6051
  let a = r * f, o = i * p;
6052
6052
  return u.ptrSm ||= {
@@ -6055,19 +6055,19 @@ function Cn(e, n, r, i) {
6055
6055
  }, u.ptrSm.x += (a - u.ptrSm.x) * .1, u.ptrSm.y += (o - u.ptrSm.y) * .1, {
6056
6056
  x: u.ptrSm.x,
6057
6057
  y: u.ptrSm.y,
6058
- down: !!e.down
6058
+ down: !!t.down
6059
6059
  };
6060
6060
  };
6061
- let d = Math.max(480, Math.min(1920, Math.round(i.resolution ?? dn))) / Math.max(a, o), f = Math.max(8, Math.round(a * d)), p = Math.max(8, Math.round(o * d)), m = (t) => {
6061
+ let d = Math.max(480, Math.min(1920, Math.round(i.resolution ?? dn))) / Math.max(a, o), f = Math.max(8, Math.round(a * d)), p = Math.max(8, Math.round(o * d)), m = (e) => {
6062
6062
  if (u.dead) return;
6063
- let n = Ft(Qt(t, f, p), f, p), r = on((i.seed ?? 1) >>> 0), s = sn(e.params);
6063
+ let n = Ft(Qt(e, f, p), f, p), r = on((i.seed ?? 1) >>> 0), s = sn(t.params);
6064
6064
  for (let e of Object.keys(s)) i[e] !== void 0 && (s[e] = i[e]);
6065
6065
  u.params = s;
6066
6066
  let d = qt(l, (e) => u.mapColor(e));
6067
6067
  u.clock;
6068
6068
  try {
6069
6069
  u.steps = Ht(() => {
6070
- u.cleanup = e.init({
6070
+ u.cleanup = t.init({
6071
6071
  canvas: c,
6072
6072
  ctx: d,
6073
6073
  sdf: n,
@@ -6080,11 +6080,11 @@ function Cn(e, n, r, i) {
6080
6080
  pointer: u.pointer
6081
6081
  }) ?? null;
6082
6082
  }), u.ready = !0;
6083
- } catch (t) {
6084
- console.error(`[penrose-${e.id}] init threw:`, t), u.steps = [], u.ready = !0;
6083
+ } catch (e) {
6084
+ console.error(`[penrose-${t.id}] init threw:`, e), u.steps = [], u.ready = !0;
6085
6085
  }
6086
6086
  }, h = i.shape ?? "none";
6087
- return h === "glyph" ? (s(), Yt(String(i.glyph ?? "A") || "A", i.font ?? pn, String(i.weight ?? "700"), Math.min(f, p) * .9, f, p).then(m).catch((t) => console.error(`[penrose-${e.id}] glyph bake failed:`, t))) : h === "custom" ? rn(i.customSvg, f, p).then(m).catch(() => m(an("none", f, p))) : m(an(h, f, p)), u;
6087
+ return h === "glyph" ? (s(), Yt(String(i.glyph ?? "A") || "A", i.font ?? pn, String(i.weight ?? "700"), Math.min(f, p) * .9, f, p).then(m).catch((e) => console.error(`[penrose-${t.id}] glyph bake failed:`, e))) : h === "custom" ? rn(i.customSvg, f, p).then(m).catch(() => m(an("none", f, p))) : m(an(h, f, p)), u;
6088
6088
  }
6089
6089
  function wn(e, t = {}) {
6090
6090
  let n = new Set(t.live ?? []), r = (e.params ?? []).map((e) => e.key).filter((e) => !n.has(e)), i = (e.params ?? []).map((e) => e.key);
@@ -18538,8 +18538,8 @@ var Gs = {
18538
18538
  default: 3.2
18539
18539
  }
18540
18540
  ],
18541
- draw(e, n, r, i, a) {
18542
- let o = `${a.seed}|${a.scatterSeed ?? 1}|${t.getEpoch()}`;
18541
+ draw(t, n, r, i, a) {
18542
+ let o = `${a.seed}|${a.scatterSeed ?? 1}|${e.getEpoch()}`;
18543
18543
  (!$s || ec !== o) && ($s = new Qs(Js), $s.setParams({ seed: a.seed }), $s.reseed(on((a.scatterSeed ?? 1) >>> 0)), ec = o, tc ||= document.createElement("canvas")), $s.setParams({
18544
18544
  feed: a.feed,
18545
18545
  kill: a.kill,
@@ -18548,7 +18548,7 @@ var Gs = {
18548
18548
  gain: a.gain
18549
18549
  }), $s.step(Math.max(1, Math.round(a.iters))), $s.render(tc, a.palette);
18550
18550
  let s = Math.max(r / Js, i / Js);
18551
- e.imageSmoothingEnabled = !0, e.drawImage(tc, (r - Js * s) / 2, (i - Js * s) / 2, Js * s, Js * s);
18551
+ t.imageSmoothingEnabled = !0, t.drawImage(tc, (r - Js * s) / 2, (i - Js * s) / 2, Js * s, Js * s);
18552
18552
  }
18553
18553
  }
18554
18554
  ], rc = (e, t, n, r = {}, i) => ({
@@ -20252,30 +20252,30 @@ function Zc(e, t, n, r, i) {
20252
20252
  return [n + a * i, r + o * i];
20253
20253
  }
20254
20254
  var Qc = /* @__PURE__ */ new Map();
20255
- function $c(e, n, r) {
20255
+ function $c(t, n, r) {
20256
20256
  let i = [
20257
20257
  r.count,
20258
20258
  r.drift,
20259
20259
  r.span,
20260
20260
  r.reach,
20261
20261
  r.seed,
20262
- e | 0,
20262
+ t | 0,
20263
20263
  n | 0,
20264
- t.getEpoch()
20264
+ e.getEpoch()
20265
20265
  ].join("|"), a = Qc.get(i);
20266
20266
  if (a) return a;
20267
20267
  let o = document.createElement("canvas");
20268
- o.width = Math.max(1, e | 0), o.height = Math.max(1, n | 0);
20268
+ o.width = Math.max(1, t | 0), o.height = Math.max(1, n | 0);
20269
20269
  let s = o.getContext("2d");
20270
20270
  s.fillStyle = r.bg || "#060608", s.fillRect(0, 0, o.width, o.height);
20271
20271
  let c = Xc({
20272
20272
  count: r.count,
20273
20273
  drift: r.drift,
20274
20274
  span: r.span
20275
- }, r.seed ?? 1), l = Math.min(e, n) * .5 * (r.reach ?? .92);
20276
- for (let t of c) {
20277
- let [r, i] = Zc(t, 0, e / 2, n / 2, l);
20278
- t.px = r, t.py = i, t.started = !0;
20275
+ }, r.seed ?? 1), l = Math.min(t, n) * .5 * (r.reach ?? .92);
20276
+ for (let e of c) {
20277
+ let [r, i] = Zc(e, 0, t / 2, n / 2, l);
20278
+ e.px = r, e.py = i, e.started = !0;
20279
20279
  }
20280
20280
  for (a = {
20281
20281
  buf: o,
@@ -23550,17 +23550,17 @@ function id(e, { gravity: t, mutual: n, dt: r }) {
23550
23550
  for (let t of e) t.x += t.vx * r, t.y += t.vy * r;
23551
23551
  }
23552
23552
  var ad = /* @__PURE__ */ new Map();
23553
- function od(e, n, r) {
23553
+ function od(t, n, r) {
23554
23554
  let i = [
23555
23555
  r.count,
23556
23556
  r.seed,
23557
- e | 0,
23557
+ t | 0,
23558
23558
  n | 0,
23559
- t.getEpoch()
23559
+ e.getEpoch()
23560
23560
  ].join("|"), a = ad.get(i);
23561
23561
  if (a) return a;
23562
23562
  let o = document.createElement("canvas");
23563
- o.width = Math.max(1, e | 0), o.height = Math.max(1, n | 0);
23563
+ o.width = Math.max(1, t | 0), o.height = Math.max(1, n | 0);
23564
23564
  let s = o.getContext("2d");
23565
23565
  for (s.fillStyle = r.bg || "#06070b", s.fillRect(0, 0, o.width, o.height), a = {
23566
23566
  buf: o,