@kolkrabbi/design-editor 0.26.0 → 0.27.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.
@@ -2,7 +2,7 @@ import { $ as e, A as t, B as n, Bt as r, Ct as i, D as a, Dt as o, E as s, Et a
2
2
  import { A as Ye, D as Xe, O as Ze, S as Qe, _ as $e, b as et, bt as tt, h as nt, i as rt, k as it, n as at, o as ot, r as st, t as ct, v as lt, w as ut, x as dt } from "./useLayerEdit-BFcZhiNX.js";
3
3
  import { A as ft, D as I, N as pt, O as mt, a as ht, c as gt, f as _t, h as vt, j as yt, k as bt, m as xt, n as St, o as Ct, r as wt, s as Tt, t as Et, u as Dt } from "./ColorModesWindow-CWhL6nfm.js";
4
4
  import { n as Ot, r as kt, t as At } from "./BindDot-CMUtpJPX.js";
5
- import { T as jt, _ as Mt, a as Nt, b as Pt, c as Ft, f as It, g as Lt, i as Rt, l as zt, n as Bt, r as Vt, t as Ht, v as Ut, x as Wt, y as Gt } from "./timelinePinned-BwYq1Msi.js";
5
+ import { C as jt, S as Mt, T as Nt, a as Pt, b as Ft, c as It, f as Lt, g as Rt, k as zt, l as Bt, o as Vt, p as Ht, s as Ut, w as Wt, x as Gt } from "./Timeline-BObvcdXF.js";
6
6
  import { i as Kt, t as qt } from "./previewScale-BMkeLc6w.js";
7
7
  import { AssetGrid as Jt, Button as L, CanvasZoomContext as Yt, CloseButton as Xt, ColorSwatch as Zt, ContentRow as Qt, ContextMenu as $t, CropOverlay as en, Divider as tn, Dropdown as nn, EyedropPick as rn, FullscreenOverlay as an, HueStrip as on, Input as sn, InspectorRail as cn, InspectorSection as ln, LabeledControl as un, LabeledControlSection as dn, MediaLibrary as fn, MediaTile as pn, MenuDropdownDivider as R, MenuDropdownItem as z, MenuDropdownNest as B, MenuItem as mn, ModalProvider as hn, OriginPicker as gn, PathNodeOverlay as _n, PopoverPanel as vn, SBSquare as yn, SearchInput as bn, SegmentedToggle as xn, SelectionOverlay as Sn, SettingsChoice as Cn, SettingsFooter as wn, SettingsPanel as Tn, SettingsRow as En, SettingsSwitch as Dn, ShellSearchOverlay as On, Slider as kn, Stepper as An, SwatchStack as jn, TabChips as Mn, ToggleCheckbox as Nn, ToggleSwitch as Pn, ToolPalette as Fn, Tooltip as V, ViewToggle as In, WheelTriangle as Ln, findLayerDeep as Rn, glyphSize as zn, rowLabelForLayer as Bn, svgToPngBlob as Vn, useContextMenu as Hn, useDragResize as Un, useGrabEdge as Wn, useModal as Gn, usePlaceholders as Kn, usePopover as qn } from "@kolkrabbi/kol-component";
8
8
  import { Component as Jn, createContext as Yn, useCallback as H, useContext as Xn, useEffect as U, useLayoutEffect as Zn, useMemo as Qn, useRef as W, useState as G, useSyncExternalStore as $n } from "react";
@@ -121,7 +121,7 @@ function Br(e) {
121
121
  loopGroup: t,
122
122
  presetId: e.id,
123
123
  presetLabel: e.label,
124
- params: Nt(Ze(e), n),
124
+ params: Bt(Ze(e), n),
125
125
  source: {
126
126
  kind: "preset",
127
127
  id: e.id,
@@ -130,7 +130,7 @@ function Br(e) {
130
130
  };
131
131
  }
132
132
  function Vr(e, t) {
133
- let n = t ? Mt(e, t) : (e.layers ?? []).find((e) => e?.type === "loop");
133
+ let n = t ? Gt(e, t) : (e.layers ?? []).find((e) => e?.type === "loop");
134
134
  if (!n) return null;
135
135
  let r = ut(n.loopId)?.params ?? [];
136
136
  return {
@@ -138,7 +138,7 @@ function Vr(e, t) {
138
138
  loopGroup: n.loopGroup,
139
139
  presetId: n.presetId,
140
140
  presetLabel: n.presetLabel,
141
- params: Nt(n, r),
141
+ params: Bt(n, r),
142
142
  source: {
143
143
  kind: "file",
144
144
  id: e.id,
@@ -153,7 +153,7 @@ function Hr(e) {
153
153
  loopGroup: e.loopGroup,
154
154
  presetId: e.presetId,
155
155
  presetLabel: e.presetLabel,
156
- params: Nt(e, t),
156
+ params: Bt(e, t),
157
157
  source: {
158
158
  kind: "stage",
159
159
  label: e.presetLabel || "Stage"
@@ -161,7 +161,7 @@ function Hr(e) {
161
161
  };
162
162
  }
163
163
  function Ur() {
164
- let e = It(), { layer: t, setOnly: n } = zr(), r = !!e.picker, i = e.mode === "blend" ? e.loopId : null, [a, o] = G(""), s = t?.type === "loop" && (e.steps.length < 2 || e.editing != null), { rows: c, make: l } = Qn(() => {
164
+ let e = Rt(), { layer: t, setOnly: n } = zr(), r = !!e.picker, i = e.mode === "blend" ? e.loopId : null, [a, o] = G(""), s = t?.type === "loop" && (e.steps.length < 2 || e.editing != null), { rows: c, make: l } = Qn(() => {
165
165
  let e = [], n = /* @__PURE__ */ new Map();
166
166
  if (!r) return {
167
167
  rows: e,
@@ -174,7 +174,7 @@ function Ur() {
174
174
  hint: et(t.loopGroup)?.label
175
175
  }), n.set("stage", () => Hr(t)));
176
176
  for (let t of (gt().preset ?? []).filter((e) => !e.shipped)) {
177
- if (t.mode === "morph" || !(i ? Mt(t, i) : (t.layers ?? []).some((e) => e?.type === "loop"))) continue;
177
+ if (t.mode === "morph" || !(i ? Gt(t, i) : (t.layers ?? []).some((e) => e?.type === "loop"))) continue;
178
178
  let r = `file:${t.id}`;
179
179
  e.push({
180
180
  id: r,
@@ -227,7 +227,7 @@ function Ur() {
227
227
  return /* @__PURE__ */ q(On, {
228
228
  open: !0,
229
229
  onClose: () => {
230
- zt({ picker: null }), o(""), d(null);
230
+ Ht({ picker: null }), o(""), d(null);
231
231
  },
232
232
  suggestions: f,
233
233
  results: p ? c.filter((e) => [
@@ -249,7 +249,7 @@ function Ur() {
249
249
  presetLabel: r.presetLabel,
250
250
  loopId: r.loopId,
251
251
  ...r.params
252
- }), Vt(r));
252
+ }), Ut(r));
253
253
  },
254
254
  placeholder: "Search presets and files",
255
255
  selectLabel: "Add step"
@@ -391,7 +391,7 @@ var Zr = () => Wr.map((e) => ({
391
391
  subs: [...new Set(Xr().filter((t) => t.type === e.id).map((e) => e.sub))]
392
392
  })), Qr = (e, t) => Xr().find((n) => n.type === e && (!t || n.category === t)), $r = (e) => Xr().find((t) => t.id === e);
393
393
  function ei(e) {
394
- e && (Ft({
394
+ e && (Lt({
395
395
  active: !0,
396
396
  ...e.morph,
397
397
  fileId: null,
@@ -497,7 +497,7 @@ function si({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
497
497
  t("kinetic", {
498
498
  presetId: e.id,
499
499
  presetLabel: e.label,
500
- comp: jt(e)
500
+ comp: zt(e)
501
501
  }), window.dispatchEvent(new CustomEvent("kol:open-params"));
502
502
  }, u = e?.presetId ?? null, d = (e?.filters ?? []).find((e) => e?.id !== "fx-media")?.id ?? null, f = u ? it(e?.loopGroup).find((e) => e.id === u) ?? null : null, p = (n, r = "loop", i) => {
503
503
  let a = it(n), o = [...new Set(a.map((e) => e.sub).filter(Boolean))], s = (e) => r === "misc" ? () => {
@@ -575,7 +575,7 @@ function si({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
575
575
  label: t,
576
576
  onSelect: () => ei(Qr(e.id, t)),
577
577
  active: (() => {
578
- let n = Xr().find((e) => e.id === Rt().presetId);
578
+ let n = Xr().find((e) => e.id === It().presetId);
579
579
  return n?.type === e.id && n.category === t;
580
580
  })()
581
581
  }))
@@ -600,14 +600,14 @@ function si({ layer: e, setOnly: t, addFilter: n, patchFilter: r, carriedSource:
600
600
  id: "sec:composition",
601
601
  label: "Composition"
602
602
  },
603
- ...Wt.map((t) => ({
603
+ ...Nt.map((t) => ({
604
604
  id: `kin:${t.label}`,
605
605
  label: t.label,
606
606
  icon: ti[`kin:${t.label}`] ?? "square",
607
607
  pages: t.subs.map((t) => ({
608
608
  label: t,
609
- onSelect: () => l(Pt.find((e) => e.sub === t)),
610
- active: e?.type === "kinetic" && Pt.some((e) => e.sub === t && e.id === u)
609
+ onSelect: () => l(Wt.find((e) => e.sub === t)),
610
+ active: e?.type === "kinetic" && Wt.some((e) => e.sub === t && e.id === u)
611
611
  }))
612
612
  })),
613
613
  ...pt.map((e) => ({
@@ -960,12 +960,12 @@ var Ci = [
960
960
  ...bi(a, n),
961
961
  type: i
962
962
  }]);
963
- }).filter(Boolean), n = Pt[0];
963
+ }).filter(Boolean), n = Wt[0];
964
964
  t.push(_i(`ship:labs:type-${n.id}`, n.label, "labs", "Composition", "Kinetic type", [vi("kinetic", {
965
965
  ...yi,
966
966
  presetId: n.id,
967
967
  presetLabel: n.label,
968
- comp: jt(n)
968
+ comp: zt(n)
969
969
  })]));
970
970
  let r = wi.map((t) => {
971
971
  let n = e(t), r = n[1] ?? n[0];
@@ -2621,7 +2621,7 @@ function bo(e, t, n, r, i, a = vo(n, r)) {
2621
2621
  }
2622
2622
  function xo(e, t, n) {
2623
2623
  let r = Array.from({ length: e }, (e, t) => t);
2624
- return t === "loop" ? Lt([...r, e], "once", n) : Lt(r, t, n);
2624
+ return t === "loop" ? Ft([...r, e], "once", n) : Ft(r, t, n);
2625
2625
  }
2626
2626
  function So(e, t, n, r, i, a) {
2627
2627
  let o = i.morph?.steps ?? [], s = o.length;
@@ -3359,18 +3359,18 @@ function Us() {
3359
3359
  if (!(!o && !s)) {
3360
3360
  if (o) {
3361
3361
  let t = Fi(o);
3362
- t ? (t.mode === "morph" && t.morph ? Ft({
3362
+ t ? (t.mode === "morph" && t.morph ? Lt({
3363
3363
  active: !0,
3364
3364
  ...t.morph,
3365
3365
  fileId: t.shipped ? null : t.id,
3366
3366
  fileName: t.name ?? null
3367
- }) : Ft(), setTimeout(() => {
3367
+ }) : Lt(), setTimeout(() => {
3368
3368
  e(t), t.mode === "morph" && t.morph?.seconds > 0 && A.setLoopSeconds(t.morph.seconds), !t.thumb && !t.shipped && setTimeout(async () => {
3369
3369
  let e = await r.current?.captureThumb();
3370
3370
  e && n("preset", t.id, e);
3371
3371
  }, Vs);
3372
3372
  }, 0)) : typeof console < "u" && console.warn(`open: no saved file ${o}`);
3373
- } else s && (t(), Ft(s === "morph" ? {
3373
+ } else s && (t(), Lt(s === "morph" ? {
3374
3374
  active: !0,
3375
3375
  picker: "preset"
3376
3376
  } : {}));
@@ -6795,7 +6795,7 @@ var Ed = 1, Dd = /* @__PURE__ */ new Set(), Od = (e) => {
6795
6795
  children: e
6796
6796
  }), qd = () => !1;
6797
6797
  function Jd() {
6798
- let { aspect: e, setAspect: t, view: n, setView: r, layers: i, selectedId: a, selectedIds: o, select: s, updateLayer: l, addLayer: u, flattenSelected: d, releaseBoolean: f, booleanSelected: p, convertShapeToPath: m, groupLayers: h, palette: g, alignSelected: _, flattenText: y, beginTransaction: b, commitTransaction: x, canUndo: S, canRedo: w, undo: T, redo: E, clearLayers: D, currentPresetId: ee, loadPreset: te, loadPalette: O, insertFromLibrary: ne, snapEnabled: re, toggleSnap: ie, showGrid: ae, toggleGrid: oe, showRulers: se } = v(), { library: ce } = _t(), le = Gn(), ue = kt(), de = Bt(), fe = kd(), pe = eu(), me = $l(pe), he = async () => {
6798
+ let { aspect: e, setAspect: t, view: n, setView: r, layers: i, selectedId: a, selectedIds: o, select: s, updateLayer: l, addLayer: u, flattenSelected: d, releaseBoolean: f, booleanSelected: p, convertShapeToPath: m, groupLayers: h, palette: g, alignSelected: _, flattenText: y, beginTransaction: b, commitTransaction: x, canUndo: S, canRedo: w, undo: T, redo: E, clearLayers: D, currentPresetId: ee, loadPreset: te, loadPalette: O, insertFromLibrary: ne, snapEnabled: re, toggleSnap: ie, showGrid: ae, toggleGrid: oe, showRulers: se } = v(), { library: ce } = _t(), le = Gn(), ue = kt(), de = Vt(), fe = kd(), pe = eu(), me = $l(pe), he = async () => {
6799
6799
  let e = (await le.prompt("Workspace name", me ?? ""))?.trim();
6800
6800
  e && Xl(e);
6801
6801
  }, ge = (Md()?.useTimelineUp ?? qd)(), _e = ir()?.setNavHidden;
@@ -7246,7 +7246,7 @@ function Jd() {
7246
7246
  children: /* @__PURE__ */ J("div", {
7247
7247
  className: "py-1 w-[240px]",
7248
7248
  children: [
7249
- Object.entries(Ut).map(([e, t]) => /* @__PURE__ */ q(z, {
7249
+ Object.entries(Mt).map(([e, t]) => /* @__PURE__ */ q(z, {
7250
7250
  onClick: () => p(e),
7251
7251
  disabled: !Fe,
7252
7252
  children: t
@@ -7488,7 +7488,7 @@ function Jd() {
7488
7488
  "File"
7489
7489
  ].map((e) => /* @__PURE__ */ q(z, {
7490
7490
  onClick: () => {
7491
- F && !ge && Ht(), gd(e);
7491
+ F && !ge && Pt(), gd(e);
7492
7492
  },
7493
7493
  children: e
7494
7494
  }, e))
@@ -7507,7 +7507,7 @@ function Jd() {
7507
7507
  }, e))
7508
7508
  }),
7509
7509
  F && /* @__PURE__ */ q(z, {
7510
- onClick: Ht,
7510
+ onClick: Pt,
7511
7511
  shortcut: Ud(de),
7512
7512
  children: "Timeline"
7513
7513
  }),
@@ -12275,7 +12275,7 @@ function hm() {
12275
12275
  onRename: (e, t) => c(e, { name: t }),
12276
12276
  onReorder: l,
12277
12277
  onGroup: i,
12278
- labelFor: Gt,
12278
+ labelFor: jt,
12279
12279
  iconFor: fm
12280
12280
  });
12281
12281
  }
@@ -12511,16 +12511,16 @@ function Mm() {
12511
12511
  //#region src/editor/compose/HistoryPanel.jsx
12512
12512
  function Nm(e, t) {
12513
12513
  let n = new Map(e.layers.map((e) => [e.id, e])), r = new Map(t.layers.map((e) => [e.id, e])), i = t.layers.find((e) => !n.has(e.id));
12514
- if (i) return `Add ${Gt(i)}`;
12514
+ if (i) return `Add ${jt(i)}`;
12515
12515
  let a = e.layers.find((e) => !r.has(e.id));
12516
- if (a) return `Delete ${Gt(a)}`;
12516
+ if (a) return `Delete ${jt(a)}`;
12517
12517
  let o = t.layers.find((e) => n.get(e.id) !== e);
12518
12518
  if (o) {
12519
12519
  let e = n.get(o.id);
12520
12520
  return `${Object.keys({
12521
12521
  ...e,
12522
12522
  ...o
12523
- }).filter((t) => e[t] !== o[t]).every((e) => e === "x" || e === "y") ? "Move" : "Edit"} ${Gt(o)}`;
12523
+ }).filter((t) => e[t] !== o[t]).every((e) => e === "x" || e === "y") ? "Move" : "Edit"} ${jt(o)}`;
12524
12524
  }
12525
12525
  return e.layers.map((e) => e.id).join() === t.layers.map((e) => e.id).join() ? "Select" : "Reorder layers";
12526
12526
  }
package/dist/core.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { Ln as e, vn as t } from "./rolls-BGtqxVYq.js";
2
2
  import { C as n, E as r, S as i, T as a, _ as o, b as s, c, d as l, f as u, g as d, i as f, l as p, m, p as h, r as g, v as _, w as v, x as y, y as b } from "./ColorModesWindow-CWhL6nfm.js";
3
- import { A as x, Ct as S, D as C, E as w, F as T, L as ee, M as E, N as D, O, _t as k, a as A, b as j, c as M, d as N, dt as P, f as F, gt as I, ht as L, i as R, j as z, l as B, lt as V, mt as H, n as U, o as W, p as G, r as K, s as q, t as J, u as Y, wt as X, xt as Z, y as Q, z as $ } from "./core-CfGqY4VB.js";
4
- export { w as AppSettingsSections, T as BRAND, J as DesignEditor, J as default, C as DisplaySettingsDrawer, G as EditorProviders, D as FilesDialog, g as GeneratorLibraryProvider, f as LIBRARY_SLOT_KEYS, L as MODES, Y as OutputCanvas, N as OutputStage, F as OutputView, q as RAIL_EXTRA_PREFIX, h as UnauthorizedError, I as VIEW_PATHS, x as closeFiles, ee as comboLabel, U as copyStored, k as currentView, K as duplicateStored, m as getLibraryApi, d as inviteFromRequest, V as isMobileDevice, o as listInviteRequests, c as loadLibrary, _ as mintInvite, z as openFiles, p as readLibraryRaw, e as registerPack, R as removeStored, A as renameStored, b as requestInvite, s as setLibraryApi, Q as setMediaClient, j as setMediaProxyBase, Z as setMode, S as setNavigator, M as setRailExtras, t as setSettingsStore, W as setThumbStored, P as setWantsDesktop, $ as shortcutsBySection, y as signInLibrary, i as signOutLibrary, n as signUpLibrary, l as subscribeLibrary, v as updateAccount, a as useAccount, E as useFilesDialog, u as useGeneratorLibrary, r as useLibrarySession, B as useRailExtras, O as useSettingsSections, H as wantsDesktop, X as withView };
3
+ import { n as x, r as S } from "./Timeline-BObvcdXF.js";
4
+ import { A as C, Ct as w, D as T, E as ee, F as E, L as D, M as O, N as k, O as A, _t as j, a as M, b as N, c as P, d as F, dt as I, f as L, gt as R, ht as z, i as B, j as V, l as H, lt as U, mt as W, n as G, o as K, p as q, r as J, s as Y, t as X, u as Z, wt as Q, xt as $, y as te, z as ne } from "./core-EWu8GfXL.js";
5
+ export { ee as AppSettingsSections, E as BRAND, X as DesignEditor, X as default, T as DisplaySettingsDrawer, q as EditorProviders, k as FilesDialog, g as GeneratorLibraryProvider, f as LIBRARY_SLOT_KEYS, z as MODES, Z as OutputCanvas, F as OutputStage, L as OutputView, Y as RAIL_EXTRA_PREFIX, x as TimelineRail, h as UnauthorizedError, R as VIEW_PATHS, C as closeFiles, D as comboLabel, G as copyStored, j as currentView, J as duplicateStored, m as getLibraryApi, d as inviteFromRequest, U as isMobileDevice, o as listInviteRequests, c as loadLibrary, _ as mintInvite, V as openFiles, p as readLibraryRaw, e as registerPack, B as removeStored, M as renameStored, b as requestInvite, s as setLibraryApi, te as setMediaClient, N as setMediaProxyBase, $ as setMode, w as setNavigator, P as setRailExtras, t as setSettingsStore, K as setThumbStored, I as setWantsDesktop, ne as shortcutsBySection, y as signInLibrary, i as signOutLibrary, n as signUpLibrary, l as subscribeLibrary, S as timelineView, v as updateAccount, a as useAccount, O as useFilesDialog, u as useGeneratorLibrary, r as useLibrarySession, H as useRailExtras, A as useSettingsSections, W as wantsDesktop, Q as withView };