verstak 0.23.111 → 0.23.112
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/core/Interfaces.d.ts +7 -7
- package/build/dist/source/core/Interfaces.js +2 -2
- package/build/dist/source/core/Utils.js +1 -1
- package/build/dist/source/core/Verstak.d.ts +4 -4
- package/build/dist/source/core/Verstak.js +55 -55
- package/build/dist/source/html/Blocks.d.ts +2 -2
- package/build/dist/source/html/Blocks.js +9 -9
- package/build/dist/source/html/HtmlBlocks.js +1 -1
- package/build/dist/source/html/HtmlDriver.d.ts +1 -1
- package/build/dist/source/html/HtmlDriver.js +3 -3
- package/build/dist/source/html/ReactingFocuser.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ export type Delegate<T = unknown, M = unknown, C = unknown, R = void> = (block:
|
|
|
4
4
|
export type AsyncDelegate<T = unknown, M = unknown> = (block: Block<T, M, Promise<void>>) => Promise<void>;
|
|
5
5
|
export type SimpleDelegate<T = unknown> = (block: Block<T, any, any, any>) => void;
|
|
6
6
|
export declare enum BlockKind {
|
|
7
|
-
|
|
7
|
+
Section = 0,
|
|
8
8
|
Table = 1,
|
|
9
9
|
Note = 2,
|
|
10
10
|
Group = 3,
|
|
@@ -15,7 +15,7 @@ export declare enum BlockKind {
|
|
|
15
15
|
export interface Block<T = unknown, M = unknown, C = unknown, R = void> {
|
|
16
16
|
readonly node: BlockNode<T, M, C, R>;
|
|
17
17
|
readonly native: T;
|
|
18
|
-
readonly
|
|
18
|
+
readonly isSection: boolean;
|
|
19
19
|
readonly isTable: boolean;
|
|
20
20
|
model: M;
|
|
21
21
|
controller: C;
|
|
@@ -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
|
-
|
|
34
|
+
updatePriority?: Priority;
|
|
35
35
|
childrenShuffling: boolean;
|
|
36
36
|
strictOrder: boolean;
|
|
37
|
-
readonly
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
108
|
+
PinpointUpdate = 1,
|
|
109
109
|
ManualMount = 2
|
|
110
110
|
}
|
|
111
111
|
export declare enum Align {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var BlockKind;
|
|
2
2
|
(function (BlockKind) {
|
|
3
|
-
BlockKind[BlockKind["
|
|
3
|
+
BlockKind[BlockKind["Section"] = 0] = "Section";
|
|
4
4
|
BlockKind[BlockKind["Table"] = 1] = "Table";
|
|
5
5
|
BlockKind[BlockKind["Note"] = 2] = "Note";
|
|
6
6
|
BlockKind[BlockKind["Group"] = 3] = "Group";
|
|
@@ -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["
|
|
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(".
|
|
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
|
|
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
|
|
11
|
-
static
|
|
10
|
+
static triggerUpdate(block: Block<any, any, any, void>, triggers: unknown): void;
|
|
11
|
+
static updatedNestedTreesThenDo(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
|
-
|
|
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
|
|
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 = Collection.createItem(result);
|
|
59
|
-
|
|
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
|
|
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
|
-
|
|
73
|
+
triggerUpdate(b.node.ties);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
static
|
|
77
|
-
|
|
76
|
+
static updatedNestedTreesThenDo(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.
|
|
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
|
-
|
|
112
|
-
|
|
111
|
+
update(block) {
|
|
112
|
+
chainedUpdate(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
|
|
173
|
-
const
|
|
172
|
+
function chainedUpdate(block, bb) {
|
|
173
|
+
const update = bb.update;
|
|
174
174
|
const base = bb.base;
|
|
175
|
-
if (
|
|
176
|
-
|
|
175
|
+
if (update)
|
|
176
|
+
update(block, base ? () => chainedUpdate(block, base) : NOP);
|
|
177
177
|
else if (base)
|
|
178
|
-
|
|
178
|
+
chainedUpdate(block, base);
|
|
179
179
|
}
|
|
180
180
|
function chainedFinalize(block, bb) {
|
|
181
181
|
const finalize = bb.finalize;
|
|
@@ -302,25 +302,25 @@ class BlockImpl {
|
|
|
302
302
|
this._contentWrapping = true;
|
|
303
303
|
this._overlayVisible = undefined;
|
|
304
304
|
this._hasStyles = false;
|
|
305
|
-
this.
|
|
305
|
+
this.updatePriority = Priority.Realtime;
|
|
306
306
|
this.childrenShuffling = false;
|
|
307
307
|
BlockImpl.grandBlockCount++;
|
|
308
|
-
if (this.isOn(Mode.
|
|
308
|
+
if (this.isOn(Mode.PinpointUpdate))
|
|
309
309
|
BlockImpl.disposableBlockCount++;
|
|
310
310
|
}
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
update(_triggers) {
|
|
312
|
+
updateNow(this.node.ties);
|
|
313
313
|
}
|
|
314
|
-
|
|
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
|
|
321
|
+
get isInitialUpdate() { return this.node.stamp === 2; }
|
|
322
322
|
get isAuxiliary() { return this.kind > BlockKind.Note; }
|
|
323
|
-
get
|
|
323
|
+
get isSection() { return this.kind === BlockKind.Section; }
|
|
324
324
|
get isTable() { return this.kind === BlockKind.Table; }
|
|
325
325
|
get isAutoMountEnabled() { return !this.isOn(Mode.ManualMount) && this.node.host !== this; }
|
|
326
326
|
get isMoved() { return this.node.owner.node.children.isMoved(this.node.ties); }
|
|
@@ -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.
|
|
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.getController(this.
|
|
433
|
+
return Rx.getController(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, "
|
|
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
|
|
583
|
+
function runUpdateNestedTreesThenDo(error, action) {
|
|
584
584
|
var _a;
|
|
585
585
|
const curr = BlockImpl.curr;
|
|
586
586
|
const owner = curr.instance;
|
|
@@ -592,7 +592,7 @@ function runRenderNestedTreesThenDo(error, action) {
|
|
|
592
592
|
for (const item of children.removedItems(true))
|
|
593
593
|
triggerFinalization(item, true, true);
|
|
594
594
|
if (!error) {
|
|
595
|
-
const
|
|
595
|
+
const ownerIsSection = owner.isSection;
|
|
596
596
|
const sequential = children.isStrict;
|
|
597
597
|
let p1 = undefined;
|
|
598
598
|
let p2 = undefined;
|
|
@@ -604,19 +604,19 @@ function runRenderNestedTreesThenDo(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.
|
|
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
|
-
|
|
610
|
+
triggerUpdate(item);
|
|
611
611
|
else if (p === Priority.Normal)
|
|
612
612
|
p1 = push(item, p1);
|
|
613
613
|
else
|
|
614
614
|
p2 = push(item, p2);
|
|
615
|
-
if (
|
|
615
|
+
if (ownerIsSection && isRow)
|
|
616
616
|
hostingRow = block;
|
|
617
617
|
}
|
|
618
618
|
if (!Transaction.isCanceled && (p1 !== undefined || p2 !== undefined))
|
|
619
|
-
promised =
|
|
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
|
|
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
|
|
646
|
+
yield updateIncrementally(owner, stamp, allChildren, priority1, Priority.Normal);
|
|
647
647
|
if (priority2)
|
|
648
|
-
yield
|
|
648
|
+
yield updateIncrementally(owner, stamp, allChildren, priority2, Priority.Background);
|
|
649
649
|
});
|
|
650
650
|
}
|
|
651
|
-
function
|
|
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.
|
|
657
|
-
Verstak.
|
|
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
|
-
|
|
664
|
+
triggerUpdate(child);
|
|
665
665
|
if (Transaction.isFrameOver(1, frameDuration)) {
|
|
666
|
-
Verstak.
|
|
666
|
+
Verstak.currentUpdatePriority = outerPriority;
|
|
667
667
|
yield Transaction.requestNextFrame(0);
|
|
668
|
-
outerPriority = Verstak.
|
|
669
|
-
Verstak.
|
|
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 renderIncrementally(owner, stamp, allChildren, items, priority) {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
finally {
|
|
677
|
-
Verstak.
|
|
677
|
+
Verstak.currentUpdatePriority = outerPriority;
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
});
|
|
681
681
|
}
|
|
682
|
-
function
|
|
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.
|
|
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.getController(b.
|
|
691
|
+
Rx.getController(b.update).configure({
|
|
692
692
|
order: node.level,
|
|
693
693
|
});
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
|
-
nonreactive(b.
|
|
696
|
+
nonreactive(b.update, node.builder.triggers);
|
|
697
697
|
}
|
|
698
698
|
else
|
|
699
|
-
|
|
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
|
nonreactive(() => driver.mount(block));
|
|
716
716
|
}
|
|
717
|
-
function
|
|
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 renderNow(ties) {
|
|
|
724
724
|
mountIfNecessary(b);
|
|
725
725
|
node.stamp++;
|
|
726
726
|
node.numerator = 0;
|
|
727
|
-
b.
|
|
727
|
+
b.prepareForUpdate();
|
|
728
728
|
node.children.beginMerge();
|
|
729
729
|
const driver = node.driver;
|
|
730
|
-
result = driver.
|
|
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 => {
|
|
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
|
-
|
|
736
|
+
runUpdateNestedTreesThenDo(undefined, NOP);
|
|
737
737
|
}
|
|
738
738
|
catch (e) {
|
|
739
|
-
|
|
740
|
-
console.log(`
|
|
739
|
+
runUpdateNestedTreesThenDo(e, NOP);
|
|
740
|
+
console.log(`Update failed: ${node.key}`);
|
|
741
741
|
console.log(`${e}`);
|
|
742
742
|
}
|
|
743
743
|
});
|
|
@@ -749,12 +749,12 @@ function triggerFinalization(ties, isLeader, individual) {
|
|
|
749
749
|
if (node.stamp >= 0) {
|
|
750
750
|
const driver = node.driver;
|
|
751
751
|
if (individual && node.key !== node.builder.key && !driver.isRow)
|
|
752
|
-
console.log(`WARNING: it is recommended to assign explicit key for
|
|
752
|
+
console.log(`WARNING: it is recommended to assign explicit key for conditional block in order to avoid unexpected side effects: ${node.key}`);
|
|
753
753
|
node.stamp = ~node.stamp;
|
|
754
754
|
const childrenAreLeaders = nonreactive(() => driver.finalize(b, isLeader));
|
|
755
755
|
b.native = null;
|
|
756
756
|
b.controller = null;
|
|
757
|
-
if (b.isOn(Mode.
|
|
757
|
+
if (b.isOn(Mode.PinpointUpdate)) {
|
|
758
758
|
ties.aux = undefined;
|
|
759
759
|
const last = gLastToDispose;
|
|
760
760
|
if (last)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Block, BlockKind, BlockBuilder, Align, BlockCoords, BlockArea } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
|
-
export declare function
|
|
3
|
+
export declare function Section<M = unknown, R = void>(builder?: BlockBuilder<HTMLElement, M, R>, base?: BlockBuilder<HTMLElement, M, R>): Block<HTMLElement, M, R>;
|
|
4
4
|
export declare function Table<M = unknown, R = void>(builder?: BlockBuilder<HTMLElement, M, R>, base?: BlockBuilder<HTMLElement, M, R>): Block<HTMLElement, M, R>;
|
|
5
5
|
export declare function row<T = void>(builder?: (block: void) => T, shiftCursorDown?: number): void;
|
|
6
6
|
export declare function fromNewRow(shiftCursorDown?: number): void;
|
|
@@ -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
|
-
|
|
26
|
+
update(block: Block<T>): void | Promise<void>;
|
|
27
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Verstak, BlockKind, Align, CursorCommandDriver, BaseDriver } from "../core/api";
|
|
2
2
|
import { HtmlDriver } from "./HtmlDriver";
|
|
3
|
-
export function
|
|
4
|
-
return Verstak.claim(Drivers.
|
|
3
|
+
export function Section(builder, base) {
|
|
4
|
+
return Verstak.claim(Drivers.section, builder, base);
|
|
5
5
|
}
|
|
6
6
|
export function Table(builder, base) {
|
|
7
7
|
return Verstak.claim(Drivers.table, builder, base);
|
|
@@ -15,21 +15,21 @@ export function fromNewRow(shiftCursorDown) {
|
|
|
15
15
|
}
|
|
16
16
|
export function cursor(areaParams) {
|
|
17
17
|
Verstak.claim(Drivers.cursor, {
|
|
18
|
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
+
update(b) {
|
|
33
33
|
b.native.innerHTML = content;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
@@ -177,20 +177,20 @@ export class VerstakHtmlDriver extends HtmlDriver {
|
|
|
177
177
|
else
|
|
178
178
|
e.className = enabled ? styleName : "";
|
|
179
179
|
}
|
|
180
|
-
|
|
180
|
+
update(block) {
|
|
181
181
|
if (block.kind <= BlockKind.Table)
|
|
182
182
|
fromNewRow();
|
|
183
|
-
return super.
|
|
183
|
+
return super.update(block);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
const Constants = {
|
|
187
187
|
block: "block",
|
|
188
188
|
row: "row",
|
|
189
|
-
layouts: ["
|
|
189
|
+
layouts: ["section", "table", "note", "group", "", ""],
|
|
190
190
|
attribute: "kind",
|
|
191
191
|
};
|
|
192
192
|
const Drivers = {
|
|
193
|
-
|
|
193
|
+
section: new VerstakHtmlDriver(Constants.block, false, b => b.kind = BlockKind.Section),
|
|
194
194
|
table: new VerstakHtmlDriver(Constants.block, false, b => b.kind = BlockKind.Table),
|
|
195
195
|
note: new VerstakHtmlDriver(Constants.block, false, b => b.kind = BlockKind.Note),
|
|
196
196
|
group: new VerstakHtmlDriver(Constants.block, false, b => b.kind = BlockKind.Group),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Verstak, StaticDriver, BlockKind } from "../core/api";
|
|
2
2
|
import { HtmlDriver, SvgDriver } from "./HtmlDriver";
|
|
3
3
|
export function HtmlBody(builder, base) {
|
|
4
|
-
const driver = new StaticDriver(global.document.body, "HtmlBody", false, b => b.kind = BlockKind.
|
|
4
|
+
const driver = new StaticDriver(global.document.body, "HtmlBody", false, b => b.kind = BlockKind.Section);
|
|
5
5
|
return Verstak.claim(driver, builder, base);
|
|
6
6
|
}
|
|
7
7
|
export function A(builder, base) { return Verstak.claim(HtmlTags.a, builder, base); }
|
|
@@ -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
|
-
|
|
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
|
-
|
|
52
|
-
const result = super.
|
|
51
|
+
update(block) {
|
|
52
|
+
const result = super.update(block);
|
|
53
53
|
if (gBlinkingEffectMarker)
|
|
54
|
-
blink(block.native, Verstak.
|
|
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";
|
|
|
3
3
|
export function FocuserReaction(key, target, model, switchEditMode = undefined) {
|
|
4
4
|
Fragment({
|
|
5
5
|
key,
|
|
6
|
-
mode: Mode.
|
|
6
|
+
mode: Mode.PinpointUpdate,
|
|
7
7
|
triggers: { target, model },
|
|
8
8
|
initialize(b) {
|
|
9
9
|
b.configureReactronic({ throttling: 0 });
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
update() {
|
|
12
12
|
if (switchEditMode !== undefined) {
|
|
13
13
|
switchEditMode(model);
|
|
14
14
|
}
|