verstak 0.22.516 → 0.23.100
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/archive/RxDomV1.Types.d.ts +5 -5
- package/build/dist/source/archive/RxDomV1.Types.js +5 -5
- package/build/dist/source/core/Cursor.d.ts +1 -1
- package/build/dist/source/core/Utils.js +2 -2
- package/build/dist/source/core/VBlock.d.ts +30 -20
- package/build/dist/source/core/VBlock.js +164 -125
- package/build/dist/source/html/Blocks.d.ts +2 -1
- package/build/dist/source/html/Blocks.js +36 -15
- package/build/dist/source/html/HtmlBlocks.d.ts +174 -174
- package/build/dist/source/html/HtmlBlocks.js +1 -1
- package/build/dist/source/html/HtmlDriver.d.ts +3 -3
- package/build/dist/source/html/HtmlDriver.js +5 -4
- package/build/dist/source/html/ReactingFocuser.js +1 -1
- package/build/dist/source/html/sensors/HtmlDragSensor.d.ts +2 -2
- package/package.json +8 -8
|
@@ -22,27 +22,14 @@ import { emitLetters, equalCellRanges } from "./CellRange";
|
|
|
22
22
|
import { Cursor, Align } from "./Cursor";
|
|
23
23
|
export var Priority;
|
|
24
24
|
(function (Priority) {
|
|
25
|
-
Priority[Priority["
|
|
26
|
-
Priority[Priority["
|
|
27
|
-
Priority[Priority["
|
|
25
|
+
Priority[Priority["Realtime"] = 0] = "Realtime";
|
|
26
|
+
Priority[Priority["Normal"] = 1] = "Normal";
|
|
27
|
+
Priority[Priority["Background"] = 2] = "Background";
|
|
28
28
|
})(Priority || (Priority = {}));
|
|
29
|
-
export function
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
base = { render: base };
|
|
34
|
-
const result = Object.assign(Object.assign(Object.assign({}, base), outer), { initialize: via(outer === null || outer === void 0 ? void 0 : outer.initialize, base.initialize), render: via(outer === null || outer === void 0 ? void 0 : outer.render, base.render), finalize: via(outer === null || outer === void 0 ? void 0 : outer.finalize, base.finalize) });
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
function via(outer, base) {
|
|
38
|
-
const inherited = base !== null && base !== void 0 ? base : NOP;
|
|
39
|
-
return outer ? b => outer(b, () => inherited(b)) : inherited;
|
|
40
|
-
}
|
|
41
|
-
export function nestedContext(type, context) {
|
|
42
|
-
return VBlockImpl.setContext(type, context);
|
|
43
|
-
}
|
|
44
|
-
export function useContext(type) {
|
|
45
|
-
return VBlockImpl.use(type);
|
|
29
|
+
export function vmt(body) {
|
|
30
|
+
if (body instanceof Function)
|
|
31
|
+
body = { render: body };
|
|
32
|
+
return body;
|
|
46
33
|
}
|
|
47
34
|
export class VBlock {
|
|
48
35
|
get isInitialRendering() {
|
|
@@ -50,7 +37,7 @@ export class VBlock {
|
|
|
50
37
|
}
|
|
51
38
|
static root(render) {
|
|
52
39
|
gSysRoot.instance.body.render = render;
|
|
53
|
-
|
|
40
|
+
triggerRendering(gSysRoot);
|
|
54
41
|
}
|
|
55
42
|
static get current() {
|
|
56
43
|
return gCurrent.instance;
|
|
@@ -62,7 +49,7 @@ export class VBlock {
|
|
|
62
49
|
forEachChildRecursively(gSysRoot, action);
|
|
63
50
|
}
|
|
64
51
|
static claim(driver, body) {
|
|
65
|
-
var _a
|
|
52
|
+
var _a;
|
|
66
53
|
let result;
|
|
67
54
|
const owner = gCurrent.instance;
|
|
68
55
|
const children = owner.children;
|
|
@@ -81,7 +68,7 @@ export class VBlock {
|
|
|
81
68
|
result = ex.instance;
|
|
82
69
|
if (result.driver !== driver && driver !== undefined)
|
|
83
70
|
throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
|
|
84
|
-
const exTriggers =
|
|
71
|
+
const exTriggers = result.body.triggers;
|
|
85
72
|
if (triggersAreEqual(body.triggers, exTriggers))
|
|
86
73
|
body.triggers = exTriggers;
|
|
87
74
|
result.body = body;
|
|
@@ -90,7 +77,7 @@ export class VBlock {
|
|
|
90
77
|
result = new VBlockImpl(key || VBlock.generateKey(owner), driver, owner, body);
|
|
91
78
|
result.item = children.add(result);
|
|
92
79
|
VBlockImpl.grandCount++;
|
|
93
|
-
if (body.
|
|
80
|
+
if (body.autonomous)
|
|
94
81
|
VBlockImpl.disposableCount++;
|
|
95
82
|
}
|
|
96
83
|
return result;
|
|
@@ -100,9 +87,9 @@ export class VBlock {
|
|
|
100
87
|
const lettered = emitLetters(n);
|
|
101
88
|
let result;
|
|
102
89
|
if (Rx.isLogging)
|
|
103
|
-
result =
|
|
90
|
+
result = `${getCallerInfo(lettered)}!`;
|
|
104
91
|
else
|
|
105
|
-
result =
|
|
92
|
+
result = `${lettered}!`;
|
|
106
93
|
return result;
|
|
107
94
|
}
|
|
108
95
|
static getDefaultLoggingOptions() {
|
|
@@ -114,7 +101,7 @@ export class VBlock {
|
|
|
114
101
|
}
|
|
115
102
|
VBlock.shortFrameDuration = 16;
|
|
116
103
|
VBlock.longFrameDuration = 300;
|
|
117
|
-
VBlock.currentRenderingPriority = Priority.
|
|
104
|
+
VBlock.currentRenderingPriority = Priority.Realtime;
|
|
118
105
|
VBlock.frameDuration = VBlock.longFrameDuration;
|
|
119
106
|
export var LayoutKind;
|
|
120
107
|
(function (LayoutKind) {
|
|
@@ -126,31 +113,32 @@ export var LayoutKind;
|
|
|
126
113
|
})(LayoutKind || (LayoutKind = {}));
|
|
127
114
|
const createDefaultCursor = () => new Cursor();
|
|
128
115
|
export class AbstractDriver {
|
|
129
|
-
constructor(name, layout, createCursor) {
|
|
130
|
-
this.name = name;
|
|
131
|
-
this.layout = layout;
|
|
132
|
-
this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
|
|
133
|
-
}
|
|
134
116
|
get isSequential() { return (this.layout & 1) === 0; }
|
|
135
117
|
get isAuxiliary() { return (this.layout & 2) === 2; }
|
|
136
118
|
get isBlock() { return this.layout === LayoutKind.Block; }
|
|
137
119
|
get isGrid() { return this.layout === LayoutKind.Grid; }
|
|
138
120
|
get isLine() { return this.layout === LayoutKind.Line; }
|
|
121
|
+
constructor(name, layout, createCursor) {
|
|
122
|
+
this.name = name;
|
|
123
|
+
this.layout = layout;
|
|
124
|
+
this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
|
|
125
|
+
}
|
|
139
126
|
initialize(block, native) {
|
|
140
|
-
var _a, _b;
|
|
141
127
|
const b = block;
|
|
142
128
|
b.native = native;
|
|
143
|
-
(
|
|
129
|
+
invokeInitializeChain(b, b.body);
|
|
130
|
+
}
|
|
131
|
+
deploy(block) {
|
|
132
|
+
}
|
|
133
|
+
render(block) {
|
|
134
|
+
invokeRenderChain(block, block.body);
|
|
144
135
|
}
|
|
145
136
|
finalize(block, isLeader) {
|
|
146
|
-
var _a, _b;
|
|
147
137
|
const b = block;
|
|
148
|
-
(
|
|
138
|
+
invokeFinalizeChain(b, b.body);
|
|
149
139
|
b.native = null;
|
|
150
140
|
return isLeader;
|
|
151
141
|
}
|
|
152
|
-
deploy(block, sequential) {
|
|
153
|
-
}
|
|
154
142
|
applyCellRange(block, cellRange) {
|
|
155
143
|
}
|
|
156
144
|
applyWidthGrowth(block, widthGrowth) {
|
|
@@ -171,24 +159,47 @@ export class AbstractDriver {
|
|
|
171
159
|
}
|
|
172
160
|
applyContentWrapping(block, contentWrapping) {
|
|
173
161
|
}
|
|
174
|
-
|
|
162
|
+
applyOverlayVisible(block, overlayVisible) {
|
|
175
163
|
}
|
|
176
|
-
|
|
177
|
-
var _a;
|
|
178
|
-
let result;
|
|
179
|
-
const override = (_a = block.body) === null || _a === void 0 ? void 0 : _a.override;
|
|
180
|
-
if (override)
|
|
181
|
-
result = override(block, NOP);
|
|
182
|
-
else
|
|
183
|
-
result = invokeRenderFunction(block);
|
|
184
|
-
return result;
|
|
164
|
+
applyStyling(block, secondary, styleName, enabled) {
|
|
185
165
|
}
|
|
186
166
|
}
|
|
187
167
|
AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
|
|
188
|
-
function
|
|
168
|
+
function invokeInitializeChain(block, vmt) {
|
|
169
|
+
var _a;
|
|
170
|
+
const redefined = vmt.redefinedInitialize;
|
|
171
|
+
const base = vmt.base;
|
|
172
|
+
if (!redefined) {
|
|
173
|
+
(_a = vmt.initialize) === null || _a === void 0 ? void 0 : _a.call(vmt, block);
|
|
174
|
+
if (base)
|
|
175
|
+
invokeInitializeChain(block, base);
|
|
176
|
+
}
|
|
177
|
+
else
|
|
178
|
+
redefined(block, base ? () => invokeInitializeChain(block, base) : NOP);
|
|
179
|
+
}
|
|
180
|
+
function invokeRenderChain(block, vmt) {
|
|
181
|
+
var _a;
|
|
182
|
+
const redefined = vmt.redefinedRender;
|
|
183
|
+
const base = vmt.base;
|
|
184
|
+
if (!redefined) {
|
|
185
|
+
if (base)
|
|
186
|
+
invokeRenderChain(block, base);
|
|
187
|
+
(_a = vmt.render) === null || _a === void 0 ? void 0 : _a.call(vmt, block);
|
|
188
|
+
}
|
|
189
|
+
else
|
|
190
|
+
redefined(block, base ? () => invokeRenderChain(block, base) : NOP);
|
|
191
|
+
}
|
|
192
|
+
function invokeFinalizeChain(block, vmt) {
|
|
189
193
|
var _a;
|
|
190
|
-
const
|
|
191
|
-
|
|
194
|
+
const redefined = vmt.redefinedFinalize;
|
|
195
|
+
const base = vmt.base;
|
|
196
|
+
if (!redefined) {
|
|
197
|
+
(_a = vmt.finalize) === null || _a === void 0 ? void 0 : _a.call(vmt, block);
|
|
198
|
+
if (base)
|
|
199
|
+
invokeFinalizeChain(block, base);
|
|
200
|
+
}
|
|
201
|
+
else
|
|
202
|
+
redefined(block, base ? () => invokeFinalizeChain(block, base) : NOP);
|
|
192
203
|
}
|
|
193
204
|
export class StaticDriver extends AbstractDriver {
|
|
194
205
|
constructor(element, name, layout, createCursor) {
|
|
@@ -199,20 +210,39 @@ export class StaticDriver extends AbstractDriver {
|
|
|
199
210
|
super.initialize(block, this.element);
|
|
200
211
|
}
|
|
201
212
|
}
|
|
213
|
+
export class ContextVariable {
|
|
214
|
+
constructor(defaultValue) {
|
|
215
|
+
this.defaultValue = defaultValue;
|
|
216
|
+
}
|
|
217
|
+
set value(value) {
|
|
218
|
+
VBlockImpl.setContextVariableValue(this, value);
|
|
219
|
+
}
|
|
220
|
+
get value() {
|
|
221
|
+
return VBlockImpl.useContextVariableValue(this);
|
|
222
|
+
}
|
|
223
|
+
get valueOrUndefined() {
|
|
224
|
+
return VBlockImpl.tryUseContextVariable(this);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
202
227
|
function getBlockKey(block) {
|
|
203
228
|
return block.stamp >= 0 ? block.key : undefined;
|
|
204
229
|
}
|
|
205
230
|
class VBlockContext extends ObservableObject {
|
|
206
|
-
constructor(
|
|
231
|
+
constructor(variable, value) {
|
|
207
232
|
super();
|
|
208
|
-
this.
|
|
209
|
-
this.
|
|
233
|
+
this.next = undefined;
|
|
234
|
+
this.variable = variable;
|
|
235
|
+
this.value = value;
|
|
210
236
|
}
|
|
211
237
|
}
|
|
212
238
|
__decorate([
|
|
213
239
|
raw,
|
|
214
240
|
__metadata("design:type", Object)
|
|
215
|
-
], VBlockContext.prototype, "
|
|
241
|
+
], VBlockContext.prototype, "next", void 0);
|
|
242
|
+
__decorate([
|
|
243
|
+
raw,
|
|
244
|
+
__metadata("design:type", ContextVariable)
|
|
245
|
+
], VBlockContext.prototype, "variable", void 0);
|
|
216
246
|
class VBlockImpl extends VBlock {
|
|
217
247
|
constructor(key, driver, owner, body) {
|
|
218
248
|
super();
|
|
@@ -221,6 +251,7 @@ class VBlockImpl extends VBlock {
|
|
|
221
251
|
this.body = body;
|
|
222
252
|
this.model = undefined;
|
|
223
253
|
this.assignedCells = undefined;
|
|
254
|
+
this.assignedStyle = false;
|
|
224
255
|
this.appliedCellRange = Cursor.UndefinedCellRange;
|
|
225
256
|
this.appliedWidthGrowth = 0;
|
|
226
257
|
this.appliedMinWidth = "";
|
|
@@ -231,9 +262,9 @@ class VBlockImpl extends VBlock {
|
|
|
231
262
|
this.appliedContentAlignment = Align.Default;
|
|
232
263
|
this.appliedFrameAlignment = Align.Default;
|
|
233
264
|
this.appliedContentWrapping = false;
|
|
234
|
-
this.
|
|
265
|
+
this.appliedOverlayVisible = undefined;
|
|
235
266
|
this.childrenShuffling = false;
|
|
236
|
-
this.renderingPriority = Priority.
|
|
267
|
+
this.renderingPriority = Priority.Realtime;
|
|
237
268
|
this.level = owner.level + 1;
|
|
238
269
|
this.host = owner;
|
|
239
270
|
this.children = new Collection(driver.isSequential, getBlockKey);
|
|
@@ -242,11 +273,17 @@ class VBlockImpl extends VBlock {
|
|
|
242
273
|
this.stamp = 0;
|
|
243
274
|
this.native = undefined;
|
|
244
275
|
this.cursor = driver.createCursor();
|
|
245
|
-
this.
|
|
276
|
+
this.outer = owner.context ? owner : owner.outer;
|
|
246
277
|
this.context = undefined;
|
|
247
278
|
}
|
|
248
|
-
|
|
249
|
-
|
|
279
|
+
get isMoved() {
|
|
280
|
+
let owner = this.host;
|
|
281
|
+
if (owner.driver.isLine)
|
|
282
|
+
owner = owner.host;
|
|
283
|
+
return owner.children.isMoved(this.item);
|
|
284
|
+
}
|
|
285
|
+
render(_triggers) {
|
|
286
|
+
renderNow(this.item);
|
|
250
287
|
}
|
|
251
288
|
get cells() { return this.assignedCells; }
|
|
252
289
|
set cells(value) {
|
|
@@ -322,50 +359,59 @@ class VBlockImpl extends VBlock {
|
|
|
322
359
|
this.appliedContentWrapping = value;
|
|
323
360
|
}
|
|
324
361
|
}
|
|
325
|
-
get
|
|
326
|
-
set
|
|
327
|
-
if (value !== this.
|
|
328
|
-
this.driver.
|
|
329
|
-
this.
|
|
362
|
+
get overlayVisible() { return this.appliedOverlayVisible; }
|
|
363
|
+
set overlayVisible(value) {
|
|
364
|
+
if (value !== this.appliedOverlayVisible) {
|
|
365
|
+
this.driver.applyOverlayVisible(this, value);
|
|
366
|
+
this.appliedOverlayVisible = value;
|
|
330
367
|
}
|
|
331
368
|
}
|
|
369
|
+
style(styleName, enabled) {
|
|
370
|
+
this.driver.applyStyling(this, this.assignedStyle, styleName, enabled);
|
|
371
|
+
this.assignedStyle = true;
|
|
372
|
+
}
|
|
332
373
|
configureReactronic(options) {
|
|
333
|
-
if (this.stamp !== 1 || !this.body.
|
|
374
|
+
if (this.stamp !== 1 || !this.body.autonomous)
|
|
334
375
|
throw new Error("reactronic can be configured only for reacting blocks and only inside initialize");
|
|
335
|
-
return Rx.getController(this.
|
|
376
|
+
return Rx.getController(this.render).configure(options);
|
|
336
377
|
}
|
|
337
|
-
static
|
|
378
|
+
static tryUseContextVariable(variable) {
|
|
338
379
|
var _a, _b;
|
|
339
380
|
let b = gCurrent.instance;
|
|
340
|
-
while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.
|
|
341
|
-
b = b.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
381
|
+
while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && b.host !== b)
|
|
382
|
+
b = b.outer;
|
|
383
|
+
return (_b = b.context) === null || _b === void 0 ? void 0 : _b.value;
|
|
384
|
+
}
|
|
385
|
+
static useContextVariableValue(variable) {
|
|
386
|
+
var _a;
|
|
387
|
+
const result = (_a = VBlockImpl.tryUseContextVariable(variable)) !== null && _a !== void 0 ? _a : variable.defaultValue;
|
|
388
|
+
if (!result)
|
|
389
|
+
throw new Error("context doesn't exist");
|
|
390
|
+
return result;
|
|
345
391
|
}
|
|
346
|
-
static
|
|
392
|
+
static setContextVariableValue(variable, value) {
|
|
347
393
|
const block = gCurrent.instance;
|
|
348
394
|
const host = block.host;
|
|
349
|
-
const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.
|
|
350
|
-
if (
|
|
395
|
+
const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.value; });
|
|
396
|
+
if (value && value !== hostCtx) {
|
|
351
397
|
if (hostCtx)
|
|
352
|
-
block.
|
|
398
|
+
block.outer = host;
|
|
353
399
|
else
|
|
354
|
-
block.
|
|
400
|
+
block.outer = host.outer;
|
|
355
401
|
Transaction.run({ separation: true }, () => {
|
|
356
402
|
const ctx = block.context;
|
|
357
403
|
if (ctx) {
|
|
358
|
-
ctx.
|
|
359
|
-
ctx.
|
|
404
|
+
ctx.variable = variable;
|
|
405
|
+
ctx.value = value;
|
|
360
406
|
}
|
|
361
407
|
else
|
|
362
|
-
block.context = new VBlockContext(
|
|
408
|
+
block.context = new VBlockContext(variable, value);
|
|
363
409
|
});
|
|
364
410
|
}
|
|
365
411
|
else if (hostCtx)
|
|
366
|
-
block.
|
|
412
|
+
block.outer = host;
|
|
367
413
|
else
|
|
368
|
-
block.
|
|
414
|
+
block.outer = host.outer;
|
|
369
415
|
}
|
|
370
416
|
}
|
|
371
417
|
VBlockImpl.grandCount = 0;
|
|
@@ -381,7 +427,7 @@ __decorate([
|
|
|
381
427
|
__metadata("design:type", Function),
|
|
382
428
|
__metadata("design:paramtypes", [Object]),
|
|
383
429
|
__metadata("design:returntype", void 0)
|
|
384
|
-
], VBlockImpl.prototype, "
|
|
430
|
+
], VBlockImpl.prototype, "render", null);
|
|
385
431
|
function runRenderNestedTreesThenDo(error, action) {
|
|
386
432
|
var _a;
|
|
387
433
|
const current = gCurrent;
|
|
@@ -392,7 +438,7 @@ function runRenderNestedTreesThenDo(error, action) {
|
|
|
392
438
|
try {
|
|
393
439
|
children.endMerge(error);
|
|
394
440
|
for (const item of children.removedItems(true)) {
|
|
395
|
-
|
|
441
|
+
triggerFinalization(item, true, true);
|
|
396
442
|
}
|
|
397
443
|
if (!error) {
|
|
398
444
|
const ownerIsBlock = owner.driver.isBlock;
|
|
@@ -409,11 +455,11 @@ function runRenderNestedTreesThenDo(error, action) {
|
|
|
409
455
|
const block = item.instance;
|
|
410
456
|
const driver = block.driver;
|
|
411
457
|
const host = driver.isLine ? owner : partHost;
|
|
412
|
-
const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.
|
|
458
|
+
const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
|
|
413
459
|
redeploy = markToRedeployIfNecessary(redeploy, host, item, children, sequential);
|
|
414
|
-
if (p === Priority.
|
|
415
|
-
|
|
416
|
-
else if (p === Priority.
|
|
460
|
+
if (p === Priority.Realtime)
|
|
461
|
+
triggerRendering(item);
|
|
462
|
+
else if (p === Priority.Normal)
|
|
417
463
|
p1 = push(item, p1);
|
|
418
464
|
else
|
|
419
465
|
p2 = push(item, p2);
|
|
@@ -447,9 +493,9 @@ function startIncrementalRendering(owner, allChildren, priority1, priority2) {
|
|
|
447
493
|
return __awaiter(this, void 0, void 0, function* () {
|
|
448
494
|
const stamp = owner.instance.stamp;
|
|
449
495
|
if (priority1)
|
|
450
|
-
yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.
|
|
496
|
+
yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
|
|
451
497
|
if (priority2)
|
|
452
|
-
yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.
|
|
498
|
+
yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
|
|
453
499
|
});
|
|
454
500
|
}
|
|
455
501
|
function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
@@ -460,13 +506,12 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
460
506
|
let outerPriority = VBlock.currentRenderingPriority;
|
|
461
507
|
VBlock.currentRenderingPriority = priority;
|
|
462
508
|
try {
|
|
463
|
-
const sequential = block.children.strict;
|
|
464
509
|
if (block.childrenShuffling)
|
|
465
510
|
shuffle(items);
|
|
466
|
-
const frameDurationLimit = priority === Priority.
|
|
511
|
+
const frameDurationLimit = priority === Priority.Background ? VBlock.shortFrameDuration : Infinity;
|
|
467
512
|
let frameDuration = Math.min(frameDurationLimit, Math.max(VBlock.frameDuration / 4, VBlock.shortFrameDuration));
|
|
468
513
|
for (const child of items) {
|
|
469
|
-
|
|
514
|
+
triggerRendering(child);
|
|
470
515
|
if (Transaction.isFrameOver(1, frameDuration)) {
|
|
471
516
|
VBlock.currentRenderingPriority = outerPriority;
|
|
472
517
|
yield Transaction.requestNextFrame(0);
|
|
@@ -484,51 +529,46 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
484
529
|
}
|
|
485
530
|
});
|
|
486
531
|
}
|
|
487
|
-
function
|
|
488
|
-
var _a, _b;
|
|
532
|
+
function triggerRendering(item) {
|
|
489
533
|
const block = item.instance;
|
|
490
534
|
if (block.stamp >= 0) {
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
nonreactive(block.rerender, (_b = block.body) === null || _b === void 0 ? void 0 : _b.triggers);
|
|
494
|
-
else
|
|
495
|
-
runRender(item);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
function prepareRender(item, redeploy, sequential) {
|
|
499
|
-
const block = item.instance;
|
|
500
|
-
const driver = block.driver;
|
|
501
|
-
if (block.stamp === 0) {
|
|
502
|
-
block.stamp = 1;
|
|
503
|
-
runUnder(item, () => {
|
|
504
|
-
var _a;
|
|
505
|
-
if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
|
|
535
|
+
if (block.body.autonomous) {
|
|
536
|
+
if (block.stamp === 0) {
|
|
506
537
|
Transaction.outside(() => {
|
|
507
538
|
if (Rx.isLogging)
|
|
508
539
|
Rx.setLoggingHint(block, block.key);
|
|
509
|
-
Rx.getController(block.
|
|
540
|
+
Rx.getController(block.render).configure({
|
|
510
541
|
order: block.level,
|
|
511
542
|
});
|
|
512
543
|
});
|
|
513
544
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
545
|
+
nonreactive(block.render, block.body.triggers);
|
|
546
|
+
}
|
|
547
|
+
else
|
|
548
|
+
renderNow(item);
|
|
517
549
|
}
|
|
518
|
-
else if (redeploy)
|
|
519
|
-
runUnder(item, () => {
|
|
520
|
-
driver.deploy(block, sequential);
|
|
521
|
-
});
|
|
522
550
|
}
|
|
523
|
-
function
|
|
551
|
+
function redeployIfNecessary(block) {
|
|
552
|
+
const driver = block.driver;
|
|
553
|
+
if (block.stamp === 0) {
|
|
554
|
+
block.stamp = 1;
|
|
555
|
+
driver.initialize(block, undefined);
|
|
556
|
+
driver.deploy(block);
|
|
557
|
+
}
|
|
558
|
+
else if (block.isMoved)
|
|
559
|
+
driver.deploy(block);
|
|
560
|
+
}
|
|
561
|
+
function renderNow(item) {
|
|
524
562
|
const block = item.instance;
|
|
525
563
|
if (block.stamp >= 0) {
|
|
526
564
|
let result = undefined;
|
|
527
565
|
runUnder(item, () => {
|
|
528
566
|
try {
|
|
567
|
+
redeployIfNecessary(block);
|
|
529
568
|
block.stamp++;
|
|
530
569
|
block.numerator = 0;
|
|
531
570
|
block.assignedCells = undefined;
|
|
571
|
+
block.assignedStyle = false;
|
|
532
572
|
block.children.beginMerge();
|
|
533
573
|
result = block.driver.render(block);
|
|
534
574
|
if (block.driver.isLine)
|
|
@@ -548,15 +588,14 @@ function runRender(item) {
|
|
|
548
588
|
});
|
|
549
589
|
}
|
|
550
590
|
}
|
|
551
|
-
function
|
|
552
|
-
var _a;
|
|
591
|
+
function triggerFinalization(item, isLeader, individual) {
|
|
553
592
|
const block = item.instance;
|
|
554
593
|
if (block.stamp >= 0) {
|
|
555
594
|
if (individual && block.key !== block.body.key && !block.driver.isLine)
|
|
556
595
|
console.log(`WARNING: it is recommended to assign explicit key for conditionally rendered block in order to avoid unexpected side effects: ${block.key}`);
|
|
557
596
|
block.stamp = ~block.stamp;
|
|
558
597
|
const childrenAreLeaders = block.driver.finalize(block, isLeader);
|
|
559
|
-
if (
|
|
598
|
+
if (block.body.autonomous) {
|
|
560
599
|
item.aux = undefined;
|
|
561
600
|
const last = gLastToDispose;
|
|
562
601
|
if (last)
|
|
@@ -569,7 +608,7 @@ function runFinalize(item, isLeader, individual) {
|
|
|
569
608
|
});
|
|
570
609
|
}
|
|
571
610
|
for (const item of block.children.items())
|
|
572
|
-
|
|
611
|
+
triggerFinalization(item, childrenAreLeaders, false);
|
|
573
612
|
VBlockImpl.grandCount--;
|
|
574
613
|
}
|
|
575
614
|
}
|
|
@@ -662,7 +701,7 @@ function defaultReject(error) {
|
|
|
662
701
|
Promise.prototype.then = reactronicDomHookedThen;
|
|
663
702
|
const NOP = (...args) => { };
|
|
664
703
|
const gSysDriver = new StaticDriver(null, "SYSTEM", LayoutKind.Group);
|
|
665
|
-
const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, {
|
|
704
|
+
const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, { autonomous: true, render: NOP }));
|
|
666
705
|
gSysRoot.instance.item = gSysRoot;
|
|
667
706
|
Object.defineProperty(gSysRoot.instance, "host", {
|
|
668
707
|
value: gSysRoot.instance,
|
|
@@ -18,6 +18,7 @@ export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T>
|
|
|
18
18
|
applyContentAlignment(block: VBlock<T>, contentAlign: Align): void;
|
|
19
19
|
applyFrameAlignment(block: VBlock<T>, frameAlign: Align): void;
|
|
20
20
|
applyContentWrapping(block: VBlock<T>, contentWrapping: boolean): void;
|
|
21
|
-
|
|
21
|
+
applyOverlayVisible(block: VBlock<T>, overlayVisible: boolean | undefined): void;
|
|
22
|
+
applyStyling(block: VBlock<T, any, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
|
|
22
23
|
render(block: VBlock<T>): void | Promise<void>;
|
|
23
24
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { VBlock, LayoutKind, Align, GridCursor,
|
|
1
|
+
import { VBlock, LayoutKind, Align, GridCursor, vmt } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
3
|
export function Block(body) {
|
|
4
4
|
return VBlock.claim(VerstakTags.block, body);
|
|
5
5
|
}
|
|
6
6
|
export function PlainText(content, body) {
|
|
7
|
-
return VBlock.claim(VerstakTags.text,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
return VBlock.claim(VerstakTags.text, Object.assign(Object.assign({}, vmt(body)), { base: {
|
|
8
|
+
render(b) {
|
|
9
|
+
b.native.innerText = content;
|
|
10
|
+
}
|
|
11
|
+
} }));
|
|
12
12
|
}
|
|
13
13
|
export function HtmlText(content, body) {
|
|
14
|
-
return VBlock.claim(VerstakTags.text,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
return VBlock.claim(VerstakTags.text, Object.assign(Object.assign({}, vmt(body)), { base: {
|
|
15
|
+
render(b) {
|
|
16
|
+
b.native.innerHTML = content;
|
|
17
|
+
}
|
|
18
|
+
} }));
|
|
19
19
|
}
|
|
20
20
|
export function Grid(body) {
|
|
21
21
|
return VBlock.claim(VerstakTags.grid, body);
|
|
@@ -110,11 +110,32 @@ export class VerstakDriver extends HtmlDriver {
|
|
|
110
110
|
else
|
|
111
111
|
block.native.removeAttribute("wrapping");
|
|
112
112
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
applyOverlayVisible(block, overlayVisible) {
|
|
114
|
+
const e = block.native;
|
|
115
|
+
const parent = HtmlDriver.findNearestParentHtmlBlock(block).native;
|
|
116
|
+
if (overlayVisible === true) {
|
|
117
|
+
const doc = document.body;
|
|
118
|
+
const rect = parent.getBoundingClientRect();
|
|
119
|
+
const h = doc.offsetWidth - rect.left > rect.right ? "rightward" : "leftward";
|
|
120
|
+
const v = doc.clientHeight - rect.top > rect.bottom ? "downward" : "upward";
|
|
121
|
+
e.setAttribute("overlay", `${h}-${v}`);
|
|
122
|
+
parent.setAttribute("stacking", "true");
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
parent.removeAttribute("stacking");
|
|
126
|
+
if (overlayVisible === false)
|
|
127
|
+
e.setAttribute("overlay", "hidden");
|
|
128
|
+
else
|
|
129
|
+
e.removeAttribute("overlay");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
applyStyling(block, secondary, styleName, enabled) {
|
|
133
|
+
const e = block.native;
|
|
134
|
+
enabled !== null && enabled !== void 0 ? enabled : (enabled = true);
|
|
135
|
+
if (secondary)
|
|
136
|
+
e.classList.toggle(styleName, enabled);
|
|
116
137
|
else
|
|
117
|
-
|
|
138
|
+
e.className = enabled ? styleName : "";
|
|
118
139
|
}
|
|
119
140
|
render(block) {
|
|
120
141
|
if (block.driver.layout < LayoutKind.Line)
|