reactronic 0.96.26002 → 0.96.26004
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.
|
@@ -36,7 +36,7 @@ export declare abstract class ReactiveTreeNode<E = unknown> {
|
|
|
36
36
|
abstract configureReactivity(options: Partial<ReactivityOptions>): ReactivityOptions;
|
|
37
37
|
static get current(): ReactiveTreeNode;
|
|
38
38
|
static get isFirstBodyBuild(): boolean;
|
|
39
|
-
static
|
|
39
|
+
static rebuildBody(node: ReactiveTreeNode<any>, signalArgs: unknown): void;
|
|
40
40
|
static launchFinalization(node: ReactiveTreeNode<any>): void;
|
|
41
41
|
static launchNestedNodesThenDo(action: (error: unknown) => void): void;
|
|
42
42
|
static markAsMounted(node: ReactiveTreeNode<any>, yes: boolean): void;
|
|
@@ -66,7 +66,7 @@ export type ReactiveTreeNodeDriver<E = unknown> = {
|
|
|
66
66
|
runPreparation(node: ReactiveTreeNode<E>): void;
|
|
67
67
|
runFinalization(node: ReactiveTreeNode<E>, isLeader: boolean): boolean;
|
|
68
68
|
runMount(node: ReactiveTreeNode<E>): void;
|
|
69
|
-
|
|
69
|
+
rebuildBody(node: ReactiveTreeNode<E>): void | Promise<void>;
|
|
70
70
|
declareChild(ownerNode: ReactiveTreeNode<E>, childDriver: ReactiveTreeNodeDriver<any>, childDeclaration?: ReactiveTreeNodeDecl<any>, childBasis?: ReactiveTreeNodeDecl<any>): LinkedItem<ReactiveTreeNode> | undefined;
|
|
71
71
|
provideHost(node: ReactiveTreeNode<E>): ReactiveTreeNode<E>;
|
|
72
72
|
};
|
|
@@ -82,7 +82,7 @@ export declare abstract class BaseDriver<E = unknown> implements ReactiveTreeNod
|
|
|
82
82
|
runPreparation(node: ReactiveTreeNode<E>): void | Promise<void>;
|
|
83
83
|
runFinalization(node: ReactiveTreeNode<E>, isLeader: boolean): boolean;
|
|
84
84
|
runMount(node: ReactiveTreeNode<E>): void;
|
|
85
|
-
|
|
85
|
+
rebuildBody(node: ReactiveTreeNode<E>): void | Promise<void>;
|
|
86
86
|
declareChild(ownerNode: ReactiveTreeNode<E>, childDriver: ReactiveTreeNodeDriver<any>, childDeclaration?: ReactiveTreeNodeDecl<any>, childBasis?: ReactiveTreeNodeDecl<any>): LinkedItem<ReactiveTreeNode> | undefined;
|
|
87
87
|
provideHost(node: ReactiveTreeNode<E>): ReactiveTreeNode<E>;
|
|
88
88
|
}
|
|
@@ -69,7 +69,7 @@ export function derivative(declaration, basis) {
|
|
|
69
69
|
return declaration;
|
|
70
70
|
}
|
|
71
71
|
export function launch(node, signalArgs) {
|
|
72
|
-
ReactiveTreeNode.
|
|
72
|
+
ReactiveTreeNode.rebuildBody(node, signalArgs);
|
|
73
73
|
return node;
|
|
74
74
|
}
|
|
75
75
|
export class ReactiveTreeNode {
|
|
@@ -79,12 +79,12 @@ export class ReactiveTreeNode {
|
|
|
79
79
|
static get isFirstBodyBuild() {
|
|
80
80
|
return ReactiveTreeNode.current.stamp === 1;
|
|
81
81
|
}
|
|
82
|
-
static
|
|
82
|
+
static rebuildBody(node, signalArgs) {
|
|
83
83
|
const impl = node;
|
|
84
84
|
const declaration = impl.declaration;
|
|
85
85
|
if (node.stamp >= Number.MAX_SAFE_INTEGER || !signalsAreEqual(signalArgs, declaration.signalArgs)) {
|
|
86
86
|
declaration.signalArgs = signalArgs;
|
|
87
|
-
|
|
87
|
+
rebuildBodyViaSlot(impl.slot);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
static launchFinalization(node) {
|
|
@@ -158,8 +158,8 @@ export class BaseDriver {
|
|
|
158
158
|
}
|
|
159
159
|
runMount(node) {
|
|
160
160
|
}
|
|
161
|
-
|
|
162
|
-
return
|
|
161
|
+
rebuildBody(node) {
|
|
162
|
+
return invokeRebuildBodyUsingBasisChain(node.element, node.declaration);
|
|
163
163
|
}
|
|
164
164
|
declareChild(ownerNode, childDriver, childDeclaration, childBasis) {
|
|
165
165
|
return undefined;
|
|
@@ -196,7 +196,7 @@ export function getModeUsingBasisChain(declaration) {
|
|
|
196
196
|
var _a;
|
|
197
197
|
return (_a = declaration === null || declaration === void 0 ? void 0 : declaration.mode) !== null && _a !== void 0 ? _a : ((declaration === null || declaration === void 0 ? void 0 : declaration.basis) ? getModeUsingBasisChain(declaration === null || declaration === void 0 ? void 0 : declaration.basis) : Mode.default);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function invokeRebuildBodyUsingBasisChain(element, declaration) {
|
|
200
200
|
let result = undefined;
|
|
201
201
|
const basis = declaration.basis;
|
|
202
202
|
const body = declaration.body;
|
|
@@ -204,11 +204,11 @@ function invokeBuildBodyUsingBasisChain(element, declaration) {
|
|
|
204
204
|
if (body && bodyTask)
|
|
205
205
|
throw misuse("'body' and 'bodyTask' cannot be defined together");
|
|
206
206
|
if (body)
|
|
207
|
-
result = body.call(element, element, basis ? () =>
|
|
207
|
+
result = body.call(element, element, basis ? () => invokeRebuildBodyUsingBasisChain(element, basis) : NOP);
|
|
208
208
|
else if (bodyTask)
|
|
209
|
-
result = bodyTask.call(element, element, basis ? () =>
|
|
209
|
+
result = bodyTask.call(element, element, basis ? () => invokeRebuildBodyUsingBasisChain(element, basis) : NOP_ASYNC);
|
|
210
210
|
else if (basis)
|
|
211
|
-
result =
|
|
211
|
+
result = invokeRebuildBodyUsingBasisChain(element, basis);
|
|
212
212
|
return result;
|
|
213
213
|
}
|
|
214
214
|
function invokePreparationUsingBasisChain(element, declaration) {
|
|
@@ -304,7 +304,7 @@ class ReactiveTreeNode$ extends ReactiveTreeNode {
|
|
|
304
304
|
return flags(getModeUsingBasisChain(this.declaration), mode);
|
|
305
305
|
}
|
|
306
306
|
body(_signalArgs) {
|
|
307
|
-
|
|
307
|
+
rebuildBodyNow(this.slot);
|
|
308
308
|
}
|
|
309
309
|
configureReactivity(options) {
|
|
310
310
|
if (this.stamp < Number.MAX_SAFE_INTEGER - 1 || !this.has(Mode.autonomous))
|
|
@@ -409,7 +409,7 @@ function launchNestedNodesThenDoImpl(nodeSlot, error, action) {
|
|
|
409
409
|
mounting = markToMountIfNecessary(mounting, host, child, children, sequential);
|
|
410
410
|
const p = (_a = childNode.priority) !== null && _a !== void 0 ? _a : Priority.realtime;
|
|
411
411
|
if (p === Priority.realtime)
|
|
412
|
-
|
|
412
|
+
rebuildBodyViaSlot(child);
|
|
413
413
|
else if (p === Priority.normal)
|
|
414
414
|
p1 = push(child, p1);
|
|
415
415
|
else
|
|
@@ -463,7 +463,7 @@ function runNestedBodyBuildIncrementally(owner, stamp, allChildren, items, prior
|
|
|
463
463
|
const frameDurationLimit = priority === Priority.background ? ReactiveTreeNode.shortFrameDuration : Infinity;
|
|
464
464
|
let frameDuration = Math.min(frameDurationLimit, Math.max(ReactiveTreeNode.frameDuration / 4, ReactiveTreeNode.shortFrameDuration));
|
|
465
465
|
for (const child of items) {
|
|
466
|
-
|
|
466
|
+
rebuildBodyViaSlot(child);
|
|
467
467
|
if (Transaction.isFrameOver(1, frameDuration)) {
|
|
468
468
|
ReactiveTreeNode$.currentBodyPriority = outerPriority;
|
|
469
469
|
yield Transaction.requestNextFrame(0);
|
|
@@ -481,7 +481,7 @@ function runNestedBodyBuildIncrementally(owner, stamp, allChildren, items, prior
|
|
|
481
481
|
}
|
|
482
482
|
});
|
|
483
483
|
}
|
|
484
|
-
function
|
|
484
|
+
function rebuildBodyViaSlot(nodeSlot) {
|
|
485
485
|
const node = nodeSlot.instance;
|
|
486
486
|
if (node.stamp >= 0) {
|
|
487
487
|
if (node.has(Mode.autonomous)) {
|
|
@@ -497,9 +497,9 @@ function buildBodyViaSlot(nodeSlot) {
|
|
|
497
497
|
runNonReactive(node.body, node.declaration.signalArgs);
|
|
498
498
|
}
|
|
499
499
|
else if (node.owner !== node)
|
|
500
|
-
|
|
500
|
+
rebuildBodyNow(nodeSlot);
|
|
501
501
|
else
|
|
502
|
-
runTransactional(() =>
|
|
502
|
+
runTransactional(() => rebuildBodyNow(nodeSlot));
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
function mountOrRemountIfNecessary(node) {
|
|
@@ -518,7 +518,7 @@ function mountOrRemountIfNecessary(node) {
|
|
|
518
518
|
else if (node.isMoved && !node.has(Mode.external) && node.host !== node)
|
|
519
519
|
runNonReactive(() => driver.runMount(node));
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function rebuildBodyNow(nodeSlot) {
|
|
522
522
|
const node = nodeSlot.instance;
|
|
523
523
|
if (node.stamp >= 0) {
|
|
524
524
|
let result = undefined;
|
|
@@ -530,7 +530,7 @@ function buildBodyNow(nodeSlot) {
|
|
|
530
530
|
node.numerator = 0;
|
|
531
531
|
node.children.beginReconciliation();
|
|
532
532
|
const driver = node.driver;
|
|
533
|
-
result = driver.
|
|
533
|
+
result = driver.rebuildBody(node);
|
|
534
534
|
result = proceedSyncOrAsync(result, v => { launchNestedNodesThenDoImpl(nodeSlot, undefined, NOP); return v; }, e => { console.log(e); launchNestedNodesThenDoImpl(nodeSlot, e !== null && e !== void 0 ? e : new Error("unknown error"), NOP); });
|
|
535
535
|
}
|
|
536
536
|
catch (e) {
|