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,182 @@
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, transactional, LoggingLevel } from 'reactronic';
11
+ import { objectHasMember } from '../../core/Utils';
12
+ import { grabElementDataList, SymDataForSensor } from './DataForSensor';
13
+ import { HtmlElementSensor } from './HtmlElementSensor';
14
+ export class FocusSensor extends HtmlElementSensor {
15
+ constructor(windowSensor) {
16
+ super(undefined, windowSensor);
17
+ this.activeData = undefined;
18
+ this.oldActiveData = undefined;
19
+ this.contextElementDataList = [];
20
+ }
21
+ setActiveData(data, debugHint = '') {
22
+ var _a, _b;
23
+ if (data !== this.activeData) {
24
+ const activeData = this.activeData;
25
+ if (activeData !== undefined && objectHasMember(activeData, 'isEditMode')) {
26
+ activeData.isEditMode = false;
27
+ (_a = activeData.onFocusOut) === null || _a === void 0 ? void 0 : _a.call(activeData, this);
28
+ }
29
+ if (data !== undefined) {
30
+ if (objectHasMember(data, 'isEditMode')) {
31
+ data.isEditMode = true;
32
+ (_b = data.onFocusIn) === null || _b === void 0 ? void 0 : _b.call(data, this);
33
+ }
34
+ }
35
+ this.oldActiveData = activeData;
36
+ this.activeData = data;
37
+ }
38
+ }
39
+ listen(element, enabled = true) {
40
+ const existing = this.sourceElement;
41
+ if (element !== existing) {
42
+ if (existing) {
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
+ }
47
+ this.sourceElement = element;
48
+ if (element && enabled) {
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
+ }
53
+ }
54
+ }
55
+ reset() {
56
+ this.preventDefault = false;
57
+ this.stopPropagation = false;
58
+ this.revision++;
59
+ }
60
+ onFocusIn(e) {
61
+ this.doFocusIn(e);
62
+ this.setPreventDefaultAndStopPropagation(e);
63
+ }
64
+ onFocusOut(e) {
65
+ this.doFocusOut(e);
66
+ this.setPreventDefaultAndStopPropagation(e);
67
+ }
68
+ onMouseDown(e) {
69
+ this.doMouseDown(e);
70
+ }
71
+ doFocusIn(e) {
72
+ var _a;
73
+ const path = e.composedPath();
74
+ const { dataList: focusDataList, activeData: focusActiveData, window } = grabElementDataList(path, SymDataForSensor, 'focus', this.elementDataList, false, e => document.activeElement === e);
75
+ this.elementDataList = focusDataList;
76
+ this.setActiveData(focusActiveData);
77
+ (_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(window);
78
+ const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor, 'context', this.contextElementDataList, true);
79
+ this.contextElementDataList = toggleContextRefs(this, this.contextElementDataList, contextDataList);
80
+ this.reset();
81
+ }
82
+ doFocusOut(e) {
83
+ var _a;
84
+ const isLosingFocus = e.relatedTarget === null;
85
+ if (isLosingFocus) {
86
+ const path = e.composedPath();
87
+ const { dataList } = grabElementDataList(path, SymDataForSensor, 'focus', this.elementDataList, true);
88
+ this.elementDataList = dataList;
89
+ const filteredElementDataList = dataList.filter(x => x !== this.activeData);
90
+ if (filteredElementDataList.length > 0) {
91
+ this.trySetEditMode(filteredElementDataList[0], ' └─');
92
+ }
93
+ else {
94
+ const defaultData = this.getDefaultSensorData();
95
+ if ((defaultData === null || defaultData === void 0 ? void 0 : defaultData.focus) !== undefined) {
96
+ this.trySetEditMode(defaultData.focus, ' └─');
97
+ }
98
+ else {
99
+ this.setActiveData(undefined);
100
+ }
101
+ (_a = this.windowSensor) === null || _a === void 0 ? void 0 : _a.setActiveWindow(defaultData === null || defaultData === void 0 ? void 0 : defaultData.window);
102
+ }
103
+ this.contextElementDataList = toggleContextRefs(this, this.contextElementDataList, []);
104
+ this.reset();
105
+ }
106
+ else {
107
+ }
108
+ }
109
+ doMouseDown(e) {
110
+ const path = e.composedPath();
111
+ const isClickInsideTabIndexedElement = path.find(el => el !== document.body && el.tabIndex >= 0) !== undefined;
112
+ if (path.length > 0 && !isClickInsideTabIndexedElement) {
113
+ const { dataList } = grabElementDataList(path, SymDataForSensor, 'focus', this.elementDataList, true);
114
+ this.elementDataList = dataList;
115
+ if (dataList.length > 0) {
116
+ this.trySetEditMode(dataList[0], '└─');
117
+ e.preventDefault();
118
+ }
119
+ const { dataList: contextDataList } = grabElementDataList(path, SymDataForSensor, 'context', this.contextElementDataList, true);
120
+ this.contextElementDataList = toggleContextRefs(this, this.contextElementDataList, contextDataList);
121
+ this.reset();
122
+ }
123
+ else {
124
+ }
125
+ }
126
+ trySetEditMode(candidateData, indent = '') {
127
+ if (candidateData !== undefined && objectHasMember(candidateData, 'isEditMode')) {
128
+ candidateData.isEditMode = true;
129
+ }
130
+ }
131
+ }
132
+ __decorate([
133
+ transactional,
134
+ __metadata("design:type", Function),
135
+ __metadata("design:paramtypes", [Object, String]),
136
+ __metadata("design:returntype", void 0)
137
+ ], FocusSensor.prototype, "setActiveData", null);
138
+ __decorate([
139
+ transactional,
140
+ __metadata("design:type", Function),
141
+ __metadata("design:paramtypes", [Object, Boolean]),
142
+ __metadata("design:returntype", void 0)
143
+ ], FocusSensor.prototype, "listen", null);
144
+ __decorate([
145
+ transactional,
146
+ options({ logging: LoggingLevel.Off }),
147
+ __metadata("design:type", Function),
148
+ __metadata("design:paramtypes", [FocusEvent]),
149
+ __metadata("design:returntype", void 0)
150
+ ], FocusSensor.prototype, "doFocusIn", null);
151
+ __decorate([
152
+ transactional,
153
+ __metadata("design:type", Function),
154
+ __metadata("design:paramtypes", [FocusEvent]),
155
+ __metadata("design:returntype", void 0)
156
+ ], FocusSensor.prototype, "doFocusOut", null);
157
+ __decorate([
158
+ transactional,
159
+ options({ logging: LoggingLevel.Off }),
160
+ __metadata("design:type", Function),
161
+ __metadata("design:paramtypes", [MouseEvent]),
162
+ __metadata("design:returntype", void 0)
163
+ ], FocusSensor.prototype, "doMouseDown", null);
164
+ function toggleContextRefs(focusSensor, existing, updated) {
165
+ if (updated !== existing) {
166
+ existing.forEach(x => {
167
+ var _a;
168
+ if (objectHasMember(x, 'contextToggle') && x.contextToggle && x.contextToggle.valueOn !== x.contextToggle.valueOff)
169
+ x.contextToggle.variable = x.contextToggle.valueOff;
170
+ if (objectHasMember(x, 'onContextOut'))
171
+ (_a = x.onContextOut) === null || _a === void 0 ? void 0 : _a.call(x, focusSensor);
172
+ });
173
+ updated.forEach(x => {
174
+ var _a;
175
+ if (objectHasMember(x, 'contextToggle') && x.contextToggle)
176
+ x.contextToggle.variable = x.contextToggle.valueOn;
177
+ if (objectHasMember(x, 'onContextIn'))
178
+ (_a = x.onContextIn) === null || _a === void 0 ? void 0 : _a.call(x, focusSensor);
179
+ });
180
+ }
181
+ return updated;
182
+ }
@@ -0,0 +1,10 @@
1
+ import { BasePointerSensor } from './BasePointerSensor';
2
+ export declare class HoverSensor extends BasePointerSensor {
3
+ target: unknown;
4
+ constructor();
5
+ listen(element: HTMLElement | undefined, enabled?: boolean): void;
6
+ protected onPointerOver(e: PointerEvent): void;
7
+ protected onPointerOut(e: PointerEvent): void;
8
+ protected doPointerOver(e: PointerEvent): void;
9
+ protected doPointerOut(): void;
10
+ }
@@ -0,0 +1,80 @@
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, transactional, LoggingLevel } from 'reactronic';
11
+ import { findTargetElementData, SymDataForSensor } from './DataForSensor';
12
+ import { extractModifierKeys, KeyboardModifiers } from './KeyboardSensor';
13
+ import { BasePointerSensor } from './BasePointerSensor';
14
+ export class HoverSensor extends BasePointerSensor {
15
+ constructor() {
16
+ super();
17
+ this.target = undefined;
18
+ this.target = undefined;
19
+ }
20
+ listen(element, enabled = true) {
21
+ const existing = this.sourceElement;
22
+ if (element !== existing) {
23
+ if (existing) {
24
+ existing.removeEventListener('pointerover', this.onPointerOver.bind(this), { capture: true });
25
+ existing.removeEventListener('pointerout', this.onPointerOut.bind(this), { capture: true });
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
+ }
32
+ }
33
+ }
34
+ onPointerOver(e) {
35
+ this.doPointerOver(e);
36
+ }
37
+ onPointerOut(e) {
38
+ this.doPointerOut();
39
+ }
40
+ doPointerOver(e) {
41
+ var _a;
42
+ this.preventDefault = false;
43
+ this.stopPropagation = false;
44
+ const targetPath = e.composedPath();
45
+ const underPointer = document.elementsFromPoint(e.clientX, e.clientY);
46
+ this.target = (_a = findTargetElementData(targetPath, underPointer, SymDataForSensor, ['hover']).data) === null || _a === void 0 ? void 0 : _a.hover;
47
+ this.modifiers = extractModifierKeys(e);
48
+ this.positionX = e.clientX;
49
+ this.positionY = e.clientY;
50
+ this.revision++;
51
+ }
52
+ doPointerOut() {
53
+ this.preventDefault = false;
54
+ this.stopPropagation = false;
55
+ this.positionX = Infinity;
56
+ this.positionY = Infinity;
57
+ this.modifiers = KeyboardModifiers.None;
58
+ this.target = undefined;
59
+ }
60
+ }
61
+ __decorate([
62
+ transactional,
63
+ __metadata("design:type", Function),
64
+ __metadata("design:paramtypes", [Object, Boolean]),
65
+ __metadata("design:returntype", void 0)
66
+ ], HoverSensor.prototype, "listen", null);
67
+ __decorate([
68
+ transactional,
69
+ options({ logging: LoggingLevel.Off }),
70
+ __metadata("design:type", Function),
71
+ __metadata("design:paramtypes", [PointerEvent]),
72
+ __metadata("design:returntype", void 0)
73
+ ], HoverSensor.prototype, "doPointerOver", null);
74
+ __decorate([
75
+ transactional,
76
+ options({ logging: LoggingLevel.Off }),
77
+ __metadata("design:type", Function),
78
+ __metadata("design:paramtypes", []),
79
+ __metadata("design:returntype", void 0)
80
+ ], HoverSensor.prototype, "doPointerOut", null);
@@ -0,0 +1,61 @@
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
+ export declare class HtmlDragSensor extends HtmlElementSensor {
8
+ draggable: unknown;
9
+ dragSource: unknown;
10
+ dragTarget: unknown;
11
+ dragTargetWindow: unknown;
12
+ previousDragTarget: unknown;
13
+ dragStarted: boolean;
14
+ dragFinished: boolean;
15
+ startX: number;
16
+ startY: number;
17
+ private dataByFormat;
18
+ private draggingImage;
19
+ private draggingImageX;
20
+ private draggingImageY;
21
+ dropEffect: DropEffect;
22
+ dataTypesAllowed: string[];
23
+ effectAllowed: DragEffectAllowed;
24
+ dropAllowed: boolean;
25
+ draggingOver: boolean;
26
+ draggingDataTypes: string[];
27
+ positionX: number;
28
+ positionY: number;
29
+ modifiers: KeyboardModifiers;
30
+ dropX: number;
31
+ dropY: number;
32
+ dropped: boolean;
33
+ immediatePositionX: number;
34
+ immediatePositionY: number;
35
+ immediateModifiers: KeyboardModifiers;
36
+ constructor(focusSensor: FocusSensor, windowSensor: WindowSensor);
37
+ getData(format: string): unknown;
38
+ setData(format: string, value: unknown): void;
39
+ clearData(format?: string): void;
40
+ setDragImage(value: HTMLElement, x: number, y: number): void;
41
+ listen(element: HTMLElement | undefined, enabled?: boolean): void;
42
+ protected onDragStart(e: DragEvent): void;
43
+ protected onDrag(e: DragEvent): void;
44
+ protected onDragEnter(e: DragEvent): void;
45
+ protected onDragLeave(e: DragEvent): void;
46
+ protected onDragOver(e: DragEvent): void;
47
+ protected onDrop(e: DragEvent): void;
48
+ protected onDragEnd(e: DragEvent): void;
49
+ protected startDragging(e: DragEvent): void;
50
+ protected dragging(e: DragEvent): void;
51
+ protected finishDragging(e: DragEvent): void;
52
+ protected enterTarget(e: DragEvent): void;
53
+ protected leaveTarget(e: DragEvent): void;
54
+ protected dragOver(e: DragEvent): void;
55
+ protected drop(e: DragEvent): void;
56
+ protected updateEventOnDragStart(e: DragEvent): void;
57
+ protected updateEventOnDropAllowed(e: DragEvent): void;
58
+ protected reset(): void;
59
+ protected updateDragTarget(e: DragEvent): void;
60
+ protected whenDragging(): void;
61
+ }