@floegence/floe-webapp-core 0.52.2 → 0.52.4
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/file-browser/FileContextMenu.d.ts +12 -2
- package/dist/components/file-browser/FileContextMenu.js +394 -268
- package/dist/components/file-browser/index.d.ts +1 -0
- package/dist/components/file-browser/longPressContextMenu.js +58 -45
- package/dist/components/ui/FloatingWindow.js +42 -35
- package/dist/components/ui/SurfaceFloatingLayer.d.ts +2 -0
- package/dist/components/ui/SurfaceFloatingLayer.js +29 -24
- package/dist/components/ui/dialogSurfaceScope.d.ts +5 -0
- package/dist/components/ui/dialogSurfaceScope.js +81 -70
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/surfaceFloatingBoundary.d.ts +12 -0
- package/dist/components/ui/surfaceFloatingBoundary.js +53 -0
- package/dist/components/ui/surfacePortalScope.d.ts +1 -1
- package/dist/file-browser.js +26 -24
- package/dist/floe.css +39 -44
- package/dist/full.js +204 -200
- package/dist/styles.css +1 -1
- package/dist/surface.css +40 -2
- package/dist/ui.js +15 -13
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { createLongPressContextMenuHandlers } from './longPressContextMenu';
|
|
1
2
|
export { FileBrowser, type FileBrowserProps } from './FileBrowser';
|
|
2
3
|
export { FileBrowserProvider, useFileBrowser, type FileBrowserProviderProps, } from './FileBrowserContext';
|
|
3
4
|
export { DirectoryTree, type DirectoryTreeProps } from './DirectoryTree';
|
|
@@ -1,54 +1,67 @@
|
|
|
1
|
-
import { onCleanup as
|
|
2
|
-
import { createItemContextMenuEvent as
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
let
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { onCleanup as D } from "solid-js";
|
|
2
|
+
import { createItemContextMenuEvent as w } from "./contextMenuEvent.js";
|
|
3
|
+
function S(c, l, a) {
|
|
4
|
+
const C = a?.delayMs ?? 500, g = a?.moveTolerancePx ?? 10, x = a?.selectOnOpen ?? !0, f = a?.source ?? "list";
|
|
5
|
+
let t = null, s = null, u = !1, d = null, p = null;
|
|
6
|
+
const n = () => {
|
|
7
|
+
t !== null && typeof window < "u" && (window.clearTimeout(t), t = null), s = null, d?.removeEventListener("pointerdown", m, !0), d = null, p = null;
|
|
8
|
+
}, m = (e) => {
|
|
9
|
+
p !== null && e.pointerId !== p && (n(), u = !0);
|
|
10
|
+
}, i = () => {
|
|
11
|
+
u = !0;
|
|
12
|
+
}, y = (e, o) => {
|
|
13
|
+
if (!x) {
|
|
14
|
+
c.showContextMenu(
|
|
15
|
+
w({
|
|
16
|
+
x: e,
|
|
17
|
+
y: o,
|
|
18
|
+
triggerItem: l,
|
|
19
|
+
items: [l],
|
|
20
|
+
source: f
|
|
21
|
+
})
|
|
22
|
+
), i();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
c.ensureContextMenuSelection(l.id);
|
|
26
|
+
const r = c.getSelectedItemsList(), h = r.length > 0 ? r : [l];
|
|
27
|
+
c.showContextMenu(
|
|
28
|
+
w({
|
|
13
29
|
x: e,
|
|
14
|
-
y:
|
|
15
|
-
triggerItem:
|
|
16
|
-
items:
|
|
30
|
+
y: o,
|
|
31
|
+
triggerItem: l,
|
|
32
|
+
items: h,
|
|
17
33
|
source: f
|
|
18
|
-
})
|
|
34
|
+
})
|
|
35
|
+
), i();
|
|
36
|
+
}, M = (e) => {
|
|
37
|
+
if (u = !1, e.pointerType === "mouse") return;
|
|
38
|
+
if (e.isPrimary === !1) {
|
|
39
|
+
n(), i();
|
|
19
40
|
return;
|
|
20
41
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
y
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, d);
|
|
37
|
-
}, M = (e) => {
|
|
38
|
-
if (n === null || !s) return;
|
|
39
|
-
const t = e.clientX - s.x, o = e.clientY - s.y;
|
|
40
|
-
Math.hypot(t, o) > m && (l(), a());
|
|
41
|
-
}, y = () => l(), g = () => l(), P = (e) => i ? (i = !1, e.preventDefault(), e.stopPropagation(), !0) : !1;
|
|
42
|
-
return v(() => {
|
|
43
|
-
l();
|
|
42
|
+
if (typeof window > "u") return;
|
|
43
|
+
n(), p = e.pointerId, d = e.currentTarget instanceof Node ? e.currentTarget.ownerDocument : document, d?.addEventListener("pointerdown", m, !0), s = { x: e.clientX, y: e.clientY };
|
|
44
|
+
const o = e.clientX, r = e.clientY;
|
|
45
|
+
t = window.setTimeout(() => {
|
|
46
|
+
t = null, y(o, r);
|
|
47
|
+
}, C);
|
|
48
|
+
}, P = (e) => {
|
|
49
|
+
if (t === null || !s) return;
|
|
50
|
+
const o = e.clientX - s.x, r = e.clientY - s.y;
|
|
51
|
+
Math.hypot(o, r) > g && (n(), i());
|
|
52
|
+
}, v = () => n(), I = () => {
|
|
53
|
+
n(), i();
|
|
54
|
+
}, T = (e) => u ? (u = !1, e.preventDefault(), e.stopPropagation(), !0) : !1;
|
|
55
|
+
return D(() => {
|
|
56
|
+
n();
|
|
44
57
|
}), {
|
|
45
|
-
onPointerDown:
|
|
46
|
-
onPointerMove:
|
|
47
|
-
onPointerUp:
|
|
48
|
-
onPointerCancel:
|
|
49
|
-
consumeClickSuppression:
|
|
58
|
+
onPointerDown: M,
|
|
59
|
+
onPointerMove: P,
|
|
60
|
+
onPointerUp: v,
|
|
61
|
+
onPointerCancel: I,
|
|
62
|
+
consumeClickSuppression: T
|
|
50
63
|
};
|
|
51
64
|
}
|
|
52
65
|
export {
|
|
53
|
-
|
|
66
|
+
S as createLongPressContextMenuHandlers
|
|
54
67
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent as a, Portal as
|
|
1
|
+
import { createComponent as a, Portal as Te, spread as ce, mergeProps as fe, memo as we, insert as g, effect as c, setAttribute as De, addEventListener as m, className as f, template as u, use as We, delegateEvents as Oe } from "solid-js/web";
|
|
2
2
|
import { createUniqueId as He, createSignal as p, onCleanup as L, onMount as Ye, createEffect as b, Show as S, batch as Ne, untrack as Xe } from "solid-js";
|
|
3
3
|
import { cn as M } from "../../utils/cn.js";
|
|
4
4
|
import { useLayout as Ue } from "../../context/LayoutContext.js";
|
|
@@ -10,21 +10,21 @@ import { resolveFloatingWindowViewport as ge, normalizeFloatingWindowRect as me,
|
|
|
10
10
|
import { createFloatingPresence as Je } from "./floatingPresence.js";
|
|
11
11
|
import { LOCAL_INTERACTION_SURFACE_ATTR as ve } from "./localInteractionSurface.js";
|
|
12
12
|
import { SURFACE_PORTAL_LAYER_ATTR as Ke, SURFACE_FLOATING_LAYER_ATTR as Qe } from "./dialogSurfaceScope.js";
|
|
13
|
-
var et = /* @__PURE__ */
|
|
13
|
+
var et = /* @__PURE__ */ u('<h2 class="text-xs leading-none font-medium truncate select-none">'), tt = /* @__PURE__ */ u('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-border">'), nt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), it = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), ot = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), rt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), lt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), st = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), at = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), dt = /* @__PURE__ */ u("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), ut = /* @__PURE__ */ u('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0 px-2"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="flex-1 overflow-auto p-3">');
|
|
14
14
|
function St(i) {
|
|
15
|
-
const B = () => i.resizable ?? !0, G = () => i.draggable ?? !0,
|
|
15
|
+
const B = () => i.resizable ?? !0, G = () => i.draggable ?? !0, k = () => i.minSize ?? {
|
|
16
16
|
width: 200,
|
|
17
17
|
height: 150
|
|
18
|
-
},
|
|
18
|
+
}, T = () => i.maxSize ?? {
|
|
19
19
|
width: 1 / 0,
|
|
20
20
|
height: 1 / 0
|
|
21
|
-
}, x = () => i.viewportInsets ?? {}, pe = () => i.zIndex ?? 100, xe = He(), ze = Ue(), $ = () => ze.isMobile(),
|
|
21
|
+
}, x = () => i.viewportInsets ?? {}, pe = () => i.zIndex ?? 100, xe = He(), ze = Ue(), $ = () => ze.isMobile(), D = 16, j = () => `floating-window-${xe}-title`, [W, ye] = p(i.defaultPosition ?? {
|
|
22
22
|
x: 0,
|
|
23
23
|
y: 0
|
|
24
24
|
}), [O, be] = p(i.defaultSize ?? {
|
|
25
25
|
width: 400,
|
|
26
26
|
height: 300
|
|
27
|
-
}), [
|
|
27
|
+
}), [d, V] = p(!1), [R, Z] = p(!1), [E, J] = p(!1), [Se, H] = p(!1), _ = Je({
|
|
28
28
|
open: () => i.open,
|
|
29
29
|
exitDurationMs: 120
|
|
30
30
|
}), [$e, _e] = p(null);
|
|
@@ -75,7 +75,7 @@ function St(i) {
|
|
|
75
75
|
}, ie = (e) => {
|
|
76
76
|
y = e, l && (l.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, l.style.width = `${e.width}px`, l.style.height = `${e.height}px`);
|
|
77
77
|
}, X = () => {
|
|
78
|
-
const e =
|
|
78
|
+
const e = W(), t = O();
|
|
79
79
|
return {
|
|
80
80
|
x: e.x,
|
|
81
81
|
y: e.y,
|
|
@@ -121,15 +121,15 @@ function St(i) {
|
|
|
121
121
|
resizeStartPos: ee,
|
|
122
122
|
resizeStartRect: te,
|
|
123
123
|
resizeHandle: ne,
|
|
124
|
-
minSize:
|
|
125
|
-
maxSize:
|
|
124
|
+
minSize: k(),
|
|
125
|
+
maxSize: T(),
|
|
126
126
|
viewport: {
|
|
127
127
|
width: window.innerWidth,
|
|
128
128
|
height: window.innerHeight
|
|
129
129
|
},
|
|
130
130
|
viewportInsets: x(),
|
|
131
131
|
mobile: $(),
|
|
132
|
-
mobilePadding:
|
|
132
|
+
mobilePadding: D
|
|
133
133
|
})));
|
|
134
134
|
}, F = (e) => {
|
|
135
135
|
if (typeof window > "u") return;
|
|
@@ -137,18 +137,18 @@ function St(i) {
|
|
|
137
137
|
width: window.innerWidth,
|
|
138
138
|
height: window.innerHeight
|
|
139
139
|
};
|
|
140
|
-
if (
|
|
140
|
+
if (d()) {
|
|
141
141
|
P(ge(t, x()));
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
P(me({
|
|
145
145
|
rect: X(),
|
|
146
|
-
minSize:
|
|
147
|
-
maxSize:
|
|
146
|
+
minSize: k(),
|
|
147
|
+
maxSize: T(),
|
|
148
148
|
viewport: t,
|
|
149
149
|
viewportInsets: x(),
|
|
150
150
|
mobile: $(),
|
|
151
|
-
mobilePadding:
|
|
151
|
+
mobilePadding: D,
|
|
152
152
|
center: e?.center ?? !1
|
|
153
153
|
}));
|
|
154
154
|
}, re = (e) => {
|
|
@@ -221,7 +221,7 @@ function St(i) {
|
|
|
221
221
|
s === null ? ie(e) : y = e;
|
|
222
222
|
});
|
|
223
223
|
const Ae = (e) => {
|
|
224
|
-
!G() ||
|
|
224
|
+
!G() || d() || s !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"]') || (e.preventDefault(), s = e.pointerId, v = "drag", Z(!0), K = {
|
|
225
225
|
x: e.clientX,
|
|
226
226
|
y: e.clientY
|
|
227
227
|
}, Q = {
|
|
@@ -231,7 +231,7 @@ function St(i) {
|
|
|
231
231
|
y: e.clientY
|
|
232
232
|
}, N(!0, "grabbing"), se(e));
|
|
233
233
|
}, w = (e) => (t) => {
|
|
234
|
-
!B() ||
|
|
234
|
+
!B() || d() || s !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), s = t.pointerId, v = "resize", J(!0), ne = e, ee = {
|
|
235
235
|
x: t.clientX,
|
|
236
236
|
y: t.clientY
|
|
237
237
|
}, te = {
|
|
@@ -270,7 +270,7 @@ function St(i) {
|
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
272
|
}, ae = () => {
|
|
273
|
-
if (s !== null && q(!0),
|
|
273
|
+
if (s !== null && q(!0), d()) {
|
|
274
274
|
const t = $e();
|
|
275
275
|
t && P(me({
|
|
276
276
|
rect: {
|
|
@@ -279,15 +279,15 @@ function St(i) {
|
|
|
279
279
|
width: t.size.width,
|
|
280
280
|
height: t.size.height
|
|
281
281
|
},
|
|
282
|
-
minSize:
|
|
283
|
-
maxSize:
|
|
282
|
+
minSize: k(),
|
|
283
|
+
maxSize: T(),
|
|
284
284
|
viewport: {
|
|
285
285
|
width: window.innerWidth,
|
|
286
286
|
height: window.innerHeight
|
|
287
287
|
},
|
|
288
288
|
viewportInsets: x(),
|
|
289
289
|
mobile: $(),
|
|
290
|
-
mobilePadding:
|
|
290
|
+
mobilePadding: D,
|
|
291
291
|
center: !1
|
|
292
292
|
})), V(!1);
|
|
293
293
|
return;
|
|
@@ -306,8 +306,8 @@ function St(i) {
|
|
|
306
306
|
width: window.innerWidth,
|
|
307
307
|
height: window.innerHeight
|
|
308
308
|
}, x())), V(!0);
|
|
309
|
-
}, Le = () => {
|
|
310
|
-
ae();
|
|
309
|
+
}, Le = (e) => {
|
|
310
|
+
e.target?.closest("button") || ae();
|
|
311
311
|
}, Me = (e) => {
|
|
312
312
|
Re(e.target) && Pe();
|
|
313
313
|
}, h = (e) => M("absolute z-10", {
|
|
@@ -325,10 +325,10 @@ function St(i) {
|
|
|
325
325
|
return _.mounted();
|
|
326
326
|
},
|
|
327
327
|
get children() {
|
|
328
|
-
return a(
|
|
328
|
+
return a(Te, {
|
|
329
329
|
get children() {
|
|
330
|
-
var e = ut(), t = e.firstChild, o = t.firstChild, r = o.firstChild, de = r.nextSibling,
|
|
331
|
-
return typeof ue == "function" ?
|
|
330
|
+
var e = ut(), t = e.firstChild, o = t.firstChild, r = o.firstChild, de = r.nextSibling, ke = o.nextSibling, ue = l;
|
|
331
|
+
return typeof ue == "function" ? We(ue, e) : l = e, ce(e, fe({
|
|
332
332
|
get "data-floating-presence"() {
|
|
333
333
|
return _.state();
|
|
334
334
|
},
|
|
@@ -345,7 +345,7 @@ function St(i) {
|
|
|
345
345
|
return {
|
|
346
346
|
width: `${O().width}px`,
|
|
347
347
|
height: `${O().height}px`,
|
|
348
|
-
transform: `translate3d(${
|
|
348
|
+
transform: `translate3d(${W().x}px, ${W().y}px, 0)`,
|
|
349
349
|
"z-index": pe(),
|
|
350
350
|
"will-change": R() ? "transform" : E() ? "transform, width, height" : void 0
|
|
351
351
|
};
|
|
@@ -371,7 +371,12 @@ function St(i) {
|
|
|
371
371
|
[ve]: "true"
|
|
372
372
|
}, {
|
|
373
373
|
get class() {
|
|
374
|
-
return M("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (R() || E()) && "floe-floating-presence--suspended",
|
|
374
|
+
return M("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "floe-floating-presence floe-floating-window-motion", (R() || E()) && "floe-floating-presence--suspended", d() && "rounded-none", i.class);
|
|
375
|
+
},
|
|
376
|
+
get style() {
|
|
377
|
+
return {
|
|
378
|
+
"border-radius": d() ? "0" : "10px"
|
|
379
|
+
};
|
|
375
380
|
},
|
|
376
381
|
get "data-floating-presence"() {
|
|
377
382
|
return _.state();
|
|
@@ -382,22 +387,23 @@ function St(i) {
|
|
|
382
387
|
},
|
|
383
388
|
get children() {
|
|
384
389
|
var n = et();
|
|
385
|
-
return g(n, () => i.title), c(() =>
|
|
390
|
+
return g(n, () => i.title), c(() => De(n, "id", j())), n;
|
|
386
391
|
}
|
|
387
392
|
})), g(de, a(he, {
|
|
388
393
|
variant: "ghost",
|
|
389
394
|
size: "icon",
|
|
390
|
-
|
|
395
|
+
"data-floe-floating-window-control": "maximize",
|
|
396
|
+
class: "h-full w-9 shrink-0 rounded-none border-0 px-0 active:scale-100",
|
|
391
397
|
onClick: (n) => {
|
|
392
398
|
n.stopPropagation(), ae();
|
|
393
399
|
},
|
|
394
400
|
get "aria-label"() {
|
|
395
|
-
return
|
|
401
|
+
return d() ? "Restore" : "Maximize";
|
|
396
402
|
},
|
|
397
403
|
get children() {
|
|
398
404
|
return a(S, {
|
|
399
405
|
get when() {
|
|
400
|
-
return
|
|
406
|
+
return d();
|
|
401
407
|
},
|
|
402
408
|
get fallback() {
|
|
403
409
|
return a(Be, {
|
|
@@ -414,7 +420,8 @@ function St(i) {
|
|
|
414
420
|
}), null), g(de, a(he, {
|
|
415
421
|
variant: "ghost-destructive",
|
|
416
422
|
size: "icon",
|
|
417
|
-
|
|
423
|
+
"data-floe-floating-window-control": "close",
|
|
424
|
+
class: "h-full w-10 shrink-0 rounded-none border-0 px-0 active:scale-100",
|
|
418
425
|
onClick: (n) => {
|
|
419
426
|
n.stopPropagation(), i.onOpenChange(!1);
|
|
420
427
|
},
|
|
@@ -424,7 +431,7 @@ function St(i) {
|
|
|
424
431
|
class: "w-3.5 h-3.5"
|
|
425
432
|
});
|
|
426
433
|
}
|
|
427
|
-
}), null), g(
|
|
434
|
+
}), null), g(ke, () => i.children), g(t, a(S, {
|
|
428
435
|
get when() {
|
|
429
436
|
return i.footer;
|
|
430
437
|
},
|
|
@@ -434,7 +441,7 @@ function St(i) {
|
|
|
434
441
|
}
|
|
435
442
|
}), null), g(t, a(S, {
|
|
436
443
|
get when() {
|
|
437
|
-
return we(() => !!B())() && !
|
|
444
|
+
return we(() => !!B())() && !d();
|
|
438
445
|
},
|
|
439
446
|
get children() {
|
|
440
447
|
return [(() => {
|
|
@@ -470,7 +477,7 @@ function St(i) {
|
|
|
470
477
|
}
|
|
471
478
|
})];
|
|
472
479
|
}
|
|
473
|
-
}), null), c(() => f(o, M("flex items-center justify-between h-
|
|
480
|
+
}), null), c(() => f(o, M("flex shrink-0 items-center justify-between h-8", "border-b", d() ? "rounded-none" : "rounded-t-md", G() && !d() && "cursor-move"))), e;
|
|
474
481
|
}
|
|
475
482
|
});
|
|
476
483
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
|
+
import { type SurfaceFloatingBoundary } from './surfaceFloatingBoundary';
|
|
2
3
|
export type SurfaceFloatingLayerPosition = Readonly<{
|
|
3
4
|
x: number;
|
|
4
5
|
y: number;
|
|
@@ -11,6 +12,7 @@ export interface SurfaceFloatingLayerProps extends Omit<JSX.HTMLAttributes<HTMLD
|
|
|
11
12
|
position: SurfaceFloatingLayerPosition;
|
|
12
13
|
/** Stable trigger or anchor used to resolve the owning projected surface. */
|
|
13
14
|
owner?: Element | null;
|
|
15
|
+
boundary?: SurfaceFloatingBoundary;
|
|
14
16
|
estimatedSize?: SurfaceFloatingLayerSize;
|
|
15
17
|
clamp?: boolean;
|
|
16
18
|
class?: string;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { createComponent as m, Portal as
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { LOCAL_INTERACTION_SURFACE_ATTR as
|
|
5
|
-
import { clampMenuPosition as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { createComponent as m, Portal as y, use as S, spread as v, mergeProps as h, insert as P, template as R } from "solid-js/web";
|
|
2
|
+
import { splitProps as g, createMemo as n } from "solid-js";
|
|
3
|
+
import { cn as A } from "../../utils/cn.js";
|
|
4
|
+
import { LOCAL_INTERACTION_SURFACE_ATTR as _ } from "./localInteractionSurface.js";
|
|
5
|
+
import { clampMenuPosition as b } from "./menuUtils.js";
|
|
6
|
+
import { readSurfaceSafeArea as T, resolveFloatingBoundary as z } from "./surfaceFloatingBoundary.js";
|
|
7
|
+
import { resolveSurfacePortalHost as C, SURFACE_FLOATING_LAYER_ATTR as w, resolveSurfacePortalMount as x, resolveSurfacePortalBoundaryRect as F, isSurfacePortalMode as L, projectSurfacePortalPosition as M } from "./dialogSurfaceScope.js";
|
|
8
|
+
var $ = /* @__PURE__ */ R("<div>");
|
|
9
|
+
function B() {
|
|
9
10
|
return {
|
|
10
11
|
left: 0,
|
|
11
12
|
top: 0,
|
|
@@ -15,38 +16,42 @@ function w() {
|
|
|
15
16
|
height: 0
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
function
|
|
19
|
-
const [e,
|
|
19
|
+
function G(l) {
|
|
20
|
+
const [e, c] = g(l, ["position", "owner", "boundary", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), o = n(() => C({
|
|
20
21
|
owner: e.owner ?? null
|
|
21
|
-
})),
|
|
22
|
+
})), i = () => L(o()), u = n(() => (e.position, T())), r = () => e.boundary === void 0 ? F(o()) : z(o(), e.boundary, u()) ?? B(), d = () => e.clamp !== !1 && !!e.estimatedSize, f = n(() => {
|
|
22
23
|
const t = e.position;
|
|
23
|
-
return !
|
|
24
|
-
}),
|
|
24
|
+
return !d() || !e.estimatedSize ? t : b(t, e.estimatedSize, r());
|
|
25
|
+
}), a = () => M(f(), o()), p = () => ({
|
|
25
26
|
...e.style ?? {},
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
...e.boundary !== void 0 && (r().width <= 16 || r().height <= 16) ? {
|
|
28
|
+
visibility: "hidden",
|
|
29
|
+
"pointer-events": "none"
|
|
30
|
+
} : {},
|
|
31
|
+
left: `${a().x}px`,
|
|
32
|
+
top: `${a().y}px`
|
|
28
33
|
});
|
|
29
|
-
return m(
|
|
34
|
+
return m(y, {
|
|
30
35
|
get mount() {
|
|
31
|
-
return
|
|
36
|
+
return x(o());
|
|
32
37
|
},
|
|
33
38
|
get children() {
|
|
34
39
|
var t = $(), s = e.layerRef;
|
|
35
|
-
return typeof s == "function" ?
|
|
40
|
+
return typeof s == "function" ? S(s, t) : e.layerRef = t, v(t, h(c, {
|
|
36
41
|
get class() {
|
|
37
|
-
return
|
|
42
|
+
return A(i() ? "absolute z-20" : "fixed z-50", e.class);
|
|
38
43
|
},
|
|
39
44
|
get style() {
|
|
40
|
-
return
|
|
45
|
+
return p();
|
|
41
46
|
}
|
|
42
47
|
}, {
|
|
43
|
-
[
|
|
48
|
+
[w]: "true"
|
|
44
49
|
}, () => ({
|
|
45
|
-
[
|
|
46
|
-
})), !1, !0),
|
|
50
|
+
[_]: i() ? "true" : void 0
|
|
51
|
+
})), !1, !0), P(t, () => e.children), t;
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
54
|
}
|
|
50
55
|
export {
|
|
51
|
-
|
|
56
|
+
G as SurfaceFloatingLayer
|
|
52
57
|
};
|
|
@@ -25,12 +25,17 @@ export type SurfacePortalHostResolutionOptions = Readonly<{
|
|
|
25
25
|
}>;
|
|
26
26
|
export declare function ensureDialogSurfaceInteractionTracking(): void;
|
|
27
27
|
export declare function ensureSurfacePortalInteractionTracking(): void;
|
|
28
|
+
export declare function readFreshInteractionSnapshot(): DialogSurfaceInteractionSnapshot | null;
|
|
28
29
|
export declare function resolveDialogSurfaceHost(options?: SurfacePortalHostResolutionOptions): ResolvedDialogSurfaceHost;
|
|
29
30
|
export declare function resolveSurfacePortalHost(options?: SurfacePortalHostResolutionOptions): ResolvedSurfacePortalHost;
|
|
30
31
|
export declare function isSurfacePortalMode(surfaceHost: ResolvedSurfacePortalHost): boolean;
|
|
31
32
|
export declare function resolveSurfacePortalMount(surfaceHost: ResolvedSurfacePortalHost): HTMLElement | undefined;
|
|
32
33
|
export declare function resolveSurfacePortalBoundaryRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
33
34
|
export declare function resolveSurfacePortalMountRect(surfaceHost: ResolvedSurfacePortalHost): SurfacePortalBoundaryRect;
|
|
35
|
+
export declare function resolveSurfacePortalScale(surfaceHost: ResolvedSurfacePortalHost): {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
34
39
|
export declare function projectSurfacePortalPosition(position: Readonly<{
|
|
35
40
|
x: number;
|
|
36
41
|
y: number;
|