@floegence/floe-webapp-core 0.72.0 → 0.73.0

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