@plures/unum 0.2.2 → 0.3.0

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 (58) hide show
  1. package/README.md +3 -6
  2. package/dist/adapters/index.d.ts +3 -0
  3. package/dist/adapters/index.d.ts.map +1 -0
  4. package/dist/adapters/index.js +3 -0
  5. package/dist/adapters/index.js.map +1 -0
  6. package/dist/adapters/memory.d.ts +7 -0
  7. package/dist/adapters/memory.d.ts.map +1 -0
  8. package/dist/adapters/memory.js +116 -0
  9. package/dist/adapters/memory.js.map +1 -0
  10. package/dist/adapters/pluresdb.d.ts +14 -0
  11. package/dist/adapters/pluresdb.d.ts.map +1 -0
  12. package/dist/adapters/pluresdb.js +48 -0
  13. package/dist/adapters/pluresdb.js.map +1 -0
  14. package/dist/context.d.ts +29 -0
  15. package/dist/context.d.ts.map +1 -0
  16. package/dist/context.js +43 -0
  17. package/dist/context.js.map +1 -0
  18. package/dist/index.d.ts +8 -53
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +9 -196
  21. package/dist/index.js.map +1 -1
  22. package/dist/runes.d.ts +17 -161
  23. package/dist/runes.d.ts.map +1 -1
  24. package/dist/runes.js +121 -290
  25. package/dist/runes.js.map +1 -1
  26. package/dist/store.d.ts +10 -21
  27. package/dist/store.d.ts.map +1 -1
  28. package/dist/store.js +31 -135
  29. package/dist/store.js.map +1 -1
  30. package/dist/types.d.ts +69 -0
  31. package/dist/types.d.ts.map +1 -0
  32. package/dist/types.js +7 -0
  33. package/dist/types.js.map +1 -0
  34. package/package.json +54 -49
  35. package/dist/GunContext.d.ts +0 -17
  36. package/dist/GunContext.d.ts.map +0 -1
  37. package/dist/GunContext.js +0 -180
  38. package/dist/GunContext.js.map +0 -1
  39. package/dist/actions.d.ts +0 -39
  40. package/dist/actions.d.ts.map +0 -1
  41. package/dist/actions.js +0 -89
  42. package/dist/actions.js.map +0 -1
  43. package/dist/gunComponent.d.ts +0 -44
  44. package/dist/gunComponent.d.ts.map +0 -1
  45. package/dist/gunComponent.js +0 -205
  46. package/dist/gunComponent.js.map +0 -1
  47. package/dist/gunify.d.ts +0 -46
  48. package/dist/gunify.d.ts.map +0 -1
  49. package/dist/gunify.js +0 -294
  50. package/dist/gunify.js.map +0 -1
  51. package/dist/plures-helper.d.ts +0 -41
  52. package/dist/plures-helper.d.ts.map +0 -1
  53. package/dist/plures-helper.js +0 -114
  54. package/dist/plures-helper.js.map +0 -1
  55. package/dist/universalGunBind.d.ts +0 -219
  56. package/dist/universalGunBind.d.ts.map +0 -1
  57. package/dist/universalGunBind.js +0 -394
  58. package/dist/universalGunBind.js.map +0 -1
package/README.md CHANGED
@@ -1,17 +1,14 @@
1
1
  # unum
2
2
 
3
- A modern Svelte binding library for [PluresDB](https://github.com/plures/pluresdb) with full Svelte 5 compatibility.
4
-
5
- PluresDB is published to npm as `pluresdb` and is also available as a Deno package. It provides a modern, graph-based database with real-time synchronization capabilities, inspired by and compatible with Gun.js. Version 1.3.0 includes Node.js N-API bindings for enhanced performance.
3
+ Svelte bindings for [PluresDB](https://github.com/plures/pluresdb) - a graph-based database with real-time synchronization.
6
4
 
7
5
  ## Features
8
6
 
9
7
  - **Svelte 4 & 5 Compatible**: Works with both store-based and runes-based reactivity
10
- - **Type-Safe**: Full TypeScript support with proper types
11
- - **Action-Based**: Modern Svelte actions for DOM binding
8
+ - **Type-Safe**: Full TypeScript support
9
+ - **Action-Based**: Svelte actions for DOM binding
12
10
  - **Store-Based**: Writable store implementation for reactive data
13
11
  - **Collection Support**: Easy handling of PluresDB collections
14
- - **PluresDB v1.3.0**: Supports latest PluresDB with Node.js N-API bindings and better-sqlite3 compatibility
15
12
 
16
13
  ## Installation
17
14
 
@@ -0,0 +1,3 @@
1
+ export { createPluresDbAdapter } from './pluresdb.js';
2
+ export { createMemoryAdapter } from './memory.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { createPluresDbAdapter } from './pluresdb.js';
2
+ export { createMemoryAdapter } from './memory.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * In-memory adapter — useful for testing and SSR.
3
+ * No external dependencies.
4
+ */
5
+ import type { DbAdapter } from '../types.js';
6
+ export declare function createMemoryAdapter(): DbAdapter;
7
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/adapters/memory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAA2B,SAAS,EAAe,MAAM,aAAa,CAAC;AAanF,wBAAgB,mBAAmB,IAAI,SAAS,CA4F/C"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * In-memory adapter — useful for testing and SSR.
3
+ * No external dependencies.
4
+ */
5
+ function createMemNode() {
6
+ return { data: undefined, children: new Map(), listeners: new Set(), mapListeners: new Set() };
7
+ }
8
+ export function createMemoryAdapter() {
9
+ const root = createMemNode();
10
+ function resolve(node, path) {
11
+ let cur = node;
12
+ for (const key of path) {
13
+ if (!cur.children.has(key))
14
+ cur.children.set(key, createMemNode());
15
+ cur = cur.children.get(key);
16
+ }
17
+ return cur;
18
+ }
19
+ function notify(node, key) {
20
+ for (const cb of node.listeners) {
21
+ try {
22
+ cb(node.data, key);
23
+ }
24
+ catch (e) {
25
+ console.error('[unum/memory]', e);
26
+ }
27
+ }
28
+ }
29
+ function notifyMap(parent) {
30
+ for (const [key, child] of parent.children) {
31
+ for (const cb of parent.mapListeners) {
32
+ try {
33
+ cb(child.data, key);
34
+ }
35
+ catch (e) {
36
+ console.error('[unum/memory]', e);
37
+ }
38
+ }
39
+ }
40
+ }
41
+ function makeChain(path, isMap = false) {
42
+ return {
43
+ get(key) { return makeChain([...path, key]); },
44
+ put(data, cb) {
45
+ const node = resolve(root, path);
46
+ node.data = data;
47
+ const key = path[path.length - 1];
48
+ notify(node, key);
49
+ // notify parent map listeners
50
+ if (path.length > 0) {
51
+ const parent = resolve(root, path.slice(0, -1));
52
+ for (const mcb of parent.mapListeners) {
53
+ try {
54
+ mcb(data, key);
55
+ }
56
+ catch (e) {
57
+ console.error('[unum/memory]', e);
58
+ }
59
+ }
60
+ }
61
+ cb?.(data, key);
62
+ return this;
63
+ },
64
+ set(data, cb) {
65
+ const id = Math.random().toString(36).slice(2, 10);
66
+ makeChain([...path, id]).put(data, cb);
67
+ return makeChain([...path, id]);
68
+ },
69
+ on(cb) {
70
+ const node = resolve(root, path);
71
+ if (isMap) {
72
+ node.mapListeners.add(cb);
73
+ // Fire for existing children
74
+ for (const [key, child] of node.children) {
75
+ try {
76
+ cb(child.data, key);
77
+ }
78
+ catch (e) {
79
+ console.error('[unum/memory]', e);
80
+ }
81
+ }
82
+ return () => { node.mapListeners.delete(cb); };
83
+ }
84
+ node.listeners.add(cb);
85
+ if (node.data !== undefined) {
86
+ try {
87
+ cb(node.data, path[path.length - 1]);
88
+ }
89
+ catch (e) {
90
+ console.error('[unum/memory]', e);
91
+ }
92
+ }
93
+ return () => { node.listeners.delete(cb); };
94
+ },
95
+ once(cb) {
96
+ const node = resolve(root, path);
97
+ cb(node.data, path[path.length - 1]);
98
+ },
99
+ map() { return makeChain(path, true); },
100
+ off() {
101
+ const node = resolve(root, path);
102
+ node.listeners.clear();
103
+ node.mapListeners.clear();
104
+ },
105
+ };
106
+ }
107
+ return {
108
+ root() { return makeChain([]); },
109
+ destroy() {
110
+ root.children.clear();
111
+ root.listeners.clear();
112
+ root.mapListeners.clear();
113
+ },
114
+ };
115
+ }
116
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/adapters/memory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,SAAS,aAAa;IACpB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;AACjG,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAE7B,SAAS,OAAO,CAAC,IAAa,EAAE,IAAc;QAC5C,IAAI,GAAG,GAAG,IAAI,CAAC;QACf,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,aAAa,EAAE,CAAC,CAAC;YACnE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;QAC/B,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,SAAS,MAAM,CAAC,IAAa,EAAE,GAAY;QACzC,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YAChC,IAAI,CAAC;gBAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;YAAC,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBAAC,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;YAAC,CAAC;QAC9E,CAAC;IACH,CAAC;IAED,SAAS,SAAS,CAAC,M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
4
+ * PluresDB exposes a Gun-compatible API: db.get(), .put(), .on(), .once(), .map()
5
+ * This adapter wraps any PluresDB (or Gun) instance.
6
+ */
7
+ import type { DbAdapter } from '../types.js';
8
+ /**
9
+ * Wrap a PluresDB/Gun instance as a DbAdapter.
10
+ *
11
+ * @param db - A PluresDB or Gun instance (anything with .get/.put/.on/.once/.map)
12
+ */
13
+ export declare function createPluresDbAdapter(db: any): DbAdapter;
14
+ //# sourceMappingURL=pluresdb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluresdb.d.ts","sourceRoot":"","sources":["../../src/adapters/pluresdb.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAA2B,SAAS,EAAe,MAAM,aAAa,CAAC;AAEnF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,GAAG,GAAG,SAAS,CAoCxD"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * PluresDB adapter — native adapter using PluresDB's chain API.
3
+ *
4
+ * PluresDB exposes a Gun-compatible API: db.get(), .put(), .on(), .once(), .map()
5
+ * This adapter wraps any PluresDB (or Gun) instance.
6
+ */
7
+ /**
8
+ * Wrap a PluresDB/Gun instance as a DbAdapter.
9
+ *
10
+ * @param db - A PluresDB or Gun instance (anything with .get/.put/.on/.once/.map)
11
+ */
12
+ export function createPluresDbAdapter(db) {
13
+ function wrapChain(chain) {
14
+ return {
15
+ get(key) {
16
+ return wrapChain(chain.get(key));
17
+ },
18
+ put(data, cb) {
19
+ chain.put(data, cb);
20
+ return this;
21
+ },
22
+ set(data, cb) {
23
+ chain.set(data, cb);
24
+ return this;
25
+ },
26
+ on(cb) {
27
+ const ref = chain.on(cb);
28
+ // Gun returns the chain, not an unsub function
29
+ return typeof ref === 'function' ? ref : () => chain.off();
30
+ },
31
+ once(cb) {
32
+ chain.once(cb);
33
+ },
34
+ map() {
35
+ return wrapChain(chain.map());
36
+ },
37
+ off() {
38
+ chain.off();
39
+ },
40
+ };
41
+ }
42
+ return {
43
+ root() {
44
+ return wrapChain(db);
45
+ },
46
+ };
47
+ }
48
+ //# sourceMappingURL=pluresdb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pluresdb.js","sourceRoot":"","sources":["../../src/adapters/pluresdb.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,EAAO;IAC3C,SAAS,SAAS,CAAC,KAAU;QAC3B,OAAO;YACL,GAAG,CAAC,GAAW;gBACb,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;YACnC,CAAC;YACD,GAAG,CAAC,IAAS,EAAE,EAAiB;gBAC9B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,GAAG,CAAC,IAAS,EAAE,EAAiB;gBAC9B,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,EAAE,CAAC,EAAgB;gBACjB,MAAM,GAAG,GAAG,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;gBACzB,+CAA+C;gBAC/C,OAAO,OAAO,GAAG,KAAK,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;YAC7D,CAAC;YACD,IAAI,CAAC,EAAgB;gBACnB,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YACD,GAAG;gBACD,OAAO,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC;YAChC,CAAC;YACD,GAAG;gBACD,KAAK,CAAC,GAAG,EAAE,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI;YACF,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC;QACvB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Database context — singleton adapter management.
3
+ * Replaces GunContext.js (no CDN, no global detection).
4
+ */
5
+ import { type Readable } from 'svelte/store';
6
+ import type { DbAdapter, ChainNode } from './types.js';
7
+ /**
8
+ * Initialize unum with a database adapter.
9
+ * Call once at app startup.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { initDb, createPluresDbAdapter } from '@plures/unum';
14
+ * import PluresDB from 'pluresdb';
15
+ *
16
+ * const db = new PluresDB({ localStorage: true });
17
+ * initDb(createPluresDbAdapter(db));
18
+ * ```
19
+ */
20
+ export declare function initDb(adapter: DbAdapter): void;
21
+ /** Get the current adapter (throws if not initialized) */
22
+ export declare function getAdapter(): DbAdapter;
23
+ /** Get a root ChainNode from the current adapter */
24
+ export declare function getRoot(): ChainNode;
25
+ /** Svelte store for the adapter — subscribe for lazy init patterns */
26
+ export declare const db: Readable<DbAdapter | null>;
27
+ /** Tear down the adapter */
28
+ export declare function destroyDb(): void;
29
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvD;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,SAAS,GAAG,IAAI,CAG/C;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,IAAI,SAAS,CAGtC;AAED,oDAAoD;AACpD,wBAAgB,OAAO,IAAI,SAAS,CAEnC;AAED,sEAAsE;AACtE,eAAO,MAAM,EAAE,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAgB,CAAC;AAE3D,4BAA4B;AAC5B,wBAAgB,SAAS,IAAI,IAAI,CAIhC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Database context — singleton adapter management.
3
+ * Replaces GunContext.js (no CDN, no global detection).
4
+ */
5
+ import { writable } from 'svelte/store';
6
+ let _adapter = null;
7
+ const adapterStore = writable(null);
8
+ /**
9
+ * Initialize unum with a database adapter.
10
+ * Call once at app startup.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { initDb, createPluresDbAdapter } from '@plures/unum';
15
+ * import PluresDB from 'pluresdb';
16
+ *
17
+ * const db = new PluresDB({ localStorage: true });
18
+ * initDb(createPluresDbAdapter(db));
19
+ * ```
20
+ */
21
+ export function initDb(adapter) {
22
+ _adapter = adapter;
23
+ adapterStore.set(adapter);
24
+ }
25
+ /** Get the current adapter (throws if not initialized) */
26
+ export function getAdapter() {
27
+ if (!_adapter)
28
+ throw new Error('unum: call initDb() before using data bindings');
29
+ return _adapter;
30
+ }
31
+ /** Get a root ChainNode from the current adapter */
32
+ export function getRoot() {
33
+ return getAdapter().root();
34
+ }
35
+ /** Svelte store for the adapter — subscribe for lazy init patterns */
36
+ export const db = adapterStore;
37
+ /** Tear down the adapter */
38
+ export function destroyDb() {
39
+ _adapter?.destroy?.();
40
+ _adapter = null;
41
+ adapterStore.set(null);
42
+ }
43
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAiB,MAAM,cAAc,CAAC;AAGvD,IAAI,QAAQ,GAAqB,IAAI,CAAC;AACtC,MAAM,YAAY,GAAG,QAAQ,CAAmB,IAAI,CAAC,CAAC;AAEtD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,MAAM,CAAC,OAAkB;IACvC,QAAQ,GAAG,OAAO,CAAC;IACnB,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC;AAED,0DAA0D;AAC1D,MAAM,UAAU,UAAU;IACxB,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACjF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,OAAO;IACrB,OAAO,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC;AAC7B,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,MAAM,EAAE,GAA+B,YAAY,CAAC;AAE3D,4BAA4B;AAC5B,MAAM,UAAU,SAAS;IACvB,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC;IACtB,QAAQ,GAAG,IAAI,CAAC;IAChB,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,57 +1,12 @@
1
1
  /**
2
- * Creates a complete PluresDB-powered component with automatic synchronization
2
+ * @plures/unum Reactive Svelte bindings for PluresDB
3
3
  *
4
- * This higher-level function creates a wrapped component that automatically
5
- * syncs with PluresDB (from the 'pluresdb' npm package), without requiring any knowledge of
6
- * the component's props structure. Just specify the component and path, and
7
- * it handles the rest.
8
- *
9
- * @param {Object} options - Configuration options
10
- * @param {Function} options.component - The component to bind with PluresDB data
11
- * @param {Object} options.db - PluresDB instance from 'pluresdb' package (can also use 'gun' for compatibility)
12
- * @param {string} options.path - PluresDB path for data storage
13
- * @param {string} [options.id] - Optional ID for multiple instances of the same component
14
- * @param {Object} [options.defaultData] - Default data to use ONLY if no data exists yet
15
- * @param {Object} [options.props] - Additional props to pass to the component (not synced with PluresDB)
16
- * @returns {Function} A self-contained component that handles the synchronization
17
- */
18
- export function pluresComponent(options: {
19
- component: Function;
20
- db: any;
21
- path: string;
22
- id?: string;
23
- defaultData?: any;
24
- props?: any;
25
- }): Function;
26
- export * from "./store.js";
27
- export * from "./actions.js";
28
- export * from "./plures-helper.js";
29
- export * from "./plures-helper.js";
30
- /**
31
- * Creates a complete PluresDB-powered component with automatic synchronization
32
- *
33
- * This higher-level function creates a wrapped component that automatically
34
- * syncs with PluresDB (from the 'pluresdb' npm package), without requiring any knowledge of
35
- * the component's props structure. Just specify the component and path, and
36
- * it handles the rest.
37
- *
38
- * @param {Object} options - Configuration options
39
- * @param {Function} options.component - The component to bind with PluresDB data
40
- * @param {Object} options.db - PluresDB instance from 'pluresdb' package (can also use 'gun' for compatibility)
41
- * @param {string} options.path - PluresDB path for data storage
42
- * @param {string} [options.id] - Optional ID for multiple instances of the same component
43
- * @param {Object} [options.defaultData] - Default data to use ONLY if no data exists yet
44
- * @param {Object} [options.props] - Additional props to pass to the component (not synced with PluresDB)
45
- * @returns {Function} A self-contained component that handles the synchronization
4
+ * Zero Gun.js dependency. Backend-agnostic via adapters.
46
5
  */
47
- export function gunComponent(options: {
48
- component: Function;
49
- db: any;
50
- path: string;
51
- id?: string;
52
- defaultData?: any;
53
- props?: any;
54
- }): Function;
55
- import { gun } from './GunContext.js';
56
- export { unum, connect, gun, gun as db, gun as plures };
6
+ export { initDb, getAdapter, getRoot, destroyDb, db } from './context.js';
7
+ export { pluresData, pluresDerived, pluresBind } from './runes.js';
8
+ export { PluresStore, createPluresStore } from './store.js';
9
+ export { createPluresDbAdapter } from './adapters/pluresdb.js';
10
+ export { createMemoryAdapter } from './adapters/memory.js';
11
+ export type { ChainNode, DbAdapter, DataCallback, DataRef, PluresDataOptions, Unsubscribe, } from './types.js';
57
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA2BA;;;;;;;;;;;;;;;;GAgBG;AACH,yCARG;IAA0B,SAAS;IACX,EAAE;IACF,IAAI,EAApB,MAAM;IACW,EAAE,GAAnB,MAAM;IACW,WAAW;IACX,KAAK;CAC9B,YA+LF;;;;;AA9MD;;;;;;;;;;;;;;;;GAgBG;AACH,sCARG;IAA0B,SAAS;IACX,EAAE;IACF,IAAI,EAApB,MAAM;IACW,EAAE,GAAnB,MAAM;IACW,WAAW;IACX,KAAK;CAC9B,YA+LF;oBAnNmB,iBAAiB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,WAAW,GACZ,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,200 +1,13 @@
1
1
  /**
2
- * unum - Local Svelte PluresDB Bindings
2
+ * @plures/unum Reactive Svelte bindings for PluresDB
3
3
  *
4
- * A reactive Svelte binding library for PluresDB (pluresdb npm package).
4
+ * Zero Gun.js dependency. Backend-agnostic via adapters.
5
5
  */
6
- // Export store implementation
7
- export * from './store.js';
8
- // Export actions
9
- export * from './actions.js';
10
- // Export PluresDB helpers
11
- export * from './plures-helper.js';
12
- // Also export from gun-helper for backward compatibility
13
- export * from './plures-helper.js';
14
- /**
15
- * Re-export unum and connect functions for easier imports
16
- */
17
- import { unum, connect } from './unum.js';
18
- import { gun } from './GunContext.js';
19
- export { unum, connect, gun };
20
- export { gun as db, gun as plures }; // Alternative export names
21
- /**
22
- * Creates a complete PluresDB-powered component with automatic synchronization
23
- *
24
- * This higher-level function creates a wrapped component that automatically
25
- * syncs with PluresDB (from the 'pluresdb' npm package), without requiring any knowledge of
26
- * the component's props structure. Just specify the component and path, and
27
- * it handles the rest.
28
- *
29
- * @param {Object} options - Configuration options
30
- * @param {Function} options.component - The component to bind with PluresDB data
31
- * @param {Object} options.db - PluresDB instance from 'pluresdb' package (can also use 'gun' for compatibility)
32
- * @param {string} options.path - PluresDB path for data storage
33
- * @param {string} [options.id] - Optional ID for multiple instances of the same component
34
- * @param {Object} [options.defaultData] - Default data to use ONLY if no data exists yet
35
- * @param {Object} [options.props] - Additional props to pass to the component (not synced with PluresDB)
36
- * @returns {Function} A self-contained component that handles the synchronization
37
- */
38
- export function pluresComponent(options) {
39
- const { component, db, gun, path, id, defaultData = {}, props: extraProps = {} } = options;
40
- const dbInstance = db || gun; // Support both 'db' and 'gun' for compatibility
41
- if (!component) {
42
- console.error('Component is required for pluresComponent');
43
- return () => null;
44
- }
45
- if (!dbInstance) {
46
- console.error('PluresDB instance from the pluresdb package is required for pluresComponent');
47
- return () => null;
48
- }
49
- if (!path) {
50
- console.error('Path is required for pluresComponent');
51
- return () => null;
52
- }
53
- // The full path including optional ID
54
- const fullPath = id ? `${path}_${id}` : path;
55
- // Return a dynamically created component constructor
56
- return class PluresComponentWrapper {
57
- constructor(options = {}) {
58
- this.options = options;
59
- this.Component = component;
60
- this.instance = null;
61
- this.isMounted = false;
62
- this.dbNode = dbInstance.get(fullPath);
63
- this.proxyData = null;
64
- this.unsubscribe = null;
65
- this.isUpdatingFromDb = false; // Flag to prevent circular updates
66
- this.lastSnapshot = JSON.stringify({}); // Used to track changes
67
- // Initialize data if empty
68
- this.dbNode.once(data => {
69
- if (!data || Object.keys(data).filter(k => k !== '_').length === 0) {
70
- // Only apply default data if empty
71
- if (defaultData && Object.keys(defaultData).length > 0) {
72
- this.dbNode.put(defaultData);
73
- }
74
- }
75
- });
76
- // Create reactive proxy
77
- this.proxyData = this.createReactiveProxy();
78
- }
79
- // Create a proxy that automatically syncs with PluresDB
80
- createReactiveProxy() {
81
- // Initial state
82
- const state = { ...defaultData };
83
- // Create proxy
84
- const proxy = new Proxy(state, {
85
- get: (target, prop) => {
86
- return target[prop];
87
- },
88
- set: (target, prop, value) => {
89
- // Set value in state
90
- target[prop] = value;
91
- // Only update PluresDB if not updating from PluresDB
92
- if (!this.isUpdatingFromDb && this.dbNode) {
93
- // Update PluresDB
94
- this.dbNode.get(prop).put(value);
95
- // Handle arrays
96
- if (Array.isArray(value)) {
97
- this.wrapArrayMethods(value, prop);
98
- }
99
- }
100
- // Update component if mounted
101
- if (this.isMounted && this.instance) {
102
- const props = {};
103
- props[prop] = value;
104
- this.instance.$set(props);
105
- }
106
- return true;
107
- },
108
- deleteProperty: (target, prop) => {
109
- delete target[prop];
110
- // Update PluresDB
111
- if (!this.isUpdatingFromDb && this.dbNode) {
112
- this.dbNode.get(prop).put(null);
113
- }
114
- return true;
115
- }
116
- });
117
- return proxy;
118
- }
119
- // Wrap array methods to detect changes
120
- wrapArrayMethods(array, propPath) {
121
- ['push', 'pop', 'shift', 'unshift', 'splice', 'reverse', 'sort'].forEach(method => {
122
- const original = array[method];
123
- array[method] = function (...args) {
124
- // Call original
125
- const result = original.apply(this, args);
126
- // Update PluresDB with entire array
127
- if (this.dbNode) {
128
- this.dbNode.get(propPath).put(array);
129
- }
130
- return result;
131
- }.bind(this);
132
- });
133
- return array;
134
- }
135
- mount(target) {
136
- if (!target) {
137
- console.error('Target element is required for mounting');
138
- return this;
139
- }
140
- // Get initial props
141
- const props = {
142
- ...this.proxyData,
143
- ...extraProps,
144
- ...this.options?.props
145
- };
146
- // Create the component instance
147
- this.instance = new this.Component({
148
- target,
149
- props
150
- });
151
- // Mark as mounted
152
- this.isMounted = true;
153
- // Subscribe to PluresDB updates
154
- this.unsubscribe = this.dbNode.on((data) => {
155
- if (!data)
156
- return;
157
- // Filter out PluresDB metadata
158
- const cleanData = {};
159
- for (const key in data) {
160
- if (key !== '_' && !key.startsWith('_')) {
161
- cleanData[key] = data[key];
162
- }
163
- }
164
- // Update proxy without triggering PluresDB updates
165
- this.isUpdatingFromDb = true;
166
- try {
167
- // Update all properties
168
- for (const key in cleanData) {
169
- // Update proxy
170
- this.proxyData[key] = cleanData[key];
171
- }
172
- // Update component if mounted
173
- if (this.isMounted && this.instance) {
174
- this.instance.$set(cleanData);
175
- }
176
- }
177
- finally {
178
- this.isUpdatingFromDb = false;
179
- }
180
- });
181
- return this;
182
- }
183
- destroy() {
184
- // Unsubscribe from PluresDB
185
- if (this.unsubscribe) {
186
- this.unsubscribe();
187
- this.unsubscribe = null;
188
- }
189
- // Destroy component
190
- if (this.instance && typeof this.instance.$destroy === 'function') {
191
- this.instance.$destroy();
192
- this.instance = null;
193
- }
194
- this.isMounted = false;
195
- }
196
- };
197
- }
198
- // Legacy export for backward compatibility
199
- export const gunComponent = pluresComponent;
6
+ // Core
7
+ export { initDb, getAdapter, getRoot, destroyDb, db } from './context.js';
8
+ export { pluresData, pluresDerived, pluresBind } from './runes.js';
9
+ export { PluresStore, createPluresStore } from './store.js';
10
+ // Adapters
11
+ export { createPluresDbAdapter } from './adapters/pluresdb.js';
12
+ export { createMemoryAdapter } from './adapters/memory.js';
200
13
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,8BAA8B;AAC9B,cAAc,YAAY,CAAC;AAE3B,iBAAiB;AACjB,cAAc,cAAc,CAAC;AAE7B,0BAA0B;AAC1B,cAAc,oBAAoB,CAAC;AAEnC,yDAAyD;AACzD,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAC9B,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,GAAG,IAAI,MAAM,EAAE,CAAC,CAAC,2BAA2B;AAEhE;;;;;;;;;;;;;;;;G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