@floegence/floe-webapp-core 0.52.11 → 0.52.12
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 +11 -0
- package/dist/components/ui/FloatingWindow.js +318 -279
- package/dist/components/ui/SurfaceFloatingPanel.d.ts +4 -0
- package/dist/components/ui/SurfaceFloatingPanel.js +169 -80
- package/dist/components/ui/dialogSurfaceScope.js +74 -71
- package/dist/components/ui/pointerSession.d.ts +4 -0
- package/dist/components/ui/pointerSession.js +23 -15
- package/dist/components/ui/surfaceFloatingPanelGeometry.d.ts +1 -1
- package/dist/components/ui/surfaceFloatingPanelGeometry.js +36 -36
- package/package.json +1 -1
|
@@ -15,6 +15,10 @@ export interface SurfaceFloatingPanelProps extends Omit<SurfaceFloatingLayerProp
|
|
|
15
15
|
snapThreshold?: number;
|
|
16
16
|
/** Client/CSS viewport pixel gap between the panel and its safe boundary. Defaults to 8px. */
|
|
17
17
|
snapInset?: number;
|
|
18
|
+
/** Show a quiet marker at the predicted landing edge during dragging. */
|
|
19
|
+
snapPreview?: boolean;
|
|
20
|
+
/** Gentle motion varies from 210–360ms with travel distance. Default: standard (180ms). */
|
|
21
|
+
snapMotion?: 'standard' | 'gentle';
|
|
18
22
|
/** Called with client/CSS viewport coordinates after a committed position change. */
|
|
19
23
|
onPositionChange?: (position: SurfaceFloatingPanelPosition) => void;
|
|
20
24
|
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { splitProps as
|
|
3
|
-
import { SurfaceFloatingLayer as
|
|
4
|
-
import { readSurfaceSafeArea as
|
|
5
|
-
import { startPointerSession as
|
|
6
|
-
import { resolveSurfaceFloatingPanelBounds as
|
|
7
|
-
import { resolveSurfacePortalHost as
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
const [a,
|
|
11
|
-
let
|
|
12
|
-
const
|
|
1
|
+
import { createComponent as D, memo as H, mergeProps as Z, template as ee, use as te } from "solid-js/web";
|
|
2
|
+
import { splitProps as ne, createSignal as f, createMemo as b, onMount as oe, onCleanup as G, Show as re } from "solid-js";
|
|
3
|
+
import { SurfaceFloatingLayer as R } from "./SurfaceFloatingLayer.js";
|
|
4
|
+
import { readSurfaceSafeArea as ae, resolveFloatingBoundary as ie } from "./surfaceFloatingBoundary.js";
|
|
5
|
+
import { startPointerSession as se } from "./pointerSession.js";
|
|
6
|
+
import { resolveSurfaceFloatingPanelBounds as le, resolveSurfaceFloatingPanelPosition as ce, resolveSurfaceFloatingPanelSnap as de, resolveSurfaceFloatingPanelSnapThreshold as pe, resolveSurfaceFloatingPanelInset as ue, insetSurfaceFloatingPanelGeometry as he } from "./surfaceFloatingPanelGeometry.js";
|
|
7
|
+
import { resolveSurfacePortalHost as ge, resolveSurfacePortalScale as fe } from "./dialogSurfaceScope.js";
|
|
8
|
+
var me = /* @__PURE__ */ ee("<span hidden>");
|
|
9
|
+
function Se(_) {
|
|
10
|
+
const [a, k] = ne(_, ["children", "owner", "boundary", "style", "snapToEdge", "boundaryInsets", "snapThreshold", "snapInset", "snapPreview", "snapMotion", "onPositionChange"]);
|
|
11
|
+
let S, u, h, m = !1, p;
|
|
12
|
+
const q = ae(), [F, X] = f(!1), [z, C] = f(!1), [K, Y] = f({
|
|
13
|
+
x: 0,
|
|
14
|
+
y: 0
|
|
15
|
+
}), [O, j] = f(!1), [T, $] = f({
|
|
13
16
|
x: 1,
|
|
14
17
|
y: 1
|
|
15
|
-
}), [
|
|
18
|
+
}), [i, N] = f({
|
|
16
19
|
left: 0,
|
|
17
20
|
top: 0,
|
|
18
21
|
width: 0,
|
|
@@ -21,83 +24,120 @@ function he($) {
|
|
|
21
24
|
panelHeight: 0,
|
|
22
25
|
scaleX: 1,
|
|
23
26
|
scaleY: 1
|
|
24
|
-
}),
|
|
25
|
-
if (!
|
|
26
|
-
const e =
|
|
27
|
-
owner:
|
|
28
|
-
}), t =
|
|
29
|
-
...
|
|
27
|
+
}), P = () => a.owner ?? S, E = () => ue(a.snapInset), A = b(() => le(i(), E())), U = (e) => P()?.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? 0 : a.snapMotion === "gentle" ? Math.round(Math.min(360, Math.max(210, 180 + Math.sqrt(e) * 12))) : 180, I = () => {
|
|
28
|
+
if (!u) return;
|
|
29
|
+
const e = ge({
|
|
30
|
+
owner: P()
|
|
31
|
+
}), t = ie(e, a.boundary, q), n = fe(e), r = u.getBoundingClientRect(), o = {
|
|
32
|
+
...he({
|
|
30
33
|
left: t?.left ?? 0,
|
|
31
34
|
top: t?.top ?? 0,
|
|
32
35
|
width: t?.width ?? 0,
|
|
33
36
|
height: t?.height ?? 0,
|
|
34
|
-
panelWidth:
|
|
35
|
-
panelHeight:
|
|
37
|
+
panelWidth: r.width,
|
|
38
|
+
panelHeight: r.height
|
|
36
39
|
}, a.boundaryInsets),
|
|
37
40
|
scaleX: n.x,
|
|
38
41
|
scaleY: n.y
|
|
39
42
|
};
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
const n =
|
|
43
|
-
|
|
44
|
-
x:
|
|
45
|
-
y:
|
|
43
|
+
p && (o.width !== i().width || o.height !== i().height || o.scaleX !== i().scaleX || o.scaleY !== i().scaleY) && w(), N((d) => Object.keys(o).every((x) => o[x] === d[x]) ? d : o);
|
|
44
|
+
}, c = b(() => ce(A(), T())), M = (e, t) => {
|
|
45
|
+
const n = A(), r = (s, o) => o.room > 0 ? Math.max(0, Math.min(1, s / o.room)) : 0;
|
|
46
|
+
$({
|
|
47
|
+
x: r(e - n.x.min, n.x),
|
|
48
|
+
y: r(t - n.y.min, n.y)
|
|
46
49
|
});
|
|
47
|
-
},
|
|
50
|
+
}, y = (e = c()) => {
|
|
48
51
|
a.onPositionChange?.(e);
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
}, w = () => {
|
|
53
|
+
const e = p;
|
|
54
|
+
p = void 0, e?.cancel(), C(!1);
|
|
55
|
+
}, L = () => {
|
|
56
|
+
const e = p !== void 0 ? u?.getBoundingClientRect() : void 0;
|
|
57
|
+
w(), I(), e && M(e.left, e.top);
|
|
58
|
+
}, W = b(() => de(c(), A(), pe(a.snapThreshold), K())), V = b(() => {
|
|
59
|
+
const e = W();
|
|
60
|
+
if (!a.snapPreview || !a.snapToEdge || !F() || !e) return null;
|
|
61
|
+
const t = i(), n = e.edge === "left" || e.edge === "right";
|
|
62
|
+
return {
|
|
63
|
+
edge: e.edge,
|
|
64
|
+
x: e.position.x + (n ? e.edge === "left" ? -7 : t.panelWidth + 5 : (t.panelWidth - 28) / 2),
|
|
65
|
+
y: e.position.y + (n ? (t.panelHeight - 28) / 2 : e.edge === "top" ? -7 : t.panelHeight + 5),
|
|
66
|
+
width: (n ? 2 : 28) / t.scaleX,
|
|
67
|
+
height: (n ? 28 : 2) / t.scaleY
|
|
68
|
+
};
|
|
69
|
+
}), J = () => {
|
|
70
|
+
const e = W();
|
|
56
71
|
if (!e) {
|
|
57
|
-
|
|
72
|
+
y(c());
|
|
58
73
|
return;
|
|
59
74
|
}
|
|
60
|
-
const t =
|
|
75
|
+
const t = c();
|
|
61
76
|
if (t.x === e.position.x && t.y === e.position.y) {
|
|
62
|
-
|
|
77
|
+
y(t);
|
|
63
78
|
return;
|
|
64
79
|
}
|
|
65
|
-
|
|
66
|
-
const n =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
w();
|
|
81
|
+
const n = U(Math.hypot(t.x - e.position.x, t.y - e.position.y)), r = a.snapMotion === "gentle" ? "cubic-bezier(.22,.7,.18,1)" : "ease-out";
|
|
82
|
+
if (M(e.position.x, e.position.y), y(e.position), !n || !u?.animate) return;
|
|
83
|
+
const s = i(), o = u.animate([{
|
|
84
|
+
translate: `${(t.x - e.position.x) / s.scaleX}px ${(t.y - e.position.y) / s.scaleY}px`
|
|
85
|
+
}, {
|
|
86
|
+
translate: "0px 0px"
|
|
87
|
+
}], {
|
|
88
|
+
duration: n,
|
|
89
|
+
easing: r
|
|
90
|
+
});
|
|
91
|
+
p = o, C(!0), o.finished.then(() => {
|
|
92
|
+
p === o && (p = void 0, C(!1));
|
|
93
|
+
}).catch(() => {
|
|
94
|
+
});
|
|
95
|
+
}, Q = {
|
|
71
96
|
style: {
|
|
72
97
|
"touch-action": "none",
|
|
73
98
|
"user-select": "none"
|
|
74
99
|
},
|
|
75
100
|
onPointerDown: (e) => {
|
|
76
|
-
if (e.button !== 0 ||
|
|
77
|
-
e.stopPropagation(),
|
|
78
|
-
const t =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
if (e.button !== 0 || h) return;
|
|
102
|
+
e.stopPropagation(), L();
|
|
103
|
+
const t = T(), n = c(), r = e.clientX, s = e.clientY;
|
|
104
|
+
m = !1, Y({
|
|
105
|
+
x: 0,
|
|
106
|
+
y: 0
|
|
107
|
+
});
|
|
108
|
+
let o = {
|
|
109
|
+
x: r,
|
|
110
|
+
y: s
|
|
111
|
+
}, d = !1;
|
|
112
|
+
const x = (l, g) => {
|
|
113
|
+
const v = l - r, B = g - s;
|
|
114
|
+
d ||= Math.hypot(v, B) >= 4, d && (m = !0, X(!0), (l !== o.x || g !== o.y) && Y({
|
|
115
|
+
x: l - o.x,
|
|
116
|
+
y: g - o.y
|
|
117
|
+
}), o = {
|
|
118
|
+
x: l,
|
|
119
|
+
y: g
|
|
120
|
+
}, M(n.x + v, n.y + B));
|
|
84
121
|
};
|
|
85
|
-
|
|
122
|
+
h = se({
|
|
86
123
|
pointerEvent: e,
|
|
87
124
|
captureEl: e.currentTarget,
|
|
88
|
-
|
|
89
|
-
|
|
125
|
+
continueOnCaptureLoss: !0,
|
|
126
|
+
interruptionPosition: "last-held",
|
|
127
|
+
onMove: (l) => {
|
|
128
|
+
l.preventDefault(), x(l.clientX, l.clientY);
|
|
90
129
|
},
|
|
91
130
|
onEnd: ({
|
|
92
|
-
commit:
|
|
93
|
-
|
|
131
|
+
commit: l,
|
|
132
|
+
reason: g,
|
|
133
|
+
snapshot: v
|
|
94
134
|
}) => {
|
|
95
|
-
|
|
135
|
+
l || g === "pointer_cancel" ? (x(v.latestClientX, v.latestClientY), d && a.snapToEdge ? J() : d && y(c())) : $(t), m = d, X(!1), h = void 0;
|
|
96
136
|
}
|
|
97
137
|
});
|
|
98
138
|
},
|
|
99
139
|
"oncapture:click": (e) => {
|
|
100
|
-
|
|
140
|
+
m && e.detail !== 0 && (e.preventDefault(), e.stopImmediatePropagation()), m = !1;
|
|
101
141
|
},
|
|
102
142
|
onKeyDown: (e) => {
|
|
103
143
|
const t = {
|
|
@@ -107,50 +147,99 @@ function he($) {
|
|
|
107
147
|
ArrowDown: [0, 1]
|
|
108
148
|
}[e.key];
|
|
109
149
|
if (!t) return;
|
|
110
|
-
e.preventDefault(), e.stopPropagation(),
|
|
111
|
-
const n =
|
|
112
|
-
|
|
150
|
+
e.preventDefault(), e.stopPropagation(), L();
|
|
151
|
+
const n = c(), r = e.shiftKey ? 40 : 10;
|
|
152
|
+
M(n.x + t[0] * r, n.y + t[1] * r), y(c());
|
|
113
153
|
}
|
|
114
154
|
};
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
155
|
+
return oe(() => {
|
|
156
|
+
j(!0);
|
|
157
|
+
const e = (o) => {
|
|
158
|
+
o.key !== "Escape" || !h || (o.preventDefault(), o.stopImmediatePropagation(), h.stop());
|
|
159
|
+
};
|
|
160
|
+
document.addEventListener("keydown", e, !0);
|
|
161
|
+
const t = window.matchMedia?.("(prefers-reduced-motion: reduce)"), n = () => {
|
|
162
|
+
t?.matches && w();
|
|
120
163
|
};
|
|
121
|
-
t(),
|
|
122
|
-
|
|
164
|
+
t?.addEventListener?.("change", n), G(() => {
|
|
165
|
+
document.removeEventListener("keydown", e, !0), t?.removeEventListener?.("change", n);
|
|
166
|
+
});
|
|
167
|
+
let r = 0;
|
|
168
|
+
const s = () => {
|
|
169
|
+
I(), r = requestAnimationFrame(s);
|
|
170
|
+
};
|
|
171
|
+
s(), G(() => {
|
|
172
|
+
cancelAnimationFrame(r), w(), h?.stop();
|
|
123
173
|
});
|
|
124
174
|
}), [(() => {
|
|
125
|
-
var e =
|
|
126
|
-
return typeof t == "function" ?
|
|
127
|
-
})(),
|
|
175
|
+
var e = me(), t = S;
|
|
176
|
+
return typeof t == "function" ? te(t, e) : S = e, e;
|
|
177
|
+
})(), D(re, {
|
|
178
|
+
get when() {
|
|
179
|
+
return V();
|
|
180
|
+
},
|
|
181
|
+
children: (e) => D(R, {
|
|
182
|
+
get owner() {
|
|
183
|
+
return P();
|
|
184
|
+
},
|
|
185
|
+
get boundary() {
|
|
186
|
+
return a.boundary;
|
|
187
|
+
},
|
|
188
|
+
get position() {
|
|
189
|
+
return e();
|
|
190
|
+
},
|
|
191
|
+
clamp: !1,
|
|
192
|
+
"aria-hidden": "true",
|
|
193
|
+
get "data-floe-panel-snap-preview"() {
|
|
194
|
+
return e().edge;
|
|
195
|
+
},
|
|
196
|
+
get style() {
|
|
197
|
+
return {
|
|
198
|
+
width: `${e().width}px`,
|
|
199
|
+
height: `${e().height}px`,
|
|
200
|
+
"border-radius": "2px",
|
|
201
|
+
"pointer-events": "none",
|
|
202
|
+
border: "1px solid currentColor",
|
|
203
|
+
"box-sizing": "border-box",
|
|
204
|
+
color: "var(--muted-foreground, CanvasText)",
|
|
205
|
+
opacity: 0.55
|
|
206
|
+
};
|
|
207
|
+
},
|
|
208
|
+
children: null
|
|
209
|
+
})
|
|
210
|
+
}), H(() => H(() => !!O())() && D(R, Z(k, {
|
|
211
|
+
get "data-floe-panel-dragging"() {
|
|
212
|
+
return F() ? "true" : void 0;
|
|
213
|
+
},
|
|
214
|
+
get "data-floe-panel-settling"() {
|
|
215
|
+
return z() ? "true" : void 0;
|
|
216
|
+
},
|
|
128
217
|
get owner() {
|
|
129
|
-
return
|
|
218
|
+
return P();
|
|
130
219
|
},
|
|
131
220
|
get boundary() {
|
|
132
221
|
return a.boundary;
|
|
133
222
|
},
|
|
134
223
|
get position() {
|
|
135
|
-
return
|
|
224
|
+
return c();
|
|
136
225
|
},
|
|
137
226
|
clamp: !1,
|
|
138
227
|
layerRef: (e) => {
|
|
139
|
-
|
|
228
|
+
u = e;
|
|
140
229
|
},
|
|
141
230
|
get style() {
|
|
142
231
|
return {
|
|
143
232
|
...a.style,
|
|
144
|
-
"max-width": `${Math.max(0,
|
|
145
|
-
"max-height": `${Math.max(0,
|
|
146
|
-
visibility:
|
|
233
|
+
"max-width": `${Math.max(0, i().width - E() * 2) / Math.max(0.01, i().scaleX)}px`,
|
|
234
|
+
"max-height": `${Math.max(0, i().height - E() * 2) / Math.max(0.01, i().scaleY)}px`,
|
|
235
|
+
visibility: i().width <= 16 || i().height <= 16 ? "hidden" : void 0
|
|
147
236
|
};
|
|
148
237
|
},
|
|
149
238
|
get children() {
|
|
150
|
-
return a.children(
|
|
239
|
+
return a.children(Q);
|
|
151
240
|
}
|
|
152
241
|
})))];
|
|
153
242
|
}
|
|
154
243
|
export {
|
|
155
|
-
|
|
244
|
+
Se as SurfaceFloatingPanel
|
|
156
245
|
};
|
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
3
|
-
function
|
|
1
|
+
const E = "data-floe-dialog-surface-host", H = E, b = "data-floe-surface-portal-layer", I = "data-floe-surface-floating-layer", B = "data-floe-dialog-surface-boundary", v = 1600;
|
|
2
|
+
let l = null, i = null;
|
|
3
|
+
function A(t) {
|
|
4
4
|
return typeof Element < "u" && t instanceof Element ? t : typeof Node < "u" && t instanceof Node ? t.parentElement : null;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function L(t) {
|
|
7
7
|
const e = t?.activeElement;
|
|
8
8
|
return e instanceof Element ? e : null;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function a(t) {
|
|
11
11
|
const e = typeof document < "u" ? document : null;
|
|
12
|
-
|
|
13
|
-
target:
|
|
14
|
-
activeElement:
|
|
12
|
+
l = {
|
|
13
|
+
target: A(t),
|
|
14
|
+
activeElement: L(e),
|
|
15
15
|
recordedAt: Date.now()
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
18
|
+
function p(t) {
|
|
19
|
+
a(t.target);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
|
|
21
|
+
function y(t) {
|
|
22
|
+
a(t.target);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
24
|
+
function T(t) {
|
|
25
|
+
a(t.target);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
|
|
27
|
+
function R() {
|
|
28
|
+
_();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
typeof document > "u" ||
|
|
30
|
+
function _() {
|
|
31
|
+
typeof document > "u" || i !== document && (i && (i.removeEventListener("pointerdown", p, !0), i.removeEventListener("focusin", y, !0), i.removeEventListener("contextmenu", T, !0)), document.addEventListener("pointerdown", p, !0), document.addEventListener("focusin", y, !0), document.addEventListener("contextmenu", T, !0), i = document);
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return !
|
|
33
|
+
function x() {
|
|
34
|
+
return !l || Date.now() - l.recordedAt > v ? null : l;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const e = t?.closest(`[${
|
|
36
|
+
function f(t) {
|
|
37
|
+
const e = t?.closest(`[${E}="true"]`);
|
|
38
38
|
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function C(t) {
|
|
41
41
|
if (!t) return null;
|
|
42
|
-
const e = t.closest(`[${
|
|
42
|
+
const e = t.closest(`[${b}="true"]`);
|
|
43
43
|
return typeof HTMLElement > "u" ? null : e instanceof HTMLElement ? e : null;
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
const e =
|
|
45
|
+
function O(t = {}) {
|
|
46
|
+
R();
|
|
47
|
+
const e = x(), n = t.owner ? f(t.owner) : f(e?.target ?? null) ?? f(e?.activeElement ?? null);
|
|
48
48
|
return n ? {
|
|
49
49
|
host: n,
|
|
50
50
|
boundaryHost: n,
|
|
51
|
-
mountHost:
|
|
51
|
+
mountHost: C(n) ?? n,
|
|
52
52
|
mode: "surface"
|
|
53
53
|
} : { host: null, boundaryHost: null, mountHost: null, mode: "global" };
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function c(t) {
|
|
56
56
|
return t.mode === "surface" && !!t.boundaryHost?.isConnected;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
if (
|
|
58
|
+
function s(t) {
|
|
59
|
+
if (c(t))
|
|
60
60
|
return t.mountHost ?? t.boundaryHost ?? void 0;
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function S() {
|
|
63
63
|
return typeof window > "u" ? {
|
|
64
64
|
left: 0,
|
|
65
65
|
top: 0,
|
|
@@ -76,9 +76,9 @@ function y() {
|
|
|
76
76
|
height: window.innerHeight
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
function
|
|
80
|
-
if (!
|
|
81
|
-
return
|
|
79
|
+
function M(t) {
|
|
80
|
+
if (!c(t) || !t.boundaryHost)
|
|
81
|
+
return S();
|
|
82
82
|
const e = t.boundaryHost.getBoundingClientRect();
|
|
83
83
|
return {
|
|
84
84
|
left: e.left,
|
|
@@ -89,10 +89,10 @@ function F(t) {
|
|
|
89
89
|
height: e.height
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
|
-
function
|
|
93
|
-
const e =
|
|
92
|
+
function P(t) {
|
|
93
|
+
const e = s(t);
|
|
94
94
|
if (!e)
|
|
95
|
-
return
|
|
95
|
+
return S();
|
|
96
96
|
const n = e.getBoundingClientRect();
|
|
97
97
|
return {
|
|
98
98
|
left: n.left,
|
|
@@ -103,28 +103,31 @@ function L(t) {
|
|
|
103
103
|
height: n.height
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
const e =
|
|
106
|
+
function F(t) {
|
|
107
|
+
const e = s(t);
|
|
108
108
|
if (!e) return { x: 1, y: 1 };
|
|
109
|
-
const n = e.getBoundingClientRect()
|
|
109
|
+
const n = e.getBoundingClientRect(), o = getComputedStyle(e), r = (u) => Number.parseFloat(u) || 0, h = (u) => {
|
|
110
|
+
const d = r(o[u]);
|
|
111
|
+
return d ? o.boxSizing === "border-box" ? d : d + (u === "width" ? r(o.paddingLeft) + r(o.paddingRight) + r(o.borderLeftWidth) + r(o.borderRightWidth) : r(o.paddingTop) + r(o.paddingBottom) + r(o.borderTopWidth) + r(o.borderBottomWidth)) : u === "width" ? e.offsetWidth : e.offsetHeight;
|
|
112
|
+
}, m = h("width"), g = h("height");
|
|
110
113
|
return {
|
|
111
|
-
x:
|
|
112
|
-
y:
|
|
114
|
+
x: m > 0 && n.width > 0 ? n.width / m : 1,
|
|
115
|
+
y: g > 0 && n.height > 0 ? n.height / g : 1
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
|
-
function
|
|
116
|
-
if (!
|
|
118
|
+
function w(t, e) {
|
|
119
|
+
if (!c(e))
|
|
117
120
|
return t;
|
|
118
|
-
const n =
|
|
121
|
+
const n = s(e), o = P(e), r = F(e);
|
|
119
122
|
return {
|
|
120
|
-
x: (t.x - o.left) /
|
|
121
|
-
y: (t.y - o.top) /
|
|
123
|
+
x: (t.x - o.left) / r.x - n.clientLeft + n.scrollLeft,
|
|
124
|
+
y: (t.y - o.top) / r.y - n.clientTop + n.scrollTop
|
|
122
125
|
};
|
|
123
126
|
}
|
|
124
|
-
function
|
|
125
|
-
if (!
|
|
127
|
+
function D(t, e) {
|
|
128
|
+
if (!c(e))
|
|
126
129
|
return t;
|
|
127
|
-
const n =
|
|
130
|
+
const n = w({ x: t.left, y: t.top }, e), o = w({ x: t.right, y: t.bottom }, e);
|
|
128
131
|
return {
|
|
129
132
|
left: n.x,
|
|
130
133
|
top: n.y,
|
|
@@ -134,26 +137,26 @@ function H(t, e) {
|
|
|
134
137
|
height: o.y - n.y
|
|
135
138
|
};
|
|
136
139
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
140
|
+
function N() {
|
|
141
|
+
l = null;
|
|
139
142
|
}
|
|
140
|
-
typeof document < "u" &&
|
|
143
|
+
typeof document < "u" && R();
|
|
141
144
|
export {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
145
|
+
B as DIALOG_SURFACE_BOUNDARY_ATTR,
|
|
146
|
+
E as DIALOG_SURFACE_HOST_ATTR,
|
|
147
|
+
I as SURFACE_FLOATING_LAYER_ATTR,
|
|
148
|
+
H as SURFACE_PORTAL_HOST_ATTR,
|
|
149
|
+
b as SURFACE_PORTAL_LAYER_ATTR,
|
|
150
|
+
N as __resetSurfacePortalScopeForTests,
|
|
151
|
+
R as ensureDialogSurfaceInteractionTracking,
|
|
152
|
+
_ as ensureSurfacePortalInteractionTracking,
|
|
153
|
+
c as isSurfacePortalMode,
|
|
154
|
+
w as projectSurfacePortalPosition,
|
|
155
|
+
D as projectSurfacePortalRect,
|
|
156
|
+
x as readFreshInteractionSnapshot,
|
|
157
|
+
M as resolveSurfacePortalBoundaryRect,
|
|
158
|
+
O as resolveSurfacePortalHost,
|
|
159
|
+
s as resolveSurfacePortalMount,
|
|
160
|
+
P as resolveSurfacePortalMountRect,
|
|
161
|
+
F as resolveSurfacePortalScale
|
|
159
162
|
};
|
|
@@ -19,6 +19,10 @@ export interface StartPointerSessionOptions {
|
|
|
19
19
|
ownerDocument?: Document;
|
|
20
20
|
buttonMask?: number;
|
|
21
21
|
capturePointer?: boolean;
|
|
22
|
+
/** Keep document ownership when capture is lost before release. */
|
|
23
|
+
continueOnCaptureLoss?: boolean;
|
|
24
|
+
/** Floating launchers settle at the last held point after an interrupted release. */
|
|
25
|
+
interruptionPosition?: 'event' | 'last-held';
|
|
22
26
|
onMove?: (event: PointerEvent, snapshot: PointerSessionSnapshot) => void;
|
|
23
27
|
onEnd: (event: PointerSessionEndEvent) => void;
|
|
24
28
|
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
function
|
|
1
|
+
function L(e) {
|
|
2
2
|
if (e.ownerDocument) return e.ownerDocument;
|
|
3
3
|
if (e.captureEl?.ownerDocument) return e.captureEl.ownerDocument;
|
|
4
4
|
const n = e.pointerEvent.target;
|
|
5
5
|
return n && typeof n == "object" && "ownerDocument" in n && n.ownerDocument instanceof Document ? n.ownerDocument : document;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function o(e, n) {
|
|
8
8
|
return typeof e.buttons == "number" ? e.buttons : n;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function h(e, n) {
|
|
11
11
|
return !e || e.pointerId === n;
|
|
12
12
|
}
|
|
13
13
|
function b(e) {
|
|
14
|
-
const n =
|
|
14
|
+
const n = L(e), l = n.defaultView ?? window, a = e.buttonMask ?? 1, P = o(e.pointerEvent, a), t = {
|
|
15
15
|
pointerId: e.pointerEvent.pointerId,
|
|
16
16
|
latestClientX: e.pointerEvent.clientX,
|
|
17
17
|
latestClientY: e.pointerEvent.clientY,
|
|
18
|
-
latestButtons:
|
|
18
|
+
latestButtons: P,
|
|
19
19
|
active: !0,
|
|
20
20
|
captureActive: !1
|
|
21
|
-
},
|
|
22
|
-
!t.active || r.pointerId !== t.pointerId || (t.latestClientX = r.clientX, t.latestClientY = r.clientY, t.latestButtons =
|
|
21
|
+
}, c = (r) => {
|
|
22
|
+
!t.active || r.pointerId !== t.pointerId || (t.latestClientX = r.clientX, t.latestClientY = r.clientY, t.latestButtons = o(r, t.latestButtons));
|
|
23
23
|
}, s = () => {
|
|
24
24
|
if (t.active && !(!e.captureEl || typeof e.captureEl.setPointerCapture != "function"))
|
|
25
25
|
try {
|
|
@@ -37,12 +37,12 @@ function b(e) {
|
|
|
37
37
|
} finally {
|
|
38
38
|
t.captureActive = !1;
|
|
39
39
|
}
|
|
40
|
-
},
|
|
40
|
+
}, C = () => {
|
|
41
41
|
n.removeEventListener("pointermove", p, !0), n.removeEventListener("pointerup", d, !0), n.removeEventListener("pointercancel", f, !0), n.removeEventListener("visibilitychange", E), l.removeEventListener("blur", v), e.captureEl?.removeEventListener("lostpointercapture", m);
|
|
42
42
|
}, i = (r = {}) => {
|
|
43
43
|
if (!t.active) return;
|
|
44
44
|
const u = r.event;
|
|
45
|
-
|
|
45
|
+
h(u, t.pointerId) && (u && c(u), t.active = !1, C(), w(), e.onEnd({
|
|
46
46
|
reason: r.reason ?? "manual_stop",
|
|
47
47
|
commit: r.commit ?? !1,
|
|
48
48
|
snapshot: t,
|
|
@@ -51,21 +51,29 @@ function b(e) {
|
|
|
51
51
|
};
|
|
52
52
|
function p(r) {
|
|
53
53
|
if (!(!t.active || r.pointerId !== t.pointerId)) {
|
|
54
|
-
if (
|
|
55
|
-
|
|
54
|
+
if (a > 0 && (o(r, t.latestButtons) & a) !== a) {
|
|
55
|
+
t.latestButtons = o(r, 0), i({
|
|
56
|
+
reason: "buttons_released",
|
|
57
|
+
commit: !0,
|
|
58
|
+
...e.interruptionPosition === "last-held" ? {} : { event: r }
|
|
59
|
+
});
|
|
56
60
|
return;
|
|
57
61
|
}
|
|
58
|
-
e.onMove?.(r, t);
|
|
62
|
+
c(r), e.onMove?.(r, t);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
function d(r) {
|
|
62
66
|
i({ reason: "pointer_up", commit: !0, event: r });
|
|
63
67
|
}
|
|
64
68
|
function f(r) {
|
|
65
|
-
|
|
69
|
+
h(r, t.pointerId) && i({
|
|
70
|
+
reason: "pointer_cancel",
|
|
71
|
+
commit: !1,
|
|
72
|
+
...e.interruptionPosition === "last-held" ? {} : { event: r }
|
|
73
|
+
});
|
|
66
74
|
}
|
|
67
75
|
function m() {
|
|
68
|
-
i({ reason: "lost_pointer_capture", commit: !0 });
|
|
76
|
+
t.captureActive = !1, !e.continueOnCaptureLoss && i({ reason: "lost_pointer_capture", commit: !0 });
|
|
69
77
|
}
|
|
70
78
|
function v() {
|
|
71
79
|
i({ reason: "window_blur", commit: !0 });
|
|
@@ -75,7 +83,7 @@ function b(e) {
|
|
|
75
83
|
}
|
|
76
84
|
return n.addEventListener("pointermove", p, !0), n.addEventListener("pointerup", d, !0), n.addEventListener("pointercancel", f, !0), n.addEventListener("visibilitychange", E), l.addEventListener("blur", v), e.captureEl?.addEventListener("lostpointercapture", m), e.capturePointer !== !1 && s(), {
|
|
77
85
|
snapshot: () => t,
|
|
78
|
-
updatePointer:
|
|
86
|
+
updatePointer: c,
|
|
79
87
|
capturePointer: s,
|
|
80
88
|
stop: i
|
|
81
89
|
};
|