@floegence/floe-webapp-core 0.53.2 → 0.53.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,60 +1,60 @@
1
- import { createComponent as l, Portal as Ve, spread as pe, mergeProps as $e, memo as J, insert as u, effect as f, setAttribute as Ge, addEventListener as b, className as w, template as s, use as _e, delegateEvents as Je } from "solid-js/web";
2
- import { createSignal as g, createUniqueId as Ze, onCleanup as C, onMount as Ke, createEffect as R, Show as z, batch as Se, untrack as Qe } from "solid-js";
3
- import { cn as B } from "../../utils/cn.js";
4
- import { useLayout as et } from "../../context/LayoutContext.js";
5
- import { Button as Ie } from "./Button.js";
6
- import { Restore as tt, Maximize as nt, X as it } from "../icons/index.js";
7
- import { startHotInteraction as ot } from "../../utils/hotInteraction.js";
8
- import { startPointerSession as rt } from "./pointerSession.js";
9
- import { resolveFloatingWindowViewport as Z, normalizeFloatingWindowRect as lt, resolveFloatingWindowRect as at } from "./floatingWindowGeometry.js";
10
- import { createFloatingPresence as st } from "./floatingPresence.js";
11
- import { LOCAL_INTERACTION_SURFACE_ATTR as Pe } from "./localInteractionSurface.js";
12
- import { readSurfaceSafeArea as dt, resolveFloatingBoundary as ct } from "./surfaceFloatingBoundary.js";
13
- import { SURFACE_PORTAL_LAYER_ATTR as ut, resolveSurfacePortalHost as ft, SURFACE_FLOATING_LAYER_ATTR as ht } from "./dialogSurfaceScope.js";
14
- var wt = /* @__PURE__ */ s("<span hidden>"), gt = /* @__PURE__ */ s('<h2 class="text-xs leading-none font-medium truncate select-none">'), mt = /* @__PURE__ */ s('<div data-floe-floating-window-header-actions=true class="flex shrink-0 cursor-default items-center gap-1"><span aria-hidden=true class="mx-2 h-4 w-px shrink-0 bg-border">'), vt = /* @__PURE__ */ s('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-border">'), yt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), xt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), bt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), zt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), pt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), $t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), _t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), St = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), It = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0 px-2"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="flex-1 overflow-auto p-3">');
15
- function Dt(n) {
16
- const K = () => n.resizable ?? !0, Q = () => n.draggable ?? !0, ee = () => n.minSize ?? {
1
+ import { createComponent as l, Portal as Je, spread as _e, mergeProps as Se, memo as B, insert as u, effect as f, setAttribute as Ze, addEventListener as b, className as w, template as s, use as Ie, delegateEvents as Ke } from "solid-js/web";
2
+ import { createSignal as g, createUniqueId as Qe, onCleanup as C, onMount as et, createEffect as _, untrack as Pe, Show as z, batch as Re } from "solid-js";
3
+ import { cn as D } from "../../utils/cn.js";
4
+ import { useLayout as tt } from "../../context/LayoutContext.js";
5
+ import { Button as Ae } from "./Button.js";
6
+ import { Restore as nt, Maximize as it, X as ot } from "../icons/index.js";
7
+ import { startHotInteraction as rt } from "../../utils/hotInteraction.js";
8
+ import { startPointerSession as lt } from "./pointerSession.js";
9
+ import { resolveFloatingWindowViewport as K, normalizeFloatingWindowRect as at, resolveFloatingWindowRect as st } from "./floatingWindowGeometry.js";
10
+ import { createFloatingPresence as dt } from "./floatingPresence.js";
11
+ import { LOCAL_INTERACTION_SURFACE_ATTR as Ee } from "./localInteractionSurface.js";
12
+ import { readSurfaceSafeArea as ct, resolveFloatingBoundary as ut } from "./surfaceFloatingBoundary.js";
13
+ import { SURFACE_PORTAL_LAYER_ATTR as ft, resolveSurfacePortalHost as ht, SURFACE_FLOATING_LAYER_ATTR as wt } from "./dialogSurfaceScope.js";
14
+ var gt = /* @__PURE__ */ s("<span hidden>"), mt = /* @__PURE__ */ s('<h2 class="text-xs leading-none font-medium truncate select-none">'), vt = /* @__PURE__ */ s('<div data-floe-floating-window-header-actions=true class="flex shrink-0 cursor-default items-center gap-1"><span aria-hidden=true class="mx-2 h-4 w-px shrink-0 bg-border">'), yt = /* @__PURE__ */ s('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-border">'), xt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), bt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), zt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), pt = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), $t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), _t = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), St = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), It = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Pt = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0 px-2"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="flex-1 overflow-auto p-3">');
15
+ function Ht(n) {
16
+ const Q = () => n.resizable ?? !0, H = () => n.maximizable ?? !0, ee = () => n.draggable ?? !0, te = () => n.minSize ?? {
17
17
  width: 200,
18
18
  height: 150
19
- }, te = () => n.maxSize ?? {
19
+ }, ne = () => n.maxSize ?? {
20
20
  width: 1 / 0,
21
21
  height: 1 / 0
22
22
  };
23
- let D;
24
- const Re = dt(), [F, ne] = g({}), [Ae, ie] = g(1 / 0), [H, oe] = g(!0), h = () => !!(n.compactBelow && Ae() < n.compactBelow), _ = () => ({
23
+ let N;
24
+ const Ce = ct(), [F, ie] = g({}), [Fe, oe] = g(1 / 0), [Y, re] = g(!0), h = () => !!(n.compactBelow && Fe() < n.compactBelow), S = () => ({
25
25
  top: (F().top ?? 0) + (n.viewportInsets?.top ?? 0),
26
26
  right: (F().right ?? 0) + (n.viewportInsets?.right ?? 0),
27
27
  bottom: (F().bottom ?? 0) + (n.viewportInsets?.bottom ?? 0),
28
28
  left: (F().left ?? 0) + (n.viewportInsets?.left ?? 0)
29
- }), Ee = () => n.zIndex ?? 100, Ce = Ze(), Fe = et(), L = () => Fe.isMobile(), re = 16, le = () => `floating-window-${Ce}-title`, [N, Le] = g(n.defaultPosition ?? {
29
+ }), Le = () => n.zIndex ?? 100, ke = Qe(), Me = tt(), L = () => Me.isMobile(), le = 16, ae = () => `floating-window-${ke}-title`, [q, Te] = g(n.defaultPosition ?? {
30
30
  x: 0,
31
31
  y: 0
32
- }), [Y, ke] = g(n.defaultSize ?? {
32
+ }), [X, We] = g(n.defaultSize ?? {
33
33
  width: 400,
34
34
  height: 300
35
- }), [c, Me] = g(!1), [k, ae] = g(!1), [M, se] = g(!1), [Te, q] = g(!1), S = st({
35
+ }), [d, se] = g(!1), [k, de] = g(!1), [M, ce] = g(!1), [Oe, U] = g(!1), I = dt({
36
36
  open: () => n.open
37
37
  });
38
- let de = {
38
+ let ue = {
39
39
  x: 0,
40
40
  y: 0
41
- }, ce = {
41
+ }, fe = {
42
42
  x: 0,
43
43
  y: 0,
44
44
  width: 0,
45
45
  height: 0
46
- }, ue = {
46
+ }, he = {
47
47
  x: 0,
48
48
  y: 0
49
- }, fe = {
49
+ }, we = {
50
50
  x: 0,
51
51
  y: 0,
52
52
  width: 0,
53
53
  height: 0
54
- }, he = "se", a, d = null, T, m = null, A = {
54
+ }, ge = "se", a, c = null, T, m = null, E = {
55
55
  x: 0,
56
56
  y: 0
57
- }, I = null, W = null, X = !1, p = {
57
+ }, P = null, W = null, j = !1, p = {
58
58
  x: n.defaultPosition?.x ?? 0,
59
59
  y: n.defaultPosition?.y ?? 0,
60
60
  width: n.defaultSize?.width ?? 400,
@@ -62,19 +62,19 @@ function Dt(n) {
62
62
  }, v = {
63
63
  ...p
64
64
  }, $;
65
- const we = (e) => {
65
+ const me = (e) => {
66
66
  v = {
67
67
  ...e
68
68
  };
69
- const t = Z({
69
+ const t = K({
70
70
  width: window.innerWidth,
71
71
  height: window.innerHeight
72
- }, _());
72
+ }, S());
73
73
  $ = {
74
74
  x: t.width > e.width ? (e.x - t.x) / (t.width - e.width) : $?.x ?? 0.5,
75
75
  y: t.height > e.height ? (e.y - t.y) / (t.height - e.height) : $?.y ?? 0.5
76
76
  };
77
- }, We = {
77
+ }, Be = {
78
78
  n: "ns-resize",
79
79
  s: "ns-resize",
80
80
  e: "ew-resize",
@@ -83,48 +83,48 @@ function Dt(n) {
83
83
  nw: "nwse-resize",
84
84
  se: "nwse-resize",
85
85
  sw: "nesw-resize"
86
- }, U = (e, t) => {
86
+ }, V = (e, t) => {
87
87
  if (!e) {
88
88
  W?.(), W = null;
89
89
  return;
90
90
  }
91
- W?.(), W = ot({
91
+ W?.(), W = rt({
92
92
  kind: m === "resize" ? "resize" : "drag",
93
93
  cursor: t,
94
94
  lockUserSelect: !0
95
95
  });
96
- }, ge = (e) => {
96
+ }, ve = (e) => {
97
97
  p = e, a && (a.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, a.style.width = `${e.width}px`, a.style.height = `${e.height}px`);
98
- }, Oe = () => {
99
- const e = N(), t = Y();
98
+ }, De = () => {
99
+ const e = q(), t = X();
100
100
  return {
101
101
  x: e.x,
102
102
  y: e.y,
103
103
  width: t.width,
104
104
  height: t.height
105
105
  };
106
- }, j = (e) => {
107
- p = e, Le((t) => t.x === e.x && t.y === e.y ? t : {
106
+ }, G = (e) => {
107
+ p = e, Te((t) => t.x === e.x && t.y === e.y ? t : {
108
108
  x: e.x,
109
109
  y: e.y
110
- }), ke((t) => t.width === e.width && t.height === e.height ? t : {
110
+ }), We((t) => t.width === e.width && t.height === e.height ? t : {
111
111
  width: e.width,
112
112
  height: e.height
113
113
  });
114
- }, Be = () => {
114
+ }, He = () => {
115
115
  try {
116
116
  a?.focus({
117
117
  preventScroll: !0
118
118
  });
119
119
  } catch {
120
120
  }
121
- }, De = (e) => {
121
+ }, Ne = (e) => {
122
122
  const t = e instanceof Element ? e : null;
123
123
  return t ? t.closest('button, input, select, textarea, a, [role="button"], [tabindex]:not([tabindex="-1"])') === null : !0;
124
- }, V = (e) => !!a && e instanceof Node && a.contains(e), He = (e) => {
125
- const o = (e instanceof Element ? e : null)?.closest('[role="menu"]')?.closest(`[${ht}="true"]`);
124
+ }, J = (e) => !!a && e instanceof Node && a.contains(e), Ye = (e) => {
125
+ const o = (e instanceof Element ? e : null)?.closest('[role="menu"]')?.closest(`[${wt}="true"]`);
126
126
  return !!(o && a?.contains(o));
127
- }, Ne = () => {
127
+ }, qe = () => {
128
128
  if (!a) return null;
129
129
  const e = a.getBoundingClientRect();
130
130
  return {
@@ -133,142 +133,148 @@ function Dt(n) {
133
133
  width: e.width,
134
134
  height: e.height
135
135
  };
136
- }, me = () => {
137
- n.open && (d === null || m === null || typeof window > "u" || ge(at({
136
+ }, ye = () => {
137
+ n.open && (c === null || m === null || typeof window > "u" || ve(st({
138
138
  mode: m,
139
- pointer: A,
140
- dragStartPos: de,
141
- dragStartRect: ce,
142
- resizeStartPos: ue,
143
- resizeStartRect: fe,
144
- resizeHandle: he,
145
- minSize: ee(),
146
- maxSize: te(),
139
+ pointer: E,
140
+ dragStartPos: ue,
141
+ dragStartRect: fe,
142
+ resizeStartPos: he,
143
+ resizeStartRect: we,
144
+ resizeHandle: ge,
145
+ minSize: te(),
146
+ maxSize: ne(),
147
147
  viewport: {
148
148
  width: window.innerWidth,
149
149
  height: window.innerHeight
150
150
  },
151
- viewportInsets: _(),
151
+ viewportInsets: S(),
152
152
  mobile: L(),
153
- mobilePadding: re
153
+ mobilePadding: le
154
154
  })));
155
- }, E = (e) => {
155
+ }, R = (e) => {
156
156
  if (typeof window > "u") return;
157
157
  const t = {
158
158
  width: window.innerWidth,
159
159
  height: window.innerHeight
160
160
  };
161
- if (c() || h()) {
162
- j(Z(t, _()));
161
+ if (d() || h()) {
162
+ G(K(t, S()));
163
163
  return;
164
164
  }
165
- let r = lt({
165
+ let r = at({
166
166
  rect: v,
167
- minSize: ee(),
168
- maxSize: te(),
167
+ minSize: te(),
168
+ maxSize: ne(),
169
169
  viewport: t,
170
- viewportInsets: _(),
170
+ viewportInsets: S(),
171
171
  mobile: n.boundary === void 0 && L(),
172
- mobilePadding: re,
172
+ mobilePadding: le,
173
173
  center: e?.center ?? !1
174
174
  });
175
175
  if (n.boundary !== void 0 && $ && !e?.center) {
176
- const o = Z(t, _());
176
+ const o = K(t, S());
177
177
  r = {
178
178
  ...r,
179
179
  x: o.x + $.x * Math.max(0, o.width - r.width),
180
180
  y: o.y + $.y * Math.max(0, o.height - r.height)
181
181
  };
182
182
  }
183
- if (j(r), !$) {
183
+ if (G(r), !$) {
184
184
  const o = {
185
185
  width: v.width,
186
186
  height: v.height
187
187
  };
188
- we(r), Object.assign(v, o);
188
+ me(r), Object.assign(v, o);
189
189
  }
190
- }, ve = (e) => {
191
- I !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(I), I = null), e && me();
192
- const t = e ? Ne() ?? p : null;
193
- Se(() => {
190
+ }, xe = (e) => {
191
+ P !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(P), P = null), e && ye();
192
+ const t = e ? qe() ?? p : null;
193
+ Re(() => {
194
194
  if (t) {
195
- j(t);
195
+ G(t);
196
196
  const r = {
197
197
  width: v.width,
198
198
  height: v.height
199
199
  };
200
- we(t), m === "drag" && Object.assign(v, r);
200
+ me(t), m === "drag" && Object.assign(v, r);
201
201
  }
202
- d = null, m = null, ae(!1), se(!1);
203
- }), U(!1, ""), T = void 0;
204
- }, G = (e = !1) => {
202
+ c = null, m = null, de(!1), ce(!1);
203
+ }), V(!1, ""), T = void 0;
204
+ }, Z = (e = !1) => {
205
205
  T ? T.stop({
206
206
  commit: e
207
- }) : ve(e);
207
+ }) : xe(e);
208
208
  };
209
- C(() => G(!1)), Ke(() => {
209
+ C(() => Z(!1)), et(() => {
210
210
  let e = 0;
211
211
  const t = () => {
212
212
  if (n.boundary !== void 0) {
213
- const o = ct(ft({
214
- owner: D
215
- }), n.boundary, Re), P = o ? {
213
+ const o = ut(ht({
214
+ owner: N
215
+ }), n.boundary, Ce), A = o ? {
216
216
  top: o.top,
217
217
  left: o.left,
218
218
  right: window.innerWidth - o.right,
219
219
  bottom: window.innerHeight - o.bottom
220
220
  } : {};
221
- Se(() => {
222
- oe(!!(o && o.width > 16 && o.height > 16)), ie(o?.width ?? 0), ne((O) => JSON.stringify(O) === JSON.stringify(P) ? O : P);
221
+ Re(() => {
222
+ re(!!(o && o.width > 16 && o.height > 16)), oe(o?.width ?? 0), ie((O) => JSON.stringify(O) === JSON.stringify(A) ? O : A);
223
223
  });
224
224
  } else
225
- oe(!0), ie(window.innerWidth), ne((o) => Object.keys(o).length ? {} : o);
225
+ re(!0), oe(window.innerWidth), ie((o) => Object.keys(o).length ? {} : o);
226
226
  e = requestAnimationFrame(t);
227
227
  };
228
- t(), C(() => cancelAnimationFrame(e)), n.open || E({
228
+ t(), C(() => cancelAnimationFrame(e)), n.open || R({
229
229
  center: !n.defaultPosition
230
230
  });
231
231
  const r = () => {
232
- d === null && E({
232
+ c === null && R({
233
233
  center: !1
234
234
  });
235
235
  };
236
236
  window.addEventListener("resize", r), C(() => window.removeEventListener("resize", r));
237
- }), R(() => {
237
+ }), _(() => {
238
238
  if (!n.open) return;
239
239
  L();
240
- const e = !X && !n.defaultPosition, t = () => {
241
- E({
240
+ const e = !j && !n.defaultPosition, t = () => {
241
+ R({
242
242
  center: e
243
- }), X = !0;
243
+ }), j = !0;
244
244
  };
245
245
  if (typeof requestAnimationFrame > "u") {
246
246
  t();
247
247
  return;
248
248
  }
249
249
  requestAnimationFrame(t);
250
- }), R(() => {
251
- _(), h(), !(!n.open || !X || d !== null) && Qe(() => E({
250
+ }), _(() => {
251
+ S(), h(), !(!n.open || !j || c !== null) && Pe(() => R({
252
252
  center: !1
253
253
  }));
254
- }), R(() => {
254
+ }), _(() => {
255
+ H() || !d() || Pe(() => {
256
+ se(!1), R({
257
+ center: !1
258
+ });
259
+ });
260
+ }), _(() => {
255
261
  if (!n.open) return;
256
262
  const e = (t) => {
257
263
  if (t.key !== "Escape") return;
258
264
  const r = typeof document < "u" ? document.activeElement : null;
259
- !V(t.target) && !V(r) || He(t.target) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), n.onOpenChange(!1));
265
+ !J(t.target) && !J(r) || Ye(t.target) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), n.onOpenChange(!1));
260
266
  };
261
267
  document.addEventListener("keydown", e, !0), C(() => document.removeEventListener("keydown", e, !0));
262
- }), R(() => {
268
+ }), _(() => {
263
269
  if (!n.open) {
264
- q(!1), G(!1);
270
+ U(!1), Z(!1);
265
271
  return;
266
272
  }
267
- q(!0);
268
- }), R(() => {
273
+ U(!0);
274
+ }), _(() => {
269
275
  if (!n.open) return;
270
276
  const e = (o) => {
271
- q(V(o));
277
+ U(J(o));
272
278
  }, t = (o) => {
273
279
  e(o.target);
274
280
  }, r = (o) => {
@@ -277,67 +283,67 @@ function Dt(n) {
277
283
  document.addEventListener("pointerdown", t), document.addEventListener("focusin", r), C(() => {
278
284
  document.removeEventListener("pointerdown", t), document.removeEventListener("focusin", r);
279
285
  });
280
- }), R(() => {
286
+ }), _(() => {
281
287
  if (!n.open) return;
282
- const e = Oe();
283
- d === null ? ge(e) : p = e;
288
+ const e = De();
289
+ c === null ? ve(e) : p = e;
284
290
  });
285
- const Ye = (e) => {
286
- !Q() || c() || h() || d !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [data-floe-floating-window-header-actions]') || (e.preventDefault(), d = e.pointerId, m = "drag", ae(!0), de = {
291
+ const Xe = (e) => {
292
+ !ee() || d() || h() || c !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [data-floe-floating-window-header-actions]') || (e.preventDefault(), c = e.pointerId, m = "drag", de(!0), ue = {
287
293
  x: e.clientX,
288
294
  y: e.clientY
289
- }, ce = {
295
+ }, fe = {
290
296
  ...p
291
- }, A = {
297
+ }, E = {
292
298
  x: e.clientX,
293
299
  y: e.clientY
294
- }, U(!0, "grabbing"), xe(e));
300
+ }, V(!0, "grabbing"), ze(e));
295
301
  }, y = (e) => (t) => {
296
- !K() || c() || h() || d !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), d = t.pointerId, m = "resize", se(!0), he = e, ue = {
302
+ !Q() || d() || h() || c !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), c = t.pointerId, m = "resize", ce(!0), ge = e, he = {
297
303
  x: t.clientX,
298
304
  y: t.clientY
299
- }, fe = {
305
+ }, we = {
300
306
  ...p
301
- }, A = {
307
+ }, E = {
302
308
  x: t.clientX,
303
309
  y: t.clientY
304
- }, U(!0, We[e]), xe(t));
305
- }, ye = () => {
306
- I = null, me();
307
- }, qe = (e) => {
308
- if (!(d === null || e.pointerId !== d) && m !== null && (A = {
310
+ }, V(!0, Be[e]), ze(t));
311
+ }, be = () => {
312
+ P = null, ye();
313
+ }, Ue = (e) => {
314
+ if (!(c === null || e.pointerId !== c) && m !== null && (E = {
309
315
  x: e.clientX,
310
316
  y: e.clientY
311
- }, I === null)) {
317
+ }, P === null)) {
312
318
  if (typeof requestAnimationFrame > "u") {
313
- ye();
319
+ be();
314
320
  return;
315
321
  }
316
- I = requestAnimationFrame(ye);
322
+ P = requestAnimationFrame(be);
317
323
  }
318
- }, xe = (e) => {
319
- T = rt({
324
+ }, ze = (e) => {
325
+ T = lt({
320
326
  pointerEvent: e,
321
327
  captureEl: a,
322
- onMove: qe,
328
+ onMove: Ue,
323
329
  onEnd: ({
324
330
  commit: t,
325
331
  reason: r,
326
332
  snapshot: o
327
333
  }) => {
328
- A = {
334
+ E = {
329
335
  x: o.latestClientX,
330
336
  y: o.latestClientY
331
- }, ve(t || r === "pointer_cancel");
337
+ }, xe(t || r === "pointer_cancel");
332
338
  }
333
339
  });
334
- }, be = () => {
335
- d !== null && G(!0), !h() && (Me(!c()), E());
336
- }, Xe = (e) => {
337
- e.target?.closest("button, [data-floe-floating-window-header-actions]") || be();
338
- }, Ue = (e) => {
339
- De(e.target) && Be();
340
- }, x = (e) => B("absolute z-10", {
340
+ }, pe = () => {
341
+ !H() || h() || (c !== null && Z(!0), se(!d()), R());
342
+ }, je = (e) => {
343
+ e.target?.closest("button, [data-floe-floating-window-header-actions]") || pe();
344
+ }, Ve = (e) => {
345
+ Ne(e.target) && He();
346
+ }, x = (e) => D("absolute z-10", {
341
347
  n: "cursor-ns-resize top-0 left-2 right-2 h-1",
342
348
  s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
343
349
  e: "cursor-ew-resize right-0 top-2 bottom-2 w-1",
@@ -348,53 +354,53 @@ function Dt(n) {
348
354
  sw: "cursor-nesw-resize bottom-0 left-0 w-2 h-2"
349
355
  }[e]);
350
356
  return [(() => {
351
- var e = wt(), t = D;
352
- return typeof t == "function" ? _e(t, e) : D = e, e;
357
+ var e = gt(), t = N;
358
+ return typeof t == "function" ? Ie(t, e) : N = e, e;
353
359
  })(), l(z, {
354
360
  get when() {
355
- return S.mounted();
361
+ return I.mounted();
356
362
  },
357
363
  get children() {
358
- return l(Ve, {
364
+ return l(Je, {
359
365
  get children() {
360
- var e = It(), t = e.firstChild, r = t.firstChild, o = r.firstChild, P = o.nextSibling, O = r.nextSibling, ze = a;
361
- return typeof ze == "function" ? _e(ze, e) : a = e, pe(e, $e({
366
+ var e = Pt(), t = e.firstChild, r = t.firstChild, o = r.firstChild, A = o.nextSibling, O = r.nextSibling, $e = a;
367
+ return typeof $e == "function" ? Ie($e, e) : a = e, _e(e, Se({
362
368
  get "data-floating-presence"() {
363
- return S.state();
369
+ return I.state();
364
370
  },
365
371
  get "aria-hidden"() {
366
- return S.exiting() || !H() ? "true" : void 0;
372
+ return I.exiting() || !Y() ? "true" : void 0;
367
373
  },
368
374
  get inert() {
369
- return S.exiting() || !H();
375
+ return I.exiting() || !Y();
370
376
  },
371
377
  get "data-floe-floating-window-compact"() {
372
378
  return h() ? "true" : void 0;
373
379
  }
374
380
  }, {
375
- [Pe]: "true"
381
+ [Ee]: "true"
376
382
  }, {
377
383
  get class() {
378
- return B("fixed left-0 top-0 z-[100] flex flex-col", (k() || M()) && "select-none", S.exiting() && "pointer-events-none");
384
+ return D("fixed left-0 top-0 z-[100] flex flex-col", (k() || M()) && "select-none", I.exiting() && "pointer-events-none");
379
385
  },
380
386
  get style() {
381
387
  return {
382
- visibility: H() ? void 0 : "hidden",
383
- width: `${Y().width}px`,
384
- height: `${Y().height}px`,
385
- transform: `translate3d(${N().x}px, ${N().y}px, 0)`,
386
- "z-index": Ee(),
388
+ visibility: Y() ? void 0 : "hidden",
389
+ width: `${X().width}px`,
390
+ height: `${X().height}px`,
391
+ transform: `translate3d(${q().x}px, ${q().y}px, 0)`,
392
+ "z-index": Le(),
387
393
  "will-change": k() ? "transform" : M() ? "transform, width, height" : void 0
388
394
  };
389
395
  },
390
396
  role: "dialog",
391
397
  get "aria-labelledby"() {
392
- return J(() => !!n.title)() ? le() : void 0;
398
+ return B(() => !!n.title)() ? ae() : void 0;
393
399
  },
394
400
  tabIndex: -1,
395
- onPointerDown: Ue
396
- }), !1, !0), pe(t, $e({
397
- [ut]: "true"
401
+ onPointerDown: Ve
402
+ }), !1, !0), _e(t, Se({
403
+ [ft]: "true"
398
404
  }, {
399
405
  "data-floe-floating-window-surface": "true",
400
406
  "data-floe-surface": "floating",
@@ -402,66 +408,66 @@ function Dt(n) {
402
408
  return k() || M() ? "true" : void 0;
403
409
  },
404
410
  get "data-floe-floating-window-state"() {
405
- return Te() ? "active" : "inactive";
411
+ return Oe() ? "active" : "inactive";
406
412
  }
407
413
  }, {
408
- [Pe]: "true"
414
+ [Ee]: "true"
409
415
  }, {
410
416
  get class() {
411
- return B("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (k() || M()) && "floe-floating-presence--suspended", c() && "rounded-none", n.class);
417
+ return D("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (k() || M()) && "floe-floating-presence--suspended", d() && "rounded-none", n.class);
412
418
  },
413
419
  get style() {
414
420
  return {
415
- "border-radius": c() ? "0" : "var(--floe-radius-floating)"
421
+ "border-radius": d() ? "0" : "var(--floe-radius-floating)"
416
422
  };
417
423
  },
418
424
  get "data-floating-presence"() {
419
- return S.state();
425
+ return I.state();
420
426
  }
421
- }), !1, !0), r.$$dblclick = Xe, r.$$pointerdown = Ye, u(o, l(z, {
427
+ }), !1, !0), r.$$dblclick = je, r.$$pointerdown = Xe, u(o, l(z, {
422
428
  get when() {
423
429
  return n.title;
424
430
  },
425
431
  get children() {
426
- var i = gt();
427
- return u(i, () => n.title), f(() => Ge(i, "id", le())), i;
432
+ var i = mt();
433
+ return u(i, () => n.title), f(() => Ze(i, "id", ae())), i;
428
434
  }
429
435
  })), u(r, l(z, {
430
436
  get when() {
431
437
  return n.headerActions;
432
438
  },
433
439
  get children() {
434
- var i = mt(), je = i.firstChild;
435
- return u(i, () => n.headerActions, je), i;
440
+ var i = vt(), Ge = i.firstChild;
441
+ return u(i, () => n.headerActions, Ge), i;
436
442
  }
437
- }), P), u(P, l(z, {
443
+ }), A), u(A, l(z, {
438
444
  get when() {
439
- return !h();
445
+ return B(() => !!H())() && !h();
440
446
  },
441
447
  get children() {
442
- return l(Ie, {
448
+ return l(Ae, {
443
449
  variant: "ghost",
444
450
  size: "icon",
445
451
  "data-floe-floating-window-control": "maximize",
446
452
  class: "h-full w-9 shrink-0 rounded-none border-0 px-0 active:scale-100",
447
453
  onClick: (i) => {
448
- i.stopPropagation(), be();
454
+ i.stopPropagation(), pe();
449
455
  },
450
456
  get "aria-label"() {
451
- return J(() => !!c())() ? n.labels?.restore ?? "Restore" : n.labels?.maximize ?? "Maximize";
457
+ return B(() => !!d())() ? n.labels?.restore ?? "Restore" : n.labels?.maximize ?? "Maximize";
452
458
  },
453
459
  get children() {
454
460
  return l(z, {
455
461
  get when() {
456
- return c();
462
+ return d();
457
463
  },
458
464
  get fallback() {
459
- return l(nt, {
465
+ return l(it, {
460
466
  class: "w-3 h-3"
461
467
  });
462
468
  },
463
469
  get children() {
464
- return l(tt, {
470
+ return l(nt, {
465
471
  class: "w-3 h-3"
466
472
  });
467
473
  }
@@ -469,7 +475,7 @@ function Dt(n) {
469
475
  }
470
476
  });
471
477
  }
472
- }), null), u(P, l(Ie, {
478
+ }), null), u(A, l(Ae, {
473
479
  variant: "ghost-destructive",
474
480
  size: "icon",
475
481
  "data-floe-floating-window-control": "close",
@@ -481,7 +487,7 @@ function Dt(n) {
481
487
  return n.labels?.close ?? "Close";
482
488
  },
483
489
  get children() {
484
- return l(it, {
490
+ return l(ot, {
485
491
  class: "w-3.5 h-3.5"
486
492
  });
487
493
  }
@@ -490,19 +496,19 @@ function Dt(n) {
490
496
  return n.footer;
491
497
  },
492
498
  get children() {
493
- var i = vt();
499
+ var i = yt();
494
500
  return u(i, () => n.footer), i;
495
501
  }
496
502
  }), null), u(t, l(z, {
497
503
  get when() {
498
- return J(() => !!(K() && !c()))() && !h();
504
+ return B(() => !!(Q() && !d()))() && !h();
499
505
  },
500
506
  get children() {
501
507
  return [(() => {
502
- var i = yt();
508
+ var i = xt();
503
509
  return b(i, "pointerdown", y("n"), !0), f(() => w(i, x("n"))), i;
504
510
  })(), (() => {
505
- var i = xt();
511
+ var i = bt();
506
512
  return b(i, "pointerdown", y("s"), !0), f(() => w(i, x("s"))), i;
507
513
  })(), l(z, {
508
514
  get when() {
@@ -510,34 +516,34 @@ function Dt(n) {
510
516
  },
511
517
  get children() {
512
518
  return [(() => {
513
- var i = bt();
519
+ var i = zt();
514
520
  return b(i, "pointerdown", y("e"), !0), f(() => w(i, x("e"))), i;
515
521
  })(), (() => {
516
- var i = zt();
522
+ var i = pt();
517
523
  return b(i, "pointerdown", y("w"), !0), f(() => w(i, x("w"))), i;
518
524
  })(), (() => {
519
- var i = pt();
525
+ var i = $t();
520
526
  return b(i, "pointerdown", y("ne"), !0), f(() => w(i, x("ne"))), i;
521
527
  })(), (() => {
522
- var i = $t();
528
+ var i = _t();
523
529
  return b(i, "pointerdown", y("nw"), !0), f(() => w(i, x("nw"))), i;
524
530
  })(), (() => {
525
- var i = _t();
531
+ var i = St();
526
532
  return b(i, "pointerdown", y("se"), !0), f(() => w(i, x("se"))), i;
527
533
  })(), (() => {
528
- var i = St();
534
+ var i = It();
529
535
  return b(i, "pointerdown", y("sw"), !0), f(() => w(i, x("sw"))), i;
530
536
  })()];
531
537
  }
532
538
  })];
533
539
  }
534
- }), null), f(() => w(r, B("flex shrink-0 items-center justify-between h-8", "border-b", c() ? "rounded-none" : "rounded-t-md", Q() && !c() && !h() && "cursor-move"))), e;
540
+ }), null), f(() => w(r, D("flex shrink-0 items-center justify-between h-8", "border-b", d() ? "rounded-none" : "rounded-t-md", ee() && !d() && !h() && "cursor-move"))), e;
535
541
  }
536
542
  });
537
543
  }
538
544
  })];
539
545
  }
540
- Je(["pointerdown", "dblclick"]);
546
+ Ke(["pointerdown", "dblclick"]);
541
547
  export {
542
- Dt as FloatingWindow
548
+ Ht as FloatingWindow
543
549
  };