j-templates 7.0.91 → 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 ARRAY_SCOPE = "ARRAY_SCOPE";
11
+ const OBJECT_SCOPE = Symbol("ARRAY_SCOPE");
12
12
  function Identity(value) {
13
13
  return value;
14
14
  }
@@ -95,18 +95,18 @@ 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[ARRAY_SCOPE]);
98
+ observableScope_1.ObservableScope.Update(object[OBJECT_SCOPE]);
99
99
  }
100
100
  function CreateProxy(value) {
101
101
  value = UnwrapProxy(value);
102
102
  return CreateProxyFromValue(value);
103
103
  }
104
104
  function CreateArrayProxy(value) {
105
- const wrapper = {
105
+ const wrapper = Object.assign([], {
106
106
  [NODE_VALUE]: value,
107
107
  [NODE_PROXY]: null,
108
- [ARRAY_SCOPE]: observableScope_1.ObservableScope.Basic(Identity.bind(null, value))
109
- };
108
+ [OBJECT_SCOPE]: observableScope_1.ObservableScope.Basic(Identity.bind(null, value))
109
+ });
110
110
  const proxy = wrapper[NODE_PROXY] = new Proxy(wrapper, {
111
111
  get: ArrayProxyGetter,
112
112
  set: ArrayProxySetter,
@@ -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[ARRAY_SCOPE]; // scopeCache.get(array) as IObservableScope<unknown[]>;
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?.[ARRAY_SCOPE]);
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 = ARRAY_SCOPE) {
284
+ function Touch(value, prop = OBJECT_SCOPE) {
285
285
  const wrapper = wrapperCache.get(value);
286
286
  if (wrapper) {
287
- const scope = wrapper[prop] ?? wrapper[ARRAY_SCOPE];
287
+ const scope = wrapper[prop] ?? wrapper[OBJECT_SCOPE];
288
288
  observableScope_1.ObservableScope.Update(scope);
289
289
  }
290
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.91",
3
+ "version": "7.0.93",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",