@dfosco/storyboard-core 4.2.4 → 4.2.5

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,6 +1,6 @@
1
1
  import { composerDraftKey as Ln, getDraft as Sn, saveDraft as Me, clearDraft as p2, getCachedUser as m2, replyDraftKey as kn, unresolveComment as L6, resolveComment as S6, editComment as k6, removeReaction as qt, addReaction as Xt, replyToComment as E6, editReply as N6, deleteComment as R6, subscribeToCommentMode as En, isCommentModeActive as A0, setCommentMode as te, isCommentsEnabled as Jt, isAuthenticated as v2, toggleCommentMode as se, getCachedComments as B6, fetchRouteCommentsSummary as _6, setCachedComments as P6, fetchCommentDetail as Nn, getPendingComments as O6, createComment as Q7, removePendingComment as Rn, clearCachedComments as Bn, moveComment as T6, getCommentsConfig as j6, savePendingComment as I6 } from "@dfosco/storyboard-core/comments";
2
2
  import * as p from "react";
3
- import q0, { forwardRef as C1, useMemo as l1, useState as R, createElement as g2, useContext as $6, createContext as D6, useRef as G1, useCallback as U1, useEffect as y1, useLayoutEffect as z6, Suspense as F6, lazy as W6 } from "react";
3
+ import q0, { forwardRef as C1, useMemo as l1, useState as R, createElement as g2, useContext as $6, createContext as D6, useRef as G1, useCallback as U1, useEffect as f1, useLayoutEffect as z6, Suspense as F6, lazy as W6 } from "react";
4
4
  import { createRoot as _n } from "react-dom/client";
5
5
  import { jsx as c, jsxs as x, Fragment as P1 } from "react/jsx-runtime";
6
6
  import { deepMerge as U6, getToolbarConfig as Pn, subscribeToToolbarConfig as G6, isMenuHidden as K6, hasChildrenProvider as Qt, getActionChildren as b7, clearDynamicActions as ea, isExcludedByRoute as et, setDynamicActions as Y6, setRoutingBasePath as q6, initCommandActions as X6, registerCommandAction as ta, getPrototypeMetadata as J6, setPrototypeToolbarConfig as Q6, clearPrototypeToolbarConfig as aa, isModeSwitcherVisible as na, getRegisteredModes as ra, getCurrentMode as la, subscribeToMode as el, getCanvasZoom as tl, getTheme as al, getThemeSyncTargets as nl, themeState as rl, themeSyncState as ll, THEMES as il, setTheme as ol, setThemeSyncTarget as sl, subscribeToCommandActions as cl, getConfig as Z7, buildPrototypeIndex as hl } from "@dfosco/storyboard-core";
@@ -393,7 +393,7 @@ const pl = (e, t) => {
393
393
  repeat: ["", "x", "y", "space", "round"]
394
394
  }], o1 = () => ["auto", "cover", "contain", Yl, Fl, {
395
395
  size: [i1, r1]
396
- }], f1 = () => [Ge, n2, C5], D = () => [
396
+ }], y1 = () => [Ge, n2, C5], D = () => [
397
397
  // Deprecated since Tailwind CSS v4.0.0
398
398
  "",
399
399
  "none",
@@ -1504,21 +1504,21 @@ const pl = (e, t) => {
1504
1504
  * @see https://tailwindcss.com/docs/gradient-color-stops
1505
1505
  */
1506
1506
  "gradient-from-pos": [{
1507
- from: f1()
1507
+ from: y1()
1508
1508
  }],
1509
1509
  /**
1510
1510
  * Gradient Color Stops Via Position
1511
1511
  * @see https://tailwindcss.com/docs/gradient-color-stops
1512
1512
  */
1513
1513
  "gradient-via-pos": [{
1514
- via: f1()
1514
+ via: y1()
1515
1515
  }],
1516
1516
  /**
1517
1517
  * Gradient Color Stops To Position
1518
1518
  * @see https://tailwindcss.com/docs/gradient-color-stops
1519
1519
  */
1520
1520
  "gradient-to-pos": [{
1521
- to: f1()
1521
+ to: y1()
1522
1522
  }],
1523
1523
  /**
1524
1524
  * Gradient Color Stops From
@@ -3196,8 +3196,8 @@ var X0 = ii(), oi = (e) => {
3196
3196
  const { class: S, className: N, ...E } = $[B];
3197
3197
  let F = !0;
3198
3198
  const o1 = W(null, z);
3199
- for (const f1 in E) {
3200
- const D = E[f1], X = o1[f1];
3199
+ for (const y1 in E) {
3200
+ const D = E[y1], X = o1[y1];
3201
3201
  if (Array.isArray(D)) {
3202
3202
  if (!D.includes(X)) {
3203
3203
  F = !1;
@@ -3241,8 +3241,8 @@ var X0 = ii(), oi = (e) => {
3241
3241
  if (!w0(E)) {
3242
3242
  let F = !0;
3243
3243
  for (const o1 in E) {
3244
- const f1 = O[o1], D = E[o1];
3245
- if (f1 === void 0 || (Array.isArray(D) ? !D.includes(f1) : D !== f1)) {
3244
+ const y1 = O[o1], D = E[o1];
3245
+ if (y1 === void 0 || (Array.isArray(D) ? !D.includes(y1) : D !== y1)) {
3246
3246
  F = !1;
3247
3247
  break;
3248
3248
  }
@@ -4044,7 +4044,7 @@ function Di({ comment: e, discussion: t, user: a = null, onClose: r, onMove: n,
4044
4044
  var I;
4045
4045
  return ((I = Sn(i)) == null ? void 0 : I.text) ?? "";
4046
4046
  }), [Z, M] = R(!1), [H, C] = R(-1), [L, V] = R(""), [P, W] = R(!1), [G, a1] = R(null), [Q, $] = R(() => [...e.reactionGroups ?? []]), [z, O] = R(() => (e.replies ?? []).map((I) => [...I.reactionGroups ?? []])), [_, B] = R(() => (e.replies ?? []).map((I) => I.text ?? I.body ?? "")), S = !!((n0 = e.meta) != null && n0.resolved), N = e.text ?? "", E = e.replies ?? [], F = !!(a && ((U = e.author) == null ? void 0 : U.login) === a.login), o1 = !!(a && t);
4047
- function f1() {
4047
+ function y1() {
4048
4048
  f.trim() ? Me(i, { type: "reply", text: f }) : p2(i);
4049
4049
  }
4050
4050
  function D(I) {
@@ -4311,7 +4311,7 @@ function Di({ comment: e, discussion: t, user: a = null, onClose: r, onMove: n,
4311
4311
  ] })
4312
4312
  ] }),
4313
4313
  o1 && /* @__PURE__ */ x("div", { className: "border-t border-border px-3 py-3 flex flex-col", children: [
4314
- /* @__PURE__ */ c(ae, { className: "min-h-[40px] max-h-[100px] text-xs mb-1", placeholder: "Reply…", value: f, onChange: (I) => b(I.target.value), onKeyDown: v0, onBlur: f1 }),
4314
+ /* @__PURE__ */ c(ae, { className: "min-h-[40px] max-h-[100px] text-xs mb-1", placeholder: "Reply…", value: f, onChange: (I) => b(I.target.value), onKeyDown: v0, onBlur: y1 }),
4315
4315
  /* @__PURE__ */ c("div", { className: "flex justify-end mt-1", children: /* @__PURE__ */ c(F1, { size: "sm", className: "text-xs", disabled: !f.trim() || Z, onClick: W1, children: Z ? "Posting…" : "Reply" }) })
4316
4316
  ] })
4317
4317
  ] });
@@ -6459,7 +6459,7 @@ function A8() {
6459
6459
  } catch {
6460
6460
  }
6461
6461
  }, []);
6462
- return y1(() => {
6462
+ return f1(() => {
6463
6463
  const i = () => t(!1);
6464
6464
  window.addEventListener("beforeinstallprompt", r), window.addEventListener("appinstalled", i);
6465
6465
  const o = K4((s) => {
@@ -8226,7 +8226,7 @@ var Zt = "PopperContent", [Jc, Qc] = h3(Zt), v3 = p.forwardRef(
8226
8226
  k0(() => {
8227
8227
  _ && (E == null || E());
8228
8228
  }, [_, E]);
8229
- const F = (m1 = B.arrow) == null ? void 0 : m1.x, o1 = (S1 = B.arrow) == null ? void 0 : S1.y, f1 = ((u1 = B.arrow) == null ? void 0 : u1.centerOffset) !== 0, [D, X] = p.useState();
8229
+ const F = (m1 = B.arrow) == null ? void 0 : m1.x, o1 = (S1 = B.arrow) == null ? void 0 : S1.y, y1 = ((u1 = B.arrow) == null ? void 0 : u1.centerOffset) !== 0, [D, X] = p.useState();
8230
8230
  return k0(() => {
8231
8231
  f && X(window.getComputedStyle(f).zIndex);
8232
8232
  }, [f]), /* @__PURE__ */ c(
@@ -8261,7 +8261,7 @@ var Zt = "PopperContent", [Jc, Qc] = h3(Zt), v3 = p.forwardRef(
8261
8261
  onArrowChange: H,
8262
8262
  arrowX: F,
8263
8263
  arrowY: o1,
8264
- shouldHideArrow: f1,
8264
+ shouldHideArrow: y1,
8265
8265
  children: /* @__PURE__ */ c(
8266
8266
  s3.div,
8267
8267
  {
@@ -9889,21 +9889,21 @@ function Xu() {
9889
9889
  };
9890
9890
  a.exports = function(L, V, P, W, G, a1, Q) {
9891
9891
  i(P, V, W);
9892
- var $ = function(f1) {
9893
- if (f1 === G && S) return S;
9894
- if (!f && f1 in _) return _[f1];
9895
- switch (f1) {
9892
+ var $ = function(y1) {
9893
+ if (y1 === G && S) return S;
9894
+ if (!f && y1 in _) return _[y1];
9895
+ switch (y1) {
9896
9896
  case Z:
9897
9897
  return function() {
9898
- return new P(this, f1);
9898
+ return new P(this, y1);
9899
9899
  };
9900
9900
  case M:
9901
9901
  return function() {
9902
- return new P(this, f1);
9902
+ return new P(this, y1);
9903
9903
  };
9904
9904
  case H:
9905
9905
  return function() {
9906
- return new P(this, f1);
9906
+ return new P(this, y1);
9907
9907
  };
9908
9908
  }
9909
9909
  return function() {
@@ -11865,16 +11865,16 @@ function Ap({ name: e, size: t = 16 }) {
11865
11865
  }
11866
11866
  function Cp({ resizable: e = !0, onClose: t }) {
11867
11867
  const [a, r] = R({ open: !1, activeTab: "inspector" }), [n, l] = R(420), [i, o] = R(300), [s, h] = R("side"), [u, d] = R(!1), m = G1(null), v = s === "bottom";
11868
- y1(() => Vt.subscribe(r), []), y1(() => {
11868
+ f1(() => Vt.subscribe(r), []), f1(() => {
11869
11869
  document.documentElement.style.setProperty("--sb--sidepanel-width", `${n}px`);
11870
- }, [n]), y1(() => {
11870
+ }, [n]), f1(() => {
11871
11871
  document.documentElement.style.setProperty("--sb--sidepanel-height", `${i}px`);
11872
- }, [i]), y1(() => (document.documentElement.classList.toggle("sb-sidepanel-bottom", v), () => document.documentElement.classList.remove("sb-sidepanel-bottom")), [v]), y1(() => {
11872
+ }, [i]), f1(() => (document.documentElement.classList.toggle("sb-sidepanel-bottom", v), () => document.documentElement.classList.remove("sb-sidepanel-bottom")), [v]), f1(() => {
11873
11873
  a.open && m.current && requestAnimationFrame(() => {
11874
11874
  var H;
11875
11875
  return (H = m.current) == null ? void 0 : H.focus();
11876
11876
  });
11877
- }, [a.open]), y1(() => {
11877
+ }, [a.open]), f1(() => {
11878
11878
  const H = localStorage.getItem("sb-sidepanel-width");
11879
11879
  if (H) {
11880
11880
  const V = parseInt(H, 10);
@@ -11887,13 +11887,13 @@ function Cp({ resizable: e = !0, onClose: t }) {
11887
11887
  }
11888
11888
  const L = localStorage.getItem("sb-sidepanel-position");
11889
11889
  (L === "side" || L === "bottom") && h(L);
11890
- }, []), y1(() => {
11890
+ }, []), f1(() => {
11891
11891
  localStorage.setItem("sb-sidepanel-width", String(n));
11892
- }, [n]), y1(() => {
11892
+ }, [n]), f1(() => {
11893
11893
  localStorage.setItem("sb-sidepanel-height", String(i));
11894
- }, [i]), y1(() => {
11894
+ }, [i]), f1(() => {
11895
11895
  localStorage.setItem("sb-sidepanel-position", s);
11896
- }, [s]), y1(() => {
11896
+ }, [s]), f1(() => {
11897
11897
  function H(C) {
11898
11898
  C.key === "Escape" && a.open && (C.preventDefault(), I7(), t == null || t());
11899
11899
  }
@@ -12075,7 +12075,7 @@ const Ep = {
12075
12075
  };
12076
12076
  function pn(e) {
12077
12077
  const [t, a] = R(() => ({ ...e }));
12078
- return y1(() => {
12078
+ return f1(() => {
12079
12079
  if (e.subscribe)
12080
12080
  return e.subscribe((n) => a({ ...n }));
12081
12081
  }, [e]), t;
@@ -12083,10 +12083,10 @@ function pn(e) {
12083
12083
  function Np({ basePath: e = "/", toolbarConfig: t, customHandlers: a = {} }) {
12084
12084
  const [r, n] = R(
12085
12085
  () => !document.documentElement.classList.contains("storyboard-chrome-hidden")
12086
- ), [l, i] = R({}), [o, s] = R({}), [h, u] = R(0), [d, m] = R(null), [v, g] = R(!1), [w, y] = R(""), [f, b] = R(100), [Z, M] = R(0), [H, C] = R(G4()), [L, V] = R(-1), [P, W] = R(!1), [G, a1] = R("default"), [Q, $] = R(""), [z, O] = R(null), _ = G1(null), B = G1(!1), S = G1(null), N = G1(null), E = G1(null), F = pn(Ep), o1 = pn(Vt), [f1, D] = R(Pn());
12087
- y1(() => G6((q) => D(q)), []), y1(() => sp(() => M((q) => q + 1)), []);
12088
- const X = l1(() => f1 && Object.keys(f1).length > 0 ? f1 : t || up, [f1, t]);
12089
- y1(() => {
12086
+ ), [l, i] = R({}), [o, s] = R({}), [h, u] = R(0), [d, m] = R(null), [v, g] = R(!1), [w, y] = R(""), [f, b] = R(100), [Z, M] = R(0), [H, C] = R(G4()), [L, V] = R(-1), [P, W] = R(!1), [G, a1] = R("default"), [Q, $] = R(""), [z, O] = R(null), _ = G1(null), B = G1(!1), S = G1(null), N = G1(null), E = G1(null), F = pn(Ep), o1 = pn(Vt), [y1, D] = R(Pn());
12087
+ f1(() => G6((q) => D(q)), []), f1(() => sp(() => M((q) => q + 1)), []);
12088
+ const X = l1(() => y1 && Object.keys(y1).length > 0 ? y1 : t || up, [y1, t]);
12089
+ f1(() => {
12090
12090
  const k = X.tools || {};
12091
12091
  op(k, { isLocalDev: d7 });
12092
12092
  }, [X]);
@@ -12264,7 +12264,7 @@ function Np({ basePath: e = "/", toolbarConfig: t, customHandlers: a = {} }) {
12264
12264
  var q;
12265
12265
  g(!0), b(((q = k.detail) == null ? void 0 : q.zoom) ?? 100);
12266
12266
  }, []);
12267
- return y1(() => {
12267
+ return f1(() => {
12268
12268
  let k = !0;
12269
12269
  q6(e);
12270
12270
  const q = new MutationObserver(() => {
@@ -12339,11 +12339,11 @@ function Np({ basePath: e = "/", toolbarConfig: t, customHandlers: a = {} }) {
12339
12339
  return () => {
12340
12340
  k = !1, E.current && window.removeEventListener("popstate", E.current), S.current && (history.pushState = S.current), N.current && (history.replaceState = N.current), w1(), ea("mobile-toolbar"), q.disconnect();
12341
12341
  };
12342
- }, []), y1(() => (document.addEventListener("storyboard:canvas:mounted", p1), document.addEventListener("storyboard:canvas:unmounted", E1), document.addEventListener("storyboard:canvas:zoom-changed", g1), document.addEventListener("storyboard:canvas:status", p1), () => {
12342
+ }, []), f1(() => (document.addEventListener("storyboard:canvas:mounted", p1), document.addEventListener("storyboard:canvas:unmounted", E1), document.addEventListener("storyboard:canvas:zoom-changed", g1), document.addEventListener("storyboard:canvas:status", p1), () => {
12343
12343
  document.removeEventListener("storyboard:canvas:mounted", p1), document.removeEventListener("storyboard:canvas:unmounted", E1), document.removeEventListener("storyboard:canvas:zoom-changed", g1), document.removeEventListener("storyboard:canvas:status", p1);
12344
- }), [p1, E1, g1]), y1(() => {
12344
+ }), [p1, E1, g1]), f1(() => {
12345
12345
  J();
12346
- }, [H, J]), y1(() => {
12346
+ }, [H, J]), f1(() => {
12347
12347
  function k(q) {
12348
12348
  var s1;
12349
12349
  const w1 = ((s1 = S1.hideChrome) == null ? void 0 : s1.key) || ".";
@@ -13402,7 +13402,7 @@ function Bm() {
13402
13402
  scope: "number",
13403
13403
  begin: W,
13404
13404
  relevance: 0
13405
- }, f1 = {
13405
+ }, y1 = {
13406
13406
  scope: "number",
13407
13407
  begin: G,
13408
13408
  relevance: 0
@@ -13436,7 +13436,7 @@ function Bm() {
13436
13436
  __proto__: null,
13437
13437
  APOS_STRING_MODE: z,
13438
13438
  BACKSLASH_ESCAPE: $,
13439
- BINARY_NUMBER_MODE: f1,
13439
+ BINARY_NUMBER_MODE: y1,
13440
13440
  BINARY_NUMBER_RE: G,
13441
13441
  COMMENT: B,
13442
13442
  C_BLOCK_COMMENT_MODE: N,
@@ -16079,7 +16079,7 @@ function Xm() {
16079
16079
  var O;
16080
16080
  (O = H.current) == null || O.deactivate(), l(!1);
16081
16081
  }, []);
16082
- y1(() => {
16082
+ f1(() => {
16083
16083
  const O = Rm({
16084
16084
  onSelect: (_) => {
16085
16085
  const B = p7(_), S = m7(_);
@@ -16127,7 +16127,7 @@ function Xm() {
16127
16127
  })(), () => {
16128
16128
  O.deactivate(), O.hideHighlight(), I5(null), document.removeEventListener("storyboard:theme:changed", a1);
16129
16129
  };
16130
- }, []), y1(() => {
16130
+ }, []), f1(() => {
16131
16131
  if (!e) {
16132
16132
  o(""), d(""), w("");
16133
16133
  return;
@@ -16166,7 +16166,7 @@ function Xm() {
16166
16166
  }), () => {
16167
16167
  _ = !0;
16168
16168
  };
16169
- }, [e, a]), y1(() => {
16169
+ }, [e, a]), f1(() => {
16170
16170
  M.current && g && requestAnimationFrame(() => {
16171
16171
  var _;
16172
16172
  const O = (_ = M.current) == null ? void 0 : _.querySelector(".highlighted-line");
@@ -16175,7 +16175,7 @@ function Xm() {
16175
16175
  M.current.scrollTo({ top: B, behavior: "smooth" });
16176
16176
  } else M.current && (M.current.scrollTop = 0);
16177
16177
  });
16178
- }, [g]), y1(() => {
16178
+ }, [g]), f1(() => {
16179
16179
  !i || !u || (async () => {
16180
16180
  try {
16181
16181
  const _ = (await G()).codeToHtml(i, {
@@ -17511,7 +17511,7 @@ var C0 = "MenuContent", [fg, Pt] = R5(C0), Ar = p.forwardRef(
17511
17511
  ...w
17512
17512
  } = e, y = f5(C0, a), f = _2(C0, a), b = B2(a), Z = yr(a), M = pg(a), [H, C] = p.useState(null), L = p.useRef(null), V = X1(t, L, y.onContentChange), P = p.useRef(0), W = p.useRef(""), G = p.useRef(0), a1 = p.useRef(null), Q = p.useRef("right"), $ = p.useRef(0), z = g ? ct : p.Fragment, O = g ? { as: Zg, allowPinchZoom: !0 } : void 0, _ = (S) => {
17513
17513
  var m1, S1;
17514
- const N = W.current + S, E = M().filter((u1) => !u1.disabled), F = document.activeElement, o1 = (m1 = E.find((u1) => u1.ref.current === F)) == null ? void 0 : m1.textValue, f1 = E.map((u1) => u1.textValue), D = Rg(f1, N, o1), X = (S1 = E.find((u1) => u1.textValue === D)) == null ? void 0 : S1.ref.current;
17514
+ const N = W.current + S, E = M().filter((u1) => !u1.disabled), F = document.activeElement, o1 = (m1 = E.find((u1) => u1.ref.current === F)) == null ? void 0 : m1.textValue, y1 = E.map((u1) => u1.textValue), D = Rg(y1, N, o1), X = (S1 = E.find((u1) => u1.textValue === D)) == null ? void 0 : S1.ref.current;
17515
17515
  (function u1(B1) {
17516
17516
  W.current = B1, window.clearTimeout(P.current), B1 !== "" && (P.current = window.setTimeout(() => u1(""), 1e3));
17517
17517
  })(N), X && setTimeout(() => X.focus());
@@ -17598,8 +17598,8 @@ var C0 = "MenuContent", [fg, Pt] = R5(C0), Ar = p.forwardRef(
17598
17598
  onKeyDown: b1(w.onKeyDown, (S) => {
17599
17599
  const E = S.target.closest("[data-radix-menu-content]") === S.currentTarget, F = S.ctrlKey || S.altKey || S.metaKey, o1 = S.key.length === 1;
17600
17600
  E && (S.key === "Tab" && S.preventDefault(), !F && o1 && _(S.key));
17601
- const f1 = L.current;
17602
- if (S.target !== f1 || !hg.includes(S.key)) return;
17601
+ const y1 = L.current;
17602
+ if (S.target !== y1 || !hg.includes(S.key)) return;
17603
17603
  S.preventDefault();
17604
17604
  const X = M().filter((m1) => !m1.disabled).map((m1) => m1.ref.current);
17605
17605
  wr.includes(S.key) && X.reverse(), Eg(X);
@@ -18377,7 +18377,7 @@ function Lw({ onClose: e }) {
18377
18377
  ), N = l1(
18378
18378
  () => S ? S.split("-").map((K) => K.charAt(0).toUpperCase() + K.slice(1)).join("").replace(/([A-Z])/g, " $1").trim() : "",
18379
18379
  [S]
18380
- ), E = l ? r : N, F = S ? `/${S}` : "", o1 = l1(() => t.trim() && !S ? "Name must contain at least one alphanumeric character" : t.trim() && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(S) ? "Name must be kebab-case" : null, [t, S]), f1 = l1(() => {
18380
+ ), E = l ? r : N, F = S ? `/${S}` : "", o1 = l1(() => t.trim() && !S ? "Name must contain at least one alphanumeric character" : t.trim() && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(S) ? "Name must be kebab-case" : null, [t, S]), y1 = l1(() => {
18381
18381
  if (!f || !Z.trim()) return null;
18382
18382
  try {
18383
18383
  const K = new URL(Z.trim());
@@ -18385,14 +18385,14 @@ function Lw({ onClose: e }) {
18385
18385
  } catch {
18386
18386
  return "Must be a valid URL (e.g. https://example.com)";
18387
18387
  }
18388
- }, [f, Z]), D = !!S && !o1 && !G && (!f || !!Z.trim() && !f1), X = o ? `${o}.folder` : "", m1 = l1(
18388
+ }, [f, Z]), D = !!S && !o1 && !G && (!f || !!Z.trim() && !y1), X = o ? `${o}.folder` : "", m1 = l1(
18389
18389
  () => L.filter((K) => K.scope === "global" || (o ? K.folder === o : !1)),
18390
18390
  [L, o]
18391
18391
  ), S1 = h ? ((k1 = m1.find((K) => K.id === h)) == null ? void 0 : k1.name) ?? h : "No template", u1 = l1(() => m1.filter((K) => K.kind === "template"), [m1]), B1 = l1(() => m1.filter((K) => K.kind === "recipe"), [m1]), I1 = l1(() => u1.filter((K) => K.scope === "global"), [u1]), W1 = l1(() => B1.filter((K) => K.scope === "global"), [B1]), $1 = l1(() => u1.filter((K) => K.scope === "prototype"), [u1]), j1 = l1(() => B1.filter((K) => K.scope === "prototype"), [B1]);
18392
- y1(() => {
18392
+ f1(() => {
18393
18393
  if (!h) return;
18394
18394
  m1.some((e0) => e0.id === h) || u("");
18395
- }, [m1, h]), y1(() => {
18395
+ }, [m1, h]), f1(() => {
18396
18396
  let K = !1;
18397
18397
  async function e0() {
18398
18398
  var T;
@@ -18468,7 +18468,7 @@ function Lw({ onClose: e }) {
18468
18468
  f && /* @__PURE__ */ x("div", { className: "space-y-1", children: [
18469
18469
  /* @__PURE__ */ c(_1, { htmlFor: "sb-proto-url", children: "URL" }),
18470
18470
  /* @__PURE__ */ c(s0, { id: "sb-proto-url", placeholder: "https://example.com/prototype", autoComplete: "off", spellCheck: !1, value: Z, onChange: (K) => M(K.target.value) }),
18471
- f1 && /* @__PURE__ */ c("p", { className: "text-sm text-destructive", children: f1 })
18471
+ y1 && /* @__PURE__ */ c("p", { className: "text-sm text-destructive", children: y1 })
18472
18472
  ] }),
18473
18473
  /* @__PURE__ */ x("div", { className: "space-y-1", children: [
18474
18474
  /* @__PURE__ */ c(_1, { htmlFor: "sb-proto-title", children: "Title" }),
@@ -18601,11 +18601,11 @@ function _w({ onClose: e }) {
18601
18601
  ), o1 = l1(
18602
18602
  () => o ? H.filter((U) => U.prototype !== o ? !1 : (U.folder || "") === ((F == null ? void 0 : F.folder) || "")) : [],
18603
18603
  [o, H, F]
18604
- ), f1 = l1(() => (F == null ? void 0 : F.routes) || [], [F]), D = v === l2, X = o ? `/${o}/` : "/prototype-name/", m1 = l1(
18604
+ ), y1 = l1(() => (F == null ? void 0 : F.routes) || [], [F]), D = v === l2, X = o ? `/${o}/` : "/prototype-name/", m1 = l1(
18605
18605
  () => o ? L.filter((U) => U.scope === "global" || U.prototype === o && (U.folder || "") === ((F == null ? void 0 : F.folder) || "")) : L.filter((U) => U.scope === "global"),
18606
18606
  [o, L, F]
18607
18607
  ), S1 = l1(() => m1.filter((U) => U.scope === "global"), [m1]), u1 = l1(() => m1.filter((U) => U.scope === "prototype"), [m1]), B1 = o || "", I1 = D && !w.trim() ? "Please provide a new page path" : null, W1 = !!_ && !!o && !E && !I1 && !G;
18608
- y1(() => {
18608
+ f1(() => {
18609
18609
  let U = !1;
18610
18610
  return (async () => {
18611
18611
  try {
@@ -18623,7 +18623,7 @@ function _w({ onClose: e }) {
18623
18623
  };
18624
18624
  }, []);
18625
18625
  const $1 = G1(o);
18626
- y1(() => {
18626
+ f1(() => {
18627
18627
  if (!o) {
18628
18628
  m(""), g(""), y(""), b(""), $1.current = o;
18629
18629
  return;
@@ -18637,7 +18637,7 @@ function _w({ onClose: e }) {
18637
18637
  const e0 = v && v !== l2 ? o1.find((T) => T.route === v) : null;
18638
18638
  return (e0 == null ? void 0 : e0.path) || "";
18639
18639
  }), $1.current = o;
18640
- }, [o]), y1(() => {
18640
+ }, [o]), f1(() => {
18641
18641
  f && (m1.some((U) => U.id === f) || b(""));
18642
18642
  }, [m1, f]);
18643
18643
  function j1(U) {
@@ -18730,7 +18730,7 @@ function _w({ onClose: e }) {
18730
18730
  ] }),
18731
18731
  /* @__PURE__ */ c("select", { className: ee, id: "sb-flow-starting-page", value: v, onChange: (U) => g(U.target.value), disabled: P || !o, children: o ? /* @__PURE__ */ x(P1, { children: [
18732
18732
  /* @__PURE__ */ c("option", { value: "", children: "None" }),
18733
- f1.map((U) => /* @__PURE__ */ c("option", { value: U, children: U }, U)),
18733
+ y1.map((U) => /* @__PURE__ */ c("option", { value: U, children: U }, U)),
18734
18734
  /* @__PURE__ */ c("option", { value: l2, children: "Create new page" })
18735
18735
  ] }) : /* @__PURE__ */ c("option", { value: "", children: "Select a prototype first" }) }),
18736
18736
  /* @__PURE__ */ c("p", { className: "text-xs text-muted-foreground", children: "Users will be redirected to this page" })
@@ -18815,7 +18815,7 @@ function Dw({ onClose: e }) {
18815
18815
  () => G.filter((E) => E.kind === "recipe"),
18816
18816
  [G]
18817
18817
  ), _ = l ? ((N = P.find((E) => E.id === l)) == null ? void 0 : N.name) ?? l : "Blank page";
18818
- y1(() => {
18818
+ f1(() => {
18819
18819
  let E = !1;
18820
18820
  return (async () => {
18821
18821
  try {
@@ -18831,14 +18831,14 @@ function Dw({ onClose: e }) {
18831
18831
  })(), () => {
18832
18832
  E = !0;
18833
18833
  };
18834
- }, []), y1(() => {
18834
+ }, []), f1(() => {
18835
18835
  if (!t) {
18836
18836
  n("");
18837
18837
  return;
18838
18838
  }
18839
18839
  const E = `/${t}/`;
18840
18840
  n((F) => !F || !F.startsWith(E) ? `${E}new-page` : F);
18841
- }, [t]), y1(() => {
18841
+ }, [t]), f1(() => {
18842
18842
  l && (P.some((E) => E.id === l) || i(""));
18843
18843
  }, [l, P]);
18844
18844
  const B = U1(async () => {
@@ -19027,7 +19027,7 @@ function Yw({ onClose: e }) {
19027
19027
  () => !!P && !Q && !f,
19028
19028
  [P, Q, f]
19029
19029
  );
19030
- y1(() => {
19030
+ f1(() => {
19031
19031
  try {
19032
19032
  const N = sessionStorage.getItem(f7);
19033
19033
  if (N) {
@@ -19197,7 +19197,7 @@ function nf({ onClose: e }) {
19197
19197
  () => t.replace(/[^a-zA-Z0-9\s_-]/g, "").trim().replace(/[\s_]+/g, "-").toLowerCase().replace(/-+/g, "-").replace(/^-|-$/g, ""),
19198
19198
  [t]
19199
19199
  ), b = l1(() => t.trim() && !f ? "Name must contain at least one alphanumeric character" : t.trim() && !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(f) ? "Name must be kebab-case" : null, [t, f]), Z = f ? `${f}.story.${l}` : "", M = !!f && !b && !o;
19200
- y1(() => {
19200
+ f1(() => {
19201
19201
  try {
19202
19202
  const L = window.__storyboardCanvasBridgeState;
19203
19203
  L != null && L.canvasId ? y(L.canvasId) : L != null && L.name && y(L.name);
@@ -19441,7 +19441,7 @@ const mf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19441
19441
  }, Symbol.toStringTag, { value: "Module" }));
19442
19442
  function vf({ config: e = {}, data: t, localOnly: a, tabindex: r = -1 }) {
19443
19443
  const [n, l] = R(!1), [i, o] = R(!1), [s, h] = R(!1), [u, d] = R(al), [m, v] = R(nl);
19444
- y1(() => rl.subscribe((b) => d(b.theme)), []), y1(() => ll.subscribe((b) => v({ ...b })), []), y1(() => {
19444
+ f1(() => rl.subscribe((b) => d(b.theme)), []), f1(() => ll.subscribe((b) => v({ ...b })), []), f1(() => {
19445
19445
  function f() {
19446
19446
  h(!0);
19447
19447
  }
@@ -19545,7 +19545,7 @@ const gf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19545
19545
  }, Symbol.toStringTag, { value: "Module" }));
19546
19546
  function wf({ config: e = {}, data: t, localOnly: a, tabindex: r }) {
19547
19547
  const [n, l] = R(A0());
19548
- y1(() => En((s) => {
19548
+ f1(() => En((s) => {
19549
19549
  l(s);
19550
19550
  }), []);
19551
19551
  async function i() {
@@ -19574,9 +19574,17 @@ const ff = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19574
19574
  function yf({ config: e = {}, data: t, localOnly: a, tabindex: r = -1 }) {
19575
19575
  var m;
19576
19576
  const [n, l] = R(!1), [i, o] = R(0);
19577
- y1(() => cl(() => {
19577
+ f1(() => cl(() => {
19578
19578
  o((g) => g + 1);
19579
- }), []);
19579
+ }), []), f1(() => {
19580
+ const v = e.action;
19581
+ if (!v) return;
19582
+ function g(w) {
19583
+ var y;
19584
+ ((y = w.detail) == null ? void 0 : y.action) === v && l(!0);
19585
+ }
19586
+ return window.addEventListener("storyboard:open-tool-menu", g), () => window.removeEventListener("storyboard:open-tool-menu", g);
19587
+ }, [e.action]);
19580
19588
  const s = e.action ? b7(e.action) : [], h = s.some((v) => v.type === "radio"), u = ((m = s.find((v) => v.type === "radio" && v.active)) == null ? void 0 : m.id) || "", d = U1((v) => {
19581
19589
  l(v), v && o((g) => g + 1);
19582
19590
  }, []);
@@ -19764,7 +19772,7 @@ function Lf({ config: e = {}, basePath: t = "/", tabindex: a = -1 }) {
19764
19772
  return (X = N.current) == null ? void 0 : X.focus();
19765
19773
  })) : Q(G.current) || _();
19766
19774
  }
19767
- y1(() => {
19775
+ f1(() => {
19768
19776
  const D = () => E(!0);
19769
19777
  return document.addEventListener("storyboard:open-autosync", D), () => document.removeEventListener("storyboard:open-autosync", D);
19770
19778
  }, []);
@@ -19776,8 +19784,8 @@ function Lf({ config: e = {}, basePath: t = "/", tabindex: a = -1 }) {
19776
19784
  return D;
19777
19785
  }
19778
19786
  }
19779
- y1(() => (z(), () => _()), [z]);
19780
- const o1 = (D) => m[D] === !0, f1 = Q(m) || y || g || b.canvas || b.prototype;
19787
+ f1(() => (z(), () => _()), [z]);
19788
+ const o1 = (D) => m[D] === !0, y1 = Q(m) || y || g || b.canvas || b.prototype;
19781
19789
  return /* @__PURE__ */ x(y5, { open: n, onOpenChange: E, children: [
19782
19790
  /* @__PURE__ */ c(Z5, { children: /* @__PURE__ */ c(
19783
19791
  U0,
@@ -19835,7 +19843,7 @@ function Lf({ config: e = {}, basePath: t = "/", tabindex: a = -1 }) {
19835
19843
  children: o1("prototype") ? "Disable autosync for prototype changes" : "Enable autosync for prototype changes"
19836
19844
  }
19837
19845
  ),
19838
- f1 && /* @__PURE__ */ x(P1, { children: [
19846
+ y1 && /* @__PURE__ */ x(P1, { children: [
19839
19847
  /* @__PURE__ */ c(Q1, {}),
19840
19848
  /* @__PURE__ */ x("div", { className: "statusRow", children: [
19841
19849
  M && C && /* @__PURE__ */ x("p", { className: "scopeHint", children: [
@@ -19901,7 +19909,7 @@ const Sf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
19901
19909
  inputRef: m
19902
19910
  }, v) {
19903
19911
  const [g, w] = R(""), y = G1(null), f = m || y, b = G1(null);
19904
- y1(() => {
19912
+ f1(() => {
19905
19913
  if (!h) return;
19906
19914
  const C = requestAnimationFrame(() => {
19907
19915
  requestAnimationFrame(() => {
@@ -20012,7 +20020,7 @@ function Bf({ config: e = {}, data: t, canvasName: a = "", zoom: r, tabindex: n
20012
20020
  function $() {
20013
20021
  H(""), P(null), L(!1);
20014
20022
  }
20015
- const [z, O] = R(""), [_, B] = R("canvas"), [S, N] = R("jsx"), [E, F] = R(!1), [o1, f1] = R(null), [D, X] = R(null), m1 = l1(
20023
+ const [z, O] = R(""), [_, B] = R("canvas"), [S, N] = R("jsx"), [E, F] = R(!1), [o1, y1] = R(null), [D, X] = R(null), m1 = l1(
20016
20024
  () => z.replace(/[^a-zA-Z0-9\s_-]/g, "").trim().replace(/[\s_]+/g, "-").toLowerCase().replace(/-+/g, "-").replace(/^-|-$/g, ""),
20017
20025
  [z]
20018
20026
  ), S1 = l1(
@@ -20023,7 +20031,7 @@ function Bf({ config: e = {}, data: t, canvasName: a = "", zoom: r, tabindex: n
20023
20031
  [m1, S]
20024
20032
  ), B1 = !!m1 && !S1 && !E;
20025
20033
  function I1() {
20026
- O(""), B("canvas"), N("jsx"), f1(null), F(!1);
20034
+ O(""), B("canvas"), N("jsx"), y1(null), F(!1);
20027
20035
  }
20028
20036
  async function W1() {
20029
20037
  try {
@@ -20036,14 +20044,14 @@ function Bf({ config: e = {}, data: t, canvasName: a = "", zoom: r, tabindex: n
20036
20044
  }
20037
20045
  m(!0);
20038
20046
  }
20039
- y1(() => {
20047
+ f1(() => {
20040
20048
  l && W1();
20041
- }, [l]), y1(() => {
20049
+ }, [l]), f1(() => {
20042
20050
  l && o === "menu" && requestAnimationFrame(() => {
20043
20051
  const T = document.querySelector("[data-bits-dropdown-menu-content] [data-bits-dropdown-menu-item]:not([data-disabled])");
20044
20052
  T == null || T.focus();
20045
20053
  });
20046
- }, [l, o]), y1(() => {
20054
+ }, [l, o]), f1(() => {
20047
20055
  !l && o === "menu" && (I1(), $(), y(/* @__PURE__ */ new Set()));
20048
20056
  }, [l, o]);
20049
20057
  function $1(T, H1) {
@@ -20092,7 +20100,7 @@ function Bf({ config: e = {}, data: t, canvasName: a = "", zoom: r, tabindex: n
20092
20100
  k1.current = o;
20093
20101
  async function K() {
20094
20102
  if (B1) {
20095
- F(!0), f1(null);
20103
+ F(!0), y1(null);
20096
20104
  try {
20097
20105
  const T = window.__storyboardCanvasBridgeState, H1 = (T == null ? void 0 : T.canvasId) || (T == null ? void 0 : T.name) || a, I = await fetch(Vn() + "/create-story", {
20098
20106
  method: "POST",
@@ -20105,14 +20113,14 @@ function Bf({ config: e = {}, data: t, canvasName: a = "", zoom: r, tabindex: n
20105
20113
  })
20106
20114
  }), J = await I.json();
20107
20115
  if (!I.ok) {
20108
- f1(J.error || "Failed to create component"), F(!1);
20116
+ y1(J.error || "Failed to create component"), F(!1);
20109
20117
  return;
20110
20118
  }
20111
20119
  j1(J.name), X(J.path), s("notification"), i(!0), m(!1), setTimeout(() => {
20112
20120
  k1.current === "notification" && (i(!1), s("menu"), X(null));
20113
20121
  }, 6e3);
20114
20122
  } catch (T) {
20115
- f1(T.message || "Network error");
20123
+ y1(T.message || "Network error");
20116
20124
  } finally {
20117
20125
  F(!1);
20118
20126
  }
@@ -20527,7 +20535,7 @@ const $f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20527
20535
  }, Symbol.toStringTag, { value: "Module" }));
20528
20536
  function Df({ config: e = {}, data: t, tabindex: a = -1 }) {
20529
20537
  const [r, n] = R(!1), [l, i] = R(!1);
20530
- return y1(() => {
20538
+ return f1(() => {
20531
20539
  function o(s) {
20532
20540
  var h, u;
20533
20541
  n(!!((h = s.detail) != null && h.canUndo)), i(!!((u = s.detail) != null && u.canRedo));
@@ -20573,7 +20581,7 @@ const zf = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
20573
20581
  }, Symbol.toStringTag, { value: "Module" }));
20574
20582
  function Ff({ config: e = {}, data: t, tabindex: a = -1 }) {
20575
20583
  const [r, n] = R(!1);
20576
- return y1(() => {
20584
+ return f1(() => {
20577
20585
  function l(o) {
20578
20586
  var s;
20579
20587
  n(!!((s = o.detail) != null && s.snapEnabled));
@@ -20627,7 +20635,7 @@ function Kf({ config: e = {}, tabindex: t }) {
20627
20635
  const [a, r] = R(
20628
20636
  () => document.documentElement.classList.contains("storyboard-chrome-hidden")
20629
20637
  );
20630
- y1(() => {
20638
+ f1(() => {
20631
20639
  const l = new MutationObserver(() => {
20632
20640
  r(document.documentElement.classList.contains("storyboard-chrome-hidden"));
20633
20641
  });