react-panel-layout 0.6.1 → 0.7.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.
Files changed (115) hide show
  1. package/dist/FloatingWindow-Bw2djgpz.js +1542 -0
  2. package/dist/FloatingWindow-Bw2djgpz.js.map +1 -0
  3. package/dist/FloatingWindow-Cvyokf0m.cjs +2 -0
  4. package/dist/FloatingWindow-Cvyokf0m.cjs.map +1 -0
  5. package/dist/GridLayout-B4aCqSyd.js +947 -0
  6. package/dist/{GridLayout-UWNxXw77.js.map → GridLayout-B4aCqSyd.js.map} +1 -1
  7. package/dist/GridLayout-DNOClFzz.cjs +2 -0
  8. package/dist/{GridLayout-DKTg_N61.cjs.map → GridLayout-DNOClFzz.cjs.map} +1 -1
  9. package/dist/PanelSystem-B8Igvnb2.cjs +3 -0
  10. package/dist/PanelSystem-B8Igvnb2.cjs.map +1 -0
  11. package/dist/{PanelSystem-BqUzNtf2.js → PanelSystem-DDUSFjXD.js} +208 -247
  12. package/dist/PanelSystem-DDUSFjXD.js.map +1 -0
  13. package/dist/components/window/Drawer.d.ts +1 -0
  14. package/dist/components/window/DrawerRevealContext.d.ts +61 -0
  15. package/dist/components/window/drawerRevealAnimationUtils.d.ts +212 -0
  16. package/dist/components/window/drawerStyles.d.ts +5 -0
  17. package/dist/components/window/useDrawerSwipeTransform.d.ts +8 -2
  18. package/dist/components/window/useDrawerTransform.d.ts +68 -0
  19. package/dist/components/window/useRevealDrawerTransform.d.ts +56 -0
  20. package/dist/config.cjs +1 -1
  21. package/dist/config.cjs.map +1 -1
  22. package/dist/config.js +8 -7
  23. package/dist/config.js.map +1 -1
  24. package/dist/grid.cjs +1 -1
  25. package/dist/grid.js +2 -2
  26. package/dist/index.cjs +1 -1
  27. package/dist/index.js +4 -4
  28. package/dist/modules/drawer/drawerStateMachine.d.ts +168 -0
  29. package/dist/modules/drawer/revealDrawerConstants.d.ts +33 -0
  30. package/dist/modules/drawer/revealDrawerStateMachine.d.ts +146 -0
  31. package/dist/modules/drawer/strategies/index.d.ts +8 -0
  32. package/dist/modules/drawer/strategies/overlayStrategy.d.ts +12 -0
  33. package/dist/modules/drawer/strategies/revealStrategy.d.ts +12 -0
  34. package/dist/modules/drawer/strategies/types.d.ts +116 -0
  35. package/dist/panels.cjs +1 -1
  36. package/dist/panels.js +1 -1
  37. package/dist/stack.cjs +1 -1
  38. package/dist/stack.cjs.map +1 -1
  39. package/dist/stack.js +306 -347
  40. package/dist/stack.js.map +1 -1
  41. package/dist/types.d.ts +14 -0
  42. package/dist/useAnimationFrame-BZ6D2lMq.cjs +2 -0
  43. package/dist/useAnimationFrame-BZ6D2lMq.cjs.map +1 -0
  44. package/dist/useAnimationFrame-Bg4e-H8O.js +394 -0
  45. package/dist/useAnimationFrame-Bg4e-H8O.js.map +1 -0
  46. package/dist/window.cjs +1 -1
  47. package/dist/window.js +1 -1
  48. package/package.json +1 -1
  49. package/src/components/gesture/SwipeSafeZone.tsx +1 -0
  50. package/src/components/grid/GridLayout.tsx +110 -38
  51. package/src/components/window/Drawer.tsx +114 -10
  52. package/src/components/window/DrawerLayers.tsx +48 -15
  53. package/src/components/window/DrawerRevealContext.spec.ts +20 -0
  54. package/src/components/window/DrawerRevealContext.tsx +99 -0
  55. package/src/components/window/drawerRevealAnimationUtils.spec.ts +375 -0
  56. package/src/components/window/drawerRevealAnimationUtils.ts +415 -0
  57. package/src/components/window/drawerStyles.spec.ts +39 -0
  58. package/src/components/window/drawerStyles.ts +24 -0
  59. package/src/components/window/useDrawerSwipeTransform.ts +28 -90
  60. package/src/components/window/useDrawerTransform.ts +505 -0
  61. package/src/components/window/useRevealDrawerTransform.spec.ts +1936 -0
  62. package/src/components/window/useRevealDrawerTransform.ts +105 -0
  63. package/src/demo/components/FullscreenDemoPage.tsx +47 -0
  64. package/src/demo/fullscreenRoutes.tsx +32 -0
  65. package/src/demo/index.tsx +5 -0
  66. package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +23 -8
  67. package/src/demo/pages/Drawer/components/DrawerBasics.module.css +6 -1
  68. package/src/demo/pages/Drawer/components/DrawerBasics.tsx +14 -4
  69. package/src/demo/pages/Drawer/components/DrawerReveal.module.css +157 -0
  70. package/src/demo/pages/Drawer/components/DrawerReveal.tsx +128 -0
  71. package/src/demo/pages/Drawer/reveal/index.tsx +17 -0
  72. package/src/demo/pages/Drawer/reveal-fullscreen/index.tsx +135 -0
  73. package/src/demo/pages/Drawer/reveal-fullscreen/styles.module.css +233 -0
  74. package/src/demo/pages/Stack/components/StackBasics.spec.tsx +56 -52
  75. package/src/demo/pages/Stack/components/StackTablet.spec.tsx +39 -49
  76. package/src/demo/routes.tsx +2 -0
  77. package/src/hooks/gesture/testing/createGestureSimulator.ts +1 -0
  78. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +10 -2
  79. package/src/hooks/gesture/utils.ts +15 -4
  80. package/src/hooks/useAnimatedVisibility.spec.ts +3 -3
  81. package/src/hooks/useOperationContinuity.spec.ts +17 -10
  82. package/src/hooks/useOperationContinuity.ts +5 -5
  83. package/src/hooks/useSharedElementTransition.ts +28 -7
  84. package/src/modules/dialog/dialogAnimationUtils.spec.ts +0 -1
  85. package/src/modules/dialog/useDialogContainer.spec.ts +11 -3
  86. package/src/modules/dialog/useDialogSwipeInput.spec.ts +49 -28
  87. package/src/modules/dialog/useDialogSwipeInput.ts +37 -6
  88. package/src/modules/dialog/useDialogTransform.spec.ts +63 -30
  89. package/src/modules/drawer/drawerStateMachine.ts +500 -0
  90. package/src/modules/drawer/revealDrawerConstants.ts +38 -0
  91. package/src/modules/drawer/revealDrawerStateMachine.spec.ts +558 -0
  92. package/src/modules/drawer/revealDrawerStateMachine.ts +197 -0
  93. package/src/modules/drawer/strategies/index.ts +9 -0
  94. package/src/modules/drawer/strategies/overlayStrategy.ts +133 -0
  95. package/src/modules/drawer/strategies/revealStrategy.ts +111 -0
  96. package/src/modules/drawer/strategies/types.ts +160 -0
  97. package/src/modules/drawer/useDrawerSwipeInput.ts +7 -4
  98. package/src/modules/pivot/SwipePivotContent.spec.tsx +48 -37
  99. package/src/modules/pivot/usePivotSwipeInput.spec.ts +8 -8
  100. package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1 -1
  101. package/src/types.ts +15 -0
  102. package/dist/FloatingWindow-CUXnEtrb.js +0 -827
  103. package/dist/FloatingWindow-CUXnEtrb.js.map +0 -1
  104. package/dist/FloatingWindow-DMwyK0eK.cjs +0 -2
  105. package/dist/FloatingWindow-DMwyK0eK.cjs.map +0 -1
  106. package/dist/GridLayout-DKTg_N61.cjs +0 -2
  107. package/dist/GridLayout-UWNxXw77.js +0 -926
  108. package/dist/PanelSystem-BqUzNtf2.js.map +0 -1
  109. package/dist/PanelSystem-D603LKKv.cjs +0 -3
  110. package/dist/PanelSystem-D603LKKv.cjs.map +0 -1
  111. package/dist/useNativeGestureGuard-C7TSqEkr.cjs +0 -2
  112. package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +0 -1
  113. package/dist/useNativeGestureGuard-CGYo6O0r.js +0 -347
  114. package/dist/useNativeGestureGuard-CGYo6O0r.js.map +0 -1
  115. package/src/components/window/useDrawerSwipeTransform.spec.ts +0 -234
@@ -1,23 +1,24 @@
1
1
  import { jsx as m, jsxs as N, Fragment as et } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
- import { e as M, t as Dt, G as ot } from "./GridLayout-UWNxXw77.js";
3
+ import { e as M, t as Dt, G as ot } from "./GridLayout-B4aCqSyd.js";
4
+ import { j as dt, k, l as kt } from "./FloatingWindow-Bw2djgpz.js";
4
5
  import { u as J } from "./useDocumentPointerEvents-DXxw3qWj.js";
5
- import { a as kt, R as st } from "./ResizeHandle-CXjc1meV.js";
6
- import { J as At, K as Mt, L as Ot, M as _t, N as Bt, O as $t, T as Nt, Q as Ht, U as Lt, V as zt, W as Xt, X as Yt, Y as Ft, Z as jt } from "./styles-NkjuMOVS.js";
6
+ import { a as At, R as st } from "./ResizeHandle-CXjc1meV.js";
7
+ import { J as Mt, K as _t, L as Ot, M as Bt, N as $t, O as Nt, T as Ht, Q as Lt, U as zt, V as Xt, W as Yt, X as Ft, Y as jt, Z as Kt } from "./styles-NkjuMOVS.js";
7
8
  import { u as nt } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
8
- import { createPortal as Kt } from "react-dom";
9
- import { u as Wt } from "./useContentCache-CO3LYNmz.js";
10
- const dt = l.createContext(null), Ut = () => {
11
- const t = l.useContext(dt);
9
+ import { createPortal as Wt } from "react-dom";
10
+ import { u as Ut } from "./useContentCache-CO3LYNmz.js";
11
+ const pt = l.createContext(null), Vt = () => {
12
+ const t = l.useContext(pt);
12
13
  if (!t)
13
14
  throw new Error("useKeybindings must be used within KeybindingsProvider");
14
15
  return t;
15
- }, Vt = (t) => {
16
+ }, qt = (t) => {
16
17
  const e = [];
17
18
  t.metaKey && e.push("Mod"), t.ctrlKey && e.push("Ctrl"), t.altKey && e.push("Alt"), t.shiftKey && e.push("Shift");
18
19
  const n = t.key.length === 1 ? t.key.toUpperCase() : t.key;
19
20
  return e.push(n), e.join("-");
20
- }, qt = ({ children: t, configure: e }) => {
21
+ }, Zt = ({ children: t, configure: e }) => {
21
22
  const n = l.useRef({}), r = l.useCallback((a, i) => {
22
23
  n.current = { ...n.current, [a]: i };
23
24
  }, []), o = l.useCallback((a) => {
@@ -26,7 +27,7 @@ const dt = l.createContext(null), Ut = () => {
26
27
  }, []);
27
28
  l.useEffect(() => {
28
29
  const a = (i) => {
29
- const c = Vt(i), u = n.current[c];
30
+ const c = qt(i), u = n.current[c];
30
31
  u && u(i);
31
32
  };
32
33
  return window.addEventListener("keydown", a), () => {
@@ -36,8 +37,8 @@ const dt = l.createContext(null), Ut = () => {
36
37
  const s = l.useMemo(() => ({ register: r, unregister: o }), [r, o]);
37
38
  return l.useEffect(() => {
38
39
  e && e(s);
39
- }, [s, e]), /* @__PURE__ */ m(dt.Provider, { value: s, children: t });
40
- }, Zt = (t, e) => {
40
+ }, [s, e]), /* @__PURE__ */ m(pt.Provider, { value: s, children: t });
41
+ }, Jt = (t, e) => {
41
42
  t.register("Mod-\\", (n) => {
42
43
  n.preventDefault(), e.splitFocused("vertical");
43
44
  }), t.register("Mod-Shift-\\", (n) => {
@@ -52,9 +53,9 @@ const dt = l.createContext(null), Ut = () => {
52
53
  }), t.register("Alt-ArrowLeft", (n) => {
53
54
  n.preventDefault(), e.focusPrevGroup();
54
55
  });
55
- }, Jt = (t) => t.type === "group", pt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
56
+ }, Qt = (t) => t.type === "group", ft = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
56
57
  const n = /* @__PURE__ */ new Map(), r = (o, s) => {
57
- if (Jt(o)) {
58
+ if (Qt(o)) {
58
59
  n.set(o.groupId, s);
59
60
  return;
60
61
  }
@@ -67,8 +68,8 @@ const dt = l.createContext(null), Ut = () => {
67
68
  r(o.a, { x: s.x, y: s.y, w: s.w, h: a }), r(o.b, { x: s.x, y: s.y + a, w: s.w, h: i });
68
69
  };
69
70
  return r(t, e), n;
70
- }, Qt = (t, e) => {
71
- const n = pt(t.tree), r = {
71
+ }, te = (t, e) => {
72
+ const n = ft(t.tree), r = {
72
73
  areas: [["root"]],
73
74
  rows: [{ size: "1fr" }],
74
75
  columns: [{ size: "1fr" }],
@@ -93,17 +94,17 @@ const dt = l.createContext(null), Ut = () => {
93
94
  };
94
95
  });
95
96
  return { config: r, layers: o };
96
- }, te = (t, e, n) => {
97
- const r = pt(t.tree), o = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, v) => h - v), s = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, v) => h - v), a = o.slice(1).map((h, v) => `${h - o[v]}fr`), i = s.slice(1).map((h, v) => `${h - s[v]}fr`), c = a.map((h) => ({ size: h, resizable: n })), u = i.map((h) => ({ size: h, resizable: n })), d = (h, v, w, T) => {
98
- for (const [f, I] of r.entries())
99
- if (h >= I.x && v <= I.x + I.w && w >= I.y && T <= I.y + I.h)
97
+ }, ee = (t, e, n) => {
98
+ const r = ft(t.tree), o = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.x, h.x + h.w]))).sort((h, v) => h - v), s = Array.from(new Set(Array.from(r.values()).flatMap((h) => [h.y, h.y + h.h]))).sort((h, v) => h - v), a = o.slice(1).map((h, v) => `${h - o[v]}fr`), i = s.slice(1).map((h, v) => `${h - s[v]}fr`), c = a.map((h) => ({ size: h, resizable: n })), u = i.map((h) => ({ size: h, resizable: n })), d = (h, v, I, T) => {
99
+ for (const [f, w] of r.entries())
100
+ if (h >= w.x && v <= w.x + w.w && I >= w.y && T <= w.y + w.h)
100
101
  return f;
101
102
  return ".";
102
103
  }, b = [];
103
104
  for (let h = 0; h < s.length - 1; h += 1) {
104
105
  const v = [];
105
- for (let w = 0; w < o.length - 1; w += 1)
106
- v.push(d(o[w], o[w + 1], s[h], s[h + 1]));
106
+ for (let I = 0; I < o.length - 1; I += 1)
107
+ v.push(d(o[I], o[I + 1], s[h], s[h + 1]));
107
108
  b.push(v);
108
109
  }
109
110
  const g = {
@@ -117,17 +118,17 @@ const dt = l.createContext(null), Ut = () => {
117
118
  component: e(h)
118
119
  }));
119
120
  return { config: g, layers: y };
120
- }, ft = l.createContext(null), ee = () => {
121
- const t = l.useContext(ft);
121
+ }, bt = l.createContext(null), ne = () => {
122
+ const t = l.useContext(bt);
122
123
  if (!t)
123
124
  throw new Error("usePanelRenderContext must be used within PanelRenderProvider");
124
125
  return t;
125
- }, ne = ({ value: t, children: e }) => /* @__PURE__ */ m(ft.Provider, { value: t, children: e }), bt = l.createContext(null), ht = () => {
126
- const t = l.useContext(bt);
126
+ }, re = ({ value: t, children: e }) => /* @__PURE__ */ m(bt.Provider, { value: t, children: e }), ht = l.createContext(null), gt = () => {
127
+ const t = l.useContext(ht);
127
128
  if (!t)
128
129
  throw new Error("useDomRegistry must be used within DomRegistryProvider");
129
130
  return t;
130
- }, re = ({ children: t }) => {
131
+ }, oe = ({ children: t }) => {
131
132
  const e = l.useRef(/* @__PURE__ */ new Map()), n = l.useCallback((c) => {
132
133
  const u = e.current.get(c);
133
134
  if (u)
@@ -162,26 +163,26 @@ const dt = l.createContext(null), Ut = () => {
162
163
  },
163
164
  [n]
164
165
  ), a = l.useCallback(() => e.current, []), i = l.useMemo(() => ({ setGroupEl: r, setTabbarEl: o, setContentEl: s, getAll: a }), [r, o, s, a]);
165
- return /* @__PURE__ */ m(bt.Provider, { value: i, children: t });
166
- }, oe = {
166
+ return /* @__PURE__ */ m(ht.Provider, { value: i, children: t });
167
+ }, se = {
167
168
  display: "flex",
168
169
  flexDirection: "column",
169
170
  width: "100%",
170
171
  height: "100%"
171
- }, se = {
172
+ }, ie = {
172
173
  flex: "1 1 auto",
173
174
  minWidth: 0,
174
175
  minHeight: 0,
175
176
  position: "relative",
176
177
  overflow: "hidden"
177
178
  };
178
- function ie(t, e, n, r) {
179
+ function ae(t, e, n, r) {
179
180
  return t ? l.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
180
181
  }
181
- function ae(t, e, n, r) {
182
+ function ce(t, e, n, r) {
182
183
  return t ? l.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
183
184
  }
184
- const ce = ({
185
+ const ue = ({
185
186
  group: t,
186
187
  tabbar: e,
187
188
  content: n,
@@ -195,63 +196,23 @@ const ce = ({
195
196
  }) => {
196
197
  const d = {
197
198
  ref: o,
198
- style: oe,
199
+ style: se,
199
200
  "data-group-id": t.id
200
- }, g = ie(u, c, {
201
+ }, g = ae(u, c, {
201
202
  ref: s,
202
- style: se,
203
+ style: ie,
203
204
  "data-dnd-zone": "content",
204
205
  onPointerDown: r
205
206
  }, n);
206
- return ae(i, a, d, /* @__PURE__ */ N(et, { children: [
207
+ return ce(i, a, d, /* @__PURE__ */ N(et, { children: [
207
208
  e,
208
209
  g
209
210
  ] }));
210
- }, gt = l.memo(ce, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
211
- gt.displayName = "PanelGroupView";
211
+ }, mt = l.memo(ue, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
212
+ mt.displayName = "PanelGroupView";
212
213
  const K = (t, e, n) => {
213
214
  const r = t.left, o = t.top, s = t.width, a = t.height, i = e - r, c = n - o, u = s / 3, d = a / 3;
214
215
  return i > u && i < s - u && c > d && c < a - d ? "center" : i < c && i < s - i && c < a - c ? "left" : s - i < c && s - i < i && c < a - c ? "right" : c < i && c < a - c && i < s - i ? "top" : "bottom";
215
- };
216
- function k(t, e) {
217
- if (!e) {
218
- const r = (() => ({ type: t }));
219
- return Object.defineProperty(r, "type", {
220
- value: t,
221
- writable: !1,
222
- enumerable: !0
223
- }), r;
224
- }
225
- const n = ((...r) => {
226
- const o = e(...r);
227
- return typeof o > "u" ? { type: t } : { type: t, payload: o };
228
- });
229
- return Object.defineProperty(n, "type", {
230
- value: t,
231
- writable: !1,
232
- enumerable: !0
233
- }), n;
234
- }
235
- const ue = (t, e) => {
236
- const n = {};
237
- return Object.keys(t).forEach((r) => {
238
- const o = t[r];
239
- n[r] = ((...s) => {
240
- const a = o(...s);
241
- return e(a), a;
242
- });
243
- }), n;
244
- }, mt = (t, e) => {
245
- const n = {};
246
- return Object.keys(e).forEach((r) => {
247
- const o = e[r];
248
- if (!o)
249
- return;
250
- const s = t[r];
251
- if (!s)
252
- throw new Error(`Missing action creator for key "${String(r)}"`);
253
- n[s.type] = o;
254
- }), n;
255
216
  }, vt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
256
217
  startContent: k(
257
218
  "START_CONTENT",
@@ -268,7 +229,7 @@ const ue = (t, e) => {
268
229
  (t) => t
269
230
  ),
270
231
  reset: k("RESET")
271
- }, le = mt(D, {
232
+ }, le = dt(D, {
272
233
  startContent: (t, e) => ({
273
234
  phase: {
274
235
  kind: "content",
@@ -304,8 +265,8 @@ const ue = (t, e) => {
304
265
  }), de = (t, e) => {
305
266
  const n = le[e.type];
306
267
  return n ? n(t, e, void 0) : t;
307
- }, wt = l.createContext(null), V = () => {
308
- const t = l.useContext(wt);
268
+ }, It = l.createContext(null), V = () => {
269
+ const t = l.useContext(It);
309
270
  if (!t)
310
271
  throw new Error("usePanelInteractions must be used within InteractionsProvider");
311
272
  return t;
@@ -317,77 +278,77 @@ const ue = (t, e) => {
317
278
  isContentZoneAllowed: o,
318
279
  children: s
319
280
  }) => {
320
- const [a, i] = l.useReducer(de, vt), c = ht(), u = l.useCallback(() => {
321
- const w = Array.from(c.getAll().entries()), T = w.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), f = w.map(([p, G]) => ({ gid: p, el: G.tabbar })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), I = w.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() }));
322
- return { groups: T, tabbars: f, contents: I };
323
- }, [c]), d = J((w) => {
281
+ const [a, i] = l.useReducer(de, vt), c = gt(), u = l.useCallback(() => {
282
+ const I = Array.from(c.getAll().entries()), T = I.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), f = I.map(([p, G]) => ({ gid: p, el: G.tabbar })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() })), w = I.map(([p, G]) => ({ gid: p, el: G.content ?? G.group })).filter((p) => !!p.el).map((p) => ({ ...p, rect: p.el.getBoundingClientRect() }));
283
+ return { groups: T, tabbars: f, contents: w };
284
+ }, [c]), d = J((I) => {
324
285
  if (!t.current)
325
286
  return;
326
- const f = w.clientX, I = w.clientY, p = a.phase;
287
+ const f = I.clientX, w = I.clientY, p = a.phase;
327
288
  if (p.kind === "idle")
328
289
  return;
329
- const G = Math.abs(f - p.startX), C = Math.abs(I - p.startY);
290
+ const G = Math.abs(f - p.startX), C = Math.abs(w - p.startY);
330
291
  if (G < e && C < e) {
331
292
  a.phase.kind === "content" && i(D.setSuggest(null)), i(D.setPointer(null)), i(D.setTabbarHover(null));
332
293
  return;
333
294
  }
334
- if (i(D.setPointer({ x: f, y: I })), p.kind === "content") {
335
- const S = p.cache.groups.find(({ rect: x }) => f >= x.left && f <= x.right && I >= x.top && I <= x.bottom);
295
+ if (i(D.setPointer({ x: f, y: w })), p.kind === "content") {
296
+ const S = p.cache.groups.find(({ rect: x }) => f >= x.left && f <= x.right && w >= x.top && w <= x.bottom);
336
297
  if (!S) {
337
298
  i(D.setSuggest(null));
338
299
  return;
339
300
  }
340
- const P = K(S.rect, f, I);
341
- if (o && !o({ targetGroupId: S.gid, zone: P })) {
301
+ const R = K(S.rect, f, w);
302
+ if (o && !o({ targetGroupId: S.gid, zone: R })) {
342
303
  i(D.setSuggest(null));
343
304
  return;
344
305
  }
345
- i(D.setSuggest({ rect: S.rect, zone: P }));
306
+ i(D.setSuggest({ rect: S.rect, zone: R }));
346
307
  return;
347
308
  }
348
309
  if (p.kind === "tab") {
349
- const S = p.cache.tabbars.find(({ rect: E }) => f >= E.left && f <= E.right && I >= E.top && I <= E.bottom);
310
+ const S = p.cache.tabbars.find(({ rect: E }) => f >= E.left && f <= E.right && w >= E.top && w <= E.bottom);
350
311
  if (S) {
351
- const A = Array.from(S.el.querySelectorAll("[role='tab']")).map((L) => L.getBoundingClientRect()), R = A.map((L) => L.left + L.width / 2), _ = R.findIndex((L) => f < L), B = _ === -1 ? R.length : _, Rt = A.length === 0 ? S.rect.left + 8 : B === 0 ? A[0].left : B === A.length ? A[A.length - 1].right : (A[B - 1].right + A[B].left) / 2;
352
- i(D.setTabbarHover({ groupId: S.gid, index: B, rect: S.rect, insertX: Rt }));
312
+ const A = Array.from(S.el.querySelectorAll("[role='tab']")).map((L) => L.getBoundingClientRect()), P = A.map((L) => L.left + L.width / 2), O = P.findIndex((L) => f < L), B = O === -1 ? P.length : O, Pt = A.length === 0 ? S.rect.left + 8 : B === 0 ? A[0].left : B === A.length ? A[A.length - 1].right : (A[B - 1].right + A[B].left) / 2;
313
+ i(D.setTabbarHover({ groupId: S.gid, index: B, rect: S.rect, insertX: Pt }));
353
314
  } else
354
315
  i(D.setTabbarHover(null));
355
- const P = p.cache.contents.find(({ rect: E }) => f >= E.left && f <= E.right && I >= E.top && I <= E.bottom);
356
- if (!P) {
316
+ const R = p.cache.contents.find(({ rect: E }) => f >= E.left && f <= E.right && w >= E.top && w <= E.bottom);
317
+ if (!R) {
357
318
  i(D.setSuggest(null));
358
319
  return;
359
320
  }
360
- const x = K(P.rect, f, I);
361
- if (o && !o({ targetGroupId: P.gid, zone: x })) {
321
+ const x = K(R.rect, f, w);
322
+ if (o && !o({ targetGroupId: R.gid, zone: x })) {
362
323
  i(D.setSuggest(null));
363
324
  return;
364
325
  }
365
- i(D.setSuggest({ rect: P.rect, zone: x }));
326
+ i(D.setSuggest({ rect: R.rect, zone: x }));
366
327
  }
367
- }), b = J((w) => {
328
+ }), b = J((I) => {
368
329
  const T = t.current, f = a;
369
330
  if (i(D.reset()), !T)
370
331
  return;
371
- const I = w.clientX, p = w.clientY;
332
+ const w = I.clientX, p = I.clientY;
372
333
  if (f.phase.kind === "idle")
373
334
  return;
374
- const G = Math.abs(I - f.phase.startX), C = Math.abs(p - f.phase.startY);
335
+ const G = Math.abs(w - f.phase.startX), C = Math.abs(p - f.phase.startY);
375
336
  if (!(G < e && C < e)) {
376
337
  if (f.phase.kind === "content") {
377
- const S = f.phase.cache.groups.find(({ rect: E }) => I >= E.left && I <= E.right && p >= E.top && p <= E.bottom);
338
+ const S = f.phase.cache.groups.find(({ rect: E }) => w >= E.left && w <= E.right && p >= E.top && p <= E.bottom);
378
339
  if (!S)
379
340
  return;
380
- const P = S.gid ?? null;
381
- if (!P)
341
+ const R = S.gid ?? null;
342
+ if (!R)
382
343
  return;
383
- const x = K(S.rect, I, p);
384
- if (o && !o({ targetGroupId: P, zone: x }))
344
+ const x = K(S.rect, w, p);
345
+ if (o && !o({ targetGroupId: R, zone: x }))
385
346
  return;
386
- n({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: P, zone: x });
347
+ n({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: R, zone: x });
387
348
  return;
388
349
  }
389
350
  if (f.phase.kind === "tab") {
390
- const S = f.phase.cache.tabbars.find(({ rect: x }) => I >= x.left && I <= x.right && p >= x.top && p <= x.bottom);
351
+ const S = f.phase.cache.tabbars.find(({ rect: x }) => w >= x.left && w <= x.right && p >= x.top && p <= x.bottom);
391
352
  if (S) {
392
353
  const x = S.gid;
393
354
  if (!x)
@@ -395,16 +356,16 @@ const ue = (t, e) => {
395
356
  const A = Array.from(S.el.querySelectorAll("[role='tab']")).map((B) => {
396
357
  const Z = B.getBoundingClientRect();
397
358
  return Z.left + Z.width / 2;
398
- }), R = A.findIndex((B) => I < B), _ = R === -1 ? A.length : R;
399
- r({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: x, targetIndex: _ });
359
+ }), P = A.findIndex((B) => w < B), O = P === -1 ? A.length : P;
360
+ r({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: x, targetIndex: O });
400
361
  return;
401
362
  }
402
- const P = f.phase.cache.contents.find(({ rect: x }) => I >= x.left && I <= x.right && p >= x.top && p <= x.bottom);
403
- if (P) {
404
- const x = P.gid ?? null;
363
+ const R = f.phase.cache.contents.find(({ rect: x }) => w >= x.left && w <= x.right && p >= x.top && p <= x.bottom);
364
+ if (R) {
365
+ const x = R.gid ?? null;
405
366
  if (!x)
406
367
  return;
407
- const E = K(P.rect, I, p);
368
+ const E = K(R.rect, w, p);
408
369
  if (o && !o({ targetGroupId: x, zone: E }))
409
370
  return;
410
371
  n({ fromGroupId: f.phase.fromGroupId, tabId: f.phase.tabId, targetGroupId: x, zone: E });
@@ -420,19 +381,19 @@ const ue = (t, e) => {
420
381
  window.removeEventListener("pointermove", d), window.removeEventListener("pointerup", b), window.removeEventListener("pointercancel", g);
421
382
  };
422
383
  }, [a.phase.kind]);
423
- const y = l.useCallback((w, T, f) => {
384
+ const y = l.useCallback((I, T, f) => {
424
385
  if (f.button !== 0)
425
386
  return;
426
387
  f.currentTarget.setPointerCapture(f.pointerId);
427
- const I = u();
428
- i(D.startContent({ x: f.clientX, y: f.clientY, groupId: w, tabId: T, cache: I }));
429
- }, [u]), h = l.useCallback((w, T, f) => {
388
+ const w = u();
389
+ i(D.startContent({ x: f.clientX, y: f.clientY, groupId: I, tabId: T, cache: w }));
390
+ }, [u]), h = l.useCallback((I, T, f) => {
430
391
  if (f.button !== 0)
431
392
  return;
432
- const I = f.currentTarget;
433
- I && I.setPointerCapture(f.pointerId);
393
+ const w = f.currentTarget;
394
+ w && w.setPointerCapture(f.pointerId);
434
395
  const p = u();
435
- i(D.startTab({ x: f.clientX, y: f.clientY, groupId: T, tabId: w, cache: p, element: I }));
396
+ i(D.startTab({ x: f.clientX, y: f.clientY, groupId: T, tabId: I, cache: p, element: w }));
436
397
  }, [u]), v = l.useMemo(() => ({
437
398
  suggest: a.suggest,
438
399
  isTabDragging: a.phase.kind === "tab",
@@ -443,7 +404,7 @@ const ue = (t, e) => {
443
404
  onStartContentDrag: y,
444
405
  onStartTabDrag: h
445
406
  }), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, y, h]);
446
- return /* @__PURE__ */ m(wt.Provider, { value: v, children: s });
407
+ return /* @__PURE__ */ m(It.Provider, { value: v, children: s });
447
408
  }, it = {
448
409
  display: "inline-flex",
449
410
  alignItems: "center",
@@ -471,8 +432,8 @@ const ue = (t, e) => {
471
432
  {
472
433
  type: "button",
473
434
  "aria-label": `Close tab ${e.title}`,
474
- onClick: (w) => {
475
- a && (w.stopPropagation(), a(t, e.id));
435
+ onClick: (I) => {
436
+ a && (I.stopPropagation(), a(t, e.id));
476
437
  },
477
438
  style: { marginLeft: 6 },
478
439
  tabIndex: v ? void 0 : -1,
@@ -552,20 +513,20 @@ const ue = (t, e) => {
552
513
  const C = Array.from(G.querySelectorAll('[role="tab"]'));
553
514
  if (C.length === 0)
554
515
  return;
555
- const S = (R) => {
556
- const _ = Math.max(0, Math.min(R, C.length - 1)), B = C[_];
516
+ const S = (P) => {
517
+ const O = Math.max(0, Math.min(P, C.length - 1)), B = C[O];
557
518
  B && B.focus();
558
- }, P = document.activeElement, x = P ? C.indexOf(P) : C.findIndex((R) => R.getAttribute("data-tab-id") === t.activeTabId);
519
+ }, R = document.activeElement, x = R ? C.indexOf(R) : C.findIndex((P) => P.getAttribute("data-tab-id") === t.activeTabId);
559
520
  if (p.key === "ArrowRight") {
560
521
  p.preventDefault();
561
- const R = x >= 0 ? x + 1 : 0;
562
- S(R >= C.length ? 0 : R);
522
+ const P = x >= 0 ? x + 1 : 0;
523
+ S(P >= C.length ? 0 : P);
563
524
  return;
564
525
  }
565
526
  if (p.key === "ArrowLeft") {
566
527
  p.preventDefault();
567
- const R = x >= 0 ? x - 1 : C.length - 1;
568
- S(R < 0 ? C.length - 1 : R);
528
+ const P = x >= 0 ? x - 1 : C.length - 1;
529
+ S(P < 0 ? C.length - 1 : P);
569
530
  return;
570
531
  }
571
532
  if (p.key === "Home") {
@@ -578,15 +539,15 @@ const ue = (t, e) => {
578
539
  }
579
540
  if (p.key === "Enter" || p.key === " ") {
580
541
  p.preventDefault();
581
- const _ = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
582
- _ && e(_);
542
+ const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
543
+ O && e(O);
583
544
  return;
584
545
  }
585
546
  if (p.key === "Delete" || p.key === "Backspace") {
586
547
  if (u) {
587
548
  p.preventDefault();
588
- const _ = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
589
- _ && u(t.id, _);
549
+ const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
550
+ O && u(t.id, O);
590
551
  }
591
552
  return;
592
553
  }
@@ -605,14 +566,14 @@ const ue = (t, e) => {
605
566
  return;
606
567
  !p.contains(document.activeElement) && G && G.focus();
607
568
  }, [t.activeTabId]);
608
- const w = {
569
+ const I = {
609
570
  style: be,
610
571
  role: "tablist",
611
572
  "data-tabbar": "true",
612
573
  "data-group-id": t.id,
613
574
  "data-dragging": b ? "true" : "false",
614
575
  onKeyDown: v
615
- }, T = kt({
576
+ }, T = At({
616
577
  element: s,
617
578
  component: o
618
579
  }), f = () => c ? /* @__PURE__ */ m(
@@ -625,10 +586,10 @@ const ue = (t, e) => {
625
586
  },
626
587
  children: "+"
627
588
  }
628
- ) : null, I = l.useCallback(() => {
589
+ ) : null, w = l.useCallback(() => {
629
590
  d && c && c(t.id);
630
591
  }, [d, c, t.id]);
631
- return /* @__PURE__ */ N(T, { ...w, ref: h, onDoubleClick: I, children: [
592
+ return /* @__PURE__ */ N(T, { ...I, ref: h, onDoubleClick: w, children: [
632
593
  t.tabs.map((p, G) => /* @__PURE__ */ m(
633
594
  fe,
634
595
  {
@@ -649,7 +610,7 @@ const ue = (t, e) => {
649
610
  f()
650
611
  ] });
651
612
  }, me = ({ id: t, TabBarComponent: e, PanelGroupComponent: n }) => {
652
- const { getGroup: r, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: u, registerContentContainer: d } = ee(), { setGroupEl: b, setTabbarEl: g, setContentEl: y } = ht(), h = l.useCallback(
613
+ const { getGroup: r, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: u, registerContentContainer: d } = ne(), { setGroupEl: b, setTabbarEl: g, setContentEl: y } = gt(), h = l.useCallback(
653
614
  (G) => {
654
615
  b(t, G);
655
616
  },
@@ -659,7 +620,7 @@ const ue = (t, e) => {
659
620
  y(t, G), d(t, G);
660
621
  },
661
622
  [t, y, d]
662
- ), w = l.useCallback(
623
+ ), I = l.useCallback(
663
624
  (G) => {
664
625
  g(t, G);
665
626
  },
@@ -669,13 +630,13 @@ const ue = (t, e) => {
669
630
  return null;
670
631
  const f = o(t);
671
632
  return /* @__PURE__ */ m(
672
- n ?? ((G) => /* @__PURE__ */ m(gt, { ...G })),
633
+ n ?? ((G) => /* @__PURE__ */ m(mt, { ...G })),
673
634
  {
674
635
  group: T,
675
636
  tabbar: /* @__PURE__ */ m(
676
637
  e ?? ge,
677
638
  {
678
- rootRef: w,
639
+ rootRef: I,
679
640
  group: T,
680
641
  onClickTab: (G) => s(t, G),
681
642
  onAddTab: a,
@@ -1091,7 +1052,7 @@ const ue = (t, e) => {
1091
1052
  ].join(`
1092
1053
  `)
1093
1054
  });
1094
- }, we = () => W([
1055
+ }, Ie = () => W([
1095
1056
  1,
1096
1057
  0,
1097
1058
  0,
@@ -1108,16 +1069,16 @@ const ue = (t, e) => {
1108
1069
  0,
1109
1070
  0,
1110
1071
  1
1111
- ]), Ie = {
1072
+ ]), we = {
1112
1073
  position: "fixed",
1113
1074
  inset: 0,
1114
1075
  pointerEvents: "none",
1115
- zIndex: At
1076
+ zIndex: Mt
1116
1077
  }, ye = {
1117
1078
  position: "absolute",
1118
- border: `${_t} dashed ${Bt}`,
1079
+ border: `${Bt} dashed ${$t}`,
1119
1080
  background: Ot,
1120
- borderRadius: Mt,
1081
+ borderRadius: _t,
1121
1082
  transformOrigin: "top left"
1122
1083
  }, $ = (t, e) => e <= 0 ? 0 : M(t / e, 0), Te = (t, e, n) => {
1123
1084
  const { width: r, height: o } = t, s = n / 2, a = r > 0 ? r : 1, i = o > 0 ? o : 1, c = {
@@ -1151,10 +1112,10 @@ const ue = (t, e) => {
1151
1112
  right: d,
1152
1113
  top: b,
1153
1114
  bottom: g
1154
- }, { translateX: h, translateY: v, scaleX: w, scaleY: T } = y[e];
1155
- return we().translate(h, v, 0).scale(w, T, 1).toCSS();
1115
+ }, { translateX: h, translateY: v, scaleX: I, scaleY: T } = y[e];
1116
+ return Ie().translate(h, v, 0).scale(I, T, 1).toCSS();
1156
1117
  }, Ge = (t, e) => {
1157
- const n = $t;
1118
+ const n = Nt;
1158
1119
  return {
1159
1120
  ...ye,
1160
1121
  left: t.left,
@@ -1167,7 +1128,7 @@ const ue = (t, e) => {
1167
1128
  if (!t)
1168
1129
  return null;
1169
1130
  const { rect: e, zone: n } = t, r = Ge(e, n);
1170
- return /* @__PURE__ */ m("div", { style: Ie, children: /* @__PURE__ */ m("div", { style: r }) });
1131
+ return /* @__PURE__ */ m("div", { style: we, children: /* @__PURE__ */ m("div", { style: r }) });
1171
1132
  }, Se = typeof window < "u" && typeof document < "u", Ce = (t) => {
1172
1133
  const [e, n] = l.useState(null), [r, o] = l.useState(null);
1173
1134
  return nt(() => {
@@ -1182,21 +1143,21 @@ const ue = (t, e) => {
1182
1143
  position: "fixed",
1183
1144
  inset: 0,
1184
1145
  pointerEvents: "none",
1185
- zIndex: Ft
1186
- }, Pe = {
1146
+ zIndex: jt
1147
+ }, Re = {
1187
1148
  position: "absolute",
1188
- width: Yt,
1189
- borderRadius: Xt,
1190
- background: zt,
1191
- boxShadow: Lt
1192
- }, Re = () => {
1149
+ width: Ft,
1150
+ borderRadius: Yt,
1151
+ background: Xt,
1152
+ boxShadow: zt
1153
+ }, Pe = () => {
1193
1154
  const { isTabDragging: t, draggingTabId: e, dragPointer: n, tabbarHover: r, draggingTabElement: o } = V(), { html: s, size: a } = Ce(o), i = n !== null && e !== null, c = l.useMemo(() => {
1194
1155
  if (!(!i || !n))
1195
1156
  return {
1196
1157
  position: "absolute",
1197
1158
  left: n.x,
1198
1159
  top: n.y,
1199
- transform: `translate(${Nt}, ${Ht})`,
1160
+ transform: `translate(${Ht}, ${Lt})`,
1200
1161
  pointerEvents: "none"
1201
1162
  };
1202
1163
  }, [i, n]), u = l.useMemo(() => {
@@ -1205,7 +1166,7 @@ const ue = (t, e) => {
1205
1166
  }, [c, o, a]), d = l.useMemo(() => {
1206
1167
  if (r)
1207
1168
  return {
1208
- ...Pe,
1169
+ ...Re,
1209
1170
  left: r.insertX,
1210
1171
  top: r.rect.top + 4,
1211
1172
  height: Math.max(0, r.rect.height - 8)
@@ -1221,26 +1182,26 @@ const ue = (t, e) => {
1221
1182
  ) }) }),
1222
1183
  /* @__PURE__ */ m(l.Activity, { mode: d ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: d }) })
1223
1184
  ] }) : null;
1224
- }, O = (t) => t.type === "group", z = (t, e = []) => {
1225
- if (O(t))
1185
+ }, _ = (t) => t.type === "group", z = (t, e = []) => {
1186
+ if (_(t))
1226
1187
  return [...e, t.groupId];
1227
1188
  const n = z(t.a, e);
1228
1189
  return z(t.b, n);
1229
- }, q = (t, e) => e.reduce((n, r) => O(n) ? n : n[r], t), j = (t, e, n) => {
1190
+ }, q = (t, e) => e.reduce((n, r) => _(n) ? n : n[r], t), j = (t, e, n) => {
1230
1191
  if (e.length === 0)
1231
1192
  return n;
1232
1193
  const [r, ...o] = e;
1233
- return O(t) ? t : r === "a" ? { ...t, a: j(t.a, o, n) } : { ...t, b: j(t.b, o, n) };
1194
+ return _(t) ? t : r === "a" ? { ...t, a: j(t.a, o, n) } : { ...t, b: j(t.b, o, n) };
1234
1195
  }, U = (t, e, n = []) => {
1235
- if (O(t))
1196
+ if (_(t))
1236
1197
  return t.groupId === e ? { splitPath: null, side: null } : null;
1237
- if (O(t.a) && t.a.groupId === e)
1198
+ if (_(t.a) && t.a.groupId === e)
1238
1199
  return { splitPath: n, side: "a" };
1239
- if (O(t.b) && t.b.groupId === e)
1200
+ if (_(t.b) && t.b.groupId === e)
1240
1201
  return { splitPath: n, side: "b" };
1241
1202
  const r = U(t.a, e, [...n, "a"]);
1242
1203
  return r || U(t.b, e, [...n, "b"]);
1243
- }, It = (t, e, n, r) => {
1204
+ }, wt = (t, e, n, r) => {
1244
1205
  const o = r(), s = U(t, e), a = {
1245
1206
  type: "split",
1246
1207
  direction: n,
@@ -1251,7 +1212,7 @@ const ue = (t, e) => {
1251
1212
  if (!s || s.splitPath === null)
1252
1213
  return { tree: a, newGroupId: o };
1253
1214
  const i = s.splitPath, c = q(t, i);
1254
- if (O(c))
1215
+ if (_(c))
1255
1216
  return { tree: a, newGroupId: o };
1256
1217
  const u = s.side === "a" ? { ...c, a } : { ...c, b: a };
1257
1218
  return { tree: j(t, i, u), newGroupId: o };
@@ -1260,13 +1221,13 @@ const ue = (t, e) => {
1260
1221
  if (!n || n.splitPath === null)
1261
1222
  return { tree: t, survivorGroupId: e };
1262
1223
  const r = n.splitPath, o = q(t, r);
1263
- if (O(o))
1224
+ if (_(o))
1264
1225
  return { tree: t, survivorGroupId: e };
1265
- const s = n.side === "a" ? o.b : o.a, a = j(t, r, s), i = O(s) ? s.groupId : z(s)[0] ?? null;
1226
+ const s = n.side === "a" ? o.b : o.a, a = j(t, r, s), i = _(s) ? s.groupId : z(s)[0] ?? null;
1266
1227
  return { tree: a, survivorGroupId: i };
1267
1228
  }, ke = (t, e, n) => {
1268
1229
  const r = q(t, e);
1269
- if (O(r))
1230
+ if (_(r))
1270
1231
  return t;
1271
1232
  const o = { ...r, ratio: M(n, 0.05, 0.95) };
1272
1233
  return j(t, e, o);
@@ -1333,10 +1294,10 @@ const ue = (t, e) => {
1333
1294
  if (!t.groups[e])
1334
1295
  throw new Error(`setFocusedGroup: group ${e} not found.`);
1335
1296
  return { ...t, focusedGroupId: e };
1336
- }, Oe = (t, e) => {
1297
+ }, _e = (t, e) => {
1337
1298
  const n = e - 1, r = t.groupOrder[n];
1338
1299
  return r ? H(t, r) : t;
1339
- }, _e = (t) => {
1300
+ }, Oe = (t) => {
1340
1301
  const e = t.groupOrder, n = t.focusedGroupId;
1341
1302
  if (!n) {
1342
1303
  const s = e[0];
@@ -1352,13 +1313,13 @@ const ue = (t, e) => {
1352
1313
  }
1353
1314
  const r = e.indexOf(n), o = e[(r - 1 + e.length) % e.length];
1354
1315
  return H(t, o);
1355
- }, In = (t) => {
1316
+ }, yn = (t) => {
1356
1317
  const e = z(t.tree);
1357
1318
  return { ...t, groupOrder: e };
1358
1319
  }, Tt = (t, e, n, r) => {
1359
- const { tree: o, newGroupId: s } = It(t.tree, e, n, r), a = { ...t.groups, [s]: Ae(s) }, i = z(o);
1320
+ const { tree: o, newGroupId: s } = wt(t.tree, e, n, r), a = { ...t.groups, [s]: Ae(s) }, i = z(o);
1360
1321
  return { ...t, tree: o, groups: a, groupOrder: i, focusedGroupId: s };
1361
- }, yn = (t) => {
1322
+ }, Tn = (t) => {
1362
1323
  const n = { type: "group", groupId: "g_1" }, r = Object.fromEntries(t.map((i) => [i.id, i])), s = { g_1: { id: "g_1", tabIds: t.map((i) => i.id), tabs: t, activeTabId: t[0]?.id ?? null } };
1363
1324
  return { tree: n, panels: r, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
1364
1325
  }, $e = l.createContext(null), Ne = ({ value: t, children: e }) => /* @__PURE__ */ m($e.Provider, { value: t, children: e }), Gt = l.createContext(null), He = () => {
@@ -1390,12 +1351,12 @@ const ue = (t, e) => {
1390
1351
  cols: Y(e.maxVertical)
1391
1352
  };
1392
1353
  }, tt = (t) => {
1393
- if (O(t))
1354
+ if (_(t))
1394
1355
  return { horizontal: 1, vertical: 1 };
1395
1356
  const e = tt(t.a), n = tt(t.b);
1396
1357
  return t.direction === "horizontal" ? { horizontal: e.horizontal + n.horizontal, vertical: Math.max(e.vertical, n.vertical) } : { horizontal: Math.max(e.horizontal, n.horizontal), vertical: e.vertical + n.vertical };
1397
1358
  }, je = (t, e, n) => {
1398
- const { tree: r } = It(t, e, n, () => "__preview__");
1359
+ const { tree: r } = wt(t, e, n, () => "__preview__");
1399
1360
  return r;
1400
1361
  }, rt = (t, e, n, r) => {
1401
1362
  if (!Number.isFinite(r.rows) && !Number.isFinite(r.cols))
@@ -1446,8 +1407,8 @@ const ue = (t, e) => {
1446
1407
  if (!n || !r || !t.panels[e.tabId])
1447
1408
  return t;
1448
1409
  if (e.fromGroupId === e.targetGroupId) {
1449
- const g = n.tabIds.filter((T) => T !== e.tabId), y = Math.max(0, Math.min(e.targetIndex, g.length)), h = g.slice(0, y).concat([e.tabId], g.slice(y)), v = h.map((T) => t.panels[T]).filter(Boolean), w = { ...t.groups, [e.fromGroupId]: { ...n, tabIds: h, tabs: v } };
1450
- return { ...t, groups: w };
1410
+ const g = n.tabIds.filter((T) => T !== e.tabId), y = Math.max(0, Math.min(e.targetIndex, g.length)), h = g.slice(0, y).concat([e.tabId], g.slice(y)), v = h.map((T) => t.panels[T]).filter(Boolean), I = { ...t.groups, [e.fromGroupId]: { ...n, tabIds: h, tabs: v } };
1411
+ return { ...t, groups: I };
1451
1412
  }
1452
1413
  const s = { ...t.groups }, a = n.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
1453
1414
  s[e.fromGroupId] = {
@@ -1458,13 +1419,13 @@ const ue = (t, e) => {
1458
1419
  };
1459
1420
  const c = r.tabIds.filter((g) => g !== e.tabId), u = Math.max(0, Math.min(e.targetIndex, c.length)), d = c.slice(0, u).concat([e.tabId], c.slice(u)), b = d.map((g) => t.panels[g]).filter(Boolean);
1460
1421
  return s[e.targetGroupId] = { ...r, tabIds: d, tabs: b, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
1461
- }, Ue = mt(St, {
1422
+ }, Ue = dt(St, {
1462
1423
  splitFocused: (t, e, n) => {
1463
1424
  const r = t.focusedGroupId ?? t.groupOrder[0] ?? null;
1464
1425
  return !r || !rt(t.tree, r, e.payload.direction, n.splitLimits) ? t : Tt(t, r, e.payload.direction, n.createGroupId);
1465
1426
  },
1466
- focusGroupIndex: (t, e) => Oe(t, e.payload.index1Based),
1467
- focusNextGroup: (t) => _e(t),
1427
+ focusGroupIndex: (t, e) => _e(t, e.payload.index1Based),
1428
+ focusNextGroup: (t) => Oe(t),
1468
1429
  focusPrevGroup: (t) => Be(t),
1469
1430
  setActiveTab: (t, e) => yt(t, e.payload.groupId, e.payload.tabId),
1470
1431
  addTab: (t, e) => {
@@ -1482,7 +1443,7 @@ const ue = (t, e) => {
1482
1443
  tabDrop: (t, e) => We(t, e.payload),
1483
1444
  adjustSplitRatio: (t, e) => {
1484
1445
  const n = q(t.tree, e.payload.path);
1485
- if (O(n))
1446
+ if (_(n))
1486
1447
  return t;
1487
1448
  const r = ke(t.tree, e.payload.path, n.ratio + e.payload.deltaRatio);
1488
1449
  return { ...t, tree: r };
@@ -1527,33 +1488,33 @@ const ue = (t, e) => {
1527
1488
  b(G);
1528
1489
  },
1529
1490
  [h, o, b]
1530
- ), w = l.useMemo(() => ue(St, v), [v]), T = l.useMemo(
1491
+ ), I = l.useMemo(() => kt(St, v), [v]), T = l.useMemo(
1531
1492
  () => ({
1532
- setActiveTab: w.setActiveTab,
1533
- tabDrop: w.tabDrop
1493
+ setActiveTab: I.setActiveTab,
1494
+ tabDrop: I.tabDrop
1534
1495
  }),
1535
- [w]
1496
+ [I]
1536
1497
  ), f = l.useMemo(
1537
1498
  () => ({
1538
- adjustSplitRatio: w.adjustSplitRatio
1499
+ adjustSplitRatio: I.adjustSplitRatio
1539
1500
  }),
1540
- [w]
1541
- ), I = l.useMemo(
1501
+ [I]
1502
+ ), w = l.useMemo(
1542
1503
  () => ({
1543
- focusGroupIndex: w.focusGroupIndex,
1544
- focusNextGroup: w.focusNextGroup,
1545
- focusPrevGroup: w.focusPrevGroup
1504
+ focusGroupIndex: I.focusGroupIndex,
1505
+ focusNextGroup: I.focusNextGroup,
1506
+ focusPrevGroup: I.focusPrevGroup
1546
1507
  }),
1547
- [w]
1508
+ [I]
1548
1509
  ), p = l.useMemo(
1549
1510
  () => ({
1550
1511
  state: g,
1551
1512
  dispatch: v,
1552
- actions: w
1513
+ actions: I
1553
1514
  }),
1554
- [g, v, w]
1515
+ [g, v, I]
1555
1516
  );
1556
- return /* @__PURE__ */ m(Ct.Provider, { value: p, children: /* @__PURE__ */ m(Ne, { value: T, children: /* @__PURE__ */ m(Le, { value: f, children: /* @__PURE__ */ m(Xe, { value: I, children: a }) }) }) });
1517
+ return /* @__PURE__ */ m(Ct.Provider, { value: p, children: /* @__PURE__ */ m(Ne, { value: T, children: /* @__PURE__ */ m(Le, { value: f, children: /* @__PURE__ */ m(Xe, { value: w, children: a }) }) }) });
1557
1518
  }, qe = () => {
1558
1519
  const { actions: t } = X();
1559
1520
  return l.useMemo(
@@ -1589,9 +1550,9 @@ const ue = (t, e) => {
1589
1550
  );
1590
1551
  return { onCommitContentDrop: e, onCommitTabDrop: n };
1591
1552
  }, Je = () => {
1592
- const t = Ut(), e = qe();
1553
+ const t = Vt(), e = qe();
1593
1554
  return l.useEffect(() => {
1594
- Zt(t, e);
1555
+ Jt(t, e);
1595
1556
  }, [t, e]), null;
1596
1557
  }, Et = l.createContext(null), Qe = () => {
1597
1558
  const t = l.useContext(Et);
@@ -1606,16 +1567,16 @@ const ue = (t, e) => {
1606
1567
  return nt(() => (r.style.display = n ? "contents" : "none", e && r.parentElement !== e && e.appendChild(r), () => {
1607
1568
  r.parentElement?.removeChild(r);
1608
1569
  }), [r, e, n]), r;
1609
- }, Pt = l.memo(
1570
+ }, Rt = l.memo(
1610
1571
  ({ panelId: t, content: e, placement: n, containerElement: r }) => {
1611
1572
  const o = n?.isActive ?? !1, s = en(t, r, o);
1612
- return Kt(
1573
+ return Wt(
1613
1574
  /* @__PURE__ */ m(l.Activity, { mode: o ? "visible" : "hidden", children: e }),
1614
1575
  s
1615
1576
  );
1616
1577
  }
1617
1578
  );
1618
- Pt.displayName = "PanelContentHost";
1579
+ Rt.displayName = "PanelContentHost";
1619
1580
  const nn = ({
1620
1581
  children: t,
1621
1582
  panels: e,
@@ -1634,7 +1595,7 @@ const nn = ({
1634
1595
  const c = l.useCallback((g) => {
1635
1596
  const y = i.current[g];
1636
1597
  return y ? y.render(y.id) : null;
1637
- }, []), u = l.useMemo(() => Object.keys(e), [e]), { getCachedContent: d } = Wt({
1598
+ }, []), u = l.useMemo(() => Object.keys(e), [e]), { getCachedContent: d } = Ut({
1638
1599
  resolveContent: c,
1639
1600
  validIds: u
1640
1601
  }), b = Object.keys(e);
@@ -1643,12 +1604,12 @@ const nn = ({
1643
1604
  b.map((g) => {
1644
1605
  if (!e[g])
1645
1606
  return null;
1646
- const h = n[g] ?? null, v = h ? r.get(h.groupId) ?? null : null, w = d(g);
1607
+ const h = n[g] ?? null, v = h ? r.get(h.groupId) ?? null : null, I = d(g);
1647
1608
  return /* @__PURE__ */ m(
1648
- Pt,
1609
+ Rt,
1649
1610
  {
1650
1611
  panelId: g,
1651
- content: w,
1612
+ content: I,
1652
1613
  placement: h,
1653
1614
  containerElement: v
1654
1615
  },
@@ -1666,8 +1627,8 @@ const nn = ({
1666
1627
  const f = o.groups[T];
1667
1628
  if (!f)
1668
1629
  return null;
1669
- const I = f.tabIds.map((p) => o.panels[p]).filter(Boolean);
1670
- return { ...f, tabs: I };
1630
+ const w = f.tabIds.map((p) => o.panels[p]).filter(Boolean);
1631
+ return { ...f, tabs: w };
1671
1632
  },
1672
1633
  [o.groups, o.panels]
1673
1634
  ), d = l.useCallback(
@@ -1682,16 +1643,16 @@ const nn = ({
1682
1643
  s.addNewTab({ groupId: T, title: "New Tab", makeActive: !0 });
1683
1644
  }, [s]), y = l.useCallback((T, f) => {
1684
1645
  s.removeTab(T, f);
1685
- }, [s]), h = l.useCallback((T, f, I) => {
1686
- s.setActiveTab(f, T), r.onStartTabDrag(T, f, I);
1646
+ }, [s]), h = l.useCallback((T, f, w) => {
1647
+ s.setActiveTab(f, T), r.onStartTabDrag(T, f, w);
1687
1648
  }, [s, r]), v = l.useCallback((T, f) => {
1688
- const I = o.groups[T];
1689
- !I || !I.activeTabId || r.onStartContentDrag(T, I.activeTabId, f);
1690
- }, [o.groups, r]), w = l.useMemo(
1649
+ const w = o.groups[T];
1650
+ !w || !w.activeTabId || r.onStartContentDrag(T, w.activeTabId, f);
1651
+ }, [o.groups, r]), I = l.useMemo(
1691
1652
  () => ({ getGroup: u, getGroupContent: d, onClickTab: b, onAddTab: g, onCloseTab: y, onStartTabDrag: h, onStartContentDrag: v, doubleClickToAdd: n, registerContentContainer: a }),
1692
1653
  [u, d, b, g, y, h, v, n, a]
1693
1654
  );
1694
- return /* @__PURE__ */ m(ne, { value: w, children: t });
1655
+ return /* @__PURE__ */ m(re, { value: I, children: t });
1695
1656
  }, on = ({
1696
1657
  children: t,
1697
1658
  emptyContentComponent: e,
@@ -1709,7 +1670,7 @@ const nn = ({
1709
1670
  }, [r.groups]);
1710
1671
  return /* @__PURE__ */ m(nn, { panels: r.panels, placements: o, children: /* @__PURE__ */ m(rn, { emptyContentComponent: e, doubleClickToAdd: n, children: t }) });
1711
1672
  }, F = (t, e, n, r) => {
1712
- if (O(t))
1673
+ if (_(t))
1713
1674
  return r;
1714
1675
  const o = t.direction, s = o === "vertical" ? n.x + n.w * t.ratio : n.y + n.h * t.ratio;
1715
1676
  if (r.push({ path: e, direction: o, parentRect: n, linePos: s }), o === "vertical") {
@@ -1751,7 +1712,7 @@ const nn = ({
1751
1712
  top: o.top + o.height * i.parentRect.y / 100,
1752
1713
  width: o.width * i.parentRect.w / 100,
1753
1714
  height: o.height * i.parentRect.h / 100
1754
- }, d = jt;
1715
+ }, d = Kt;
1755
1716
  if (i.direction === "vertical") {
1756
1717
  const h = u.left + u.width * (i.linePos - i.parentRect.x) / i.parentRect.w, v = {
1757
1718
  position: "fixed",
@@ -1763,8 +1724,8 @@ const nn = ({
1763
1724
  pointerEvents: "auto"
1764
1725
  };
1765
1726
  return /* @__PURE__ */ m("div", { style: v, children: /* @__PURE__ */ m(st, { direction: "vertical", onResize: (T) => {
1766
- const f = o.width * i.parentRect.w / 100, I = f === 0 ? 0 : T / f;
1767
- n({ path: i.path, deltaRatio: I });
1727
+ const f = o.width * i.parentRect.w / 100, w = f === 0 ? 0 : T / f;
1728
+ n({ path: i.path, deltaRatio: w });
1768
1729
  } }) }, `split-${c}`);
1769
1730
  }
1770
1731
  const b = u.top + u.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
@@ -1777,8 +1738,8 @@ const nn = ({
1777
1738
  pointerEvents: "auto"
1778
1739
  };
1779
1740
  return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(st, { direction: "horizontal", onResize: (h) => {
1780
- const v = o.height * i.parentRect.h / 100, w = v === 0 ? 0 : h / v;
1781
- n({ path: i.path, deltaRatio: w });
1741
+ const v = o.height * i.parentRect.h / 100, I = v === 0 ? 0 : h / v;
1742
+ n({ path: i.path, deltaRatio: I });
1782
1743
  } }) }, `split-${c}`);
1783
1744
  };
1784
1745
  return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: r.map((i, c) => a(i, c)) });
@@ -1797,10 +1758,10 @@ const nn = ({
1797
1758
  }) => {
1798
1759
  const a = (c) => r ? /* @__PURE__ */ m(r, { groupId: c }) : /* @__PURE__ */ m(me, { id: c, TabBarComponent: o, PanelGroupComponent: s });
1799
1760
  if (e === "grid") {
1800
- const c = te(t, a, !!n);
1761
+ const c = ee(t, a, !!n);
1801
1762
  return /* @__PURE__ */ m(ot, { config: c.config, layers: c.layers });
1802
1763
  }
1803
- const i = Qt(t, a);
1764
+ const i = te(t, a);
1804
1765
  return /* @__PURE__ */ m(ot, { config: i.config, layers: i.layers });
1805
1766
  }, un = ({
1806
1767
  containerRef: t,
@@ -1816,23 +1777,23 @@ const nn = ({
1816
1777
  emptyContentComponent: d,
1817
1778
  doubleClickToAdd: b
1818
1779
  }) => {
1819
- const { state: g } = X(), { onCommitContentDrop: y, onCommitTabDrop: h } = Ze(), v = l.useMemo(() => ({ ...an, ...s }), [s]), w = l.useCallback(
1780
+ const { state: g } = X(), { onCommitContentDrop: y, onCommitTabDrop: h } = Ze(), v = l.useMemo(() => ({ ...an, ...s }), [s]), I = l.useCallback(
1820
1781
  ({ targetGroupId: T, zone: f }) => {
1821
1782
  if (f === "center")
1822
1783
  return !0;
1823
- const I = f === "left" || f === "right" ? "vertical" : "horizontal";
1824
- return rt(g.tree, T, I, u);
1784
+ const w = f === "left" || f === "right" ? "vertical" : "horizontal";
1785
+ return rt(g.tree, T, w, u);
1825
1786
  },
1826
1787
  [g.tree, u]
1827
1788
  );
1828
- return /* @__PURE__ */ m(re, { children: /* @__PURE__ */ N(
1789
+ return /* @__PURE__ */ m(oe, { children: /* @__PURE__ */ N(
1829
1790
  pe,
1830
1791
  {
1831
1792
  containerRef: t,
1832
1793
  dragThresholdPx: r,
1833
1794
  onCommitContentDrop: y,
1834
1795
  onCommitTabDrop: h,
1835
- isContentZoneAllowed: w,
1796
+ isContentZoneAllowed: I,
1836
1797
  children: [
1837
1798
  /* @__PURE__ */ m(on, { emptyContentComponent: d, doubleClickToAdd: b, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: v, children: /* @__PURE__ */ m(
1838
1799
  cn,
@@ -1854,9 +1815,9 @@ const nn = ({
1854
1815
  const t = V();
1855
1816
  return /* @__PURE__ */ N(et, { children: [
1856
1817
  /* @__PURE__ */ m(xe, { suggest: t.suggest }),
1857
- /* @__PURE__ */ m(Re, {})
1818
+ /* @__PURE__ */ m(Pe, {})
1858
1819
  ] });
1859
- }, Tn = ({
1820
+ }, Gn = ({
1860
1821
  initialState: t,
1861
1822
  createGroupId: e,
1862
1823
  createPanelId: n,
@@ -1884,7 +1845,7 @@ const nn = ({
1884
1845
  throw new Error("PanelSystem(layoutMode='grid') requires explicit 'gridTracksInteractive' flag.");
1885
1846
  if (s === void 0)
1886
1847
  throw new Error("PanelSystem requires explicit 'dragThresholdPx' value.");
1887
- const w = l.useRef(null), T = l.useMemo(() => xt(h), [h]);
1848
+ const I = l.useRef(null), T = l.useMemo(() => xt(h), [h]);
1888
1849
  return /* @__PURE__ */ m(
1889
1850
  Ve,
1890
1851
  {
@@ -1894,12 +1855,12 @@ const nn = ({
1894
1855
  state: c,
1895
1856
  onStateChange: u,
1896
1857
  splitLimits: h,
1897
- children: /* @__PURE__ */ N(qt, { children: [
1858
+ children: /* @__PURE__ */ N(Zt, { children: [
1898
1859
  /* @__PURE__ */ m(Je, {}),
1899
1860
  /* @__PURE__ */ m(
1900
1861
  un,
1901
1862
  {
1902
- containerRef: w,
1863
+ containerRef: I,
1903
1864
  layoutMode: r,
1904
1865
  gridTracksInteractive: o,
1905
1866
  dragThresholdPx: s,
@@ -1919,8 +1880,8 @@ const nn = ({
1919
1880
  };
1920
1881
  export {
1921
1882
  xe as D,
1922
- Tn as P,
1923
- gt as a,
1883
+ Gn as P,
1884
+ mt as a,
1924
1885
  Ve as b,
1925
1886
  z as c,
1926
1887
  De as d,
@@ -1928,19 +1889,19 @@ export {
1928
1889
  Ae as f,
1929
1890
  at as g,
1930
1891
  yt as h,
1931
- O as i,
1892
+ _ as i,
1932
1893
  wn as j,
1933
1894
  ut as k,
1934
1895
  H as l,
1935
1896
  ct as m,
1936
- Oe as n,
1937
- _e as o,
1897
+ _e as n,
1898
+ Oe as o,
1938
1899
  Be as p,
1939
- In as q,
1900
+ yn as q,
1940
1901
  Me as r,
1941
- It as s,
1902
+ wt as s,
1942
1903
  Tt as t,
1943
1904
  X as u,
1944
- yn as v
1905
+ Tn as v
1945
1906
  };
1946
- //# sourceMappingURL=PanelSystem-BqUzNtf2.js.map
1907
+ //# sourceMappingURL=PanelSystem-DDUSFjXD.js.map