reactronic 0.96.26008 → 0.96.26010
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.
|
@@ -70,6 +70,7 @@ export type ReactiveTreeNodeDriver<E = unknown> = {
|
|
|
70
70
|
provideHost(node: ReactiveTreeNode<E>): ReactiveTreeNode<E>;
|
|
71
71
|
};
|
|
72
72
|
export type ReactiveTreeNodeContext<T extends Object = Object> = {
|
|
73
|
+
variable: ReactiveTreeVariable<T>;
|
|
73
74
|
value: T;
|
|
74
75
|
};
|
|
75
76
|
export declare abstract class BaseDriver<E = unknown> implements ReactiveTreeNodeDriver<E> {
|
|
@@ -86,8 +87,9 @@ export declare abstract class BaseDriver<E = unknown> implements ReactiveTreeNod
|
|
|
86
87
|
provideHost(node: ReactiveTreeNode<E>): ReactiveTreeNode<E>;
|
|
87
88
|
}
|
|
88
89
|
export declare class ReactiveTreeVariable<T extends Object = Object> {
|
|
90
|
+
readonly hint: string;
|
|
89
91
|
readonly defaultValue: T | undefined;
|
|
90
|
-
constructor(defaultValue?: T);
|
|
92
|
+
constructor(hint: string, defaultValue?: T);
|
|
91
93
|
set value(value: T);
|
|
92
94
|
get value(): T;
|
|
93
95
|
get valueOrUndefined(): T | undefined;
|
|
@@ -167,7 +167,8 @@ export class BaseDriver {
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
export class ReactiveTreeVariable {
|
|
170
|
-
constructor(defaultValue) {
|
|
170
|
+
constructor(hint, defaultValue) {
|
|
171
|
+
this.hint = hint;
|
|
171
172
|
this.defaultValue = defaultValue;
|
|
172
173
|
}
|
|
173
174
|
set value(value) {
|
|
@@ -314,11 +315,12 @@ class ReactiveTreeNode$ extends ReactiveTreeNode {
|
|
|
314
315
|
return gCurrentNode;
|
|
315
316
|
}
|
|
316
317
|
static tryUseTreeVariableValue(variable) {
|
|
317
|
-
var _a
|
|
318
|
+
var _a;
|
|
318
319
|
let node = ReactiveTreeNode.current;
|
|
319
|
-
while (((_a = node.context) === null || _a === void 0 ? void 0 : _a.
|
|
320
|
+
while (((_a = node.context) === null || _a === void 0 ? void 0 : _a.variable) !== variable && node.owner !== node)
|
|
320
321
|
node = node.outer;
|
|
321
|
-
|
|
322
|
+
const ctx = node.context;
|
|
323
|
+
return (ctx === null || ctx === void 0 ? void 0 : ctx.variable) === variable ? ctx.value : undefined;
|
|
322
324
|
}
|
|
323
325
|
static useTreeVariableValue(variable) {
|
|
324
326
|
var _a;
|