react-panel-layout 0.5.1 → 0.5.2

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,8 +1,8 @@
1
- import { jsxs as H, Fragment as N, jsx as h } from "react/jsx-runtime";
1
+ import { jsxs as H, Fragment as _, jsx as h } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
- import { F as Pt, e as yt, a as Lt, b as Mt, f as Dt, d as Ut } from "./FloatingPanelFrame-6W5OexYe.js";
3
+ import { F as Pt, e as yt, a as Lt, b as Mt, f as Dt, d as Ut } from "./FloatingPanelFrame-lLg-Lpg7.js";
4
4
  import { C as jt, D as Kt, o as Zt, p as qt, q as Jt, r as Qt, s as te, G as Y, t as T, u as ee, v as ne, w as oe, R as ut, x as re, y as Q } from "./styles-CA2_zLZt.js";
5
- import { a as se, u as ie } from "./usePivot-BvOGxLQQ.js";
5
+ import { a as se, u as ie } from "./usePivot-CgQxB8rc.js";
6
6
  import { createPortal as ae } from "react-dom";
7
7
  import { u as It } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
8
8
  const ce = () => {
@@ -114,7 +114,7 @@ const dt = {
114
114
  children: s
115
115
  }
116
116
  )
117
- ] }) : /* @__PURE__ */ h(N, { children: s }), me = ({ header: t, dismissible: e, onClose: n }) => {
117
+ ] }) : /* @__PURE__ */ h(_, { children: s }), me = ({ header: t, dismissible: e, onClose: n }) => {
118
118
  if (!t)
119
119
  return null;
120
120
  const o = t.showCloseButton ?? !0, r = pe(e, o);
@@ -162,7 +162,7 @@ const dt = {
162
162
  right: "translateX(0)",
163
163
  top: "translateY(0)",
164
164
  bottom: "translateY(0)"
165
- }, $ = i.useMemo(() => {
165
+ }, N = i.useMemo(() => {
166
166
  const I = ge(w, C, z), R = {
167
167
  ...fe,
168
168
  ...m ? { position: "absolute" } : { position: "fixed" },
@@ -184,14 +184,14 @@ const dt = {
184
184
  const I = L === "left" || L === "right", R = { borderRadius: 0 };
185
185
  return I && (R.height = "100%"), R;
186
186
  }, [L]);
187
- return /* @__PURE__ */ H(N, { children: [
187
+ return /* @__PURE__ */ H(_, { children: [
188
188
  /* @__PURE__ */ h("div", { style: D, onClick: l ? o : void 0 }),
189
189
  /* @__PURE__ */ h(
190
190
  "div",
191
191
  {
192
192
  "data-layer-id": t,
193
193
  "data-placement": L,
194
- style: $,
194
+ style: N,
195
195
  role: "dialog",
196
196
  "aria-modal": l ? !0 : void 0,
197
197
  "aria-hidden": n ? void 0 : !0,
@@ -227,7 +227,7 @@ const dt = {
227
227
  t(), n && await be(n, o);
228
228
  return;
229
229
  }
230
- }, Vn = (t) => {
230
+ }, Xn = (t) => {
231
231
  const [e, n] = i.useState({}), o = i.useRef(t);
232
232
  o.current = t;
233
233
  const r = i.useCallback(
@@ -294,7 +294,7 @@ const dt = {
294
294
  r.set(s.id, () => e.close(s.id));
295
295
  }), r;
296
296
  }, [n, e.close]);
297
- return /* @__PURE__ */ h(N, { children: n.map((r) => {
297
+ return /* @__PURE__ */ h(_, { children: n.map((r) => {
298
298
  if (!r.drawer)
299
299
  return null;
300
300
  const s = e.state(r.id), u = o.get(r.id);
@@ -352,7 +352,7 @@ const dt = {
352
352
  }, Nt = i.createContext(null), $t = ({ layerId: t, children: e }) => {
353
353
  const n = i.useMemo(() => ({ layerId: t }), [t]);
354
354
  return /* @__PURE__ */ h(Nt.Provider, { value: n, children: e });
355
- }, Xn = () => {
355
+ }, Un = () => {
356
356
  const t = i.useContext(Nt);
357
357
  if (!t)
358
358
  throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");
@@ -447,7 +447,7 @@ const dt = {
447
447
  }, De = ({ header: t, draggable: e, chrome: n, onClose: o, children: r }) => n ? /* @__PURE__ */ H(Pt, { style: { height: "100%", width: "100%" }, children: [
448
448
  /* @__PURE__ */ h(Me, { header: t, draggable: e, onClose: o }),
449
449
  /* @__PURE__ */ h(yt, { style: { flex: 1, display: "flex", flexDirection: "column" }, children: r })
450
- ] }) : /* @__PURE__ */ h(N, { children: r }), _t = ({ id: t, config: e, onClose: n, children: o }) => {
450
+ ] }) : /* @__PURE__ */ h(_, { children: r }), _t = ({ id: t, config: e, onClose: n, children: o }) => {
451
451
  const r = e.chrome ?? !1, s = e.draggable ?? !1, u = e.header?.title ?? e.ariaLabel ?? "Floating window";
452
452
  return /* @__PURE__ */ h("div", { "data-floating-window": t, role: "dialog", "aria-label": u, style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ h(De, { header: e.header, draggable: s, chrome: r, onClose: n, children: o }) });
453
453
  };
@@ -533,7 +533,7 @@ const Gt = {
533
533
  { key: "right", variant: "edge", horizontal: "right" },
534
534
  { key: "top", variant: "edge", vertical: "top" },
535
535
  { key: "bottom", variant: "edge", vertical: "bottom" }
536
- ], He = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h(N, { children: Ae.map((n) => {
536
+ ], He = ({ layerId: t, onPointerDown: e }) => /* @__PURE__ */ h(_, { children: Ae.map((n) => {
537
537
  const o = n.variant === "corner" ? Ie : Te, r = n.variant === "corner" ? xe[n.key] : ke[n.key], s = { ...o, ...r }, u = n.variant === "corner" ? { "data-resize-corner": n.key } : { "data-resize-edge": n.key };
538
538
  return /* @__PURE__ */ h(
539
539
  "div",
@@ -556,19 +556,19 @@ const Gt = {
556
556
  transitionMode: t.transitionMode
557
557
  });
558
558
  return /* @__PURE__ */ h(e, {});
559
- }, Wt = i.memo(({ layer: t, onClose: e }) => {
560
- const { getCachedContent: n } = Ht(), o = t.pivot ? /* @__PURE__ */ h(Ne, { pivot: t.pivot }) : /* @__PURE__ */ h(N, { children: n(t.id) });
559
+ }, $e = (t, e) => t.pivot ? /* @__PURE__ */ h(Ne, { pivot: t.pivot }) : t.cache ? e(t.id) : t.component, Wt = i.memo(({ layer: t, onClose: e }) => {
560
+ const { getCachedContent: n } = Ht(), o = $e(t, n);
561
561
  return t.floating?.chrome ? /* @__PURE__ */ h(_t, { id: t.id, config: t.floating, onClose: e, children: o }) : o;
562
562
  });
563
563
  Wt.displayName = "LayerContentRenderer";
564
564
  const Ot = i.memo(({ layerId: t, isResizable: e, onPointerDown: n }) => e ? /* @__PURE__ */ h(He, { layerId: t, onPointerDown: n }) : null);
565
565
  Ot.displayName = "LayerResizeHandles";
566
- const $e = (t, e) => t ? "auto" : e ? "visible" : "hidden", Bt = i.memo(({ layer: t, handleLayerPointerDown: e }) => {
566
+ const Fe = (t, e) => t ? "auto" : e ? "visible" : "hidden", Bt = i.memo(({ layer: t, handleLayerPointerDown: e }) => {
567
567
  const { getLayerRenderState: n } = kt(), { style: o, isResizable: r, isResizing: s, onResizeHandlePointerDown: u } = n(t), c = i.useMemo(() => {
568
568
  const g = {};
569
569
  return t.gridArea && (g.gridArea = t.gridArea), t.gridRow && (g.gridRow = t.gridRow), t.gridColumn && (g.gridColumn = t.gridColumn), g;
570
570
  }, [t.gridArea, t.gridRow, t.gridColumn]), a = i.useMemo(() => {
571
- const g = !!t.floating, f = $e(t.scrollable, g), m = {
571
+ const g = !!t.floating, f = Fe(t.scrollable, g), m = {
572
572
  ...o,
573
573
  ...c,
574
574
  minWidth: 0,
@@ -596,9 +596,9 @@ const $e = (t, e) => t ? "auto" : e ? "visible" : "hidden", Bt = i.memo(({ layer
596
596
  );
597
597
  });
598
598
  Bt.displayName = "EmbeddedLayer";
599
- const Fe = ({ layers: t }) => {
599
+ const _e = ({ layers: t }) => {
600
600
  const { handleLayerPointerDown: e } = kt();
601
- return /* @__PURE__ */ h(N, { children: t.map((n) => {
601
+ return /* @__PURE__ */ h(_, { children: t.map((n) => {
602
602
  const o = n.floating?.mode ?? "embedded";
603
603
  return n.floating && o === "popup" ? /* @__PURE__ */ h(Pe, { layer: n }, n.id) : /* @__PURE__ */ h(Bt, { layer: n, handleLayerPointerDown: e }, n.id);
604
604
  }) });
@@ -620,7 +620,7 @@ function et(t, e) {
620
620
  };
621
621
  }, [t, e.onMove, e.onUp, e.onCancel, n, o, r]);
622
622
  }
623
- function _e(t, e, n) {
623
+ function Ge(t, e, n) {
624
624
  i.useEffect(() => {
625
625
  const o = t.current;
626
626
  if (!(!e || !o || n === void 0))
@@ -629,7 +629,7 @@ function _e(t, e, n) {
629
629
  };
630
630
  }, [t, e, n]);
631
631
  }
632
- function Ge(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
632
+ function We(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
633
633
  i.useEffect(() => {
634
634
  const o = t.current;
635
635
  if (!e || !o)
@@ -646,11 +646,11 @@ function Ge(t, e, n = ["pointerdown", "pointermove", "pointerup"]) {
646
646
  };
647
647
  }, [t, e, n]);
648
648
  }
649
- function We(t, e, n) {
649
+ function Oe(t, e, n) {
650
650
  const { onMove: o, onUp: r, onCancel: s, pointerId: u, capturePointer: c = !0, preventDefaults: a = !0 } = n;
651
- et(e, { onMove: o, onUp: r, onCancel: s }), _e(t, e ? c : !1, u), Ge(t, e ? a : !1);
651
+ et(e, { onMove: o, onUp: r, onCancel: s }), Ge(t, e ? c : !1, u), We(t, e ? a : !1);
652
652
  }
653
- const Oe = (t) => {
653
+ const Be = (t) => {
654
654
  const e = i.useRef(null), n = i.useRef(null), o = i.useRef(0), [r, s] = i.useState(!1), u = W((f) => {
655
655
  t.onResize?.(f);
656
656
  }), c = i.useCallback(
@@ -670,7 +670,7 @@ const Oe = (t) => {
670
670
  ), g = i.useCallback(() => {
671
671
  s(!1), n.current = null;
672
672
  }, []);
673
- return We(e, r, {
673
+ return Oe(e, r, {
674
674
  onMove: l,
675
675
  onUp: g,
676
676
  pointerId: n.current ?? void 0,
@@ -681,7 +681,7 @@ const Oe = (t) => {
681
681
  onPointerDown: a,
682
682
  isDragging: r
683
683
  };
684
- }, Be = ({
684
+ }, Ye = ({
685
685
  element: t,
686
686
  component: e
687
687
  }) => i.forwardRef(({ children: n, ...o }, r) => t ? i.cloneElement(
@@ -689,22 +689,22 @@ const Oe = (t) => {
689
689
  { ...o, ref: r },
690
690
  n ?? t.props.children
691
691
  ) : e ? /* @__PURE__ */ h(e, { ...o, ref: r, children: n }) : /* @__PURE__ */ h("div", { ...o, ref: r, children: n }));
692
- function Ye({
692
+ function Ve({
693
693
  element: t,
694
694
  component: e
695
695
  }) {
696
696
  return i.useMemo(
697
- () => Be({
697
+ () => Ye({
698
698
  element: t,
699
699
  component: e
700
700
  }),
701
701
  [e, t]
702
702
  );
703
703
  }
704
- const Ve = {
704
+ const Xe = {
705
705
  position: "absolute",
706
706
  zIndex: re
707
- }, Xe = {
707
+ }, Ue = {
708
708
  vertical: {
709
709
  width: ut,
710
710
  height: "100%",
@@ -717,28 +717,28 @@ const Ve = {
717
717
  left: 0,
718
718
  cursor: "row-resize"
719
719
  }
720
- }, Ue = {
720
+ }, je = {
721
721
  idle: oe,
722
722
  hovered: ne,
723
723
  dragging: ee
724
- }, je = ({
724
+ }, Ke = ({
725
725
  direction: t,
726
726
  onResize: e,
727
727
  component: n,
728
728
  element: o,
729
729
  children: r
730
730
  }) => {
731
- const s = t === "vertical" ? "x" : "y", { ref: u, isDragging: c, onPointerDown: a } = Oe({ axis: s, onResize: e }), [l, g] = i.useState(!1), f = i.useCallback(() => {
731
+ const s = t === "vertical" ? "x" : "y", { ref: u, isDragging: c, onPointerDown: a } = Be({ axis: s, onResize: e }), [l, g] = i.useState(!1), f = i.useCallback(() => {
732
732
  g(!0);
733
733
  }, []), m = i.useCallback(() => {
734
734
  g(!1);
735
- }, []), w = Ye({
735
+ }, []), w = Ve({
736
736
  element: o,
737
737
  component: n
738
738
  }), C = i.useMemo(() => c ? "dragging" : l ? "hovered" : "idle", [c, l]), z = i.useMemo(() => ({
739
- ...Ve,
740
- ...Xe[t],
741
- backgroundColor: Ue[C],
739
+ ...Xe,
740
+ ...Ue[t],
741
+ backgroundColor: je[C],
742
742
  touchAction: "none"
743
743
  }), [t, C]);
744
744
  return /* @__PURE__ */ h(
@@ -799,8 +799,8 @@ const Ve = {
799
799
  ...n === "start" ? { top: -f } : { bottom: -f }
800
800
  };
801
801
  }, [n, t, o]);
802
- return /* @__PURE__ */ h("div", { "data-resizable": "true", style: { ...a, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ h("div", { "data-direction": u, "data-align": n, "data-handle": "true", style: l, children: /* @__PURE__ */ h(je, { direction: u, onResize: c }) }) });
803
- }, Ke = (t) => {
802
+ return /* @__PURE__ */ h("div", { "data-resizable": "true", style: { ...a, position: "relative", pointerEvents: "none" }, children: /* @__PURE__ */ h("div", { "data-direction": u, "data-align": n, "data-handle": "true", style: l, children: /* @__PURE__ */ h(Ke, { direction: u, onResize: c }) }) });
803
+ }, Ze = (t) => {
804
804
  const e = /* @__PURE__ */ new Map();
805
805
  t.forEach((o, r) => {
806
806
  o.forEach((s, u) => {
@@ -835,7 +835,7 @@ const Ve = {
835
835
  };
836
836
  n.set(r, l);
837
837
  }), n;
838
- }, Ze = (t, e) => {
838
+ }, qe = (t, e) => {
839
839
  if ((t.positionMode ?? "grid") !== "grid")
840
840
  return t;
841
841
  const o = t.gridArea ?? t.id, r = e.get(o);
@@ -848,8 +848,8 @@ const Ve = {
848
848
  gridRow: u ? r.gridRow : t.gridRow,
849
849
  gridColumn: c ? r.gridColumn : t.gridColumn
850
850
  };
851
- }, qe = (t, e) => {
852
- const n = i.useMemo(() => Ke(t.areas), [t.areas]), o = i.useMemo(() => e.map((c) => Ze(c, n)), [e, n]), r = i.useMemo(
851
+ }, Je = (t, e) => {
852
+ const n = i.useMemo(() => Ze(t.areas), [t.areas]), o = i.useMemo(() => e.map((c) => qe(c, n)), [e, n]), r = i.useMemo(
853
853
  () => o.filter((c) => c.visible !== !1),
854
854
  [o]
855
855
  ), s = i.useMemo(
@@ -867,7 +867,7 @@ const Ve = {
867
867
  regularLayers: s,
868
868
  layerById: u
869
869
  };
870
- }, Je = (t) => {
870
+ }, Qe = (t) => {
871
871
  if (!t)
872
872
  return { rowGap: 0, columnGap: 0 };
873
873
  const e = t.split(/\s+/).map((o) => o.trim()).filter(Boolean), n = (o) => {
@@ -882,15 +882,15 @@ const Ve = {
882
882
  rowGap: n(e[0]),
883
883
  columnGap: n(e[1])
884
884
  };
885
- }, Qe = (t, e) => {
885
+ }, tn = (t, e) => {
886
886
  if (!t)
887
887
  return [];
888
888
  const n = getComputedStyle(t);
889
889
  return (e === "col" ? n.gridTemplateColumns : n.gridTemplateRows).split(/\s+/).map((r) => parseFloat(r)).filter((r) => !Number.isNaN(r));
890
- }, Yt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), Un = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, K = (t, e) => `${t}-${e}`, tn = (t, e, n, o) => {
890
+ }, Yt = (t, e = Number.NEGATIVE_INFINITY, n = Number.POSITIVE_INFINITY) => Math.min(Math.max(t, e), n), jn = (t, e) => typeof t != "number" || !Number.isFinite(t) ? e : t, K = (t, e) => `${t}-${e}`, en = (t, e, n, o) => {
891
891
  const r = K(n, o), s = e[r];
892
892
  return s !== void 0 ? `minmax(${t.minSize ?? 0}px, ${s}px)` : t.size;
893
- }, wt = (t, e, n) => t.map((o, r) => tn(o, e, n, r)).join(" "), X = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[K(e, r)] = parseInt(o.size, 10)), n), {}), en = ({
893
+ }, wt = (t, e, n) => t.map((o, r) => en(o, e, n, r)).join(" "), X = (t, e) => t.reduce((n, o, r) => (o.resizable && o.size.endsWith("px") && (n[K(e, r)] = parseInt(o.size, 10)), n), {}), nn = ({
894
894
  trackSizes: t,
895
895
  track: e,
896
896
  direction: n,
@@ -900,9 +900,9 @@ const Ve = {
900
900
  const s = K(n, o), u = t[s];
901
901
  if (u !== void 0)
902
902
  return u;
903
- const a = Qe(r?.current ?? null, n)[o];
903
+ const a = tn(r?.current ?? null, n)[o];
904
904
  return a !== void 0 && a > 0 ? a : e.size.endsWith("px") ? Number.parseInt(e.size, 10) : 300;
905
- }, nn = (t, e) => t.reduce((n, o, r) => r === e ? n : o.size.includes("fr") ? n + 100 : n + (o.minSize ?? 50), 0), on = ({
905
+ }, on = (t, e) => t.reduce((n, o, r) => r === e ? n : o.size.includes("fr") ? n + 100 : n + (o.minSize ?? 50), 0), rn = ({
906
906
  track: t,
907
907
  tracks: e,
908
908
  trackIndex: n,
@@ -912,9 +912,9 @@ const Ve = {
912
912
  }) => {
913
913
  if (!r?.current)
914
914
  return t.maxSize;
915
- const u = o === "col" ? r.current.offsetWidth : r.current.offsetHeight, c = nn(e, n), a = e.length - 1, l = o === "col" ? s.columnGap : s.rowGap, g = a * l, f = u - c - g;
915
+ const u = o === "col" ? r.current.offsetWidth : r.current.offsetHeight, c = on(e, n), a = e.length - 1, l = o === "col" ? s.columnGap : s.rowGap, g = a * l, f = u - c - g;
916
916
  return t.maxSize !== void 0 ? Math.min(t.maxSize, f) : f;
917
- }, rn = (t, e, n) => Yt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), bt = (t, e) => {
917
+ }, sn = (t, e, n) => Yt(t, e ?? Number.NEGATIVE_INFINITY, n ?? Number.POSITIVE_INFINITY), bt = (t, e) => {
918
918
  const n = t.length, o = [];
919
919
  for (let u = 0; u < n; u++) {
920
920
  const c = t[u], a = c[e], l = c[e + 1];
@@ -934,7 +934,7 @@ const Ve = {
934
934
  return { start: 1, end: r + 1 };
935
935
  const u = Math.min(...s), c = Math.max(...s);
936
936
  return { start: u + 1, end: c + 2 };
937
- }, sn = (t, e) => {
937
+ }, an = (t, e) => {
938
938
  if (t.length === 0)
939
939
  return [];
940
940
  const n = e.length;
@@ -953,7 +953,7 @@ const Ve = {
953
953
  o.push({ trackIndex: s, align: "end", span: a });
954
954
  }
955
955
  }), o;
956
- }, an = (t, e) => {
956
+ }, cn = (t, e) => {
957
957
  if (t.length === 0)
958
958
  return [];
959
959
  const n = e[0]?.length ?? 0;
@@ -972,7 +972,7 @@ const Ve = {
972
972
  o.push({ trackIndex: s, align: "end", span: a });
973
973
  }
974
974
  }), o;
975
- }, cn = (t) => t !== void 0 ? { gap: t } : {}, un = (t, e) => {
975
+ }, un = (t) => t !== void 0 ? { gap: t } : {}, ln = (t, e) => {
976
976
  const n = Object.keys(e), o = {};
977
977
  for (const g of n)
978
978
  o[g] = t[g] ?? e[g];
@@ -980,7 +980,7 @@ const Ve = {
980
980
  (g) => !Object.prototype.hasOwnProperty.call(o, g)
981
981
  ), c = s ? !0 : u, a = n.some((g) => t[g] !== o[g]);
982
982
  return (c ? !0 : a) ? o : null;
983
- }, ln = (t, e, n) => {
983
+ }, dn = (t, e, n) => {
984
984
  const [o, r] = i.useState(() => ({
985
985
  ...X(t.columns, "col"),
986
986
  ...X(t.rows, "row")
@@ -990,13 +990,13 @@ const Ve = {
990
990
  ...X(t.columns, "col"),
991
991
  ...X(t.rows, "row")
992
992
  };
993
- r((m) => un(m, f) ?? m);
993
+ r((m) => ln(m, f) ?? m);
994
994
  }, [t.columns, t.rows]);
995
- const s = i.useMemo(() => t.areas.map((f) => `"${f.join(" ")}"`).join(" "), [t.areas]), u = i.useMemo(() => Je(t.gap), [t.gap]), c = i.useMemo(
996
- () => sn(t.columns, t.areas),
995
+ const s = i.useMemo(() => t.areas.map((f) => `"${f.join(" ")}"`).join(" "), [t.areas]), u = i.useMemo(() => Qe(t.gap), [t.gap]), c = i.useMemo(
996
+ () => an(t.columns, t.areas),
997
997
  [t.columns, t.areas]
998
998
  ), a = i.useMemo(
999
- () => an(t.rows, t.areas),
999
+ () => cn(t.rows, t.areas),
1000
1000
  [t.rows, t.areas]
1001
1001
  ), l = i.useMemo(() => ({
1002
1002
  ...t.style,
@@ -1004,19 +1004,19 @@ const Ve = {
1004
1004
  gridTemplateAreas: s,
1005
1005
  gridTemplateRows: wt(t.rows, o, "row"),
1006
1006
  gridTemplateColumns: wt(t.columns, o, "col"),
1007
- ...cn(t.gap)
1007
+ ...un(t.gap)
1008
1008
  }), [s, t.columns, t.gap, t.rows, t.style, e, o]), g = i.useCallback(
1009
1009
  (f, m, w) => {
1010
1010
  const C = f === "row" ? t.rows : t.columns, z = C[m];
1011
1011
  if (!z || !z.resizable)
1012
1012
  return;
1013
- const y = en({
1013
+ const y = nn({
1014
1014
  trackSizes: o,
1015
1015
  track: z,
1016
1016
  direction: f,
1017
1017
  trackIndex: m,
1018
1018
  containerRef: n
1019
- }), L = on({
1019
+ }), L = rn({
1020
1020
  track: z,
1021
1021
  tracks: C,
1022
1022
  trackIndex: m,
@@ -1024,9 +1024,9 @@ const Ve = {
1024
1024
  containerRef: n,
1025
1025
  gapSizes: u
1026
1026
  }), x = K(f, m);
1027
- r(($) => {
1028
- const M = y + w, D = rn(M, z.minSize, L);
1029
- return { ...$, [x]: D };
1027
+ r((N) => {
1028
+ const M = y + w, D = sn(M, z.minSize, L);
1029
+ return { ...N, [x]: D };
1030
1030
  });
1031
1031
  },
1032
1032
  [t.columns, t.rows, o, n, u]
@@ -1038,19 +1038,19 @@ const Ve = {
1038
1038
  gridStyle: l,
1039
1039
  handleResize: g
1040
1040
  };
1041
- }, dn = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", fn = (t) => ({ position: t === "grid" ? "relative" : t }), gn = (t, e) => e !== "grid" ? {} : {
1041
+ }, fn = (t) => t.positionMode ? t.positionMode : t.floating ? (t.floating.mode ?? "embedded") === "embedded" ? "absolute" : "relative" : "grid", gn = (t) => ({ position: t === "grid" ? "relative" : t }), pn = (t, e) => e !== "grid" ? {} : {
1042
1042
  gridArea: t.gridArea,
1043
1043
  gridRow: t.gridRow,
1044
1044
  gridColumn: t.gridColumn
1045
- }, pn = (t) => t ? {
1045
+ }, hn = (t) => t ? {
1046
1046
  top: t.top,
1047
1047
  right: t.right,
1048
1048
  bottom: t.bottom,
1049
1049
  left: t.left
1050
- } : {}, hn = (t) => t !== void 0 ? { zIndex: t } : {}, mn = (t, e) => ({
1050
+ } : {}, mn = (t) => t !== void 0 ? { zIndex: t } : {}, wn = (t, e) => ({
1051
1051
  width: t,
1052
1052
  height: e
1053
- }), wn = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, bn = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, vn = (t) => {
1053
+ }), bn = (t, e) => t.pointerEvents !== void 0 ? typeof t.pointerEvents == "boolean" ? { pointerEvents: t.pointerEvents ? "auto" : "none" } : { pointerEvents: t.pointerEvents } : e === "absolute" || e === "fixed" ? { pointerEvents: "auto" } : {}, vn = (t) => t.floating ? t.floating.position ?? t.floating.defaultPosition ?? t.position : t.position, Sn = (t) => {
1054
1054
  if (t.floating) {
1055
1055
  const e = t.floating.size ?? t.floating.defaultSize;
1056
1056
  if (e)
@@ -1063,21 +1063,21 @@ const Ve = {
1063
1063
  width: t.width,
1064
1064
  height: t.height
1065
1065
  };
1066
- }, Sn = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, Cn = (t) => {
1067
- const e = dn(t), n = bn(t), o = vn(t), r = Sn(t);
1066
+ }, Cn = (t) => t.floating?.zIndex !== void 0 ? t.floating.zIndex : t.zIndex, zn = (t) => {
1067
+ const e = fn(t), n = vn(t), o = Sn(t), r = Cn(t);
1068
1068
  return {
1069
1069
  ...t.style,
1070
- ...fn(e),
1071
- ...gn(t, e),
1072
- ...pn(n),
1073
- ...hn(r),
1074
- ...mn(o.width, o.height),
1075
- ...wn(t, e)
1070
+ ...gn(e),
1071
+ ...pn(t, e),
1072
+ ...hn(n),
1073
+ ...mn(r),
1074
+ ...wn(o.width, o.height),
1075
+ ...bn(t, e)
1076
1076
  };
1077
- }, zn = (t) => {
1077
+ }, En = (t) => {
1078
1078
  const e = t.floating;
1079
1079
  return e ? e.mode ?? "embedded" : null;
1080
- }, _ = (t) => zn(t) !== "embedded" ? null : t.floating ?? null, St = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, Ct = (t, e, n) => {
1080
+ }, F = (t) => En(t) !== "embedded" ? null : t.floating ?? null, St = (t) => t instanceof HTMLElement ? ["INPUT", "TEXTAREA", "SELECT", "BUTTON"].includes(t.tagName) : !1, Ct = (t, e, n) => {
1081
1081
  const o = e ?? Number.NEGATIVE_INFINITY, r = n ?? Number.POSITIVE_INFINITY;
1082
1082
  return Yt(t, o, r);
1083
1083
  }, zt = (t, e, n) => {
@@ -1087,7 +1087,7 @@ const Ve = {
1087
1087
  `Floating layer "${n}" must provide a numeric "${e}" value when draggable mode is enabled.`
1088
1088
  );
1089
1089
  }, Et = (t) => {
1090
- const e = _(t);
1090
+ const e = F(t);
1091
1091
  if (!e)
1092
1092
  throw new Error(`Floating layer "${t.id}" is missing floating configuration required for dragging.`);
1093
1093
  const n = e.position ?? e.defaultPosition ?? t.position;
@@ -1097,10 +1097,10 @@ const Ve = {
1097
1097
  left: zt(n.left, "left", t.id),
1098
1098
  top: zt(n.top, "top", t.id)
1099
1099
  };
1100
- }, En = (t) => {
1101
- const e = _(t);
1100
+ }, Rn = (t) => {
1101
+ const e = F(t);
1102
1102
  return e ? e.constraints ?? {} : {};
1103
- }, Rn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, Pn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, yn = (t, e, n) => !t || t === "right" ? e : e + n, Ln = (t, e, n) => !t || t === "bottom" ? e : e + n, nt = (t, e) => t ? t.dataset.layerId === e ? t : nt(t.parentElement, e) : null, ot = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : ot(t.parentElement, e, n), Mn = (t) => t instanceof HTMLElement ? ot(
1103
+ }, Pn = (t, e, n) => t ? t === "left" ? e - n : e + n : e, yn = (t, e, n) => t ? t === "top" ? e - n : e + n : e, Ln = (t, e, n) => !t || t === "right" ? e : e + n, Mn = (t, e, n) => !t || t === "bottom" ? e : e + n, nt = (t, e) => t ? t.dataset.layerId === e ? t : nt(t.parentElement, e) : null, ot = (t, e, n) => !t || n?.(t) ? null : e(t) ? t : ot(t.parentElement, e, n), Dn = (t) => t instanceof HTMLElement ? ot(
1104
1104
  t,
1105
1105
  (e) => e.dataset.dragHandle === "true",
1106
1106
  (e) => e.dataset.dragIgnore === "true"
@@ -1108,19 +1108,19 @@ const Ve = {
1108
1108
  t,
1109
1109
  (e) => e.dataset.resizeCorner !== void 0 || e.dataset.resizeEdge !== void 0
1110
1110
  ) !== null : !1, U = (t) => {
1111
- const e = _(t);
1111
+ const e = F(t);
1112
1112
  return e ? e.resizable === !0 : !1;
1113
1113
  }, j = (t) => {
1114
- if (!_(t))
1114
+ if (!F(t))
1115
1115
  return null;
1116
- const n = Tn(t);
1116
+ const n = xn(t);
1117
1117
  if (!n)
1118
1118
  throw new Error(`Floating layer "${t.id}" must define width and height when resizable or draggable.`);
1119
1119
  return {
1120
1120
  width: n.width,
1121
1121
  height: n.height
1122
1122
  };
1123
- }, Dn = (t, e, n) => {
1123
+ }, In = (t, e, n) => {
1124
1124
  const o = t.filter(U).reduce((f, m) => {
1125
1125
  if (n === m.id) {
1126
1126
  const C = e[m.id];
@@ -1137,7 +1137,7 @@ const Ve = {
1137
1137
  sizes: o,
1138
1138
  changed: a ? !0 : l
1139
1139
  };
1140
- }, In = ({
1140
+ }, Tn = ({
1141
1141
  layers: t,
1142
1142
  layerById: e,
1143
1143
  isRootLevel: n
@@ -1148,7 +1148,7 @@ const Ve = {
1148
1148
  e.get(p)?.floating?.onResize?.(d);
1149
1149
  });
1150
1150
  It(() => {
1151
- const { sizes: p, changed: d } = Dn(t, l, s);
1151
+ const { sizes: p, changed: d } = In(t, l, s);
1152
1152
  d && g(p);
1153
1153
  }, [t, s]);
1154
1154
  const z = i.useCallback(
@@ -1174,7 +1174,7 @@ const Ve = {
1174
1174
  [c]
1175
1175
  ), y = i.useCallback(
1176
1176
  (p) => {
1177
- const d = p.target, b = Mn(d);
1177
+ const d = p.target, b = Dn(d);
1178
1178
  if (!b)
1179
1179
  return;
1180
1180
  const v = b.closest("[data-layer-id]")?.getAttribute("data-layer-id");
@@ -1183,7 +1183,7 @@ const Ve = {
1183
1183
  const S = e.get(v);
1184
1184
  if (!S)
1185
1185
  return;
1186
- const P = _(S);
1186
+ const P = F(S);
1187
1187
  if (!(!P || P.draggable !== !0) && !St(p.target) && !Rt(p.target) && b) {
1188
1188
  const E = nt(b, v);
1189
1189
  if (!E)
@@ -1195,7 +1195,7 @@ const Ve = {
1195
1195
  [z, e]
1196
1196
  ), L = i.useCallback(
1197
1197
  (p, d) => {
1198
- const b = e.get(p), v = b ? _(b) : null;
1198
+ const b = e.get(p), v = b ? F(b) : null;
1199
1199
  if (!b || !v || v.draggable !== !0 || St(d.target) || Rt(d.target))
1200
1200
  return;
1201
1201
  const S = nt(d.currentTarget, p);
@@ -1210,7 +1210,7 @@ const Ve = {
1210
1210
  const S = l[p] ?? j(v);
1211
1211
  if (!S)
1212
1212
  return;
1213
- const P = Et(v), E = En(v), k = c[p] ?? { x: 0, y: 0 };
1213
+ const P = Et(v), E = Rn(v), k = c[p] ?? { x: 0, y: 0 };
1214
1214
  if (b.stopPropagation(), b.preventDefault(), b.currentTarget.setPointerCapture)
1215
1215
  try {
1216
1216
  b.currentTarget.setPointerCapture(b.pointerId);
@@ -1236,7 +1236,7 @@ const Ve = {
1236
1236
  }, u(p);
1237
1237
  },
1238
1238
  [e, c, l]
1239
- ), $ = i.useCallback(
1239
+ ), N = i.useCallback(
1240
1240
  (p) => {
1241
1241
  const d = f.current;
1242
1242
  if (!d)
@@ -1256,12 +1256,12 @@ const Ve = {
1256
1256
  const d = m.current;
1257
1257
  if (!d || d.pointerId !== p.pointerId || !e.get(d.layerId))
1258
1258
  return;
1259
- const v = p.clientX - d.startX, S = p.clientY - d.startY, P = Rn(d.horizontalEdge, d.startWidth, v), E = Pn(d.verticalEdge, d.startHeight, S), k = Ct(P, d.minWidth, d.maxWidth), F = Ct(E, d.minHeight, d.maxHeight), O = d.startWidth - k, Z = d.startHeight - F, it = yn(
1259
+ const v = p.clientX - d.startX, S = p.clientY - d.startY, P = Pn(d.horizontalEdge, d.startWidth, v), E = yn(d.verticalEdge, d.startHeight, S), k = Ct(P, d.minWidth, d.maxWidth), $ = Ct(E, d.minHeight, d.maxHeight), O = d.startWidth - k, Z = d.startHeight - $, it = Ln(
1260
1260
  d.horizontalEdge,
1261
1261
  d.startPosition.x,
1262
1262
  O
1263
- ), Xt = Ln(d.verticalEdge, d.startPosition.y, Z), q = l[d.layerId], at = { width: k, height: F };
1264
- (!q || q.width !== k || q.height !== F) && (g((J) => ({
1263
+ ), Xt = Mn(d.verticalEdge, d.startPosition.y, Z), q = l[d.layerId], at = { width: k, height: $ };
1264
+ (!q || q.width !== k || q.height !== $) && (g((J) => ({
1265
1265
  ...J,
1266
1266
  [d.layerId]: at
1267
1267
  })), C(d.layerId, at));
@@ -1299,7 +1299,7 @@ const Ve = {
1299
1299
  u(null);
1300
1300
  }, []);
1301
1301
  et(o !== null, {
1302
- onMove: $,
1302
+ onMove: N,
1303
1303
  onUp: D,
1304
1304
  onCancel: D
1305
1305
  }), et(s !== null, {
@@ -1309,10 +1309,10 @@ const Ve = {
1309
1309
  });
1310
1310
  const I = i.useCallback(
1311
1311
  (p) => {
1312
- const d = Cn(p), b = _(p);
1312
+ const d = zn(p), b = F(p);
1313
1313
  if (!b || b.draggable !== !0)
1314
1314
  return d;
1315
- const v = c[p.id], S = o === p.id, P = s === p.id, E = v ? { transform: `translate(${v.x}px, ${v.y}px)` } : {}, k = l[p.id], F = U(p) ? j(p) : null, O = k ?? F, Z = O ? { width: `${O.width}px`, height: `${O.height}px` } : {};
1315
+ const v = c[p.id], S = o === p.id, P = s === p.id, E = v ? { transform: `translate(${v.x}px, ${v.y}px)` } : {}, k = l[p.id], $ = U(p) ? j(p) : null, O = k ?? $, Z = O ? { width: `${O.width}px`, height: `${O.height}px` } : {};
1316
1316
  return {
1317
1317
  ...d,
1318
1318
  ...Z,
@@ -1326,8 +1326,8 @@ const Ve = {
1326
1326
  if (!U(p))
1327
1327
  return { isResizable: !1 };
1328
1328
  const b = l[p.id], v = j(p);
1329
- return (b ?? v) !== null ? { isResizable: !0, onPointerDown: (k, F) => {
1330
- x(p.id, k, F);
1329
+ return (b ?? v) !== null ? { isResizable: !0, onPointerDown: (k, $) => {
1330
+ x(p.id, k, $);
1331
1331
  } } : { isResizable: !1 };
1332
1332
  },
1333
1333
  [x, l]
@@ -1369,7 +1369,7 @@ const Ve = {
1369
1369
  draggingLayerId: o,
1370
1370
  resizingLayerId: s
1371
1371
  };
1372
- }, Tn = (t) => {
1372
+ }, xn = (t) => {
1373
1373
  if (t.floating) {
1374
1374
  const e = t.floating.size ?? t.floating.defaultSize;
1375
1375
  if (e)
@@ -1382,40 +1382,40 @@ const Ve = {
1382
1382
  width: "100%",
1383
1383
  height: "100%",
1384
1384
  overflow: "hidden"
1385
- }, xn = {
1385
+ }, kn = {
1386
1386
  touchAction: "none",
1387
1387
  WebkitTouchCallout: "none",
1388
1388
  WebkitUserSelect: "none",
1389
1389
  userSelect: "none"
1390
- }, kn = {
1390
+ }, An = {
1391
1391
  ...Vt,
1392
1392
  overflow: "visible",
1393
1393
  height: "auto",
1394
1394
  minHeight: "100%"
1395
- }, An = (t) => t ? kn : Vt, jn = ({ config: t, layers: e, style: n, root: o = !1 }) => {
1395
+ }, Hn = (t) => t ? An : Vt, Kn = ({ config: t, layers: e, style: n, root: o = !1 }) => {
1396
1396
  const r = i.useRef(null), { isIntersecting: s } = de(r, { threshold: 0 });
1397
- return /* @__PURE__ */ h(Ee, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(Hn, { gridRef: r, isIntersecting: s, isRoot: o }) });
1398
- }, Hn = ({ gridRef: t, isIntersecting: e, isRoot: n }) => {
1399
- const { config: o, style: r, layers: s } = Ht(), { normalizedLayers: u, visibleLayers: c, regularLayers: a, layerById: l } = qe(o, s.defs), { columnHandles: g, rowHandles: f, gapSizes: m, gridStyle: w, handleResize: C } = ln(o, r, t), { providerValue: z, draggingLayerId: y, resizingLayerId: L } = In({
1397
+ return /* @__PURE__ */ h(Ee, { config: t, layers: e, style: n, children: /* @__PURE__ */ h(Nn, { gridRef: r, isIntersecting: s, isRoot: o }) });
1398
+ }, Nn = ({ gridRef: t, isIntersecting: e, isRoot: n }) => {
1399
+ const { config: o, style: r, layers: s } = Ht(), { normalizedLayers: u, visibleLayers: c, regularLayers: a, layerById: l } = Je(o, s.defs), { columnHandles: g, rowHandles: f, gapSizes: m, gridStyle: w, handleResize: C } = dn(o, r, t), { providerValue: z, draggingLayerId: y, resizingLayerId: L } = Tn({
1400
1400
  layers: u,
1401
1401
  layerById: l,
1402
1402
  isRootLevel: n
1403
- }), x = y ? !0 : !!L, $ = i.useMemo(() => ({
1404
- ...An(n),
1403
+ }), x = y ? !0 : !!L, N = i.useMemo(() => ({
1404
+ ...Hn(n),
1405
1405
  ...w,
1406
- ...x ? xn : {}
1406
+ ...x ? kn : {}
1407
1407
  }), [w, x, n]);
1408
- return /* @__PURE__ */ H(N, { children: [
1408
+ return /* @__PURE__ */ H(_, { children: [
1409
1409
  /* @__PURE__ */ H(
1410
1410
  "div",
1411
1411
  {
1412
1412
  ref: t,
1413
- style: $,
1413
+ style: N,
1414
1414
  "data-dragging": !!y,
1415
1415
  "data-resizing": !!L,
1416
1416
  "data-visible": e,
1417
1417
  children: [
1418
- /* @__PURE__ */ h(ze, { value: z, children: /* @__PURE__ */ h(Fe, { layers: a }) }),
1418
+ /* @__PURE__ */ h(ze, { value: z, children: /* @__PURE__ */ h(_e, { layers: a }) }),
1419
1419
  g.map(({ trackIndex: M, align: D, span: A }) => /* @__PURE__ */ h(
1420
1420
  mt,
1421
1421
  {
@@ -1449,17 +1449,17 @@ const Ve = {
1449
1449
  export {
1450
1450
  we as D,
1451
1451
  _t as F,
1452
- jn as G,
1453
- je as R,
1454
- Xn as a,
1452
+ Kn as G,
1453
+ Ke as R,
1454
+ Un as a,
1455
1455
  kt as b,
1456
1456
  W as c,
1457
- Ye as d,
1457
+ Ve as d,
1458
1458
  Yt as e,
1459
1459
  Ce as f,
1460
- Vn as g,
1460
+ Xn as g,
1461
1461
  Tt as r,
1462
- Un as t,
1463
- Oe as u
1462
+ jn as t,
1463
+ Be as u
1464
1464
  };
1465
- //# sourceMappingURL=GridLayout-BzrIDrC9.js.map
1465
+ //# sourceMappingURL=GridLayout-CJTKq7Mp.js.map