reactronic 0.24.272 → 0.24.274
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.
|
@@ -55,11 +55,11 @@ export declare abstract class RxNode<E = unknown> {
|
|
|
55
55
|
static setDefaultLoggingOptions(logging?: LoggingOptions): void;
|
|
56
56
|
}
|
|
57
57
|
export type RxNodeDecl<E = unknown> = {
|
|
58
|
-
|
|
58
|
+
script?: Delegate<E>;
|
|
59
59
|
key?: string;
|
|
60
60
|
mode?: Mode;
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
creation?: Delegate<E>;
|
|
62
|
+
destruction?: Delegate<E>;
|
|
63
63
|
triggers?: unknown;
|
|
64
64
|
preset?: RxNodeDecl<E>;
|
|
65
65
|
};
|
|
@@ -73,6 +73,7 @@ export type RxNodeDriver<E = unknown> = {
|
|
|
73
73
|
mount(node: RxNode<E>): void;
|
|
74
74
|
update(node: RxNode<E>): void | Promise<void>;
|
|
75
75
|
child(ownerNode: RxNode<E>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any>, childPreset?: RxNodeDecl<any>): MergedItem<RxNode> | undefined;
|
|
76
|
+
getHost(node: RxNode<E>): RxNode<E>;
|
|
76
77
|
};
|
|
77
78
|
export type RxNodeContext<T extends Object = Object> = {
|
|
78
79
|
value: T;
|
|
@@ -88,6 +89,7 @@ export declare abstract class BaseDriver<E = unknown> implements RxNodeDriver<E>
|
|
|
88
89
|
mount(node: RxNode<E>): void;
|
|
89
90
|
update(node: RxNode<E>): void | Promise<void>;
|
|
90
91
|
child(ownerNode: RxNode<E>, childDriver: RxNodeDriver<any>, childDeclaration?: RxNodeDecl<any>, childPreset?: RxNodeDecl<any>): MergedItem<RxNode> | undefined;
|
|
92
|
+
getHost(node: RxNode<E>): RxNode<E>;
|
|
91
93
|
}
|
|
92
94
|
export declare class RxNodeVariable<T extends Object = Object> {
|
|
93
95
|
readonly defaultValue: T | undefined;
|
|
@@ -161,11 +161,14 @@ export class BaseDriver {
|
|
|
161
161
|
mount(node) {
|
|
162
162
|
}
|
|
163
163
|
update(node) {
|
|
164
|
-
|
|
164
|
+
invokeScriptViaPresetChain(node.element, node.declaration);
|
|
165
165
|
}
|
|
166
166
|
child(ownerNode, childDriver, childDeclaration, childPreset) {
|
|
167
167
|
return undefined;
|
|
168
168
|
}
|
|
169
|
+
getHost(node) {
|
|
170
|
+
return node;
|
|
171
|
+
}
|
|
169
172
|
}
|
|
170
173
|
export class RxNodeVariable {
|
|
171
174
|
constructor(defaultValue) {
|
|
@@ -197,25 +200,25 @@ function getModeViaPresetChain(declaration) {
|
|
|
197
200
|
}
|
|
198
201
|
function invokeOnCreateViaPresetChain(element, declaration) {
|
|
199
202
|
const preset = declaration.preset;
|
|
200
|
-
const
|
|
201
|
-
if (
|
|
202
|
-
|
|
203
|
+
const creation = declaration.creation;
|
|
204
|
+
if (creation)
|
|
205
|
+
creation(element, preset ? () => invokeOnCreateViaPresetChain(element, preset) : NOP);
|
|
203
206
|
else if (preset)
|
|
204
207
|
invokeOnCreateViaPresetChain(element, preset);
|
|
205
208
|
}
|
|
206
|
-
function
|
|
209
|
+
function invokeScriptViaPresetChain(element, declaration) {
|
|
207
210
|
const preset = declaration.preset;
|
|
208
|
-
const
|
|
209
|
-
if (
|
|
210
|
-
|
|
211
|
+
const script = declaration.script;
|
|
212
|
+
if (script)
|
|
213
|
+
script(element, preset ? () => invokeScriptViaPresetChain(element, preset) : NOP);
|
|
211
214
|
else if (preset)
|
|
212
|
-
|
|
215
|
+
invokeScriptViaPresetChain(element, preset);
|
|
213
216
|
}
|
|
214
217
|
function invokeOnDestroyViaPresetChain(element, declaration) {
|
|
215
218
|
const preset = declaration.preset;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
218
|
-
|
|
219
|
+
const destruction = declaration.destruction;
|
|
220
|
+
if (destruction)
|
|
221
|
+
destruction(element, preset ? () => invokeOnDestroyViaPresetChain(element, preset) : NOP);
|
|
219
222
|
else if (preset)
|
|
220
223
|
invokeOnDestroyViaPresetChain(element, preset);
|
|
221
224
|
}
|