@ng-org/alien-deepsignals 0.1.2-alpha.5 → 0.1.2-alpha.7

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 (62) hide show
  1. package/README.md +55 -374
  2. package/dist/core.d.ts +66 -60
  3. package/dist/core.d.ts.map +1 -1
  4. package/dist/core.js +70 -82
  5. package/dist/deepSignal.d.ts +19 -5
  6. package/dist/deepSignal.d.ts.map +1 -1
  7. package/dist/deepSignal.js +214 -141
  8. package/dist/effect.d.ts.map +1 -1
  9. package/dist/effect.js +8 -1
  10. package/dist/hooks/react/useDeepSignal.d.ts +1 -1
  11. package/dist/hooks/react/useDeepSignal.d.ts.map +1 -1
  12. package/dist/hooks/react/useDeepSignal.js +5 -2
  13. package/dist/hooks/svelte/index.d.ts +0 -1
  14. package/dist/hooks/svelte/index.d.ts.map +1 -1
  15. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts +3 -15
  16. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts.map +1 -1
  17. package/dist/hooks/svelte/useDeepSignal.svelte.js +29 -63
  18. package/dist/hooks/svelte4/index.d.ts +4 -0
  19. package/dist/hooks/svelte4/index.d.ts.map +1 -0
  20. package/dist/hooks/svelte4/index.js +8 -0
  21. package/dist/hooks/svelte4/useDeepSignal.svelte.d.ts +27 -0
  22. package/dist/hooks/svelte4/useDeepSignal.svelte.d.ts.map +1 -0
  23. package/dist/hooks/svelte4/useDeepSignal.svelte.js +91 -0
  24. package/dist/hooks/vue/useDeepSignal.d.ts +2 -2
  25. package/dist/hooks/vue/useDeepSignal.d.ts.map +1 -1
  26. package/dist/hooks/vue/useDeepSignal.js +22 -74
  27. package/dist/index.d.ts +1 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +8 -2
  30. package/dist/test/frontend/astro-app/src/components/ReactPanel.d.ts.map +1 -1
  31. package/dist/test/frontend/astro-app/src/components/{ReactPanel.js → ReactPanel.jsx} +56 -45
  32. package/dist/test/frontend/playwright/crossFrameworkHooks.spec.js +13 -3
  33. package/dist/test/frontend/utils/mockData.d.ts.map +1 -1
  34. package/dist/test/frontend/utils/mockData.js +13 -4
  35. package/dist/test/lib/index.test.js +16 -3
  36. package/dist/test/lib/misc.test.js +104 -1
  37. package/dist/test/lib/watch.test.js +2 -11
  38. package/dist/types.d.ts +94 -19
  39. package/dist/types.d.ts.map +1 -1
  40. package/dist/types.js +9 -0
  41. package/dist/watch.d.ts +37 -0
  42. package/dist/watch.d.ts.map +1 -1
  43. package/dist/watch.js +35 -0
  44. package/package.json +8 -5
  45. package/dist/test/frontend/astro-app/src/components/PerfSuiteClient.d.ts +0 -4
  46. package/dist/test/frontend/astro-app/src/components/PerfSuiteClient.d.ts.map +0 -1
  47. package/dist/test/frontend/astro-app/src/components/PerfSuiteClient.js +0 -225
  48. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfDeep.d.ts +0 -4
  49. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfDeep.d.ts.map +0 -1
  50. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfDeep.js +0 -150
  51. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfNative.d.ts +0 -4
  52. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfNative.d.ts.map +0 -1
  53. package/dist/test/frontend/astro-app/src/components/perf/react/ReactPerfNative.js +0 -184
  54. package/dist/test/frontend/playwright/perfSuite.spec.d.ts +0 -2
  55. package/dist/test/frontend/playwright/perfSuite.spec.d.ts.map +0 -1
  56. package/dist/test/frontend/playwright/perfSuite.spec.js +0 -128
  57. package/dist/test/frontend/utils/perfScenarios.d.ts +0 -15
  58. package/dist/test/frontend/utils/perfScenarios.d.ts.map +0 -1
  59. package/dist/test/frontend/utils/perfScenarios.js +0 -287
  60. package/dist/test/lib/core.test.d.ts +0 -2
  61. package/dist/test/lib/core.test.d.ts.map +0 -1
  62. package/dist/test/lib/core.test.js +0 -53
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
+ // All rights reserved.
4
+ // Licensed under the Apache License, Version 2.0
5
+ // <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
6
+ // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
7
+ // at your option. All files in the project carrying such
8
+ // notice may not be copied, modified, or distributed except
9
+ // according to those terms.
10
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
2
11
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
12
  if (k2 === undefined) k2 = k;
4
13
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -47,52 +56,11 @@ const ReactPanel = () => {
47
56
  (0, react_1.useEffect)(() => {
48
57
  (0, renderMetrics_1.recordRender)("react", renderCount.current);
49
58
  });
50
- const objectEntries = Array.from(state.objectSet.values());
51
- const ObjectRow = ({ entry }) => {
52
- const rowRenderCount = (0, react_1.useRef)(0);
53
- rowRenderCount.current += 1;
54
- (0, react_1.useEffect)(() => {
55
- (0, renderMetrics_1.recordObjectRender)("react", entry["@id"], rowRenderCount.current);
56
- });
57
- return (<div className="object-row" data-entry-id={entry["@id"]} data-render-count={rowRenderCount.current}>
58
- <span className="object-id">{entry["@id"]}</span>
59
- <input type="text" data-role="label" value={entry.label} onChange={(event) => {
60
- entry.label = event.target.value;
61
- }}/>
62
- <input type="number" data-role="count-input" value={entry.count} onChange={(event) => {
63
- entry.count = Number(event.target.value || 0);
64
- }}/>
65
- <span data-role="count">{entry.count}</span>
66
- <button type="button" data-action="increment" onClick={() => {
67
- entry.count += 1;
68
- }}>
69
- +1
70
- </button>
71
- </div>);
72
- };
73
- const renderPrimitiveField = (label, options) => {
74
- if (options.type === "boolean") {
75
- return (<fieldset className="field" data-field={label}>
76
- <legend>{label}</legend>
77
- <input type="checkbox" data-role="editor" checked={options.value} onChange={(event) => options.onChange(event.target.checked)}/>
78
- <span data-role="value">{String(options.value)}</span>
79
- </fieldset>);
80
- }
81
- if (options.type === "number") {
82
- return (<fieldset className="field" data-field={label}>
83
- <legend>{label}</legend>
84
- <input type="number" data-role="editor" value={options.value} onChange={(event) => options.onChange(Number(event.target.value || 0))}/>
85
- <span data-role="value">{options.value}</span>
86
- </fieldset>);
87
- }
88
- return (<fieldset className="field" data-field={label}>
89
- <legend>{label}</legend>
90
- <input type="text" data-role="editor" value={options.value} onChange={(event) => options.onChange(event.target.value)}/>
91
- <span data-role="value">{options.value}</span>
92
- </fieldset>);
93
- };
59
+ const objectEntries = (0, react_1.useMemo)(() => {
60
+ return [...state.objectSet];
61
+ }, [state.objectSet]);
94
62
  return (<section>
95
- <h2 className="title">react</h2>
63
+ <h2 className="title">React</h2>
96
64
  <div className="render-meta" data-render-count={renderCount.current}>
97
65
  Render #{renderCount.current}
98
66
  </div>
@@ -224,4 +192,47 @@ const ReactPanel = () => {
224
192
  </fieldset>
225
193
  </section>);
226
194
  };
195
+ const ObjectRow = ({ entry }) => {
196
+ const rowRenderCount = (0, react_1.useRef)(0);
197
+ rowRenderCount.current += 1;
198
+ (0, react_1.useEffect)(() => {
199
+ (0, renderMetrics_1.recordObjectRender)("react", entry["@id"], rowRenderCount.current);
200
+ });
201
+ return (<div className="object-row" data-entry-id={entry["@id"]} data-render-count={rowRenderCount.current}>
202
+ <span className="object-id">{entry["@id"]}</span>
203
+ <input type="text" data-role="label" value={entry.label} onChange={(event) => {
204
+ entry.label = event.target.value;
205
+ }}/>
206
+ <input type="number" data-role="count-input" value={entry.count} onChange={(event) => {
207
+ entry.count = Number(event.target.value || 0);
208
+ }}/>
209
+ <span data-role="count">{entry.count}</span>
210
+ <button type="button" data-action="increment" onClick={() => {
211
+ entry.count += 1;
212
+ }}>
213
+ +1
214
+ </button>
215
+ </div>);
216
+ };
217
+ const renderPrimitiveField = (label, options) => {
218
+ if (options.type === "boolean") {
219
+ return (<fieldset className="field" data-field={label}>
220
+ <legend>{label}</legend>
221
+ <input type="checkbox" data-role="editor" checked={options.value} onChange={(event) => options.onChange(event.target.checked)}/>
222
+ <span data-role="value">{String(options.value)}</span>
223
+ </fieldset>);
224
+ }
225
+ if (options.type === "number") {
226
+ return (<fieldset className="field" data-field={label}>
227
+ <legend>{label}</legend>
228
+ <input type="number" data-role="editor" value={options.value} onChange={(event) => options.onChange(Number(event.target.value || 0))}/>
229
+ <span data-role="value">{options.value}</span>
230
+ </fieldset>);
231
+ }
232
+ return (<fieldset className="field" data-field={label}>
233
+ <legend>{label}</legend>
234
+ <input type="text" data-role="editor" value={options.value} onChange={(event) => options.onChange(event.target.value)}/>
235
+ <span data-role="value">{options.value}</span>
236
+ </fieldset>);
237
+ };
227
238
  exports.default = ReactPanel;
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
+ // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
+ // All rights reserved.
4
+ // Licensed under the Apache License, Version 2.0
5
+ // <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
6
+ // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
7
+ // at your option. All files in the project carrying such
8
+ // notice may not be copied, modified, or distributed except
9
+ // according to those terms.
10
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  const test_1 = require("@playwright/test");
4
13
  const mockData_1 = require("../utils/mockData");
5
- const frameworks = ["react", "vue", "svelte"];
14
+ const frameworks = ["react", "vue", "svelte", "svelte4"];
6
15
  const alphaEntry = Array.from(mockData_1.mockTestObject.objectSet).find((entry) => entry["@id"] === "urn:object:alpha");
7
16
  if (!alphaEntry) {
8
17
  throw new Error("mock data must include an objectSet entry with @id urn:object:alpha");
@@ -87,8 +96,8 @@ const createObjectSetPlan = (entryId, nextLabel, expectedCount) => ({
87
96
  },
88
97
  assert: async (page, framework) => {
89
98
  const entry = fieldLocator(page, framework, "objectSet").locator(`[data-entry-id='${entryId}']`);
90
- await (0, test_1.expect)(entry.locator("input[data-role='label']")).toHaveValue(nextLabel);
91
99
  await (0, test_1.expect)(entry.locator("[data-role='count']")).toHaveText(String(expectedCount));
100
+ await (0, test_1.expect)(entry.locator("input[data-role='label']")).toHaveValue(nextLabel);
92
101
  },
93
102
  });
94
103
  const fieldPlans = [
@@ -119,12 +128,13 @@ test_1.test.beforeEach(async ({ page }) => {
119
128
  await waitForFrameworkReady(page, "react");
120
129
  await waitForFrameworkReady(page, "vue");
121
130
  await waitForFrameworkReady(page, "svelte");
131
+ await waitForFrameworkReady(page, "svelte4");
122
132
  await page.waitForFunction("window.testHarness?.ready === true");
123
133
  await page.evaluate(() => window.testHarness?.resetState());
124
134
  });
125
135
  (0, test_1.test)("components load", async ({ page }) => {
126
136
  for (const framework of frameworks) {
127
- await (0, test_1.expect)(page.locator(`.${framework} .title`)).toHaveText(framework);
137
+ await (0, test_1.expect)(page.locator(`.${framework} .title`)).toBeDefined();
128
138
  }
129
139
  });
130
140
  test_1.test.describe("cross framework propagation", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"mockData.d.ts","sourceRoot":"","sources":["../../../../src/test/frontend/utils/mockData.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,SAAS;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE;QACT,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,EAAE,CAAC;KACzB,CAAC;IACF,QAAQ,EAAE,G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AM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB;AA4BD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;EA0BzB,CAAC;AAEH,wBAAgB,qBAAqB,IAAI,YAAY,EAAE,CAEtD;AAED,wBAAgB,iBAAiB,IAAI,SAAS,CAyB7C"}
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
+ // All rights reserved.
4
+ // Licensed under the Apache License, Version 2.0
5
+ // <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
6
+ // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
7
+ // at your option. All files in the project carrying such
8
+ // notice may not be copied, modified, or distributed except
9
+ // according to those terms.
10
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
2
11
  Object.defineProperty(exports, "__esModule", { value: true });
3
12
  exports.mockTestObject = void 0;
4
13
  exports.cloneDefaultObjectSet = cloneDefaultObjectSet;
@@ -6,20 +15,20 @@ exports.buildInitialState = buildInitialState;
6
15
  const buildDefaultObjectSetEntries = () => {
7
16
  const baseEntries = [
8
17
  {
9
- "@id": "urn:object:alpha",
18
+ "@id": "did:ng:x:alpha",
10
19
  label: "Alpha",
11
20
  count: 1,
12
21
  },
13
22
  {
14
- "@id": "urn:object:beta",
23
+ "@id": "did:ng:x:beta",
15
24
  label: "Beta",
16
25
  count: 3,
17
26
  },
18
27
  ];
19
- const extraEntries = Array.from({ length: 298 }, (_, index) => {
28
+ const extraEntries = Array.from({ length: 2 }, (_, index) => {
20
29
  const idNumber = (index + 1).toString().padStart(3, "0");
21
30
  return {
22
- "@id": `urn:object:item-${idNumber}`,
31
+ "@id": `did:ng:x:item-${idNumber}`,
23
32
  label: `Item ${idNumber}`,
24
33
  count: 5 + index,
25
34
  };
@@ -434,7 +434,6 @@ const __1 = require("../..");
434
434
  let x = "";
435
435
  (0, __1.effect)(() => {
436
436
  x = store.join(" ");
437
- console.log("joined", x);
438
437
  });
439
438
  (0, vitest_1.expect)(x).to.equal("foo bar");
440
439
  store.push("baz");
@@ -545,7 +544,7 @@ const __1 = require("../..");
545
544
  });
546
545
  });
547
546
  (0, vitest_1.describe)("refs", () => {
548
- (0, vitest_1.it)("should change if children changed", async () => {
547
+ (0, vitest_1.it)("should change if children changed when replaceProxiesInBranchOnChange", async () => {
549
548
  const signalObj = (0, index_1.deepSignal)({
550
549
  primitive: 1,
551
550
  nestedObject: { primitive: 2 },
@@ -559,7 +558,7 @@ const __1 = require("../..");
559
558
  { "@id": "obj1", primitive: true },
560
559
  { "@id": "obj2", primitive: "false" },
561
560
  ],
562
- });
561
+ }, { replaceProxiesInBranchOnChange: true });
563
562
  // Capture initial references
564
563
  let no = signalObj.nestedObject;
565
564
  let nop = signalObj.nestedObject.primitive;
@@ -736,6 +735,20 @@ const __1 = require("../..");
736
735
  (0, vitest_1.expect)(state[key]).to.equal(true);
737
736
  (0, vitest_1.expect)(x).to.equal(undefined);
738
737
  });
738
+ (0, vitest_1.it)("access well-known symbol property returns raw value and not a signal", () => {
739
+ const tag = Symbol.toStringTag;
740
+ const ds = (0, index_1.deepSignal)({ [tag]: "Custom", x: 1 });
741
+ const val = ds[tag];
742
+ (0, vitest_1.expect)(val).toBe("Custom");
743
+ });
744
+ (0, vitest_1.it)("access Set Symbol.iterator.toString() key path (skip branch)", () => {
745
+ const ds = (0, index_1.deepSignal)({ set: new Set([1]) });
746
+ const iterKey = Symbol.iterator.toString(); // 'Symbol(Symbol.iterator)'
747
+ // Accessing this string property triggers skip branch (no special handling needed)
748
+ const maybe = ds.set[iterKey];
749
+ // underlying Set likely has undefined for that string key
750
+ (0, vitest_1.expect)(maybe).toBeUndefined();
751
+ });
739
752
  });
740
753
  (0, vitest_1.describe)("shallow", () => {
741
754
  (0, vitest_1.it)("should not proxy shallow objects", () => {
@@ -59,7 +59,7 @@ const watch_1 = require("../../watch");
59
59
  stop();
60
60
  });
61
61
  });
62
- (0, vitest_1.describe)("tier3: Set iteration variants", () => {
62
+ (0, vitest_1.describe)("Set iteration variants", () => {
63
63
  (0, vitest_1.it)("entries() iteration proxies nested mutation", async () => {
64
64
  const st = (0, deepSignal_1.deepSignal)({ s: new Set() }, {
65
65
  syntheticIdPropertyName: "id",
@@ -138,3 +138,106 @@ const watch_1 = require("../../watch");
138
138
  stop();
139
139
  });
140
140
  });
141
+ (0, vitest_1.describe)("external subscribers", () => {
142
+ (0, vitest_1.it)("onGet / onSet are called for basic types", () => {
143
+ const onGet = vitest_1.vi.fn(() => { });
144
+ const onSet = vitest_1.vi.fn(() => { });
145
+ const ds = (0, deepSignal_1.deepSignal)({
146
+ s1: "str",
147
+ o1: {
148
+ i1: 1,
149
+ b1: false,
150
+ },
151
+ }, { subscriberFactories: new Set([() => ({ onGet, onSet })]) });
152
+ let setCount = 0;
153
+ let getCount = 0;
154
+ ds.o1;
155
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
156
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes(setCount);
157
+ ds.o1.b1;
158
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
159
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes(setCount);
160
+ ds.s1 = "new string";
161
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes(getCount);
162
+ // We didn't track s1 yet so set won't be called.
163
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes(setCount);
164
+ ds.s1;
165
+ ds.s1 = "new string2";
166
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
167
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
168
+ ds.o1 = { b1: true, i1: 2 };
169
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes(getCount);
170
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
171
+ });
172
+ (0, vitest_1.it)("onGet / onSet are called for sets", () => {
173
+ const onGet = vitest_1.vi.fn(() => {
174
+ // No op
175
+ let a;
176
+ });
177
+ const onSet = vitest_1.vi.fn(() => {
178
+ // no op
179
+ let a;
180
+ });
181
+ const createSubscriber = vitest_1.vi.fn(() => ({ onGet, onSet }));
182
+ const ds = (0, deepSignal_1.deepSignal)({
183
+ set1: new Set([{ s1: "s1 in set" }]),
184
+ set2: new Set([1, 2, 3]),
185
+ }, { subscriberFactories: new Set([createSubscriber]) });
186
+ let setCount = 0;
187
+ let getCount = 0;
188
+ ds.set1.first().s1;
189
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 3));
190
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
191
+ ds.set1.first().s1 = "s1 new value";
192
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
193
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
194
+ ds.set1.add({ s1: "s1.2 in set" });
195
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
196
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
197
+ ds.set2.size; // Track.
198
+ ds.set2.delete(2);
199
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 4));
200
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
201
+ ds.set2.delete(2);
202
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
203
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
204
+ ds.set2.add(4);
205
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
206
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
207
+ ds.set2.add(4);
208
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
209
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
210
+ (0, vitest_1.expect)(ds.set2.has(4)).toBe(true);
211
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
212
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
213
+ const isDisjoint = ds.set2.isDisjointFrom(new Set([8]));
214
+ (0, vitest_1.expect)(isDisjoint).toBe(true);
215
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
216
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
217
+ (0, vitest_1.expect)(ds.set1.size).toBe(2);
218
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
219
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
220
+ (0, vitest_1.expect)(ds.set1.getById("")).toBe(undefined);
221
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
222
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
223
+ ds.set2.clear();
224
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
225
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 1));
226
+ ds.set2.clear();
227
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 1));
228
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
229
+ let counter = 0;
230
+ for (const _item of ds.set1) {
231
+ counter += 1;
232
+ }
233
+ (0, vitest_1.expect)(counter).toBe(2);
234
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 2));
235
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
236
+ let concatenated = ds.set1.reduce((previous, current) => {
237
+ return `${previous}_${current.s1}`;
238
+ }, "");
239
+ (0, vitest_1.expect)(concatenated).toBe("_s1 new value_s1.2 in set");
240
+ (0, vitest_1.expect)(onGet).toHaveBeenCalledTimes((getCount += 4));
241
+ (0, vitest_1.expect)(onSet).toHaveBeenCalledTimes((setCount += 0));
242
+ });
243
+ });
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const vitest_1 = require("vitest");
13
13
  const __1 = require("../../");
14
14
  const watch_1 = require("../../watch");
15
- const effect_1 = require("../../effect");
15
+ const deepSignal_1 = require("../../deepSignal");
16
16
  (0, vitest_1.describe)("watch", () => {
17
17
  (0, vitest_1.it)("watch immediate", () => {
18
18
  const store = (0, __1.deepSignal)({
@@ -83,15 +83,6 @@ const effect_1 = require("../../effect");
83
83
  (0, vitest_1.expect)(versions.length).toBe(1);
84
84
  (0, vitest_1.expect)(versions[0]).toBeGreaterThan(0);
85
85
  });
86
- (0, vitest_1.it)("effect runs and cleans up", () => {
87
- const calls = [];
88
- const dispose = (0, effect_1.effect)((registerCleanup) => {
89
- calls.push("run");
90
- registerCleanup?.(() => calls.push("cleanup"));
91
- });
92
- dispose();
93
- (0, vitest_1.expect)(calls).toEqual(["run", "cleanup"]);
94
- });
95
86
  });
96
87
  (0, vitest_1.describe)("watch (patch mode)", () => {
97
88
  (0, vitest_1.it)("emits set patches with correct paths and batching", async () => {
@@ -568,7 +559,7 @@ const effect_1 = require("../../effect");
568
559
  (0, vitest_1.it)("setSetEntrySyntheticId applies custom id without helper", async () => {
569
560
  const st = (0, __1.deepSignal)({ s: new Set() });
570
561
  const obj = { name: "x" };
571
- (0, __1.setSetEntrySyntheticId)(obj, "customX");
562
+ (0, deepSignal_1.setSetEntrySyntheticId)(obj, "customX");
572
563
  const patches = [];
573
564
  const { stopListening: stop } = (0, watch_1.watch)(st, ({ patches: batch }) => patches.push(batch));
574
565
  st.s.add(obj);
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { computed, signal } from "./core";
1
+ import { computed, alienSignal } from "./core";
2
2
  /** Deep mutation emitted from a deepSignal root. */
3
3
  export type DeepPatch = {
4
4
  path: (string | number)[];
@@ -16,25 +16,92 @@ export interface DeepPatchBatch {
16
16
  version: number;
17
17
  patches: DeepPatch[];
18
18
  }
19
- /** Batched patch payload for justInTime listeners. */
19
+ /** @ignore Batched patch payload for justInTime listeners. */
20
20
  export interface DeepPatchJITBatch {
21
21
  patches: DeepPatch[];
22
22
  }
23
+ /** @ignore */
23
24
  export type DeepPatchSubscriber = (batch: DeepPatchBatch) => void;
25
+ /** @ignore */
24
26
  export type DeepPatchJITSubscriber = (batch: DeepPatchJITBatch) => void;
27
+ /**
28
+ * Options to pass to {@link deepSignal}
29
+ * @internal
30
+ */
25
31
  export interface DeepSignalOptions {
32
+ /**
33
+ * An optional function that is called when new objects are attached and
34
+ * that may return additional properties to be attached.
35
+ */
26
36
  propGenerator?: DeepSignalPropGenFn;
37
+ /**
38
+ * The property name which should be used as an object identifier in sets.
39
+ * You will see it when patches are generated with a path to an object in a set.
40
+ * The `syntheticId` will be a patch element then.
41
+ * Objects with existing properties matching `syntheticIdPropertyName` keep their values (not overwritten).
42
+ */
27
43
  syntheticIdPropertyName?: string;
44
+ /**
45
+ * Optional: Properties that are made read-only in objects.
46
+ * Can only be attached by propGenerator or must already be member
47
+ * of the new object before attaching it.
48
+ */
28
49
  readOnlyProps?: string[];
50
+ /**
51
+ * If set to `true`, all proxies in the branch to a modified nested property are replaced.
52
+ * This has no effect except for equality checks (===). This is necessary for react to notice the change.
53
+ * @default false
54
+ */
55
+ replaceProxiesInBranchOnChange?: boolean;
56
+ subscriberFactories?: Set<ExternalSubscriberFactory>;
29
57
  }
58
+ export type ExternalSubscriberFactory<T = any> = () => {
59
+ onGet: () => void;
60
+ onSet: (newVal: T) => void;
61
+ };
62
+ /**
63
+ * @internal
64
+ *
65
+ * The `propGenerator` function is called when a new object is added to the deep signal tree.
66
+ * @example
67
+ * ```ts
68
+ * let counter = 0;
69
+ * const state = deepSignal(
70
+ * { items: new Set() },
71
+ * {
72
+ * propGenerator: ({ path, inSet, object }) => ({
73
+ * syntheticId: inSet
74
+ * ? `urn:item:${++counter}`
75
+ * : `urn:obj:${path.join("-")}`,
76
+ * extraProps: { createdAt: new Date().toISOString() },
77
+ * }),
78
+ * syntheticIdPropertyName: "@id",
79
+ * }
80
+ * );
81
+ *
82
+ * state.items.add({ name: "Item 1" });
83
+ * // Attaches `{ name: "Item 1", `@id`: "urn:item:1", createdAt: <current date>`
84
+ *
85
+ * state.foo = {bar: 42};
86
+ * // Attaches `{bar: 42, "@id": "urn:obj:foo", createdAt: <current date>}`
87
+ * ```
88
+ */
30
89
  export type DeepSignalPropGenFn = (props: {
90
+ /**
91
+ * The path of the newly added object.
92
+ */
31
93
  path: (string | number)[];
94
+ /** Whether the object is being added to a Set (true) or not (false) */
32
95
  inSet: boolean;
96
+ /** The newly added object itself */
33
97
  object: any;
34
98
  }) => {
99
+ /** A custom identifier for the object (used in Set entry paths and optionally as a property). */
35
100
  syntheticId?: string | number;
101
+ /** Additional properties to be added to the object (overwriting existing ones). */
36
102
  extraProps?: Record<string, unknown>;
37
103
  };
104
+ /**@ignore*/
38
105
  export interface ProxyMeta {
39
106
  raw: object;
40
107
  parent?: ProxyMeta;
@@ -44,10 +111,12 @@ export interface ProxyMeta {
44
111
  options: DeepSignalOptions;
45
112
  setInfo?: SetMeta;
46
113
  }
114
+ /** @hidden */
47
115
  export interface SetMeta {
48
116
  idForObject: WeakMap<object, string>;
49
117
  objectForId: Map<string, object>;
50
118
  }
119
+ /**@ignore*/
51
120
  export interface RootState {
52
121
  options?: DeepSignalOptions;
53
122
  version: number;
@@ -55,14 +124,15 @@ export interface RootState {
55
124
  listeners: Set<DeepPatchSubscriber>;
56
125
  pendingPatches: DeepPatch[];
57
126
  }
58
- type WritableSignalFunction<T> = typeof signal<T>;
59
- type ComputedSignalFunction<T> = typeof computed<T>;
60
- export type WritableSignal<T = any> = ReturnType<WritableSignalFunction<T>>;
61
- export type ComputedSignal<T = any> = ReturnType<ComputedSignalFunction<T>>;
127
+ /** @ignore */
128
+ export type WritableSignal<T = any> = ReturnType<typeof alienSignal<T>>;
129
+ export type ComputedSignal<T = any> = ReturnType<typeof computed<T>>;
62
130
  export type SignalLike<T = any> = WritableSignal<T> | ComputedSignal<T>;
63
- /** Raw and meta key. */
131
+ /** @ignore Raw and meta key. */
64
132
  export type DeepSignalObjectProps<T> = {
133
+ /** The original raw object. */
65
134
  __raw__: T;
135
+ /** @ignore meta information */
66
136
  __meta__: ProxyMeta;
67
137
  };
68
138
  /** Utility functions for sets. */
@@ -70,21 +140,24 @@ export type DeepSignalSetProps<T> = {
70
140
  /** Get the element that was first inserted into the set. */
71
141
  first(): undefined | (T extends object ? DeepSignal<T> : T);
72
142
  /**
73
- * Retrieve an entry from the Set by its synthetic ID.
143
+ * Retrieve an entry from the Set by its synthetic set ID.
74
144
  * @param id - The synthetic ID (string or number) assigned to the entry.
75
145
  * @returns The proxied entry if found, undefined otherwise.
76
146
  */
77
147
  getById(id: string | number): DeepSignal<T> | undefined;
78
148
  /**
79
- * Retrieve an entry from the Set by constructing an ID from graphIri and subjectIri.
80
- * This is a convenience method that constructs the ID as "graphIri|subjectIri".
81
- * @param graphIri - The graph IRI part of the identifier.
82
- * @param subjectIri - The subject IRI part of the identifier.
149
+ * Retrieve an object from the Set by its `@graph` and `@id`.
150
+ *
151
+ * @param graphIri - The `@graph` NURI of the object.
152
+ * @param subjectIri - The `@subject` IRI of the object.
83
153
  * @returns The proxied entry if found, undefined otherwise.
84
154
  */
85
155
  getBy(graphIri: string, subjectIri: string): DeepSignal<T> | undefined;
86
156
  };
87
- /** Reactive Set wrapper that accepts raw or proxied entries. */
157
+ /**
158
+ * Type alias for `DeepSignal<Set<T>>` and reactive Set wrapper that accepts raw or proxied entries.
159
+ * Additionally it is decorated with {@link DeepSignalSetProps}.
160
+ */
88
161
  export interface DeepSignalSet<T> extends Set<DeepSignal<T>>, DeepSignalObjectProps<Set<T>>, SetIterator<DeepSignal<T>>, DeepSignalSetProps<T> {
89
162
  add(value: T | DeepSignal<T>): this;
90
163
  delete(value: T | DeepSignal<T>): boolean;
@@ -93,15 +166,17 @@ export interface DeepSignalSet<T> extends Set<DeepSignal<T>>, DeepSignalObjectPr
93
166
  forEach(callbackfn: (value: DeepSignal<T>, index: number) => void, thisArg?: any): void;
94
167
  }
95
168
  /**
96
- * The object returned by the @see deepSignal function.
97
- * It is decorated with utility functions for sets and a
98
- * `__raw__` prop to get the underlying non-reactive object
99
- * and `__meta__` prop, to get the internal metadata.
169
+ * The object returned by the {@link deepSignal} function.
170
+ * It is decorated with utility functions for sets, see {@link DeepSignalSetProps}
171
+ * and a `__raw__` prop to get the underlying non-reactive object.
100
172
  */
101
173
  export type DeepSignal<T> = T extends Function ? T : T extends string | number | boolean ? T : T extends DeepSignalObjectProps<any> | DeepSignalObjectProps<any>[] ? T : T extends Array<infer I> ? DeepSignal<I>[] : T extends Set<infer S> ? DeepSignalSet<S> : T extends object ? DeepSignalObject<T> : T;
102
174
  export type DeepSignalObject<T extends object> = {
103
175
  [K in keyof T]: DeepSignal<T[K]>;
104
176
  };
105
- export type RevertDeepSignal<T> = T extends DeepSignal<infer S> ? S : T;
106
- export {};
177
+ export type UnwrapDeepSignal<T> = T extends DeepSignal<infer S> ? S : T;
178
+ /** Union allowing a plain value or a writable signal wrapping that value. */
179
+ export type MaybeSignal<T = any> = T | ReturnType<typeof alienSignal>;
180
+ /** Union allowing value, writable signal, computed signal or plain getter function. */
181
+ export type MaybeSignalOrComputed<T = any> = MaybeSignal<T> | (() => T);
107
182
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,oDAAoD;AACpD,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC7B,GAAG,CACE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAAC,KA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AM,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,QAAQ,GACxC,CAAC,GACD,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GACjC,CAAC,GACD,CAAC,SAAS,qBAAqB,CAAC,GAAG,CAAC,GAAG,qBAAqB,CAAC,GAAG,CAAC,EAAE,GACjE,CAAC,GACD,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,GACtB,UAAU,CAAC,CAAC,CAAC,EAAE,GACf,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,GACpB,aAAa,CAAC,CAAC,CAAC,GAChB,CAAC,SAAS,MAAM,GACd,gBAAgB,CAAC,CAAC,CAAC,GACnB,CAAC,CAAC;AAElB,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;KAC5C,CAAC,IAAI,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAExE,6EAA6E;AAC7E,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AACtE,uFAAuF;AACvF,MAAM,MAAM,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -1,2 +1,11 @@
1
1
  "use strict";
2
+ // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
+ // All rights reserved.
4
+ // Licensed under the Apache License, Version 2.0
5
+ // <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
6
+ // or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
7
+ // at your option. All files in the project carrying such
8
+ // notice may not be copied, modified, or distributed except
9
+ // according to those terms.
10
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
2
11
  Object.defineProperty(exports, "__esModule", { value: true });