verstak 0.24.125 → 0.24.128
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/build/dist/source/archive/RxDomV1.js +1 -1
- package/build/dist/source/html/El.d.ts +22 -24
- package/build/dist/source/html/El.js +35 -35
- package/build/dist/source/html/Elements.d.ts +3 -2
- package/build/dist/source/html/Elements.js +12 -9
- package/build/dist/source/html/Handlers.d.ts +6 -0
- package/build/dist/source/html/Handlers.js +55 -0
- package/build/dist/source/html/HtmlApiExt.d.ts +2 -0
- package/build/dist/source/html/HtmlApiExt.js +11 -1
- package/build/dist/source/html/HtmlElements.js +174 -174
- package/build/dist/source/html/api.d.ts +1 -1
- package/build/dist/source/html/api.js +1 -1
- package/build/dist/source/html/sensors/BasePointerSensor.d.ts +5 -5
- package/build/dist/source/html/sensors/BasePointerSensor.js +11 -11
- package/build/dist/source/html/sensors/ButtonSensor.d.ts +6 -6
- package/build/dist/source/html/sensors/ButtonSensor.js +39 -48
- package/build/dist/source/html/sensors/DataForSensor.d.ts +1 -0
- package/build/dist/source/html/sensors/DataForSensor.js +1 -0
- package/build/dist/source/html/sensors/FocusSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/FocusSensor.js +14 -17
- package/build/dist/source/html/sensors/HoverSensor.d.ts +15 -4
- package/build/dist/source/html/sensors/HoverSensor.js +65 -24
- package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/HtmlDragSensor.js +25 -34
- package/build/dist/source/html/sensors/HtmlElementSensor.d.ts +3 -3
- package/build/dist/source/html/sensors/HtmlElementSensor.js +7 -4
- package/build/dist/source/html/sensors/HtmlSensors.d.ts +23 -11
- package/build/dist/source/html/sensors/HtmlSensors.js +81 -35
- package/build/dist/source/html/sensors/KeyboardSensor.d.ts +17 -17
- package/build/dist/source/html/sensors/KeyboardSensor.js +42 -51
- package/build/dist/source/html/sensors/PointerSensor.d.ts +3 -2
- package/build/dist/source/html/sensors/PointerSensor.js +28 -38
- package/build/dist/source/html/sensors/ScrollSensor.d.ts +12 -0
- package/build/dist/source/html/sensors/ScrollSensor.js +62 -0
- package/build/dist/source/html/sensors/WheelSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/WheelSensor.js +11 -20
- package/package.json +8 -8
- package/build/dist/source/html/ReactingFocuser.d.ts +0 -2
- package/build/dist/source/html/ReactingFocuser.js +0 -20
|
@@ -13,54 +13,51 @@ import { findTargetElementData, SymDataForSensor } from "./DataForSensor.js";
|
|
|
13
13
|
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor.js";
|
|
14
14
|
export var ButtonState;
|
|
15
15
|
(function (ButtonState) {
|
|
16
|
-
ButtonState[ButtonState["
|
|
17
|
-
ButtonState[ButtonState["
|
|
18
|
-
ButtonState[ButtonState["
|
|
19
|
-
ButtonState[ButtonState["
|
|
16
|
+
ButtonState[ButtonState["pressed"] = 0] = "pressed";
|
|
17
|
+
ButtonState[ButtonState["selecting"] = 1] = "selecting";
|
|
18
|
+
ButtonState[ButtonState["selected"] = 2] = "selected";
|
|
19
|
+
ButtonState[ButtonState["released"] = 3] = "released";
|
|
20
20
|
})(ButtonState || (ButtonState = {}));
|
|
21
21
|
export class ButtonSensor extends BasePointerSensor {
|
|
22
|
-
constructor(focusSensor, windowSensor) {
|
|
23
|
-
super(focusSensor, windowSensor);
|
|
24
|
-
this.state = ButtonState.
|
|
25
|
-
this.pointerButton = PointerButton.
|
|
22
|
+
constructor(element, focusSensor, windowSensor) {
|
|
23
|
+
super(element, focusSensor, windowSensor);
|
|
24
|
+
this.state = ButtonState.released;
|
|
25
|
+
this.pointerButton = PointerButton.none;
|
|
26
26
|
this.originData = undefined;
|
|
27
27
|
this.selectedData = undefined;
|
|
28
28
|
this.selectedX = Infinity;
|
|
29
29
|
this.selectedY = Infinity;
|
|
30
30
|
this.selected = false;
|
|
31
31
|
}
|
|
32
|
-
listen(
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
element.addEventListener("lostpointercapture", this.onLostPointerCapture.bind(this), { capture: true });
|
|
48
|
-
element.addEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
49
|
-
}
|
|
32
|
+
listen(enabled = true) {
|
|
33
|
+
const element = this.sourceElement;
|
|
34
|
+
if (enabled) {
|
|
35
|
+
element.addEventListener("pointerdown", this.onPointerDown.bind(this), { capture: true });
|
|
36
|
+
element.addEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
37
|
+
element.addEventListener("pointerup", this.onPointerUp.bind(this), { capture: true });
|
|
38
|
+
element.addEventListener("lostpointercapture", this.onLostPointerCapture.bind(this), { capture: true });
|
|
39
|
+
element.addEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
element.removeEventListener("pointerdown", this.onPointerDown.bind(this), { capture: true });
|
|
43
|
+
element.removeEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
44
|
+
element.removeEventListener("pointerup", this.onPointerUp.bind(this), { capture: true });
|
|
45
|
+
element.removeEventListener("lostpointercapture", this.onLostPointerCapture.bind(this), { capture: true });
|
|
46
|
+
element.removeEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
50
47
|
}
|
|
51
48
|
}
|
|
52
49
|
onPointerDown(e) {
|
|
53
|
-
if (this.state === ButtonState.
|
|
50
|
+
if (this.state === ButtonState.released && (this.pointerButton === PointerButton.none))
|
|
54
51
|
this.press(e);
|
|
55
52
|
this.setPreventDefaultAndStopPropagation(e);
|
|
56
53
|
}
|
|
57
54
|
onPointerMove(e) {
|
|
58
55
|
const state = this.state;
|
|
59
56
|
if (isPointerButtonDown(this.pointerButton, e.buttons)) {
|
|
60
|
-
if (state === ButtonState.
|
|
57
|
+
if (state === ButtonState.pressed || state === ButtonState.selecting)
|
|
61
58
|
this.selecting(e);
|
|
62
59
|
}
|
|
63
|
-
else if (state !== ButtonState.
|
|
60
|
+
else if (state !== ButtonState.released) {
|
|
64
61
|
this.cancel();
|
|
65
62
|
this.reset();
|
|
66
63
|
}
|
|
@@ -69,11 +66,11 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
69
66
|
onPointerUp(e) {
|
|
70
67
|
const button = extractPointerButton(e);
|
|
71
68
|
if (button === this.pointerButton) {
|
|
72
|
-
if (this.state === ButtonState.
|
|
69
|
+
if (this.state === ButtonState.selecting) {
|
|
73
70
|
this.select(e);
|
|
74
71
|
this.release();
|
|
75
72
|
}
|
|
76
|
-
else if (this.state === ButtonState.
|
|
73
|
+
else if (this.state === ButtonState.pressed) {
|
|
77
74
|
this.release();
|
|
78
75
|
}
|
|
79
76
|
}
|
|
@@ -83,13 +80,13 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
83
80
|
this.setPreventDefaultAndStopPropagation(e);
|
|
84
81
|
}
|
|
85
82
|
onLostPointerCapture(e) {
|
|
86
|
-
if (this.state !== ButtonState.
|
|
83
|
+
if (this.state !== ButtonState.released) {
|
|
87
84
|
this.cancel();
|
|
88
85
|
this.reset();
|
|
89
86
|
}
|
|
90
87
|
}
|
|
91
88
|
onKeyDown(e) {
|
|
92
|
-
if (e.key === "Escape" && this.state !== ButtonState.
|
|
89
|
+
if (e.key === "Escape" && this.state !== ButtonState.released) {
|
|
93
90
|
this.cancel();
|
|
94
91
|
this.reset();
|
|
95
92
|
}
|
|
@@ -102,7 +99,7 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
102
99
|
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["button"]);
|
|
103
100
|
const originData = data === null || data === void 0 ? void 0 : data.button;
|
|
104
101
|
if (originData) {
|
|
105
|
-
this.state = ButtonState.
|
|
102
|
+
this.state = ButtonState.pressed;
|
|
106
103
|
this.pointerButton = extractPointerButton(e);
|
|
107
104
|
this.originData = originData;
|
|
108
105
|
this.modifiers = extractModifierKeys(e);
|
|
@@ -117,12 +114,12 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
117
114
|
}
|
|
118
115
|
selecting(e) {
|
|
119
116
|
this.updateSensorData(e);
|
|
120
|
-
this.state = ButtonState.
|
|
117
|
+
this.state = ButtonState.selecting;
|
|
121
118
|
this.selected = false;
|
|
122
119
|
}
|
|
123
120
|
select(e) {
|
|
124
121
|
this.updateSensorData(e);
|
|
125
|
-
this.state = ButtonState.
|
|
122
|
+
this.state = ButtonState.selected;
|
|
126
123
|
this.selectedX = e.clientX;
|
|
127
124
|
this.selectedY = e.clientY;
|
|
128
125
|
this.selected = true;
|
|
@@ -130,26 +127,26 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
130
127
|
release() {
|
|
131
128
|
this.preventDefault = false;
|
|
132
129
|
this.stopPropagation = false;
|
|
133
|
-
this.state = ButtonState.
|
|
130
|
+
this.state = ButtonState.released;
|
|
134
131
|
this.revision++;
|
|
135
132
|
}
|
|
136
133
|
cancel() {
|
|
137
|
-
this.state = ButtonState.
|
|
134
|
+
this.state = ButtonState.released;
|
|
138
135
|
this.selected = false;
|
|
139
136
|
this.revision++;
|
|
140
137
|
}
|
|
141
138
|
reset() {
|
|
142
139
|
this.preventDefault = false;
|
|
143
140
|
this.stopPropagation = false;
|
|
144
|
-
this.state = ButtonState.
|
|
141
|
+
this.state = ButtonState.released;
|
|
145
142
|
this.originData = undefined;
|
|
146
143
|
this.selectedData = undefined;
|
|
147
|
-
this.pointerButton = PointerButton.
|
|
144
|
+
this.pointerButton = PointerButton.none;
|
|
148
145
|
this.positionX = Infinity;
|
|
149
146
|
this.positionY = Infinity;
|
|
150
147
|
this.selectedX = Infinity;
|
|
151
148
|
this.selectedY = Infinity;
|
|
152
|
-
this.modifiers = KeyboardModifiers.
|
|
149
|
+
this.modifiers = KeyboardModifiers.none;
|
|
153
150
|
this.selected = false;
|
|
154
151
|
}
|
|
155
152
|
updateSensorData(e) {
|
|
@@ -161,12 +158,6 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
161
158
|
this.revision++;
|
|
162
159
|
}
|
|
163
160
|
}
|
|
164
|
-
__decorate([
|
|
165
|
-
transactional,
|
|
166
|
-
__metadata("design:type", Function),
|
|
167
|
-
__metadata("design:paramtypes", [Object, Boolean]),
|
|
168
|
-
__metadata("design:returntype", void 0)
|
|
169
|
-
], ButtonSensor.prototype, "listen", null);
|
|
170
161
|
__decorate([
|
|
171
162
|
transactional,
|
|
172
163
|
options({ logging: LoggingLevel.Off }),
|
|
@@ -176,7 +167,7 @@ __decorate([
|
|
|
176
167
|
], ButtonSensor.prototype, "press", null);
|
|
177
168
|
__decorate([
|
|
178
169
|
transactional,
|
|
179
|
-
options({ reentrance: Reentrance.
|
|
170
|
+
options({ reentrance: Reentrance.cancelPrevious, logging: LoggingLevel.Off }),
|
|
180
171
|
__metadata("design:type", Function),
|
|
181
172
|
__metadata("design:paramtypes", [PointerEvent]),
|
|
182
173
|
__metadata("design:returntype", void 0)
|
|
@@ -13,6 +13,7 @@ export type DataForSensor = {
|
|
|
13
13
|
htmlDraggable?: unknown;
|
|
14
14
|
button?: unknown;
|
|
15
15
|
};
|
|
16
|
+
export declare const SymHtmlSensors: unique symbol;
|
|
16
17
|
export declare const SymDataForSensor: unique symbol;
|
|
17
18
|
export declare const SymResizeObserver: unique symbol;
|
|
18
19
|
export declare const EmptyDataArray: any[];
|
|
@@ -15,9 +15,9 @@ export declare class FocusSensor extends HtmlElementSensor {
|
|
|
15
15
|
activeData: unknown;
|
|
16
16
|
oldActiveData: unknown;
|
|
17
17
|
contextElementDataList: unknown[];
|
|
18
|
-
constructor(windowSensor: WindowSensor);
|
|
18
|
+
constructor(element: HTMLElement | SVGElement, windowSensor: WindowSensor);
|
|
19
19
|
setActiveData(data: unknown, debugHint?: string): void;
|
|
20
|
-
listen(
|
|
20
|
+
listen(enabled?: boolean): void;
|
|
21
21
|
reset(): void;
|
|
22
22
|
protected onFocusIn(e: FocusEvent): void;
|
|
23
23
|
protected onFocusOut(e: FocusEvent): void;
|
|
@@ -12,8 +12,8 @@ import { objectHasMember } from "../ElUtils.js";
|
|
|
12
12
|
import { grabElementDataList, SymDataForSensor } from "./DataForSensor.js";
|
|
13
13
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
14
14
|
export class FocusSensor extends HtmlElementSensor {
|
|
15
|
-
constructor(windowSensor) {
|
|
16
|
-
super(undefined, windowSensor);
|
|
15
|
+
constructor(element, windowSensor) {
|
|
16
|
+
super(element, undefined, windowSensor);
|
|
17
17
|
this.activeData = undefined;
|
|
18
18
|
this.oldActiveData = undefined;
|
|
19
19
|
this.contextElementDataList = [];
|
|
@@ -36,20 +36,17 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
36
36
|
this.activeData = data;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
listen(
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
this.
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
element.addEventListener("focusout", this.onFocusOut.bind(this), { capture: true });
|
|
51
|
-
element.addEventListener("mousedown", this.onMouseDown.bind(this), { capture: true });
|
|
52
|
-
}
|
|
39
|
+
listen(enabled = true) {
|
|
40
|
+
const element = this.sourceElement;
|
|
41
|
+
if (enabled) {
|
|
42
|
+
element.addEventListener("focusin", this.onFocusIn.bind(this), { capture: true });
|
|
43
|
+
element.addEventListener("focusout", this.onFocusOut.bind(this), { capture: true });
|
|
44
|
+
element.addEventListener("mousedown", this.onMouseDown.bind(this), { capture: true });
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
element.removeEventListener("focusin", this.onFocusIn.bind(this), { capture: true });
|
|
48
|
+
element.removeEventListener("focusout", this.onFocusOut.bind(this), { capture: true });
|
|
49
|
+
element.removeEventListener("mousedown", this.onMouseDown.bind(this), { capture: true });
|
|
53
50
|
}
|
|
54
51
|
}
|
|
55
52
|
reset() {
|
|
@@ -138,7 +135,7 @@ __decorate([
|
|
|
138
135
|
__decorate([
|
|
139
136
|
transactional,
|
|
140
137
|
__metadata("design:type", Function),
|
|
141
|
-
__metadata("design:paramtypes", [
|
|
138
|
+
__metadata("design:paramtypes", [Boolean]),
|
|
142
139
|
__metadata("design:returntype", void 0)
|
|
143
140
|
], FocusSensor.prototype, "listen", null);
|
|
144
141
|
__decorate([
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { BasePointerSensor } from "./BasePointerSensor.js";
|
|
2
|
+
export type IHoverable = {
|
|
3
|
+
isHovered: boolean;
|
|
4
|
+
onHoverStart?: (hover: HoverSensor) => void;
|
|
5
|
+
onHoverEnd?: (hover: HoverSensor) => void;
|
|
6
|
+
};
|
|
2
7
|
export declare class HoverSensor extends BasePointerSensor {
|
|
8
|
+
isHovered: boolean;
|
|
3
9
|
target: unknown;
|
|
4
|
-
constructor();
|
|
5
|
-
listen(
|
|
10
|
+
constructor(element: HTMLElement | SVGElement);
|
|
11
|
+
listen(enabled?: boolean): void;
|
|
12
|
+
protected onPointerEnter(e: PointerEvent): void;
|
|
6
13
|
protected onPointerOver(e: PointerEvent): void;
|
|
7
|
-
protected
|
|
14
|
+
protected onPointerMove(e: PointerEvent): void;
|
|
15
|
+
protected onPointerLeave(e: PointerEvent): void;
|
|
16
|
+
protected doPointerEnter(e: PointerEvent): void;
|
|
8
17
|
protected doPointerOver(e: PointerEvent): void;
|
|
9
|
-
protected
|
|
18
|
+
protected doPointerMove(e: PointerEvent): void;
|
|
19
|
+
protected doPointerLeave(e: PointerEvent): void;
|
|
20
|
+
protected reset(): void;
|
|
10
21
|
}
|
|
@@ -8,34 +8,48 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { options, transactional, LoggingLevel } from "reactronic";
|
|
11
|
-
import {
|
|
12
|
-
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor.js";
|
|
11
|
+
import { SymDataForSensor, findTargetElementData } from "./DataForSensor.js";
|
|
13
12
|
import { BasePointerSensor } from "./BasePointerSensor.js";
|
|
13
|
+
import { KeyboardModifiers, extractModifierKeys } from "./KeyboardSensor.js";
|
|
14
14
|
export class HoverSensor extends BasePointerSensor {
|
|
15
|
-
constructor() {
|
|
16
|
-
super();
|
|
15
|
+
constructor(element) {
|
|
16
|
+
super(element);
|
|
17
17
|
this.target = undefined;
|
|
18
|
+
this.isHovered = false;
|
|
18
19
|
this.target = undefined;
|
|
19
20
|
}
|
|
20
|
-
listen(
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.sourceElement = element;
|
|
28
|
-
if (element && enabled) {
|
|
29
|
-
element.addEventListener("pointerover", this.onPointerOver.bind(this), { capture: true });
|
|
30
|
-
element.addEventListener("pointerout", this.onPointerOut.bind(this), { capture: true });
|
|
31
|
-
}
|
|
21
|
+
listen(enabled = true) {
|
|
22
|
+
const element = this.sourceElement;
|
|
23
|
+
if (enabled) {
|
|
24
|
+
element.addEventListener("pointerenter", this.onPointerEnter.bind(this));
|
|
25
|
+
element.addEventListener("pointerover", this.onPointerOver.bind(this), { capture: true });
|
|
26
|
+
element.addEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
27
|
+
element.addEventListener("pointerleave", this.onPointerLeave.bind(this));
|
|
32
28
|
}
|
|
29
|
+
else {
|
|
30
|
+
element.removeEventListener("pointerenter", this.onPointerEnter.bind(this));
|
|
31
|
+
element.removeEventListener("pointerover", this.onPointerOver.bind(this), { capture: true });
|
|
32
|
+
element.removeEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
33
|
+
element.removeEventListener("pointerleave", this.onPointerLeave.bind(this));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onPointerEnter(e) {
|
|
37
|
+
this.doPointerEnter(e);
|
|
33
38
|
}
|
|
34
39
|
onPointerOver(e) {
|
|
35
40
|
this.doPointerOver(e);
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
this.
|
|
42
|
+
onPointerMove(e) {
|
|
43
|
+
this.doPointerMove(e);
|
|
44
|
+
}
|
|
45
|
+
onPointerLeave(e) {
|
|
46
|
+
this.doPointerLeave(e);
|
|
47
|
+
}
|
|
48
|
+
doPointerEnter(e) {
|
|
49
|
+
this.preventDefault = false;
|
|
50
|
+
this.stopPropagation = false;
|
|
51
|
+
this.isHovered = true;
|
|
52
|
+
this.revision++;
|
|
39
53
|
}
|
|
40
54
|
doPointerOver(e) {
|
|
41
55
|
var _a;
|
|
@@ -49,21 +63,34 @@ export class HoverSensor extends BasePointerSensor {
|
|
|
49
63
|
this.positionY = e.clientY;
|
|
50
64
|
this.revision++;
|
|
51
65
|
}
|
|
52
|
-
|
|
66
|
+
doPointerMove(e) {
|
|
67
|
+
this.preventDefault = false;
|
|
68
|
+
this.stopPropagation = false;
|
|
69
|
+
this.modifiers = extractModifierKeys(e);
|
|
70
|
+
this.positionX = e.clientX;
|
|
71
|
+
this.positionY = e.clientY;
|
|
72
|
+
this.revision++;
|
|
73
|
+
}
|
|
74
|
+
doPointerLeave(e) {
|
|
75
|
+
this.reset();
|
|
76
|
+
}
|
|
77
|
+
reset() {
|
|
53
78
|
this.preventDefault = false;
|
|
54
79
|
this.stopPropagation = false;
|
|
80
|
+
this.isHovered = false;
|
|
81
|
+
this.target = undefined;
|
|
55
82
|
this.positionX = Infinity;
|
|
56
83
|
this.positionY = Infinity;
|
|
57
|
-
this.modifiers = KeyboardModifiers.
|
|
58
|
-
this.target = undefined;
|
|
84
|
+
this.modifiers = KeyboardModifiers.none;
|
|
59
85
|
}
|
|
60
86
|
}
|
|
61
87
|
__decorate([
|
|
62
88
|
transactional,
|
|
89
|
+
options({ logging: LoggingLevel.Off }),
|
|
63
90
|
__metadata("design:type", Function),
|
|
64
|
-
__metadata("design:paramtypes", [
|
|
91
|
+
__metadata("design:paramtypes", [PointerEvent]),
|
|
65
92
|
__metadata("design:returntype", void 0)
|
|
66
|
-
], HoverSensor.prototype, "
|
|
93
|
+
], HoverSensor.prototype, "doPointerEnter", null);
|
|
67
94
|
__decorate([
|
|
68
95
|
transactional,
|
|
69
96
|
options({ logging: LoggingLevel.Off }),
|
|
@@ -71,10 +98,24 @@ __decorate([
|
|
|
71
98
|
__metadata("design:paramtypes", [PointerEvent]),
|
|
72
99
|
__metadata("design:returntype", void 0)
|
|
73
100
|
], HoverSensor.prototype, "doPointerOver", null);
|
|
101
|
+
__decorate([
|
|
102
|
+
transactional,
|
|
103
|
+
options({ logging: LoggingLevel.Off }),
|
|
104
|
+
__metadata("design:type", Function),
|
|
105
|
+
__metadata("design:paramtypes", [PointerEvent]),
|
|
106
|
+
__metadata("design:returntype", void 0)
|
|
107
|
+
], HoverSensor.prototype, "doPointerMove", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
transactional,
|
|
110
|
+
options({ logging: LoggingLevel.Off }),
|
|
111
|
+
__metadata("design:type", Function),
|
|
112
|
+
__metadata("design:paramtypes", [PointerEvent]),
|
|
113
|
+
__metadata("design:returntype", void 0)
|
|
114
|
+
], HoverSensor.prototype, "doPointerLeave", null);
|
|
74
115
|
__decorate([
|
|
75
116
|
transactional,
|
|
76
117
|
options({ logging: LoggingLevel.Off }),
|
|
77
118
|
__metadata("design:type", Function),
|
|
78
119
|
__metadata("design:paramtypes", []),
|
|
79
120
|
__metadata("design:returntype", void 0)
|
|
80
|
-
], HoverSensor.prototype, "
|
|
121
|
+
], HoverSensor.prototype, "reset", null);
|
|
@@ -33,12 +33,12 @@ export declare class HtmlDragSensor extends HtmlElementSensor {
|
|
|
33
33
|
immediatePositionX: number;
|
|
34
34
|
immediatePositionY: number;
|
|
35
35
|
immediateModifiers: KeyboardModifiers;
|
|
36
|
-
constructor(focusSensor: FocusSensor, windowSensor: WindowSensor);
|
|
36
|
+
constructor(element: HTMLElement | SVGElement, focusSensor: FocusSensor, windowSensor: WindowSensor);
|
|
37
37
|
getData(format: string): unknown;
|
|
38
38
|
setData(format: string, value: unknown): void;
|
|
39
39
|
clearData(format?: string): void;
|
|
40
40
|
setDragImage(value: HTMLElement, x: number, y: number): void;
|
|
41
|
-
listen(
|
|
41
|
+
listen(enabled?: boolean): void;
|
|
42
42
|
protected onDragStart(e: DragEvent): void;
|
|
43
43
|
protected onDrag(e: DragEvent): void;
|
|
44
44
|
protected onDragEnter(e: DragEvent): void;
|
|
@@ -12,8 +12,8 @@ import { findTargetElementData, SymDataForSensor } from "./DataForSensor.js";
|
|
|
12
12
|
import { HtmlElementSensor } from "./HtmlElementSensor.js";
|
|
13
13
|
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor.js";
|
|
14
14
|
export class HtmlDragSensor extends HtmlElementSensor {
|
|
15
|
-
constructor(focusSensor, windowSensor) {
|
|
16
|
-
super(focusSensor, windowSensor);
|
|
15
|
+
constructor(element, focusSensor, windowSensor) {
|
|
16
|
+
super(element, focusSensor, windowSensor);
|
|
17
17
|
this.draggable = undefined;
|
|
18
18
|
this.dragSource = undefined;
|
|
19
19
|
this.dragTarget = undefined;
|
|
@@ -35,13 +35,13 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
35
35
|
this.draggingDataTypes = [];
|
|
36
36
|
this.positionX = Infinity;
|
|
37
37
|
this.positionY = Infinity;
|
|
38
|
-
this.modifiers = KeyboardModifiers.
|
|
38
|
+
this.modifiers = KeyboardModifiers.none;
|
|
39
39
|
this.dropX = Infinity;
|
|
40
40
|
this.dropY = Infinity;
|
|
41
41
|
this.dropped = false;
|
|
42
42
|
this.immediatePositionX = Infinity;
|
|
43
43
|
this.immediatePositionY = Infinity;
|
|
44
|
-
this.immediateModifiers = KeyboardModifiers.
|
|
44
|
+
this.immediateModifiers = KeyboardModifiers.none;
|
|
45
45
|
}
|
|
46
46
|
getData(format) {
|
|
47
47
|
return this.dataByFormat.get(format);
|
|
@@ -60,28 +60,25 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
60
60
|
this.draggingImageX = x;
|
|
61
61
|
this.draggingImageY = y;
|
|
62
62
|
}
|
|
63
|
-
listen(
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
element.addEventListener("drop", this.onDrop.bind(this), { capture: true });
|
|
83
|
-
element.addEventListener("dragend", this.onDragEnd.bind(this), { capture: true });
|
|
84
|
-
}
|
|
63
|
+
listen(enabled = true) {
|
|
64
|
+
const element = this.sourceElement;
|
|
65
|
+
if (enabled) {
|
|
66
|
+
element.addEventListener("dragstart", this.onDragStart.bind(this), { capture: true });
|
|
67
|
+
element.addEventListener("drag", this.onDrag.bind(this), { capture: true });
|
|
68
|
+
element.addEventListener("dragenter", this.onDragEnter.bind(this), { capture: false });
|
|
69
|
+
element.addEventListener("dragleave", this.onDragLeave.bind(this), { capture: false });
|
|
70
|
+
element.addEventListener("dragover", this.onDragOver.bind(this), { capture: true });
|
|
71
|
+
element.addEventListener("drop", this.onDrop.bind(this), { capture: true });
|
|
72
|
+
element.addEventListener("dragend", this.onDragEnd.bind(this), { capture: true });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
element.removeEventListener("dragstart", this.onDragStart.bind(this), { capture: true });
|
|
76
|
+
element.removeEventListener("drag", this.onDrag.bind(this), { capture: true });
|
|
77
|
+
element.removeEventListener("dragenter", this.onDragEnter.bind(this), { capture: false });
|
|
78
|
+
element.removeEventListener("dragleave", this.onDragLeave.bind(this), { capture: false });
|
|
79
|
+
element.removeEventListener("dragover", this.onDragOver.bind(this), { capture: true });
|
|
80
|
+
element.removeEventListener("drop", this.onDrop.bind(this), { capture: true });
|
|
81
|
+
element.removeEventListener("dragend", this.onDragEnd.bind(this), { capture: true });
|
|
85
82
|
}
|
|
86
83
|
}
|
|
87
84
|
onDragStart(e) {
|
|
@@ -217,13 +214,13 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
217
214
|
this.draggingDataTypes = [];
|
|
218
215
|
this.positionX = Infinity;
|
|
219
216
|
this.positionY = Infinity;
|
|
220
|
-
this.modifiers = KeyboardModifiers.
|
|
217
|
+
this.modifiers = KeyboardModifiers.none;
|
|
221
218
|
this.dropX = Infinity;
|
|
222
219
|
this.dropY = Infinity;
|
|
223
220
|
this.dropped = false;
|
|
224
221
|
this.immediatePositionX = Infinity;
|
|
225
222
|
this.immediatePositionY = Infinity;
|
|
226
|
-
this.immediateModifiers = KeyboardModifiers.
|
|
223
|
+
this.immediateModifiers = KeyboardModifiers.none;
|
|
227
224
|
this.revision++;
|
|
228
225
|
}
|
|
229
226
|
updateDragTarget(e) {
|
|
@@ -291,12 +288,6 @@ __decorate([
|
|
|
291
288
|
raw,
|
|
292
289
|
__metadata("design:type", Boolean)
|
|
293
290
|
], HtmlDragSensor.prototype, "dropAllowed", void 0);
|
|
294
|
-
__decorate([
|
|
295
|
-
transactional,
|
|
296
|
-
__metadata("design:type", Function),
|
|
297
|
-
__metadata("design:paramtypes", [Object, Boolean]),
|
|
298
|
-
__metadata("design:returntype", void 0)
|
|
299
|
-
], HtmlDragSensor.prototype, "listen", null);
|
|
300
291
|
__decorate([
|
|
301
292
|
transactional,
|
|
302
293
|
options({ logging: LoggingLevel.Off }),
|
|
@@ -2,12 +2,12 @@ import { DataForSensor } from "./DataForSensor.js";
|
|
|
2
2
|
import { Sensor } from "./Sensor.js";
|
|
3
3
|
import { WindowSensor } from "./WindowSensor.js";
|
|
4
4
|
export declare class HtmlElementSensor extends Sensor {
|
|
5
|
+
readonly sourceElement: HTMLElement | SVGElement;
|
|
5
6
|
readonly focusSensor?: any;
|
|
6
7
|
readonly windowSensor?: WindowSensor;
|
|
7
|
-
sourceElement: HTMLElement | undefined;
|
|
8
8
|
preventDefault: boolean;
|
|
9
9
|
stopPropagation: boolean;
|
|
10
|
-
constructor(focusSensor?: any, windowSensor?: WindowSensor);
|
|
11
|
-
protected getDefaultSensorData(): DataForSensor
|
|
10
|
+
constructor(sourceElement: HTMLElement | SVGElement, focusSensor?: any, windowSensor?: WindowSensor);
|
|
11
|
+
protected getDefaultSensorData(): DataForSensor;
|
|
12
12
|
protected setPreventDefaultAndStopPropagation(e: Event): void;
|
|
13
13
|
}
|
|
@@ -12,17 +12,16 @@ import { SymDataForSensor } from "./DataForSensor.js";
|
|
|
12
12
|
import { Sensor } from "./Sensor.js";
|
|
13
13
|
import { WindowSensor } from "./WindowSensor.js";
|
|
14
14
|
export class HtmlElementSensor extends Sensor {
|
|
15
|
-
constructor(focusSensor, windowSensor) {
|
|
15
|
+
constructor(sourceElement, focusSensor, windowSensor) {
|
|
16
16
|
super();
|
|
17
|
-
this.sourceElement =
|
|
17
|
+
this.sourceElement = sourceElement;
|
|
18
18
|
this.focusSensor = focusSensor;
|
|
19
19
|
this.windowSensor = windowSensor;
|
|
20
20
|
this.preventDefault = false;
|
|
21
21
|
this.stopPropagation = false;
|
|
22
22
|
}
|
|
23
23
|
getDefaultSensorData() {
|
|
24
|
-
|
|
25
|
-
return sourceElement ? sourceElement[SymDataForSensor] : undefined;
|
|
24
|
+
return this.sourceElement[SymDataForSensor];
|
|
26
25
|
}
|
|
27
26
|
setPreventDefaultAndStopPropagation(e) {
|
|
28
27
|
if (this.preventDefault) {
|
|
@@ -35,6 +34,10 @@ export class HtmlElementSensor extends Sensor {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
}
|
|
37
|
+
__decorate([
|
|
38
|
+
raw,
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], HtmlElementSensor.prototype, "sourceElement", void 0);
|
|
38
41
|
__decorate([
|
|
39
42
|
raw,
|
|
40
43
|
__metadata("design:type", Object)
|
|
@@ -5,18 +5,30 @@ import { KeyboardSensor } from "./KeyboardSensor.js";
|
|
|
5
5
|
import { ButtonSensor } from "./ButtonSensor.js";
|
|
6
6
|
import { ResizeSensor } from "./ResizeSensor.js";
|
|
7
7
|
import { WheelSensor } from "./WheelSensor.js";
|
|
8
|
+
import { ScrollSensor } from "./ScrollSensor.js";
|
|
8
9
|
import { WindowSensor } from "./WindowSensor.js";
|
|
9
10
|
import { PointerSensor } from "./PointerSensor.js";
|
|
10
11
|
export declare class HtmlSensors {
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
private readonly _element;
|
|
13
|
+
private _window;
|
|
14
|
+
get window(): WindowSensor;
|
|
15
|
+
private _focus;
|
|
16
|
+
get focus(): FocusSensor;
|
|
17
|
+
private _hover;
|
|
18
|
+
get hover(): HoverSensor;
|
|
19
|
+
private _keyboard;
|
|
20
|
+
get keyboard(): KeyboardSensor;
|
|
21
|
+
private _wheel;
|
|
22
|
+
get wheel(): WheelSensor;
|
|
23
|
+
private _scroll;
|
|
24
|
+
get scroll(): ScrollSensor;
|
|
25
|
+
private _resize;
|
|
26
|
+
get resize(): ResizeSensor;
|
|
27
|
+
private _htmlDrag;
|
|
28
|
+
get htmlDrag(): HtmlDragSensor;
|
|
29
|
+
private _button;
|
|
30
|
+
get button(): ButtonSensor;
|
|
31
|
+
private _pointer;
|
|
32
|
+
get pointer(): PointerSensor;
|
|
33
|
+
constructor(element: HTMLElement | SVGElement);
|
|
22
34
|
}
|