verstak 0.23.120 → 0.23.121

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.
@@ -31,10 +31,10 @@ export interface Block<T = unknown, M = unknown, C = unknown, R = void> {
31
31
  blockAlignment: Align;
32
32
  contentWrapping: boolean;
33
33
  overlayVisible: boolean | undefined;
34
- rebuildPriority?: Priority;
34
+ updatePriority?: Priority;
35
35
  childrenShuffling: boolean;
36
36
  strictOrder: boolean;
37
- readonly isInitialRebuild: boolean;
37
+ readonly isInitialUpdate: boolean;
38
38
  useStyle(styleName: string, enabled?: boolean): void;
39
39
  configureReactronic(options: Partial<MemberOptions>): MemberOptions;
40
40
  }
@@ -59,7 +59,7 @@ export interface BlockBuilder<T = unknown, M = unknown, C = unknown, R = void> {
59
59
  claim?: Delegate<T, M, C, R>;
60
60
  create?: Delegate<T, M, C, R>;
61
61
  initialize?: Delegate<T, M, C, R>;
62
- rebuild?: Delegate<T, M, C, R>;
62
+ update?: Delegate<T, M, C, R>;
63
63
  finalize?: Delegate<T, M, C, R>;
64
64
  }
65
65
  export interface BlockCtx<T extends Object = Object> {
@@ -76,7 +76,7 @@ export interface Driver<T, C = unknown> {
76
76
  }): void;
77
77
  initialize(block: Block<T, unknown, C>): void;
78
78
  mount(block: Block<T, unknown, C>): void;
79
- rebuild(block: Block<T, unknown, C>): void | Promise<void>;
79
+ update(block: Block<T, unknown, C>): void | Promise<void>;
80
80
  finalize(block: Block<T, unknown, C>, isLeader: boolean): boolean;
81
81
  applyKind(block: Block<T, any, C, any>, value: BlockKind): void;
82
82
  applyCoords(block: Block<T, any, C, any>, value: BlockCoords | undefined): void;
@@ -105,7 +105,7 @@ export declare const enum Priority {
105
105
  }
106
106
  export declare enum Mode {
107
107
  Default = 0,
108
- PinpointRebuild = 1,
108
+ PinpointUpdate = 1,
109
109
  ManualMount = 2
110
110
  }
111
111
  export declare enum Align {
@@ -17,7 +17,7 @@ export var Priority;
17
17
  export var Mode;
18
18
  (function (Mode) {
19
19
  Mode[Mode["Default"] = 0] = "Default";
20
- Mode[Mode["PinpointRebuild"] = 1] = "PinpointRebuild";
20
+ Mode[Mode["PinpointUpdate"] = 1] = "PinpointUpdate";
21
21
  Mode[Mode["ManualMount"] = 2] = "ManualMount";
22
22
  })(Mode || (Mode = {}));
23
23
  export var Align;
@@ -187,7 +187,7 @@ export function getCallerInfo(prefix) {
187
187
  i = i >= 0 ? i + 2 : 5;
188
188
  let caller = extractFunctionAndLocation(lines[i]);
189
189
  let location = caller;
190
- if (caller.func.endsWith(".rebuild")) {
190
+ if (caller.func.endsWith(".update")) {
191
191
  i = i - 1;
192
192
  caller = extractFunctionAndLocation(lines[i]);
193
193
  location = extractFunctionAndLocation(lines[i + 1]);
@@ -3,12 +3,12 @@ import { BlockCoords, BlockKind, Priority, Align, BlockBuilder, Block, Driver, S
3
3
  export declare class Verstak {
4
4
  static readonly shortFrameDuration = 16;
5
5
  static readonly longFrameDuration = 300;
6
- static currentRebuildPriority: Priority;
6
+ static currentUpdatePriority: Priority;
7
7
  static frameDuration: number;
8
8
  static claim<T = undefined, M = unknown, C = unknown, R = void>(driver: Driver<T>, builder?: BlockBuilder<T, M, C, R>, base?: BlockBuilder<T, M, C, R>): Block<T, M, C, R>;
9
9
  static get block(): Block;
10
- static triggerRebuild(block: Block<any, any, any, void>, triggers: unknown): void;
11
- static rebuildNestedTreesThenDo(action: (error: unknown) => void): void;
10
+ static triggerUpdate(block: Block<any, any, any, void>, triggers: unknown): void;
11
+ static updateNestedTreesThenDo(action: (error: unknown) => void): void;
12
12
  static getDefaultLoggingOptions(): LoggingOptions | undefined;
13
13
  static setDefaultLoggingOptions(logging?: LoggingOptions): void;
14
14
  }
@@ -25,7 +25,7 @@ export declare class BaseDriver<T, C = unknown> implements Driver<T, C> {
25
25
  }): void;
26
26
  initialize(block: Block<T, unknown, C>): void;
27
27
  mount(block: Block<T, unknown, C>): void;
28
- rebuild(block: Block<T, unknown, C>): void | Promise<void>;
28
+ update(block: Block<T, unknown, C>): void | Promise<void>;
29
29
  finalize(block: Block<T, unknown, C>, isLeader: boolean): boolean;
30
30
  applyKind(block: Block<T, any, C, any>, value: BlockKind): void;
31
31
  applyCoords(block: Block<T, any, C, any>, value: BlockCoords | undefined): void;
@@ -37,7 +37,7 @@ export class Verstak {
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 blocks can be declared inside rebuild function only"));
40
+ ex !== null && ex !== void 0 ? ex : (ex = children.claim(key = key || generateKey(owner), undefined, "nested blocks can be declared inside update function only"));
41
41
  if (ex) {
42
42
  result = ex.instance;
43
43
  const node = result.node;
@@ -56,7 +56,7 @@ export class Verstak {
56
56
  else {
57
57
  result = new BlockImpl(key || "", driver, owner, builder);
58
58
  result.node.ties = MergeList.createItem(result);
59
- triggerRebuild(result.node.ties);
59
+ triggerUpdate(result.node.ties);
60
60
  }
61
61
  return result;
62
62
  }
@@ -65,16 +65,16 @@ export class Verstak {
65
65
  throw new Error("current block is undefined");
66
66
  return gCurrent.instance;
67
67
  }
68
- static triggerRebuild(block, triggers) {
68
+ static triggerUpdate(block, triggers) {
69
69
  const b = block;
70
70
  const builder = b.node.builder;
71
71
  if (!triggersAreEqual(triggers, builder.triggers)) {
72
72
  builder.triggers = triggers;
73
- triggerRebuild(b.node.ties);
73
+ triggerUpdate(b.node.ties);
74
74
  }
75
75
  }
76
- static rebuildNestedTreesThenDo(action) {
77
- runRebuildNestedTreesThenDo(undefined, action);
76
+ static updateNestedTreesThenDo(action) {
77
+ runUpdateNestedTreesThenDo(undefined, action);
78
78
  }
79
79
  static getDefaultLoggingOptions() {
80
80
  return BlockImpl.logging;
@@ -85,7 +85,7 @@ export class Verstak {
85
85
  }
86
86
  Verstak.shortFrameDuration = 16;
87
87
  Verstak.longFrameDuration = 300;
88
- Verstak.currentRebuildPriority = Priority.Realtime;
88
+ Verstak.currentUpdatePriority = Priority.Realtime;
89
89
  Verstak.frameDuration = Verstak.longFrameDuration;
90
90
  export class BaseDriver {
91
91
  constructor(name, isRow, preset) {
@@ -108,8 +108,8 @@ export class BaseDriver {
108
108
  }
109
109
  mount(block) {
110
110
  }
111
- rebuild(block) {
112
- chainedRebuild(block, block.node.builder);
111
+ update(block) {
112
+ chainedUpdated(block, block.node.builder);
113
113
  }
114
114
  finalize(block, isLeader) {
115
115
  const b = block;
@@ -169,13 +169,13 @@ function chainedInitialize(block, bb) {
169
169
  else if (base)
170
170
  chainedInitialize(block, base);
171
171
  }
172
- function chainedRebuild(block, bb) {
173
- const rebuild = bb.rebuild;
172
+ function chainedUpdated(block, bb) {
173
+ const update = bb.update;
174
174
  const base = bb.base;
175
- if (rebuild)
176
- rebuild(block, base ? () => chainedRebuild(block, base) : NOP);
175
+ if (update)
176
+ update(block, base ? () => chainedUpdated(block, base) : NOP);
177
177
  else if (base)
178
- chainedRebuild(block, base);
178
+ chainedUpdated(block, base);
179
179
  }
180
180
  function chainedFinalize(block, bb) {
181
181
  const finalize = bb.finalize;
@@ -302,23 +302,23 @@ class BlockImpl {
302
302
  this._contentWrapping = true;
303
303
  this._overlayVisible = undefined;
304
304
  this._hasStyles = false;
305
- this.rebuildPriority = Priority.Realtime;
305
+ this.updatePriority = Priority.Realtime;
306
306
  this.childrenShuffling = false;
307
307
  BlockImpl.grandBlockCount++;
308
- if (this.isOn(Mode.PinpointRebuild))
308
+ if (this.isOn(Mode.PinpointUpdate))
309
309
  BlockImpl.disposableBlockCount++;
310
310
  }
311
- rebuild(_triggers) {
312
- rebuildNow(this.node.ties);
311
+ update(_triggers) {
312
+ updateNow(this.node.ties);
313
313
  }
314
- prepareForRebuild() {
314
+ prepareForUpdate() {
315
315
  this._area = undefined;
316
316
  this._hasStyles = false;
317
317
  }
318
318
  isOn(mode) {
319
319
  return (chainedMode(this.node.builder) & mode) === mode;
320
320
  }
321
- get isInitialRebuild() { return this.node.stamp === 2; }
321
+ get isInitialUpdate() { return this.node.stamp === 2; }
322
322
  get isAuxiliary() { return this.kind > BlockKind.Note; }
323
323
  get isSection() { return this.kind === BlockKind.Section; }
324
324
  get isTable() { return this.kind === BlockKind.Table; }
@@ -428,9 +428,9 @@ class BlockImpl {
428
428
  this._hasStyles = true;
429
429
  }
430
430
  configureReactronic(options) {
431
- if (this.node.stamp !== 1 || !this.isOn(Mode.PinpointRebuild))
431
+ if (this.node.stamp !== 1 || !this.isOn(Mode.PinpointUpdate))
432
432
  throw new Error("reactronic can be configured only for blocks with separate reaction mode and only inside initialize");
433
- return Rx.getReaction(this.rebuild).configure(options);
433
+ return Rx.getReaction(this.update).configure(options);
434
434
  }
435
435
  static get curr() {
436
436
  if (!gCurrent)
@@ -498,7 +498,7 @@ __decorate([
498
498
  __metadata("design:type", Function),
499
499
  __metadata("design:paramtypes", [Object]),
500
500
  __metadata("design:returntype", void 0)
501
- ], BlockImpl.prototype, "rebuild", null);
501
+ ], BlockImpl.prototype, "update", null);
502
502
  function getBlockKey(block) {
503
503
  const node = block.node;
504
504
  return node.stamp >= 0 ? node.key : undefined;
@@ -580,7 +580,7 @@ function getEffectiveBlockCoords(isRegularBlock, area, maxX, maxY, cursorPositio
580
580
  throw new Error("relative layout requires sequential children");
581
581
  return result;
582
582
  }
583
- function runRebuildNestedTreesThenDo(error, action) {
583
+ function runUpdateNestedTreesThenDo(error, action) {
584
584
  var _a;
585
585
  const curr = BlockImpl.curr;
586
586
  const owner = curr.instance;
@@ -604,10 +604,10 @@ function runRebuildNestedTreesThenDo(error, action) {
604
604
  const block = item.instance;
605
605
  const isRow = block.node.driver.isRow;
606
606
  const host = isRow ? owner : hostingRow;
607
- const p = (_a = block.rebuildPriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
607
+ const p = (_a = block.updatePriority) !== null && _a !== void 0 ? _a : Priority.Realtime;
608
608
  mounting = markToMountIfNecessary(mounting, host, item, children, sequential);
609
609
  if (p === Priority.Realtime)
610
- triggerRebuild(item);
610
+ triggerUpdate(item);
611
611
  else if (p === Priority.Normal)
612
612
  p1 = push(item, p1);
613
613
  else
@@ -616,7 +616,7 @@ function runRebuildNestedTreesThenDo(error, action) {
616
616
  hostingRow = block;
617
617
  }
618
618
  if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
619
- promised = startIncrementalRebuild(curr, children, p1, p2).then(() => action(error), e => action(e));
619
+ promised = startIncrementalUpdate(curr, children, p1, p2).then(() => action(error), e => action(e));
620
620
  }
621
621
  }
622
622
  finally {
@@ -639,34 +639,34 @@ function markToMountIfNecessary(mounting, host, ties, children, sequential) {
639
639
  node.host = host;
640
640
  return mounting;
641
641
  }
642
- function startIncrementalRebuild(owner, allChildren, priority1, priority2) {
642
+ function startIncrementalUpdate(owner, allChildren, priority1, priority2) {
643
643
  return __awaiter(this, void 0, void 0, function* () {
644
644
  const stamp = owner.instance.node.stamp;
645
645
  if (priority1)
646
- yield rebuildIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
646
+ yield updateIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
647
647
  if (priority2)
648
- yield rebuildIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
648
+ yield updateIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
649
649
  });
650
650
  }
651
- function rebuildIncrementally(owner, stamp, allChildren, items, priority) {
651
+ function updateIncrementally(owner, stamp, allChildren, items, priority) {
652
652
  return __awaiter(this, void 0, void 0, function* () {
653
653
  yield Transaction.requestNextFrame();
654
654
  const block = owner.instance;
655
655
  if (!Transaction.isCanceled || !Transaction.isFrameOver(1, Verstak.shortFrameDuration / 3)) {
656
- let outerPriority = Verstak.currentRebuildPriority;
657
- Verstak.currentRebuildPriority = priority;
656
+ let outerPriority = Verstak.currentUpdatePriority;
657
+ Verstak.currentUpdatePriority = priority;
658
658
  try {
659
659
  if (block.childrenShuffling)
660
660
  shuffle(items);
661
661
  const frameDurationLimit = priority === Priority.Background ? Verstak.shortFrameDuration : Infinity;
662
662
  let frameDuration = Math.min(frameDurationLimit, Math.max(Verstak.frameDuration / 4, Verstak.shortFrameDuration));
663
663
  for (const child of items) {
664
- triggerRebuild(child);
664
+ triggerUpdate(child);
665
665
  if (Transaction.isFrameOver(1, frameDuration)) {
666
- Verstak.currentRebuildPriority = outerPriority;
666
+ Verstak.currentUpdatePriority = outerPriority;
667
667
  yield Transaction.requestNextFrame(0);
668
- outerPriority = Verstak.currentRebuildPriority;
669
- Verstak.currentRebuildPriority = priority;
668
+ outerPriority = Verstak.currentUpdatePriority;
669
+ Verstak.currentUpdatePriority = priority;
670
670
  frameDuration = Math.min(4 * frameDuration, Math.min(frameDurationLimit, Verstak.frameDuration));
671
671
  }
672
672
  if (Transaction.isCanceled && Transaction.isFrameOver(1, Verstak.shortFrameDuration / 3))
@@ -674,29 +674,29 @@ function rebuildIncrementally(owner, stamp, allChildren, items, priority) {
674
674
  }
675
675
  }
676
676
  finally {
677
- Verstak.currentRebuildPriority = outerPriority;
677
+ Verstak.currentUpdatePriority = outerPriority;
678
678
  }
679
679
  }
680
680
  });
681
681
  }
682
- function triggerRebuild(ties) {
682
+ function triggerUpdate(ties) {
683
683
  const b = ties.instance;
684
684
  const node = b.node;
685
685
  if (node.stamp >= 0) {
686
- if (b.isOn(Mode.PinpointRebuild)) {
686
+ if (b.isOn(Mode.PinpointUpdate)) {
687
687
  if (node.stamp === 0) {
688
688
  Transaction.outside(() => {
689
689
  if (Rx.isLogging)
690
690
  Rx.setLoggingHint(b, node.key);
691
- Rx.getReaction(b.rebuild).configure({
691
+ Rx.getReaction(b.update).configure({
692
692
  order: node.level,
693
693
  });
694
694
  });
695
695
  }
696
- unobs(b.rebuild, node.builder.triggers);
696
+ unobs(b.update, node.builder.triggers);
697
697
  }
698
698
  else
699
- rebuildNow(ties);
699
+ updateNow(ties);
700
700
  }
701
701
  }
702
702
  function mountIfNecessary(block) {
@@ -714,7 +714,7 @@ function mountIfNecessary(block) {
714
714
  else if (block.isMoved && block.isAutoMountEnabled)
715
715
  unobs(() => driver.mount(block));
716
716
  }
717
- function rebuildNow(ties) {
717
+ function updateNow(ties) {
718
718
  const b = ties.instance;
719
719
  const node = b.node;
720
720
  if (node.stamp >= 0) {
@@ -724,20 +724,20 @@ function rebuildNow(ties) {
724
724
  mountIfNecessary(b);
725
725
  node.stamp++;
726
726
  node.numerator = 0;
727
- b.prepareForRebuild();
727
+ b.prepareForUpdate();
728
728
  node.children.beginMerge();
729
729
  const driver = node.driver;
730
- result = driver.rebuild(b);
730
+ result = driver.update(b);
731
731
  if (b.area === undefined && node.owner.isTable)
732
732
  b.area = undefined;
733
733
  if (result instanceof Promise)
734
- result.then(v => { runRebuildNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runRebuildNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
734
+ result.then(v => { runUpdateNestedTreesThenDo(undefined, NOP); return v; }, e => { console.log(e); runUpdateNestedTreesThenDo(e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
735
735
  else
736
- runRebuildNestedTreesThenDo(undefined, NOP);
736
+ runUpdateNestedTreesThenDo(undefined, NOP);
737
737
  }
738
738
  catch (e) {
739
- runRebuildNestedTreesThenDo(e, NOP);
740
- console.log(`Rebuild failed: ${node.key}`);
739
+ runUpdateNestedTreesThenDo(e, NOP);
740
+ console.log(`Update failed: ${node.key}`);
741
741
  console.log(`${e}`);
742
742
  }
743
743
  });
@@ -754,7 +754,7 @@ function triggerFinalization(ties, isLeader, individual) {
754
754
  const childrenAreLeaders = unobs(() => driver.finalize(b, isLeader));
755
755
  b.native = null;
756
756
  b.controller = null;
757
- if (b.isOn(Mode.PinpointRebuild)) {
757
+ if (b.isOn(Mode.PinpointUpdate)) {
758
758
  ties.aux = undefined;
759
759
  const last = gLastToDispose;
760
760
  if (last)
@@ -23,5 +23,5 @@ export declare class VerstakHtmlDriver<T extends HTMLElement> extends HtmlDriver
23
23
  applyContentWrapping(block: Block<T>, value: boolean): void;
24
24
  applyOverlayVisible(block: Block<T>, value: boolean | undefined): void;
25
25
  applyStyle(block: Block<T, any, any>, secondary: boolean, styleName: string, enabled?: boolean): void;
26
- rebuild(block: Block<T>): void | Promise<void>;
26
+ update(block: Block<T>): void | Promise<void>;
27
27
  }
@@ -15,21 +15,21 @@ export function startNewRow(shiftCursorDown) {
15
15
  }
16
16
  export function cursor(areaParams) {
17
17
  Verstak.claim(Drivers.cursor, {
18
- rebuild(b) {
18
+ update(b) {
19
19
  b.area = areaParams;
20
20
  },
21
21
  });
22
22
  }
23
23
  export function Note(content, builder) {
24
24
  return Verstak.claim(Drivers.note, builder, {
25
- rebuild(b) {
25
+ update(b) {
26
26
  b.native.innerText = content;
27
27
  }
28
28
  });
29
29
  }
30
30
  export function HtmlNote(content, builder) {
31
31
  return Verstak.claim(Drivers.note, builder, {
32
- rebuild(b) {
32
+ update(b) {
33
33
  b.native.innerHTML = content;
34
34
  }
35
35
  });
@@ -177,10 +177,10 @@ export class VerstakHtmlDriver extends HtmlDriver {
177
177
  else
178
178
  e.className = enabled ? styleName : "";
179
179
  }
180
- rebuild(block) {
180
+ update(block) {
181
181
  if (block.kind <= BlockKind.Table)
182
182
  startNewRow();
183
- return super.rebuild(block);
183
+ return super.update(block);
184
184
  }
185
185
  }
186
186
  const Constants = {
@@ -9,7 +9,7 @@ export declare abstract class BaseHtmlDriver<T extends Element, C = unknown> ext
9
9
  finalize(block: Block<T, unknown, C>, isLeader: boolean): boolean;
10
10
  mount(block: Block<T, unknown, C>): void;
11
11
  relocate(block: Block<T, unknown, C>): void;
12
- rebuild(block: Block<T, unknown, C>): void | Promise<void>;
12
+ update(block: Block<T, unknown, C>): void | Promise<void>;
13
13
  static get blinkingEffectMarker(): string | undefined;
14
14
  static set blinkingEffectMarker(value: string | undefined);
15
15
  static findEffectiveHtmlBlockHost(block: Block<any>): Block<HTMLElement | SVGElement>;
@@ -48,10 +48,10 @@ export class BaseHtmlDriver extends BaseDriver {
48
48
  }
49
49
  relocate(block) {
50
50
  }
51
- rebuild(block) {
52
- const result = super.rebuild(block);
51
+ update(block) {
52
+ const result = super.update(block);
53
53
  if (gBlinkingEffectMarker)
54
- blink(block.native, Verstak.currentRebuildPriority, block.node.stamp);
54
+ blink(block.native, Verstak.currentUpdatePriority, block.node.stamp);
55
55
  return result;
56
56
  }
57
57
  static get blinkingEffectMarker() {
@@ -3,12 +3,12 @@ import { Fragment } from "./Blocks.js";
3
3
  export function FocuserReaction(key, target, model, switchEditMode = undefined) {
4
4
  Fragment({
5
5
  key,
6
- mode: Mode.PinpointRebuild,
6
+ mode: Mode.PinpointUpdate,
7
7
  triggers: { target, model },
8
8
  initialize(b) {
9
9
  b.configureReactronic({ throttling: 0 });
10
10
  },
11
- rebuild() {
11
+ update() {
12
12
  if (switchEditMode !== undefined) {
13
13
  switchEditMode(model);
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verstak",
3
- "version": "0.23.120",
3
+ "version": "0.23.121",
4
4
  "description": "Verstak - Front-End Library",
5
5
  "publisher": "Nezaboodka Software",
6
6
  "license": "Apache-2.0",