verstak 0.22.500 → 0.22.503

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 (66) hide show
  1. package/build/dist/source/api.d.ts +2 -2
  2. package/build/dist/source/api.js +2 -2
  3. package/build/dist/source/archive/RxDomV1.d.ts +1 -1
  4. package/build/dist/source/archive/RxDomV1.js +13 -13
  5. package/build/dist/source/core/Allocator.d.ts +64 -0
  6. package/build/dist/source/core/Allocator.js +141 -0
  7. package/build/dist/source/core/CellRange.d.ts +8 -0
  8. package/build/dist/source/core/CellRange.js +173 -0
  9. package/build/dist/source/core/Kernel.d.ts +77 -0
  10. package/build/dist/source/core/Kernel.js +504 -0
  11. package/build/dist/source/core/Restyler.js +1 -1
  12. package/build/dist/source/core/api.d.ts +5 -5
  13. package/build/dist/source/core/api.js +5 -5
  14. package/build/dist/source/html/Blocks.d.ts +14 -0
  15. package/build/dist/source/html/Blocks.js +124 -0
  16. package/build/dist/source/html/HtmlApiExt.d.ts +1 -1
  17. package/build/dist/source/html/HtmlApiExt.js +3 -3
  18. package/build/dist/source/html/HtmlBlocks.d.ts +175 -0
  19. package/build/dist/source/html/HtmlBlocks.js +356 -0
  20. package/build/dist/source/html/HtmlDriver.d.ts +20 -0
  21. package/build/dist/source/html/{HtmlNodeFactory.js → HtmlDriver.js} +25 -23
  22. package/build/dist/source/html/ReactingFocuser.d.ts +2 -0
  23. package/build/dist/source/html/ReactingFocuser.js +16 -0
  24. package/build/dist/source/html/api.d.ts +18 -17
  25. package/build/dist/source/html/api.js +18 -17
  26. package/build/dist/source/html/sensors/BasePointerSensor.d.ts +4 -4
  27. package/build/dist/source/html/sensors/BasePointerSensor.js +2 -2
  28. package/build/dist/source/html/sensors/ButtonSensor.d.ts +3 -3
  29. package/build/dist/source/html/sensors/ButtonSensor.js +17 -17
  30. package/build/dist/source/html/sensors/DataForSensor.js +6 -6
  31. package/build/dist/source/html/sensors/FocusSensor.d.ts +3 -3
  32. package/build/dist/source/html/sensors/FocusSensor.js +27 -27
  33. package/build/dist/source/html/sensors/HoverSensor.d.ts +1 -1
  34. package/build/dist/source/html/sensors/HoverSensor.js +9 -9
  35. package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +6 -6
  36. package/build/dist/source/html/sensors/HtmlDragSensor.js +28 -28
  37. package/build/dist/source/html/sensors/HtmlElementSensor.d.ts +3 -3
  38. package/build/dist/source/html/sensors/HtmlElementSensor.js +4 -4
  39. package/build/dist/source/html/sensors/HtmlSensors.d.ts +9 -9
  40. package/build/dist/source/html/sensors/HtmlSensors.js +10 -10
  41. package/build/dist/source/html/sensors/KeyboardSensor.d.ts +1 -1
  42. package/build/dist/source/html/sensors/KeyboardSensor.js +18 -18
  43. package/build/dist/source/html/sensors/PointerSensor.d.ts +4 -4
  44. package/build/dist/source/html/sensors/PointerSensor.js +20 -20
  45. package/build/dist/source/html/sensors/ResizeSensor.d.ts +3 -3
  46. package/build/dist/source/html/sensors/ResizeSensor.js +13 -13
  47. package/build/dist/source/html/sensors/Sensor.d.ts +1 -1
  48. package/build/dist/source/html/sensors/Sensor.js +1 -1
  49. package/build/dist/source/html/sensors/WheelSensor.d.ts +1 -1
  50. package/build/dist/source/html/sensors/WheelSensor.js +7 -7
  51. package/build/dist/source/html/sensors/WindowSensor.d.ts +2 -2
  52. package/build/dist/source/html/sensors/WindowSensor.js +5 -5
  53. package/package.json +3 -3
  54. package/build/dist/source/core/Block.d.ts +0 -62
  55. package/build/dist/source/core/Block.js +0 -431
  56. package/build/dist/source/core/Elements.d.ts +0 -3
  57. package/build/dist/source/core/Elements.js +0 -7
  58. package/build/dist/source/core/Layout.d.ts +0 -27
  59. package/build/dist/source/core/Layout.js +0 -259
  60. package/build/dist/source/html/Cluster.d.ts +0 -11
  61. package/build/dist/source/html/Cluster.js +0 -14
  62. package/build/dist/source/html/HtmlElements.d.ts +0 -349
  63. package/build/dist/source/html/HtmlElements.js +0 -529
  64. package/build/dist/source/html/HtmlNodeFactory.d.ts +0 -19
  65. package/build/dist/source/html/RxFocuser.d.ts +0 -2
  66. package/build/dist/source/html/RxFocuser.js +0 -11
@@ -1,2 +1,2 @@
1
- export * from './core/api';
2
- export * from './html/api';
1
+ export * from "./core/api";
2
+ export * from "./html/api";
@@ -1,2 +1,2 @@
1
- export * from './core/api';
2
- export * from './html/api';
1
+ export * from "./core/api";
2
+ export * from "./html/api";
@@ -1,4 +1,4 @@
1
- import { Render, SuperRender, RxNodeType, RxNodeInstance, RxNode } from './RxDomV1.Types';
1
+ import { Render, SuperRender, RxNodeType, RxNodeInstance, RxNode } from "./RxDomV1.Types";
2
2
  export declare class BasicNodeType<E, O> implements RxNodeType<E, O> {
3
3
  readonly name: string;
4
4
  readonly sequential: boolean;
@@ -16,8 +16,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
16
16
  step((generator = generator.apply(thisArg, _arguments || [])).next());
17
17
  });
18
18
  };
19
- import { reactive, nonreactive, Transaction, Rx, options, Reentrance } from 'reactronic';
20
- import { RxNode } from './RxDomV1.Types';
19
+ import { reactive, nonreactive, Transaction, Rx, options, Reentrance } from "reactronic";
20
+ import { RxNode } from "./RxDomV1.Types";
21
21
  export class BasicNodeType {
22
22
  constructor(name, sequential) {
23
23
  this.name = name;
@@ -30,9 +30,9 @@ export class BasicNodeType {
30
30
  render(node, args) {
31
31
  const inst = node.instance;
32
32
  if (!inst)
33
- throw new Error('element must be initialized before rendering');
33
+ throw new Error("element must be initialized before rendering");
34
34
  if (inst.buffer)
35
- throw new Error('rendering re-entrance is not supported yet');
35
+ throw new Error("rendering re-entrance is not supported yet");
36
36
  inst.buffer = [];
37
37
  let result;
38
38
  if (node.superRender)
@@ -96,7 +96,7 @@ export class RxDom {
96
96
  static Root(render) {
97
97
  const inst = SYSTEM.instance;
98
98
  if (inst.buffer)
99
- throw new Error('rendering re-entrance is not supported yet');
99
+ throw new Error("rendering re-entrance is not supported yet");
100
100
  inst.buffer = [];
101
101
  let result = render();
102
102
  if (result instanceof Promise)
@@ -110,14 +110,14 @@ export class RxDom {
110
110
  const o = creator !== null && creator !== void 0 ? creator : gCreator;
111
111
  const inst = o.instance;
112
112
  if (!inst)
113
- throw new Error('element must be initialized before children');
113
+ throw new Error("element must be initialized before children");
114
114
  if (type === undefined)
115
115
  type = RxDom.basic;
116
116
  if (!host)
117
117
  host = gHost;
118
118
  const node = new RxNode(id, args, render, superRender, 0, false, type, inline !== null && inline !== void 0 ? inline : false, o, host);
119
119
  if (inst.buffer === undefined)
120
- throw new Error('children are rendered already');
120
+ throw new Error("children are rendered already");
121
121
  const rev = (_b = (_a = host.instance) === null || _a === void 0 ? void 0 : _a.revision) !== null && _b !== void 0 ? _b : ~1;
122
122
  if (rev >= ~0)
123
123
  inst.buffer.push(node);
@@ -148,8 +148,8 @@ export class RxDom {
148
148
  const inst = new RxNodeInstanceImpl(0);
149
149
  const node = new RxNode(id, null, () => { }, undefined, 0, false, { name: id, sequential }, false, {}, {}, inst);
150
150
  const a = node;
151
- a['creator'] = node;
152
- a['host'] = node;
151
+ a["creator"] = node;
152
+ a["host"] = node;
153
153
  inst.native = native;
154
154
  return node;
155
155
  }
@@ -159,13 +159,13 @@ export class RxDom {
159
159
  static currentNodeInstance() {
160
160
  const inst = gCreator.instance;
161
161
  if (!inst)
162
- throw new Error('currentNodeInstance function can be called only inside rendering function');
162
+ throw new Error("currentNodeInstance function can be called only inside rendering function");
163
163
  return inst;
164
164
  }
165
165
  static currentNodeInstanceInternal() {
166
166
  const inst = gCreator.instance;
167
167
  if (!inst)
168
- throw new Error('currentNodeInstanceInternal function can be called only inside rendering function');
168
+ throw new Error("currentNodeInstanceInternal function can be called only inside rendering function");
169
169
  return inst;
170
170
  }
171
171
  static currentNodeRevision() {
@@ -416,7 +416,7 @@ export class RxDom {
416
416
  }
417
417
  }
418
418
  }
419
- RxDom.basic = new BasicNodeType('basic', false);
419
+ RxDom.basic = new BasicNodeType("basic", false);
420
420
  function tryToRender(node) {
421
421
  const inst = node.instance;
422
422
  if (node.inline)
@@ -551,6 +551,6 @@ export function rejectRethrow(error) {
551
551
  Promise.prototype.then = reactronicDomHookedThen;
552
552
  const NOP = () => { };
553
553
  const EMPTY = Object.freeze([]);
554
- const SYSTEM = RxDom.createRootNode('SYSTEM', false, 'SYSTEM');
554
+ const SYSTEM = RxDom.createRootNode("SYSTEM", false, "SYSTEM");
555
555
  let gCreator = SYSTEM;
556
556
  let gHost = SYSTEM;
@@ -0,0 +1,64 @@
1
+ import { CellRange } from "./CellRange";
2
+ export declare enum To {
3
+ Fit = 0,
4
+ Left = 1,
5
+ Center = 2,
6
+ Right = 3,
7
+ Top = 4,
8
+ CenterV = 8,
9
+ Bottom = 12,
10
+ Default = 16
11
+ }
12
+ export interface ElasticSize {
13
+ cells?: number;
14
+ min?: string;
15
+ max?: string;
16
+ growth?: number;
17
+ }
18
+ export interface TrackSize extends ElasticSize {
19
+ track?: string | number;
20
+ }
21
+ export interface Bounds {
22
+ place?: string;
23
+ widthSpan?: number;
24
+ widthMin?: string;
25
+ widthMax?: string;
26
+ widthGrab?: number;
27
+ widthOverlap?: boolean;
28
+ heightSpan?: number;
29
+ heightMin?: string;
30
+ heightMax?: string;
31
+ heightGrab?: number;
32
+ heightOverlap?: boolean;
33
+ align?: To;
34
+ dock?: To;
35
+ }
36
+ export interface Place {
37
+ exact: CellRange | undefined;
38
+ widthMin: string;
39
+ widthMax: string;
40
+ widthGrab: number;
41
+ heightMin: string;
42
+ heightMax: string;
43
+ heightGrab: number;
44
+ align: To;
45
+ dock: To;
46
+ }
47
+ export declare class Allocator {
48
+ reset(): void;
49
+ lineFeed(): void;
50
+ allocate(bounds: Bounds | undefined): Place | undefined;
51
+ }
52
+ export declare class GridBasedAllocator implements Allocator {
53
+ private maxColumnCount;
54
+ private maxRowCount;
55
+ private actualColumnCount;
56
+ private actualRowCount;
57
+ private columnCursor;
58
+ private rowCursor;
59
+ private newRowCursor;
60
+ reset(): void;
61
+ lineFeed(): void;
62
+ allocate(bounds: Bounds | undefined): Place | undefined;
63
+ }
64
+ export declare function equalPlaces(a: Place | undefined, b: Place | undefined): boolean;
@@ -0,0 +1,141 @@
1
+ import { parseCellRange } from "./CellRange";
2
+ export var To;
3
+ (function (To) {
4
+ To[To["Fit"] = 0] = "Fit";
5
+ To[To["Left"] = 1] = "Left";
6
+ To[To["Center"] = 2] = "Center";
7
+ To[To["Right"] = 3] = "Right";
8
+ To[To["Top"] = 4] = "Top";
9
+ To[To["CenterV"] = 8] = "CenterV";
10
+ To[To["Bottom"] = 12] = "Bottom";
11
+ To[To["Default"] = 16] = "Default";
12
+ })(To || (To = {}));
13
+ export class Allocator {
14
+ reset() {
15
+ }
16
+ lineFeed() {
17
+ }
18
+ allocate(bounds) {
19
+ var _a, _b, _c, _d, _e, _f, _g, _h;
20
+ return !bounds ? undefined : {
21
+ exact: bounds.place ? parseCellRange(bounds.place, { x1: 0, y1: 0, x2: 0, y2: 0 }) : undefined,
22
+ widthMin: (_a = bounds.widthMin) !== null && _a !== void 0 ? _a : "",
23
+ widthMax: (_b = bounds.widthMax) !== null && _b !== void 0 ? _b : "",
24
+ widthGrab: (_c = bounds.widthGrab) !== null && _c !== void 0 ? _c : 0,
25
+ heightMin: (_d = bounds.heightMin) !== null && _d !== void 0 ? _d : "",
26
+ heightMax: (_e = bounds.heightMax) !== null && _e !== void 0 ? _e : "",
27
+ heightGrab: (_f = bounds.heightGrab) !== null && _f !== void 0 ? _f : 0,
28
+ align: (_g = bounds.align) !== null && _g !== void 0 ? _g : To.Default,
29
+ dock: (_h = bounds.dock) !== null && _h !== void 0 ? _h : To.Default,
30
+ };
31
+ }
32
+ }
33
+ export class GridBasedAllocator {
34
+ constructor() {
35
+ this.maxColumnCount = 0;
36
+ this.maxRowCount = 0;
37
+ this.actualColumnCount = 0;
38
+ this.actualRowCount = 0;
39
+ this.columnCursor = 0;
40
+ this.rowCursor = 0;
41
+ this.newRowCursor = 0;
42
+ }
43
+ reset() {
44
+ this.maxColumnCount = 0;
45
+ this.maxRowCount = 0;
46
+ this.actualColumnCount = 0;
47
+ this.actualRowCount = 0;
48
+ this.columnCursor = 0;
49
+ this.rowCursor = 0;
50
+ this.newRowCursor = 0;
51
+ }
52
+ lineFeed() {
53
+ this.columnCursor = 0;
54
+ this.rowCursor = this.newRowCursor;
55
+ }
56
+ allocate(bounds) {
57
+ var _a, _b, _c, _d;
58
+ const result = {
59
+ exact: undefined,
60
+ widthMin: "", widthMax: "", widthGrab: 0,
61
+ heightMin: "", heightMax: "", heightGrab: 0,
62
+ align: (_a = bounds === null || bounds === void 0 ? void 0 : bounds.align) !== null && _a !== void 0 ? _a : To.Default,
63
+ dock: (_b = bounds === null || bounds === void 0 ? void 0 : bounds.dock) !== null && _b !== void 0 ? _b : To.Default,
64
+ };
65
+ if (bounds === null || bounds === void 0 ? void 0 : bounds.place) {
66
+ result.exact = parseCellRange(bounds.place, { x1: 0, y1: 0, x2: 0, y2: 0 });
67
+ absolutizeCellRange(result.exact, this.columnCursor + 1, this.rowCursor + 1, this.maxColumnCount || Infinity, this.maxRowCount || Infinity, result.exact);
68
+ }
69
+ else {
70
+ const totalColumnCount = this.maxColumnCount !== 0 ? this.maxColumnCount : this.actualColumnCount;
71
+ const totalRowCount = this.maxRowCount !== 0 ? this.maxRowCount : this.actualRowCount;
72
+ const cr = result.exact = { x1: 0, y1: 0, x2: 0, y2: 0 };
73
+ let w = (_c = bounds === null || bounds === void 0 ? void 0 : bounds.widthSpan) !== null && _c !== void 0 ? _c : 1;
74
+ if (w === 0)
75
+ w = totalColumnCount || 1;
76
+ if (w >= 0) {
77
+ cr.x1 = this.columnCursor + 1;
78
+ cr.x2 = absolutizePosition(cr.x1 + w - 1, 0, this.maxColumnCount || Infinity);
79
+ if (!(bounds === null || bounds === void 0 ? void 0 : bounds.widthOverlap))
80
+ this.columnCursor = cr.x2;
81
+ }
82
+ else {
83
+ cr.x1 = Math.max(this.columnCursor + w, 1);
84
+ cr.x2 = this.columnCursor;
85
+ }
86
+ let h = (_d = bounds === null || bounds === void 0 ? void 0 : bounds.heightSpan) !== null && _d !== void 0 ? _d : 1;
87
+ if (h === 0)
88
+ h = totalRowCount || 1;
89
+ if (h >= 0) {
90
+ cr.y1 = this.rowCursor + 1;
91
+ cr.y2 = absolutizePosition(cr.y1 + h - 1, 0, this.maxRowCount || Infinity);
92
+ if (!(bounds === null || bounds === void 0 ? void 0 : bounds.heightOverlap) && cr.y2 > this.newRowCursor)
93
+ this.newRowCursor = cr.y2;
94
+ }
95
+ else {
96
+ cr.y1 = Math.max(this.rowCursor + h, 1);
97
+ cr.y2 = this.rowCursor;
98
+ }
99
+ }
100
+ return result;
101
+ }
102
+ }
103
+ function absolutizeCellRange(area, cursorX, cursorY, maxWidth, maxHeight, result) {
104
+ const x1 = absolutizePosition(area.x1, cursorX, maxWidth);
105
+ const x2 = absolutizePosition(area.x2, x1, maxWidth);
106
+ if (x1 <= x2)
107
+ result.x1 = x1, result.x2 = x2;
108
+ else
109
+ result.x1 = x2, result.x2 = x1;
110
+ const y1 = absolutizePosition(area.y1, cursorY, maxHeight);
111
+ const y2 = absolutizePosition(area.y2, y1, maxHeight);
112
+ if (y1 <= y2)
113
+ result.y1 = y1, result.y2 = y2;
114
+ else
115
+ result.y1 = y2, result.y2 = y1;
116
+ return result;
117
+ }
118
+ function absolutizePosition(pos, cursor, max) {
119
+ if (pos === 0)
120
+ pos = cursor;
121
+ else if (pos < 0)
122
+ pos = Math.max(max + pos, 1);
123
+ else
124
+ pos = Math.min(pos, max);
125
+ return pos;
126
+ }
127
+ export function equalPlaces(a, b) {
128
+ let result;
129
+ if (a) {
130
+ if (b) {
131
+ result = a.widthGrab == b.widthGrab;
132
+ }
133
+ else
134
+ result = false;
135
+ }
136
+ else if (b)
137
+ result = false;
138
+ else
139
+ result = true;
140
+ return result;
141
+ }
@@ -0,0 +1,8 @@
1
+ export interface CellRange {
2
+ x1: number;
3
+ y1: number;
4
+ x2: number;
5
+ y2: number;
6
+ }
7
+ export declare function parseCellRange(text: string, result: CellRange): CellRange;
8
+ export declare function emitCellRange(value: CellRange): string;
@@ -0,0 +1,173 @@
1
+ export function parseCellRange(text, result) {
2
+ let i = 0;
3
+ let value = 0;
4
+ let sign = 1;
5
+ let component = 0;
6
+ while (i < text.length) {
7
+ const charCode = text.charCodeAt(i);
8
+ if (isCapitalLetter(charCode)) {
9
+ if (component % 2 === 0)
10
+ value = value * 26 + charCode - 64;
11
+ else
12
+ console.error(`Digit is expected, but letter ('${text[i]}') was read`);
13
+ }
14
+ else if (isLowercaseLetter(charCode)) {
15
+ if (component % 2 === 0) {
16
+ value = value * 26 + charCode - 96;
17
+ }
18
+ else {
19
+ console.error(`Digit is expected, but letter ('${text[i]}') was read`);
20
+ }
21
+ }
22
+ else if (isDigit(charCode)) {
23
+ if (component % 2 === 0) {
24
+ if (value !== 0) {
25
+ if (component === 0)
26
+ result.x1 = value * sign;
27
+ else
28
+ result.x2 = value * sign;
29
+ value = 0;
30
+ }
31
+ component++;
32
+ }
33
+ value = value * 10 + charCode - 48;
34
+ }
35
+ else if (charCode === 40) {
36
+ if (component === 0)
37
+ result.x1 = value * sign;
38
+ else if (component === 2)
39
+ result.x2 = value * sign;
40
+ if (sign > 0) {
41
+ sign = -1;
42
+ component &= ~1;
43
+ value = 0;
44
+ }
45
+ else {
46
+ console.error("Sign must not be negative");
47
+ }
48
+ }
49
+ else if (charCode === 41) {
50
+ if (sign > 0) {
51
+ console.error("Sign must be negative");
52
+ }
53
+ switch (component) {
54
+ case 0:
55
+ result.x1 = value * sign;
56
+ break;
57
+ case 1:
58
+ result.y1 = value * sign;
59
+ break;
60
+ case 2:
61
+ result.x2 = value * sign;
62
+ break;
63
+ case 3:
64
+ result.y2 = value * sign;
65
+ break;
66
+ }
67
+ sign = 1;
68
+ value = 0;
69
+ component++;
70
+ }
71
+ else if (charCode === 58) {
72
+ if (sign < 0)
73
+ console.error(`area '${text}': e1`);
74
+ if (component === 1)
75
+ result.y1 = value * sign;
76
+ else if (component !== 2)
77
+ console.error(`area '${text}': [e2] component = ${component}`);
78
+ component = 2;
79
+ value = 0;
80
+ }
81
+ else if (isWhitespace(charCode)) {
82
+ }
83
+ else {
84
+ console.error(`Unknown symbol '${text[i]}' in '${text}'`);
85
+ }
86
+ i++;
87
+ }
88
+ if (value !== 0) {
89
+ switch (component) {
90
+ case 0: {
91
+ result.x1 = value * sign;
92
+ if (sign < 0 && result.y1 === 0)
93
+ result.y1 = sign;
94
+ break;
95
+ }
96
+ case 1: {
97
+ if (sign < 0 && result.x1 === 0)
98
+ result.x1 = sign;
99
+ result.y1 = value * sign;
100
+ break;
101
+ }
102
+ case 2: {
103
+ result.x2 = value * sign;
104
+ if (sign < 0 && result.y2 === 0)
105
+ result.y2 = sign;
106
+ break;
107
+ }
108
+ case 3: {
109
+ if (sign < 0 && result.x2 === 0)
110
+ result.x2 = sign;
111
+ result.y2 = value * sign;
112
+ break;
113
+ }
114
+ }
115
+ }
116
+ else if (sign < 0) {
117
+ if (component === 0) {
118
+ if (result.x1 === 0)
119
+ result.x1 = sign;
120
+ if (result.y1 === 0)
121
+ result.y1 = sign;
122
+ }
123
+ else {
124
+ if (result.x2 === 0)
125
+ result.x2 = sign;
126
+ if (result.y2 === 0)
127
+ result.y2 = sign;
128
+ }
129
+ }
130
+ return result;
131
+ }
132
+ export function emitCellRange(value) {
133
+ const p1 = emitCellPosition(value.x1, value.y1);
134
+ const p2 = emitCellPosition(value.x2, value.y2);
135
+ return `${p1}${p2 !== "" ? `:${p2}` : ""}`;
136
+ }
137
+ function isWhitespace(char) {
138
+ return char === 32 || (char >= 9 && char <= 13) || char === 133 || char === 160;
139
+ }
140
+ function isDigit(input, index) {
141
+ return 48 <= input && input <= 57;
142
+ }
143
+ function isCapitalLetter(ch) {
144
+ return 65 <= ch && ch <= 90;
145
+ }
146
+ function isLowercaseLetter(ch) {
147
+ return 97 <= ch && ch <= 122;
148
+ }
149
+ function emitLetters(n) {
150
+ if (n < 0)
151
+ throw new Error(`emitLetters: argument (${n}) should not be negative or zero`);
152
+ let result = "";
153
+ while (n >= 0) {
154
+ const r = n % 26;
155
+ n = Math.floor(n / 26) - 1;
156
+ result = String.fromCharCode(65 + r) + result;
157
+ }
158
+ return result;
159
+ }
160
+ function emitCellPosition(x, y) {
161
+ let result = "";
162
+ if (x > 0 && y > 0)
163
+ result = `${emitLetters(x - 1)}${y}`;
164
+ else if (x > 0 && y < 0)
165
+ result = `${emitLetters(x - 1)}(${-y})`;
166
+ else if (x < 0 && y > 0)
167
+ result = `(${emitLetters(-x - 1)})${y}`;
168
+ else if (x < 0 && y < 0)
169
+ result = `(${emitLetters(-x - 1)}${-y})`;
170
+ else
171
+ result = "";
172
+ return result;
173
+ }
@@ -0,0 +1,77 @@
1
+ import { Monitor, LoggingOptions, Item, CollectionReader } from "reactronic";
2
+ import { Bounds, Place, Allocator } from "./Allocator";
3
+ export declare type Callback<T = unknown> = (native: T) => void;
4
+ export declare type Render<T = unknown, M = unknown, R = void> = (native: T, block: VBlock<T, M, R>) => R;
5
+ export declare type AsyncRender<T = unknown, M = unknown> = (native: T, block: VBlock<T, M, Promise<void>>) => Promise<void>;
6
+ export declare const enum Priority {
7
+ SyncP0 = 0,
8
+ AsyncP1 = 1,
9
+ AsyncP2 = 2
10
+ }
11
+ export interface BlockArgs<T = unknown, M = unknown, R = void> extends Bounds {
12
+ reacting?: boolean;
13
+ mixins?: Array<Render<T, M, R>>;
14
+ triggers?: unknown;
15
+ priority?: Priority;
16
+ monitor?: Monitor;
17
+ throttling?: number;
18
+ logging?: Partial<LoggingOptions>;
19
+ shuffle?: boolean;
20
+ wrapper?: Render<T, M, R>;
21
+ render: Render<T, M, R>;
22
+ }
23
+ export declare abstract class VBlock<T = unknown, M = unknown, R = void> {
24
+ static readonly shortFrameDuration = 16;
25
+ static readonly longFrameDuration = 300;
26
+ static currentRenderingPriority: Priority;
27
+ static frameDuration: number;
28
+ abstract readonly name: string;
29
+ abstract readonly driver: AbstractDriver<T>;
30
+ abstract readonly args: Readonly<BlockArgs<T, M, R>>;
31
+ abstract model?: M;
32
+ abstract readonly level: number;
33
+ abstract readonly host: VBlock;
34
+ abstract readonly children: CollectionReader<VBlock>;
35
+ abstract readonly item: Item<VBlock> | undefined;
36
+ abstract readonly stamp: number;
37
+ abstract readonly native: T | undefined;
38
+ abstract readonly place: Readonly<Place> | undefined;
39
+ baseRender(): R;
40
+ get isInitialRendering(): boolean;
41
+ static root(render: () => void): void;
42
+ static get current(): VBlock;
43
+ static renderNestedTreesThenDo(action: (error: unknown) => void): void;
44
+ static runForAllBlocks<T>(action: (e: T) => void): void;
45
+ static claim<T = undefined, M = unknown, R = void>(name: string, args: BlockArgs<T, M, R>, driver?: AbstractDriver<T>): VBlock<T, M, R>;
46
+ static getDefaultLoggingOptions(): LoggingOptions | undefined;
47
+ static setDefaultLoggingOptions(logging?: LoggingOptions): void;
48
+ }
49
+ export declare enum LayoutKind {
50
+ Block = 0,
51
+ Grid = 1,
52
+ Line = 2,
53
+ Group = 3,
54
+ Text = 4
55
+ }
56
+ export declare class AbstractDriver<T> {
57
+ static readonly group: AbstractDriver<any>;
58
+ readonly name: string;
59
+ readonly layout: LayoutKind;
60
+ readonly createAllocator: () => Allocator;
61
+ get isSequential(): boolean;
62
+ get isAuxiliary(): boolean;
63
+ get isBlock(): boolean;
64
+ get isGrid(): boolean;
65
+ get isLine(): boolean;
66
+ constructor(name: string, layout: LayoutKind, createAllocator?: () => Allocator);
67
+ initialize(block: VBlock<T>, native: T | undefined): void;
68
+ finalize(block: VBlock<T>, isLeader: boolean): boolean;
69
+ deploy(block: VBlock<T>, sequential: boolean): void;
70
+ arrange(block: VBlock<T>, place: Place | undefined, heightGrab: number | undefined): void;
71
+ render(block: VBlock<T>): void | Promise<void>;
72
+ }
73
+ export declare class StaticDriver<T> extends AbstractDriver<T> {
74
+ readonly element: T;
75
+ constructor(element: T, name: string, layout: LayoutKind, createAllocator?: () => Allocator);
76
+ initialize(block: VBlock<T>, element: T | undefined): void;
77
+ }