verstak 0.22.412

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.
Files changed (59) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +28 -0
  3. package/build/dist/source/api.d.ts +2 -0
  4. package/build/dist/source/api.js +2 -0
  5. package/build/dist/source/archive/RxDomV1.Types.d.ts +46 -0
  6. package/build/dist/source/archive/RxDomV1.Types.js +22 -0
  7. package/build/dist/source/archive/RxDomV1.d.ts +45 -0
  8. package/build/dist/source/archive/RxDomV1.js +556 -0
  9. package/build/dist/source/core/Elements.d.ts +4 -0
  10. package/build/dist/source/core/Elements.js +7 -0
  11. package/build/dist/source/core/Restyler.d.ts +7 -0
  12. package/build/dist/source/core/Restyler.js +30 -0
  13. package/build/dist/source/core/RxNode.d.ts +59 -0
  14. package/build/dist/source/core/RxNode.js +426 -0
  15. package/build/dist/source/core/Utils.d.ts +1 -0
  16. package/build/dist/source/core/Utils.js +3 -0
  17. package/build/dist/source/core/api.d.ts +4 -0
  18. package/build/dist/source/core/api.js +4 -0
  19. package/build/dist/source/html/CellRange.d.ts +11 -0
  20. package/build/dist/source/html/CellRange.js +175 -0
  21. package/build/dist/source/html/HtmlApiExt.d.ts +7 -0
  22. package/build/dist/source/html/HtmlApiExt.js +25 -0
  23. package/build/dist/source/html/HtmlElements.d.ts +349 -0
  24. package/build/dist/source/html/HtmlElements.js +529 -0
  25. package/build/dist/source/html/HtmlNodeFactory.d.ts +19 -0
  26. package/build/dist/source/html/HtmlNodeFactory.js +96 -0
  27. package/build/dist/source/html/RxFocuser.d.ts +2 -0
  28. package/build/dist/source/html/RxFocuser.js +11 -0
  29. package/build/dist/source/html/api.d.ts +18 -0
  30. package/build/dist/source/html/api.js +18 -0
  31. package/build/dist/source/html/sensors/BasePointerSensor.d.ts +18 -0
  32. package/build/dist/source/html/sensors/BasePointerSensor.js +32 -0
  33. package/build/dist/source/html/sensors/ButtonSensor.d.ts +32 -0
  34. package/build/dist/source/html/sensors/ButtonSensor.js +211 -0
  35. package/build/dist/source/html/sensors/DataForSensor.d.ts +27 -0
  36. package/build/dist/source/html/sensors/DataForSensor.js +72 -0
  37. package/build/dist/source/html/sensors/FocusSensor.d.ts +29 -0
  38. package/build/dist/source/html/sensors/FocusSensor.js +182 -0
  39. package/build/dist/source/html/sensors/HoverSensor.d.ts +10 -0
  40. package/build/dist/source/html/sensors/HoverSensor.js +80 -0
  41. package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +61 -0
  42. package/build/dist/source/html/sensors/HtmlDragSensor.js +386 -0
  43. package/build/dist/source/html/sensors/HtmlElementSensor.d.ts +13 -0
  44. package/build/dist/source/html/sensors/HtmlElementSensor.js +53 -0
  45. package/build/dist/source/html/sensors/HtmlSensors.d.ts +22 -0
  46. package/build/dist/source/html/sensors/HtmlSensors.js +47 -0
  47. package/build/dist/source/html/sensors/KeyboardSensor.d.ts +33 -0
  48. package/build/dist/source/html/sensors/KeyboardSensor.js +143 -0
  49. package/build/dist/source/html/sensors/PointerSensor.d.ts +60 -0
  50. package/build/dist/source/html/sensors/PointerSensor.js +394 -0
  51. package/build/dist/source/html/sensors/ResizeSensor.d.ts +18 -0
  52. package/build/dist/source/html/sensors/ResizeSensor.js +72 -0
  53. package/build/dist/source/html/sensors/Sensor.d.ts +6 -0
  54. package/build/dist/source/html/sensors/Sensor.js +11 -0
  55. package/build/dist/source/html/sensors/WheelSensor.d.ts +13 -0
  56. package/build/dist/source/html/sensors/WheelSensor.js +86 -0
  57. package/build/dist/source/html/sensors/WindowSensor.d.ts +10 -0
  58. package/build/dist/source/html/sensors/WindowSensor.js +38 -0
  59. package/package.json +54 -0
@@ -0,0 +1,386 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
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
+ export class HtmlDragSensor extends HtmlElementSensor {
15
+ constructor(focusSensor, windowSensor) {
16
+ super(focusSensor, windowSensor);
17
+ this.draggable = undefined;
18
+ this.dragSource = undefined;
19
+ this.dragTarget = undefined;
20
+ this.dragTargetWindow = undefined;
21
+ this.previousDragTarget = undefined;
22
+ this.dragStarted = false;
23
+ this.dragFinished = false;
24
+ this.startX = Infinity;
25
+ this.startY = Infinity;
26
+ this.dataByFormat = new Map();
27
+ this.draggingImage = undefined;
28
+ this.draggingImageX = Infinity;
29
+ this.draggingImageY = Infinity;
30
+ this.dropEffect = 'none';
31
+ this.dataTypesAllowed = [];
32
+ this.effectAllowed = 'uninitialized';
33
+ this.dropAllowed = false;
34
+ this.draggingOver = false;
35
+ this.draggingDataTypes = [];
36
+ this.positionX = Infinity;
37
+ this.positionY = Infinity;
38
+ this.modifiers = KeyboardModifiers.None;
39
+ this.dropX = Infinity;
40
+ this.dropY = Infinity;
41
+ this.dropped = false;
42
+ this.immediatePositionX = Infinity;
43
+ this.immediatePositionY = Infinity;
44
+ this.immediateModifiers = KeyboardModifiers.None;
45
+ }
46
+ getData(format) {
47
+ return this.dataByFormat.get(format);
48
+ }
49
+ setData(format, value) {
50
+ this.dataByFormat.set(format, value);
51
+ }
52
+ clearData(format) {
53
+ if (format)
54
+ this.dataByFormat.delete(format);
55
+ else
56
+ this.dataByFormat.clear();
57
+ }
58
+ setDragImage(value, x, y) {
59
+ this.draggingImage = value;
60
+ this.draggingImageX = x;
61
+ this.draggingImageY = y;
62
+ }
63
+ listen(element, enabled = true) {
64
+ const existing = this.sourceElement;
65
+ if (element !== existing) {
66
+ if (existing) {
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
+ }
75
+ this.sourceElement = element;
76
+ if (element && enabled) {
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
+ }
85
+ }
86
+ }
87
+ onDragStart(e) {
88
+ this.startDragging(e);
89
+ this.updateEventOnDragStart(e);
90
+ }
91
+ onDrag(e) {
92
+ this.dragging(e);
93
+ }
94
+ onDragEnter(e) {
95
+ this.enterTarget(e);
96
+ this.updateEventOnDropAllowed(e);
97
+ }
98
+ onDragLeave(e) {
99
+ this.leaveTarget(e);
100
+ }
101
+ onDragOver(e) {
102
+ this.dragOver(e);
103
+ this.updateEventOnDropAllowed(e);
104
+ }
105
+ onDrop(e) {
106
+ this.drop(e);
107
+ }
108
+ onDragEnd(e) {
109
+ this.finishDragging(e);
110
+ this.reset();
111
+ }
112
+ startDragging(e) {
113
+ var _a;
114
+ this.preventDefault = false;
115
+ this.stopPropagation = false;
116
+ const targetPath = e.composedPath();
117
+ const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
118
+ const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ['htmlDraggable']);
119
+ this.draggable = data === null || data === void 0 ? void 0 : data.htmlDraggable;
120
+ this.dragSource = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, ['htmlDrag'], true).data) === null || _a === void 0 ? void 0 : _a.htmlDrag;
121
+ this.dragStarted = true;
122
+ this.dragFinished = false;
123
+ this.startX = e.clientX;
124
+ this.startY = e.clientY;
125
+ this.modifiers = extractModifierKeys(e);
126
+ this.positionX = e.clientX;
127
+ this.positionY = e.clientY;
128
+ this.dropped = false;
129
+ this.dragTarget = undefined;
130
+ this.dragTargetWindow = undefined;
131
+ this.previousDragTarget = undefined;
132
+ this.revision++;
133
+ Transaction.separate(() => {
134
+ var _a;
135
+ (_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window, 'htmlDrag');
136
+ });
137
+ }
138
+ dragging(e) {
139
+ this.dragStarted = true;
140
+ this.dragFinished = false;
141
+ this.revision++;
142
+ }
143
+ finishDragging(e) {
144
+ this.dragFinished = true;
145
+ this.revision++;
146
+ }
147
+ enterTarget(e) {
148
+ this.updateDragTarget(e);
149
+ this.dropped = false;
150
+ this.revision++;
151
+ }
152
+ leaveTarget(e) {
153
+ }
154
+ dragOver(e) {
155
+ this.updateDragTarget(e);
156
+ this.dropped = false;
157
+ this.revision++;
158
+ }
159
+ drop(e) {
160
+ this.updateDragTarget(e);
161
+ this.modifiers = this.immediateModifiers;
162
+ this.dropX = e.clientX;
163
+ this.dropY = e.clientY;
164
+ this.dropped = true;
165
+ const dt = e.dataTransfer;
166
+ if (dt) {
167
+ let dataByFormat = this.dataByFormat;
168
+ dt.types.forEach(type => {
169
+ if (!dataByFormat.has(type)) {
170
+ const data = dt.getData(type);
171
+ if (data !== '') {
172
+ this.dataByFormat = dataByFormat = dataByFormat.toMutable();
173
+ dataByFormat.set(type, data);
174
+ }
175
+ }
176
+ });
177
+ }
178
+ this.revision++;
179
+ }
180
+ updateEventOnDragStart(e) {
181
+ const dt = e.dataTransfer;
182
+ if (dt) {
183
+ dt.dropEffect = this.dropEffect;
184
+ dt.effectAllowed = this.effectAllowed;
185
+ this.dataByFormat.forEach((data, format) => {
186
+ if (typeof data === 'string')
187
+ dt.setData(format, data);
188
+ });
189
+ if (this.draggingImage) {
190
+ dt.setDragImage(this.draggingImage, this.draggingImageX, this.draggingImageY);
191
+ }
192
+ }
193
+ }
194
+ updateEventOnDropAllowed(e) {
195
+ if (this.dropAllowed)
196
+ e.preventDefault();
197
+ }
198
+ reset() {
199
+ this.draggable = undefined;
200
+ this.dragSource = undefined;
201
+ this.dragTarget = undefined;
202
+ this.dragTargetWindow = undefined;
203
+ this.previousDragTarget = undefined;
204
+ this.dragStarted = false;
205
+ this.dragFinished = false;
206
+ this.startX = Infinity;
207
+ this.startY = Infinity;
208
+ this.dataByFormat.clear();
209
+ this.draggingImage = undefined;
210
+ this.draggingImageX = Infinity;
211
+ this.draggingImageY = Infinity;
212
+ this.dropEffect = 'none';
213
+ this.dataTypesAllowed = [];
214
+ this.effectAllowed = 'uninitialized';
215
+ this.dropAllowed = false;
216
+ this.draggingOver = false;
217
+ this.draggingDataTypes = [];
218
+ this.positionX = Infinity;
219
+ this.positionY = Infinity;
220
+ this.modifiers = KeyboardModifiers.None;
221
+ this.dropX = Infinity;
222
+ this.dropY = Infinity;
223
+ this.dropped = false;
224
+ this.immediatePositionX = Infinity;
225
+ this.immediatePositionY = Infinity;
226
+ this.immediateModifiers = KeyboardModifiers.None;
227
+ this.revision++;
228
+ }
229
+ updateDragTarget(e) {
230
+ var _a;
231
+ const targetPath = e.composedPath();
232
+ const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
233
+ const { data, window } = findTargetElementData(targetPath, underPointer, SymDataForSensor, ['htmlDrag']);
234
+ const dragTarget = data === null || data === void 0 ? void 0 : data.htmlDrag;
235
+ if (dragTarget !== this.dragTarget) {
236
+ this.previousDragTarget = this.dragTarget;
237
+ this.dragTarget = dragTarget;
238
+ this.dragTargetWindow = window;
239
+ }
240
+ const types = (_a = e.dataTransfer) === null || _a === void 0 ? void 0 : _a.types;
241
+ if (types) {
242
+ if (!areEqualArrays(types, this.draggingDataTypes)) {
243
+ const draggingDataTypes = new Array();
244
+ for (let i = 0; i < types.length; i++)
245
+ draggingDataTypes.push(types[i]);
246
+ this.draggingDataTypes = draggingDataTypes;
247
+ }
248
+ }
249
+ this.immediateModifiers = extractModifierKeys(e);
250
+ this.immediatePositionX = e.clientX;
251
+ this.immediatePositionY = e.clientY;
252
+ this.draggingOver = true;
253
+ }
254
+ whenDragging() {
255
+ if (this.draggingOver) {
256
+ this.positionX = this.immediatePositionX;
257
+ this.positionY = this.immediatePositionY;
258
+ this.modifiers = this.immediateModifiers;
259
+ }
260
+ }
261
+ }
262
+ __decorate([
263
+ raw,
264
+ __metadata("design:type", Map)
265
+ ], HtmlDragSensor.prototype, "dataByFormat", void 0);
266
+ __decorate([
267
+ raw,
268
+ __metadata("design:type", Object)
269
+ ], HtmlDragSensor.prototype, "draggingImage", void 0);
270
+ __decorate([
271
+ raw,
272
+ __metadata("design:type", Number)
273
+ ], HtmlDragSensor.prototype, "draggingImageX", void 0);
274
+ __decorate([
275
+ raw,
276
+ __metadata("design:type", Number)
277
+ ], HtmlDragSensor.prototype, "draggingImageY", void 0);
278
+ __decorate([
279
+ raw,
280
+ __metadata("design:type", String)
281
+ ], HtmlDragSensor.prototype, "dropEffect", void 0);
282
+ __decorate([
283
+ raw,
284
+ __metadata("design:type", Array)
285
+ ], HtmlDragSensor.prototype, "dataTypesAllowed", void 0);
286
+ __decorate([
287
+ raw,
288
+ __metadata("design:type", String)
289
+ ], HtmlDragSensor.prototype, "effectAllowed", void 0);
290
+ __decorate([
291
+ raw,
292
+ __metadata("design:type", Boolean)
293
+ ], 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
+ __decorate([
301
+ transactional,
302
+ options({ logging: LoggingLevel.Off }),
303
+ __metadata("design:type", Function),
304
+ __metadata("design:paramtypes", [DragEvent]),
305
+ __metadata("design:returntype", void 0)
306
+ ], HtmlDragSensor.prototype, "startDragging", null);
307
+ __decorate([
308
+ transactional,
309
+ options({ logging: LoggingLevel.Off }),
310
+ __metadata("design:type", Function),
311
+ __metadata("design:paramtypes", [DragEvent]),
312
+ __metadata("design:returntype", void 0)
313
+ ], HtmlDragSensor.prototype, "dragging", null);
314
+ __decorate([
315
+ transactional,
316
+ options({ logging: LoggingLevel.Off }),
317
+ __metadata("design:type", Function),
318
+ __metadata("design:paramtypes", [DragEvent]),
319
+ __metadata("design:returntype", void 0)
320
+ ], HtmlDragSensor.prototype, "finishDragging", null);
321
+ __decorate([
322
+ transactional,
323
+ options({ logging: LoggingLevel.Off }),
324
+ __metadata("design:type", Function),
325
+ __metadata("design:paramtypes", [DragEvent]),
326
+ __metadata("design:returntype", void 0)
327
+ ], HtmlDragSensor.prototype, "enterTarget", null);
328
+ __decorate([
329
+ transactional,
330
+ options({ logging: LoggingLevel.Off }),
331
+ __metadata("design:type", Function),
332
+ __metadata("design:paramtypes", [DragEvent]),
333
+ __metadata("design:returntype", void 0)
334
+ ], HtmlDragSensor.prototype, "leaveTarget", null);
335
+ __decorate([
336
+ transactional,
337
+ options({ logging: LoggingLevel.Off }),
338
+ __metadata("design:type", Function),
339
+ __metadata("design:paramtypes", [DragEvent]),
340
+ __metadata("design:returntype", void 0)
341
+ ], HtmlDragSensor.prototype, "dragOver", null);
342
+ __decorate([
343
+ transactional,
344
+ options({ logging: LoggingLevel.Off }),
345
+ __metadata("design:type", Function),
346
+ __metadata("design:paramtypes", [DragEvent]),
347
+ __metadata("design:returntype", void 0)
348
+ ], HtmlDragSensor.prototype, "drop", null);
349
+ __decorate([
350
+ transactional,
351
+ options({ logging: LoggingLevel.Off }),
352
+ __metadata("design:type", Function),
353
+ __metadata("design:paramtypes", [DragEvent]),
354
+ __metadata("design:returntype", void 0)
355
+ ], HtmlDragSensor.prototype, "updateEventOnDragStart", null);
356
+ __decorate([
357
+ transactional,
358
+ options({ logging: LoggingLevel.Off }),
359
+ __metadata("design:type", Function),
360
+ __metadata("design:paramtypes", [DragEvent]),
361
+ __metadata("design:returntype", void 0)
362
+ ], HtmlDragSensor.prototype, "updateEventOnDropAllowed", null);
363
+ __decorate([
364
+ transactional,
365
+ options({ logging: LoggingLevel.Off }),
366
+ __metadata("design:type", Function),
367
+ __metadata("design:paramtypes", []),
368
+ __metadata("design:returntype", void 0)
369
+ ], HtmlDragSensor.prototype, "reset", null);
370
+ __decorate([
371
+ reactive,
372
+ options({ throttling: 0 }),
373
+ __metadata("design:type", Function),
374
+ __metadata("design:paramtypes", []),
375
+ __metadata("design:returntype", void 0)
376
+ ], HtmlDragSensor.prototype, "whenDragging", null);
377
+ function areEqualArrays(array1, array2) {
378
+ let result = true;
379
+ for (let i = 0; i < array1.length; i++) {
380
+ if (array1[i] !== array2[i]) {
381
+ result = false;
382
+ break;
383
+ }
384
+ }
385
+ return result;
386
+ }
@@ -0,0 +1,13 @@
1
+ import { DataForSensor } from './DataForSensor';
2
+ import { Sensor } from './Sensor';
3
+ import { WindowSensor } from './WindowSensor';
4
+ export declare class HtmlElementSensor extends Sensor {
5
+ readonly focusSensor?: any;
6
+ readonly windowSensor?: WindowSensor;
7
+ sourceElement: HTMLElement | undefined;
8
+ preventDefault: boolean;
9
+ stopPropagation: boolean;
10
+ constructor(focusSensor?: any, windowSensor?: WindowSensor);
11
+ protected getDefaultSensorData(): DataForSensor | undefined;
12
+ protected setPreventDefaultAndStopPropagation(e: Event): void;
13
+ }
@@ -0,0 +1,53 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { raw } from 'reactronic';
11
+ import { SymDataForSensor } from './DataForSensor';
12
+ import { Sensor } from './Sensor';
13
+ import { WindowSensor } from './WindowSensor';
14
+ export class HtmlElementSensor extends Sensor {
15
+ constructor(focusSensor, windowSensor) {
16
+ super();
17
+ this.sourceElement = undefined;
18
+ this.focusSensor = focusSensor;
19
+ this.windowSensor = windowSensor;
20
+ this.preventDefault = false;
21
+ this.stopPropagation = false;
22
+ }
23
+ getDefaultSensorData() {
24
+ const sourceElement = this.sourceElement;
25
+ return sourceElement ? sourceElement[SymDataForSensor] : undefined;
26
+ }
27
+ setPreventDefaultAndStopPropagation(e) {
28
+ if (this.preventDefault) {
29
+ e.preventDefault();
30
+ this.preventDefault = false;
31
+ }
32
+ if (this.stopPropagation) {
33
+ e.stopPropagation();
34
+ this.stopPropagation = false;
35
+ }
36
+ }
37
+ }
38
+ __decorate([
39
+ raw,
40
+ __metadata("design:type", Object)
41
+ ], HtmlElementSensor.prototype, "focusSensor", void 0);
42
+ __decorate([
43
+ raw,
44
+ __metadata("design:type", WindowSensor)
45
+ ], HtmlElementSensor.prototype, "windowSensor", void 0);
46
+ __decorate([
47
+ raw,
48
+ __metadata("design:type", Boolean)
49
+ ], HtmlElementSensor.prototype, "preventDefault", void 0);
50
+ __decorate([
51
+ raw,
52
+ __metadata("design:type", Boolean)
53
+ ], HtmlElementSensor.prototype, "stopPropagation", void 0);
@@ -0,0 +1,22 @@
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
+ export declare class HtmlSensors {
11
+ readonly window: WindowSensor;
12
+ readonly focus: FocusSensor;
13
+ readonly hover: HoverSensor;
14
+ readonly keyboard: KeyboardSensor;
15
+ readonly wheel: WheelSensor;
16
+ readonly resize: ResizeSensor;
17
+ readonly htmlDrag: HtmlDragSensor;
18
+ readonly button: ButtonSensor;
19
+ readonly pointer: PointerSensor;
20
+ constructor();
21
+ listen(element: HTMLElement | undefined, enabled?: boolean): void;
22
+ }
@@ -0,0 +1,47 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
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
+ export class HtmlSensors {
21
+ constructor() {
22
+ this.window = new WindowSensor();
23
+ this.focus = new FocusSensor(this.window);
24
+ this.hover = new HoverSensor();
25
+ this.keyboard = new KeyboardSensor();
26
+ this.wheel = new WheelSensor();
27
+ this.resize = new ResizeSensor();
28
+ this.htmlDrag = new HtmlDragSensor(this.focus, this.window);
29
+ this.button = new ButtonSensor(this.focus, this.window);
30
+ this.pointer = new PointerSensor(this.focus, this.window);
31
+ }
32
+ listen(element, enabled = true) {
33
+ this.focus.listen(element, enabled);
34
+ this.hover.listen(element, enabled);
35
+ this.keyboard.listen(element, enabled);
36
+ this.wheel.listen(element, enabled);
37
+ this.htmlDrag.listen(element, enabled);
38
+ this.button.listen(element, enabled);
39
+ this.pointer.listen(element, enabled);
40
+ }
41
+ }
42
+ __decorate([
43
+ transactional,
44
+ __metadata("design:type", Function),
45
+ __metadata("design:paramtypes", [Object, Boolean]),
46
+ __metadata("design:returntype", void 0)
47
+ ], HtmlSensors.prototype, "listen", null);
@@ -0,0 +1,33 @@
1
+ import { HtmlElementSensor } from './HtmlElementSensor';
2
+ export declare enum KeyboardModifiers {
3
+ None = 0,
4
+ Ctrl = 1,
5
+ Shift = 2,
6
+ Alt = 4,
7
+ Meta = 8,
8
+ CtrlShift = 3,
9
+ CtrlAlt = 5,
10
+ CtrlMeta = 9,
11
+ CtrlShiftAlt = 7,
12
+ CtrlShiftAltMeta = 15,
13
+ CtrlShiftMeta = 11,
14
+ ShiftAlt = 6,
15
+ ShiftMeta = 10,
16
+ ShiftAltMeta = 14,
17
+ AltMeta = 12
18
+ }
19
+ export declare class KeyboardSensor extends HtmlElementSensor {
20
+ down: string;
21
+ up: string;
22
+ modifiers: KeyboardModifiers;
23
+ constructor();
24
+ listen(element: HTMLElement | undefined, enabled?: boolean): void;
25
+ reset(): void;
26
+ protected onKeyDown(e: KeyboardEvent): void;
27
+ protected onKeyUp(e: KeyboardEvent): void;
28
+ protected keyDown(e: KeyboardEvent): void;
29
+ protected keyUp(e: KeyboardEvent): void;
30
+ protected updateSensorData(e: KeyboardEvent): void;
31
+ protected static getKeyAsModifierIfAny(key: string): KeyboardModifiers;
32
+ }
33
+ export declare function extractModifierKeys(e: MouseEvent | KeyboardEvent | WheelEvent): KeyboardModifiers;