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