@ng-org/alien-deepsignals 0.1.2-alpha.1

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 (47) hide show
  1. package/README.md +476 -0
  2. package/dist/contents.d.ts +6 -0
  3. package/dist/contents.d.ts.map +1 -0
  4. package/dist/contents.js +18 -0
  5. package/dist/core.d.ts +75 -0
  6. package/dist/core.d.ts.map +1 -0
  7. package/dist/core.js +113 -0
  8. package/dist/deepSignal.d.ts +26 -0
  9. package/dist/deepSignal.d.ts.map +1 -0
  10. package/dist/deepSignal.js +916 -0
  11. package/dist/effect.d.ts +5 -0
  12. package/dist/effect.d.ts.map +1 -0
  13. package/dist/effect.js +35 -0
  14. package/dist/hooks/react/index.d.ts +3 -0
  15. package/dist/hooks/react/index.d.ts.map +1 -0
  16. package/dist/hooks/react/index.js +8 -0
  17. package/dist/hooks/react/useDeepSignal.d.ts +14 -0
  18. package/dist/hooks/react/useDeepSignal.d.ts.map +1 -0
  19. package/dist/hooks/react/useDeepSignal.js +39 -0
  20. package/dist/hooks/svelte/index.d.ts +4 -0
  21. package/dist/hooks/svelte/index.d.ts.map +1 -0
  22. package/dist/hooks/svelte/index.js +8 -0
  23. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts +31 -0
  24. package/dist/hooks/svelte/useDeepSignal.svelte.d.ts.map +1 -0
  25. package/dist/hooks/svelte/useDeepSignal.svelte.js +74 -0
  26. package/dist/hooks/vue/index.d.ts +3 -0
  27. package/dist/hooks/vue/index.d.ts.map +1 -0
  28. package/dist/hooks/vue/index.js +8 -0
  29. package/dist/hooks/vue/useDeepSignal.d.ts +15 -0
  30. package/dist/hooks/vue/useDeepSignal.d.ts.map +1 -0
  31. package/dist/hooks/vue/useDeepSignal.js +73 -0
  32. package/dist/index.d.ts +6 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.js +21 -0
  35. package/dist/iteratorHelpers.d.ts +3 -0
  36. package/dist/iteratorHelpers.d.ts.map +1 -0
  37. package/dist/iteratorHelpers.js +38 -0
  38. package/dist/types.d.ts +107 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +2 -0
  41. package/dist/utils.d.ts +17 -0
  42. package/dist/utils.d.ts.map +1 -0
  43. package/dist/utils.js +47 -0
  44. package/dist/watch.d.ts +27 -0
  45. package/dist/watch.d.ts.map +1 -0
  46. package/dist/watch.js +72 -0
  47. package/package.json +84 -0
@@ -0,0 +1,5 @@
1
+ type RegisterCleanup = (cleanup: () => void) => void;
2
+ /** Wrap `alien-signals` effect with optional cleanup registration. */
3
+ export declare function effect(run: (registerCleanup?: RegisterCleanup) => void): () => void;
4
+ export {};
5
+ //# sourceMappingURL=effect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effect.d.ts","sourceRoot":"","sources":["../src/effect.ts"],"names":[],"mappings":"AAKA,KAAK,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;AAErD,sEAAsE;AACtE,wBAAgB,MAAM,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,EAAE,eAAe,KAAK,IAAI,cA2BtE"}
package/dist/effect.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ // Copyright (c) 2025 Laurin Weger, Par le Peuple, NextGraph.org developers
3
+ // SPDX-License-Identifier: Apache-2.0 OR MIT
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.effect = effect;
6
+ const core_1 = require("./core");
7
+ /** Wrap `alien-signals` effect with optional cleanup registration. */
8
+ function effect(run) {
9
+ let cleanup;
10
+ const registerCleanup = (fn) => {
11
+ cleanup = fn;
12
+ };
13
+ const stop = (0, core_1._rawEffect)(() => {
14
+ if (cleanup) {
15
+ try {
16
+ cleanup();
17
+ }
18
+ finally {
19
+ cleanup = undefined;
20
+ }
21
+ }
22
+ run(registerCleanup);
23
+ });
24
+ return () => {
25
+ if (cleanup) {
26
+ try {
27
+ cleanup();
28
+ }
29
+ finally {
30
+ cleanup = undefined;
31
+ }
32
+ }
33
+ stop();
34
+ };
35
+ }
@@ -0,0 +1,3 @@
1
+ import useDeepSignal from "./useDeepSignal.js";
2
+ export { useDeepSignal };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/react/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeepSignal = void 0;
7
+ const useDeepSignal_js_1 = __importDefault(require("./useDeepSignal.js"));
8
+ exports.useDeepSignal = useDeepSignal_js_1.default;
@@ -0,0 +1,14 @@
1
+ import { DeepSignalOptions } from "../../types.js";
2
+ /**
3
+ * Create or use an existing deepSignal object in your component.
4
+ * Modifications to the returned deepSignal object cause an immediate rerender.
5
+ * If modifications of the object are made from somewhere else, the component
6
+ * is rerendered as well.
7
+ *
8
+ * @param object The object that should become reactive
9
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
10
+ * @returns The deepSignal object of the object param.
11
+ */
12
+ declare const useSignal: <T extends object>(object: T, deepSignalObjects?: DeepSignalOptions) => import("../../types.js").DeepSignal<T>;
13
+ export default useSignal;
14
+ //# sourceMappingURL=useDeepSignal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeepSignal.d.ts","sourceRoot":"","sources":["../../../src/hooks/react/useDeepSignal.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;;GASG;AACH,QAAA,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,EAC/B,QAAQ,CAAC,EACT,oBAAoB,iBAAiB,2CAqBxC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,39 @@
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
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const watch_js_1 = require("../../watch.js");
13
+ const react_1 = require("react");
14
+ const deepSignal_1 = require("../../deepSignal");
15
+ /**
16
+ * Create or use an existing deepSignal object in your component.
17
+ * Modifications to the returned deepSignal object cause an immediate rerender.
18
+ * If modifications of the object are made from somewhere else, the component
19
+ * is rerendered as well.
20
+ *
21
+ * @param object The object that should become reactive
22
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
23
+ * @returns The deepSignal object of the object param.
24
+ */
25
+ const useSignal = (object, deepSignalObjects) => {
26
+ const shapeSignalRef = (0, react_1.useRef)((0, deepSignal_1.deepSignal)(object, deepSignalObjects));
27
+ const [, setTick] = (0, react_1.useState)(0);
28
+ (0, react_1.useEffect)(() => {
29
+ const { stopListening } = (0, watch_js_1.watch)(shapeSignalRef.current, () => {
30
+ // trigger a React re-render when the deep signal updates
31
+ setTick((t) => t + 1);
32
+ }, { triggerInstantly: true });
33
+ return () => {
34
+ stopListening();
35
+ };
36
+ }, []);
37
+ return shapeSignalRef.current;
38
+ };
39
+ exports.default = useSignal;
@@ -0,0 +1,4 @@
1
+ import useDeepSignal from "./useDeepSignal.svelte.js";
2
+ export { useDeepSignal };
3
+ export type { UseDeepSignalResult } from "./useDeepSignal.svelte.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/svelte/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeepSignal = void 0;
7
+ const useDeepSignal_svelte_js_1 = __importDefault(require("./useDeepSignal.svelte.js"));
8
+ exports.useDeepSignal = useDeepSignal_svelte_js_1.default;
@@ -0,0 +1,31 @@
1
+ import { type Readable } from "svelte/store";
2
+ import { type DeepPatchBatch, DeepSignalOptions, RevertDeepSignal } from "../../index";
3
+ /** Base result contract for a deepSignal-backed Svelte integration. */
4
+ export interface UseDeepSignalResult<T extends object> extends Readable<T> {
5
+ /** Store of the full deep proxy tree (also accessible via `subscribe` directly on this result). */
6
+ deep: Readable<T>;
7
+ /** Last batch of deep mutation patches for this root (empties only on next non-empty batch). */
8
+ patches: Readable<DeepPatchBatch | null>;
9
+ /** Derive a nested selection; re-runs when the underlying tree version increments. */
10
+ select<U>(selector: (tree: T) => U): Readable<U>;
11
+ /** Stop receiving further updates (invoked automatically on component destroy). */
12
+ dispose(): void;
13
+ /** Replace root shape contents (mutative merge) – enables Svelte writable store binding semantics. */
14
+ set(next: Partial<T> | T): void;
15
+ /** Functional update helper using current tree snapshot. */
16
+ update(updater: (current: T) => T | void): void;
17
+ }
18
+ /**
19
+ * Create a rune from a deepSignal object (creates one if it is just a regular object).
20
+ *
21
+ * Modifications to the returned deepSignal object cause an immediate rerender.
22
+ * If modifications of the object are made from somewhere else, the component
23
+ * is rerendered as well.
24
+ *
25
+ * @param object The object that should become reactive
26
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
27
+ * @returns A rune for using the deepSignal object in svelte.
28
+ */
29
+ export declare function useDeepSignal<T extends object>(object: T, options?: DeepSignalOptions): UseDeepSignalResult<RevertDeepSignal<T>>;
30
+ export default useDeepSignal;
31
+ //# sourceMappingURL=useDeepSignal.svelte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeepSignal.svelte.d.ts","sourceRoot":"","sources":["../../../src/hooks/svelte/useDeepSignal.svelte.ts"],"names":[],"mappings":"AAUA,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAGH,KAAK,cAAc,EACnB,iBAAiB,EAEjB,gBAAgB,EAEnB,MAAM,aAAa,CAAC;AAErB,uEAAuE;AACvE,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACtE,mGAAmG;IACnG,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClB,gGAAgG;IAChG,OAAO,EAAE,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACzC,sFAAsF;IACtF,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACjD,mFAAmF;IACnF,OAAO,IAAI,IAAI,CAAC;IAChB,sGAAsG;IACtG,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IAChC,4DAA4D;IAC5D,MAAM,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;CACnD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC1C,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,iBAAiB,GAC5B,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAiD1C;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,74 @@
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
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useDeepSignal = useDeepSignal;
13
+ const store_1 = require("svelte/store");
14
+ const svelte_1 = require("svelte");
15
+ const index_1 = require("../../index");
16
+ /**
17
+ * Create a rune from a deepSignal object (creates one if it is just a regular object).
18
+ *
19
+ * Modifications to the returned deepSignal object cause an immediate rerender.
20
+ * If modifications of the object are made from somewhere else, the component
21
+ * is rerendered as well.
22
+ *
23
+ * @param object The object that should become reactive
24
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
25
+ * @returns A rune for using the deepSignal object in svelte.
26
+ */
27
+ function useDeepSignal(object, options) {
28
+ const deepProxy = (0, index_1.deepSignal)(object, options);
29
+ const rootId = (0, index_1.getDeepSignalRootId)(deepProxy);
30
+ const initialVersion = (0, index_1.getDeepSignalVersion)(deepProxy) ?? 0;
31
+ const version = (0, store_1.writable)(initialVersion);
32
+ const patchesStore = (0, store_1.writable)(null);
33
+ const unsubscribe = (0, index_1.subscribeDeepMutations)(deepProxy, (batch) => {
34
+ if (!rootId)
35
+ return;
36
+ if (batch.patches.length) {
37
+ patchesStore.set(batch);
38
+ version.set(batch.version);
39
+ }
40
+ });
41
+ const deep = (0, store_1.derived)(version, () => deepProxy);
42
+ const select = (selector) => (0, store_1.derived)(deep, (t) => selector(t));
43
+ const dispose = () => unsubscribe();
44
+ (0, svelte_1.onDestroy)(dispose);
45
+ // Expose Svelte store contract by delegating subscribe to deep store.
46
+ const applyReplacement = (next) => {
47
+ if (!next || typeof next !== "object")
48
+ return;
49
+ // Remove keys absent in next
50
+ for (const k of Object.keys(deepProxy)) {
51
+ if (!(k in next))
52
+ delete deepProxy[k];
53
+ }
54
+ // Assign / overwrite provided keys
55
+ Object.assign(deepProxy, next);
56
+ };
57
+ const store = {
58
+ deep,
59
+ patches: patchesStore,
60
+ select,
61
+ dispose,
62
+ subscribe: deep.subscribe,
63
+ set(next) {
64
+ applyReplacement(next);
65
+ },
66
+ update(updater) {
67
+ const result = updater(deepProxy);
68
+ if (result && typeof result === "object")
69
+ applyReplacement(result);
70
+ },
71
+ };
72
+ return store;
73
+ }
74
+ exports.default = useDeepSignal;
@@ -0,0 +1,3 @@
1
+ import useDeepSignal from "./useDeepSignal";
2
+ export { useDeepSignal };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/vue/index.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.useDeepSignal = void 0;
7
+ const useDeepSignal_1 = __importDefault(require("./useDeepSignal"));
8
+ exports.useDeepSignal = useDeepSignal_1.default;
@@ -0,0 +1,15 @@
1
+ import { DeepSignal, DeepSignalOptions } from "../../";
2
+ /**
3
+ * Create or use an existing deepSignal object in your component.
4
+ * Modifications to the returned deepSignal object cause an immediate rerender.
5
+ * If modifications of the object are made from somewhere else, the component
6
+ * is rerendered as well.
7
+ *
8
+ * @param object The object that should become reactive
9
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
10
+ * @returns The deepSignal object of the object param.
11
+ *
12
+ */
13
+ export declare function useDeepSignal<T extends object>(object: T, options?: DeepSignalOptions): DeepSignal<T>;
14
+ export default useDeepSignal;
15
+ //# sourceMappingURL=useDeepSignal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDeepSignal.d.ts","sourceRoot":"","sources":["../../../src/hooks/vue/useDeepSignal.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAc,iBAAiB,EAAS,MAAM,QAAQ,CAAC;AAE1E;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAC1C,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,iBAAiB,GAC5B,UAAU,CAAC,CAAC,CAAC,CAgDf;AAED,eAAe,aAAa,CAAC"}
@@ -0,0 +1,73 @@
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
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useDeepSignal = useDeepSignal;
13
+ const vue_1 = require("vue");
14
+ const __1 = require("../../");
15
+ /**
16
+ * Create or use an existing deepSignal object in your component.
17
+ * Modifications to the returned deepSignal object cause an immediate rerender.
18
+ * If modifications of the object are made from somewhere else, the component
19
+ * is rerendered as well.
20
+ *
21
+ * @param object The object that should become reactive
22
+ * @param deepSignalObjects When the object is not a deepSignal already, options passed to `deepSignal`.
23
+ * @returns The deepSignal object of the object param.
24
+ *
25
+ */
26
+ function useDeepSignal(object, options) {
27
+ const version = (0, vue_1.ref)(0);
28
+ const signalObject = (0, __1.deepSignal)(object, options);
29
+ const stopHandle = (0, __1.watch)(signalObject, ({ patches }) => {
30
+ if (patches.length > 0) {
31
+ version.value++;
32
+ }
33
+ });
34
+ // Proxy that creates Vue dependency on version for any access
35
+ const proxy = new Proxy(signalObject, {
36
+ get(target, key) {
37
+ if (key === "__raw")
38
+ return target;
39
+ // Track version to create reactive dependency
40
+ version.value;
41
+ const value = target[key];
42
+ // Bind methods to maintain correct `this` context
43
+ return typeof value === "function" ? value.bind(target) : value;
44
+ },
45
+ set(target, key, value) {
46
+ // Directly forward writes to the deep signal root so other frameworks observe the change.
47
+ return Reflect.set(target, key, value);
48
+ },
49
+ has(target, key) {
50
+ version.value;
51
+ return key in target;
52
+ },
53
+ ownKeys(target) {
54
+ version.value;
55
+ return Reflect.ownKeys(target);
56
+ },
57
+ getOwnPropertyDescriptor(target, key) {
58
+ version.value;
59
+ const desc = Object.getOwnPropertyDescriptor(target, key);
60
+ return desc ? { ...desc, configurable: true } : undefined;
61
+ },
62
+ });
63
+ (0, vue_1.onBeforeUnmount)(() => {
64
+ try {
65
+ stopHandle.stopListening();
66
+ }
67
+ catch {
68
+ // ignore
69
+ }
70
+ });
71
+ return proxy;
72
+ }
73
+ exports.default = useDeepSignal;
@@ -0,0 +1,6 @@
1
+ export * from "./deepSignal";
2
+ export * from "./core";
3
+ export * from "./watch";
4
+ export * from "./effect";
5
+ export * from "./types";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./deepSignal"), exports);
18
+ __exportStar(require("./core"), exports);
19
+ __exportStar(require("./watch"), exports);
20
+ __exportStar(require("./effect"), exports);
21
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,3 @@
1
+ export declare const iteratorHelperKeys: Set<string>;
2
+ export declare function createIteratorWithHelpers<T>(nextImpl: () => IteratorResult<T, undefined>, sourceIterator?: Iterator<unknown, unknown, undefined>): IteratorObject<T, undefined, unknown>;
3
+ //# sourceMappingURL=iteratorHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iteratorHelpers.d.ts","sourceRoot":"","sources":["../src/iteratorHelpers.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,aAY7B,CAAC;AAEH,wBAAgB,yBAAyB,CAAC,CAAC,EACvC,QAAQ,EAAE,MAAM,cAAc,CAAC,CAAC,EAAE,SAAS,CAAC,EAC5C,cAAc,CAAC,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,GACvD,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAmBvC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.iteratorHelperKeys = void 0;
4
+ exports.createIteratorWithHelpers = createIteratorWithHelpers;
5
+ function hasNativeIteratorHelpers() {
6
+ return (typeof Iterator !== "undefined" && typeof Iterator.from === "function");
7
+ }
8
+ exports.iteratorHelperKeys = new Set([
9
+ "map",
10
+ "filter",
11
+ "take",
12
+ "drop",
13
+ "flatMap",
14
+ "reduce",
15
+ "toArray",
16
+ "forEach",
17
+ "some",
18
+ "every",
19
+ "find",
20
+ ]);
21
+ function createIteratorWithHelpers(nextImpl, sourceIterator) {
22
+ const base = {
23
+ next: nextImpl,
24
+ [Symbol.iterator]() {
25
+ return this;
26
+ },
27
+ return() {
28
+ if (sourceIterator && typeof sourceIterator.return === "function") {
29
+ sourceIterator.return();
30
+ }
31
+ return { value: undefined, done: true };
32
+ },
33
+ };
34
+ if (hasNativeIteratorHelpers()) {
35
+ return Iterator.from(base);
36
+ }
37
+ return base;
38
+ }
@@ -0,0 +1,107 @@
1
+ import { computed, signal } from "./core";
2
+ /** Deep mutation emitted from a deepSignal root. */
3
+ export type DeepPatch = {
4
+ path: (string | number)[];
5
+ } & ({
6
+ op: "add";
7
+ type?: "object" | "set";
8
+ value?: any;
9
+ } | {
10
+ op: "remove";
11
+ type?: "set";
12
+ value?: any;
13
+ });
14
+ /** Batched patch payload tagged with a monotonically increasing version. */
15
+ export interface DeepPatchBatch {
16
+ version: number;
17
+ patches: DeepPatch[];
18
+ }
19
+ /** Batched patch payload for justInTime listeners. */
20
+ export interface DeepPatchJITBatch {
21
+ patches: DeepPatch[];
22
+ }
23
+ export type DeepPatchSubscriber = (batch: DeepPatchBatch) => void;
24
+ export type DeepPatchJITSubscriber = (batch: DeepPatchJITBatch) => void;
25
+ export interface DeepSignalOptions {
26
+ propGenerator?: DeepSignalPropGenFn;
27
+ syntheticIdPropertyName?: string;
28
+ readOnlyProps?: string[];
29
+ }
30
+ export type DeepSignalPropGenFn = (props: {
31
+ path: (string | number)[];
32
+ inSet: boolean;
33
+ object: any;
34
+ }) => {
35
+ syntheticId?: string | number;
36
+ extraProps?: Record<string, unknown>;
37
+ };
38
+ export interface ProxyMeta {
39
+ raw: object;
40
+ parent?: object;
41
+ key?: string | number | symbol;
42
+ isSyntheticId?: boolean;
43
+ root: symbol;
44
+ options: DeepSignalOptions;
45
+ setInfo?: SetMeta;
46
+ }
47
+ export interface SetMeta {
48
+ idForObject: WeakMap<object, string>;
49
+ objectForId: Map<string, object>;
50
+ }
51
+ export interface RootState {
52
+ options?: DeepSignalOptions;
53
+ version: number;
54
+ justInTimeListeners: Set<DeepPatchJITSubscriber>;
55
+ listeners: Set<DeepPatchSubscriber>;
56
+ pendingPatches: DeepPatch[];
57
+ }
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>>;
62
+ export type SignalLike<T = any> = WritableSignal<T> | ComputedSignal<T>;
63
+ /** Raw and meta key. */
64
+ export type DeepSignalObjectProps<T> = {
65
+ __raw__: T;
66
+ __meta__: ProxyMeta;
67
+ };
68
+ /** Utility functions for sets. */
69
+ export type DeepSignalSetProps<T> = {
70
+ /** Get the element that was first inserted into the set. */
71
+ first(): undefined | (T extends object ? DeepSignal<T> : T);
72
+ /**
73
+ * Retrieve an entry from the Set by its synthetic ID.
74
+ * @param id - The synthetic ID (string or number) assigned to the entry.
75
+ * @returns The proxied entry if found, undefined otherwise.
76
+ */
77
+ getById(id: string | number): DeepSignal<T> | undefined;
78
+ /**
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.
83
+ * @returns The proxied entry if found, undefined otherwise.
84
+ */
85
+ getBy(graphIri: string, subjectIri: string): DeepSignal<T> | undefined;
86
+ };
87
+ /** Reactive Set wrapper that accepts raw or proxied entries. */
88
+ export interface DeepSignalSet<T> extends Set<DeepSignal<T>>, DeepSignalObjectProps<Set<T>>, SetIterator<DeepSignal<T>>, DeepSignalSetProps<T> {
89
+ add(value: T | DeepSignal<T>): this;
90
+ delete(value: T | DeepSignal<T>): boolean;
91
+ has(value: T | DeepSignal<T>): boolean;
92
+ forEach(callbackfn: (value: DeepSignal<T>, value2: DeepSignal<T>, set: DeepSignalSet<T>) => void, thisArg?: any): void;
93
+ forEach(callbackfn: (value: DeepSignal<T>, index: number) => void, thisArg?: any): void;
94
+ }
95
+ /**
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.
100
+ */
101
+ 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
+ export type DeepSignalObject<T extends object> = {
103
+ [K in keyof T]: DeepSignal<T[K]>;
104
+ };
105
+ export type RevertDeepSignal<T> = T extends DeepSignal<infer S> ? S : T;
106
+ export {};
107
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +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,KAAK,CAAC,EAAE,GAAG,CAAA;CAAE,GACnD;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,IAAI,CAAC,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ACjE,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"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ export declare const objectToString: typeof Object.prototype.toString;
2
+ export declare const toTypeString: (value: unknown) => string;
3
+ export declare const hasOwn: (val: object, key: string | symbol) => key is keyof typeof val;
4
+ export declare const isArray: typeof Array.isArray;
5
+ export declare const isMap: (val: unknown) => val is Map<any, any>;
6
+ export declare const isSet: (val: unknown) => val is Set<any>;
7
+ export declare const isDate: (val: unknown) => val is Date;
8
+ export declare const isRegExp: (val: unknown) => val is RegExp;
9
+ export declare const isFunction: (val: unknown) => val is Function;
10
+ export declare const isString: (val: unknown) => val is string;
11
+ export declare const isSymbol: (val: unknown) => val is symbol;
12
+ export declare const isObject: (val: unknown) => val is Record<any, any>;
13
+ export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
14
+ export declare const isPlainObject: (val: unknown) => val is object;
15
+ export declare const hasChanged: (value: any, oldValue: any) => boolean;
16
+ export declare function NOOP(): void;
17
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","s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,OAAO,GAAG,EAAE,UAAU,GAAG,KAAG,OAC1B,CAAA;AAE7B,wBAAgB,IAAI,SAAK"}
package/dist/utils.js ADDED
@@ -0,0 +1,47 @@
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
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.hasChanged = exports.isPlainObject = exports.isPromise = exports.isObject = exports.isSymbol = exports.isString = exports.isFunction = exports.isRegExp = exports.isDate = exports.isSet = exports.isMap = exports.isArray = exports.hasOwn = exports.toTypeString = exports.objectToString = void 0;
13
+ exports.NOOP = NOOP;
14
+ exports.objectToString = Object.prototype.toString;
15
+ const toTypeString = (value) => exports.objectToString.call(value);
16
+ exports.toTypeString = toTypeString;
17
+ const hasOwnProperty = Object.prototype.hasOwnProperty;
18
+ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
19
+ exports.hasOwn = hasOwn;
20
+ exports.isArray = Array.isArray;
21
+ const isMap = (val) => (0, exports.toTypeString)(val) === '[object Map]';
22
+ exports.isMap = isMap;
23
+ const isSet = (val) => (0, exports.toTypeString)(val) === '[object Set]';
24
+ exports.isSet = isSet;
25
+ const isDate = (val) => (0, exports.toTypeString)(val) === '[object Date]';
26
+ exports.isDate = isDate;
27
+ const isRegExp = (val) => (0, exports.toTypeString)(val) === '[object RegExp]';
28
+ exports.isRegExp = isRegExp;
29
+ const isFunction = (val) => typeof val === 'function';
30
+ exports.isFunction = isFunction;
31
+ const isString = (val) => typeof val === 'string';
32
+ exports.isString = isString;
33
+ const isSymbol = (val) => typeof val === 'symbol';
34
+ exports.isSymbol = isSymbol;
35
+ const isObject = (val) => val !== null && typeof val === 'object';
36
+ exports.isObject = isObject;
37
+ const isPromise = (val) => {
38
+ return (((0, exports.isObject)(val) || (0, exports.isFunction)(val)) &&
39
+ (0, exports.isFunction)(val.then) &&
40
+ (0, exports.isFunction)(val.catch));
41
+ };
42
+ exports.isPromise = isPromise;
43
+ const isPlainObject = (val) => (0, exports.toTypeString)(val) === '[object Object]';
44
+ exports.isPlainObject = isPlainObject;
45
+ const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
46
+ exports.hasChanged = hasChanged;
47
+ function NOOP() { }