verstak 0.23.122 → 0.23.123

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.
@@ -20,43 +20,43 @@ import { reactive, unobs, Transaction, options, Reentrance, Rx, MergeList, Obser
20
20
  import { ElKind, Priority, Mode, Align } from "./Interfaces.js";
21
21
  import { emitLetters, equalElCoords, parseElCoords, getCallerInfo } from "./Utils.js";
22
22
  export class Verstak {
23
- static claim(driver, builder, base) {
23
+ static specify(driver, spec, base) {
24
24
  var _a;
25
25
  let result;
26
- if (builder)
27
- builder.base = base;
26
+ if (spec)
27
+ spec.base = base;
28
28
  else
29
- builder = base !== null && base !== void 0 ? base : {};
30
- let key = builder.key;
29
+ spec = base !== null && base !== void 0 ? base : {};
30
+ let key = spec.key;
31
31
  const owner = gCurrent === null || gCurrent === void 0 ? void 0 : gCurrent.instance;
32
32
  if (owner) {
33
33
  let ex = undefined;
34
34
  const children = owner.node.children;
35
- if (driver.isRow) {
36
- const last = children.lastClaimedItem();
35
+ if (driver.isSeparator) {
36
+ const last = children.lastSpecifiedItem();
37
37
  if (((_a = last === null || last === void 0 ? void 0 : last.instance) === null || _a === void 0 ? void 0 : _a.node.driver) === driver)
38
38
  ex = last;
39
39
  }
40
- ex !== null && ex !== void 0 ? ex : (ex = children.claim(key = key || generateKey(owner), undefined, "nested elements can be declared inside update function only"));
40
+ ex !== null && ex !== void 0 ? ex : (ex = children.specify(key = key || generateKey(owner), undefined, "nested elements can be declared inside update function only"));
41
41
  if (ex) {
42
42
  result = ex.instance;
43
43
  const node = result.node;
44
44
  if (node.driver !== driver && driver !== undefined)
45
45
  throw new Error(`changing element driver is not yet supported: "${result.node.driver.name}" -> "${driver === null || driver === void 0 ? void 0 : driver.name}"`);
46
- const exTriggers = node.builder.triggers;
47
- if (triggersAreEqual(builder.triggers, exTriggers))
48
- builder.triggers = exTriggers;
49
- node.builder = builder;
46
+ const exTriggers = node.spec.triggers;
47
+ if (triggersAreEqual(spec.triggers, exTriggers))
48
+ spec.triggers = exTriggers;
49
+ node.spec = spec;
50
50
  }
51
51
  else {
52
- result = new ElImpl(key || generateKey(owner), driver, owner, builder);
53
- result.node.ties = children.add(result);
52
+ result = new ElImpl(key || generateKey(owner), driver, owner, spec);
53
+ result.node.slot = children.add(result);
54
54
  }
55
55
  }
56
56
  else {
57
- result = new ElImpl(key || "", driver, owner, builder);
58
- result.node.ties = MergeList.createItem(result);
59
- triggerUpdate(result.node.ties);
57
+ result = new ElImpl(key || "", driver, owner, spec);
58
+ result.node.slot = MergeList.createItem(result);
59
+ triggerUpdate(result.node.slot);
60
60
  }
61
61
  return result;
62
62
  }
@@ -67,10 +67,10 @@ export class Verstak {
67
67
  }
68
68
  static triggerUpdate(element, triggers) {
69
69
  const el = element;
70
- const builder = el.node.builder;
71
- if (!triggersAreEqual(triggers, builder.triggers)) {
72
- builder.triggers = triggers;
73
- triggerUpdate(el.node.ties);
70
+ const spec = el.node.spec;
71
+ if (!triggersAreEqual(triggers, spec.triggers)) {
72
+ spec.triggers = triggers;
73
+ triggerUpdate(el.node.slot);
74
74
  }
75
75
  }
76
76
  static updateNestedTreesThenDo(action) {
@@ -88,32 +88,29 @@ Verstak.longFrameDuration = 300;
88
88
  Verstak.currentUpdatePriority = Priority.Realtime;
89
89
  Verstak.frameDuration = Verstak.longFrameDuration;
90
90
  export class BaseDriver {
91
- constructor(name, isRow, preset) {
91
+ constructor(name, isSeparator, preset) {
92
92
  this.name = name;
93
- this.isRow = isRow;
93
+ this.isSeparator = isSeparator;
94
94
  this.preset = preset;
95
95
  }
96
- claim(element) {
97
- const el = element;
98
- chainedClaim(el, el.node.builder);
96
+ specify(element) {
97
+ chainedSpecify(element, element.node.spec);
99
98
  }
100
- create(element, result) {
101
- chainedCreate(element, element.node.builder);
99
+ create(element) {
100
+ chainedCreate(element, element.node.spec);
102
101
  }
103
102
  initialize(element) {
104
103
  var _a;
105
- const el = element;
106
- (_a = this.preset) === null || _a === void 0 ? void 0 : _a.call(this, el);
107
- chainedInitialize(el, el.node.builder);
104
+ (_a = this.preset) === null || _a === void 0 ? void 0 : _a.call(this, element);
105
+ chainedInitialize(element, element.node.spec);
108
106
  }
109
- mount(element, nativeHost) {
107
+ mount(element) {
110
108
  }
111
109
  update(element) {
112
- chainedUpdated(element, element.node.builder);
110
+ chainedUpdated(element, element.node.spec);
113
111
  }
114
112
  finalize(element, isLeader) {
115
- const el = element;
116
- chainedFinalize(el, el.node.builder);
113
+ chainedFinalize(element, element.node.spec);
117
114
  return isLeader;
118
115
  }
119
116
  applyKind(element, value) { }
@@ -145,13 +142,13 @@ function chainedMode(bb) {
145
142
  var _a;
146
143
  return (_a = bb === null || bb === void 0 ? void 0 : bb.mode) !== null && _a !== void 0 ? _a : ((bb === null || bb === void 0 ? void 0 : bb.base) ? chainedMode(bb === null || bb === void 0 ? void 0 : bb.base) : Mode.Default);
147
144
  }
148
- function chainedClaim(element, elb) {
149
- const claim = elb.claim;
145
+ function chainedSpecify(element, elb) {
146
+ const specify = elb.specify;
150
147
  const base = elb.base;
151
- if (claim)
152
- claim(element, base ? () => chainedClaim(element, base) : NOP);
148
+ if (specify)
149
+ specify(element, base ? () => chainedSpecify(element, base) : NOP);
153
150
  else if (base)
154
- chainedClaim(element, base);
151
+ chainedSpecify(element, base);
155
152
  }
156
153
  function chainedCreate(element, elb) {
157
154
  const create = elb.create;
@@ -190,8 +187,8 @@ export class StaticDriver extends BaseDriver {
190
187
  super(name, isRow, preset);
191
188
  this.native = native;
192
189
  }
193
- create(element, result) {
194
- result.native = this.native;
190
+ create(element) {
191
+ element.native = this.native;
195
192
  }
196
193
  }
197
194
  export class CursorCommand {
@@ -200,9 +197,9 @@ export class CursorCommandDriver extends BaseDriver {
200
197
  constructor() {
201
198
  super("cursor", false, el => el.kind = ElKind.Cursor);
202
199
  }
203
- create(element, result) {
204
- result.native = new CursorCommand();
205
- super.create(element, result);
200
+ create(element) {
201
+ element.native = new CursorCommand();
202
+ super.create(element);
206
203
  }
207
204
  }
208
205
  export class SubTreeVariable {
@@ -237,7 +234,7 @@ var CursorFlags;
237
234
  })(CursorFlags || (CursorFlags = {}));
238
235
  const UndefinedElCoords = Object.freeze({ x1: 0, y1: 0, x2: 0, y2: 0 });
239
236
  const InitialCursorPosition = Object.freeze(new CursorPosition({ x: 1, y: 1, runningMaxX: 0, runningMaxY: 0, flags: CursorFlags.None }));
240
- class ElCtxImpl extends ObservableObject {
237
+ class RxNodeCtxImpl extends ObservableObject {
241
238
  constructor(variable, value) {
242
239
  super();
243
240
  this.next = undefined;
@@ -248,43 +245,69 @@ class ElCtxImpl extends ObservableObject {
248
245
  __decorate([
249
246
  raw,
250
247
  __metadata("design:type", Object)
251
- ], ElCtxImpl.prototype, "next", void 0);
248
+ ], RxNodeCtxImpl.prototype, "next", void 0);
252
249
  __decorate([
253
250
  raw,
254
251
  __metadata("design:type", SubTreeVariable)
255
- ], ElCtxImpl.prototype, "variable", void 0);
256
- class ElNodeImpl {
257
- constructor(key, driver, builder, self, owner) {
258
- this.maxColumnCount = 0;
259
- this.maxRowCount = 0;
252
+ ], RxNodeCtxImpl.prototype, "variable", void 0);
253
+ class RxNodeImpl {
254
+ constructor(key, driver, spec, element, owner) {
260
255
  this.key = key;
261
256
  this.driver = driver;
262
- this.builder = builder;
257
+ this.spec = spec;
263
258
  if (owner) {
264
- const node = owner.node;
259
+ const node = owner;
265
260
  this.level = node.level + 1;
266
261
  this.owner = owner;
267
262
  this.outer = node.context ? owner : node.outer;
268
263
  }
269
264
  else {
270
265
  this.level = 1;
271
- this.owner = owner = self;
272
- this.outer = self;
266
+ this.owner = owner = this;
267
+ this.outer = this;
273
268
  }
274
- this.host = self;
275
- this.children = new MergeList(getElNodeKey, true);
276
- this.ties = undefined;
269
+ this.host = this;
270
+ this.children = new MergeList(getNodeKey, true);
271
+ this.slot = undefined;
277
272
  this.stamp = Number.MAX_SAFE_INTEGER;
278
273
  this.context = undefined;
279
274
  this.numerator = 0;
280
- this.maxColumnCount = 0;
281
- this.maxRowCount = 0;
282
- this.cursorPosition = undefined;
275
+ this.priority = Priority.Realtime;
276
+ this.childrenShuffling = false;
277
+ RxNodeImpl.grandNodeCount++;
278
+ if (this.has(Mode.PinpointUpdate))
279
+ RxNodeImpl.disposableNodeCount++;
280
+ }
281
+ get isInitialUpdate() { return this.stamp === 1; }
282
+ get strictOrder() { return this.children.isStrict; }
283
+ set strictOrder(value) { this.children.isStrict = value; }
284
+ get isMoved() { return this.owner.children.isMoved(this.slot); }
285
+ has(mode) {
286
+ return (chainedMode(this.spec) & mode) === mode;
287
+ }
288
+ update(_triggers) {
289
+ updateNow(this.slot);
283
290
  }
284
291
  }
292
+ RxNodeImpl.grandNodeCount = 0;
293
+ RxNodeImpl.disposableNodeCount = 0;
294
+ __decorate([
295
+ reactive,
296
+ options({
297
+ reentrance: Reentrance.CancelPrevious,
298
+ triggeringArgs: true,
299
+ noSideEffects: false,
300
+ }),
301
+ __metadata("design:type", Function),
302
+ __metadata("design:paramtypes", [Object]),
303
+ __metadata("design:returntype", void 0)
304
+ ], RxNodeImpl.prototype, "update", null);
285
305
  class ElImpl {
286
- constructor(key, driver, owner, builder) {
287
- this.node = new ElNodeImpl(key, driver, builder, this, owner);
306
+ constructor(key, driver, owner, spec) {
307
+ this.node = new RxNodeImpl(key, driver, spec, this, owner === null || owner === void 0 ? void 0 : owner.node);
308
+ this.maxColumnCount = 0;
309
+ this.maxRowCount = 0;
310
+ this.cursorPosition = undefined;
288
311
  this.native = undefined;
289
312
  this.model = undefined;
290
313
  this.controller = undefined;
@@ -302,29 +325,14 @@ class ElImpl {
302
325
  this._contentWrapping = true;
303
326
  this._overlayVisible = undefined;
304
327
  this._hasStyles = false;
305
- this.updatePriority = Priority.Realtime;
306
- this.childrenShuffling = false;
307
- ElImpl.grandElementCount++;
308
- if (this.hasMode(Mode.PinpointUpdate))
309
- ElImpl.disposableElementCount++;
310
- }
311
- update(_triggers) {
312
- updateNow(this.node.ties);
313
328
  }
314
329
  prepareForUpdate() {
315
330
  this._area = undefined;
316
331
  this._hasStyles = false;
317
332
  }
318
- hasMode(mode) {
319
- return (chainedMode(this.node.builder) & mode) === mode;
320
- }
321
- get isInitialUpdate() { return this.node.stamp === 1; }
322
333
  get isAuxiliary() { return this.kind > ElKind.Note; }
323
334
  get isSection() { return this.kind === ElKind.Section; }
324
335
  get isTable() { return this.kind === ElKind.Table; }
325
- get isMoved() { return this.node.owner.node.children.isMoved(this.node.ties); }
326
- get strictOrder() { return this.node.children.isStrict; }
327
- set strictOrder(value) { this.node.children.isStrict = value; }
328
336
  get kind() { return this._kind; }
329
337
  set kind(value) {
330
338
  if (value !== this._kind || this.node.stamp >= Number.MAX_SAFE_INTEGER - 1) {
@@ -337,12 +345,13 @@ class ElImpl {
337
345
  var _a, _b;
338
346
  const node = this.node;
339
347
  const driver = node.driver;
340
- if (!driver.isRow) {
341
- const owner = node.owner.node;
342
- const cursorPosition = (_b = (_a = node.ties.prev) === null || _a === void 0 ? void 0 : _a.instance.node.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
343
- const newCursorPosition = node.cursorPosition = owner.children.isStrict ? new CursorPosition(cursorPosition) : undefined;
348
+ if (!driver.isSeparator) {
349
+ const owner = node.owner;
350
+ const ownerEl = owner.slot.instance;
351
+ const cursorPosition = (_b = (_a = node.slot.prev) === null || _a === void 0 ? void 0 : _a.instance.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
352
+ const newCursorPosition = this.cursorPosition = owner.children.isStrict ? new CursorPosition(cursorPosition) : undefined;
344
353
  const isCursorElement = driver instanceof CursorCommandDriver;
345
- const coords = getEffectiveElCoords(!isCursorElement, value, owner.maxColumnCount, owner.maxRowCount, cursorPosition, newCursorPosition);
354
+ const coords = getEffectiveElCoords(!isCursorElement, value, ownerEl.maxColumnCount, ownerEl.maxRowCount, cursorPosition, newCursorPosition);
346
355
  if (!equalElCoords(coords, this._coords)) {
347
356
  driver.applyCoords(this, coords);
348
357
  this._coords = coords;
@@ -427,9 +436,10 @@ class ElImpl {
427
436
  this._hasStyles = true;
428
437
  }
429
438
  configureReactronic(options) {
430
- if (this.node.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.hasMode(Mode.PinpointUpdate))
439
+ const node = this.node;
440
+ if (node.stamp < Number.MAX_SAFE_INTEGER - 1 || !node.has(Mode.PinpointUpdate))
431
441
  throw new Error("reactronic can be configured only for elements with pinpoint update mode and only inside initialize");
432
- return Rx.getReaction(this.update).configure(options);
442
+ return Rx.getReaction(node.update).configure(options);
433
443
  }
434
444
  static get curr() {
435
445
  if (!gCurrent)
@@ -439,8 +449,8 @@ class ElImpl {
439
449
  static tryUseSubTreeVariable(variable) {
440
450
  var _a, _b;
441
451
  let el = ElImpl.curr.instance;
442
- while (((_a = el.node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && el.node.owner !== el)
443
- el = el.node.outer;
452
+ while (((_a = el.node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && el.node.owner !== el.node)
453
+ el = el.node.outer.slot.instance;
444
454
  return (_b = el.node.context) === null || _b === void 0 ? void 0 : _b.value;
445
455
  }
446
456
  static useSubTreeVariableValue(variable) {
@@ -454,12 +464,12 @@ class ElImpl {
454
464
  const el = ElImpl.curr.instance;
455
465
  const node = el.node;
456
466
  const owner = node.owner;
457
- const hostCtx = unobs(() => { var _a; return (_a = owner.node.context) === null || _a === void 0 ? void 0 : _a.value; });
467
+ const hostCtx = unobs(() => { var _a; return (_a = owner.context) === null || _a === void 0 ? void 0 : _a.value; });
458
468
  if (value && value !== hostCtx) {
459
469
  if (hostCtx)
460
470
  node.outer = owner;
461
471
  else
462
- node.outer = owner.node.outer;
472
+ node.outer = owner.outer;
463
473
  Transaction.run({ separation: true }, () => {
464
474
  const ctx = node.context;
465
475
  if (ctx) {
@@ -467,38 +477,25 @@ class ElImpl {
467
477
  ctx.value = value;
468
478
  }
469
479
  else
470
- node.context = new ElCtxImpl(variable, value);
480
+ node.context = new RxNodeCtxImpl(variable, value);
471
481
  });
472
482
  }
473
483
  else if (hostCtx)
474
484
  node.outer = owner;
475
485
  else
476
- node.outer = owner.node.outer;
486
+ node.outer = owner.outer;
477
487
  }
478
488
  rowBreak() {
479
489
  var _a, _b;
480
490
  const node = this.node;
481
- const cursorPosition = (_b = (_a = node.ties.prev) === null || _a === void 0 ? void 0 : _a.instance.node.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
482
- const newCursorPosition = this.node.cursorPosition = new CursorPosition(cursorPosition);
491
+ const cursorPosition = (_b = (_a = node.slot.prev) === null || _a === void 0 ? void 0 : _a.instance.cursorPosition) !== null && _b !== void 0 ? _b : InitialCursorPosition;
492
+ const newCursorPosition = this.cursorPosition = new CursorPosition(cursorPosition);
483
493
  newCursorPosition.x = 1;
484
494
  newCursorPosition.y = newCursorPosition.runningMaxY + 1;
485
495
  }
486
496
  }
487
- ElImpl.grandElementCount = 0;
488
- ElImpl.disposableElementCount = 0;
489
497
  ElImpl.logging = undefined;
490
- __decorate([
491
- reactive,
492
- options({
493
- reentrance: Reentrance.CancelPrevious,
494
- triggeringArgs: true,
495
- noSideEffects: false,
496
- }),
497
- __metadata("design:type", Function),
498
- __metadata("design:paramtypes", [Object]),
499
- __metadata("design:returntype", void 0)
500
- ], ElImpl.prototype, "update", null);
501
- function getElNodeKey(element) {
498
+ function getNodeKey(element) {
502
499
  const node = element.node;
503
500
  return node.stamp >= 0 ? node.key : undefined;
504
501
  }
@@ -588,8 +585,8 @@ function runUpdateNestedTreesThenDo(error, action) {
588
585
  let promised = undefined;
589
586
  try {
590
587
  children.endMerge(error);
591
- for (const item of children.removedItems(true))
592
- triggerFinalization(item, true, true);
588
+ for (const slot of children.removedItems(true))
589
+ triggerFinalization(slot, true, true);
593
590
  if (!error) {
594
591
  const ownerIsSection = owner.isSection;
595
592
  const sequential = children.isStrict;
@@ -597,21 +594,21 @@ function runUpdateNestedTreesThenDo(error, action) {
597
594
  let p2 = undefined;
598
595
  let mounting = false;
599
596
  let hostingRow = owner;
600
- for (const item of children.items()) {
597
+ for (const slot of children.items()) {
601
598
  if (Transaction.isCanceled)
602
599
  break;
603
- const el = item.instance;
604
- const isRow = el.node.driver.isRow;
605
- const host = isRow ? owner : hostingRow;
606
- const p = (_a = el.updatePriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
607
- mounting = markToMountIfNecessary(mounting, host, item, children, sequential);
600
+ const el = slot.instance;
601
+ const isSeparator = el.node.driver.isSeparator;
602
+ const host = isSeparator ? owner : hostingRow;
603
+ const p = (_a = el.node.priority) !== null && _a !== void 0 ? _a : Priority.Realtime;
604
+ mounting = markToMountIfNecessary(mounting, host, slot, children, sequential);
608
605
  if (p === Priority.Realtime)
609
- triggerUpdate(item);
606
+ triggerUpdate(slot);
610
607
  else if (p === Priority.Normal)
611
- p1 = push(item, p1);
608
+ p1 = push(slot, p1);
612
609
  else
613
- p2 = push(item, p2);
614
- if (ownerIsSection && isRow)
610
+ p2 = push(slot, p2);
611
+ if (ownerIsSection && isSeparator)
615
612
  hostingRow = el;
616
613
  }
617
614
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
@@ -624,18 +621,18 @@ function runUpdateNestedTreesThenDo(error, action) {
624
621
  }
625
622
  }
626
623
  }
627
- function markToMountIfNecessary(mounting, host, ties, children, sequential) {
628
- const el = ties.instance;
624
+ function markToMountIfNecessary(mounting, host, slot, children, sequential) {
625
+ const el = slot.instance;
629
626
  const node = el.node;
630
- if (el.native && !el.hasMode(Mode.ManualMount)) {
631
- if (mounting || node.host !== host) {
632
- children.markAsMoved(ties);
627
+ if (el.native && !node.has(Mode.ManualMount)) {
628
+ if (mounting || node.host !== host.node) {
629
+ children.markAsMoved(slot);
633
630
  mounting = false;
634
631
  }
635
632
  }
636
- else if (sequential && children.isMoved(ties))
633
+ else if (sequential && children.isMoved(slot))
637
634
  mounting = true;
638
- node.host = host;
635
+ node.host = host.node;
639
636
  return mounting;
640
637
  }
641
638
  function startIncrementalUpdate(owner, allChildren, priority1, priority2) {
@@ -655,7 +652,7 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
655
652
  let outerPriority = Verstak.currentUpdatePriority;
656
653
  Verstak.currentUpdatePriority = priority;
657
654
  try {
658
- if (el.childrenShuffling)
655
+ if (el.node.childrenShuffling)
659
656
  shuffle(items);
660
657
  const frameDurationLimit = priority === Priority.Background ? Verstak.shortFrameDuration : Infinity;
661
658
  let frameDuration = Math.min(frameDurationLimit, Math.max(Verstak.frameDuration / 4, Verstak.shortFrameDuration));
@@ -678,24 +675,24 @@ function updateIncrementally(owner, stamp, allChildren, items, priority) {
678
675
  }
679
676
  });
680
677
  }
681
- function triggerUpdate(ties) {
682
- const el = ties.instance;
678
+ function triggerUpdate(slot) {
679
+ const el = slot.instance;
683
680
  const node = el.node;
684
681
  if (node.stamp >= 0) {
685
- if (el.hasMode(Mode.PinpointUpdate)) {
682
+ if (node.has(Mode.PinpointUpdate)) {
686
683
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
687
684
  Transaction.outside(() => {
688
685
  if (Rx.isLogging)
689
686
  Rx.setLoggingHint(el, node.key);
690
- Rx.getReaction(el.update).configure({
687
+ Rx.getReaction(node.update).configure({
691
688
  order: node.level,
692
689
  });
693
690
  });
694
691
  }
695
- unobs(el.update, node.builder.triggers);
692
+ unobs(node.update, node.spec.triggers);
696
693
  }
697
694
  else
698
- updateNow(ties);
695
+ updateNow(slot);
699
696
  }
700
697
  }
701
698
  function mountOrRemountIfNecessary(element) {
@@ -704,24 +701,25 @@ function mountOrRemountIfNecessary(element) {
704
701
  if (node.stamp === Number.MAX_SAFE_INTEGER) {
705
702
  node.stamp = Number.MAX_SAFE_INTEGER - 1;
706
703
  unobs(() => {
707
- driver.create(element, element);
704
+ driver.create(element);
708
705
  driver.initialize(element);
709
- if (!element.hasMode(Mode.ManualMount)) {
706
+ if (!node.has(Mode.ManualMount)) {
710
707
  node.stamp = 0;
711
- if (element.node.host !== element)
708
+ if (element.node.host !== element.node)
712
709
  driver.mount(element);
713
710
  }
711
+ node.stamp = 0;
714
712
  });
715
713
  }
716
- else if (element.isMoved && !element.hasMode(Mode.ManualMount) && element.node.host !== element)
714
+ else if (node.isMoved && !node.has(Mode.ManualMount) && element.node.host !== element.node)
717
715
  unobs(() => driver.mount(element));
718
716
  }
719
- function updateNow(ties) {
720
- const el = ties.instance;
717
+ function updateNow(slot) {
718
+ const el = slot.instance;
721
719
  const node = el.node;
722
720
  if (node.stamp >= 0) {
723
721
  let result = undefined;
724
- runInside(ties, () => {
722
+ runInside(slot, () => {
725
723
  mountOrRemountIfNecessary(el);
726
724
  if (node.stamp < Number.MAX_SAFE_INTEGER - 1) {
727
725
  try {
@@ -731,7 +729,7 @@ function updateNow(ties) {
731
729
  node.children.beginMerge();
732
730
  const driver = node.driver;
733
731
  result = driver.update(el);
734
- if (el.area === undefined && node.owner.isTable)
732
+ if (el.area === undefined && node.owner.slot.instance.isTable)
735
733
  el.area = undefined;
736
734
  if (result instanceof Promise)
737
735
  result.then(v => { runUpdateNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runUpdateNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
@@ -747,44 +745,44 @@ function updateNow(ties) {
747
745
  });
748
746
  }
749
747
  }
750
- function triggerFinalization(ties, isLeader, individual) {
751
- const el = ties.instance;
748
+ function triggerFinalization(slot, isLeader, individual) {
749
+ const el = slot.instance;
752
750
  const node = el.node;
753
751
  if (node.stamp >= 0) {
754
752
  const driver = node.driver;
755
- if (individual && node.key !== node.builder.key && !driver.isRow)
753
+ if (individual && node.key !== node.spec.key && !driver.isSeparator)
756
754
  console.log(`WARNING: it is recommended to assign explicit key for conditional element in order to avoid unexpected side effects: ${node.key}`);
757
755
  node.stamp = ~node.stamp;
758
756
  const childrenAreLeaders = unobs(() => driver.finalize(el, isLeader));
759
757
  el.native = null;
760
758
  el.controller = null;
761
- if (el.hasMode(Mode.PinpointUpdate)) {
762
- ties.aux = undefined;
759
+ if (node.has(Mode.PinpointUpdate)) {
760
+ slot.aux = undefined;
763
761
  const last = gLastToDispose;
764
762
  if (last)
765
- gLastToDispose = last.aux = ties;
763
+ gLastToDispose = last.aux = slot;
766
764
  else
767
- gFirstToDispose = gLastToDispose = ties;
768
- if (gFirstToDispose === ties)
769
- Transaction.run({ separation: "disposal", hint: `runDisposalLoop(initiator=${ties.instance.node.key})` }, () => {
765
+ gFirstToDispose = gLastToDispose = slot;
766
+ if (gFirstToDispose === slot)
767
+ Transaction.run({ separation: "disposal", hint: `runDisposalLoop(initiator=${slot.instance.node.key})` }, () => {
770
768
  void runDisposalLoop().then(NOP, error => console.log(error));
771
769
  });
772
770
  }
773
- for (const item of node.children.items())
774
- triggerFinalization(item, childrenAreLeaders, false);
775
- ElImpl.grandElementCount--;
771
+ for (const slot of node.children.items())
772
+ triggerFinalization(slot, childrenAreLeaders, false);
773
+ RxNodeImpl.grandNodeCount--;
776
774
  }
777
775
  }
778
776
  function runDisposalLoop() {
779
777
  return __awaiter(this, void 0, void 0, function* () {
780
778
  yield Transaction.requestNextFrame();
781
- let item = gFirstToDispose;
782
- while (item !== undefined) {
779
+ let slot = gFirstToDispose;
780
+ while (slot !== undefined) {
783
781
  if (Transaction.isFrameOver(500, 5))
784
782
  yield Transaction.requestNextFrame();
785
- Rx.dispose(item.instance);
786
- item = item.aux;
787
- ElImpl.disposableElementCount--;
783
+ Rx.dispose(slot.instance);
784
+ slot = slot.aux;
785
+ RxNodeImpl.disposableNodeCount--;
788
786
  }
789
787
  gFirstToDispose = gLastToDispose = undefined;
790
788
  });
@@ -800,10 +798,10 @@ function wrapToRunInside(func) {
800
798
  wrappedToRunInside = func;
801
799
  return wrappedToRunInside;
802
800
  }
803
- function runInside(ties, func, ...args) {
801
+ function runInside(slot, func, ...args) {
804
802
  const outer = gCurrent;
805
803
  try {
806
- gCurrent = ties;
804
+ gCurrent = slot;
807
805
  return func(...args);
808
806
  }
809
807
  finally {
@@ -1,14 +1,14 @@
1
- import { El, ElKind, ElBuilder, Align, ElCoords, ElArea } from "../core/api.js";
1
+ import { El, ElKind, RxNodeSpec, Align, ElCoords, ElArea } from "../core/api.js";
2
2
  import { HtmlDriver } from "./HtmlDriver.js";
3
- export declare function Section<M = unknown, R = void>(builder?: ElBuilder<HTMLElement, M, R>, base?: ElBuilder<HTMLElement, M, R>): El<HTMLElement, M, R>;
4
- export declare function Table<M = unknown, R = void>(builder?: ElBuilder<HTMLElement, M, R>, base?: ElBuilder<HTMLElement, M, R>): El<HTMLElement, M, R>;
3
+ export declare function Section<M = unknown, R = void>(spec?: RxNodeSpec<El<HTMLElement, M, R>>, base?: RxNodeSpec<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
4
+ export declare function Table<M = unknown, R = void>(spec?: RxNodeSpec<El<HTMLElement, M, R>>, base?: RxNodeSpec<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
5
5
  export declare function row<T = void>(builder?: (element: void) => T, shiftCursorDown?: number): void;
6
6
  export declare function startNewRow(shiftCursorDown?: number): void;
7
7
  export declare function cursor(areaParams: ElArea): void;
8
- export declare function Note(content: string, builder?: ElBuilder<HTMLElement, void, void>): El<HTMLElement, void, void>;
9
- export declare function HtmlNote(content: string, builder?: ElBuilder<HTMLElement, void, void>): El<HTMLElement, void, void>;
10
- export declare function Group<M = unknown, R = void>(builder?: ElBuilder<HTMLElement, M, R>, base?: ElBuilder<HTMLElement, M, R>): El<HTMLElement, M, R>;
11
- export declare function Fragment<M = unknown, R = void>(builder?: ElBuilder<void, M, R>, base?: ElBuilder<void, M, R>): El<void, M, R>;
8
+ export declare function Note(content: string, spec?: RxNodeSpec<El<HTMLElement, void, void>>): El<HTMLElement, void, void>;
9
+ export declare function HtmlNote(content: string, spec?: RxNodeSpec<El<HTMLElement, void, void>>): El<HTMLElement, void, void>;
10
+ export declare function Group<M = unknown, R = void>(spec?: RxNodeSpec<El<HTMLElement, M, R>>, base?: RxNodeSpec<El<HTMLElement, M, R>>): El<HTMLElement, M, R>;
11
+ export declare function Fragment<M = unknown, R = void>(spec?: RxNodeSpec<El<void, M, R>>, base?: RxNodeSpec<El<void, M, R>>): El<void, M, R>;
12
12
  export declare class VerstakHtmlDriver<T extends HTMLElement> extends HtmlDriver<T> {
13
13
  applyKind(element: El<T, any, any>, value: ElKind): void;
14
14
  applyCoords(element: El<T>, value: ElCoords | undefined): void;