@floegence/floe-webapp-core 0.77.0 → 0.77.1
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/remote-pointer.js +14 -14
- package/package.json +1 -1
package/dist/remote-pointer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function U(a) {
|
|
2
|
-
const { surface: l } = a,
|
|
2
|
+
const { surface: l } = a, I = l.ownerDocument, c = I.defaultView;
|
|
3
3
|
if (!c) throw new Error("Remote pointer requires an attached document");
|
|
4
4
|
let o = null, f = null, u = null, p = null, y = 0, z = 0, M = !1, x = !1, D = 0, b = !1;
|
|
5
5
|
const g = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Map(), C = [], w = (e) => !x && a.isTargetValid(e), O = (e, t) => Math.hypot(e.clientX - t.clientX, e.clientY - t.clientY), v = (e) => ({
|
|
@@ -43,7 +43,7 @@ function U(a) {
|
|
|
43
43
|
y = i;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function T(e, t, n, i, s = 1) {
|
|
47
47
|
const m = h.get(i);
|
|
48
48
|
if (!e && !m) return;
|
|
49
49
|
e || h.delete(i);
|
|
@@ -55,14 +55,14 @@ function U(a) {
|
|
|
55
55
|
return a.onActivate?.(e, t), n === D && w(t);
|
|
56
56
|
}
|
|
57
57
|
function Y(e, t, n, i = 1) {
|
|
58
|
-
K(e, t) && (
|
|
58
|
+
K(e, t) && (T(!0, e, t, n, i), T(!1, e, t, n, i));
|
|
59
59
|
}
|
|
60
60
|
function r() {
|
|
61
61
|
D++, H(), y && c.cancelAnimationFrame(y), y = 0;
|
|
62
62
|
const e = /* @__PURE__ */ new Set();
|
|
63
63
|
o && e.add(o.target), f && e.add(f.target), u !== null && e.add(u), f = null, o = null, u = null, p = null, b = g.size > 0;
|
|
64
64
|
for (const [t, n] of h)
|
|
65
|
-
e.add(n.target),
|
|
65
|
+
e.add(n.target), T(!1, n.command, n.target, t);
|
|
66
66
|
for (const t of e) a.release(t);
|
|
67
67
|
for (const t of [...L]) X(t);
|
|
68
68
|
}
|
|
@@ -79,7 +79,7 @@ function U(a) {
|
|
|
79
79
|
const n = v(e);
|
|
80
80
|
if ((t.mode === "pending" || t.mode === "hold") && O(t.origin, n) > 8) {
|
|
81
81
|
const i = t.mode === "hold";
|
|
82
|
-
if (H(), p = null, t.mode = i ? "drag" : "scroll", i && K(t.origin, t.target) &&
|
|
82
|
+
if (H(), p = null, t.mode = i ? "drag" : "scroll", i && K(t.origin, t.target) && T(!0, t.origin, t.target, 0), o !== t) return;
|
|
83
83
|
}
|
|
84
84
|
if (t.mode === "scroll") {
|
|
85
85
|
const i = t.last, s = i.clientX - n.clientX, m = i.clientY - n.clientY;
|
|
@@ -113,9 +113,9 @@ function U(a) {
|
|
|
113
113
|
}
|
|
114
114
|
o && (o.id !== e.pointerId || o.target !== t) && r(), k(), u !== null && (a.release(u), u = null), o = { id: e.pointerId, target: t, origin: n, last: n, mode: "direct" };
|
|
115
115
|
const i = e.button === 0 && p?.target === t && c.performance.now() - p.time <= 350 && O(p.position, n) <= 16;
|
|
116
|
-
K(n, t) &&
|
|
116
|
+
K(n, t) && T(!0, n, t, e.button, Math.max(1, e.detail, i ? 2 : 1));
|
|
117
117
|
}
|
|
118
|
-
B(e.pointerId), e.preventDefault();
|
|
118
|
+
B(e.pointerId), e.pointerType === "touch" && e.preventDefault();
|
|
119
119
|
}), d(l, "pointermove", (e) => {
|
|
120
120
|
if (e.pointerType === "touch") {
|
|
121
121
|
_(e);
|
|
@@ -132,7 +132,7 @@ function U(a) {
|
|
|
132
132
|
o.last = n;
|
|
133
133
|
for (const [i, s] of [[0, 1], [1, 4], [2, 2], [3, 8], [4, 16]]) {
|
|
134
134
|
const m = !!(e.buttons & s);
|
|
135
|
-
m !== h.has(i) && (k(),
|
|
135
|
+
m !== h.has(i) && (k(), T(m, n, t, i));
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
E({ ...n, kind: "move" }, t);
|
|
@@ -146,12 +146,12 @@ function U(a) {
|
|
|
146
146
|
if (t.mode === "pending") {
|
|
147
147
|
const i = c.performance.now(), s = p?.target === t.target && i - p.time <= 350 && O(p.position, n) <= 16;
|
|
148
148
|
Y(n, t.target, 0, s ? 2 : 1), p = s ? null : { target: t.target, position: n, time: i };
|
|
149
|
-
} else t.mode === "hold" ? (p = null, Y(n, t.target, 2)) : (k(), t.mode === "drag" &&
|
|
149
|
+
} else t.mode === "hold" ? (p = null, Y(n, t.target, 2)) : (k(), t.mode === "drag" && T(!1, n, t.target, 0));
|
|
150
150
|
a.release(t.target), o = null;
|
|
151
151
|
} else {
|
|
152
152
|
f?.command.kind === "move" && (f.command = { ...v(e), kind: "move" }), k();
|
|
153
153
|
const n = h.get(e.button)?.command;
|
|
154
|
-
for (const i of [...h.keys()])
|
|
154
|
+
for (const i of [...h.keys()]) T(!1, v(e), t.target, i, n && "clicks" in n ? n.clicks : 1);
|
|
155
155
|
p = e.button === 0 && n && "clicks" in n && n.clicks === 1 && O(t.origin, v(e)) <= 8 ? { target: t.target, position: v(e), time: c.performance.now() } : null, h.size || (o = null);
|
|
156
156
|
}
|
|
157
157
|
(!o || o.id !== e.pointerId) && S(e.pointerId);
|
|
@@ -159,9 +159,9 @@ function U(a) {
|
|
|
159
159
|
r(), S(e.pointerId);
|
|
160
160
|
}), d(l, "lostpointercapture", (e) => {
|
|
161
161
|
L.has(e.pointerId) && (r(), S(e.pointerId));
|
|
162
|
-
}), d(
|
|
162
|
+
}), d(I, "pointerup", (e) => {
|
|
163
163
|
o?.id !== e.pointerId && S(e.pointerId);
|
|
164
|
-
}), d(
|
|
164
|
+
}), d(I, "pointercancel", (e) => S(e.pointerId)), d(I, "pointerdown", (e) => {
|
|
165
165
|
o && (e.pointerType === "touch" && e.pointerId !== o.id ? (g.add(e.pointerId), r()) : l.contains(e.target) || r());
|
|
166
166
|
}, !0), d(l, "wheel", (e) => {
|
|
167
167
|
const t = a.resolveTarget(e);
|
|
@@ -175,8 +175,8 @@ function U(a) {
|
|
|
175
175
|
a.resolveTarget(t) !== null && t.preventDefault();
|
|
176
176
|
});
|
|
177
177
|
for (const e of ["blur", "pagehide", "resize", "orientationchange"]) d(c, e, r);
|
|
178
|
-
if (d(
|
|
179
|
-
|
|
178
|
+
if (d(I, "visibilitychange", () => {
|
|
179
|
+
I.hidden && r();
|
|
180
180
|
}), d(c, "scroll", r, !0), c.visualViewport && (d(c.visualViewport, "resize", r), d(c.visualViewport, "scroll", r)), typeof ResizeObserver < "u") {
|
|
181
181
|
let e = `${l.clientWidth}:${l.clientHeight}`;
|
|
182
182
|
const t = new ResizeObserver(() => {
|