j-templates 7.0.92 → 7.0.93
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.
|
@@ -22,7 +22,7 @@ export declare namespace ObservableNode {
|
|
|
22
22
|
* @param value The observable node to touch.
|
|
23
23
|
* @param prop Optional property name or index to touch a specific nested property.
|
|
24
24
|
*/
|
|
25
|
-
function Touch(value: unknown, prop?: string | number): void;
|
|
25
|
+
function Touch(value: unknown, prop?: string | number | symbol): void;
|
|
26
26
|
function Apply(rootNode: any, update: any): void;
|
|
27
27
|
/**
|
|
28
28
|
* Applies a JSON diff result to an observable node, efficiently updating only changed properties.
|
|
@@ -8,7 +8,7 @@ const NODE_VALUE = Symbol("NODE_VALUE");
|
|
|
8
8
|
const NODE_PROXY = Symbol("NODE_PROXY");
|
|
9
9
|
const toJSON = "toJSON";
|
|
10
10
|
const IS_NODE = Symbol("IS_NODE");
|
|
11
|
-
const
|
|
11
|
+
const OBJECT_SCOPE = Symbol("ARRAY_SCOPE");
|
|
12
12
|
function Identity(value) {
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
@@ -95,7 +95,7 @@ function CreateProxyFactory(alias) {
|
|
|
95
95
|
}
|
|
96
96
|
function SetArrayValue(object, prop, value) {
|
|
97
97
|
object[NODE_VALUE][prop] = value;
|
|
98
|
-
observableScope_1.ObservableScope.Update(object[
|
|
98
|
+
observableScope_1.ObservableScope.Update(object[OBJECT_SCOPE]);
|
|
99
99
|
}
|
|
100
100
|
function CreateProxy(value) {
|
|
101
101
|
value = UnwrapProxy(value);
|
|
@@ -105,7 +105,7 @@ function CreateProxyFactory(alias) {
|
|
|
105
105
|
const wrapper = Object.assign([], {
|
|
106
106
|
[NODE_VALUE]: value,
|
|
107
107
|
[NODE_PROXY]: null,
|
|
108
|
-
[
|
|
108
|
+
[OBJECT_SCOPE]: observableScope_1.ObservableScope.Basic(Identity.bind(null, value))
|
|
109
109
|
});
|
|
110
110
|
const proxy = wrapper[NODE_PROXY] = new Proxy(wrapper, {
|
|
111
111
|
get: ArrayProxyGetter,
|
|
@@ -146,7 +146,7 @@ function CreateProxyFactory(alias) {
|
|
|
146
146
|
case NODE_VALUE:
|
|
147
147
|
return object[NODE_VALUE];
|
|
148
148
|
default: {
|
|
149
|
-
const scope = object[
|
|
149
|
+
const scope = object[OBJECT_SCOPE]; // scopeCache.get(array) as IObservableScope<unknown[]>;
|
|
150
150
|
const array = observableScope_1.ObservableScope.Value(scope);
|
|
151
151
|
const arrayValue = array[prop];
|
|
152
152
|
if (typeof prop === "symbol")
|
|
@@ -238,7 +238,7 @@ function CreateProxyFactory(alias) {
|
|
|
238
238
|
case "array": {
|
|
239
239
|
const wrapper = wrapperCache.get(value);
|
|
240
240
|
const proxy = wrapper?.[NODE_PROXY] ?? CreateArrayProxy(value);
|
|
241
|
-
observableScope_1.ObservableScope.Touch(wrapper?.[
|
|
241
|
+
observableScope_1.ObservableScope.Touch(wrapper?.[OBJECT_SCOPE]);
|
|
242
242
|
return proxy;
|
|
243
243
|
}
|
|
244
244
|
default:
|
|
@@ -281,10 +281,10 @@ var ObservableNode;
|
|
|
281
281
|
* @param value The observable node to touch.
|
|
282
282
|
* @param prop Optional property name or index to touch a specific nested property.
|
|
283
283
|
*/
|
|
284
|
-
function Touch(value, prop =
|
|
284
|
+
function Touch(value, prop = OBJECT_SCOPE) {
|
|
285
285
|
const wrapper = wrapperCache.get(value);
|
|
286
286
|
if (wrapper) {
|
|
287
|
-
const scope = wrapper[prop] ?? wrapper[
|
|
287
|
+
const scope = wrapper[prop] ?? wrapper[OBJECT_SCOPE];
|
|
288
288
|
observableScope_1.ObservableScope.Update(scope);
|
|
289
289
|
}
|
|
290
290
|
}
|