verstak 0.22.500 → 0.22.504
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/api.d.ts +2 -2
- package/build/dist/source/api.js +2 -2
- package/build/dist/source/archive/RxDomV1.d.ts +1 -1
- package/build/dist/source/archive/RxDomV1.js +13 -13
- package/build/dist/source/core/Allocator.d.ts +64 -0
- package/build/dist/source/core/Allocator.js +141 -0
- package/build/dist/source/core/CellRange.d.ts +8 -0
- package/build/dist/source/core/CellRange.js +173 -0
- package/build/dist/source/core/Kernel.d.ts +82 -0
- package/build/dist/source/core/Kernel.js +559 -0
- package/build/dist/source/core/Restyler.js +1 -1
- package/build/dist/source/core/api.d.ts +5 -5
- package/build/dist/source/core/api.js +5 -5
- package/build/dist/source/html/Blocks.d.ts +13 -0
- package/build/dist/source/html/Blocks.js +121 -0
- package/build/dist/source/html/HtmlApiExt.d.ts +1 -1
- package/build/dist/source/html/HtmlApiExt.js +3 -3
- package/build/dist/source/html/HtmlBlocks.d.ts +175 -0
- package/build/dist/source/html/HtmlBlocks.js +356 -0
- package/build/dist/source/html/HtmlDriver.d.ts +20 -0
- package/build/dist/source/html/{HtmlNodeFactory.js → HtmlDriver.js} +25 -23
- package/build/dist/source/html/ReactingFocuser.d.ts +2 -0
- package/build/dist/source/html/ReactingFocuser.js +16 -0
- package/build/dist/source/html/api.d.ts +18 -17
- package/build/dist/source/html/api.js +18 -17
- package/build/dist/source/html/sensors/BasePointerSensor.d.ts +4 -4
- package/build/dist/source/html/sensors/BasePointerSensor.js +2 -2
- package/build/dist/source/html/sensors/ButtonSensor.d.ts +3 -3
- package/build/dist/source/html/sensors/ButtonSensor.js +17 -17
- package/build/dist/source/html/sensors/DataForSensor.js +6 -6
- package/build/dist/source/html/sensors/FocusSensor.d.ts +3 -3
- package/build/dist/source/html/sensors/FocusSensor.js +27 -27
- package/build/dist/source/html/sensors/HoverSensor.d.ts +1 -1
- package/build/dist/source/html/sensors/HoverSensor.js +9 -9
- package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +6 -6
- package/build/dist/source/html/sensors/HtmlDragSensor.js +28 -28
- package/build/dist/source/html/sensors/HtmlElementSensor.d.ts +3 -3
- package/build/dist/source/html/sensors/HtmlElementSensor.js +4 -4
- package/build/dist/source/html/sensors/HtmlSensors.d.ts +9 -9
- package/build/dist/source/html/sensors/HtmlSensors.js +10 -10
- package/build/dist/source/html/sensors/KeyboardSensor.d.ts +1 -1
- package/build/dist/source/html/sensors/KeyboardSensor.js +18 -18
- package/build/dist/source/html/sensors/PointerSensor.d.ts +4 -4
- package/build/dist/source/html/sensors/PointerSensor.js +20 -20
- package/build/dist/source/html/sensors/ResizeSensor.d.ts +3 -3
- package/build/dist/source/html/sensors/ResizeSensor.js +13 -13
- package/build/dist/source/html/sensors/Sensor.d.ts +1 -1
- package/build/dist/source/html/sensors/Sensor.js +1 -1
- package/build/dist/source/html/sensors/WheelSensor.d.ts +1 -1
- package/build/dist/source/html/sensors/WheelSensor.js +7 -7
- package/build/dist/source/html/sensors/WindowSensor.d.ts +2 -2
- package/build/dist/source/html/sensors/WindowSensor.js +5 -5
- package/package.json +7 -7
- package/build/dist/source/core/Block.d.ts +0 -62
- package/build/dist/source/core/Block.js +0 -431
- package/build/dist/source/core/Elements.d.ts +0 -3
- package/build/dist/source/core/Elements.js +0 -7
- package/build/dist/source/core/Layout.d.ts +0 -27
- package/build/dist/source/core/Layout.js +0 -259
- package/build/dist/source/html/Cluster.d.ts +0 -11
- package/build/dist/source/html/Cluster.js +0 -14
- package/build/dist/source/html/HtmlElements.d.ts +0 -349
- package/build/dist/source/html/HtmlElements.js +0 -529
- package/build/dist/source/html/HtmlNodeFactory.d.ts +0 -19
- package/build/dist/source/html/RxFocuser.d.ts +0 -2
- package/build/dist/source/html/RxFocuser.js +0 -11
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { options, Reentrance, transactional, Transaction, LoggingLevel } from
|
|
11
|
-
import { extractPointerButton, isPointerButtonDown, PointerButton, BasePointerSensor } from
|
|
12
|
-
import { findTargetElementData, SymDataForSensor } from
|
|
13
|
-
import { extractModifierKeys, KeyboardModifiers } from
|
|
10
|
+
import { options, Reentrance, transactional, Transaction, LoggingLevel } from "reactronic";
|
|
11
|
+
import { extractPointerButton, isPointerButtonDown, PointerButton, BasePointerSensor } from "./BasePointerSensor";
|
|
12
|
+
import { findTargetElementData, SymDataForSensor } from "./DataForSensor";
|
|
13
|
+
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor";
|
|
14
14
|
export var ButtonState;
|
|
15
15
|
(function (ButtonState) {
|
|
16
16
|
ButtonState[ButtonState["Pressed"] = 0] = "Pressed";
|
|
@@ -33,19 +33,19 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
33
33
|
const existing = this.sourceElement;
|
|
34
34
|
if (element !== existing) {
|
|
35
35
|
if (existing) {
|
|
36
|
-
existing.removeEventListener(
|
|
37
|
-
existing.removeEventListener(
|
|
38
|
-
existing.removeEventListener(
|
|
39
|
-
existing.removeEventListener(
|
|
40
|
-
existing.removeEventListener(
|
|
36
|
+
existing.removeEventListener("pointerdown", this.onPointerDown.bind(this), { capture: true });
|
|
37
|
+
existing.removeEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
38
|
+
existing.removeEventListener("pointerup", this.onPointerUp.bind(this), { capture: true });
|
|
39
|
+
existing.removeEventListener("lostpointercapture", this.onLostPointerCapture.bind(this), { capture: true });
|
|
40
|
+
existing.removeEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
41
41
|
}
|
|
42
42
|
this.sourceElement = element;
|
|
43
43
|
if (element && enabled) {
|
|
44
|
-
element.addEventListener(
|
|
45
|
-
element.addEventListener(
|
|
46
|
-
element.addEventListener(
|
|
47
|
-
element.addEventListener(
|
|
48
|
-
element.addEventListener(
|
|
44
|
+
element.addEventListener("pointerdown", this.onPointerDown.bind(this), { capture: true });
|
|
45
|
+
element.addEventListener("pointermove", this.onPointerMove.bind(this), { capture: true });
|
|
46
|
+
element.addEventListener("pointerup", this.onPointerUp.bind(this), { capture: true });
|
|
47
|
+
element.addEventListener("lostpointercapture", this.onLostPointerCapture.bind(this), { capture: true });
|
|
48
|
+
element.addEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -89,7 +89,7 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
onKeyDown(e) {
|
|
92
|
-
if (e.key ===
|
|
92
|
+
if (e.key === "Escape" && this.state !== ButtonState.Released) {
|
|
93
93
|
this.cancel();
|
|
94
94
|
this.reset();
|
|
95
95
|
}
|
|
@@ -99,7 +99,7 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
99
99
|
this.stopPropagation = false;
|
|
100
100
|
const targetPath = e.composedPath();
|
|
101
101
|
const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
|
|
102
|
-
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, [
|
|
102
|
+
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["button"]);
|
|
103
103
|
const originData = data === null || data === void 0 ? void 0 : data.button;
|
|
104
104
|
if (originData) {
|
|
105
105
|
this.state = ButtonState.Pressed;
|
|
@@ -112,7 +112,7 @@ export class ButtonSensor extends BasePointerSensor {
|
|
|
112
112
|
}
|
|
113
113
|
Transaction.separate(() => {
|
|
114
114
|
var _a;
|
|
115
|
-
(_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window,
|
|
115
|
+
(_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window, "button");
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
118
|
selecting(e) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export const SymDataForSensor = Symbol(
|
|
2
|
-
export const SymResizeObserver = Symbol(
|
|
1
|
+
export const SymDataForSensor = Symbol("DataForSensor");
|
|
2
|
+
export const SymResizeObserver = Symbol("ResizeObserver");
|
|
3
3
|
export const EmptyDataArray = [];
|
|
4
4
|
export function findTargetElementData(targetPath, underPointer, sym, anyOfPayloadKeys, ignoreWindow = false) {
|
|
5
5
|
let result = undefined;
|
|
@@ -11,8 +11,8 @@ export function findTargetElementData(targetPath, underPointer, sym, anyOfPayloa
|
|
|
11
11
|
if (candidateData !== undefined) {
|
|
12
12
|
if (!ignoreWindow) {
|
|
13
13
|
if (window === undefined)
|
|
14
|
-
window = candidateData[
|
|
15
|
-
else if (window !== candidateData[
|
|
14
|
+
window = candidateData["window"];
|
|
15
|
+
else if (window !== candidateData["window"])
|
|
16
16
|
break;
|
|
17
17
|
}
|
|
18
18
|
if (result === undefined) {
|
|
@@ -42,8 +42,8 @@ export function grabElementDataList(targetPath, sym, payloadKey, existing, ignor
|
|
|
42
42
|
if (candidateData !== undefined) {
|
|
43
43
|
if (!ignoreWindow) {
|
|
44
44
|
if (window === undefined)
|
|
45
|
-
window = candidateData[
|
|
46
|
-
else if (window !== candidateData[
|
|
45
|
+
window = candidateData["window"];
|
|
46
|
+
else if (window !== candidateData["window"])
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
payload = candidateData[payloadKey];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ToggleRef } from
|
|
2
|
-
import { HtmlElementSensor } from
|
|
3
|
-
import { WindowSensor } from
|
|
1
|
+
import { ToggleRef } from "reactronic";
|
|
2
|
+
import { HtmlElementSensor } from "./HtmlElementSensor";
|
|
3
|
+
import { WindowSensor } from "./WindowSensor";
|
|
4
4
|
export interface FocusModel {
|
|
5
5
|
isEditMode: boolean;
|
|
6
6
|
onFocusIn?: (focus: FocusSensor) => void;
|
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { options, transactional, LoggingLevel } from
|
|
11
|
-
import { objectHasMember } from
|
|
12
|
-
import { grabElementDataList, SymDataForSensor } from
|
|
13
|
-
import { HtmlElementSensor } from
|
|
10
|
+
import { options, transactional, LoggingLevel } from "reactronic";
|
|
11
|
+
import { objectHasMember } from "../../core/Utils";
|
|
12
|
+
import { grabElementDataList, SymDataForSensor } from "./DataForSensor";
|
|
13
|
+
import { HtmlElementSensor } from "./HtmlElementSensor";
|
|
14
14
|
export class FocusSensor extends HtmlElementSensor {
|
|
15
15
|
constructor(windowSensor) {
|
|
16
16
|
super(undefined, windowSensor);
|
|
@@ -18,16 +18,16 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
18
18
|
this.oldActiveData = undefined;
|
|
19
19
|
this.contextElementDataList = [];
|
|
20
20
|
}
|
|
21
|
-
setActiveData(data, debugHint =
|
|
21
|
+
setActiveData(data, debugHint = "") {
|
|
22
22
|
var _a, _b;
|
|
23
23
|
if (data !== this.activeData) {
|
|
24
24
|
const activeData = this.activeData;
|
|
25
|
-
if (activeData !== undefined && objectHasMember(activeData,
|
|
25
|
+
if (activeData !== undefined && objectHasMember(activeData, "isEditMode")) {
|
|
26
26
|
activeData.isEditMode = false;
|
|
27
27
|
(_a = activeData.onFocusOut) === null || _a === void 0 ? void 0 : _a.call(activeData, this);
|
|
28
28
|
}
|
|
29
29
|
if (data !== undefined) {
|
|
30
|
-
if (objectHasMember(data,
|
|
30
|
+
if (objectHasMember(data, "isEditMode")) {
|
|
31
31
|
data.isEditMode = true;
|
|
32
32
|
(_b = data.onFocusIn) === null || _b === void 0 ? void 0 : _b.call(data, this);
|
|
33
33
|
}
|
|
@@ -40,15 +40,15 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
40
40
|
const existing = this.sourceElement;
|
|
41
41
|
if (element !== existing) {
|
|
42
42
|
if (existing) {
|
|
43
|
-
existing.removeEventListener(
|
|
44
|
-
existing.removeEventListener(
|
|
45
|
-
existing.removeEventListener(
|
|
43
|
+
existing.removeEventListener("focusin", this.onFocusIn.bind(this), { capture: true });
|
|
44
|
+
existing.removeEventListener("focusout", this.onFocusOut.bind(this), { capture: true });
|
|
45
|
+
existing.removeEventListener("mousedown", this.onMouseDown.bind(this), { capture: true });
|
|
46
46
|
}
|
|
47
47
|
this.sourceElement = element;
|
|
48
48
|
if (element && enabled) {
|
|
49
|
-
element.addEventListener(
|
|
50
|
-
element.addEventListener(
|
|
51
|
-
element.addEventListener(
|
|
49
|
+
element.addEventListener("focusin", this.onFocusIn.bind(this), { capture: true });
|
|
50
|
+
element.addEventListener("focusout", this.onFocusOut.bind(this), { capture: true });
|
|
51
|
+
element.addEventListener("mousedown", this.onMouseDown.bind(this), { capture: true });
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -71,11 +71,11 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
71
71
|
doFocusIn(e) {
|
|
72
72
|
var _a;
|
|
73
73
|
const path = e.composedPath();
|
|
74
|
-
const { dataList: focusDataList, activeData: focusActiveData, window } = grabElementDataList(path, SymDataForSensor,
|
|
74
|
+
const { dataList: focusDataList, activeData: focusActiveData, window } = grabElementDataList(path, SymDataForSensor, "focus", this.elementDataList, false, e => document.activeElement === e);
|
|
75
75
|
this.elementDataList = focusDataList;
|
|
76
76
|
this.setActiveData(focusActiveData);
|
|
77
77
|
(_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window);
|
|
78
|
-
const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor,
|
|
78
|
+
const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor, "context", this.contextElementDataList, true);
|
|
79
79
|
this.contextElementDataList = toggleContextRefs(this, this.contextElementDataList, contextDataList);
|
|
80
80
|
this.reset();
|
|
81
81
|
}
|
|
@@ -84,16 +84,16 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
84
84
|
const isLosingFocus = e.relatedTarget === null;
|
|
85
85
|
if (isLosingFocus) {
|
|
86
86
|
const path = e.composedPath();
|
|
87
|
-
const { dataList } = grabElementDataList(path, SymDataForSensor,
|
|
87
|
+
const { dataList } = grabElementDataList(path, SymDataForSensor, "focus", this.elementDataList, true);
|
|
88
88
|
this.elementDataList = dataList;
|
|
89
89
|
const filteredElementDataList = dataList.filter(x => x !== this.activeData);
|
|
90
90
|
if (filteredElementDataList.length > 0) {
|
|
91
|
-
this.trySetEditMode(filteredElementDataList[0],
|
|
91
|
+
this.trySetEditMode(filteredElementDataList[0], " └─");
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
94
|
const defaultData = this.getDefaultSensorData();
|
|
95
95
|
if ((defaultData === null || defaultData === void 0 ? void 0 : defaultData.focus) !== undefined) {
|
|
96
|
-
this.trySetEditMode(defaultData.focus,
|
|
96
|
+
this.trySetEditMode(defaultData.focus, " └─");
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
99
|
this.setActiveData(undefined);
|
|
@@ -110,21 +110,21 @@ export class FocusSensor extends HtmlElementSensor {
|
|
|
110
110
|
const path = e.composedPath();
|
|
111
111
|
const isClickInsideTabIndexedElement = path.find(el => el !== document.body && el.tabIndex >= 0) !== undefined;
|
|
112
112
|
if (path.length > 0 && !isClickInsideTabIndexedElement) {
|
|
113
|
-
const { dataList } = grabElementDataList(path, SymDataForSensor,
|
|
113
|
+
const { dataList } = grabElementDataList(path, SymDataForSensor, "focus", this.elementDataList, true);
|
|
114
114
|
this.elementDataList = dataList;
|
|
115
115
|
if (dataList.length > 0) {
|
|
116
|
-
this.trySetEditMode(dataList[0],
|
|
116
|
+
this.trySetEditMode(dataList[0], "└─");
|
|
117
117
|
e.preventDefault();
|
|
118
118
|
}
|
|
119
|
-
const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor,
|
|
119
|
+
const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor, "context", this.contextElementDataList, true);
|
|
120
120
|
this.contextElementDataList = toggleContextRefs(this, this.contextElementDataList, contextDataList);
|
|
121
121
|
this.reset();
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
trySetEditMode(candidateData, indent =
|
|
127
|
-
if (candidateData !== undefined && objectHasMember(candidateData,
|
|
126
|
+
trySetEditMode(candidateData, indent = "") {
|
|
127
|
+
if (candidateData !== undefined && objectHasMember(candidateData, "isEditMode")) {
|
|
128
128
|
candidateData.isEditMode = true;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
@@ -165,16 +165,16 @@ function toggleContextRefs(focusSensor, existing, updated) {
|
|
|
165
165
|
if (updated !== existing) {
|
|
166
166
|
existing.forEach(x => {
|
|
167
167
|
var _a;
|
|
168
|
-
if (objectHasMember(x,
|
|
168
|
+
if (objectHasMember(x, "contextToggle") && x.contextToggle && x.contextToggle.valueOn !== x.contextToggle.valueOff)
|
|
169
169
|
x.contextToggle.variable = x.contextToggle.valueOff;
|
|
170
|
-
if (objectHasMember(x,
|
|
170
|
+
if (objectHasMember(x, "onContextOut"))
|
|
171
171
|
(_a = x.onContextOut) === null || _a === void 0 ? void 0 : _a.call(x, focusSensor);
|
|
172
172
|
});
|
|
173
173
|
updated.forEach(x => {
|
|
174
174
|
var _a;
|
|
175
|
-
if (objectHasMember(x,
|
|
175
|
+
if (objectHasMember(x, "contextToggle") && x.contextToggle)
|
|
176
176
|
x.contextToggle.variable = x.contextToggle.valueOn;
|
|
177
|
-
if (objectHasMember(x,
|
|
177
|
+
if (objectHasMember(x, "onContextIn"))
|
|
178
178
|
(_a = x.onContextIn) === null || _a === void 0 ? void 0 : _a.call(x, focusSensor);
|
|
179
179
|
});
|
|
180
180
|
}
|
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { options, transactional, LoggingLevel } from
|
|
11
|
-
import { findTargetElementData, SymDataForSensor } from
|
|
12
|
-
import { extractModifierKeys, KeyboardModifiers } from
|
|
13
|
-
import { BasePointerSensor } from
|
|
10
|
+
import { options, transactional, LoggingLevel } from "reactronic";
|
|
11
|
+
import { findTargetElementData, SymDataForSensor } from "./DataForSensor";
|
|
12
|
+
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor";
|
|
13
|
+
import { BasePointerSensor } from "./BasePointerSensor";
|
|
14
14
|
export class HoverSensor extends BasePointerSensor {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
@@ -21,13 +21,13 @@ export class HoverSensor extends BasePointerSensor {
|
|
|
21
21
|
const existing = this.sourceElement;
|
|
22
22
|
if (element !== existing) {
|
|
23
23
|
if (existing) {
|
|
24
|
-
existing.removeEventListener(
|
|
25
|
-
existing.removeEventListener(
|
|
24
|
+
existing.removeEventListener("pointerover", this.onPointerOver.bind(this), { capture: true });
|
|
25
|
+
existing.removeEventListener("pointerout", this.onPointerOut.bind(this), { capture: true });
|
|
26
26
|
}
|
|
27
27
|
this.sourceElement = element;
|
|
28
28
|
if (element && enabled) {
|
|
29
|
-
element.addEventListener(
|
|
30
|
-
element.addEventListener(
|
|
29
|
+
element.addEventListener("pointerover", this.onPointerOver.bind(this), { capture: true });
|
|
30
|
+
element.addEventListener("pointerout", this.onPointerOut.bind(this), { capture: true });
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -43,7 +43,7 @@ export class HoverSensor extends BasePointerSensor {
|
|
|
43
43
|
this.stopPropagation = false;
|
|
44
44
|
const targetPath = e.composedPath();
|
|
45
45
|
const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
|
|
46
|
-
this.target = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, [
|
|
46
|
+
this.target = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["hover"]).data) === null || _a === void 0 ? void 0 : _a.hover;
|
|
47
47
|
this.modifiers = extractModifierKeys(e);
|
|
48
48
|
this.positionX = e.clientX;
|
|
49
49
|
this.positionY = e.clientY;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FocusSensor } from
|
|
2
|
-
import { HtmlElementSensor } from
|
|
3
|
-
import { KeyboardModifiers } from
|
|
4
|
-
import { WindowSensor } from
|
|
5
|
-
export declare type DragEffectAllowed =
|
|
6
|
-
export declare type DropEffect =
|
|
1
|
+
import { FocusSensor } from "./FocusSensor";
|
|
2
|
+
import { HtmlElementSensor } from "./HtmlElementSensor";
|
|
3
|
+
import { KeyboardModifiers } from "./KeyboardSensor";
|
|
4
|
+
import { WindowSensor } from "./WindowSensor";
|
|
5
|
+
export declare type DragEffectAllowed = "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized";
|
|
6
|
+
export declare type DropEffect = "none" | "copy" | "link" | "move";
|
|
7
7
|
export declare class HtmlDragSensor extends HtmlElementSensor {
|
|
8
8
|
draggable: unknown;
|
|
9
9
|
dragSource: unknown;
|
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { options, reactive, transactional, raw, Transaction, LoggingLevel } from
|
|
11
|
-
import { findTargetElementData, SymDataForSensor } from
|
|
12
|
-
import { HtmlElementSensor } from
|
|
13
|
-
import { extractModifierKeys, KeyboardModifiers } from
|
|
10
|
+
import { options, reactive, transactional, raw, Transaction, LoggingLevel } from "reactronic";
|
|
11
|
+
import { findTargetElementData, SymDataForSensor } from "./DataForSensor";
|
|
12
|
+
import { HtmlElementSensor } from "./HtmlElementSensor";
|
|
13
|
+
import { extractModifierKeys, KeyboardModifiers } from "./KeyboardSensor";
|
|
14
14
|
export class HtmlDragSensor extends HtmlElementSensor {
|
|
15
15
|
constructor(focusSensor, windowSensor) {
|
|
16
16
|
super(focusSensor, windowSensor);
|
|
@@ -27,9 +27,9 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
27
27
|
this.draggingImage = undefined;
|
|
28
28
|
this.draggingImageX = Infinity;
|
|
29
29
|
this.draggingImageY = Infinity;
|
|
30
|
-
this.dropEffect =
|
|
30
|
+
this.dropEffect = "none";
|
|
31
31
|
this.dataTypesAllowed = [];
|
|
32
|
-
this.effectAllowed =
|
|
32
|
+
this.effectAllowed = "uninitialized";
|
|
33
33
|
this.dropAllowed = false;
|
|
34
34
|
this.draggingOver = false;
|
|
35
35
|
this.draggingDataTypes = [];
|
|
@@ -64,23 +64,23 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
64
64
|
const existing = this.sourceElement;
|
|
65
65
|
if (element !== existing) {
|
|
66
66
|
if (existing) {
|
|
67
|
-
existing.removeEventListener(
|
|
68
|
-
existing.removeEventListener(
|
|
69
|
-
existing.removeEventListener(
|
|
70
|
-
existing.removeEventListener(
|
|
71
|
-
existing.removeEventListener(
|
|
72
|
-
existing.removeEventListener(
|
|
73
|
-
existing.removeEventListener(
|
|
67
|
+
existing.removeEventListener("dragstart", this.onDragStart.bind(this), { capture: true });
|
|
68
|
+
existing.removeEventListener("drag", this.onDrag.bind(this), { capture: true });
|
|
69
|
+
existing.removeEventListener("dragenter", this.onDragEnter.bind(this), { capture: false });
|
|
70
|
+
existing.removeEventListener("dragleave", this.onDragLeave.bind(this), { capture: false });
|
|
71
|
+
existing.removeEventListener("dragover", this.onDragOver.bind(this), { capture: true });
|
|
72
|
+
existing.removeEventListener("drop", this.onDrop.bind(this), { capture: true });
|
|
73
|
+
existing.removeEventListener("dragend", this.onDragEnd.bind(this), { capture: true });
|
|
74
74
|
}
|
|
75
75
|
this.sourceElement = element;
|
|
76
76
|
if (element && enabled) {
|
|
77
|
-
element.addEventListener(
|
|
78
|
-
element.addEventListener(
|
|
79
|
-
element.addEventListener(
|
|
80
|
-
element.addEventListener(
|
|
81
|
-
element.addEventListener(
|
|
82
|
-
element.addEventListener(
|
|
83
|
-
element.addEventListener(
|
|
77
|
+
element.addEventListener("dragstart", this.onDragStart.bind(this), { capture: true });
|
|
78
|
+
element.addEventListener("drag", this.onDrag.bind(this), { capture: true });
|
|
79
|
+
element.addEventListener("dragenter", this.onDragEnter.bind(this), { capture: false });
|
|
80
|
+
element.addEventListener("dragleave", this.onDragLeave.bind(this), { capture: false });
|
|
81
|
+
element.addEventListener("dragover", this.onDragOver.bind(this), { capture: true });
|
|
82
|
+
element.addEventListener("drop", this.onDrop.bind(this), { capture: true });
|
|
83
|
+
element.addEventListener("dragend", this.onDragEnd.bind(this), { capture: true });
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -115,9 +115,9 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
115
115
|
this.stopPropagation = false;
|
|
116
116
|
const targetPath = e.composedPath();
|
|
117
117
|
const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
|
|
118
|
-
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, [
|
|
118
|
+
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["htmlDraggable"]);
|
|
119
119
|
this.draggable = data === null || data === void 0 ? void 0 : data.htmlDraggable;
|
|
120
|
-
this.dragSource = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, [
|
|
120
|
+
this.dragSource = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["htmlDrag"], true).data) === null || _a === void 0 ? void 0 : _a.htmlDrag;
|
|
121
121
|
this.dragStarted = true;
|
|
122
122
|
this.dragFinished = false;
|
|
123
123
|
this.startX = e.clientX;
|
|
@@ -132,7 +132,7 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
132
132
|
this.revision++;
|
|
133
133
|
Transaction.separate(() => {
|
|
134
134
|
var _a;
|
|
135
|
-
(_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window,
|
|
135
|
+
(_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window, "htmlDrag");
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
138
|
dragging(e) {
|
|
@@ -168,7 +168,7 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
168
168
|
dt.types.forEach(type => {
|
|
169
169
|
if (!dataByFormat.has(type)) {
|
|
170
170
|
const data = dt.getData(type);
|
|
171
|
-
if (data !==
|
|
171
|
+
if (data !== "") {
|
|
172
172
|
this.dataByFormat = dataByFormat = dataByFormat.toMutable();
|
|
173
173
|
dataByFormat.set(type, data);
|
|
174
174
|
}
|
|
@@ -183,7 +183,7 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
183
183
|
dt.dropEffect = this.dropEffect;
|
|
184
184
|
dt.effectAllowed = this.effectAllowed;
|
|
185
185
|
this.dataByFormat.forEach((data, format) => {
|
|
186
|
-
if (typeof data ===
|
|
186
|
+
if (typeof data === "string")
|
|
187
187
|
dt.setData(format, data);
|
|
188
188
|
});
|
|
189
189
|
if (this.draggingImage) {
|
|
@@ -209,9 +209,9 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
209
209
|
this.draggingImage = undefined;
|
|
210
210
|
this.draggingImageX = Infinity;
|
|
211
211
|
this.draggingImageY = Infinity;
|
|
212
|
-
this.dropEffect =
|
|
212
|
+
this.dropEffect = "none";
|
|
213
213
|
this.dataTypesAllowed = [];
|
|
214
|
-
this.effectAllowed =
|
|
214
|
+
this.effectAllowed = "uninitialized";
|
|
215
215
|
this.dropAllowed = false;
|
|
216
216
|
this.draggingOver = false;
|
|
217
217
|
this.draggingDataTypes = [];
|
|
@@ -230,7 +230,7 @@ export class HtmlDragSensor extends HtmlElementSensor {
|
|
|
230
230
|
var _a;
|
|
231
231
|
const targetPath = e.composedPath();
|
|
232
232
|
const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
|
|
233
|
-
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, [
|
|
233
|
+
const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ["htmlDrag"]);
|
|
234
234
|
const dragTarget = data === null || data === void 0 ? void 0 : data.htmlDrag;
|
|
235
235
|
if (dragTarget !== this.dragTarget) {
|
|
236
236
|
this.previousDragTarget = this.dragTarget;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataForSensor } from
|
|
2
|
-
import { Sensor } from
|
|
3
|
-
import { WindowSensor } from
|
|
1
|
+
import { DataForSensor } from "./DataForSensor";
|
|
2
|
+
import { Sensor } from "./Sensor";
|
|
3
|
+
import { WindowSensor } from "./WindowSensor";
|
|
4
4
|
export declare class HtmlElementSensor extends Sensor {
|
|
5
5
|
readonly focusSensor?: any;
|
|
6
6
|
readonly windowSensor?: WindowSensor;
|
|
@@ -7,10 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { raw } from
|
|
11
|
-
import { SymDataForSensor } from
|
|
12
|
-
import { Sensor } from
|
|
13
|
-
import { WindowSensor } from
|
|
10
|
+
import { raw } from "reactronic";
|
|
11
|
+
import { SymDataForSensor } from "./DataForSensor";
|
|
12
|
+
import { Sensor } from "./Sensor";
|
|
13
|
+
import { WindowSensor } from "./WindowSensor";
|
|
14
14
|
export class HtmlElementSensor extends Sensor {
|
|
15
15
|
constructor(focusSensor, windowSensor) {
|
|
16
16
|
super();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FocusSensor } from
|
|
2
|
-
import { HoverSensor } from
|
|
3
|
-
import { HtmlDragSensor } from
|
|
4
|
-
import { KeyboardSensor } from
|
|
5
|
-
import { ButtonSensor } from
|
|
6
|
-
import { ResizeSensor } from
|
|
7
|
-
import { WheelSensor } from
|
|
8
|
-
import { WindowSensor } from
|
|
9
|
-
import { PointerSensor } from
|
|
1
|
+
import { FocusSensor } from "./FocusSensor";
|
|
2
|
+
import { HoverSensor } from "./HoverSensor";
|
|
3
|
+
import { HtmlDragSensor } from "./HtmlDragSensor";
|
|
4
|
+
import { KeyboardSensor } from "./KeyboardSensor";
|
|
5
|
+
import { ButtonSensor } from "./ButtonSensor";
|
|
6
|
+
import { ResizeSensor } from "./ResizeSensor";
|
|
7
|
+
import { WheelSensor } from "./WheelSensor";
|
|
8
|
+
import { WindowSensor } from "./WindowSensor";
|
|
9
|
+
import { PointerSensor } from "./PointerSensor";
|
|
10
10
|
export declare class HtmlSensors {
|
|
11
11
|
readonly window: WindowSensor;
|
|
12
12
|
readonly focus: FocusSensor;
|
|
@@ -7,16 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { transactional } from
|
|
11
|
-
import { FocusSensor } from
|
|
12
|
-
import { HoverSensor } from
|
|
13
|
-
import { HtmlDragSensor } from
|
|
14
|
-
import { KeyboardSensor } from
|
|
15
|
-
import { ButtonSensor } from
|
|
16
|
-
import { ResizeSensor } from
|
|
17
|
-
import { WheelSensor } from
|
|
18
|
-
import { WindowSensor } from
|
|
19
|
-
import { PointerSensor } from
|
|
10
|
+
import { transactional } from "reactronic";
|
|
11
|
+
import { FocusSensor } from "./FocusSensor";
|
|
12
|
+
import { HoverSensor } from "./HoverSensor";
|
|
13
|
+
import { HtmlDragSensor } from "./HtmlDragSensor";
|
|
14
|
+
import { KeyboardSensor } from "./KeyboardSensor";
|
|
15
|
+
import { ButtonSensor } from "./ButtonSensor";
|
|
16
|
+
import { ResizeSensor } from "./ResizeSensor";
|
|
17
|
+
import { WheelSensor } from "./WheelSensor";
|
|
18
|
+
import { WindowSensor } from "./WindowSensor";
|
|
19
|
+
import { PointerSensor } from "./PointerSensor";
|
|
20
20
|
export class HtmlSensors {
|
|
21
21
|
constructor() {
|
|
22
22
|
this.window = new WindowSensor();
|
|
@@ -7,9 +7,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
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
|
-
import { options, sensitive, transactional, LoggingLevel } from
|
|
11
|
-
import { grabElementDataList, SymDataForSensor } from
|
|
12
|
-
import { HtmlElementSensor } from
|
|
10
|
+
import { options, sensitive, transactional, LoggingLevel } from "reactronic";
|
|
11
|
+
import { grabElementDataList, SymDataForSensor } from "./DataForSensor";
|
|
12
|
+
import { HtmlElementSensor } from "./HtmlElementSensor";
|
|
13
13
|
export var KeyboardModifiers;
|
|
14
14
|
(function (KeyboardModifiers) {
|
|
15
15
|
KeyboardModifiers[KeyboardModifiers["None"] = 0] = "None";
|
|
@@ -31,29 +31,29 @@ export var KeyboardModifiers;
|
|
|
31
31
|
export class KeyboardSensor extends HtmlElementSensor {
|
|
32
32
|
constructor() {
|
|
33
33
|
super();
|
|
34
|
-
this.down =
|
|
35
|
-
this.up =
|
|
34
|
+
this.down = "";
|
|
35
|
+
this.up = "";
|
|
36
36
|
this.modifiers = KeyboardModifiers.None;
|
|
37
37
|
}
|
|
38
38
|
listen(element, enabled = true) {
|
|
39
39
|
const existing = this.sourceElement;
|
|
40
40
|
if (element !== existing) {
|
|
41
41
|
if (existing) {
|
|
42
|
-
existing.removeEventListener(
|
|
43
|
-
existing.removeEventListener(
|
|
42
|
+
existing.removeEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
43
|
+
existing.removeEventListener("keyup", this.onKeyUp.bind(this), { capture: true });
|
|
44
44
|
}
|
|
45
45
|
this.sourceElement = element;
|
|
46
46
|
if (element && enabled) {
|
|
47
|
-
element.addEventListener(
|
|
48
|
-
element.addEventListener(
|
|
47
|
+
element.addEventListener("keydown", this.onKeyDown.bind(this), { capture: true });
|
|
48
|
+
element.addEventListener("keyup", this.onKeyUp.bind(this), { capture: true });
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
reset() {
|
|
53
53
|
this.preventDefault = false;
|
|
54
54
|
this.stopPropagation = false;
|
|
55
|
-
this.down =
|
|
56
|
-
this.up =
|
|
55
|
+
this.down = "";
|
|
56
|
+
this.up = "";
|
|
57
57
|
this.modifiers = KeyboardModifiers.None;
|
|
58
58
|
}
|
|
59
59
|
onKeyDown(e) {
|
|
@@ -66,31 +66,31 @@ export class KeyboardSensor extends HtmlElementSensor {
|
|
|
66
66
|
}
|
|
67
67
|
keyDown(e) {
|
|
68
68
|
this.updateSensorData(e);
|
|
69
|
-
this.up =
|
|
69
|
+
this.up = "";
|
|
70
70
|
sensitive(true, () => this.down = e.key);
|
|
71
71
|
}
|
|
72
72
|
keyUp(e) {
|
|
73
73
|
this.updateSensorData(e);
|
|
74
|
-
this.down =
|
|
74
|
+
this.down = "";
|
|
75
75
|
sensitive(true, () => this.up = e.key);
|
|
76
76
|
}
|
|
77
77
|
updateSensorData(e) {
|
|
78
78
|
this.preventDefault = false;
|
|
79
79
|
this.stopPropagation = false;
|
|
80
80
|
const path = e.composedPath();
|
|
81
|
-
this.elementDataList = grabElementDataList(path, SymDataForSensor,
|
|
81
|
+
this.elementDataList = grabElementDataList(path, SymDataForSensor, "keyboard", this.elementDataList).dataList;
|
|
82
82
|
this.modifiers = extractModifierKeys(e);
|
|
83
83
|
this.revision++;
|
|
84
84
|
}
|
|
85
85
|
static getKeyAsModifierIfAny(key) {
|
|
86
86
|
let modifier = KeyboardModifiers.None;
|
|
87
|
-
if (key ===
|
|
87
|
+
if (key === "Control")
|
|
88
88
|
modifier = KeyboardModifiers.Ctrl;
|
|
89
|
-
else if (key ===
|
|
89
|
+
else if (key === "Shift")
|
|
90
90
|
modifier = KeyboardModifiers.Shift;
|
|
91
|
-
else if (key ===
|
|
91
|
+
else if (key === "Alt")
|
|
92
92
|
modifier = KeyboardModifiers.Alt;
|
|
93
|
-
else if (key ===
|
|
93
|
+
else if (key === "Meta")
|
|
94
94
|
modifier = KeyboardModifiers.Meta;
|
|
95
95
|
return modifier;
|
|
96
96
|
}
|