@floegence/floe-webapp-core 0.86.55 → 0.86.58

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