verstak 0.22.515 → 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.
@@ -17,31 +17,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
17
17
  });
18
18
  };
19
19
  import { reactive, nonreactive, Transaction, options, Reentrance, Rx, Collection, ObservableObject, raw } from "reactronic";
20
- import { equalCellRanges } from "./CellRange";
20
+ import { getCallerInfo } from "./Utils";
21
+ import { emitLetters, equalCellRanges } from "./CellRange";
21
22
  import { Cursor, Align } from "./Cursor";
22
23
  export var Priority;
23
24
  (function (Priority) {
24
- Priority[Priority["SyncP0"] = 0] = "SyncP0";
25
- Priority[Priority["AsyncP1"] = 1] = "AsyncP1";
26
- Priority[Priority["AsyncP2"] = 2] = "AsyncP2";
25
+ Priority[Priority["Realtime"] = 0] = "Realtime";
26
+ Priority[Priority["Normal"] = 1] = "Normal";
27
+ Priority[Priority["Background"] = 2] = "Background";
27
28
  })(Priority || (Priority = {}));
28
- export function asBaseFor(outer, base) {
29
- if (outer instanceof Function)
30
- outer = { render: outer };
31
- if (base instanceof Function)
32
- base = { render: base };
33
- 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) });
34
- return result;
35
- }
36
- function via(outer, base) {
37
- const inherited = base !== null && base !== void 0 ? base : NOP;
38
- return outer ? b => outer(b, () => inherited(b)) : inherited;
39
- }
40
- export function setContext(type, context) {
41
- return VBlockImpl.setContext(type, context);
42
- }
43
- export function use(type) {
44
- return VBlockImpl.use(type);
29
+ export function vmt(body) {
30
+ if (body instanceof Function)
31
+ body = { render: body };
32
+ return body;
45
33
  }
46
34
  export class VBlock {
47
35
  get isInitialRendering() {
@@ -49,7 +37,7 @@ export class VBlock {
49
37
  }
50
38
  static root(render) {
51
39
  gSysRoot.instance.body.render = render;
52
- prepareAndRunRender(gSysRoot, false, false);
40
+ triggerRendering(gSysRoot);
53
41
  }
54
42
  static get current() {
55
43
  return gCurrent.instance;
@@ -61,7 +49,7 @@ export class VBlock {
61
49
  forEachChildRecursively(gSysRoot, action);
62
50
  }
63
51
  static claim(driver, body) {
64
- var _a, _b;
52
+ var _a;
65
53
  let result;
66
54
  const owner = gCurrent.instance;
67
55
  const children = owner.children;
@@ -70,30 +58,40 @@ export class VBlock {
70
58
  if (body instanceof Function)
71
59
  body = { render: body };
72
60
  let key = body.key;
73
- if (driver.isRow) {
61
+ if (driver.isLine) {
74
62
  const last = children.lastClaimedItem();
75
63
  if (((_a = last === null || last === void 0 ? void 0 : last.instance) === null || _a === void 0 ? void 0 : _a.driver) === driver)
76
64
  ex = last;
77
65
  }
78
- ex !== null && ex !== void 0 ? ex : (ex = children.claim(key = key || `${++owner.numerator}!`, undefined, "nested blocks can be declared inside render function only"));
66
+ ex !== null && ex !== void 0 ? ex : (ex = children.claim(key = key || VBlock.generateKey(owner), undefined, "nested blocks can be declared inside render function only"));
79
67
  if (ex) {
80
68
  result = ex.instance;
81
69
  if (result.driver !== driver && driver !== undefined)
82
70
  throw new Error(`changing block driver is not yet supported: "${result.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
83
- const exTriggers = (_b = result.body) === null || _b === void 0 ? void 0 : _b.triggers;
71
+ const exTriggers = result.body.triggers;
84
72
  if (triggersAreEqual(body.triggers, exTriggers))
85
73
  body.triggers = exTriggers;
86
74
  result.body = body;
87
75
  }
88
76
  else {
89
- result = new VBlockImpl(key || `${++owner.numerator}!`, driver, owner, body);
77
+ result = new VBlockImpl(key || VBlock.generateKey(owner), driver, owner, body);
90
78
  result.item = children.add(result);
91
79
  VBlockImpl.grandCount++;
92
- if (body.reacting)
80
+ if (body.autonomous)
93
81
  VBlockImpl.disposableCount++;
94
82
  }
95
83
  return result;
96
84
  }
85
+ static generateKey(owner) {
86
+ const n = owner.numerator++;
87
+ const lettered = emitLetters(n);
88
+ let result;
89
+ if (Rx.isLogging)
90
+ result = `${getCallerInfo(lettered)}!`;
91
+ else
92
+ result = `${lettered}!`;
93
+ return result;
94
+ }
97
95
  static getDefaultLoggingOptions() {
98
96
  return VBlockImpl.logging;
99
97
  }
@@ -103,43 +101,44 @@ export class VBlock {
103
101
  }
104
102
  VBlock.shortFrameDuration = 16;
105
103
  VBlock.longFrameDuration = 300;
106
- VBlock.currentRenderingPriority = Priority.SyncP0;
104
+ VBlock.currentRenderingPriority = Priority.Realtime;
107
105
  VBlock.frameDuration = VBlock.longFrameDuration;
108
106
  export var LayoutKind;
109
107
  (function (LayoutKind) {
110
108
  LayoutKind[LayoutKind["Block"] = 0] = "Block";
111
109
  LayoutKind[LayoutKind["Grid"] = 1] = "Grid";
112
- LayoutKind[LayoutKind["Row"] = 2] = "Row";
110
+ LayoutKind[LayoutKind["Line"] = 2] = "Line";
113
111
  LayoutKind[LayoutKind["Group"] = 3] = "Group";
114
112
  LayoutKind[LayoutKind["Text"] = 4] = "Text";
115
113
  })(LayoutKind || (LayoutKind = {}));
116
114
  const createDefaultCursor = () => new Cursor();
117
115
  export class AbstractDriver {
116
+ get isSequential() { return (this.layout & 1) === 0; }
117
+ get isAuxiliary() { return (this.layout & 2) === 2; }
118
+ get isBlock() { return this.layout === LayoutKind.Block; }
119
+ get isGrid() { return this.layout === LayoutKind.Grid; }
120
+ get isLine() { return this.layout === LayoutKind.Line; }
118
121
  constructor(name, layout, createCursor) {
119
122
  this.name = name;
120
123
  this.layout = layout;
121
124
  this.createCursor = createCursor !== null && createCursor !== void 0 ? createCursor : createDefaultCursor;
122
125
  }
123
- get isSequential() { return (this.layout & 1) === 0; }
124
- get isAuxiliary() { return (this.layout & 2) === 2; }
125
- get isBlock() { return this.layout === LayoutKind.Block; }
126
- get isGrid() { return this.layout === LayoutKind.Grid; }
127
- get isRow() { return this.layout === LayoutKind.Row; }
128
126
  initialize(block, native) {
129
- var _a, _b;
130
127
  const b = block;
131
128
  b.native = native;
132
- (_b = (_a = block.body).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
129
+ invokeInitializeChain(b, b.body);
130
+ }
131
+ deploy(block) {
132
+ }
133
+ render(block) {
134
+ invokeRenderChain(block, block.body);
133
135
  }
134
136
  finalize(block, isLeader) {
135
- var _a, _b;
136
137
  const b = block;
137
- (_b = (_a = block.body).finalize) === null || _b === void 0 ? void 0 : _b.call(_a, block, NOP);
138
+ invokeFinalizeChain(b, b.body);
138
139
  b.native = null;
139
140
  return isLeader;
140
141
  }
141
- deploy(block, sequential) {
142
- }
143
142
  applyCellRange(block, cellRange) {
144
143
  }
145
144
  applyWidthGrowth(block, widthGrowth) {
@@ -160,24 +159,47 @@ export class AbstractDriver {
160
159
  }
161
160
  applyContentWrapping(block, contentWrapping) {
162
161
  }
163
- applyFloating(block, floating) {
162
+ applyOverlayVisible(block, overlayVisible) {
164
163
  }
165
- render(block) {
166
- var _a;
167
- let result;
168
- const override = (_a = block.body) === null || _a === void 0 ? void 0 : _a.override;
169
- if (override)
170
- result = override(block, NOP);
171
- else
172
- result = invokeRenderFunction(block);
173
- return result;
164
+ applyStyling(block, secondary, styleName, enabled) {
174
165
  }
175
166
  }
176
167
  AbstractDriver.group = new AbstractDriver("group", LayoutKind.Group);
177
- function invokeRenderFunction(block) {
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) {
178
181
  var _a;
179
- const r = (_a = block.body.render) !== null && _a !== void 0 ? _a : NOP;
180
- return r(block, NOP);
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) {
193
+ var _a;
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);
181
203
  }
182
204
  export class StaticDriver extends AbstractDriver {
183
205
  constructor(element, name, layout, createCursor) {
@@ -188,20 +210,39 @@ export class StaticDriver extends AbstractDriver {
188
210
  super.initialize(block, this.element);
189
211
  }
190
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
+ }
191
227
  function getBlockKey(block) {
192
228
  return block.stamp >= 0 ? block.key : undefined;
193
229
  }
194
230
  class VBlockContext extends ObservableObject {
195
- constructor(type, instance) {
231
+ constructor(variable, value) {
196
232
  super();
197
- this.type = type;
198
- this.instance = instance;
233
+ this.next = undefined;
234
+ this.variable = variable;
235
+ this.value = value;
199
236
  }
200
237
  }
201
238
  __decorate([
202
239
  raw,
203
240
  __metadata("design:type", Object)
204
- ], VBlockContext.prototype, "type", void 0);
241
+ ], VBlockContext.prototype, "next", void 0);
242
+ __decorate([
243
+ raw,
244
+ __metadata("design:type", ContextVariable)
245
+ ], VBlockContext.prototype, "variable", void 0);
205
246
  class VBlockImpl extends VBlock {
206
247
  constructor(key, driver, owner, body) {
207
248
  super();
@@ -210,6 +251,7 @@ class VBlockImpl extends VBlock {
210
251
  this.body = body;
211
252
  this.model = undefined;
212
253
  this.assignedCells = undefined;
254
+ this.assignedStyle = false;
213
255
  this.appliedCellRange = Cursor.UndefinedCellRange;
214
256
  this.appliedWidthGrowth = 0;
215
257
  this.appliedMinWidth = "";
@@ -220,9 +262,9 @@ class VBlockImpl extends VBlock {
220
262
  this.appliedContentAlignment = Align.Default;
221
263
  this.appliedFrameAlignment = Align.Default;
222
264
  this.appliedContentWrapping = false;
223
- this.appliedFloating = false;
265
+ this.appliedOverlayVisible = undefined;
224
266
  this.childrenShuffling = false;
225
- this.renderingPriority = Priority.SyncP0;
267
+ this.renderingPriority = Priority.Realtime;
226
268
  this.level = owner.level + 1;
227
269
  this.host = owner;
228
270
  this.children = new Collection(driver.isSequential, getBlockKey);
@@ -231,11 +273,17 @@ class VBlockImpl extends VBlock {
231
273
  this.stamp = 0;
232
274
  this.native = undefined;
233
275
  this.cursor = driver.createCursor();
234
- this.senior = owner.context ? owner : owner.senior;
276
+ this.outer = owner.context ? owner : owner.outer;
235
277
  this.context = undefined;
236
278
  }
237
- rerender(_triggers) {
238
- runRender(this.item);
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);
239
287
  }
240
288
  get cells() { return this.assignedCells; }
241
289
  set cells(value) {
@@ -278,16 +326,16 @@ class VBlockImpl extends VBlock {
278
326
  }
279
327
  get minHeight() { return this.appliedMinHeight; }
280
328
  set minHeight(value) {
281
- if (value !== this.appliedMinWidth) {
282
- this.driver.applyMinWidth(this, value);
283
- this.appliedMinWidth = value;
329
+ if (value !== this.appliedMinHeight) {
330
+ this.driver.applyMinHeight(this, value);
331
+ this.appliedMinHeight = value;
284
332
  }
285
333
  }
286
334
  get maxHeight() { return this.appliedMaxHeight; }
287
335
  set maxHeight(value) {
288
- if (value !== this.appliedMaxWidth) {
289
- this.driver.applyMaxWidth(this, value);
290
- this.appliedMaxWidth = value;
336
+ if (value !== this.appliedMaxHeight) {
337
+ this.driver.applyMaxHeight(this, value);
338
+ this.appliedMaxHeight = value;
291
339
  }
292
340
  }
293
341
  get contentAlignment() { return this.appliedContentAlignment; }
@@ -311,50 +359,59 @@ class VBlockImpl extends VBlock {
311
359
  this.appliedContentWrapping = value;
312
360
  }
313
361
  }
314
- get floating() { return this.appliedFloating; }
315
- set floating(value) {
316
- if (value !== this.appliedFloating) {
317
- this.driver.applyFloating(this, value);
318
- this.appliedFloating = value;
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;
319
367
  }
320
368
  }
369
+ style(styleName, enabled) {
370
+ this.driver.applyStyling(this, this.assignedStyle, styleName, enabled);
371
+ this.assignedStyle = true;
372
+ }
321
373
  configureReactronic(options) {
322
- if (this.stamp !== 1 || !this.body.reacting)
374
+ if (this.stamp !== 1 || !this.body.autonomous)
323
375
  throw new Error("reactronic can be configured only for reacting blocks and only inside initialize");
324
- return Rx.getController(this.rerender).configure(options);
376
+ return Rx.getController(this.render).configure(options);
325
377
  }
326
- static use(type) {
378
+ static tryUseContextVariable(variable) {
327
379
  var _a, _b;
328
380
  let b = gCurrent.instance;
329
- while (((_a = b.context) === null || _a === void 0 ? void 0 : _a.type) !== type && b.host !== b)
330
- b = b.senior;
331
- if (b.host === b)
332
- throw new Error(`${type.name} context doesn't exist`);
333
- return (_b = b.context) === null || _b === void 0 ? void 0 : _b.instance;
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;
334
384
  }
335
- static setContext(type, context) {
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;
391
+ }
392
+ static setContextVariableValue(variable, value) {
336
393
  const block = gCurrent.instance;
337
394
  const host = block.host;
338
- const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.instance; });
339
- if (context && context !== hostCtx) {
395
+ const hostCtx = nonreactive(() => { var _a; return (_a = host.context) === null || _a === void 0 ? void 0 : _a.value; });
396
+ if (value && value !== hostCtx) {
340
397
  if (hostCtx)
341
- block.senior = host;
398
+ block.outer = host;
342
399
  else
343
- block.senior = host.senior;
400
+ block.outer = host.outer;
344
401
  Transaction.run({ separation: true }, () => {
345
402
  const ctx = block.context;
346
403
  if (ctx) {
347
- ctx.type = type;
348
- ctx.instance = context;
404
+ ctx.variable = variable;
405
+ ctx.value = value;
349
406
  }
350
407
  else
351
- block.context = new VBlockContext(type, context);
408
+ block.context = new VBlockContext(variable, value);
352
409
  });
353
410
  }
354
411
  else if (hostCtx)
355
- block.senior = host;
412
+ block.outer = host;
356
413
  else
357
- block.senior = host.senior;
414
+ block.outer = host.outer;
358
415
  }
359
416
  }
360
417
  VBlockImpl.grandCount = 0;
@@ -370,7 +427,7 @@ __decorate([
370
427
  __metadata("design:type", Function),
371
428
  __metadata("design:paramtypes", [Object]),
372
429
  __metadata("design:returntype", void 0)
373
- ], VBlockImpl.prototype, "rerender", null);
430
+ ], VBlockImpl.prototype, "render", null);
374
431
  function runRenderNestedTreesThenDo(error, action) {
375
432
  var _a;
376
433
  const current = gCurrent;
@@ -381,10 +438,7 @@ function runRenderNestedTreesThenDo(error, action) {
381
438
  try {
382
439
  children.endMerge(error);
383
440
  for (const item of children.removedItems(true)) {
384
- const b = item.instance;
385
- if (b.key !== b.body.key)
386
- console.warn(`every conditionally rendered block requires explicit key: ${b.key}, ${b.driver.name}`);
387
- runFinalize(item, true);
441
+ triggerFinalization(item, true, true);
388
442
  }
389
443
  if (!error) {
390
444
  const ownerIsBlock = owner.driver.isBlock;
@@ -400,16 +454,16 @@ function runRenderNestedTreesThenDo(error, action) {
400
454
  break;
401
455
  const block = item.instance;
402
456
  const driver = block.driver;
403
- const host = driver.isRow ? owner : partHost;
404
- const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.SyncP0;
457
+ const host = driver.isLine ? owner : partHost;
458
+ const p = (_a = block.renderingPriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
405
459
  redeploy = markToRedeployIfNecessary(redeploy, host, item, children, sequential);
406
- if (p === Priority.SyncP0)
407
- prepareAndRunRender(item, children.isMoved(item), sequential);
408
- else if (p === Priority.AsyncP1)
460
+ if (p === Priority.Realtime)
461
+ triggerRendering(item);
462
+ else if (p === Priority.Normal)
409
463
  p1 = push(item, p1);
410
464
  else
411
465
  p2 = push(item, p2);
412
- if (ownerIsBlock && driver.isRow)
466
+ if (ownerIsBlock && driver.isLine)
413
467
  partHost = block;
414
468
  }
415
469
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
@@ -439,9 +493,9 @@ function startIncrementalRendering(owner, allChildren, priority1, priority2) {
439
493
  return __awaiter(this, void 0, void 0, function* () {
440
494
  const stamp = owner.instance.stamp;
441
495
  if (priority1)
442
- yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.AsyncP1);
496
+ yield renderIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
443
497
  if (priority2)
444
- yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.AsyncP2);
498
+ yield renderIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
445
499
  });
446
500
  }
447
501
  function renderIncrementally(owner, stamp, allChildren, items, priority) {
@@ -452,13 +506,12 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
452
506
  let outerPriority = VBlock.currentRenderingPriority;
453
507
  VBlock.currentRenderingPriority = priority;
454
508
  try {
455
- const sequential = block.children.strict;
456
509
  if (block.childrenShuffling)
457
510
  shuffle(items);
458
- const frameDurationLimit = priority === Priority.AsyncP2 ? VBlock.shortFrameDuration : Infinity;
511
+ const frameDurationLimit = priority === Priority.Background ? VBlock.shortFrameDuration : Infinity;
459
512
  let frameDuration = Math.min(frameDurationLimit, Math.max(VBlock.frameDuration / 4, VBlock.shortFrameDuration));
460
513
  for (const child of items) {
461
- prepareAndRunRender(child, allChildren.isMoved(child), sequential);
514
+ triggerRendering(child);
462
515
  if (Transaction.isFrameOver(1, frameDuration)) {
463
516
  VBlock.currentRenderingPriority = outerPriority;
464
517
  yield Transaction.requestNextFrame(0);
@@ -476,54 +529,49 @@ function renderIncrementally(owner, stamp, allChildren, items, priority) {
476
529
  }
477
530
  });
478
531
  }
479
- function prepareAndRunRender(item, redeploy, sequential) {
480
- var _a, _b;
532
+ function triggerRendering(item) {
481
533
  const block = item.instance;
482
534
  if (block.stamp >= 0) {
483
- prepareRender(item, redeploy, sequential);
484
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting)
485
- nonreactive(block.rerender, (_b = block.body) === null || _b === void 0 ? void 0 : _b.triggers);
486
- else
487
- runRender(item);
488
- }
489
- }
490
- function prepareRender(item, redeploy, sequential) {
491
- const block = item.instance;
492
- const driver = block.driver;
493
- if (block.stamp === 0) {
494
- block.stamp = 1;
495
- runUnder(item, () => {
496
- var _a;
497
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
535
+ if (block.body.autonomous) {
536
+ if (block.stamp === 0) {
498
537
  Transaction.outside(() => {
499
538
  if (Rx.isLogging)
500
539
  Rx.setLoggingHint(block, block.key);
501
- Rx.getController(block.rerender).configure({
540
+ Rx.getController(block.render).configure({
502
541
  order: block.level,
503
542
  });
504
543
  });
505
544
  }
506
- driver.initialize(block, undefined);
507
- driver.deploy(block, sequential);
508
- });
545
+ nonreactive(block.render, block.body.triggers);
546
+ }
547
+ else
548
+ renderNow(item);
509
549
  }
510
- else if (redeploy)
511
- runUnder(item, () => {
512
- driver.deploy(block, sequential);
513
- });
514
550
  }
515
- function runRender(item) {
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) {
516
562
  const block = item.instance;
517
563
  if (block.stamp >= 0) {
518
564
  let result = undefined;
519
565
  runUnder(item, () => {
520
566
  try {
567
+ redeployIfNecessary(block);
521
568
  block.stamp++;
522
569
  block.numerator = 0;
523
570
  block.assignedCells = undefined;
571
+ block.assignedStyle = false;
524
572
  block.children.beginMerge();
525
573
  result = block.driver.render(block);
526
- if (block.driver.isRow)
574
+ if (block.driver.isLine)
527
575
  block.host.cursor.lineFeed();
528
576
  else if (block.assignedCells === undefined)
529
577
  block.cells = undefined;
@@ -540,13 +588,14 @@ function runRender(item) {
540
588
  });
541
589
  }
542
590
  }
543
- function runFinalize(item, isLeader) {
544
- var _a;
591
+ function triggerFinalization(item, isLeader, individual) {
545
592
  const block = item.instance;
546
593
  if (block.stamp >= 0) {
594
+ if (individual && block.key !== block.body.key && !block.driver.isLine)
595
+ console.log(`WARNING: it is recommended to assign explicit key for conditionally rendered block in order to avoid unexpected side effects: ${block.key}`);
547
596
  block.stamp = ~block.stamp;
548
597
  const childrenAreLeaders = block.driver.finalize(block, isLeader);
549
- if ((_a = block.body) === null || _a === void 0 ? void 0 : _a.reacting) {
598
+ if (block.body.autonomous) {
550
599
  item.aux = undefined;
551
600
  const last = gLastToDispose;
552
601
  if (last)
@@ -559,7 +608,7 @@ function runFinalize(item, isLeader) {
559
608
  });
560
609
  }
561
610
  for (const item of block.children.items())
562
- runFinalize(item, childrenAreLeaders);
611
+ triggerFinalization(item, childrenAreLeaders, false);
563
612
  VBlockImpl.grandCount--;
564
613
  }
565
614
  }
@@ -652,7 +701,7 @@ function defaultReject(error) {
652
701
  Promise.prototype.then = reactronicDomHookedThen;
653
702
  const NOP = (...args) => { };
654
703
  const gSysDriver = new StaticDriver(null, "SYSTEM", LayoutKind.Group);
655
- const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, { reacting: true, render: NOP }));
704
+ const gSysRoot = Collection.createItem(new VBlockImpl(gSysDriver.name, gSysDriver, { level: 0 }, { autonomous: true, render: NOP }));
656
705
  gSysRoot.instance.item = gSysRoot;
657
706
  Object.defineProperty(gSysRoot.instance, "host", {
658
707
  value: gSysRoot.instance,
@@ -4,7 +4,7 @@ export declare function Block<M = unknown, R = void>(body: BlockBody<HTMLElement
4
4
  export declare function PlainText(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
5
5
  export declare function HtmlText(content: string, body?: BlockBody<HTMLElement, void, void>): VBlock<HTMLElement, void, void>;
6
6
  export declare function Grid<M = unknown, R = void>(body: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
7
- export declare function Line<T = void>(body: (block: void) => T): void;
7
+ export declare function line<T = void>(body: (block: void) => T): void;
8
8
  export declare function lineFeed(noCoalescing?: boolean, key?: string): VBlock<HTMLElement>;
9
9
  export declare function Group<M = unknown, R = void>(body: BlockBody<HTMLElement, M, R>): VBlock<HTMLElement, M, R>;
10
10
  export declare class VerstakDriver<T extends HTMLElement> extends HtmlDriver<T> {
@@ -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
- applyFloating(block: VBlock<T>, floating: boolean): void;
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
  }