@floegence/floe-webapp-core 0.86.57 → 0.86.60

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