react-panel-layout 0.6.0 → 0.6.1

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 (216) hide show
  1. package/dist/{FloatingPanelFrame-SgYLc6Ud.js → FloatingPanelFrame-3eU9AwPo.js} +2 -2
  2. package/dist/{FloatingPanelFrame-SgYLc6Ud.js.map → FloatingPanelFrame-3eU9AwPo.js.map} +1 -1
  3. package/dist/FloatingWindow-CUXnEtrb.js +827 -0
  4. package/dist/FloatingWindow-CUXnEtrb.js.map +1 -0
  5. package/dist/FloatingWindow-DMwyK0eK.cjs +2 -0
  6. package/dist/FloatingWindow-DMwyK0eK.cjs.map +1 -0
  7. package/dist/GridLayout-DKTg_N61.cjs +2 -0
  8. package/dist/{GridLayout-B4VRsC0r.cjs.map → GridLayout-DKTg_N61.cjs.map} +1 -1
  9. package/dist/{GridLayout-BltqeCPK.js → GridLayout-UWNxXw77.js} +34 -35
  10. package/dist/{GridLayout-BltqeCPK.js.map → GridLayout-UWNxXw77.js.map} +1 -1
  11. package/dist/{HorizontalDivider-WF1k_qND.js → HorizontalDivider-DdxzfV0l.js} +3 -3
  12. package/dist/{HorizontalDivider-WF1k_qND.js.map → HorizontalDivider-DdxzfV0l.js.map} +1 -1
  13. package/dist/{HorizontalDivider-B5Z-KZLk.cjs → HorizontalDivider-_pgV4Mcv.cjs} +2 -2
  14. package/dist/{HorizontalDivider-B5Z-KZLk.cjs.map → HorizontalDivider-_pgV4Mcv.cjs.map} +1 -1
  15. package/dist/{PanelSystem-Dr1TBhxM.js → PanelSystem-BqUzNtf2.js} +5 -5
  16. package/dist/{PanelSystem-Dr1TBhxM.js.map → PanelSystem-BqUzNtf2.js.map} +1 -1
  17. package/dist/{PanelSystem-Bs8bQwQF.cjs → PanelSystem-D603LKKv.cjs} +2 -2
  18. package/dist/{PanelSystem-Bs8bQwQF.cjs.map → PanelSystem-D603LKKv.cjs.map} +1 -1
  19. package/dist/ResizeHandle-CBcAS918.cjs +2 -0
  20. package/dist/{ResizeHandle-CScipO5l.cjs.map → ResizeHandle-CBcAS918.cjs.map} +1 -1
  21. package/dist/{ResizeHandle-CdA_JYfN.js → ResizeHandle-CXjc1meV.js} +28 -29
  22. package/dist/{ResizeHandle-CdA_JYfN.js.map → ResizeHandle-CXjc1meV.js.map} +1 -1
  23. package/dist/SwipePivotTabBar-DWrCuwEI.js +411 -0
  24. package/dist/SwipePivotTabBar-DWrCuwEI.js.map +1 -0
  25. package/dist/SwipePivotTabBar-fjjXkpj7.cjs +2 -0
  26. package/dist/SwipePivotTabBar-fjjXkpj7.cjs.map +1 -0
  27. package/dist/components/gesture/SwipeSafeZone.d.ts +40 -0
  28. package/dist/components/window/Drawer.d.ts +3 -1
  29. package/dist/components/window/DrawerLayers.d.ts +1 -1
  30. package/dist/components/window/drawerStyles.d.ts +69 -0
  31. package/dist/components/window/drawerSwipeConfig.d.ts +29 -0
  32. package/dist/components/window/useDrawerSwipeTransform.d.ts +23 -0
  33. package/dist/config.cjs +1 -1
  34. package/dist/config.js +3 -3
  35. package/dist/constants/styles.d.ts +17 -0
  36. package/dist/dialog/index.d.ts +69 -0
  37. package/dist/floating.js +1 -1
  38. package/dist/grid.cjs +1 -1
  39. package/dist/grid.js +2 -2
  40. package/dist/hooks/gesture/testing/createGestureSimulator.d.ts +7 -0
  41. package/dist/hooks/gesture/types.d.ts +48 -5
  42. package/dist/hooks/gesture/utils.d.ts +19 -0
  43. package/dist/hooks/useAnimationFrame.d.ts +2 -0
  44. package/dist/hooks/useOperationContinuity.d.ts +64 -0
  45. package/dist/hooks/useResizeObserver.d.ts +33 -1
  46. package/dist/hooks/useSharedElementTransition.d.ts +112 -0
  47. package/dist/hooks/useSwipeContentTransform.d.ts +9 -2
  48. package/dist/index.cjs +1 -1
  49. package/dist/index.js +7 -7
  50. package/dist/modules/dialog/AlertDialog.d.ts +9 -0
  51. package/dist/modules/dialog/DialogContainer.d.ts +37 -0
  52. package/dist/modules/dialog/Modal.d.ts +26 -0
  53. package/dist/modules/dialog/SwipeDialogContainer.d.ts +16 -0
  54. package/dist/modules/dialog/dialogAnimationUtils.d.ts +113 -0
  55. package/dist/modules/dialog/types.d.ts +183 -0
  56. package/dist/modules/dialog/useDialog.d.ts +39 -0
  57. package/dist/modules/dialog/useDialogContainer.d.ts +47 -0
  58. package/dist/modules/dialog/useDialogSwipeInput.d.ts +70 -0
  59. package/dist/modules/dialog/useDialogTransform.d.ts +82 -0
  60. package/dist/modules/drawer/types.d.ts +74 -0
  61. package/dist/modules/drawer/useDrawerSwipeInput.d.ts +24 -0
  62. package/dist/modules/pivot/SwipePivotTabBar.d.ts +3 -0
  63. package/dist/modules/stack/SwipeStackContent.d.ts +6 -3
  64. package/dist/modules/stack/SwipeStackOutlet.d.ts +4 -4
  65. package/dist/modules/stack/computeSwipeStackTransform.d.ts +1 -1
  66. package/dist/panels.cjs +1 -1
  67. package/dist/panels.js +1 -1
  68. package/dist/pivot.cjs +1 -1
  69. package/dist/pivot.js +1 -1
  70. package/dist/resizer.cjs +1 -1
  71. package/dist/resizer.js +2 -2
  72. package/dist/stack.cjs +1 -1
  73. package/dist/stack.cjs.map +1 -1
  74. package/dist/stack.js +503 -762
  75. package/dist/stack.js.map +1 -1
  76. package/dist/sticky-header/calculateStickyMetrics.d.ts +28 -0
  77. package/dist/sticky-header.cjs +1 -1
  78. package/dist/sticky-header.cjs.map +1 -1
  79. package/dist/sticky-header.js +59 -51
  80. package/dist/sticky-header.js.map +1 -1
  81. package/dist/{styles-DPPuJ0sf.js → styles-NkjuMOVS.js} +13 -13
  82. package/dist/{styles-DPPuJ0sf.js.map → styles-NkjuMOVS.js.map} +1 -1
  83. package/dist/styles-qf6ptVLD.cjs.map +1 -1
  84. package/dist/types.d.ts +16 -0
  85. package/dist/useDocumentPointerEvents-DXxw3qWj.js +54 -0
  86. package/dist/useDocumentPointerEvents-DXxw3qWj.js.map +1 -0
  87. package/dist/useDocumentPointerEvents-DxDSOtip.cjs +2 -0
  88. package/dist/useDocumentPointerEvents-DxDSOtip.cjs.map +1 -0
  89. package/dist/useNativeGestureGuard-C7TSqEkr.cjs +2 -0
  90. package/dist/useNativeGestureGuard-C7TSqEkr.cjs.map +1 -0
  91. package/dist/useNativeGestureGuard-CGYo6O0r.js +347 -0
  92. package/dist/useNativeGestureGuard-CGYo6O0r.js.map +1 -0
  93. package/dist/window/index.d.ts +2 -0
  94. package/dist/window.cjs +1 -1
  95. package/dist/window.cjs.map +1 -1
  96. package/dist/window.js +114 -103
  97. package/dist/window.js.map +1 -1
  98. package/package.json +6 -1
  99. package/src/components/gesture/SwipeSafeZone.tsx +69 -0
  100. package/src/components/window/Drawer.tsx +249 -162
  101. package/src/components/window/DrawerLayers.tsx +13 -3
  102. package/src/components/window/drawerStyles.spec.ts +263 -0
  103. package/src/components/window/drawerStyles.ts +228 -0
  104. package/src/components/window/drawerSwipeConfig.spec.ts +131 -0
  105. package/src/components/window/drawerSwipeConfig.ts +112 -0
  106. package/src/components/window/useDrawerSwipeTransform.spec.ts +234 -0
  107. package/src/components/window/useDrawerSwipeTransform.ts +129 -0
  108. package/src/constants/styles.ts +19 -0
  109. package/src/demo/pages/Dialog/alerts/index.tsx +22 -0
  110. package/src/demo/pages/Dialog/card/index.tsx +22 -0
  111. package/src/demo/pages/Dialog/components/AlertDialogDemo.tsx +124 -0
  112. package/src/demo/pages/Dialog/components/CardExpandDemo.module.css +243 -0
  113. package/src/demo/pages/Dialog/components/CardExpandDemo.tsx +204 -0
  114. package/src/demo/pages/Dialog/components/CustomAlertDialogDemo.tsx +219 -0
  115. package/src/demo/pages/Dialog/components/DialogDemos.module.css +77 -0
  116. package/src/demo/pages/Dialog/components/ModalBasics.tsx +45 -0
  117. package/src/demo/pages/Dialog/components/SwipeDialogDemo.module.css +77 -0
  118. package/src/demo/pages/Dialog/components/SwipeDialogDemo.tsx +181 -0
  119. package/src/demo/pages/Dialog/custom-alert/index.tsx +22 -0
  120. package/src/demo/pages/Dialog/modal/index.tsx +17 -0
  121. package/src/demo/pages/Dialog/swipe/index.tsx +22 -0
  122. package/src/demo/pages/Drawer/components/DrawerSwipe.module.css +316 -0
  123. package/src/demo/pages/Drawer/components/DrawerSwipe.tsx +178 -0
  124. package/src/demo/pages/Drawer/swipe/index.tsx +17 -0
  125. package/src/demo/pages/Pivot/components/SwipeTabsPivot.tsx +54 -23
  126. package/src/demo/pages/Pivot/swipe-debug/index.tsx +1 -1
  127. package/src/demo/pages/Stack/components/StackBasics.spec.tsx +152 -0
  128. package/src/demo/pages/Stack/components/StackBasics.tsx +179 -95
  129. package/src/demo/pages/Stack/components/StackTablet.spec.tsx +120 -0
  130. package/src/demo/pages/Stack/components/StackTablet.tsx +42 -21
  131. package/src/demo/routes.tsx +22 -1
  132. package/src/dialog/index.ts +85 -0
  133. package/src/hooks/gesture/testing/createGestureSimulator.spec.ts +68 -64
  134. package/src/hooks/gesture/testing/createGestureSimulator.ts +112 -37
  135. package/src/hooks/gesture/types.ts +83 -6
  136. package/src/hooks/gesture/useEdgeSwipeInput.spec.ts +22 -14
  137. package/src/hooks/gesture/useNativeGestureGuard.spec.ts +91 -31
  138. package/src/hooks/gesture/useNativeGestureGuard.ts +3 -1
  139. package/src/hooks/gesture/utils.ts +91 -0
  140. package/src/hooks/useAnimatedVisibility.spec.ts +44 -24
  141. package/src/hooks/useAnimatedVisibility.ts +28 -2
  142. package/src/hooks/useAnimationFrame.ts +8 -0
  143. package/src/hooks/useOperationContinuity.spec.ts +387 -0
  144. package/src/hooks/useOperationContinuity.ts +135 -0
  145. package/src/hooks/useResizeObserver.spec.tsx +277 -0
  146. package/src/hooks/useResizeObserver.tsx +108 -39
  147. package/src/hooks/useScrollContainer.ts +4 -10
  148. package/src/hooks/useSharedElementTransition.ts +333 -0
  149. package/src/hooks/useSwipeContentTransform.spec.ts +18 -18
  150. package/src/hooks/useSwipeContentTransform.ts +166 -28
  151. package/src/modules/dialog/AlertDialog.spec.tsx +387 -0
  152. package/src/modules/dialog/AlertDialog.tsx +221 -0
  153. package/src/modules/dialog/DialogContainer.spec.tsx +228 -0
  154. package/src/modules/dialog/DialogContainer.tsx +188 -0
  155. package/src/modules/dialog/Modal.spec.tsx +220 -0
  156. package/src/modules/dialog/Modal.tsx +182 -0
  157. package/src/modules/dialog/SwipeDialogContainer.tsx +208 -0
  158. package/src/modules/dialog/dialogAnimationUtils.spec.ts +253 -0
  159. package/src/modules/dialog/dialogAnimationUtils.ts +297 -0
  160. package/src/modules/dialog/types.ts +186 -0
  161. package/src/modules/dialog/useDialog.spec.tsx +447 -0
  162. package/src/modules/dialog/useDialog.ts +214 -0
  163. package/src/modules/dialog/useDialogContainer.spec.ts +331 -0
  164. package/src/modules/dialog/useDialogContainer.ts +150 -0
  165. package/src/modules/dialog/useDialogSwipeInput.spec.ts +157 -0
  166. package/src/modules/dialog/useDialogSwipeInput.ts +319 -0
  167. package/src/modules/dialog/useDialogTransform.spec.ts +370 -0
  168. package/src/modules/dialog/useDialogTransform.ts +407 -0
  169. package/src/modules/drawer/types.ts +102 -0
  170. package/src/modules/drawer/useDrawerSwipeInput.spec.ts +566 -0
  171. package/src/modules/drawer/useDrawerSwipeInput.ts +399 -0
  172. package/src/modules/panels/rendering/ContentRegistry.spec.tsx +21 -14
  173. package/src/modules/pivot/SwipePivotContent.position.spec.tsx +12 -8
  174. package/src/modules/pivot/SwipePivotContent.spec.tsx +55 -25
  175. package/src/modules/pivot/SwipePivotContent.tsx +2 -2
  176. package/src/modules/pivot/SwipePivotTabBar.spec.tsx +85 -68
  177. package/src/modules/pivot/SwipePivotTabBar.tsx +75 -15
  178. package/src/modules/pivot/scaleInputState.spec.ts +11 -2
  179. package/src/modules/pivot/usePivot.spec.ts +17 -3
  180. package/src/modules/pivot/usePivotSwipeInput.spec.ts +182 -123
  181. package/src/modules/stack/SwipeStackContent.spec.tsx +387 -100
  182. package/src/modules/stack/SwipeStackContent.tsx +43 -33
  183. package/src/modules/stack/SwipeStackOutlet.spec.tsx +14 -16
  184. package/src/modules/stack/SwipeStackOutlet.tsx +6 -6
  185. package/src/modules/stack/computeSwipeStackTransform.spec.ts +5 -5
  186. package/src/modules/stack/computeSwipeStackTransform.ts +3 -3
  187. package/src/modules/stack/swipeTransitionContinuity.spec.tsx +1133 -0
  188. package/src/modules/stack/useStackAnimationState.spec.ts +3 -1
  189. package/src/modules/stack/useStackAnimationState.ts +18 -13
  190. package/src/modules/stack/useStackNavigation.spec.ts +198 -3
  191. package/src/modules/stack/useStackNavigation.tsx +113 -56
  192. package/src/modules/stack/useStackSwipeInput.spec.ts +65 -32
  193. package/src/modules/stack/useStackSwipeInput.ts +1 -1
  194. package/src/sticky-header/StickyArea.tsx +29 -57
  195. package/src/sticky-header/calculateStickyMetrics.spec.ts +105 -0
  196. package/src/sticky-header/calculateStickyMetrics.ts +50 -0
  197. package/src/types.ts +18 -0
  198. package/src/window/index.ts +2 -0
  199. package/dist/FloatingWindow-BpdOpg_L.js +0 -400
  200. package/dist/FloatingWindow-BpdOpg_L.js.map +0 -1
  201. package/dist/FloatingWindow-TCDNY5gE.cjs +0 -2
  202. package/dist/FloatingWindow-TCDNY5gE.cjs.map +0 -1
  203. package/dist/GridLayout-B4VRsC0r.cjs +0 -2
  204. package/dist/ResizeHandle-CScipO5l.cjs +0 -2
  205. package/dist/SwipePivotTabBar-BGO9X94m.js +0 -407
  206. package/dist/SwipePivotTabBar-BGO9X94m.js.map +0 -1
  207. package/dist/SwipePivotTabBar-BrQismcZ.cjs +0 -2
  208. package/dist/SwipePivotTabBar-BrQismcZ.cjs.map +0 -1
  209. package/dist/useDocumentPointerEvents-CKdhGXd0.js +0 -46
  210. package/dist/useDocumentPointerEvents-CKdhGXd0.js.map +0 -1
  211. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs +0 -2
  212. package/dist/useDocumentPointerEvents-ChqrKXDk.cjs.map +0 -1
  213. package/dist/useEffectEvent-Dp7HLCf0.js +0 -13
  214. package/dist/useEffectEvent-Dp7HLCf0.js.map +0 -1
  215. package/dist/useEffectEvent-huSsGUnl.cjs +0 -2
  216. package/dist/useEffectEvent-huSsGUnl.cjs.map +0 -1
@@ -1,400 +0,0 @@
1
- import { jsxs as S, Fragment as R, jsx as l } from "react/jsx-runtime";
2
- import * as u from "react";
3
- import { F as A, e as F, a as T, b as W, f as $, d as Y } from "./FloatingPanelFrame-SgYLc6Ud.js";
4
- import { s as j, t as q, u as O, v as U, w as K, x as J, y as Q } from "./styles-DPPuJ0sf.js";
5
- import { createPortal as Z } from "react-dom";
6
- import { u as tt } from "./useContentCache-CO3LYNmz.js";
7
- const L = {
8
- position: "fixed",
9
- inset: 0,
10
- background: j
11
- }, et = {
12
- willChange: "transform"
13
- }, x = {
14
- left: {
15
- top: 0,
16
- bottom: 0,
17
- left: 0,
18
- transform: "translateX(-100%)"
19
- },
20
- right: {
21
- top: 0,
22
- bottom: 0,
23
- right: 0,
24
- transform: "translateX(100%)"
25
- },
26
- top: {
27
- top: 0,
28
- left: 0,
29
- right: 0,
30
- transform: "translateY(-100%)"
31
- },
32
- bottom: {
33
- bottom: 0,
34
- left: 0,
35
- right: 0,
36
- transform: "translateY(100%)"
37
- }
38
- }, ot = (t, e, n) => t === "none" ? void 0 : `transform ${e ?? q} ${n ?? O}`, nt = (t, e) => t ? e : !1, rt = ({ chrome: t, frameStyle: e, header: n, dismissible: s, onClose: o, children: i }) => t ? /* @__PURE__ */ S(A, { style: e, children: [
39
- /* @__PURE__ */ l(st, { header: n, dismissible: s, onClose: o }),
40
- /* @__PURE__ */ l(
41
- F,
42
- {
43
- style: { padding: U, flex: 1, display: "flex", flexDirection: "column" },
44
- children: i
45
- }
46
- )
47
- ] }) : /* @__PURE__ */ l(R, { children: i }), st = ({ header: t, dismissible: e, onClose: n }) => {
48
- if (!t)
49
- return null;
50
- const s = t.showCloseButton ?? !0, o = nt(e, s);
51
- return /* @__PURE__ */ l(u.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ S(
52
- T,
53
- {
54
- style: { padding: `${J} ${Q}`, gap: K },
55
- children: [
56
- /* @__PURE__ */ l(u.Activity, { mode: t ? "visible" : "hidden", children: /* @__PURE__ */ l(W, { children: t.title }) }),
57
- /* @__PURE__ */ l(u.Activity, { mode: o ? "visible" : "hidden", children: /* @__PURE__ */ l(
58
- $,
59
- {
60
- onClick: n,
61
- "aria-label": "Close drawer",
62
- style: { marginLeft: "auto" }
63
- }
64
- ) })
65
- ]
66
- }
67
- ) });
68
- }, it = ({
69
- id: t,
70
- config: e,
71
- isOpen: n,
72
- onClose: s,
73
- children: o,
74
- zIndex: i,
75
- width: d,
76
- height: f,
77
- position: a
78
- }) => {
79
- const {
80
- dismissible: r = !0,
81
- header: c,
82
- chrome: p = !0,
83
- inline: h = !1,
84
- transitionMode: w = "css",
85
- transitionDuration: C,
86
- transitionEasing: P
87
- } = e, g = u.useCallback(
88
- (v, m) => v || (m ? m.left !== void 0 ? "left" : m.right !== void 0 ? "right" : m.top !== void 0 ? "top" : m.bottom !== void 0 ? "bottom" : "right" : "right"),
89
- []
90
- )(e.anchor, a), I = {
91
- left: "translateX(0)",
92
- right: "translateX(0)",
93
- top: "translateY(0)",
94
- bottom: "translateY(0)"
95
- }, H = u.useMemo(() => {
96
- const v = ot(w, C, P), m = {
97
- ...et,
98
- ...h ? { position: "absolute" } : { position: "fixed" },
99
- ...x[g],
100
- transform: n ? I[g] : x[g].transform,
101
- transition: v
102
- };
103
- return i !== void 0 && (m.zIndex = i), d !== void 0 && (m.width = typeof d == "number" ? `${d}px` : d), f !== void 0 && (m.height = typeof f == "number" ? `${f}px` : f), m;
104
- }, [f, h, n, g, C, P, w, d, i]), V = c?.title ?? e.ariaLabel ?? "Drawer", z = u.useMemo(() => {
105
- const v = h ? { ...L, position: "absolute" } : L, m = w === "none" ? void 0 : `opacity ${C ?? "220ms"} ease`;
106
- return {
107
- ...v,
108
- opacity: n ? 1 : 0,
109
- pointerEvents: n ? "auto" : "none",
110
- transition: m,
111
- zIndex: i !== void 0 ? i - 1 : void 0
112
- };
113
- }, [h, n, C, w, i]), X = u.useMemo(() => {
114
- const v = g === "left" || g === "right", m = { borderRadius: 0 };
115
- return v && (m.height = "100%"), m;
116
- }, [g]);
117
- return /* @__PURE__ */ S(R, { children: [
118
- /* @__PURE__ */ l("div", { style: z, onClick: r ? s : void 0 }),
119
- /* @__PURE__ */ l(
120
- "div",
121
- {
122
- "data-layer-id": t,
123
- "data-placement": g,
124
- style: H,
125
- role: "dialog",
126
- "aria-modal": r ? !0 : void 0,
127
- "aria-hidden": n ? void 0 : !0,
128
- "aria-label": V,
129
- children: /* @__PURE__ */ l(
130
- rt,
131
- {
132
- chrome: p,
133
- frameStyle: X,
134
- header: c,
135
- dismissible: r,
136
- onClose: s,
137
- children: o
138
- }
139
- )
140
- }
141
- )
142
- ] });
143
- }, at = (t, e) => new Promise((n) => {
144
- let s = !1;
145
- const o = () => {
146
- s || (s = !0, t.removeEventListener("transitionend", i), n());
147
- }, i = (d) => {
148
- d.target === t && o();
149
- };
150
- t.addEventListener("transitionend", i), setTimeout(o, e + 50);
151
- }), k = async (t, e, n, s) => {
152
- switch (e) {
153
- case "none":
154
- t();
155
- return;
156
- case "css":
157
- t(), n && await at(n, s);
158
- return;
159
- }
160
- }, Et = (t) => {
161
- const [e, n] = u.useState({}), s = u.useRef(t);
162
- s.current = t;
163
- const o = u.useCallback(
164
- async (a, r, c) => {
165
- const { mode: p = "none", element: h, duration: w = 300 } = c ?? {};
166
- await k(() => {
167
- n((b) => b[a] === r ? b : { ...b, [a]: r });
168
- }, p, h?.current, w);
169
- const P = s.current;
170
- r ? P?.onOpen?.(a) : P?.onClose?.(a), P?.onTransitionEnd?.(a, r);
171
- },
172
- []
173
- ), i = u.useCallback((a) => e[a] ?? !1, [e]), d = u.useCallback(
174
- (a, r) => o(a, !0, r),
175
- [o]
176
- ), f = u.useCallback(
177
- (a, r) => o(a, !1, r),
178
- [o]
179
- );
180
- return { state: i, open: d, close: f };
181
- }, ut = (t) => {
182
- if (!t)
183
- return 300;
184
- const e = t.match(/(\d+)/);
185
- return e ? parseInt(e[1], 10) : 300;
186
- }, ct = (t) => {
187
- const [e, n] = u.useState(() => {
188
- const a = {};
189
- return t.forEach((r) => {
190
- r.drawer && (a[r.id] = r.drawer.defaultOpen ?? !1);
191
- }), a;
192
- }), s = u.useMemo(() => {
193
- const a = /* @__PURE__ */ new Map();
194
- return t.forEach((r) => a.set(r.id, r)), a;
195
- }, [t]), o = u.useCallback(
196
- async (a, r, c) => {
197
- const p = s.get(a);
198
- if (!p?.drawer)
199
- return;
200
- const h = c?.mode ?? p.drawer.transitionMode ?? "css", w = c?.duration ?? ut(p.drawer.transitionDuration), C = c?.element?.current;
201
- await k(() => {
202
- p.drawer?.open === void 0 && n((b) => b[a] === r ? b : { ...b, [a]: r }), p.drawer?.onStateChange?.(r);
203
- }, h, C, w);
204
- },
205
- [s]
206
- ), i = u.useCallback(
207
- (a) => {
208
- const r = s.get(a);
209
- return r?.drawer?.open !== void 0 ? r.drawer.open : e[a] ?? !1;
210
- },
211
- [s, e]
212
- ), d = u.useCallback(
213
- (a, r) => o(a, !0, r),
214
- [o]
215
- ), f = u.useCallback(
216
- (a, r) => o(a, !1, r),
217
- [o]
218
- );
219
- return { state: i, open: d, close: f };
220
- }, St = ({ layers: t }) => {
221
- const e = ct(t), n = u.useMemo(() => t.filter((o) => o.drawer), [t]), s = u.useMemo(() => {
222
- const o = /* @__PURE__ */ new Map();
223
- return n.forEach((i) => {
224
- o.set(i.id, () => e.close(i.id));
225
- }), o;
226
- }, [n, e.close]);
227
- return /* @__PURE__ */ l(R, { children: n.map((o) => {
228
- if (!o.drawer)
229
- return null;
230
- const i = e.state(o.id), d = s.get(o.id);
231
- return d ? /* @__PURE__ */ l(
232
- it,
233
- {
234
- id: o.id,
235
- config: o.drawer,
236
- isOpen: i,
237
- onClose: d,
238
- zIndex: o.zIndex,
239
- width: o.width,
240
- height: o.height,
241
- position: o.position,
242
- children: o.component
243
- },
244
- o.id
245
- ) : null;
246
- }) });
247
- }, _ = u.createContext(null), Dt = ({ value: t, children: e }) => /* @__PURE__ */ l(_.Provider, { value: t, children: e }), Rt = () => {
248
- const t = u.useContext(_);
249
- if (!t)
250
- throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");
251
- return t;
252
- }, N = u.createContext(null), Lt = () => {
253
- const t = u.useContext(N);
254
- if (!t)
255
- throw new Error("usePanelSystem must be used within a PanelSystemProvider.");
256
- return t;
257
- }, xt = ({ config: t, layers: e, style: n, children: s }) => {
258
- const o = u.useMemo(() => {
259
- const r = /* @__PURE__ */ new Map();
260
- return e.forEach((c) => {
261
- r.set(c.id, c);
262
- }), r;
263
- }, [e]), i = u.useCallback(
264
- (r) => o.get(r)?.component ?? null,
265
- [o]
266
- ), d = u.useMemo(() => e.map((r) => r.id), [e]), { getCachedContent: f } = tt({
267
- resolveContent: i,
268
- validIds: d
269
- }), a = u.useMemo(
270
- () => ({
271
- config: t,
272
- style: n,
273
- layers: {
274
- defs: e,
275
- layerById: o
276
- },
277
- getCachedContent: f
278
- }),
279
- [t, n, e, o, f]
280
- );
281
- return /* @__PURE__ */ l(N.Provider, { value: a, children: s });
282
- }, B = u.createContext(null), lt = ({ layerId: t, children: e }) => {
283
- const n = u.useMemo(() => ({ layerId: t }), [t]);
284
- return /* @__PURE__ */ l(B.Provider, { value: n, children: e });
285
- }, yt = () => {
286
- const t = u.useContext(B);
287
- if (!t)
288
- throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");
289
- return t;
290
- }, y = (t, e, n) => {
291
- if (typeof t == "number" && Number.isFinite(t))
292
- return t;
293
- throw new Error(`Popup layer "${n}" requires a numeric "${e}" value.`);
294
- }, G = (t, e) => {
295
- if (!t)
296
- throw new Error(`Popup layer "${e}" must define position (left/top).`);
297
- return {
298
- left: y(t.left, "left", e),
299
- top: y(t.top, "top", e)
300
- };
301
- }, D = (t) => `${Math.round(t)}`, E = (t) => {
302
- if (t !== void 0)
303
- return t ? "yes" : "no";
304
- }, dt = (t, e, n, s, o) => {
305
- const i = {}, d = G(e, t);
306
- if (typeof n != "number" || typeof s != "number")
307
- throw new Error(`Popup layer "${t}" requires numeric width/height.`);
308
- i.width = D(n), i.height = D(s), i.left = D(d.left), i.top = D(d.top);
309
- const f = o?.features;
310
- if (f) {
311
- const a = E(f.toolbar), r = E(f.menubar), c = E(f.location), p = E(f.status), h = E(f.resizable), w = E(f.scrollbars);
312
- a !== void 0 && (i.toolbar = a), r !== void 0 && (i.menubar = r), c !== void 0 && (i.location = c), p !== void 0 && (i.status = p), h !== void 0 && (i.resizable = h), w !== void 0 && (i.scrollbars = w);
313
- }
314
- return Object.entries(i).map(([a, r]) => `${a}=${r}`).join(",");
315
- }, M = (t, e, n, s, o) => {
316
- const i = G(n, e);
317
- if (typeof s != "number" || typeof o != "number")
318
- throw new Error(`Popup layer "${e}" requires numeric width/height.`);
319
- t.moveTo(Math.round(i.left), Math.round(i.top)), t.resizeTo(Math.round(s), Math.round(o));
320
- }, Mt = ({ layer: t }) => {
321
- const e = t.floating;
322
- if (!e)
323
- throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);
324
- if ((e.mode ?? "embedded") !== "popup")
325
- throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);
326
- const s = u.useRef(null), o = u.useRef(null), [i, d] = u.useState(!1);
327
- return u.useEffect(() => {
328
- if (typeof window > "u")
329
- return;
330
- const f = dt(t.id, t.position, t.width, t.height, e.popup), a = e.popup?.name ?? t.id, r = ft(
331
- a,
332
- f,
333
- {
334
- position: t.position,
335
- size: { width: t.width, height: t.height }
336
- },
337
- e.popup
338
- );
339
- if (!r)
340
- throw new Error(`Failed to open popup window for layer "${t.id}".`);
341
- const c = r;
342
- o.current = c, e.popup?.focus !== !1 && c.focus(), c.document.title || (c.document.title = t.id), c.document.body.innerHTML = "";
343
- const p = c.document.createElement("div");
344
- p.dataset.layerId = t.id, c.document.body.appendChild(p), s.current = p, d(!0), M(c, t.id, t.position, t.width, t.height);
345
- const h = () => {
346
- o.current = null, s.current = null, d(!1);
347
- };
348
- return c.addEventListener("beforeunload", h), () => {
349
- c.removeEventListener("beforeunload", h), e.popup?.closeOnUnmount !== !1 && c.close(), o.current = null, s.current = null, d(!1);
350
- };
351
- }, [
352
- e.popup?.closeOnUnmount,
353
- e.popup?.features?.location,
354
- e.popup?.features?.menubar,
355
- e.popup?.features?.resizable,
356
- e.popup?.features?.scrollbars,
357
- e.popup?.features?.status,
358
- e.popup?.features?.toolbar,
359
- e.popup?.focus,
360
- e.popup?.name,
361
- t.id
362
- ]), u.useEffect(() => {
363
- const f = o.current;
364
- f && M(f, t.id, t.position, t.width, t.height);
365
- }, [t.position?.left, t.position?.top, t.height, t.width, t.id]), !i || !s.current ? null : Z(/* @__PURE__ */ l(lt, { layerId: t.id, children: t.component }), s.current);
366
- }, ft = (t, e, n, s) => {
367
- const o = s?.createWindow;
368
- return o ? o({ name: t, features: e, bounds: n }) : window.open("", t, e);
369
- }, pt = ({ onClick: t }) => /* @__PURE__ */ l(Y, { children: /* @__PURE__ */ l($, { onClick: t, "aria-label": "Close window", "data-drag-ignore": "true" }) }), mt = ({ header: t, draggable: e, onClose: n }) => {
370
- if (!t)
371
- return null;
372
- const s = t.showCloseButton ?? !1;
373
- return /* @__PURE__ */ S(T, { ...e ? { "data-drag-handle": "true" } : {}, style: { cursor: e ? "grab" : void 0 }, children: [
374
- t.title ? /* @__PURE__ */ l(W, { children: t.title }) : null,
375
- s ? /* @__PURE__ */ l(pt, { onClick: n }) : null
376
- ] });
377
- }, ht = ({ header: t, draggable: e, chrome: n, onClose: s, children: o }) => n ? /* @__PURE__ */ S(A, { style: { height: "100%", width: "100%" }, children: [
378
- /* @__PURE__ */ l(mt, { header: t, draggable: e, onClose: s }),
379
- /* @__PURE__ */ l(F, { style: { flex: 1, display: "flex", flexDirection: "column" }, children: o })
380
- ] }) : /* @__PURE__ */ l(R, { children: o }), wt = ({ id: t, config: e, onClose: n, children: s }) => {
381
- const o = e.chrome ?? !1, i = e.draggable ?? !1, d = e.header?.title ?? e.ariaLabel ?? "Floating window";
382
- return /* @__PURE__ */ l("div", { "data-floating-window": t, role: "dialog", "aria-label": d, style: { height: "100%", width: "100%" }, children: /* @__PURE__ */ l(ht, { header: e.header, draggable: i, chrome: o, onClose: n, children: s }) });
383
- };
384
- wt.displayName = "FloatingWindow";
385
- export {
386
- it as D,
387
- wt as F,
388
- Dt as G,
389
- lt as L,
390
- Mt as P,
391
- yt as a,
392
- St as b,
393
- Et as c,
394
- ct as d,
395
- Lt as e,
396
- xt as f,
397
- k as r,
398
- Rt as u
399
- };
400
- //# sourceMappingURL=FloatingWindow-BpdOpg_L.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FloatingWindow-BpdOpg_L.js","sources":["../src/components/window/Drawer.tsx","../src/hooks/useTransitionState.ts","../src/modules/window/useDrawerState.ts","../src/components/window/DrawerLayers.tsx","../src/modules/grid/GridLayoutContext.tsx","../src/PanelSystemContext.tsx","../src/modules/grid/LayerInstanceContext.tsx","../src/components/window/PopupLayerPortal.tsx","../src/components/window/FloatingWindow.tsx"],"sourcesContent":["/**\n * @file Drawer component\n *\n * Mobile-friendly slide-in panel with backdrop support.\n */\nimport * as React from \"react\";\nimport type { DrawerBehavior, WindowPosition } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelContent,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n} from \"../paneling/FloatingPanelFrame\";\nimport {\n DRAWER_HEADER_PADDING_Y,\n DRAWER_HEADER_PADDING_X,\n DRAWER_HEADER_GAP,\n DRAWER_CONTENT_PADDING,\n COLOR_DRAWER_BACKDROP,\n DRAWER_TRANSITION_DURATION,\n DRAWER_TRANSITION_EASING,\n} from \"../../constants/styles\";\n\nconst drawerBackdropStyle: React.CSSProperties = {\n position: \"fixed\",\n inset: 0,\n background: COLOR_DRAWER_BACKDROP,\n};\n\nconst drawerBaseStyle: React.CSSProperties = {\n willChange: \"transform\",\n};\n\nconst drawerPlacementStyles: Record<string, React.CSSProperties> = {\n left: {\n top: 0,\n bottom: 0,\n left: 0,\n transform: \"translateX(-100%)\",\n },\n right: {\n top: 0,\n bottom: 0,\n right: 0,\n transform: \"translateX(100%)\",\n },\n top: {\n top: 0,\n left: 0,\n right: 0,\n transform: \"translateY(-100%)\",\n },\n bottom: {\n bottom: 0,\n left: 0,\n right: 0,\n transform: \"translateY(100%)\",\n },\n};\n\nconst computeTransitionValue = (\n mode: DrawerBehavior[\"transitionMode\"] | undefined,\n duration: DrawerBehavior[\"transitionDuration\"],\n easing: DrawerBehavior[\"transitionEasing\"],\n): string | undefined => {\n if (mode === \"none\") {\n return undefined;\n }\n\n const durationValue = duration ?? DRAWER_TRANSITION_DURATION;\n const easingValue = easing ?? DRAWER_TRANSITION_EASING;\n\n return `transform ${durationValue} ${easingValue}`;\n};\n\nexport type DrawerProps = {\n id: string;\n config: DrawerBehavior;\n isOpen: boolean;\n onClose: () => void;\n children: React.ReactNode;\n zIndex?: number;\n width?: string | number;\n height?: string | number;\n position?: WindowPosition;\n};\n\nconst shouldShowCloseButton = (dismissible: boolean, showClose: boolean): boolean => {\n if (!dismissible) {\n return false;\n }\n return showClose;\n};\n\ntype DrawerContentProps = {\n chrome: boolean;\n frameStyle: React.CSSProperties;\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst DrawerContent: React.FC<DrawerContentProps> = ({ chrome, frameStyle, header, dismissible, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n return (\n <FloatingPanelFrame style={frameStyle}>\n <DrawerHeaderView header={header} dismissible={dismissible} onClose={onClose} />\n <FloatingPanelContent\n style={{ padding: DRAWER_CONTENT_PADDING, flex: 1, display: \"flex\", flexDirection: \"column\" }}\n >\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nconst DrawerHeaderView: React.FC<{\n header?: DrawerBehavior[\"header\"];\n dismissible: boolean;\n onClose: () => void;\n}> = ({ header, dismissible, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? true;\n const shouldShowClose = shouldShowCloseButton(dismissible, showCloseButton);\n\n return (\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelHeader\n style={{ padding: `${DRAWER_HEADER_PADDING_Y} ${DRAWER_HEADER_PADDING_X}`, gap: DRAWER_HEADER_GAP }}\n >\n <React.Activity mode={header ? \"visible\" : \"hidden\"}>\n <FloatingPanelTitle>{header.title}</FloatingPanelTitle>\n </React.Activity>\n <React.Activity mode={shouldShowClose ? \"visible\" : \"hidden\"}>\n <FloatingPanelCloseButton\n onClick={onClose}\n aria-label=\"Close drawer\"\n style={{ marginLeft: \"auto\" }}\n />\n </React.Activity>\n </FloatingPanelHeader>\n </React.Activity>\n );\n};\n\nexport const Drawer: React.FC<DrawerProps> = ({\n id,\n config,\n isOpen,\n onClose,\n children,\n zIndex,\n width,\n height,\n position,\n}) => {\n const {\n dismissible = true,\n header,\n chrome = true,\n inline = false,\n transitionMode = \"css\",\n transitionDuration,\n transitionEasing,\n } = config;\n\n const resolvePlacement = React.useCallback(\n (anchor?: DrawerBehavior[\"anchor\"], pos?: WindowPosition): \"left\" | \"right\" | \"top\" | \"bottom\" => {\n // Prefer explicit anchor from config\n if (anchor) {\n return anchor;\n }\n // Fall back to inferring from position\n if (!pos) {\n return \"right\";\n }\n if (pos.left !== undefined) {\n return \"left\";\n }\n if (pos.right !== undefined) {\n return \"right\";\n }\n if (pos.top !== undefined) {\n return \"top\";\n }\n if (pos.bottom !== undefined) {\n return \"bottom\";\n }\n return \"right\";\n },\n [],\n );\n\n const placement = resolvePlacement(config.anchor, position);\n\n const openTransforms: Record<string, string> = {\n left: \"translateX(0)\",\n right: \"translateX(0)\",\n top: \"translateY(0)\",\n bottom: \"translateY(0)\",\n };\n\n const drawerStyle = React.useMemo((): React.CSSProperties => {\n const transitionValue = computeTransitionValue(transitionMode, transitionDuration, transitionEasing);\n\n const style: React.CSSProperties = {\n ...drawerBaseStyle,\n ...(inline ? { position: \"absolute\" } : { position: \"fixed\" }),\n ...drawerPlacementStyles[placement],\n transform: isOpen ? openTransforms[placement] : drawerPlacementStyles[placement].transform,\n transition: transitionValue,\n };\n\n if (zIndex !== undefined) {\n style.zIndex = zIndex;\n }\n\n if (width !== undefined) {\n style.width = typeof width === \"number\" ? `${width}px` : width;\n }\n if (height !== undefined) {\n style.height = typeof height === \"number\" ? `${height}px` : height;\n }\n\n return style;\n }, [height, inline, isOpen, placement, transitionDuration, transitionEasing, transitionMode, width, zIndex]);\n\n const ariaLabel = header?.title ?? config.ariaLabel ?? \"Drawer\";\n\n const backdropStyle = React.useMemo((): React.CSSProperties => {\n const base = inline ? { ...drawerBackdropStyle, position: \"absolute\" as const } : drawerBackdropStyle;\n const transitionValue = transitionMode === \"none\" ? undefined : `opacity ${transitionDuration ?? \"220ms\"} ease`;\n return {\n ...base,\n opacity: isOpen ? 1 : 0,\n pointerEvents: isOpen ? \"auto\" : \"none\",\n transition: transitionValue,\n zIndex: zIndex !== undefined ? zIndex - 1 : undefined,\n };\n }, [inline, isOpen, transitionDuration, transitionMode, zIndex]);\n\n const frameStyle = React.useMemo((): React.CSSProperties => {\n const isVertical = placement === \"left\" || placement === \"right\";\n const style: React.CSSProperties = { borderRadius: 0 };\n if (isVertical) {\n style.height = \"100%\";\n }\n return style;\n }, [placement]);\n\n return (\n <>\n <div style={backdropStyle} onClick={dismissible ? onClose : undefined} />\n <div\n data-layer-id={id}\n data-placement={placement}\n style={drawerStyle}\n role=\"dialog\"\n aria-modal={dismissible ? true : undefined}\n aria-hidden={isOpen ? undefined : true}\n aria-label={ariaLabel}\n >\n <DrawerContent\n chrome={chrome}\n frameStyle={frameStyle}\n header={header}\n dismissible={dismissible}\n onClose={onClose}\n >\n {children}\n </DrawerContent>\n </div>\n </>\n );\n};\n","/**\n * @file Generic transition state management with animation support.\n */\nimport * as React from \"react\";\n\nexport type TransitionMode = \"none\" | \"css\";\n\nexport type TransitionOptions = {\n mode?: TransitionMode;\n element?: React.RefObject<HTMLElement>;\n duration?: number;\n};\n\nexport type UseTransitionStateOptions = {\n onOpen?: (id: string) => void;\n onClose?: (id: string) => void;\n onTransitionEnd?: (id: string, isOpen: boolean) => void;\n};\n\nconst waitForTransitionEnd = (el: HTMLElement, timeout: number): Promise<void> =>\n new Promise((resolve) => {\n // eslint-disable-next-line no-restricted-syntax -- mutable flag needed for deduplication\n let resolved = false;\n const done = () => {\n if (resolved) {return;}\n resolved = true;\n el.removeEventListener(\"transitionend\", handler);\n resolve();\n };\n const handler = (e: TransitionEvent) => {\n if (e.target === el) {done();}\n };\n el.addEventListener(\"transitionend\", handler);\n setTimeout(done, timeout + 50);\n });\n\nexport const runTransition = async (\n update: () => void,\n mode: TransitionMode,\n el: HTMLElement | null | undefined,\n duration: number,\n): Promise<void> => {\n switch (mode) {\n case \"none\":\n update();\n return;\n\n case \"css\":\n update();\n if (el) {await waitForTransitionEnd(el, duration);}\n return;\n }\n};\n\nexport const useTransitionState = (options?: UseTransitionStateOptions) => {\n const [states, setStates] = React.useState<Record<string, boolean>>({});\n const optionsRef = React.useRef(options);\n optionsRef.current = options;\n\n const update = React.useCallback(\n async (id: string, isOpen: boolean, transitionOptions?: TransitionOptions) => {\n const { mode = \"none\", element, duration = 300 } = transitionOptions ?? {};\n\n const applyState = () => {\n setStates((prev) => {\n if (prev[id] === isOpen) {return prev;}\n return { ...prev, [id]: isOpen };\n });\n };\n\n await runTransition(applyState, mode, element?.current, duration);\n\n const opts = optionsRef.current;\n if (isOpen) {\n opts?.onOpen?.(id);\n } else {\n opts?.onClose?.(id);\n }\n opts?.onTransitionEnd?.(id, isOpen);\n },\n [],\n );\n\n const state = React.useCallback((id: string): boolean => states[id] ?? false, [states]);\n const open = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, true, opts),\n [update],\n );\n const close = React.useCallback(\n (id: string, opts?: TransitionOptions) => update(id, false, opts),\n [update],\n );\n\n return { state, open, close };\n};\n","/**\n * @file Hook for managing drawer state (controlled/uncontrolled)\n */\nimport * as React from \"react\";\nimport {\n type TransitionMode,\n type TransitionOptions,\n runTransition,\n} from \"../../hooks/useTransitionState\";\nimport type { LayerDefinition } from \"../../types\";\n\nconst parseDuration = (value: string | undefined): number => {\n if (!value) {return 300;}\n const match = value.match(/(\\d+)/);\n return match ? parseInt(match[1], 10) : 300;\n};\n\nexport const useDrawerState = (layers: LayerDefinition[]) => {\n const [drawerStates, setDrawerStates] = React.useState<Record<string, boolean>>(() => {\n const initial: Record<string, boolean> = {};\n layers.forEach((layer) => {\n if (layer.drawer) {\n initial[layer.id] = layer.drawer.defaultOpen ?? false;\n }\n });\n return initial;\n });\n\n const layerMap = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => map.set(layer.id, layer));\n return map;\n }, [layers]);\n\n const updateState = React.useCallback(\n async (layerId: string, isOpen: boolean, options?: TransitionOptions) => {\n const layer = layerMap.get(layerId);\n if (!layer?.drawer) {return;}\n\n const mode: TransitionMode = options?.mode ?? layer.drawer.transitionMode ?? \"css\";\n const duration = options?.duration ?? parseDuration(layer.drawer.transitionDuration);\n const element = options?.element?.current;\n\n const applyState = () => {\n if (layer.drawer?.open === undefined) {\n setDrawerStates((prev) => {\n if (prev[layerId] === isOpen) {return prev;}\n return { ...prev, [layerId]: isOpen };\n });\n }\n layer.drawer?.onStateChange?.(isOpen);\n };\n\n await runTransition(applyState, mode, element, duration);\n },\n [layerMap],\n );\n\n const state = React.useCallback(\n (layerId: string): boolean => {\n const layer = layerMap.get(layerId);\n if (layer?.drawer?.open !== undefined) {\n return layer.drawer.open;\n }\n return drawerStates[layerId] ?? false;\n },\n [layerMap, drawerStates],\n );\n\n const open = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, true, options),\n [updateState],\n );\n\n const close = React.useCallback(\n (id: string, options?: TransitionOptions) => updateState(id, false, options),\n [updateState],\n );\n\n return { state, open, close };\n};\n","/**\n * @file DrawerLayers component\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { Drawer } from \"./Drawer\";\nimport { useDrawerState } from \"../../modules/window/useDrawerState\";\n\nexport type DrawerLayersProps = {\n layers: LayerDefinition[];\n};\n\nexport const DrawerLayers: React.FC<DrawerLayersProps> = ({ layers }) => {\n const drawer = useDrawerState(layers);\n\n const drawerLayers = React.useMemo(() => layers.filter((layer) => layer.drawer), [layers]);\n\n const closeHandlers = React.useMemo(() => {\n const handlers = new Map<string, () => void>();\n drawerLayers.forEach((layer) => {\n handlers.set(layer.id, () => drawer.close(layer.id));\n });\n return handlers;\n }, [drawerLayers, drawer.close]);\n\n return (\n <>\n {drawerLayers.map((layer) => {\n if (!layer.drawer) {\n return null;\n }\n\n const isOpen = drawer.state(layer.id);\n const onClose = closeHandlers.get(layer.id);\n\n if (!onClose) {\n return null;\n }\n\n return (\n <Drawer\n key={layer.id}\n id={layer.id}\n config={layer.drawer}\n isOpen={isOpen}\n onClose={onClose}\n zIndex={layer.zIndex}\n width={layer.width}\n height={layer.height}\n position={layer.position}\n >\n {layer.component}\n </Drawer>\n );\n })}\n </>\n );\n};\n","/**\n * @file Context provider for grid layer rendering helpers.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\n\nexport type GridLayerHandleProps = React.HTMLAttributes<HTMLElement> & {\n \"data-drag-handle\": \"true\";\n};\n\nexport type ResizeHandleConfig =\n | {\n key: \"top-left\" | \"top-right\" | \"bottom-left\" | \"bottom-right\";\n variant: \"corner\";\n horizontal: \"left\" | \"right\";\n vertical: \"top\" | \"bottom\";\n }\n | {\n key: \"left\" | \"right\" | \"top\" | \"bottom\";\n variant: \"edge\";\n horizontal?: \"left\" | \"right\";\n vertical?: \"top\" | \"bottom\";\n };\n\nexport type GridLayerRenderState = {\n style: React.CSSProperties;\n isResizable: boolean;\n isResizing: boolean;\n onResizeHandlePointerDown: (config: ResizeHandleConfig, event: React.PointerEvent<HTMLDivElement>) => void;\n};\n\nexport type GridLayoutContextValue = {\n handleLayerPointerDown: (event: React.PointerEvent<HTMLDivElement>) => void;\n getLayerRenderState: (layer: LayerDefinition) => GridLayerRenderState;\n getLayerHandleProps: (layerId: string) => GridLayerHandleProps;\n /**\n * Whether the GridLayout is mounted at root level.\n * When true, scrollable layers should delegate to browser's native scroll.\n */\n isRootLevel: boolean;\n};\n\nconst GridLayoutContext = React.createContext<GridLayoutContextValue | null>(null);\n\nexport const GridLayoutProvider: React.FC<\n React.PropsWithChildren<{ value: GridLayoutContextValue }>\n> = ({ value, children }) => {\n return <GridLayoutContext.Provider value={value}>{children}</GridLayoutContext.Provider>;\n};\n\nexport const useGridLayoutContext = (): GridLayoutContextValue => {\n const context = React.useContext(GridLayoutContext);\n if (!context) {\n throw new Error(\"useGridLayoutContext must be used within a GridLayoutProvider.\");\n }\n return context;\n};\n","/**\n * @file PanelSystemContext\n *\n * Core provider for panel definitions and registry. Grid-specific layout and\n * interactions are composed by UI layers (e.g., GridLayout) on top of this.\n *\n * Includes content caching to preserve React component state across re-renders.\n * This is essential for maintaining internal state when parent components\n * re-create the layers array.\n */\nimport * as React from \"react\";\nimport type { PanelLayoutConfig, LayerDefinition } from \"./types\";\nimport { useContentCache } from \"./hooks/useContentCache\";\n\nexport type PanelSystemContextValue = {\n config: PanelLayoutConfig;\n style?: React.CSSProperties;\n layers: {\n /** Raw panel definitions (no grid normalization). */\n defs: LayerDefinition[];\n /** Fast lookup map by id for consumers. */\n layerById: Map<string, LayerDefinition>;\n };\n /**\n * Get cached content for a layer. Returns the same ReactNode reference\n * for the same layer ID to prevent remounting on parent re-renders.\n */\n getCachedContent: (layerId: string) => React.ReactNode | null;\n};\n\nconst PanelSystemContext = React.createContext<PanelSystemContextValue | null>(null);\n\nexport const usePanelSystem = (): PanelSystemContextValue => {\n const ctx = React.useContext(PanelSystemContext);\n if (!ctx) {\n throw new Error(\"usePanelSystem must be used within a PanelSystemProvider.\");\n }\n return ctx;\n};\n\nexport type PanelSystemProviderProps = React.PropsWithChildren<{\n config: PanelLayoutConfig;\n layers: LayerDefinition[];\n style?: React.CSSProperties;\n}>;\n\nexport const PanelSystemProvider: React.FC<PanelSystemProviderProps> = ({ config, layers, style, children }) => {\n const layerById = React.useMemo(() => {\n const map = new Map<string, LayerDefinition>();\n layers.forEach((layer) => {\n map.set(layer.id, layer);\n });\n return map;\n }, [layers]);\n\n // Content resolver for useContentCache\n const resolveContent = React.useCallback(\n (layerId: string): React.ReactNode | null => {\n const layer = layerById.get(layerId);\n return layer?.component ?? null;\n },\n [layerById],\n );\n\n // Valid IDs for cache cleanup\n const validIds = React.useMemo(() => layers.map((l) => l.id), [layers]);\n\n // Use shared content cache hook\n const { getCachedContent } = useContentCache({\n resolveContent,\n validIds,\n });\n\n const value = React.useMemo<PanelSystemContextValue>(\n () => ({\n config,\n style,\n layers: {\n defs: layers,\n layerById,\n },\n getCachedContent,\n }),\n [config, style, layers, layerById, getCachedContent],\n );\n\n return <PanelSystemContext.Provider value={value}>{children}</PanelSystemContext.Provider>;\n};\n","/**\n * @file Context exposing the current grid layer id and helpers to child components.\n */\nimport * as React from \"react\";\nimport type { LayerDefinition } from \"../../types\";\nimport { usePanelSystem } from \"../../PanelSystemContext\";\nimport { useGridLayoutContext, type GridLayerHandleProps } from \"./GridLayoutContext\";\n\ntype LayerInstanceContextValue = {\n layerId: string;\n};\n\nconst LayerInstanceContext = React.createContext<LayerInstanceContextValue | null>(null);\n\nexport type LayerInstanceProviderProps = React.PropsWithChildren<LayerInstanceContextValue>;\n\nexport const LayerInstanceProvider: React.FC<LayerInstanceProviderProps> = ({ layerId, children }) => {\n const value = React.useMemo(() => ({ layerId }), [layerId]);\n return <LayerInstanceContext.Provider value={value}>{children}</LayerInstanceContext.Provider>;\n};\n\nexport const useLayerInstance = (): LayerInstanceContextValue => {\n const value = React.useContext(LayerInstanceContext);\n if (!value) {\n throw new Error(\"useLayerInstance must be used within a LayerInstanceProvider.\");\n }\n return value;\n};\n\n/**\n * Convenience: read the current layer definition from the core registry.\n */\nexport const useCurrentLayerDefinition = (): LayerDefinition => {\n const { layerId } = useLayerInstance();\n const { layers } = usePanelSystem();\n const def = layers.layerById.get(layerId);\n if (!def) {\n throw new Error(`Layer definition not found for id: ${layerId}`);\n }\n return def;\n};\n\n/**\n * Convenience: get drag handle props, pre-bound to the current layer.\n */\nexport const useCurrentLayerHandleProps = (): GridLayerHandleProps => {\n const { layerId } = useLayerInstance();\n const { getLayerHandleProps } = useGridLayoutContext();\n return React.useMemo(() => getLayerHandleProps(layerId), [getLayerHandleProps, layerId]);\n};\n\n/**\n * Compatibility helper for existing code using useLayerDragHandle.\n * Prefer useCurrentLayerHandleProps for direct access.\n */\nexport const useLayerDragHandleProps = useCurrentLayerHandleProps;\n","/**\n * @file Renders floating layers inside a dedicated browser popup window.\n */\nimport * as React from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type { LayerDefinition, PopupWindowOptions, WindowPosition, WindowBounds } from \"../../types\";\nimport { LayerInstanceProvider } from \"../../modules/grid/LayerInstanceContext\";\n\nconst ensureNumericOffset = (value: number | string | undefined, key: keyof WindowPosition, layerId: string): number => {\n if (typeof value === \"number\" && Number.isFinite(value)) {\n return value;\n }\n throw new Error(`Popup layer \"${layerId}\" requires a numeric \"${key}\" value.`);\n};\n\nconst resolvePopupAnchor = (position: WindowPosition | undefined, layerId: string): { left: number; top: number } => {\n if (!position) {\n throw new Error(`Popup layer \"${layerId}\" must define position (left/top).`);\n }\n return {\n left: ensureNumericOffset(position.left, \"left\", layerId),\n top: ensureNumericOffset(position.top, \"top\", layerId),\n };\n};\n\nconst numericFeature = (value: number): string => {\n return `${Math.round(value)}`;\n};\n\nconst booleanFeature = (value: boolean | undefined): string | undefined => {\n if (value === undefined) {\n return undefined;\n }\n return value ? \"yes\" : \"no\";\n};\n\nconst buildWindowFeatures = (\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n options: PopupWindowOptions | undefined,\n): string => {\n const features: Record<string, string> = {};\n const anchor = resolvePopupAnchor(position, layerId);\n\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n features.width = numericFeature(width);\n features.height = numericFeature(height);\n features.left = numericFeature(anchor.left);\n features.top = numericFeature(anchor.top);\n\n const overrides = options?.features;\n if (overrides) {\n const toolbar = booleanFeature(overrides.toolbar);\n const menubar = booleanFeature(overrides.menubar);\n const location = booleanFeature(overrides.location);\n const status = booleanFeature(overrides.status);\n const resizable = booleanFeature(overrides.resizable);\n const scrollbars = booleanFeature(overrides.scrollbars);\n\n if (toolbar !== undefined) {\n features.toolbar = toolbar;\n }\n if (menubar !== undefined) {\n features.menubar = menubar;\n }\n if (location !== undefined) {\n features.location = location;\n }\n if (status !== undefined) {\n features.status = status;\n }\n if (resizable !== undefined) {\n features.resizable = resizable;\n }\n if (scrollbars !== undefined) {\n features.scrollbars = scrollbars;\n }\n }\n\n return Object.entries(features)\n .map(([key, value]) => `${key}=${value}`)\n .join(\",\");\n};\n\nconst applyBoundsToWindow = (\n popupWindow: Window,\n layerId: string,\n position: WindowPosition | undefined,\n width: number | string | undefined,\n height: number | string | undefined,\n) => {\n const anchor = resolvePopupAnchor(position, layerId);\n if (typeof width !== \"number\" || typeof height !== \"number\") {\n throw new Error(`Popup layer \"${layerId}\" requires numeric width/height.`);\n }\n popupWindow.moveTo(Math.round(anchor.left), Math.round(anchor.top));\n popupWindow.resizeTo(Math.round(width), Math.round(height));\n};\n\ntype PopupLayerPortalProps = {\n layer: LayerDefinition;\n};\n\nexport const PopupLayerPortal: React.FC<PopupLayerPortalProps> = ({ layer }) => {\n const floating = layer.floating;\n if (!floating) {\n throw new Error(`Layer \"${layer.id}\" is missing floating configuration required for popup mode.`);\n }\n const mode = floating.mode ?? \"embedded\";\n if (mode !== \"popup\") {\n throw new Error(`PopupLayerPortal received layer \"${layer.id}\" that is not configured for popup mode.`);\n }\n\n const containerRef = React.useRef<HTMLDivElement | null>(null);\n const popupWindowRef = React.useRef<Window | null>(null);\n const [isMounted, setIsMounted] = React.useState(false);\n\n React.useEffect(() => {\n if (typeof window === \"undefined\") {\n return;\n }\n\n const features = buildWindowFeatures(layer.id, layer.position, layer.width, layer.height, floating.popup);\n const windowName = floating.popup?.name ?? layer.id;\n const createdWindow = resolvePopupWindow(\n windowName,\n features,\n {\n position: layer.position,\n size: { width: layer.width as number, height: layer.height as number },\n },\n floating.popup,\n );\n\n if (!createdWindow) {\n throw new Error(`Failed to open popup window for layer \"${layer.id}\".`);\n }\n\n const openedWindow = createdWindow;\n\n popupWindowRef.current = openedWindow;\n\n if (floating.popup?.focus !== false) {\n openedWindow.focus();\n }\n\n if (!openedWindow.document.title) {\n openedWindow.document.title = layer.id;\n }\n openedWindow.document.body.innerHTML = \"\";\n const mountNode = openedWindow.document.createElement(\"div\");\n mountNode.dataset.layerId = layer.id;\n openedWindow.document.body.appendChild(mountNode);\n containerRef.current = mountNode;\n setIsMounted(true);\n\n applyBoundsToWindow(openedWindow, layer.id, layer.position, layer.width, layer.height);\n\n const handleBeforeUnload = () => {\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n openedWindow.addEventListener(\"beforeunload\", handleBeforeUnload);\n\n return () => {\n openedWindow.removeEventListener(\"beforeunload\", handleBeforeUnload);\n if (floating.popup?.closeOnUnmount !== false) {\n openedWindow.close();\n }\n popupWindowRef.current = null;\n containerRef.current = null;\n setIsMounted(false);\n };\n }, [\n floating.popup?.closeOnUnmount,\n floating.popup?.features?.location,\n floating.popup?.features?.menubar,\n floating.popup?.features?.resizable,\n floating.popup?.features?.scrollbars,\n floating.popup?.features?.status,\n floating.popup?.features?.toolbar,\n floating.popup?.focus,\n floating.popup?.name,\n layer.id,\n ]);\n\n React.useEffect(() => {\n const popupWindow = popupWindowRef.current;\n if (!popupWindow) {\n return;\n }\n applyBoundsToWindow(popupWindow, layer.id, layer.position, layer.width, layer.height);\n }, [layer.position?.left, layer.position?.top, layer.height, layer.width, layer.id]);\n\n if (!isMounted || !containerRef.current) {\n return null;\n }\n\n return createPortal(<LayerInstanceProvider layerId={layer.id}>{layer.component}</LayerInstanceProvider>, containerRef.current);\n};\n\nconst resolvePopupWindow = (\n windowName: string,\n features: string,\n bounds: WindowBounds,\n options: PopupWindowOptions | undefined,\n): Window | null => {\n const customFactory = options?.createWindow;\n if (customFactory) {\n return customFactory({ name: windowName, features, bounds });\n }\n return window.open(\"\", windowName, features);\n};\n","/**\n * @file FloatingWindow component with chrome support\n *\n * Renders floating panel content with optional built-in chrome (FloatingPanelFrame).\n * When chrome is enabled and header is provided, header becomes the drag handle.\n */\nimport * as React from \"react\";\nimport type { FloatingBehavior } from \"../../types\";\nimport {\n FloatingPanelCloseButton,\n FloatingPanelFrame,\n FloatingPanelHeader,\n FloatingPanelTitle,\n FloatingPanelControls,\n FloatingPanelContent,\n} from \"../paneling/FloatingPanelFrame\";\n\nexport type FloatingWindowProps = {\n id: string;\n config: FloatingBehavior;\n onClose: () => void;\n children: React.ReactNode;\n};\n\ntype CloseButtonProps = {\n onClick: () => void;\n};\n\nconst CloseButton: React.FC<CloseButtonProps> = ({ onClick }) => (\n <FloatingPanelControls>\n <FloatingPanelCloseButton onClick={onClick} aria-label=\"Close window\" data-drag-ignore=\"true\" />\n </FloatingPanelControls>\n);\n\ntype FloatingWindowHeaderProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n onClose: () => void;\n};\n\nconst FloatingWindowHeader: React.FC<FloatingWindowHeaderProps> = ({ header, draggable, onClose }) => {\n if (!header) {\n return null;\n }\n\n const showCloseButton = header.showCloseButton ?? false;\n const dragHandleProps = draggable ? { \"data-drag-handle\": \"true\" } : {};\n const cursorStyle = draggable ? \"grab\" : undefined;\n\n return (\n <FloatingPanelHeader {...dragHandleProps} style={{ cursor: cursorStyle }}>\n {header.title ? <FloatingPanelTitle>{header.title}</FloatingPanelTitle> : null}\n {showCloseButton ? <CloseButton onClick={onClose} /> : null}\n </FloatingPanelHeader>\n );\n};\n\ntype FloatingWindowViewProps = {\n header?: FloatingBehavior[\"header\"];\n draggable?: boolean;\n chrome: boolean;\n onClose: () => void;\n children: React.ReactNode;\n};\n\nconst FloatingWindowView: React.FC<FloatingWindowViewProps> = ({ header, draggable, chrome, onClose, children }) => {\n if (!chrome) {\n return <>{children}</>;\n }\n\n return (\n <FloatingPanelFrame style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowHeader header={header} draggable={draggable} onClose={onClose} />\n <FloatingPanelContent style={{ flex: 1, display: \"flex\", flexDirection: \"column\" }}>\n {children}\n </FloatingPanelContent>\n </FloatingPanelFrame>\n );\n};\n\nexport const FloatingWindow: React.FC<FloatingWindowProps> = ({ id, config, onClose, children }) => {\n const chrome = config.chrome ?? false;\n const draggable = config.draggable ?? false;\n const ariaLabel = config.header?.title ?? config.ariaLabel ?? \"Floating window\";\n\n return (\n <div data-floating-window={id} role=\"dialog\" aria-label={ariaLabel} style={{ height: \"100%\", width: \"100%\" }}>\n <FloatingWindowView header={config.header} draggable={draggable} chrome={chrome} onClose={onClose}>\n {children}\n </FloatingWindowView>\n </div>\n );\n};\n\nFloatingWindow.displayName = \"FloatingWindow\";\n"],"names":["drawerBackdropStyle","COLOR_DRAWER_BACKDROP","drawerBaseStyle","drawerPlacementStyles","computeTransitionValue","mode","duration","easing","DRAWER_TRANSITION_DURATION","DRAWER_TRANSITION_EASING","shouldShowCloseButton","dismissible","showClose","DrawerContent","chrome","frameStyle","header","onClose","children","jsxs","FloatingPanelFrame","jsx","DrawerHeaderView","FloatingPanelContent","DRAWER_CONTENT_PADDING","showCloseButton","shouldShowClose","React","FloatingPanelHeader","DRAWER_HEADER_PADDING_Y","DRAWER_HEADER_PADDING_X","DRAWER_HEADER_GAP","FloatingPanelTitle","FloatingPanelCloseButton","Drawer","id","config","isOpen","zIndex","width","height","position","inline","transitionMode","transitionDuration","transitionEasing","placement","anchor","pos","openTransforms","drawerStyle","transitionValue","style","ariaLabel","backdropStyle","base","isVertical","Fragment","waitForTransitionEnd","el","timeout","resolve","resolved","done","handler","e","runTransition","update","useTransitionState","options","states","setStates","optionsRef","transitionOptions","element","prev","opts","state","open","close","parseDuration","value","match","useDrawerState","layers","drawerStates","setDrawerStates","initial","layer","layerMap","map","updateState","layerId","DrawerLayers","drawer","drawerLayers","closeHandlers","handlers","GridLayoutContext","GridLayoutProvider","useGridLayoutContext","context","PanelSystemContext","usePanelSystem","ctx","PanelSystemProvider","layerById","resolveContent","validIds","l","getCachedContent","useContentCache","LayerInstanceContext","LayerInstanceProvider","useLayerInstance","ensureNumericOffset","key","resolvePopupAnchor","numericFeature","booleanFeature","buildWindowFeatures","features","overrides","toolbar","menubar","location","status","resizable","scrollbars","applyBoundsToWindow","popupWindow","PopupLayerPortal","floating","containerRef","popupWindowRef","isMounted","setIsMounted","windowName","createdWindow","resolvePopupWindow","openedWindow","mountNode","handleBeforeUnload","createPortal","bounds","customFactory","CloseButton","onClick","FloatingPanelControls","FloatingWindowHeader","draggable","FloatingWindowView","FloatingWindow"],"mappings":";;;;;;AAwBA,MAAMA,IAA2C;AAAA,EAC/C,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAYC;AACd,GAEMC,KAAuC;AAAA,EAC3C,YAAY;AACd,GAEMC,IAA6D;AAAA,EACjE,MAAM;AAAA,IACJ,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,WAAW;AAAA,EAAA;AAAA,EAEb,OAAO;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,WAAW;AAAA,EAAA;AAAA,EAEb,KAAK;AAAA,IACH,KAAK;AAAA,IACL,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,EAAA;AAAA,EAEb,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,OAAO;AAAA,IACP,WAAW;AAAA,EAAA;AAEf,GAEMC,KAAyB,CAC7BC,GACA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AA,CACF;AAEJ;AAEAsI,GAAe,cAAc;"}
@@ -1,2 +0,0 @@
1
- "use strict";const c=require("react/jsx-runtime"),O=require("react"),b=require("./FloatingPanelFrame-CEmXDvUA.cjs"),E=require("./styles-qf6ptVLD.cjs"),V=require("react-dom"),z=require("./useContentCache-DqXtLrLs.cjs");function X(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const u=X(O),y={position:"fixed",inset:0,background:E.COLOR_DRAWER_BACKDROP},Y={willChange:"transform"},F={left:{top:0,bottom:0,left:0,transform:"translateX(-100%)"},right:{top:0,bottom:0,right:0,transform:"translateX(100%)"},top:{top:0,left:0,right:0,transform:"translateY(-100%)"},bottom:{bottom:0,left:0,right:0,transform:"translateY(100%)"}},U=(t,e,o)=>{if(t==="none")return;const r=e??E.DRAWER_TRANSITION_DURATION,n=o??E.DRAWER_TRANSITION_EASING;return`transform ${r} ${n}`},K=(t,e)=>t?e:!1,J=({chrome:t,frameStyle:e,header:o,dismissible:r,onClose:n,children:i})=>t?c.jsxs(b.FloatingPanelFrame,{style:e,children:[c.jsx(Q,{header:o,dismissible:r,onClose:n}),c.jsx(b.FloatingPanelContent,{style:{padding:E.DRAWER_CONTENT_PADDING,flex:1,display:"flex",flexDirection:"column"},children:i})]}):c.jsx(c.Fragment,{children:i}),Q=({header:t,dismissible:e,onClose:o})=>{if(!t)return null;const r=t.showCloseButton??!0,n=K(e,r);return c.jsx(u.Activity,{mode:t?"visible":"hidden",children:c.jsxs(b.FloatingPanelHeader,{style:{padding:`${E.DRAWER_HEADER_PADDING_Y} ${E.DRAWER_HEADER_PADDING_X}`,gap:E.DRAWER_HEADER_GAP},children:[c.jsx(u.Activity,{mode:t?"visible":"hidden",children:c.jsx(b.FloatingPanelTitle,{children:t.title})}),c.jsx(u.Activity,{mode:n?"visible":"hidden",children:c.jsx(b.FloatingPanelCloseButton,{onClick:o,"aria-label":"Close drawer",style:{marginLeft:"auto"}})})]})})},M=({id:t,config:e,isOpen:o,onClose:r,children:n,zIndex:i,width:d,height:f,position:a})=>{const{dismissible:s=!0,header:l,chrome:p=!0,inline:w=!1,transitionMode:h="css",transitionDuration:x,transitionEasing:C}=e,v=u.useCallback((P,m)=>P||(m?m.left!==void 0?"left":m.right!==void 0?"right":m.top!==void 0?"top":m.bottom!==void 0?"bottom":"right":"right"),[])(e.anchor,a),B={left:"translateX(0)",right:"translateX(0)",top:"translateY(0)",bottom:"translateY(0)"},I=u.useMemo(()=>{const P=U(h,x,C),m={...Y,...w?{position:"absolute"}:{position:"fixed"},...F[v],transform:o?B[v]:F[v].transform,transition:P};return i!==void 0&&(m.zIndex=i),d!==void 0&&(m.width=typeof d=="number"?`${d}px`:d),f!==void 0&&(m.height=typeof f=="number"?`${f}px`:f),m},[f,w,o,v,x,C,h,d,i]),G=l?.title??e.ariaLabel??"Drawer",q=u.useMemo(()=>{const P=w?{...y,position:"absolute"}:y,m=h==="none"?void 0:`opacity ${x??"220ms"} ease`;return{...P,opacity:o?1:0,pointerEvents:o?"auto":"none",transition:m,zIndex:i!==void 0?i-1:void 0}},[w,o,x,h,i]),H=u.useMemo(()=>{const P=v==="left"||v==="right",m={borderRadius:0};return P&&(m.height="100%"),m},[v]);return c.jsxs(c.Fragment,{children:[c.jsx("div",{style:q,onClick:s?r:void 0}),c.jsx("div",{"data-layer-id":t,"data-placement":v,style:I,role:"dialog","aria-modal":s?!0:void 0,"aria-hidden":o?void 0:!0,"aria-label":G,children:c.jsx(J,{chrome:p,frameStyle:H,header:l,dismissible:s,onClose:r,children:n})})]})},Z=(t,e)=>new Promise(o=>{let r=!1;const n=()=>{r||(r=!0,t.removeEventListener("transitionend",i),o())},i=d=>{d.target===t&&n()};t.addEventListener("transitionend",i),setTimeout(n,e+50)}),D=async(t,e,o,r)=>{switch(e){case"none":t();return;case"css":t(),o&&await Z(o,r);return}},tt=t=>{const[e,o]=u.useState({}),r=u.useRef(t);r.current=t;const n=u.useCallback(async(a,s,l)=>{const{mode:p="none",element:w,duration:h=300}=l??{};await D(()=>{o(g=>g[a]===s?g:{...g,[a]:s})},p,w?.current,h);const C=r.current;s?C?.onOpen?.(a):C?.onClose?.(a),C?.onTransitionEnd?.(a,s)},[]),i=u.useCallback(a=>e[a]??!1,[e]),d=u.useCallback((a,s)=>n(a,!0,s),[n]),f=u.useCallback((a,s)=>n(a,!1,s),[n]);return{state:i,open:d,close:f}},et=t=>{if(!t)return 300;const e=t.match(/(\d+)/);return e?parseInt(e[1],10):300},A=t=>{const[e,o]=u.useState(()=>{const a={};return t.forEach(s=>{s.drawer&&(a[s.id]=s.drawer.defaultOpen??!1)}),a}),r=u.useMemo(()=>{const a=new Map;return t.forEach(s=>a.set(s.id,s)),a},[t]),n=u.useCallback(async(a,s,l)=>{const p=r.get(a);if(!p?.drawer)return;const w=l?.mode??p.drawer.transitionMode??"css",h=l?.duration??et(p.drawer.transitionDuration),x=l?.element?.current;await D(()=>{p.drawer?.open===void 0&&o(g=>g[a]===s?g:{...g,[a]:s}),p.drawer?.onStateChange?.(s)},w,x,h)},[r]),i=u.useCallback(a=>{const s=r.get(a);return s?.drawer?.open!==void 0?s.drawer.open:e[a]??!1},[r,e]),d=u.useCallback((a,s)=>n(a,!0,s),[n]),f=u.useCallback((a,s)=>n(a,!1,s),[n]);return{state:i,open:d,close:f}},nt=({layers:t})=>{const e=A(t),o=u.useMemo(()=>t.filter(n=>n.drawer),[t]),r=u.useMemo(()=>{const n=new Map;return o.forEach(i=>{n.set(i.id,()=>e.close(i.id))}),n},[o,e.close]);return c.jsx(c.Fragment,{children:o.map(n=>{if(!n.drawer)return null;const i=e.state(n.id),d=r.get(n.id);return d?c.jsx(M,{id:n.id,config:n.drawer,isOpen:i,onClose:d,zIndex:n.zIndex,width:n.width,height:n.height,position:n.position,children:n.component},n.id):null})})},T=u.createContext(null),ot=({value:t,children:e})=>c.jsx(T.Provider,{value:t,children:e}),rt=()=>{const t=u.useContext(T);if(!t)throw new Error("useGridLayoutContext must be used within a GridLayoutProvider.");return t},W=u.createContext(null),st=()=>{const t=u.useContext(W);if(!t)throw new Error("usePanelSystem must be used within a PanelSystemProvider.");return t},it=({config:t,layers:e,style:o,children:r})=>{const n=u.useMemo(()=>{const s=new Map;return e.forEach(l=>{s.set(l.id,l)}),s},[e]),i=u.useCallback(s=>n.get(s)?.component??null,[n]),d=u.useMemo(()=>e.map(s=>s.id),[e]),{getCachedContent:f}=z.useContentCache({resolveContent:i,validIds:d}),a=u.useMemo(()=>({config:t,style:o,layers:{defs:e,layerById:n},getCachedContent:f}),[t,o,e,n,f]);return c.jsx(W.Provider,{value:a,children:r})},_=u.createContext(null),$=({layerId:t,children:e})=>{const o=u.useMemo(()=>({layerId:t}),[t]);return c.jsx(_.Provider,{value:o,children:e})},at=()=>{const t=u.useContext(_);if(!t)throw new Error("useLayerInstance must be used within a LayerInstanceProvider.");return t},L=(t,e,o)=>{if(typeof t=="number"&&Number.isFinite(t))return t;throw new Error(`Popup layer "${o}" requires a numeric "${e}" value.`)},k=(t,e)=>{if(!t)throw new Error(`Popup layer "${e}" must define position (left/top).`);return{left:L(t.left,"left",e),top:L(t.top,"top",e)}},S=t=>`${Math.round(t)}`,j=t=>{if(t!==void 0)return t?"yes":"no"},ut=(t,e,o,r,n)=>{const i={},d=k(e,t);if(typeof o!="number"||typeof r!="number")throw new Error(`Popup layer "${t}" requires numeric width/height.`);i.width=S(o),i.height=S(r),i.left=S(d.left),i.top=S(d.top);const f=n?.features;if(f){const a=j(f.toolbar),s=j(f.menubar),l=j(f.location),p=j(f.status),w=j(f.resizable),h=j(f.scrollbars);a!==void 0&&(i.toolbar=a),s!==void 0&&(i.menubar=s),l!==void 0&&(i.location=l),p!==void 0&&(i.status=p),w!==void 0&&(i.resizable=w),h!==void 0&&(i.scrollbars=h)}return Object.entries(i).map(([a,s])=>`${a}=${s}`).join(",")},R=(t,e,o,r,n)=>{const i=k(o,e);if(typeof r!="number"||typeof n!="number")throw new Error(`Popup layer "${e}" requires numeric width/height.`);t.moveTo(Math.round(i.left),Math.round(i.top)),t.resizeTo(Math.round(r),Math.round(n))},ct=({layer:t})=>{const e=t.floating;if(!e)throw new Error(`Layer "${t.id}" is missing floating configuration required for popup mode.`);if((e.mode??"embedded")!=="popup")throw new Error(`PopupLayerPortal received layer "${t.id}" that is not configured for popup mode.`);const r=u.useRef(null),n=u.useRef(null),[i,d]=u.useState(!1);return u.useEffect(()=>{if(typeof window>"u")return;const f=ut(t.id,t.position,t.width,t.height,e.popup),a=e.popup?.name??t.id,s=lt(a,f,{position:t.position,size:{width:t.width,height:t.height}},e.popup);if(!s)throw new Error(`Failed to open popup window for layer "${t.id}".`);const l=s;n.current=l,e.popup?.focus!==!1&&l.focus(),l.document.title||(l.document.title=t.id),l.document.body.innerHTML="";const p=l.document.createElement("div");p.dataset.layerId=t.id,l.document.body.appendChild(p),r.current=p,d(!0),R(l,t.id,t.position,t.width,t.height);const w=()=>{n.current=null,r.current=null,d(!1)};return l.addEventListener("beforeunload",w),()=>{l.removeEventListener("beforeunload",w),e.popup?.closeOnUnmount!==!1&&l.close(),n.current=null,r.current=null,d(!1)}},[e.popup?.closeOnUnmount,e.popup?.features?.location,e.popup?.features?.menubar,e.popup?.features?.resizable,e.popup?.features?.scrollbars,e.popup?.features?.status,e.popup?.features?.toolbar,e.popup?.focus,e.popup?.name,t.id]),u.useEffect(()=>{const f=n.current;f&&R(f,t.id,t.position,t.width,t.height)},[t.position?.left,t.position?.top,t.height,t.width,t.id]),!i||!r.current?null:V.createPortal(c.jsx($,{layerId:t.id,children:t.component}),r.current)},lt=(t,e,o,r)=>{const n=r?.createWindow;return n?n({name:t,features:e,bounds:o}):window.open("",t,e)},dt=({onClick:t})=>c.jsx(b.FloatingPanelControls,{children:c.jsx(b.FloatingPanelCloseButton,{onClick:t,"aria-label":"Close window","data-drag-ignore":"true"})}),ft=({header:t,draggable:e,onClose:o})=>{if(!t)return null;const r=t.showCloseButton??!1,n=e?{"data-drag-handle":"true"}:{},i=e?"grab":void 0;return c.jsxs(b.FloatingPanelHeader,{...n,style:{cursor:i},children:[t.title?c.jsx(b.FloatingPanelTitle,{children:t.title}):null,r?c.jsx(dt,{onClick:o}):null]})},pt=({header:t,draggable:e,chrome:o,onClose:r,children:n})=>o?c.jsxs(b.FloatingPanelFrame,{style:{height:"100%",width:"100%"},children:[c.jsx(ft,{header:t,draggable:e,onClose:r}),c.jsx(b.FloatingPanelContent,{style:{flex:1,display:"flex",flexDirection:"column"},children:n})]}):c.jsx(c.Fragment,{children:n}),N=({id:t,config:e,onClose:o,children:r})=>{const n=e.chrome??!1,i=e.draggable??!1,d=e.header?.title??e.ariaLabel??"Floating window";return c.jsx("div",{"data-floating-window":t,role:"dialog","aria-label":d,style:{height:"100%",width:"100%"},children:c.jsx(pt,{header:e.header,draggable:i,chrome:n,onClose:o,children:r})})};N.displayName="FloatingWindow";exports.Drawer=M;exports.DrawerLayers=nt;exports.FloatingWindow=N;exports.GridLayoutProvider=ot;exports.LayerInstanceProvider=$;exports.PanelSystemProvider=it;exports.PopupLayerPortal=ct;exports.runTransition=D;exports.useDrawerState=A;exports.useGridLayoutContext=rt;exports.useLayerInstance=at;exports.usePanelSystem=st;exports.useTransitionState=tt;
2
- //# sourceMappingURL=FloatingWindow-TCDNY5gE.cjs.map