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