j-templates 8.0.13 → 8.0.15

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.
Files changed (49) hide show
  1. package/DOM/createAssignment.js +2 -6
  2. package/DOM/createAttributeAssignment.js +2 -6
  3. package/DOM/createEventAssignment.js +2 -6
  4. package/DOM/createPropertyAssignment.js +10 -14
  5. package/DOM/domNodeConfig.js +27 -30
  6. package/DOM/elements.js +102 -108
  7. package/DOM/index.js +3 -19
  8. package/Node/component.js +12 -16
  9. package/Node/component.types.js +1 -2
  10. package/Node/nodeConfig.js +2 -5
  11. package/Node/vNode.js +64 -67
  12. package/Node/vNode.types.js +5 -9
  13. package/Store/Diff/defaultDiffTreeWorker.d.ts +1 -0
  14. package/Store/Diff/defaultDiffTreeWorker.js +4 -0
  15. package/Store/Diff/diffAsync.d.ts +2 -4
  16. package/Store/Diff/diffAsync.js +4 -33
  17. package/Store/Diff/diffSync.js +3 -10
  18. package/Store/Diff/diffTree.d.ts +66 -41
  19. package/Store/Diff/diffTree.js +374 -426
  20. package/Store/Diff/diffTreeWorker.d.ts +8 -0
  21. package/Store/Diff/diffTreeWorker.js +27 -0
  22. package/Store/Diff/workerQueue.js +6 -10
  23. package/Store/Store/store.js +10 -14
  24. package/Store/Store/storeAsync.d.ts +1 -2
  25. package/Store/Store/storeAsync.js +10 -14
  26. package/Store/Store/storeSync.js +10 -14
  27. package/Store/Tree/observableNode.js +35 -38
  28. package/Store/Tree/observableScope.js +35 -42
  29. package/Store/index.js +5 -13
  30. package/Utils/animation.js +7 -11
  31. package/Utils/array.js +2 -6
  32. package/Utils/asyncQueue.js +7 -11
  33. package/Utils/decorators.js +44 -53
  34. package/Utils/emitter.js +6 -9
  35. package/Utils/functions.js +1 -4
  36. package/Utils/index.js +3 -21
  37. package/Utils/injector.js +2 -6
  38. package/Utils/json.d.ts +32 -10
  39. package/Utils/json.js +195 -208
  40. package/Utils/list.js +2 -5
  41. package/Utils/scheduling.js +4 -7
  42. package/Utils/thread.js +18 -26
  43. package/Utils/utils.types.js +1 -2
  44. package/_not_used/array.js +4 -10
  45. package/_not_used/avlTree.js +2 -5
  46. package/index.js +2 -10
  47. package/package.json +1 -1
  48. package/Store/Diff/diffWorker.d.ts +0 -3
  49. package/Store/Diff/diffWorker.js +0 -21
@@ -0,0 +1,8 @@
1
+ import { DiffTree } from "./diffTree";
2
+ export interface IDiffMethod {
3
+ /** The method to call */
4
+ method: "create" | "diffpath" | "splicepath" | "diffbatch" | "updatepath" | "getpath";
5
+ /** Arguments for the method call */
6
+ arguments: Array<any>;
7
+ }
8
+ export declare function ConnectWorkerToDiffTree(diffTree: DiffTree, worker: Worker): void;
@@ -0,0 +1,27 @@
1
+ export function ConnectWorkerToDiffTree(diffTree, worker) {
2
+ worker.onmessage = function (event) {
3
+ const data = event.data;
4
+ switch (data.method) {
5
+ case "diffpath": {
6
+ const diff = diffTree.DiffPath(data.arguments[0], data.arguments[1], data.arguments[2]);
7
+ worker.postMessage(diff);
8
+ break;
9
+ }
10
+ case "splicepath": {
11
+ const diff = diffTree.SplicePath(data.arguments[0], data.arguments[1], data.arguments[2], data.arguments[3], data.arguments[4]);
12
+ worker.postMessage(diff);
13
+ break;
14
+ }
15
+ case "diffbatch": {
16
+ const diff = diffTree.DiffBatch(data.arguments[0]);
17
+ worker.postMessage(diff);
18
+ break;
19
+ }
20
+ case "getpath": {
21
+ const ret = diffTree.GetPath(data.arguments[0]);
22
+ worker.postMessage(ret);
23
+ break;
24
+ }
25
+ }
26
+ };
27
+ }
@@ -1,23 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WorkerQueue = void 0;
4
- const list_1 = require("../../Utils/list");
5
- class WorkerQueue {
1
+ import { List } from "../../Utils/list";
2
+ export class WorkerQueue {
6
3
  constructor(worker) {
7
4
  this.worker = worker;
8
- this.callbacks = list_1.List.Create();
5
+ this.callbacks = List.Create();
9
6
  this.worker.onerror = (err) => {
10
- const cb = list_1.List.Pop(this.callbacks);
7
+ const cb = List.Pop(this.callbacks);
11
8
  cb && cb(null, err);
12
9
  };
13
10
  this.worker.onmessage = (message) => {
14
- const cb = list_1.List.Pop(this.callbacks);
11
+ const cb = List.Pop(this.callbacks);
15
12
  cb && cb(message.data);
16
13
  };
17
14
  }
18
15
  Push(message) {
19
16
  return new Promise((resolve, reject) => {
20
- list_1.List.Add(this.callbacks, function (data, err) {
17
+ List.Add(this.callbacks, function (data, err) {
21
18
  if (err)
22
19
  reject(err);
23
20
  else
@@ -30,4 +27,3 @@ class WorkerQueue {
30
27
  this.worker.terminate();
31
28
  }
32
29
  }
33
- exports.WorkerQueue = WorkerQueue;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Store = void 0;
4
- const json_1 = require("../../Utils/json");
5
- const observableNode_1 = require("../Tree/observableNode");
1
+ import { JsonDeepClone } from "../../Utils/json";
2
+ import { ObservableNode } from "../Tree/observableNode";
6
3
  /**
7
4
  * Base class for observable data store management.
8
5
  * Stores root objects as ObservableNode instances and manages updates through diff operations.
@@ -10,7 +7,7 @@ const observableNode_1 = require("../Tree/observableNode");
10
7
  * @see StoreSync
11
8
  * @see StoreAsync
12
9
  */
13
- class Store {
10
+ export class Store {
14
11
  /**
15
12
  * Creates an instance of Store.
16
13
  * @param keyFunc Optional function to generate a key for a given data value.
@@ -28,14 +25,14 @@ class Store {
28
25
  const rootObject = this.rootMap.get(key);
29
26
  if (rootObject === undefined)
30
27
  throw `No root object found for key: ${key}`;
31
- const rootValue = observableNode_1.ObservableNode.Unwrap(rootObject); // rootObject[GET_OBSERVABLE_VALUE];
32
- reactive && observableNode_1.ObservableNode.Touch(rootValue, key);
28
+ const rootValue = ObservableNode.Unwrap(rootObject); // rootObject[GET_OBSERVABLE_VALUE];
29
+ reactive && ObservableNode.Touch(rootValue, key);
33
30
  const alias = rootValue[key];
34
31
  return alias;
35
32
  });
36
33
  this.createNode = aliasFunc
37
- ? observableNode_1.ObservableNode.CreateFactory(aliasFunc)
38
- : observableNode_1.ObservableNode.Create;
34
+ ? ObservableNode.CreateFactory(aliasFunc)
35
+ : ObservableNode.Create;
39
36
  }
40
37
  Get(id, defaultValue) {
41
38
  let result = this.rootMap.get(id);
@@ -65,7 +62,7 @@ class Store {
65
62
  }
66
63
  SpliceRootObject(rootPath, start, deleteCount, items) {
67
64
  const rootObject = this.rootMap.get(rootPath);
68
- observableNode_1.ObservableNode.ApplySplice(rootObject[rootPath], start, deleteCount, items, this.cloneData);
65
+ ObservableNode.ApplySplice(rootObject[rootPath], start, deleteCount, items, this.cloneData);
69
66
  }
70
67
  /**
71
68
  * Updates a specific root object with diff results.
@@ -80,12 +77,11 @@ class Store {
80
77
  if (rootObject === undefined) {
81
78
  if (results.length > 1 || results[0].path.length > 1)
82
79
  throw `Unable to initialize root path ${rootPath} with ${results.length} results and initial path ${results[0].path}`;
83
- const rootData = this.cloneData ? (0, json_1.JsonDeepClone)(results[0].value) : results[0].value;
80
+ const rootData = this.cloneData ? JsonDeepClone(results[0].value) : results[0].value;
84
81
  const newRootObject = this.createNode({ [rootPath]: rootData });
85
82
  this.rootMap.set(rootPath, newRootObject);
86
83
  return;
87
84
  }
88
- observableNode_1.ObservableNode.ApplyDiff(rootObject, results);
85
+ ObservableNode.ApplyDiff(rootObject, results);
89
86
  }
90
87
  }
91
- exports.Store = Store;
@@ -1,4 +1,3 @@
1
- import { DiffTreeProjectionMap } from "../Diff/diffTree";
2
1
  import { Store } from "./store";
3
2
  /**
4
3
  * StoreAsync class extends the base Store class to provide asynchronous data management operations.
@@ -52,7 +51,7 @@ export declare class StoreAsync extends Store {
52
51
  * worker, the same mechanic used for `keyFunc`, so it must not close over state that
53
52
  * doesn't survive that round trip.
54
53
  */
55
- constructor(keyFunc?: (value: any) => string | undefined, projections?: DiffTreeProjectionMap);
54
+ constructor(diffWorker: Worker, keyFunc?: (value: any) => string | undefined);
56
55
  /**
57
56
  * Returns a promise that resolve once all current queued writes have completed
58
57
  */
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StoreAsync = void 0;
4
- const asyncQueue_1 = require("../../Utils/asyncQueue");
5
- const json_1 = require("../../Utils/json");
6
- const diffAsync_1 = require("../Diff/diffAsync");
7
- const store_1 = require("./store");
1
+ import { AsyncQueue } from "../../Utils/asyncQueue";
2
+ import { JsonDeepClone, JsonMerge } from "../../Utils/json";
3
+ import { DiffAsync } from "../Diff/diffAsync";
4
+ import { Store } from "./store";
8
5
  /**
9
6
  * StoreAsync class extends the base Store class to provide asynchronous data management operations.
10
7
  * This class handles writing, patching, pushing, and splicing data in an asynchronous manner.
@@ -37,7 +34,7 @@ const store_1 = require("./store");
37
34
  * @see StoreSync
38
35
  * @see DiffAsync
39
36
  */
40
- class StoreAsync extends store_1.Store {
37
+ export class StoreAsync extends Store {
41
38
  /**
42
39
  * Creates an instance of StoreAsync.
43
40
  * @param keyFunc Optional function to generate a key for a given data value.
@@ -47,14 +44,14 @@ class StoreAsync extends store_1.Store {
47
44
  * worker, the same mechanic used for `keyFunc`, so it must not close over state that
48
45
  * doesn't survive that round trip.
49
46
  */
50
- constructor(keyFunc, projections) {
47
+ constructor(diffWorker, keyFunc) {
51
48
  super(keyFunc, false);
52
49
  /**
53
50
  * The async queue instance used to manage asynchronous operations in a non-blocking manner.
54
51
  * @private
55
52
  */
56
- this.queue = new asyncQueue_1.AsyncQueue();
57
- this.diff = new diffAsync_1.DiffAsync(keyFunc, projections);
53
+ this.queue = new AsyncQueue();
54
+ this.diff = new DiffAsync(diffWorker);
58
55
  }
59
56
  /**
60
57
  * Returns a promise that resolve once all current queued writes have completed
@@ -93,7 +90,7 @@ class StoreAsync extends store_1.Store {
93
90
  if (value === undefined)
94
91
  throw "Unable to patch undefined value";
95
92
  const json = value.toJSON();
96
- const mergedJson = (0, json_1.JsonMerge)(json, patch);
93
+ const mergedJson = JsonMerge(json, patch);
97
94
  const diffResult = await this.diff.DiffPath(key, mergedJson, false);
98
95
  this.UpdateRootMap(diffResult);
99
96
  });
@@ -130,7 +127,7 @@ class StoreAsync extends store_1.Store {
130
127
  * @returns The array of deleted elements.
131
128
  */
132
129
  async Splice(key, start, deleteCount, ...items) {
133
- items = (0, json_1.JsonDeepClone)(items);
130
+ items = JsonDeepClone(items);
134
131
  return await this.queue.Next(async () => {
135
132
  if (!this.Has(key))
136
133
  throw "Key not found in store";
@@ -149,4 +146,3 @@ class StoreAsync extends store_1.Store {
149
146
  this.diff.Destroy();
150
147
  }
151
148
  }
152
- exports.StoreAsync = StoreAsync;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StoreSync = void 0;
4
- const json_1 = require("../../Utils/json");
5
- const diffSync_1 = require("../Diff/diffSync");
6
- const observableNode_1 = require("../Tree/observableNode");
7
- const store_1 = require("./store");
1
+ import { JsonMerge, JsonDeepClone } from "../../Utils/json";
2
+ import { DiffSync } from "../Diff/diffSync";
3
+ import { ObservableNode } from "../Tree/observableNode";
4
+ import { Store } from "./store";
8
5
  /**
9
6
  * StoreSync class extends the base Store class to provide synchronous data management operations.
10
7
  * This class handles writing, patching, pushing, and splicing data in a synchronous manner.
@@ -33,7 +30,7 @@ const store_1 = require("./store");
33
30
  * @see StoreAsync
34
31
  * @see DiffSync
35
32
  */
36
- class StoreSync extends store_1.Store {
33
+ export class StoreSync extends Store {
37
34
  /**
38
35
  * Creates an instance of StoreSync.
39
36
  * @param keyFunc Optional function to generate a key for a given data value.
@@ -42,7 +39,7 @@ class StoreSync extends store_1.Store {
42
39
  */
43
40
  constructor(keyFunc, projections) {
44
41
  super(keyFunc);
45
- this.diff = new diffSync_1.DiffSync(keyFunc, projections);
42
+ this.diff = new DiffSync(keyFunc, projections);
46
43
  }
47
44
  /**
48
45
  * Writes data to the store synchronously.
@@ -54,7 +51,7 @@ class StoreSync extends store_1.Store {
54
51
  key = key || this.keyFunc?.(data);
55
52
  if (!key)
56
53
  throw "No key provided for data";
57
- data = observableNode_1.ObservableNode.Unwrap(data);
54
+ data = ObservableNode.Unwrap(data);
58
55
  const diffResult = this.diff.DiffPath(key, data);
59
56
  this.UpdateRootMap(diffResult);
60
57
  }
@@ -70,8 +67,8 @@ class StoreSync extends store_1.Store {
70
67
  const value = this.Get(key);
71
68
  if (value === undefined)
72
69
  throw "Unable to patch undefined value";
73
- const json = observableNode_1.ObservableNode.Unwrap(value);
74
- const mergedJson = (0, json_1.JsonMerge)(json, patch);
70
+ const json = ObservableNode.Unwrap(value);
71
+ const mergedJson = JsonMerge(json, patch);
75
72
  const diffResult = this.diff.DiffPath(key, mergedJson, false);
76
73
  this.UpdateRootMap(diffResult);
77
74
  }
@@ -108,7 +105,6 @@ class StoreSync extends store_1.Store {
108
105
  const spliceResult = this.diff.SplicePath(key, start, deleteCount, items);
109
106
  this.UpdateRootMap(spliceResult.diffResult);
110
107
  this.SpliceRootObject(spliceResult.path[0], spliceResult.start, spliceResult.deleteCount, items);
111
- return (0, json_1.JsonDeepClone)(spliceResult.spliceResult);
108
+ return JsonDeepClone(spliceResult.spliceResult);
112
109
  }
113
110
  }
114
- exports.StoreSync = StoreSync;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ObservableNode = void 0;
4
- const json_1 = require("../../Utils/json");
5
- const json_2 = require("../../Utils/json");
6
- const observableScope_1 = require("./observableScope");
1
+ import { JsonDeepClone, JsonDiff } from "../../Utils/json";
2
+ import { JsonType } from "../../Utils/json";
3
+ import { ObservableScope } from "./observableScope";
7
4
  const NODE_VALUE = Symbol("NODE_VALUE");
8
5
  const NODE_PROXY = Symbol("NODE_PROXY");
9
6
  const NODE_SNAPSHOT = Symbol("NODE_SNAPSHOT");
@@ -51,22 +48,22 @@ function getOwnPropertyDescriptorArray(target, prop) {
51
48
  };
52
49
  }
53
50
  function has(value, prop) {
54
- observableScope_1.ObservableScope.Touch(value[ITERATOR_SCOPE]);
51
+ ObservableScope.Touch(value[ITERATOR_SCOPE]);
55
52
  return Object.hasOwn(value[NODE_VALUE], prop);
56
53
  }
57
54
  function hasArray(value, prop) {
58
- observableScope_1.ObservableScope.Touch(value[ITERATOR_SCOPE]);
55
+ ObservableScope.Touch(value[ITERATOR_SCOPE]);
59
56
  return Object.hasOwn(value[NODE_VALUE], prop);
60
57
  }
61
58
  function ownKeys(value) {
62
- observableScope_1.ObservableScope.Touch(value[ITERATOR_SCOPE]);
59
+ ObservableScope.Touch(value[ITERATOR_SCOPE]);
63
60
  return Object.keys(value[NODE_VALUE]);
64
61
  }
65
62
  function ownKeysArray(value) {
66
- observableScope_1.ObservableScope.Touch(value[ITERATOR_SCOPE]);
63
+ ObservableScope.Touch(value[ITERATOR_SCOPE]);
67
64
  return Object.keys(value[NODE_VALUE]);
68
65
  }
69
- function UnwrapProxy(value, type = (0, json_2.JsonType)(value)) {
66
+ function UnwrapProxy(value, type = JsonType(value)) {
70
67
  if (type === "value")
71
68
  return value;
72
69
  if (value[IS_NODE]) {
@@ -88,11 +85,11 @@ function UnwrapProxy(value, type = (0, json_2.JsonType)(value)) {
88
85
  }
89
86
  return value;
90
87
  }
91
- function CloneProxy(value, type = (0, json_2.JsonType)(value)) {
88
+ function CloneProxy(value, type = JsonType(value)) {
92
89
  if (type === "value")
93
90
  return value;
94
91
  if (value[IS_NODE]) {
95
- return (0, json_1.JsonDeepClone)(value);
92
+ return JsonDeepClone(value);
96
93
  }
97
94
  switch (type) {
98
95
  case "object": {
@@ -110,19 +107,19 @@ function CloneProxy(value, type = (0, json_2.JsonType)(value)) {
110
107
  return value;
111
108
  }
112
109
  function GetPropertyScope(object, prop) {
113
- return object[prop] ??= observableScope_1.ObservableScope.Basic(Property.bind(null, object[NODE_VALUE], prop));
110
+ return object[prop] ??= ObservableScope.Basic(Property.bind(null, object[NODE_VALUE], prop));
114
111
  }
115
112
  function SetObjectValue(object, prop, value) {
116
113
  const propExists = Object.hasOwn(object[NODE_VALUE], prop);
117
114
  object[NODE_VALUE][prop] = value;
118
115
  InvalidateSnapshotForValue(object[NODE_VALUE]);
119
- observableScope_1.ObservableScope.Update(object[prop]);
120
- !propExists && observableScope_1.ObservableScope.Update(object[ITERATOR_SCOPE]);
116
+ ObservableScope.Update(object[prop]);
117
+ !propExists && ObservableScope.Update(object[ITERATOR_SCOPE]);
121
118
  }
122
119
  function SetArrayValue(object, prop, value) {
123
120
  object[NODE_VALUE][prop] = value;
124
121
  InvalidateSnapshotForValue(object[NODE_VALUE]);
125
- observableScope_1.ObservableScope.Update(object[OBJECT_SCOPE]);
122
+ ObservableScope.Update(object[OBJECT_SCOPE]);
126
123
  }
127
124
  function CreateProxyFactory(alias) {
128
125
  /**
@@ -135,7 +132,7 @@ function CreateProxyFactory(alias) {
135
132
  * shared between snapshots. Keyed children are read through their root.
136
133
  */
137
134
  function CreateSnapshot(value) {
138
- if ((0, json_2.JsonType)(value) === "value")
135
+ if (JsonType(value) === "value")
139
136
  return value;
140
137
  const cached = valueSnapshotCache.get(value);
141
138
  if (cached !== undefined)
@@ -162,7 +159,7 @@ function CreateProxyFactory(alias) {
162
159
  * (one that changes which entity a slot holds) mutates that copy in place.
163
160
  */
164
161
  function ChildSnapshot(parent, child) {
165
- if ((0, json_2.JsonType)(child) === "value")
162
+ if (JsonType(child) === "value")
166
163
  return child;
167
164
  CreateSnapshotLink(child, parent);
168
165
  const resolved = alias?.(child, false);
@@ -177,7 +174,7 @@ function CreateProxyFactory(alias) {
177
174
  const wrapper = Object.assign([], {
178
175
  [NODE_VALUE]: value,
179
176
  [NODE_PROXY]: null,
180
- [OBJECT_SCOPE]: observableScope_1.ObservableScope.Basic(Identity.bind(null, value))
177
+ [OBJECT_SCOPE]: ObservableScope.Basic(Identity.bind(null, value))
181
178
  });
182
179
  const proxy = wrapper[NODE_PROXY] = new Proxy(wrapper, {
183
180
  get: ArrayProxyGetter,
@@ -221,7 +218,7 @@ function CreateProxyFactory(alias) {
221
218
  return CreateSnapshot(object[NODE_VALUE]);
222
219
  default: {
223
220
  const scope = object[OBJECT_SCOPE];
224
- const array = observableScope_1.ObservableScope.Value(scope);
221
+ const array = ObservableScope.Value(scope);
225
222
  const arrayValue = array[prop];
226
223
  if (typeof prop === "symbol")
227
224
  return arrayValue;
@@ -243,7 +240,7 @@ function CreateProxyFactory(alias) {
243
240
  for (let x = 0; x < proxyArray.length; x++)
244
241
  array[x] = UnwrapProxy(proxyArray[x]);
245
242
  InvalidateSnapshotForValue(object[NODE_VALUE]);
246
- observableScope_1.ObservableScope.Update(scope);
243
+ ObservableScope.Update(scope);
247
244
  break;
248
245
  }
249
246
  return result;
@@ -257,7 +254,7 @@ function CreateProxyFactory(alias) {
257
254
  const wrapper = {
258
255
  [NODE_VALUE]: value,
259
256
  [NODE_PROXY]: null,
260
- [ITERATOR_SCOPE]: observableScope_1.ObservableScope.Basic(Identity.bind(null, value))
257
+ [ITERATOR_SCOPE]: ObservableScope.Basic(Identity.bind(null, value))
261
258
  };
262
259
  const proxy = wrapper[NODE_PROXY] = new Proxy(wrapper, {
263
260
  get: ObjectProxyGetter,
@@ -277,7 +274,7 @@ function CreateProxyFactory(alias) {
277
274
  return true;
278
275
  }
279
276
  function ObjectProxyGetter(object, prop) {
280
- observableScope_1.ObservableScope.Touch(object[OBJECT_SCOPE]);
277
+ ObservableScope.Touch(object[OBJECT_SCOPE]);
281
278
  switch (prop) {
282
279
  case IS_NODE:
283
280
  return true;
@@ -296,11 +293,11 @@ function CreateProxyFactory(alias) {
296
293
  }
297
294
  function GetAccessorValue(object, prop) {
298
295
  const scope = GetPropertyScope(object, prop);
299
- const value = observableScope_1.ObservableScope.Value(scope);
296
+ const value = ObservableScope.Value(scope);
300
297
  return CreateProxyFromValue(value);
301
298
  }
302
299
  function CreateProxyFromValue(value) {
303
- const type = (0, json_2.JsonType)(value);
300
+ const type = JsonType(value);
304
301
  switch (type) {
305
302
  case "object": {
306
303
  const wrapper = wrapperCache.get(value);
@@ -317,7 +314,7 @@ function CreateProxyFactory(alias) {
317
314
  case "array": {
318
315
  const wrapper = wrapperCache.get(value);
319
316
  const proxy = wrapper?.[NODE_PROXY] ?? CreateArrayProxy(value);
320
- observableScope_1.ObservableScope.Touch(wrapper?.[OBJECT_SCOPE]);
317
+ ObservableScope.Touch(wrapper?.[OBJECT_SCOPE]);
321
318
  return proxy;
322
319
  }
323
320
  default:
@@ -330,7 +327,7 @@ function CreateProxyFactory(alias) {
330
327
  };
331
328
  }
332
329
  const DefaultCreateProxy = CreateProxyFactory();
333
- var ObservableNode;
330
+ export var ObservableNode;
334
331
  (function (ObservableNode) {
335
332
  /**
336
333
  * Unwraps an observable node to get the raw underlying value.
@@ -396,7 +393,7 @@ var ObservableNode;
396
393
  const wrapper = wrapperCache.get(value);
397
394
  if (wrapper) {
398
395
  const scope = Array.isArray(wrapper) ? wrapper[OBJECT_SCOPE] : (prop && wrapper[prop]) ?? wrapper[ITERATOR_SCOPE];
399
- observableScope_1.ObservableScope.Update(scope);
396
+ ObservableScope.Update(scope);
400
397
  }
401
398
  }
402
399
  ObservableNode.Update = Update;
@@ -420,7 +417,7 @@ var ObservableNode;
420
417
  const wrapper = wrapperCache.get(value);
421
418
  if (wrapper) {
422
419
  const scope = prop && GetPropertyScope(wrapper, prop) || wrapper[OBJECT_SCOPE];
423
- observableScope_1.ObservableScope.Touch(scope);
420
+ ObservableScope.Touch(scope);
424
421
  }
425
422
  }
426
423
  ObservableNode.Touch = Touch;
@@ -428,7 +425,7 @@ var ObservableNode;
428
425
  const wrapper = wrapperCache.get(value);
429
426
  if (wrapper) {
430
427
  const scope = Array.isArray(wrapper) ? wrapper[OBJECT_SCOPE] : (prop && wrapper[prop]) ?? wrapper[ITERATOR_SCOPE];
431
- observableScope_1.ObservableScope.Update(scope);
428
+ ObservableScope.Update(scope);
432
429
  }
433
430
  }
434
431
  ObservableNode.Read = Read;
@@ -452,14 +449,14 @@ var ObservableNode;
452
449
  */
453
450
  function Apply(rootNode, value) {
454
451
  const root = rootNode[NODE_VALUE];
455
- const diff = (0, json_1.JsonDiff)(value, root);
452
+ const diff = JsonDiff(value, root);
456
453
  ApplyDiff(rootNode, diff);
457
454
  }
458
455
  ObservableNode.Apply = Apply;
459
456
  function ApplySplice(rootNode, start, deleteCount, items, cloneData = true) {
460
457
  const root = rootNode[NODE_VALUE];
461
458
  InvalidateSnapshotForValue(rootNode[NODE_VALUE]);
462
- const addItems = cloneData ? (0, json_1.JsonDeepClone)(items) : items;
459
+ const addItems = cloneData ? JsonDeepClone(items) : items;
463
460
  root.splice(start, deleteCount, ...addItems);
464
461
  ObservableNode.Update(root);
465
462
  }
@@ -475,9 +472,9 @@ var ObservableNode;
475
472
  if (diffResult.length === 1 && diffResult[0].path.length === 0) {
476
473
  // Replacing rootNode
477
474
  InvalidateSnapshotForValue(root);
478
- const rootPatch = cloneData ? (0, json_1.JsonDeepClone)(diffResult[0].value) : diffResult[0].value;
479
- const rootType = (0, json_2.JsonType)(root);
480
- const rootPatchType = (0, json_2.JsonType)(rootPatch);
475
+ const rootPatch = cloneData ? JsonDeepClone(diffResult[0].value) : diffResult[0].value;
476
+ const rootType = JsonType(root);
477
+ const rootPatchType = JsonType(rootPatch);
481
478
  if (rootType !== rootPatchType)
482
479
  throw new Error("Unable to change type of Root ObservableNode: " + rootType);
483
480
  switch (rootType) {
@@ -521,7 +518,7 @@ var ObservableNode;
521
518
  }
522
519
  }
523
520
  const assignValue = pathTuples[y][1];
524
- const assignData = cloneData ? (0, json_1.JsonDeepClone)(value) : value;
521
+ const assignData = cloneData ? JsonDeepClone(value) : value;
525
522
  ObservableNode.Assign(assignValue, path[y], assignData);
526
523
  }
527
524
  }
@@ -537,4 +534,4 @@ var ObservableNode;
537
534
  return CreateProxyFactory(alias);
538
535
  }
539
536
  ObservableNode.CreateFactory = CreateFactory;
540
- })(ObservableNode || (exports.ObservableNode = ObservableNode = {}));
537
+ })(ObservableNode || (ObservableNode = {}));