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
|
@@ -1,431 +0,0 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
11
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
16
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
import { reactive, nonreactive, Transaction, options, Reentrance, Rx, Collection } from 'reactronic';
|
|
20
|
-
export var Priority;
|
|
21
|
-
(function (Priority) {
|
|
22
|
-
Priority[Priority["SyncP0"] = 0] = "SyncP0";
|
|
23
|
-
Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
|
|
24
|
-
Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
|
|
25
|
-
})(Priority || (Priority = {}));
|
|
26
|
-
export class Block {
|
|
27
|
-
render() {
|
|
28
|
-
return this.renderer(this.impl, this);
|
|
29
|
-
}
|
|
30
|
-
get isInitialRendering() {
|
|
31
|
-
return this.stamp === 2;
|
|
32
|
-
}
|
|
33
|
-
static root(render) {
|
|
34
|
-
gSysRoot.self.renderer = render;
|
|
35
|
-
prepareThenRunRender(gSysRoot, false, false);
|
|
36
|
-
}
|
|
37
|
-
static get current() {
|
|
38
|
-
return gContext.self;
|
|
39
|
-
}
|
|
40
|
-
static renderChildrenThenDo(action) {
|
|
41
|
-
runRenderChildrenThenDo(undefined, action);
|
|
42
|
-
}
|
|
43
|
-
static forAllBlocksDo(action) {
|
|
44
|
-
forEachChildRecursively(gSysRoot, action);
|
|
45
|
-
}
|
|
46
|
-
static claim(name, inline, options, renderer, factory) {
|
|
47
|
-
var _a;
|
|
48
|
-
const parent = gContext.self;
|
|
49
|
-
const children = parent.children;
|
|
50
|
-
const item = children.claim(name);
|
|
51
|
-
let block;
|
|
52
|
-
if (item) {
|
|
53
|
-
block = item.self;
|
|
54
|
-
if (block.factory !== factory && factory !== undefined)
|
|
55
|
-
throw new Error(`changing block type is not yet supported: "${block.factory.name}" -> "${factory === null || factory === void 0 ? void 0 : factory.name}"`);
|
|
56
|
-
if (options) {
|
|
57
|
-
const existingTriggers = (_a = block.options) === null || _a === void 0 ? void 0 : _a.triggers;
|
|
58
|
-
if (triggersAreEqual(options.triggers, existingTriggers))
|
|
59
|
-
options.triggers = existingTriggers;
|
|
60
|
-
}
|
|
61
|
-
block.options = options;
|
|
62
|
-
block.renderer = renderer;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
block = new VerstakBlock(name, factory !== null && factory !== void 0 ? factory : BlockFactory.default, inline !== null && inline !== void 0 ? inline : false, parent, options, renderer, undefined);
|
|
66
|
-
block.item = children.add(block);
|
|
67
|
-
VerstakBlock.grandCount++;
|
|
68
|
-
if (!block.inline)
|
|
69
|
-
VerstakBlock.disposableCount++;
|
|
70
|
-
}
|
|
71
|
-
return block;
|
|
72
|
-
}
|
|
73
|
-
static getDefaultLoggingOptions() {
|
|
74
|
-
return VerstakBlock.logging;
|
|
75
|
-
}
|
|
76
|
-
static setDefaultLoggingOptions(logging) {
|
|
77
|
-
VerstakBlock.logging = logging;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
Block.shortFrameDuration = 16;
|
|
81
|
-
Block.longFrameDuration = 300;
|
|
82
|
-
Block.currentRenderingPriority = Priority.SyncP0;
|
|
83
|
-
Block.frameDuration = Block.longFrameDuration;
|
|
84
|
-
const NOP = () => { };
|
|
85
|
-
export class BlockFactory {
|
|
86
|
-
constructor(name, strict) {
|
|
87
|
-
this.name = name;
|
|
88
|
-
this.strict = strict;
|
|
89
|
-
}
|
|
90
|
-
initialize(block, impl) {
|
|
91
|
-
const b = block;
|
|
92
|
-
b.impl = impl;
|
|
93
|
-
}
|
|
94
|
-
finalize(block, isLeader) {
|
|
95
|
-
const b = block;
|
|
96
|
-
b.impl = undefined;
|
|
97
|
-
return isLeader;
|
|
98
|
-
}
|
|
99
|
-
layout(block, strict) {
|
|
100
|
-
}
|
|
101
|
-
render(block) {
|
|
102
|
-
let result;
|
|
103
|
-
if (block.wrapper)
|
|
104
|
-
result = block.wrapper(block.impl, block);
|
|
105
|
-
else
|
|
106
|
-
result = block.render();
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
BlockFactory.default = new BlockFactory('default', false);
|
|
111
|
-
export class StaticBlockFactory extends BlockFactory {
|
|
112
|
-
constructor(name, sequential, element) {
|
|
113
|
-
super(name, sequential);
|
|
114
|
-
this.element = element;
|
|
115
|
-
}
|
|
116
|
-
initialize(block, element) {
|
|
117
|
-
super.initialize(block, this.element);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
function getBlockName(block) {
|
|
121
|
-
return block.stamp >= 0 ? block.name : undefined;
|
|
122
|
-
}
|
|
123
|
-
class VerstakBlock extends Block {
|
|
124
|
-
constructor(name, factory, inline, parent, options, renderer, wrapper) {
|
|
125
|
-
super();
|
|
126
|
-
this.name = name;
|
|
127
|
-
this.factory = factory;
|
|
128
|
-
this.inline = inline;
|
|
129
|
-
this.options = options;
|
|
130
|
-
this.renderer = renderer;
|
|
131
|
-
this.wrapper = wrapper;
|
|
132
|
-
this.model = undefined;
|
|
133
|
-
this.level = parent.level + 1;
|
|
134
|
-
this.parent = parent;
|
|
135
|
-
this.children = new Collection(factory.strict, getBlockName);
|
|
136
|
-
this.item = undefined;
|
|
137
|
-
this.stamp = 0;
|
|
138
|
-
this.impl = undefined;
|
|
139
|
-
}
|
|
140
|
-
autorender(_triggers) {
|
|
141
|
-
runRender(this.item);
|
|
142
|
-
}
|
|
143
|
-
wrapBy(renderer) {
|
|
144
|
-
this.wrapper = renderer;
|
|
145
|
-
return this;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
VerstakBlock.grandCount = 0;
|
|
149
|
-
VerstakBlock.disposableCount = 0;
|
|
150
|
-
VerstakBlock.logging = undefined;
|
|
151
|
-
__decorate([
|
|
152
|
-
reactive,
|
|
153
|
-
options({
|
|
154
|
-
reentrance: Reentrance.CancelPrevious,
|
|
155
|
-
triggeringArgs: true,
|
|
156
|
-
noSideEffects: false,
|
|
157
|
-
}),
|
|
158
|
-
__metadata("design:type", Function),
|
|
159
|
-
__metadata("design:paramtypes", [Object]),
|
|
160
|
-
__metadata("design:returntype", void 0)
|
|
161
|
-
], VerstakBlock.prototype, "autorender", null);
|
|
162
|
-
function runRenderChildrenThenDo(error, action) {
|
|
163
|
-
var _a, _b;
|
|
164
|
-
const context = gContext;
|
|
165
|
-
const block = context.self;
|
|
166
|
-
const children = block.children;
|
|
167
|
-
if (children.isMergeInProgress) {
|
|
168
|
-
let promised = undefined;
|
|
169
|
-
try {
|
|
170
|
-
children.endMerge(error);
|
|
171
|
-
for (const child of children.removedItems(true))
|
|
172
|
-
runFinalize(child, true);
|
|
173
|
-
if (!error) {
|
|
174
|
-
const strict = children.strict;
|
|
175
|
-
let p1 = undefined;
|
|
176
|
-
let p2 = undefined;
|
|
177
|
-
let isMoved = false;
|
|
178
|
-
for (const child of children.items()) {
|
|
179
|
-
if (Transaction.isCanceled)
|
|
180
|
-
break;
|
|
181
|
-
isMoved = checkIsMoved(isMoved, child, children, strict);
|
|
182
|
-
const x = child.self;
|
|
183
|
-
const priority = (_b = (_a = x.options) === null || _a === void 0 ? void 0 : _a.priority) !== null && _b !== void 0 ? _b : Priority.SyncP0;
|
|
184
|
-
if (priority === Priority.SyncP0)
|
|
185
|
-
prepareThenRunRender(child, children.isMoved(child), strict);
|
|
186
|
-
else if (priority === Priority.AsyncP1)
|
|
187
|
-
p1 = push(child, p1);
|
|
188
|
-
else
|
|
189
|
-
p2 = push(child, p2);
|
|
190
|
-
}
|
|
191
|
-
if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
|
|
192
|
-
promised = startIncrementalRendering(context, children, p1, p2).then(() => action(error), e => action(e));
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
finally {
|
|
196
|
-
if (!promised)
|
|
197
|
-
action(error);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function checkIsMoved(isMoved, child, children, strict) {
|
|
202
|
-
if (child.self.impl) {
|
|
203
|
-
if (isMoved) {
|
|
204
|
-
children.markAsMoved(child);
|
|
205
|
-
isMoved = false;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
else if (strict && children.isMoved(child))
|
|
209
|
-
isMoved = true;
|
|
210
|
-
return isMoved;
|
|
211
|
-
}
|
|
212
|
-
function startIncrementalRendering(parent, allChildren, priority1, priority2) {
|
|
213
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
214
|
-
const stamp = parent.self.stamp;
|
|
215
|
-
if (priority1)
|
|
216
|
-
yield renderIncrementally(parent, stamp, allChildren, priority1, Priority.AsyncP1);
|
|
217
|
-
if (priority2)
|
|
218
|
-
yield renderIncrementally(parent, stamp, allChildren, priority2, Priority.AsyncP2);
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
function renderIncrementally(parent, stamp, allChildren, items, priority) {
|
|
222
|
-
var _a;
|
|
223
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
yield Transaction.requestNextFrame();
|
|
225
|
-
const block = parent.self;
|
|
226
|
-
if (!Transaction.isCanceled || !Transaction.isFrameOver(1, Block.shortFrameDuration / 3)) {
|
|
227
|
-
let outerPriority = Block.currentRenderingPriority;
|
|
228
|
-
Block.currentRenderingPriority = priority;
|
|
229
|
-
try {
|
|
230
|
-
const strict = block.children.strict;
|
|
231
|
-
if ((_a = block.options) === null || _a === void 0 ? void 0 : _a.shuffle)
|
|
232
|
-
shuffle(items);
|
|
233
|
-
const frameDurationLimit = priority === Priority.AsyncP2 ? Block.shortFrameDuration : Infinity;
|
|
234
|
-
let frameDuration = Math.min(frameDurationLimit, Math.max(Block.frameDuration / 4, Block.shortFrameDuration));
|
|
235
|
-
for (const child of items) {
|
|
236
|
-
prepareThenRunRender(child, allChildren.isMoved(child), strict);
|
|
237
|
-
if (Transaction.isFrameOver(1, frameDuration)) {
|
|
238
|
-
Block.currentRenderingPriority = outerPriority;
|
|
239
|
-
yield Transaction.requestNextFrame(0);
|
|
240
|
-
outerPriority = Block.currentRenderingPriority;
|
|
241
|
-
Block.currentRenderingPriority = priority;
|
|
242
|
-
frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, Block.frameDuration));
|
|
243
|
-
}
|
|
244
|
-
if (Transaction.isCanceled && Transaction.isFrameOver(1, Block.shortFrameDuration / 3))
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
finally {
|
|
249
|
-
Block.currentRenderingPriority = outerPriority;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
function prepareThenRunRender(item, moved, strict) {
|
|
255
|
-
var _a;
|
|
256
|
-
const block = item.self;
|
|
257
|
-
if (block.stamp >= 0) {
|
|
258
|
-
prepareRender(item, moved, strict);
|
|
259
|
-
if (block.inline)
|
|
260
|
-
runRender(item);
|
|
261
|
-
else
|
|
262
|
-
nonreactive(block.autorender, (_a = block.options) === null || _a === void 0 ? void 0 : _a.triggers);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function prepareRender(item, moved, strict) {
|
|
266
|
-
var _a, _b, _c;
|
|
267
|
-
const block = item.self;
|
|
268
|
-
const factory = block.factory;
|
|
269
|
-
if (block.stamp === 0) {
|
|
270
|
-
block.stamp = 1;
|
|
271
|
-
if (!block.inline) {
|
|
272
|
-
Transaction.outside(() => {
|
|
273
|
-
var _a, _b, _c;
|
|
274
|
-
if (Rx.isLogging)
|
|
275
|
-
Rx.setLoggingHint(block, block.name);
|
|
276
|
-
Rx.getController(block.autorender).configure({
|
|
277
|
-
order: block.level,
|
|
278
|
-
monitor: (_a = block.options) === null || _a === void 0 ? void 0 : _a.monitor,
|
|
279
|
-
throttling: (_b = block.options) === null || _b === void 0 ? void 0 : _b.throttling,
|
|
280
|
-
logging: (_c = block.options) === null || _c === void 0 ? void 0 : _c.logging,
|
|
281
|
-
});
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
(_a = factory.initialize) === null || _a === void 0 ? void 0 : _a.call(factory, block, undefined);
|
|
285
|
-
(_b = factory.layout) === null || _b === void 0 ? void 0 : _b.call(factory, block, strict);
|
|
286
|
-
}
|
|
287
|
-
else if (moved)
|
|
288
|
-
(_c = factory.layout) === null || _c === void 0 ? void 0 : _c.call(factory, block, strict);
|
|
289
|
-
}
|
|
290
|
-
function runRender(item) {
|
|
291
|
-
const block = item.self;
|
|
292
|
-
if (block.stamp >= 0) {
|
|
293
|
-
runUnder(item, () => {
|
|
294
|
-
let result = undefined;
|
|
295
|
-
try {
|
|
296
|
-
block.stamp++;
|
|
297
|
-
block.children.beginMerge();
|
|
298
|
-
result = block.factory.render(block);
|
|
299
|
-
if (result instanceof Promise)
|
|
300
|
-
result.then(v => { runRenderChildrenThenDo(undefined, NOP); return v; }, e => { console.log(e); runRenderChildrenThenDo(e !== null && e !== void 0 ? e : new Error('unknown error'), NOP); });
|
|
301
|
-
else
|
|
302
|
-
runRenderChildrenThenDo(undefined, NOP);
|
|
303
|
-
}
|
|
304
|
-
catch (e) {
|
|
305
|
-
runRenderChildrenThenDo(e, NOP);
|
|
306
|
-
console.log(`Rendering failed: ${block.name}`);
|
|
307
|
-
console.log(`${e}`);
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function runFinalize(item, isLeader) {
|
|
313
|
-
const block = item.self;
|
|
314
|
-
if (block.stamp >= 0) {
|
|
315
|
-
block.stamp = ~block.stamp;
|
|
316
|
-
const childrenAreLeaders = block.factory.finalize(block, isLeader);
|
|
317
|
-
if (!block.inline) {
|
|
318
|
-
item.aux = undefined;
|
|
319
|
-
const last = gLastToDispose;
|
|
320
|
-
if (last)
|
|
321
|
-
gLastToDispose = last.aux = item;
|
|
322
|
-
else
|
|
323
|
-
gFirstToDispose = gLastToDispose = item;
|
|
324
|
-
if (gFirstToDispose === item)
|
|
325
|
-
Transaction.run({ separation: 'disposal', hint: `runDisposalLoop(initiator=${item.self.name})` }, () => {
|
|
326
|
-
void runDisposalLoop().then(NOP, error => console.log(error));
|
|
327
|
-
});
|
|
328
|
-
}
|
|
329
|
-
for (const item of block.children.items())
|
|
330
|
-
runFinalize(item, childrenAreLeaders);
|
|
331
|
-
VerstakBlock.grandCount--;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
function runDisposalLoop() {
|
|
335
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
336
|
-
yield Transaction.requestNextFrame();
|
|
337
|
-
let item = gFirstToDispose;
|
|
338
|
-
while (item !== undefined) {
|
|
339
|
-
if (Transaction.isFrameOver(500, 5))
|
|
340
|
-
yield Transaction.requestNextFrame();
|
|
341
|
-
Rx.dispose(item.self);
|
|
342
|
-
item = item.aux;
|
|
343
|
-
VerstakBlock.disposableCount--;
|
|
344
|
-
}
|
|
345
|
-
gFirstToDispose = gLastToDispose = undefined;
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
function forEachChildRecursively(item, action) {
|
|
349
|
-
const block = item.self;
|
|
350
|
-
const impl = block.impl;
|
|
351
|
-
impl && action(impl);
|
|
352
|
-
for (const item of block.children.items())
|
|
353
|
-
forEachChildRecursively(item, action);
|
|
354
|
-
}
|
|
355
|
-
function wrap(func) {
|
|
356
|
-
const parent = gContext;
|
|
357
|
-
const wrappedRunUnder = (...args) => {
|
|
358
|
-
return runUnder(parent, func, ...args);
|
|
359
|
-
};
|
|
360
|
-
return wrappedRunUnder;
|
|
361
|
-
}
|
|
362
|
-
function runUnder(item, func, ...args) {
|
|
363
|
-
const outer = gContext;
|
|
364
|
-
try {
|
|
365
|
-
gContext = item;
|
|
366
|
-
return func(...args);
|
|
367
|
-
}
|
|
368
|
-
finally {
|
|
369
|
-
gContext = outer;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
function triggersAreEqual(a1, a2) {
|
|
373
|
-
let result = a1 === a2;
|
|
374
|
-
if (!result) {
|
|
375
|
-
if (Array.isArray(a1)) {
|
|
376
|
-
result = Array.isArray(a2) &&
|
|
377
|
-
a1.length === a2.length &&
|
|
378
|
-
a1.every((t, i) => t === a2[i]);
|
|
379
|
-
}
|
|
380
|
-
else if (a1 === Object(a1) && a2 === Object(a2)) {
|
|
381
|
-
for (const p in a1) {
|
|
382
|
-
result = a1[p] === a2[p];
|
|
383
|
-
if (!result)
|
|
384
|
-
break;
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return result;
|
|
389
|
-
}
|
|
390
|
-
function push(item, array) {
|
|
391
|
-
if (array == undefined)
|
|
392
|
-
array = new Array();
|
|
393
|
-
array.push(item);
|
|
394
|
-
return array;
|
|
395
|
-
}
|
|
396
|
-
function shuffle(array) {
|
|
397
|
-
const n = array.length - 1;
|
|
398
|
-
let i = n;
|
|
399
|
-
while (i >= 0) {
|
|
400
|
-
const j = Math.floor(Math.random() * n);
|
|
401
|
-
const t = array[i];
|
|
402
|
-
array[i] = array[j];
|
|
403
|
-
array[j] = t;
|
|
404
|
-
i--;
|
|
405
|
-
}
|
|
406
|
-
return array;
|
|
407
|
-
}
|
|
408
|
-
const ORIGINAL_PROMISE_THEN = Promise.prototype.then;
|
|
409
|
-
function reactronicDomHookedThen(resolve, reject) {
|
|
410
|
-
resolve = resolve ? wrap(resolve) : defaultResolve;
|
|
411
|
-
reject = reject ? wrap(reject) : defaultReject;
|
|
412
|
-
return ORIGINAL_PROMISE_THEN.call(this, resolve, reject);
|
|
413
|
-
}
|
|
414
|
-
function defaultResolve(value) {
|
|
415
|
-
return value;
|
|
416
|
-
}
|
|
417
|
-
function defaultReject(error) {
|
|
418
|
-
throw error;
|
|
419
|
-
}
|
|
420
|
-
Promise.prototype.then = reactronicDomHookedThen;
|
|
421
|
-
const gSysRoot = Collection.createItem(new VerstakBlock('SYSTEM', new StaticBlockFactory('SYSTEM', false, null), false, { level: 0 }, undefined, NOP));
|
|
422
|
-
gSysRoot.self.item = gSysRoot;
|
|
423
|
-
Object.defineProperty(gSysRoot, 'parent', {
|
|
424
|
-
value: gSysRoot,
|
|
425
|
-
writable: false,
|
|
426
|
-
configurable: false,
|
|
427
|
-
enumerable: true,
|
|
428
|
-
});
|
|
429
|
-
let gContext = gSysRoot;
|
|
430
|
-
let gFirstToDispose = undefined;
|
|
431
|
-
let gLastToDispose = undefined;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Block, Render, BlockFactory, BlockOptions } from './Block';
|
|
2
|
-
export declare function Reaction<T = undefined, M = unknown, P = void, R = void>(name: string, options: BlockOptions<P> | undefined, renderer: Render<T, M, P, R>, factory?: BlockFactory<T>): Block<T, M, P, R>;
|
|
3
|
-
export declare function Inline<T = undefined, M = unknown, P = void, R = void>(name: string, options: BlockOptions<P> | undefined, renderer: Render<T, M, P, R>, factory?: BlockFactory<T>): Block<T, M, P, R>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Block } from './Block';
|
|
2
|
-
export function Reaction(name, options, renderer, factory) {
|
|
3
|
-
return Block.claim(name, false, options, renderer, factory);
|
|
4
|
-
}
|
|
5
|
-
export function Inline(name, options, renderer, factory) {
|
|
6
|
-
return Block.claim(name, true, options, renderer, factory);
|
|
7
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export interface Place {
|
|
2
|
-
lineBegin?: boolean;
|
|
3
|
-
area?: string;
|
|
4
|
-
columns?: number;
|
|
5
|
-
rows?: number;
|
|
6
|
-
cursorRight?: boolean;
|
|
7
|
-
cursorDown?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface CellRange {
|
|
10
|
-
x1: number;
|
|
11
|
-
y1: number;
|
|
12
|
-
x2: number;
|
|
13
|
-
y2: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class Layout {
|
|
16
|
-
private maxColumnCount;
|
|
17
|
-
private maxRowCount;
|
|
18
|
-
private actualColumnCount;
|
|
19
|
-
private actualRowCount;
|
|
20
|
-
private columnCursor;
|
|
21
|
-
private rowCursor;
|
|
22
|
-
private newRowCursor;
|
|
23
|
-
reset(maxColumnCount: number, maxRowCount: number): void;
|
|
24
|
-
claim(p: Place, result: CellRange): CellRange;
|
|
25
|
-
static parseCellRange(text: string, result: CellRange): CellRange;
|
|
26
|
-
static emitCellRange(value: CellRange): string;
|
|
27
|
-
}
|