@nvidia-elements/core 2.8.1 → 2.9.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/CHANGELOG.md +11 -0
- package/dist/accordion/accordion2.js +4 -4
- package/dist/alert/alert-group2.js +1 -1
- package/dist/alert/alert2.js +1 -1
- package/dist/avatar/avatar-group2.js +1 -1
- package/dist/avatar/avatar2.js +1 -1
- package/dist/badge/badge2.js +1 -1
- package/dist/breadcrumb/breadcrumb2.js +1 -1
- package/dist/bundle.d.ts +2 -0
- package/dist/bundles/index.d.ts +205 -0
- package/dist/bundles/index.js +6 -6
- package/dist/button/button2.js +1 -1
- package/dist/button-group/button-group2.js +1 -1
- package/dist/card/card2.js +4 -4
- package/dist/chat-message/chat-message2.js +1 -1
- package/dist/checkbox/checkbox-group2.js +1 -1
- package/dist/checkbox/checkbox2.js +1 -1
- package/dist/color/color2.js +1 -1
- package/dist/combobox/combobox2.js +1 -1
- package/dist/copy-button/copy-button2.js +1 -1
- package/dist/custom-elements-jsx.d.ts +109 -0
- package/dist/custom-elements-vue.d.ts +107 -0
- package/dist/custom-elements.json +3321 -66
- package/dist/data.html.json +94 -0
- package/dist/data.snippets.json +45 -45
- package/dist/date/date2.js +1 -1
- package/dist/datetime/datetime2.js +1 -1
- package/dist/dialog/dialog-footer2.js +1 -1
- package/dist/dialog/dialog-header2.js +1 -1
- package/dist/dialog/dialog2.js +1 -1
- package/dist/divider/divider2.js +1 -1
- package/dist/dot/dot2.js +1 -1
- package/dist/drawer/drawer-content2.js +1 -1
- package/dist/drawer/drawer-footer2.js +1 -1
- package/dist/drawer/drawer-header2.js +1 -1
- package/dist/drawer/drawer2.js +1 -1
- package/dist/dropdown/dropdown-footer2.js +1 -1
- package/dist/dropdown/dropdown-header2.js +1 -1
- package/dist/dropdown/dropdown2.js +1 -1
- package/dist/dropdown-group/dropdown-group.js +1 -1
- package/dist/dropzone/dropzone2.js +1 -1
- package/dist/file/file2.js +1 -1
- package/dist/format-bytes/format-bytes2.js +1 -1
- package/dist/format-datetime/format-datetime2.js +1 -1
- package/dist/format-number/format-number2.js +1 -1
- package/dist/format-relative-time/format-relative-time2.js +1 -1
- package/dist/format-truncate/format-truncate2.js +1 -1
- package/dist/forms/control/control2.js +1 -1
- package/dist/forms/control-group/control-group2.js +1 -1
- package/dist/forms/control-message/control-message2.js +1 -1
- package/dist/gauge/gauge2.js +1 -1
- package/dist/grid/cell/cell2.js +1 -1
- package/dist/grid/column/column2.js +1 -1
- package/dist/grid/footer/footer2.js +1 -1
- package/dist/grid/grid2.js +1 -1
- package/dist/grid/header/header2.js +1 -1
- package/dist/grid/placeholder/placeholder2.js +1 -1
- package/dist/grid/row/row2.js +1 -1
- package/dist/icon/icon2.js +2 -2
- package/dist/icon-button/icon-button2.js +1 -1
- package/dist/index.js +1 -1
- package/dist/input/input-group2.js +1 -1
- package/dist/input/input2.js +1 -1
- package/dist/internal/controllers/gesture.controller.d.ts +122 -42
- package/dist/internal/controllers/gesture.controller.examples.js.map +1 -1
- package/dist/internal/controllers/gesture.controller.examples.json +2 -2
- package/dist/internal/controllers/gesture.controller.js +300 -159
- package/dist/internal/controllers/gesture.controller.js.map +1 -1
- package/dist/internal/controllers/key-state.controller.d.ts +18 -0
- package/dist/internal/controllers/key-state.controller.js +84 -0
- package/dist/internal/controllers/key-state.controller.js.map +1 -0
- package/dist/internal/controllers/keynav-spatial.controller.d.ts +4 -1
- package/dist/internal/controllers/keynav-spatial.controller.js +7 -6
- package/dist/internal/controllers/keynav-spatial.controller.js.map +1 -1
- package/dist/internal/index.d.ts +2 -0
- package/dist/internal/index.js +29 -27
- package/dist/internal/services/global.service.js +1 -1
- package/dist/internal/utils/dom.d.ts +1 -0
- package/dist/internal/utils/dom.js +42 -38
- package/dist/internal/utils/dom.js.map +1 -1
- package/dist/internal/utils/focus.d.ts +2 -0
- package/dist/internal/utils/focus.js +14 -7
- package/dist/internal/utils/focus.js.map +1 -1
- package/dist/internal/utils/numeric.d.ts +3 -0
- package/dist/internal/utils/numeric.js +14 -0
- package/dist/internal/utils/numeric.js.map +1 -0
- package/dist/logo/logo2.js +1 -1
- package/dist/menu/menu-item2.js +1 -1
- package/dist/menu/menu2.js +1 -1
- package/dist/month/month2.js +1 -1
- package/dist/notification/notification-group2.js +1 -1
- package/dist/notification/notification2.js +1 -1
- package/dist/page/page-panel/page-panel-content2.js +1 -1
- package/dist/page/page-panel/page-panel-footer2.js +1 -1
- package/dist/page/page-panel/page-panel-header2.js +1 -1
- package/dist/page/page-panel/page-panel2.js +1 -1
- package/dist/page/page2.js +1 -1
- package/dist/page-header/page-header2.js +1 -1
- package/dist/page-loader/page-loader2.js +1 -1
- package/dist/pagination/pagination2.js +1 -1
- package/dist/panel/panel2.js +4 -4
- package/dist/password/password2.js +1 -1
- package/dist/preferences-input/preferences-input2.js +1 -1
- package/dist/progress-bar/progress-bar2.js +1 -1
- package/dist/progress-ring/progress-ring2.js +1 -1
- package/dist/progressive-filter-chip/progressive-filter-chip2.js +1 -1
- package/dist/pulse/pulse2.js +1 -1
- package/dist/radio/radio-group2.js +1 -1
- package/dist/radio/radio2.js +1 -1
- package/dist/range/range2.js +1 -1
- package/dist/resize-handle/resize-handle2.js +6 -10
- package/dist/resize-handle/resize-handle2.js.map +1 -1
- package/dist/search/search2.js +1 -1
- package/dist/select/select2.js +1 -1
- package/dist/skeleton/skeleton2.js +1 -1
- package/dist/sort-button/sort-button2.js +1 -1
- package/dist/sparkline/sparkline2.js +1 -1
- package/dist/star-rating/star-rating2.js +1 -1
- package/dist/steps/steps2.js +2 -2
- package/dist/switch/switch-group2.js +1 -1
- package/dist/switch/switch2.js +1 -1
- package/dist/tabs/tabs-group2.js +1 -1
- package/dist/tabs/tabs2.js +2 -2
- package/dist/tag/tag2.js +1 -1
- package/dist/textarea/textarea2.js +1 -1
- package/dist/time/time2.js +1 -1
- package/dist/toast/toast2.js +1 -1
- package/dist/toggletip/toggletip-footer2.js +1 -1
- package/dist/toggletip/toggletip-header2.js +1 -1
- package/dist/toggletip/toggletip2.js +1 -1
- package/dist/toolbar/toolbar2.js +1 -1
- package/dist/tooltip/tooltip2.js +1 -1
- package/dist/tree/tree-node2.js +1 -1
- package/dist/tree/tree2.js +1 -1
- package/dist/viewport/define.d.ts +7 -0
- package/dist/viewport/define.js +7 -0
- package/dist/viewport/define.js.map +1 -0
- package/dist/viewport/index.d.ts +3 -0
- package/dist/viewport/index.js +3 -0
- package/dist/viewport/viewport-animation.controller.d.ts +21 -0
- package/dist/viewport/viewport-animation.controller.js +93 -0
- package/dist/viewport/viewport-animation.controller.js.map +1 -0
- package/dist/viewport/viewport-autofit.controller.d.ts +18 -0
- package/dist/viewport/viewport-autofit.controller.js +105 -0
- package/dist/viewport/viewport-autofit.controller.js.map +1 -0
- package/dist/viewport/viewport-fitting.utils.d.ts +36 -0
- package/dist/viewport/viewport-fitting.utils.js +35 -0
- package/dist/viewport/viewport-fitting.utils.js.map +1 -0
- package/dist/viewport/viewport-gesture-navigation.controller.d.ts +29 -0
- package/dist/viewport/viewport-gesture-navigation.controller.js +311 -0
- package/dist/viewport/viewport-gesture-navigation.controller.js.map +1 -0
- package/dist/viewport/viewport-gridlines.d.ts +38 -0
- package/dist/viewport/viewport-gridlines.js +6 -0
- package/dist/viewport/viewport-gridlines.js.map +1 -0
- package/dist/viewport/viewport-gridlines.utils.d.ts +11 -0
- package/dist/viewport/viewport-gridlines.utils.js +54 -0
- package/dist/viewport/viewport-gridlines.utils.js.map +1 -0
- package/dist/viewport/viewport-gridlines2.js +154 -0
- package/dist/viewport/viewport-gridlines2.js.map +1 -0
- package/dist/viewport/viewport-navigation.controller.d.ts +27 -0
- package/dist/viewport/viewport-navigation.controller.js +142 -0
- package/dist/viewport/viewport-navigation.controller.js.map +1 -0
- package/dist/viewport/viewport-navigation.types.d.ts +9 -0
- package/dist/viewport/viewport-projection.utils.d.ts +7 -0
- package/dist/viewport/viewport-projection.utils.js +25 -0
- package/dist/viewport/viewport-projection.utils.js.map +1 -0
- package/dist/viewport/viewport.d.ts +92 -0
- package/dist/viewport/viewport.examples.js +6 -0
- package/dist/viewport/viewport.examples.js.map +1 -0
- package/dist/viewport/viewport.examples.json +60 -0
- package/dist/viewport/viewport.js +6 -0
- package/dist/viewport/viewport.js.map +1 -0
- package/dist/viewport/viewport.types.d.ts +66 -0
- package/dist/viewport/viewport2.js +375 -0
- package/dist/viewport/viewport2.js.map +1 -0
- package/dist/week/week2.js +1 -1
- package/package.json +13 -1
|
@@ -1,204 +1,333 @@
|
|
|
1
1
|
//#region src/internal/controllers/gesture.controller.ts
|
|
2
2
|
var e = [
|
|
3
|
-
"auxclick",
|
|
4
|
-
"click",
|
|
5
3
|
"contextmenu",
|
|
4
|
+
"dragstart",
|
|
6
5
|
"lostpointercapture",
|
|
7
6
|
"pointercancel",
|
|
8
7
|
"pointerdown",
|
|
9
8
|
"pointermove",
|
|
10
9
|
"pointerup",
|
|
10
|
+
"selectstart",
|
|
11
11
|
"wheel"
|
|
12
|
-
], t = class {
|
|
12
|
+
], t = .002, n = 10, r = 16, i = class {
|
|
13
|
+
#e;
|
|
14
|
+
constructor(e) {
|
|
15
|
+
this.claim = (e) => {
|
|
16
|
+
let t = this.#e;
|
|
17
|
+
return t ? (this.#e = void 0, t(e), !0) : !1;
|
|
18
|
+
}, this.#e = e;
|
|
19
|
+
}
|
|
20
|
+
close() {
|
|
21
|
+
this.#e = void 0;
|
|
22
|
+
}
|
|
23
|
+
}, a = class {
|
|
13
24
|
#e;
|
|
14
25
|
#t;
|
|
15
|
-
#n = /* @__PURE__ */ new
|
|
16
|
-
#r =
|
|
17
|
-
#i
|
|
26
|
+
#n = /* @__PURE__ */ new Map();
|
|
27
|
+
#r = !1;
|
|
28
|
+
#i;
|
|
18
29
|
#a;
|
|
19
30
|
#o;
|
|
31
|
+
#s;
|
|
20
32
|
constructor(e, t) {
|
|
21
33
|
this.#e = e, this.#t = t, e.addController(this);
|
|
22
34
|
}
|
|
35
|
+
getWheelZoomFactor(e) {
|
|
36
|
+
let r = e.event.ctrlKey ? n : 1;
|
|
37
|
+
return 2 ** (-e.deltaY * t * r);
|
|
38
|
+
}
|
|
23
39
|
set target(e) {
|
|
24
|
-
e !== this.#
|
|
40
|
+
e !== this.#a && (this.#l(), this.#L(), this.#a = e, this.#c());
|
|
25
41
|
}
|
|
26
42
|
hostConnected() {
|
|
27
|
-
this.#
|
|
43
|
+
this.#r = !0, this.#c();
|
|
28
44
|
}
|
|
29
45
|
hostDisconnected() {
|
|
30
|
-
this.#
|
|
46
|
+
this.#l(), this.#L(), this.#r = !1;
|
|
31
47
|
}
|
|
32
|
-
|
|
33
|
-
|
|
48
|
+
hostUpdated() {
|
|
49
|
+
this.#j();
|
|
34
50
|
}
|
|
35
51
|
#c() {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
let t
|
|
40
|
-
|
|
41
|
-
this.#t.prepare?.();
|
|
42
|
-
let n = this.#t.getCapabilities();
|
|
43
|
-
e instanceof WheelEvent ? this.#u(e, n) : e.type === "contextmenu" ? n.pan && e.preventDefault() : e instanceof PointerEvent && this.#d(e, n);
|
|
44
|
-
};
|
|
45
|
-
#u(e, t) {
|
|
46
|
-
let n = this.#o;
|
|
47
|
-
!t.wheel || !n || (this.#w({
|
|
48
|
-
deltaPixels: i(e, n),
|
|
49
|
-
event: e,
|
|
50
|
-
kind: "wheel"
|
|
51
|
-
}), e.preventDefault());
|
|
52
|
-
}
|
|
53
|
-
#d(e, t) {
|
|
54
|
-
switch (e.type) {
|
|
55
|
-
case "auxclick":
|
|
56
|
-
case "click":
|
|
57
|
-
this.#f(e, t);
|
|
58
|
-
break;
|
|
59
|
-
case "lostpointercapture":
|
|
60
|
-
this.#r.delete(e.pointerId), this.#n.delete(e.pointerId), this.#a?.pointerIds.includes(e.pointerId) && (this.#a = void 0), this.#T({
|
|
61
|
-
event: e,
|
|
62
|
-
kind: "lostpointercapture"
|
|
63
|
-
});
|
|
64
|
-
break;
|
|
65
|
-
case "pointercancel":
|
|
66
|
-
this.#r.delete(e.pointerId), this.#n.delete(e.pointerId), this.#a = void 0, this.#T({
|
|
67
|
-
event: e,
|
|
68
|
-
kind: "pointercancel"
|
|
69
|
-
});
|
|
70
|
-
break;
|
|
71
|
-
case "pointerdown":
|
|
72
|
-
this.#p(e, t);
|
|
73
|
-
break;
|
|
74
|
-
case "pointermove":
|
|
75
|
-
this.#h(e, t);
|
|
76
|
-
break;
|
|
77
|
-
case "pointerup": this.#m(e);
|
|
78
|
-
}
|
|
52
|
+
let t = this.#a;
|
|
53
|
+
if (!this.#r || !t) return;
|
|
54
|
+
let n = this.#t.claimPriority !== "descendant-first";
|
|
55
|
+
for (let r of e) t.addEventListener(r, this.#f, n);
|
|
56
|
+
this.#u() && t.addEventListener("pointerdown", this.#d, !0), this.#k(t);
|
|
79
57
|
}
|
|
80
|
-
#
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
#l() {
|
|
59
|
+
let t = this.#a;
|
|
60
|
+
if (!this.#r || !t) return;
|
|
61
|
+
let n = this.#t.claimPriority !== "descendant-first";
|
|
62
|
+
for (let r of e) t.removeEventListener(r, this.#f, n);
|
|
63
|
+
this.#u() && t.removeEventListener("pointerdown", this.#d, !0), this.#A();
|
|
85
64
|
}
|
|
86
|
-
#
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
65
|
+
#u() {
|
|
66
|
+
return this.#t.claimPriority === "descendant-first" && this.#t.shouldReservePointerDown !== void 0;
|
|
67
|
+
}
|
|
68
|
+
#d = (e) => {
|
|
69
|
+
let t = this.#a;
|
|
70
|
+
!t || e.currentTarget !== t || e.defaultPrevented || this.#t.shouldIgnoreEvent?.(e) || this.#t.shouldReservePointerDown?.(e) && e.preventDefault();
|
|
71
|
+
};
|
|
72
|
+
#f = (e) => {
|
|
73
|
+
let t = this.#a;
|
|
74
|
+
if (!(!t || e.currentTarget !== t)) {
|
|
75
|
+
if (e.type === "contextmenu" && e instanceof MouseEvent) {
|
|
76
|
+
this.#m(e);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (e.type === "selectstart") {
|
|
80
|
+
this.#h(e);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (e instanceof WheelEvent) {
|
|
84
|
+
this.#_(e);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (e instanceof PointerEvent) {
|
|
88
|
+
this.#g(e);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
this.#p(e);
|
|
94
92
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
93
|
+
};
|
|
94
|
+
#p(e) {
|
|
95
|
+
e.type !== "dragstart" || this.#t.shouldIgnoreEvent?.(e) || this.#t.suppressNativeDrag && e.preventDefault();
|
|
99
96
|
}
|
|
100
97
|
#m(e) {
|
|
101
|
-
this.#
|
|
102
|
-
let t = this.#n.delete(e.pointerId);
|
|
103
|
-
this.#a?.pointerIds.includes(e.pointerId) && (this.#a = void 0), t ? r(e) : this.#T({
|
|
104
|
-
event: e,
|
|
105
|
-
kind: "pointerup"
|
|
106
|
-
});
|
|
98
|
+
this.#t.shouldIgnoreEvent?.(e) || this.#t.shouldPreventContextMenu?.(e) && e.preventDefault();
|
|
107
99
|
}
|
|
108
|
-
#h(e
|
|
109
|
-
|
|
110
|
-
|
|
100
|
+
#h(e) {
|
|
101
|
+
this.#n.size > 0 && e.preventDefault();
|
|
102
|
+
}
|
|
103
|
+
#g(e) {
|
|
104
|
+
let t = l(e);
|
|
105
|
+
if (t !== void 0) {
|
|
106
|
+
this.#n.has(e.pointerId) && this.#S(e, t);
|
|
111
107
|
return;
|
|
112
108
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
109
|
+
e.type === "pointerdown" ? this.#t.shouldIgnoreEvent?.(e) || this.#v(e) : e.type === "pointermove" && this.#n.has(e.pointerId) && this.#y(e);
|
|
110
|
+
}
|
|
111
|
+
#_(e) {
|
|
112
|
+
let t = this.#a;
|
|
113
|
+
if (!t || this.#t.shouldIgnoreEvent?.(e)) return;
|
|
114
|
+
let n = e.deltaMode === WheelEvent.DOM_DELTA_PAGE ? t.getBoundingClientRect() : void 0, r = d(e.deltaX, e.deltaMode, n?.width), a = d(e.deltaY, e.deltaMode, n?.height), o = new i(() => {
|
|
115
|
+
e.preventDefault(), e.stopPropagation();
|
|
117
116
|
});
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
try {
|
|
118
|
+
this.#I({
|
|
119
|
+
claim: o.claim,
|
|
120
|
+
clientX: e.clientX,
|
|
121
|
+
clientY: e.clientY,
|
|
122
|
+
deltaX: r,
|
|
123
|
+
deltaY: a,
|
|
120
124
|
event: e,
|
|
121
|
-
kind: "
|
|
125
|
+
kind: "wheel"
|
|
126
|
+
});
|
|
127
|
+
} finally {
|
|
128
|
+
o.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
#v(e) {
|
|
132
|
+
let t = new i((t) => {
|
|
133
|
+
this.#n.set(e.pointerId, {
|
|
134
|
+
clientX: e.clientX,
|
|
135
|
+
clientY: e.clientY,
|
|
136
|
+
gestureKind: t?.kind,
|
|
137
|
+
movementX: 0,
|
|
138
|
+
movementY: 0,
|
|
139
|
+
pinchCandidate: t?.pinchCandidate ?? !1,
|
|
140
|
+
pointerType: e.pointerType,
|
|
141
|
+
startClientX: e.clientX,
|
|
142
|
+
startClientY: e.clientY
|
|
122
143
|
});
|
|
123
|
-
|
|
144
|
+
let n = this.#a;
|
|
145
|
+
n && this.#N(n), e.stopPropagation(), this.#O(e.pointerId);
|
|
146
|
+
});
|
|
147
|
+
try {
|
|
148
|
+
this.#I({
|
|
149
|
+
claim: t.claim,
|
|
124
150
|
event: e,
|
|
125
|
-
kind: "
|
|
126
|
-
movementX: i.x,
|
|
127
|
-
movementY: i.y
|
|
151
|
+
kind: "pointerdown"
|
|
128
152
|
});
|
|
153
|
+
} finally {
|
|
154
|
+
t.close();
|
|
129
155
|
}
|
|
156
|
+
this.#T();
|
|
130
157
|
}
|
|
131
|
-
#
|
|
132
|
-
|
|
158
|
+
#y(e) {
|
|
159
|
+
let t = this.#b(e);
|
|
160
|
+
t && (e.stopPropagation(), (t.movementX !== 0 || t.movementY !== 0) && (this.#n.size >= 2 && this.#C(e) || t.gestureKind !== void 0 && (e.preventDefault(), this.#x(e, t, t.gestureKind))));
|
|
161
|
+
}
|
|
162
|
+
#b(e) {
|
|
163
|
+
let t = this.#n.get(e.pointerId);
|
|
164
|
+
if (t) return t.movementX = o(e.clientX, t.clientX), t.movementY = o(e.clientY, t.clientY), t.clientX = e.clientX, t.clientY = e.clientY, t;
|
|
165
|
+
}
|
|
166
|
+
#x(e, t, n) {
|
|
167
|
+
this.#F({
|
|
168
|
+
clientX: t.clientX,
|
|
169
|
+
clientY: t.clientY,
|
|
133
170
|
event: e,
|
|
134
|
-
kind:
|
|
171
|
+
kind: n,
|
|
172
|
+
movementX: t.movementX,
|
|
173
|
+
movementY: t.movementY,
|
|
174
|
+
startClientX: t.startClientX,
|
|
175
|
+
startClientY: t.startClientY,
|
|
176
|
+
totalDisplacementX: o(t.clientX, t.startClientX),
|
|
177
|
+
totalDisplacementY: o(t.clientY, t.startClientY)
|
|
135
178
|
});
|
|
136
179
|
}
|
|
137
|
-
#
|
|
138
|
-
|
|
180
|
+
#S(e, t) {
|
|
181
|
+
let n = this.#n.get(e.pointerId);
|
|
182
|
+
if (!n) return;
|
|
183
|
+
let r = u(t), i = r ? n.clientX : e.clientX, a = r ? n.clientY : e.clientY;
|
|
184
|
+
e.stopPropagation(), this.#I({
|
|
185
|
+
clientX: i,
|
|
186
|
+
clientY: a,
|
|
139
187
|
event: e,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
188
|
+
interrupted: r,
|
|
189
|
+
kind: "pointerend",
|
|
190
|
+
movementX: o(i, n.clientX),
|
|
191
|
+
movementY: o(a, n.clientY),
|
|
192
|
+
startClientX: n.startClientX,
|
|
193
|
+
startClientY: n.startClientY,
|
|
194
|
+
totalDisplacementX: o(i, n.startClientX),
|
|
195
|
+
totalDisplacementY: o(a, n.startClientY),
|
|
196
|
+
reason: t
|
|
197
|
+
}), this.#n.delete(e.pointerId), this.#n.size === 0 && this.#P(), this.#D() < 2 && (this.#i = void 0);
|
|
144
198
|
}
|
|
145
|
-
#
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
let n = {
|
|
153
|
-
x: e.clientX - t.x,
|
|
154
|
-
y: e.clientY - t.y
|
|
155
|
-
};
|
|
156
|
-
return n.x === 0 && n.y === 0 ? void 0 : n;
|
|
199
|
+
#C(e) {
|
|
200
|
+
this.#T(), this.#E();
|
|
201
|
+
let t = this.#i, n = this.#n.get(e.pointerId);
|
|
202
|
+
if (!t || !n?.pinchCandidate) return !1;
|
|
203
|
+
let r = e.pointerId === t.firstPointerId || e.pointerId === t.secondPointerId;
|
|
204
|
+
return t.status === "pending" ? !0 : t.status === "declined" ? !r : !r || this.#w(e, t);
|
|
157
205
|
}
|
|
158
|
-
#
|
|
159
|
-
let t = this.#t.
|
|
160
|
-
if (!
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
pointerIds: n
|
|
169
|
-
}, this.#C(e.pointerId), e.preventDefault(), this.#w({
|
|
170
|
-
context: this.#a.context,
|
|
206
|
+
#w(e, t) {
|
|
207
|
+
let n = this.#n.get(t.firstPointerId), r = this.#n.get(t.secondPointerId);
|
|
208
|
+
if (!n || !r) return !0;
|
|
209
|
+
let i = c(n, r);
|
|
210
|
+
if (i <= 0) return !0;
|
|
211
|
+
let a = s(n.clientX, r.clientX), o = s(n.clientY, r.clientY);
|
|
212
|
+
return e.preventDefault(), this.#F({
|
|
213
|
+
centerClientX: a,
|
|
214
|
+
centerClientY: o,
|
|
215
|
+
context: t.context,
|
|
171
216
|
event: e,
|
|
217
|
+
firstPointerId: t.firstPointerId,
|
|
218
|
+
firstPointerType: t.firstPointerType,
|
|
219
|
+
firstStartClientX: t.firstStartClientX,
|
|
220
|
+
firstStartClientY: t.firstStartClientY,
|
|
172
221
|
kind: "pinch",
|
|
173
|
-
scale:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
222
|
+
scale: i / t.distance,
|
|
223
|
+
secondPointerId: t.secondPointerId,
|
|
224
|
+
secondPointerType: t.secondPointerType,
|
|
225
|
+
secondStartClientX: t.secondStartClientX,
|
|
226
|
+
secondStartClientY: t.secondStartClientY,
|
|
227
|
+
startCenterClientX: t.startCenterClientX,
|
|
228
|
+
startCenterClientY: t.startCenterClientY
|
|
229
|
+
}), !0;
|
|
230
|
+
}
|
|
231
|
+
#T() {
|
|
232
|
+
let e = this.#t.beginPinch;
|
|
233
|
+
if (this.#i || this.#n.size < 2 || !e) return;
|
|
234
|
+
let t, n;
|
|
235
|
+
for (let e of this.#n.keys()) if (this.#n.get(e)?.pinchCandidate) {
|
|
236
|
+
if (t === void 0) t = e;
|
|
237
|
+
else {
|
|
238
|
+
n = e;
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
t !== void 0 && n !== void 0 && (this.#i = {
|
|
243
|
+
firstPointerId: t,
|
|
244
|
+
secondPointerId: n,
|
|
245
|
+
status: "pending"
|
|
246
|
+
}, this.#E());
|
|
187
247
|
}
|
|
188
|
-
#
|
|
189
|
-
let e =
|
|
190
|
-
|
|
248
|
+
#E() {
|
|
249
|
+
let e = this.#i, t = this.#t.beginPinch;
|
|
250
|
+
if (e?.status !== "pending" || !t) return;
|
|
251
|
+
let n = this.#n.get(e.firstPointerId), r = this.#n.get(e.secondPointerId);
|
|
252
|
+
if (!n || !r) return;
|
|
253
|
+
let i = c(n, r);
|
|
254
|
+
if (i <= 0) return;
|
|
255
|
+
let a = {
|
|
256
|
+
firstPointerId: e.firstPointerId,
|
|
257
|
+
firstPointerType: n.pointerType,
|
|
258
|
+
firstStartClientX: n.startClientX,
|
|
259
|
+
firstStartClientY: n.startClientY,
|
|
260
|
+
secondPointerId: e.secondPointerId,
|
|
261
|
+
secondPointerType: r.pointerType,
|
|
262
|
+
secondStartClientX: r.startClientX,
|
|
263
|
+
secondStartClientY: r.startClientY,
|
|
264
|
+
startCenterClientX: s(n.clientX, r.clientX),
|
|
265
|
+
startCenterClientY: s(n.clientY, r.clientY)
|
|
266
|
+
}, o = t(a);
|
|
267
|
+
if (!o) {
|
|
268
|
+
this.#i = {
|
|
269
|
+
firstPointerId: e.firstPointerId,
|
|
270
|
+
secondPointerId: e.secondPointerId,
|
|
271
|
+
status: "declined"
|
|
272
|
+
};
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
this.#i = {
|
|
276
|
+
context: o.context,
|
|
277
|
+
distance: i,
|
|
278
|
+
status: "active",
|
|
279
|
+
...a
|
|
280
|
+
};
|
|
191
281
|
}
|
|
192
|
-
#
|
|
193
|
-
let
|
|
194
|
-
|
|
282
|
+
#D() {
|
|
283
|
+
let e = 0;
|
|
284
|
+
for (let t of this.#n.values()) t.pinchCandidate && (e += 1);
|
|
285
|
+
return e;
|
|
195
286
|
}
|
|
196
|
-
#
|
|
287
|
+
#O(e) {
|
|
197
288
|
try {
|
|
198
|
-
this.#
|
|
289
|
+
this.#a?.setPointerCapture?.(e);
|
|
199
290
|
} catch {}
|
|
200
291
|
}
|
|
201
|
-
#
|
|
292
|
+
#k(e) {
|
|
293
|
+
let t = this.#M();
|
|
294
|
+
t !== void 0 && (this.#o = {
|
|
295
|
+
applied: t,
|
|
296
|
+
priority: e.style.getPropertyPriority("touch-action"),
|
|
297
|
+
target: e,
|
|
298
|
+
value: e.style.getPropertyValue("touch-action")
|
|
299
|
+
}, e.style.setProperty("touch-action", t));
|
|
300
|
+
}
|
|
301
|
+
#A() {
|
|
302
|
+
let e = this.#o;
|
|
303
|
+
this.#o = void 0, !(!e || e.target.style.getPropertyValue("touch-action") !== e.applied) && (e.value ? e.target.style.setProperty("touch-action", e.value, e.priority) : e.target.style.removeProperty("touch-action"));
|
|
304
|
+
}
|
|
305
|
+
#j() {
|
|
306
|
+
let e = this.#a;
|
|
307
|
+
if (!this.#r || !e) return;
|
|
308
|
+
let t = this.#M();
|
|
309
|
+
t !== this.#o?.applied && (this.#A(), t !== void 0 && this.#k(e));
|
|
310
|
+
}
|
|
311
|
+
#M() {
|
|
312
|
+
let e = this.#t.touchAction;
|
|
313
|
+
return typeof e == "function" ? e() : e;
|
|
314
|
+
}
|
|
315
|
+
#N(e) {
|
|
316
|
+
if (this.#s) return;
|
|
317
|
+
let t = "none";
|
|
318
|
+
this.#s = {
|
|
319
|
+
applied: t,
|
|
320
|
+
appliedPriority: "",
|
|
321
|
+
priority: e.style.getPropertyPriority("user-select"),
|
|
322
|
+
target: e,
|
|
323
|
+
value: e.style.getPropertyValue("user-select")
|
|
324
|
+
}, e.style.setProperty("user-select", t, "");
|
|
325
|
+
}
|
|
326
|
+
#P() {
|
|
327
|
+
let e = this.#s;
|
|
328
|
+
this.#s = void 0, !(!e || e.target.style.getPropertyValue("user-select") !== e.applied || e.target.style.getPropertyPriority("user-select") !== e.appliedPriority) && (e.value ? e.target.style.setProperty("user-select", e.value, e.priority) : e.target.style.removeProperty("user-select"));
|
|
329
|
+
}
|
|
330
|
+
#F(e) {
|
|
202
331
|
this.#e.dispatchEvent(new CustomEvent("nve-gesture", {
|
|
203
332
|
bubbles: !1,
|
|
204
333
|
cancelable: !1,
|
|
@@ -206,28 +335,40 @@ var e = [
|
|
|
206
335
|
detail: e
|
|
207
336
|
}));
|
|
208
337
|
}
|
|
209
|
-
#
|
|
210
|
-
this.#e.dispatchEvent(new CustomEvent("nve-
|
|
338
|
+
#I(e) {
|
|
339
|
+
this.#e.dispatchEvent(new CustomEvent("nve-gesture-input", {
|
|
211
340
|
bubbles: !1,
|
|
212
341
|
cancelable: !1,
|
|
213
342
|
composed: !1,
|
|
214
343
|
detail: e
|
|
215
344
|
}));
|
|
216
345
|
}
|
|
217
|
-
#
|
|
218
|
-
this.#
|
|
346
|
+
#L() {
|
|
347
|
+
this.#n.clear(), this.#i = void 0, this.#P();
|
|
219
348
|
}
|
|
220
349
|
};
|
|
221
|
-
function
|
|
222
|
-
return e
|
|
350
|
+
function o(e, t) {
|
|
351
|
+
return e - t;
|
|
352
|
+
}
|
|
353
|
+
function s(e, t) {
|
|
354
|
+
return (e + t) / 2;
|
|
355
|
+
}
|
|
356
|
+
function c(e, t) {
|
|
357
|
+
return Math.hypot(e.clientX - t.clientX, e.clientY - t.clientY);
|
|
358
|
+
}
|
|
359
|
+
function l(e) {
|
|
360
|
+
if (e.type === "pointerup") return "up";
|
|
361
|
+
if (e.type === "pointercancel") return "cancel";
|
|
362
|
+
if (e.type === "lostpointercapture") return "lost-capture";
|
|
363
|
+
if (e.type === "pointermove" && e.buttons === 0) return "buttons-released";
|
|
223
364
|
}
|
|
224
|
-
function
|
|
225
|
-
e
|
|
365
|
+
function u(e) {
|
|
366
|
+
return e === "cancel" || e === "lost-capture";
|
|
226
367
|
}
|
|
227
|
-
function
|
|
228
|
-
return
|
|
368
|
+
function d(e, t, n = 1) {
|
|
369
|
+
return t === WheelEvent.DOM_DELTA_LINE ? e * r : t === WheelEvent.DOM_DELTA_PAGE ? e * n : e;
|
|
229
370
|
}
|
|
230
371
|
//#endregion
|
|
231
|
-
export {
|
|
372
|
+
export { a as GestureController };
|
|
232
373
|
|
|
233
374
|
//# sourceMappingURL=gesture.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gesture.controller.js","names":[],"sources":["../../../src/internal/controllers/gesture.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nconst GESTURE_EVENT_TYPES = [\n 'auxclick',\n 'click',\n 'contextmenu',\n 'lostpointercapture',\n 'pointercancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'wheel'\n] as const;\n\ninterface Point {\n readonly x: number;\n readonly y: number;\n}\n\nexport interface GestureCapabilities {\n readonly drag: boolean;\n readonly pan: boolean;\n readonly pinch: boolean;\n readonly wheel: boolean;\n}\n\ninterface PointerMovementGesture {\n readonly event: PointerEvent;\n readonly movementX: number;\n readonly movementY: number;\n}\n\nexport type Gesture<TPinchContext> =\n | (PointerMovementGesture & { readonly kind: 'drag' })\n | (PointerMovementGesture & { readonly kind: 'pan' })\n | {\n readonly context: TPinchContext;\n readonly event: PointerEvent;\n readonly kind: 'pinch';\n readonly scale: number;\n }\n | {\n readonly deltaPixels: number;\n readonly event: WheelEvent;\n readonly kind: 'wheel';\n };\n\nexport type UnhandledPointerInput =\n | { readonly event: PointerEvent; readonly kind: 'click' }\n | { readonly event: PointerEvent; readonly kind: 'lostpointercapture' }\n | { readonly event: PointerEvent; readonly kind: 'pointercancel' }\n | { readonly event: PointerEvent; readonly kind: 'pointerdown' }\n | { readonly event: PointerEvent; readonly kind: 'pointermove' }\n | { readonly event: PointerEvent; readonly kind: 'pointerup' };\n\nexport interface GestureControllerOptions<TPinchContext = undefined> {\n /** Creates a snapshot of caller state when a pinch begins. Omit this field to disable pinch recognition. */\n readonly createPinchContext?: () => TPinchContext;\n /** Returns the gesture kinds that the controller can recognize for the current input event. */\n readonly getCapabilities: () => GestureCapabilities;\n /** Updates caller state before the controller reads capabilities for a nonignored input event. */\n readonly prepare?: () => void;\n /** Returns whether the controller should skip an input event before preparing or recognizing it. */\n readonly shouldIgnore?: (event: Event) => boolean;\n}\n\ninterface PinchState<TPinchContext> {\n readonly context: TPinchContext;\n readonly distance: number;\n readonly pointerIds: readonly [number, number];\n}\n\ntype GestureHost = EventTarget & ReactiveControllerHost;\n\n/** Recognizes drag, pan, pinch, and wheel input on a dynamically assigned target. */\nexport class GestureController<TPinchContext = undefined> implements ReactiveController {\n readonly #host: GestureHost;\n readonly #options: GestureControllerOptions<TPinchContext>;\n readonly #panPointerIds = new Set<number>();\n readonly #pointerPositions = new Map<number, Point>();\n #connected = false;\n #pinch?: PinchState<TPinchContext>;\n #target?: HTMLElement;\n\n constructor(host: GestureHost, options: GestureControllerOptions<TPinchContext>) {\n this.#host = host;\n this.#options = options;\n host.addController(this);\n }\n\n set target(target: HTMLElement | undefined) {\n if (target === this.#target) return;\n this.#removeTargetListeners();\n this.#resetGestureState();\n this.#target = target;\n this.#addTargetListeners();\n }\n\n hostConnected(): void {\n this.#connected = true;\n this.#addTargetListeners();\n }\n\n hostDisconnected(): void {\n this.#removeTargetListeners();\n this.#resetGestureState();\n this.#connected = false;\n }\n\n #addTargetListeners(): void {\n if (!this.#connected || !this.#target) return;\n for (const type of GESTURE_EVENT_TYPES) this.#target.addEventListener(type, this.#handleEvent, true);\n }\n\n #removeTargetListeners(): void {\n if (!this.#connected || !this.#target) return;\n for (const type of GESTURE_EVENT_TYPES) this.#target.removeEventListener(type, this.#handleEvent, true);\n }\n\n #handleEvent = (event: Event): void => {\n const target = this.#target;\n if (!target || event.currentTarget !== target || this.#options.shouldIgnore?.(event)) return;\n this.#options.prepare?.();\n const capabilities = this.#options.getCapabilities();\n if (event instanceof WheelEvent) {\n this.#handleWheel(event, capabilities);\n } else if (event.type === 'contextmenu') {\n if (capabilities.pan) event.preventDefault();\n } else if (event instanceof PointerEvent) {\n this.#handlePointer(event, capabilities);\n }\n };\n\n #handleWheel(event: WheelEvent, capabilities: GestureCapabilities): void {\n const target = this.#target;\n if (!capabilities.wheel || !target) return;\n this.#dispatchGesture({\n deltaPixels: normalizeWheelDelta(event, target),\n event,\n kind: 'wheel'\n });\n event.preventDefault();\n }\n\n #handlePointer(event: PointerEvent, capabilities: GestureCapabilities): void {\n switch (event.type) {\n case 'auxclick':\n case 'click':\n this.#handleClick(event, capabilities);\n break;\n case 'lostpointercapture':\n this.#pointerPositions.delete(event.pointerId);\n this.#panPointerIds.delete(event.pointerId);\n if (this.#pinch?.pointerIds.includes(event.pointerId)) this.#pinch = undefined;\n this.#dispatchPointerInput({ event, kind: 'lostpointercapture' });\n break;\n case 'pointercancel':\n this.#pointerPositions.delete(event.pointerId);\n this.#panPointerIds.delete(event.pointerId);\n this.#pinch = undefined;\n this.#dispatchPointerInput({ event, kind: 'pointercancel' });\n break;\n case 'pointerdown':\n this.#handlePointerDown(event, capabilities);\n break;\n case 'pointermove':\n this.#handlePointerMove(event, capabilities);\n break;\n case 'pointerup':\n this.#handlePointerUp(event);\n break;\n }\n }\n\n #handleClick(event: PointerEvent, capabilities: GestureCapabilities): void {\n if (event.button === 2 && capabilities.pan) {\n consumePanBoundaryEvent(event);\n } else if (event.type === 'click') {\n this.#dispatchPointerInput({ event, kind: 'click' });\n }\n }\n\n #handlePointerDown(event: PointerEvent, capabilities: GestureCapabilities): void {\n const canPinch = capabilities.pinch && this.#options.createPinchContext !== undefined;\n this.#pointerPositions.set(event.pointerId, { x: event.clientX, y: event.clientY });\n if (event.button === 2 && capabilities.pan) this.#panPointerIds.add(event.pointerId);\n if (hasPointerCapability(capabilities, canPinch)) this.#capturePointer(event.pointerId);\n if (this.#panPointerIds.has(event.pointerId)) {\n consumePanBoundaryEvent(event);\n return;\n }\n if (canPinch) this.#startPinchIfNeeded();\n this.#dispatchPointerInput({ event, kind: 'pointerdown' });\n }\n\n #handlePointerUp(event: PointerEvent): void {\n this.#pointerPositions.delete(event.pointerId);\n const wasPanPointer = this.#panPointerIds.delete(event.pointerId);\n if (this.#pinch?.pointerIds.includes(event.pointerId)) this.#pinch = undefined;\n if (wasPanPointer) {\n consumePanBoundaryEvent(event);\n } else {\n this.#dispatchPointerInput({ event, kind: 'pointerup' });\n }\n }\n\n #handlePointerMove(event: PointerEvent, capabilities: GestureCapabilities): void {\n if (event.buttons === 0) {\n this.#handlePointerButtonsReleased(event);\n return;\n }\n const canPinch = capabilities.pinch && this.#options.createPinchContext !== undefined;\n const movement = this.#updatePointerPosition(event);\n if (!movement || !hasPointerCapability(capabilities, canPinch)) {\n return this.#dispatchPointerInput({ event, kind: 'pointermove' });\n }\n if (this.#handlePanMove(event, movement, capabilities)) return;\n if (this.#pointerPositions.size >= 2 && canPinch && this.#handlePinch(event)) return;\n if (!capabilities.drag) return this.#dispatchPointerInput({ event, kind: 'pointermove' });\n this.#capturePointer(event.pointerId);\n event.preventDefault();\n this.#dispatchGesture({ event, kind: 'drag', movementX: movement.x, movementY: movement.y });\n }\n\n #handlePointerButtonsReleased(event: PointerEvent): void {\n this.#pointerPositions.delete(event.pointerId);\n this.#panPointerIds.delete(event.pointerId);\n this.#pinch = undefined;\n this.#dispatchPointerInput({ event, kind: 'pointermove' });\n }\n\n #handlePanMove(event: PointerEvent, movement: Point, capabilities: GestureCapabilities): boolean {\n if (!capabilities.pan || !this.#panPointerIds.has(event.pointerId)) return false;\n this.#capturePointer(event.pointerId);\n event.preventDefault();\n this.#dispatchGesture({ event, kind: 'pan', movementX: movement.x, movementY: movement.y });\n return true;\n }\n\n #updatePointerPosition(event: PointerEvent): Point | undefined {\n const previous = this.#pointerPositions.get(event.pointerId);\n if (!previous) return undefined;\n this.#pointerPositions.set(event.pointerId, { x: event.clientX, y: event.clientY });\n const movement = { x: event.clientX - previous.x, y: event.clientY - previous.y };\n return movement.x === 0 && movement.y === 0 ? undefined : movement;\n }\n\n #handlePinch(event: PointerEvent): boolean {\n const createPinchContext = this.#options.createPinchContext;\n if (!createPinchContext) return false;\n if (this.#pinch && !this.#pinch.pointerIds.includes(event.pointerId)) return true;\n const pointerIds = this.#pinch?.pointerIds ?? this.#getPinchPointerIds();\n if (!pointerIds) return false;\n const distance = this.#getPointerDistance(pointerIds);\n if (distance === undefined || distance <= 0) return false;\n this.#pinch ??= { context: createPinchContext(), distance, pointerIds };\n this.#capturePointer(event.pointerId);\n event.preventDefault();\n this.#dispatchGesture({\n context: this.#pinch.context,\n event,\n kind: 'pinch',\n scale: distance / this.#pinch.distance\n });\n return true;\n }\n\n #startPinchIfNeeded(): void {\n const createPinchContext = this.#options.createPinchContext;\n if (this.#pointerPositions.size !== 2 || !createPinchContext) return;\n const pointerIds = this.#getPinchPointerIds();\n if (!pointerIds) return;\n const distance = this.#getPointerDistance(pointerIds);\n if (distance !== undefined && distance > 0) {\n this.#pinch = { context: createPinchContext(), distance, pointerIds };\n }\n }\n\n #getPinchPointerIds(): [number, number] | undefined {\n const pointerIds = [...this.#pointerPositions.keys()];\n const first = pointerIds[0];\n const second = pointerIds[1];\n return first === undefined || second === undefined ? undefined : [first, second];\n }\n\n #getPointerDistance(pointerIds: readonly [number, number]): number | undefined {\n const first = this.#pointerPositions.get(pointerIds[0]);\n const second = this.#pointerPositions.get(pointerIds[1]);\n return first && second ? Math.hypot(first.x - second.x, first.y - second.y) : undefined;\n }\n\n #capturePointer(pointerId: number): void {\n try {\n this.#target?.setPointerCapture?.(pointerId);\n } catch {\n // Synthetic test events and browser implementations may not have an active pointer to capture.\n }\n }\n\n #dispatchGesture(gesture: Gesture<TPinchContext>): void {\n this.#host.dispatchEvent(\n new CustomEvent<Gesture<TPinchContext>>('nve-gesture', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: gesture\n })\n );\n }\n\n #dispatchPointerInput(input: UnhandledPointerInput): void {\n this.#host.dispatchEvent(\n new CustomEvent<UnhandledPointerInput>('nve-pointer-input', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: input\n })\n );\n }\n\n #resetGestureState(): void {\n this.#pointerPositions.clear();\n this.#panPointerIds.clear();\n this.#pinch = undefined;\n }\n}\n\nfunction hasPointerCapability(capabilities: GestureCapabilities, canPinch: boolean): boolean {\n return capabilities.drag || capabilities.pan || canPinch;\n}\n\nfunction consumePanBoundaryEvent(event: Event): void {\n event.preventDefault();\n event.stopImmediatePropagation();\n}\n\nfunction normalizeWheelDelta(event: WheelEvent, target: HTMLElement): number {\n if (event.deltaMode === WheelEvent.DOM_DELTA_LINE) return event.deltaY * 16;\n if (event.deltaMode === WheelEvent.DOM_DELTA_PAGE) return event.deltaY * target.getBoundingClientRect().height;\n return event.deltaY;\n}\n"],"mappings":";AAKA,IAAM,IAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GA+Da,IAAb,MAAwF;CACtF;CACA;CACA,qBAA0B,IAAI,IAAY;CAC1C,qBAA6B,IAAI,IAAmB;CACpD,KAAa;CACb;CACA;CAEA,YAAY,GAAmB,GAAkD;EAG/E,AAFA,KAAK,KAAQ,GACb,KAAK,KAAW,GAChB,EAAK,cAAc,IAAI;CACzB;CAEA,IAAI,OAAO,GAAiC;EACtC,MAAW,KAAK,OACpB,KAAK,GAAuB,GAC5B,KAAK,GAAmB,GACxB,KAAK,KAAU,GACf,KAAK,GAAoB;CAC3B;CAEA,gBAAsB;EAEpB,AADA,KAAK,KAAa,IAClB,KAAK,GAAoB;CAC3B;CAEA,mBAAyB;EAGvB,AAFA,KAAK,GAAuB,GAC5B,KAAK,GAAmB,GACxB,KAAK,KAAa;CACpB;CAEA,KAA4B;EACtB,OAAC,KAAK,MAAc,CAAC,KAAK,KAC9B,KAAK,IAAM,KAAQ,GAAqB,KAAK,GAAQ,iBAAiB,GAAM,KAAK,IAAc,EAAI;CACrG;CAEA,KAA+B;EACzB,OAAC,KAAK,MAAc,CAAC,KAAK,KAC9B,KAAK,IAAM,KAAQ,GAAqB,KAAK,GAAQ,oBAAoB,GAAM,KAAK,IAAc,EAAI;CACxG;CAEA,MAAgB,MAAuB;EACrC,IAAM,IAAS,KAAK;EACpB,IAAI,CAAC,KAAU,EAAM,kBAAkB,KAAU,KAAK,GAAS,eAAe,CAAK,GAAG;EACtF,KAAK,GAAS,UAAU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M,GAC7B,KAAK,GAAe,MAAM,GAC1B,KAAK,KAAS,KAAA;CAChB;AACF;AAEA,SAAS,EAAqB,GAAmC,GAA4B;CAC3F,OAAO,EAAa,QAAQ,EAAa,OAAO;AAClD;AAEA,SAAS,EAAwB,GAAoB;CAEnD,AADA,EAAM,eAAe,GACrB,EAAM,yBAAyB;AACjC;AAEA,SAAS,EAAoB,GAAmB,GAA6B;CAG3E,OAFI,EAAM,cAAc,WAAW,iBAAuB,EAAM,SAAS,KACrE,EAAM,cAAc,WAAW,iBAAuB,EAAM,SAAS,EAAO,sBAAsB,CAAC,CAAC,SACjG,EAAM;AACf"}
|
|
1
|
+
{"version":3,"file":"gesture.controller.js","names":[],"sources":["../../../src/internal/controllers/gesture.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ReactiveController, ReactiveControllerHost } from 'lit';\n\nconst GESTURE_EVENT_TYPES = [\n 'contextmenu',\n 'dragstart',\n 'lostpointercapture',\n 'pointercancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'selectstart',\n 'wheel'\n] as const;\n\nconst WHEEL_ZOOM_EXPONENT_PER_PIXEL = 0.002;\n\n/**\n * Browsers expose trackpad pinch as Ctrl-modified wheel input, so Ctrl-wheel uses a higher zoom gain.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/ctrlKey\n */\nconst CTRL_WHEEL_ZOOM_GAIN = 10;\n\nconst WHEEL_LINE_PIXELS = 16;\n\ninterface PointerState {\n clientX: number;\n clientY: number;\n gestureKind: PointerClaimOptions['kind'];\n movementX: number;\n movementY: number;\n pinchCandidate: boolean;\n readonly pointerType: string;\n readonly startClientX: number;\n readonly startClientY: number;\n}\n\nexport interface PointerClaimOptions {\n readonly kind?: 'drag' | 'pan';\n readonly pinchCandidate?: boolean;\n}\n\nexport interface PinchStartDecision<TContext> {\n readonly context: TContext;\n}\n\n/** Coordinates and deltas use CSS pixels; movement is sample-relative and total displacement is start-relative. */\nexport interface PointerMovementGesture {\n readonly event: PointerEvent;\n readonly clientX: number;\n readonly clientY: number;\n readonly movementX: number;\n readonly movementY: number;\n readonly startClientX: number;\n readonly startClientY: number;\n readonly totalDisplacementX: number;\n readonly totalDisplacementY: number;\n}\n\nexport interface PinchStart {\n readonly firstPointerId: number;\n readonly firstPointerType: string;\n readonly firstStartClientX: number;\n readonly firstStartClientY: number;\n readonly secondPointerId: number;\n readonly secondPointerType: string;\n readonly secondStartClientX: number;\n readonly secondStartClientY: number;\n readonly startCenterClientX: number;\n readonly startCenterClientY: number;\n}\n\nexport interface PinchGesture<TContext> extends PinchStart {\n readonly kind: 'pinch';\n readonly event: PointerEvent;\n readonly context: TContext;\n /** Current pointer distance divided by the starting pointer distance. */\n readonly scale: number;\n readonly centerClientX: number;\n readonly centerClientY: number;\n}\n\n/**\n * Per-event wheel input normalized to CSS pixels.\n *\n * Modifier-assisted trackpad pinch remains wheel input: consumers can classify it using the native event's\n * `ctrlKey` or `metaKey` without conflating it with the start-relative lifecycle of a two-pointer pinch.\n */\nexport interface WheelGesture {\n readonly kind: 'wheel';\n readonly event: WheelEvent;\n readonly clientX: number;\n readonly clientY: number;\n readonly deltaX: number;\n readonly deltaY: number;\n}\n\nexport type PointerEndReason = 'up' | 'cancel' | 'lost-capture' | 'buttons-released';\n\nexport interface PointerEndGesture extends PointerMovementGesture {\n readonly kind: 'pointerend';\n /** Whether the pointer session ended without an observed physical release. */\n readonly interrupted: boolean;\n readonly reason: PointerEndReason;\n}\n\nexport type Gesture<TPinchContext> =\n | (PointerMovementGesture & { readonly kind: 'drag' })\n | (PointerMovementGesture & { readonly kind: 'pan' })\n | PinchGesture<TPinchContext>;\n\nexport interface PointerDownInput {\n readonly event: PointerEvent;\n readonly kind: 'pointerdown';\n /**\n * Claims this pointer sequence once during the synchronous input dispatch and suppresses native text selection for\n * its lifetime; returns `false` after that window.\n */\n readonly claim: (options?: PointerClaimOptions) => boolean;\n}\n\nexport interface WheelGestureInput extends WheelGesture {\n /** Claims and prevents this wheel event during the synchronous input dispatch; returns `false` afterward. */\n readonly claim: () => boolean;\n}\n\n/** Claimable starts, claimed pointer terminals, and normalized claimable wheel input. */\nexport type GestureInput = PointerDownInput | PointerEndGesture | WheelGestureInput;\n\n/** Precedence policy for claims among nested GestureController targets. */\nexport type GestureClaimPriority = 'self-first' | 'descendant-first';\n\nexport interface GestureControllerOptions<TPinchContext = undefined> {\n /**\n * Skips admission of a new pointer sequence or a stateless native event.\n * The controller does not consult it again after a pointerdown claim.\n */\n readonly shouldIgnoreEvent?: (event: Event) => boolean;\n /**\n * Consulted once when the controller first observes two claimed pinch candidates.\n * Returning `undefined` declines that pair; otherwise the controller retains the context for its pinch lifetime.\n * The pair remains locked until fewer than two pinch candidates remain.\n */\n readonly beginPinch?: (start: PinchStart) => PinchStartDecision<TPinchContext> | undefined;\n /** Consulted independently for each context-menu event. */\n readonly shouldPreventContextMenu?: (event: MouseEvent) => boolean;\n /**\n * Determines precedence among nested GestureController targets.\n *\n * `self-first` is appropriate for a dedicated interaction surface.\n * `descendant-first` lets nested controllers claim input before this controller.\n *\n * Defaults to `self-first`.\n */\n readonly claimPriority?: GestureClaimPriority;\n /**\n * Consulted during native pointerdown capture before descendant handlers.\n *\n * Returning true calls preventDefault() on the pointerdown, but does not\n * claim the pointer, capture it, stop propagation, create pointer state,\n * suppress selection, or start a gesture.\n *\n * This is meaningful with `claimPriority: 'descendant-first'`. It lets an\n * activated higher-level interaction mode reserve a sequence for ordinary\n * target-phase application code while preserving nested GestureController\n * claim priority.\n */\n readonly shouldReservePointerDown?: (event: PointerEvent) => boolean;\n /** Prevents native HTML drag competition on a dedicated interaction surface. */\n readonly suppressNativeDrag?: boolean;\n /**\n * Inline `touch-action` for a dedicated interaction surface. The controller reevaluates a callback after host updates.\n * Restores the target's prior inline value afterward.\n * Avoid applying it to a general root that contains native interactive content.\n */\n readonly touchAction?: string | (() => string | undefined);\n}\n\ninterface PinchPair {\n readonly firstPointerId: number;\n readonly secondPointerId: number;\n}\n\ninterface PendingPinchState extends PinchPair {\n readonly status: 'pending';\n}\n\ninterface DeclinedPinchState extends PinchPair {\n readonly status: 'declined';\n}\n\ninterface ActivePinchState<TPinchContext> extends PinchPair, PinchStart {\n readonly context: TPinchContext;\n readonly distance: number;\n readonly status: 'active';\n}\n\ntype PinchState<TPinchContext> = PendingPinchState | DeclinedPinchState | ActivePinchState<TPinchContext>;\n\ninterface TouchActionState {\n readonly applied: string;\n readonly priority: string;\n readonly target: HTMLElement;\n readonly value: string;\n}\n\ninterface UserSelectState {\n readonly applied: string;\n readonly appliedPriority: string;\n readonly priority: string;\n readonly target: HTMLElement;\n readonly value: string;\n}\n\nclass SynchronousClaim<TOptions = void> {\n #action?: (options?: TOptions) => void;\n\n constructor(action: (options?: TOptions) => void) {\n this.#action = action;\n }\n\n readonly claim = (options?: TOptions): boolean => {\n const action = this.#action;\n if (!action) return false;\n this.#action = undefined;\n action(options);\n return true;\n };\n\n close(): void {\n this.#action = undefined;\n }\n}\n\ntype GestureHost = EventTarget & ReactiveControllerHost;\n\n/**\n * Normalizes claimable platform pointer and wheel input on a dynamically assigned target.\n * A pointer claim owns native input competition for its lifetime: the controller prevents claimed movement and text\n * selection, and can suppress native drag when configured.\n */\nexport class GestureController<TPinchContext = undefined> implements ReactiveController {\n readonly #host: GestureHost;\n readonly #options: GestureControllerOptions<TPinchContext>;\n readonly #pointerStates = new Map<number, PointerState>();\n #connected = false;\n #pinch?: PinchState<TPinchContext>;\n #target?: HTMLElement;\n #touchActionState?: TouchActionState;\n #userSelectState?: UserSelectState;\n\n constructor(host: GestureHost, options: GestureControllerOptions<TPinchContext>) {\n this.#host = host;\n this.#options = options;\n host.addController(this);\n }\n\n getWheelZoomFactor(input: Pick<WheelGesture, 'deltaY' | 'event'>): number {\n const gain = input.event.ctrlKey ? CTRL_WHEEL_ZOOM_GAIN : 1;\n return 2 ** (-input.deltaY * WHEEL_ZOOM_EXPONENT_PER_PIXEL * gain);\n }\n\n set target(target: HTMLElement | undefined) {\n if (target === this.#target) return;\n this.#removeTargetListeners();\n this.#resetGestureState();\n this.#target = target;\n this.#addTargetListeners();\n }\n\n hostConnected(): void {\n this.#connected = true;\n this.#addTargetListeners();\n }\n\n hostDisconnected(): void {\n this.#removeTargetListeners();\n this.#resetGestureState();\n this.#connected = false;\n }\n\n hostUpdated(): void {\n this.#syncTouchAction();\n }\n\n #addTargetListeners(): void {\n const target = this.#target;\n if (!this.#connected || !target) return;\n const capture = this.#options.claimPriority !== 'descendant-first';\n for (const type of GESTURE_EVENT_TYPES) target.addEventListener(type, this.#handleEvent, capture);\n if (this.#shouldListenForPointerDownReservation()) {\n target.addEventListener('pointerdown', this.#handlePointerDownReservation, true);\n }\n this.#applyTouchAction(target);\n }\n\n #removeTargetListeners(): void {\n const target = this.#target;\n if (!this.#connected || !target) return;\n const capture = this.#options.claimPriority !== 'descendant-first';\n for (const type of GESTURE_EVENT_TYPES) target.removeEventListener(type, this.#handleEvent, capture);\n if (this.#shouldListenForPointerDownReservation()) {\n target.removeEventListener('pointerdown', this.#handlePointerDownReservation, true);\n }\n this.#restoreTouchAction();\n }\n\n #shouldListenForPointerDownReservation(): boolean {\n return this.#options.claimPriority === 'descendant-first' && this.#options.shouldReservePointerDown !== undefined;\n }\n\n #handlePointerDownReservation = (event: PointerEvent): void => {\n const target = this.#target;\n if (\n !target ||\n event.currentTarget !== target ||\n event.defaultPrevented ||\n this.#options.shouldIgnoreEvent?.(event)\n ) {\n return;\n }\n if (this.#options.shouldReservePointerDown?.(event)) event.preventDefault();\n };\n\n #handleEvent = (event: Event): void => {\n const target = this.#target;\n if (!target || event.currentTarget !== target) return;\n if (event.type === 'contextmenu' && event instanceof MouseEvent) {\n this.#handleContextMenu(event);\n return;\n }\n if (event.type === 'selectstart') {\n this.#handleSelectStart(event);\n return;\n }\n if (event instanceof WheelEvent) {\n this.#handleWheel(event);\n return;\n }\n if (event instanceof PointerEvent) {\n this.#handlePointerEvent(event);\n return;\n }\n this.#handleNativeDrag(event);\n };\n\n #handleNativeDrag(event: Event): void {\n if (event.type !== 'dragstart' || this.#options.shouldIgnoreEvent?.(event)) return;\n if (this.#options.suppressNativeDrag) event.preventDefault();\n }\n\n #handleContextMenu(event: MouseEvent): void {\n if (this.#options.shouldIgnoreEvent?.(event)) return;\n if (this.#options.shouldPreventContextMenu?.(event)) event.preventDefault();\n }\n\n #handleSelectStart(event: Event): void {\n if (this.#pointerStates.size > 0) event.preventDefault();\n }\n\n #handlePointerEvent(event: PointerEvent): void {\n const reason = getPointerEndReason(event);\n if (reason !== undefined) {\n if (this.#pointerStates.has(event.pointerId)) this.#endPointer(event, reason);\n return;\n }\n if (event.type === 'pointerdown') {\n if (!this.#options.shouldIgnoreEvent?.(event)) this.#handlePointerDown(event);\n } else if (event.type === 'pointermove' && this.#pointerStates.has(event.pointerId)) {\n this.#handlePointerMove(event);\n }\n }\n\n #handleWheel(event: WheelEvent): void {\n const target = this.#target;\n if (!target || this.#options.shouldIgnoreEvent?.(event)) return;\n const pageBounds = event.deltaMode === WheelEvent.DOM_DELTA_PAGE ? target.getBoundingClientRect() : undefined;\n const deltaX = normalizeWheelDelta(event.deltaX, event.deltaMode, pageBounds?.width);\n const deltaY = normalizeWheelDelta(event.deltaY, event.deltaMode, pageBounds?.height);\n const claimWindow = new SynchronousClaim(() => {\n event.preventDefault();\n event.stopPropagation();\n });\n try {\n this.#dispatchGestureInput({\n claim: claimWindow.claim,\n clientX: event.clientX,\n clientY: event.clientY,\n deltaX,\n deltaY,\n event,\n kind: 'wheel'\n });\n } finally {\n claimWindow.close();\n }\n }\n\n #handlePointerDown(event: PointerEvent): void {\n const claimWindow = new SynchronousClaim<PointerClaimOptions>(options => {\n this.#pointerStates.set(event.pointerId, {\n clientX: event.clientX,\n clientY: event.clientY,\n gestureKind: options?.kind,\n movementX: 0,\n movementY: 0,\n pinchCandidate: options?.pinchCandidate ?? false,\n pointerType: event.pointerType,\n startClientX: event.clientX,\n startClientY: event.clientY\n });\n const target = this.#target;\n if (target) this.#applyUserSelect(target);\n event.stopPropagation();\n this.#capturePointer(event.pointerId);\n });\n try {\n this.#dispatchGestureInput({ claim: claimWindow.claim, event, kind: 'pointerdown' });\n } finally {\n claimWindow.close();\n }\n this.#startPinchIfNeeded();\n }\n\n #handlePointerMove(event: PointerEvent): void {\n const pointerState = this.#updatePointerPosition(event);\n if (!pointerState) return;\n event.stopPropagation();\n if (pointerState.movementX === 0 && pointerState.movementY === 0) return;\n if (this.#pointerStates.size >= 2 && this.#handlePinch(event)) return;\n if (pointerState.gestureKind === undefined) return;\n event.preventDefault();\n this.#dispatchPointerMovementGesture(event, pointerState, pointerState.gestureKind);\n }\n\n #updatePointerPosition(event: PointerEvent): PointerState | undefined {\n const pointerState = this.#pointerStates.get(event.pointerId);\n if (!pointerState) return undefined;\n pointerState.movementX = calculateDisplacement(event.clientX, pointerState.clientX);\n pointerState.movementY = calculateDisplacement(event.clientY, pointerState.clientY);\n pointerState.clientX = event.clientX;\n pointerState.clientY = event.clientY;\n return pointerState;\n }\n\n #dispatchPointerMovementGesture(event: PointerEvent, pointerState: PointerState, kind: 'drag' | 'pan'): void {\n this.#dispatchGesture({\n clientX: pointerState.clientX,\n clientY: pointerState.clientY,\n event,\n kind,\n movementX: pointerState.movementX,\n movementY: pointerState.movementY,\n startClientX: pointerState.startClientX,\n startClientY: pointerState.startClientY,\n totalDisplacementX: calculateDisplacement(pointerState.clientX, pointerState.startClientX),\n totalDisplacementY: calculateDisplacement(pointerState.clientY, pointerState.startClientY)\n });\n }\n\n #endPointer(event: PointerEvent, reason: PointerEndReason): void {\n const pointerState = this.#pointerStates.get(event.pointerId);\n if (!pointerState) return;\n const interrupted = isPointerEndInterrupted(reason);\n const clientX = interrupted ? pointerState.clientX : event.clientX;\n const clientY = interrupted ? pointerState.clientY : event.clientY;\n event.stopPropagation();\n this.#dispatchGestureInput({\n clientX,\n clientY,\n event,\n interrupted,\n kind: 'pointerend',\n movementX: calculateDisplacement(clientX, pointerState.clientX),\n movementY: calculateDisplacement(clientY, pointerState.clientY),\n startClientX: pointerState.startClientX,\n startClientY: pointerState.startClientY,\n totalDisplacementX: calculateDisplacement(clientX, pointerState.startClientX),\n totalDisplacementY: calculateDisplacement(clientY, pointerState.startClientY),\n reason\n });\n this.#pointerStates.delete(event.pointerId);\n if (this.#pointerStates.size === 0) this.#restoreUserSelect();\n if (this.#countPinchCandidates() < 2) this.#pinch = undefined;\n }\n\n #handlePinch(event: PointerEvent): boolean {\n this.#startPinchIfNeeded();\n this.#beginPendingPinchIfPossible();\n const pinch = this.#pinch;\n const pointerState = this.#pointerStates.get(event.pointerId);\n if (!pinch || !pointerState?.pinchCandidate) return false;\n const isPairPointer = event.pointerId === pinch.firstPointerId || event.pointerId === pinch.secondPointerId;\n if (pinch.status === 'pending') return true;\n if (pinch.status === 'declined') return !isPairPointer;\n if (!isPairPointer) return true;\n return this.#dispatchActivePinch(event, pinch);\n }\n\n #dispatchActivePinch(event: PointerEvent, pinch: ActivePinchState<TPinchContext>): boolean {\n const first = this.#pointerStates.get(pinch.firstPointerId);\n const second = this.#pointerStates.get(pinch.secondPointerId);\n if (!first || !second) return true;\n const distance = calculatePointerDistance(first, second);\n if (distance <= 0) return true;\n const centerClientX = calculateMidpoint(first.clientX, second.clientX);\n const centerClientY = calculateMidpoint(first.clientY, second.clientY);\n event.preventDefault();\n this.#dispatchGesture({\n centerClientX,\n centerClientY,\n context: pinch.context,\n event,\n firstPointerId: pinch.firstPointerId,\n firstPointerType: pinch.firstPointerType,\n firstStartClientX: pinch.firstStartClientX,\n firstStartClientY: pinch.firstStartClientY,\n kind: 'pinch',\n scale: distance / pinch.distance,\n secondPointerId: pinch.secondPointerId,\n secondPointerType: pinch.secondPointerType,\n secondStartClientX: pinch.secondStartClientX,\n secondStartClientY: pinch.secondStartClientY,\n startCenterClientX: pinch.startCenterClientX,\n startCenterClientY: pinch.startCenterClientY\n });\n return true;\n }\n\n #startPinchIfNeeded(): void {\n const beginPinch = this.#options.beginPinch;\n if (this.#pinch || this.#pointerStates.size < 2 || !beginPinch) return;\n let firstPointerId: number | undefined;\n let secondPointerId: number | undefined;\n for (const pointerId of this.#pointerStates.keys()) {\n if (!this.#pointerStates.get(pointerId)?.pinchCandidate) continue;\n if (firstPointerId === undefined) firstPointerId = pointerId;\n else {\n secondPointerId = pointerId;\n break;\n }\n }\n if (firstPointerId === undefined || secondPointerId === undefined) return;\n this.#pinch = { firstPointerId, secondPointerId, status: 'pending' };\n this.#beginPendingPinchIfPossible();\n }\n\n #beginPendingPinchIfPossible(): void {\n const pinch = this.#pinch;\n const beginPinch = this.#options.beginPinch;\n if (pinch?.status !== 'pending' || !beginPinch) return;\n const first = this.#pointerStates.get(pinch.firstPointerId);\n const second = this.#pointerStates.get(pinch.secondPointerId);\n if (!first || !second) return;\n const distance = calculatePointerDistance(first, second);\n if (distance <= 0) return;\n const start: PinchStart = {\n firstPointerId: pinch.firstPointerId,\n firstPointerType: first.pointerType,\n firstStartClientX: first.startClientX,\n firstStartClientY: first.startClientY,\n secondPointerId: pinch.secondPointerId,\n secondPointerType: second.pointerType,\n secondStartClientX: second.startClientX,\n secondStartClientY: second.startClientY,\n startCenterClientX: calculateMidpoint(first.clientX, second.clientX),\n startCenterClientY: calculateMidpoint(first.clientY, second.clientY)\n };\n const decision = beginPinch(start);\n if (!decision) {\n this.#pinch = {\n firstPointerId: pinch.firstPointerId,\n secondPointerId: pinch.secondPointerId,\n status: 'declined'\n };\n return;\n }\n this.#pinch = {\n context: decision.context,\n distance,\n status: 'active',\n ...start\n };\n }\n\n #countPinchCandidates(): number {\n let count = 0;\n for (const pointerState of this.#pointerStates.values()) {\n if (pointerState.pinchCandidate) count += 1;\n }\n return count;\n }\n\n #capturePointer(pointerId: number): void {\n try {\n this.#target?.setPointerCapture?.(pointerId);\n } catch {\n // Synthetic test events and browser implementations may not have an active pointer to capture.\n }\n }\n\n #applyTouchAction(target: HTMLElement): void {\n const touchAction = this.#getTouchAction();\n if (touchAction === undefined) return;\n this.#touchActionState = {\n applied: touchAction,\n priority: target.style.getPropertyPriority('touch-action'),\n target,\n value: target.style.getPropertyValue('touch-action')\n };\n target.style.setProperty('touch-action', touchAction);\n }\n\n #restoreTouchAction(): void {\n const state = this.#touchActionState;\n this.#touchActionState = undefined;\n if (!state || state.target.style.getPropertyValue('touch-action') !== state.applied) return;\n if (state.value) {\n state.target.style.setProperty('touch-action', state.value, state.priority);\n } else {\n state.target.style.removeProperty('touch-action');\n }\n }\n\n #syncTouchAction(): void {\n const target = this.#target;\n if (!this.#connected || !target) return;\n const touchAction = this.#getTouchAction();\n if (touchAction === this.#touchActionState?.applied) return;\n this.#restoreTouchAction();\n if (touchAction !== undefined) this.#applyTouchAction(target);\n }\n\n #getTouchAction(): string | undefined {\n const touchAction = this.#options.touchAction;\n return typeof touchAction === 'function' ? touchAction() : touchAction;\n }\n\n #applyUserSelect(target: HTMLElement): void {\n if (this.#userSelectState) return;\n const applied = 'none';\n const appliedPriority = '';\n this.#userSelectState = {\n applied,\n appliedPriority,\n priority: target.style.getPropertyPriority('user-select'),\n target,\n value: target.style.getPropertyValue('user-select')\n };\n target.style.setProperty('user-select', applied, appliedPriority);\n }\n\n #restoreUserSelect(): void {\n const state = this.#userSelectState;\n this.#userSelectState = undefined;\n if (\n !state ||\n state.target.style.getPropertyValue('user-select') !== state.applied ||\n state.target.style.getPropertyPriority('user-select') !== state.appliedPriority\n ) {\n return;\n }\n if (state.value) {\n state.target.style.setProperty('user-select', state.value, state.priority);\n } else {\n state.target.style.removeProperty('user-select');\n }\n }\n\n #dispatchGesture(gesture: Gesture<TPinchContext>): void {\n this.#host.dispatchEvent(\n new CustomEvent<Gesture<TPinchContext>>('nve-gesture', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: gesture\n })\n );\n }\n\n #dispatchGestureInput(input: GestureInput): void {\n this.#host.dispatchEvent(\n new CustomEvent<GestureInput>('nve-gesture-input', {\n bubbles: false,\n cancelable: false,\n composed: false,\n detail: input\n })\n );\n }\n\n #resetGestureState(): void {\n this.#pointerStates.clear();\n this.#pinch = undefined;\n this.#restoreUserSelect();\n }\n}\n\nfunction calculateDisplacement(position: number, origin: number): number {\n return position - origin;\n}\n\nfunction calculateMidpoint(first: number, second: number): number {\n return (first + second) / 2;\n}\n\nfunction calculatePointerDistance(first: PointerState, second: PointerState): number {\n return Math.hypot(first.clientX - second.clientX, first.clientY - second.clientY);\n}\n\nfunction getPointerEndReason(event: PointerEvent): PointerEndReason | undefined {\n if (event.type === 'pointerup') return 'up';\n if (event.type === 'pointercancel') return 'cancel';\n if (event.type === 'lostpointercapture') return 'lost-capture';\n if (event.type === 'pointermove' && event.buttons === 0) return 'buttons-released';\n return undefined;\n}\n\nfunction isPointerEndInterrupted(reason: PointerEndReason): boolean {\n return reason === 'cancel' || reason === 'lost-capture';\n}\n\nfunction normalizeWheelDelta(delta: number, deltaMode: number, pagePixels = 1): number {\n if (deltaMode === WheelEvent.DOM_DELTA_LINE) return delta * WHEEL_LINE_PIXELS;\n if (deltaMode === WheelEvent.DOM_DELTA_PAGE) return delta * pagePixels;\n return delta;\n}\n"],"mappings":";AAKA,IAAM,IAAsB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GAEM,IAAgC,MAMhC,IAAuB,IAEvB,IAAoB,IA+LpB,IAAN,MAAwC;CACtC;CAEA,YAAY,GAAsC;EAChD,AAGgB,KAAA,SAAA,MAAgC;GAChD,IAAM,IAAS,KAAK;GAIpB,OAHK,KACL,KAAK,KAAU,KAAA,GACf,EAAO,CAAO,GACP,MAHa;EAItB,GATE,KAAK,KAAU;CACjB;CAUA,QAAc;EACZ,KAAK,KAAU,KAAA;CACjB;AACF,GASa,IAAb,MAAwF;CACtF;CACA;CACA,qBAA0B,IAAI,IAA0B;CACxD,KAAa;CACb;CACA;CACA;CACA;CAEA,YAAY,GAAmB,GAAkD;EAG/E,A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