@plures/unum 0.2.2
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.
- package/LICENSE +21 -0
- package/LICENSE.md +21 -0
- package/README.md +114 -0
- package/dist/GunContext.d.ts +17 -0
- package/dist/GunContext.d.ts.map +1 -0
- package/dist/GunContext.js +180 -0
- package/dist/GunContext.js.map +1 -0
- package/dist/actions.d.ts +39 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +89 -0
- package/dist/actions.js.map +1 -0
- package/dist/gunComponent.d.ts +44 -0
- package/dist/gunComponent.d.ts.map +1 -0
- package/dist/gunComponent.js +205 -0
- package/dist/gunComponent.js.map +1 -0
- package/dist/gunify.d.ts +46 -0
- package/dist/gunify.d.ts.map +1 -0
- package/dist/gunify.js +294 -0
- package/dist/gunify.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +200 -0
- package/dist/index.js.map +1 -0
- package/dist/plures-helper.d.ts +41 -0
- package/dist/plures-helper.d.ts.map +1 -0
- package/dist/plures-helper.js +114 -0
- package/dist/plures-helper.js.map +1 -0
- package/dist/runes.d.ts +185 -0
- package/dist/runes.d.ts.map +1 -0
- package/dist/runes.js +327 -0
- package/dist/runes.js.map +1 -0
- package/dist/store.d.ts +26 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +154 -0
- package/dist/store.js.map +1 -0
- package/dist/universalGunBind.d.ts +219 -0
- package/dist/universalGunBind.d.ts.map +1 -0
- package/dist/universalGunBind.js +394 -0
- package/dist/universalGunBind.js.map +1 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* unum - Local Svelte PluresDB Bindings
|
|
3
|
+
*
|
|
4
|
+
* A reactive Svelte binding library for PluresDB (pluresdb npm package).
|
|
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;
|
|
200
|
+
//# sourceMapping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,CAAC,WAAW,EAAE,CAAC;gBACnB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YAC1B,CAAC;YAED,oBAAoB;YACpB,IAAI,IAAI,CAAC,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;gBAClE,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;gBACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACvB,CAAC;YAED,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,2CAA2C;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* unum - PluresDB Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions for working with PluresDB in Svelte.
|
|
5
|
+
* PluresDB is a Gun.js-compatible database available at npm package 'pluresdb'.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get a reference to the PluresDB constructor when loaded from CDN
|
|
9
|
+
*/
|
|
10
|
+
export function getPlures(options: any): any;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if PluresDB is available
|
|
13
|
+
*/
|
|
14
|
+
export function isPluresAvailable(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Helper to safely access PluresDB data with nested properties
|
|
17
|
+
*/
|
|
18
|
+
export function safeGet(obj: any, path: any, defaultValue?: any): any;
|
|
19
|
+
/**
|
|
20
|
+
* Helper to safely process PluresDB data in a map operation
|
|
21
|
+
*/
|
|
22
|
+
export function safeMap(dbData: any, callback: any, filterFn?: any): any[];
|
|
23
|
+
/**
|
|
24
|
+
* Create a PluresDB chain with safety checks
|
|
25
|
+
*/
|
|
26
|
+
export function safeChain(db: any, path: any): any;
|
|
27
|
+
/**
|
|
28
|
+
* unum - PluresDB Helper Utilities
|
|
29
|
+
*
|
|
30
|
+
* This module provides helper functions for working with PluresDB in Svelte.
|
|
31
|
+
* PluresDB is a Gun.js-compatible database available at npm package 'pluresdb'.
|
|
32
|
+
*/
|
|
33
|
+
/**
|
|
34
|
+
* Get a reference to the PluresDB constructor when loaded from CDN
|
|
35
|
+
*/
|
|
36
|
+
export function getGun(options: any): any;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if PluresDB is available
|
|
39
|
+
*/
|
|
40
|
+
export function isGunAvailable(): boolean;
|
|
41
|
+
//# sourceMappingURL=plures-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plures-helper.d.ts","sourceRoot":"","sources":["../src/plures-helper.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,6CAcC;AAED;;GAEG;AACH,6CAEC;AAED;;GAEG;AACH,sEAmBC;AAED;;GAEG;AACH,2EA2BC;AAED;;GAEG;AACH,mDAyBC;AArHD;;;;;GAKG;AAEH;;GAEG;AACH,0CAcC;AAED;;GAEG;AACH,0CAEC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* unum - PluresDB Helper Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions for working with PluresDB in Svelte.
|
|
5
|
+
* PluresDB is a Gun.js-compatible database available at npm package 'pluresdb'.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Get a reference to the PluresDB constructor when loaded from CDN
|
|
9
|
+
*/
|
|
10
|
+
export function getPlures(options) {
|
|
11
|
+
// First check if PluresDB/Gun was loaded via CDN
|
|
12
|
+
if (typeof window !== 'undefined' && (window.GunDB || window.Gun)) {
|
|
13
|
+
try {
|
|
14
|
+
const DB = window.GunDB || window.Gun;
|
|
15
|
+
return new DB(options);
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
console.error('Error initializing PluresDB:', error);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
console.warn('PluresDB/Gun.js not available. Make sure to include it via CDN script tag or install the pluresdb npm package.');
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if PluresDB is available
|
|
27
|
+
*/
|
|
28
|
+
export function isPluresAvailable() {
|
|
29
|
+
return typeof window !== 'undefined' && (window.GunDB !== undefined || window.Gun !== undefined);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Helper to safely access PluresDB data with nested properties
|
|
33
|
+
*/
|
|
34
|
+
export function safeGet(obj, path, defaultValue = undefined) {
|
|
35
|
+
if (!obj)
|
|
36
|
+
return defaultValue;
|
|
37
|
+
try {
|
|
38
|
+
const parts = path.split('.');
|
|
39
|
+
let result = obj;
|
|
40
|
+
for (const part of parts) {
|
|
41
|
+
if (result === undefined || result === null) {
|
|
42
|
+
return defaultValue;
|
|
43
|
+
}
|
|
44
|
+
result = result[part];
|
|
45
|
+
}
|
|
46
|
+
return result === undefined ? defaultValue : result;
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
console.error(`Error getting path ${path}:`, error);
|
|
50
|
+
return defaultValue;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Helper to safely process PluresDB data in a map operation
|
|
55
|
+
*/
|
|
56
|
+
export function safeMap(dbData, callback, filterFn = null) {
|
|
57
|
+
if (!dbData || typeof dbData !== 'object') {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
// Convert to entries and filter out metadata
|
|
62
|
+
let entries = Object.entries(dbData).filter(([key]) => key !== '_');
|
|
63
|
+
// Apply additional filter if provided
|
|
64
|
+
if (filterFn && typeof filterFn === 'function') {
|
|
65
|
+
entries = entries.filter(([key, value]) => filterFn(key, value));
|
|
66
|
+
}
|
|
67
|
+
// Map the data
|
|
68
|
+
return entries.map(([key, value]) => {
|
|
69
|
+
try {
|
|
70
|
+
return callback(key, value);
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
console.error(`Error processing item ${key}:`, error);
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}).filter(item => item !== null);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.error('Error processing PluresDB data:', error);
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a PluresDB chain with safety checks
|
|
85
|
+
*/
|
|
86
|
+
export function safeChain(db, path) {
|
|
87
|
+
if (!db) {
|
|
88
|
+
console.error('No PluresDB instance provided');
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
if (!path)
|
|
93
|
+
return db;
|
|
94
|
+
let chain = db;
|
|
95
|
+
const parts = path.split('.');
|
|
96
|
+
for (const part of parts) {
|
|
97
|
+
if (part === '#') {
|
|
98
|
+
chain = chain.map();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
chain = chain.get(part);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return chain;
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error(`Error creating PluresDB chain for path ${path}:`, error);
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
// Legacy exports for backward compatibility
|
|
112
|
+
export const getGun = getPlures;
|
|
113
|
+
export const isGunAvailable = isPluresAvailable;
|
|
114
|
+
//# sourceMappingURL=plures-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plures-helper.js","sourceRoot":"","sources":["../src/plures-helper.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,OAAO;IAC/B,iDAAiD;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QAClE,IAAI,CA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AE,IAAI;IAChC,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,IAAI,CAAC,IAAI;YAAE,OAAO,EAAE,CAAC;QAErB,IAAI,KAAK,GAAG,EAAE,CAAC;QACf,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,KAAK,GAAG,EAAE,CAAC;gBACjB,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;YACtB,CAAC;iBAAM,CAAC;gBACN,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,0CAA0C,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,4CAA4C;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,iBAAiB,CAAC"}
|
package/dist/runes.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a reactive connection to a PluresDB path
|
|
3
|
+
* This is the primary API for Svelte 5 components to use PluresDB data
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```svelte
|
|
7
|
+
* <script>
|
|
8
|
+
* import { pluresData } from 'unum';
|
|
9
|
+
*
|
|
10
|
+
* // Create a reactive connection to PluresDB data
|
|
11
|
+
* const todos = pluresData('todos');
|
|
12
|
+
*
|
|
13
|
+
* // Access a specific todo by ID
|
|
14
|
+
* const todo = pluresData('todos', 'specific-id');
|
|
15
|
+
*
|
|
16
|
+
* // Create a new todo
|
|
17
|
+
* function addTodo(text) {
|
|
18
|
+
* todos.add({ text, completed: false });
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* // Toggle a todo's completed status
|
|
22
|
+
* function toggleTodo(id) {
|
|
23
|
+
* todo.update(id, current => ({ ...current, completed: !current.completed }));
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* // Delete a todo
|
|
27
|
+
* function deleteTodo(id) {
|
|
28
|
+
* todos.remove(id);
|
|
29
|
+
* }
|
|
30
|
+
* </script>
|
|
31
|
+
*
|
|
32
|
+
* <!-- Use the data directly in the template -->
|
|
33
|
+
* <ul>
|
|
34
|
+
* {#each todos.list() as item}
|
|
35
|
+
* <li>{item.text}</li>
|
|
36
|
+
* {/each}
|
|
37
|
+
* </ul>
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export function pluresData(path: any, id?: any): {
|
|
41
|
+
readonly state: {};
|
|
42
|
+
readonly value: {};
|
|
43
|
+
list: () => any[];
|
|
44
|
+
add: (data: any) => void;
|
|
45
|
+
update: (itemId: any, updater: any) => void;
|
|
46
|
+
remove: (itemId?: any) => void;
|
|
47
|
+
subscribe: (callback: any) => () => void;
|
|
48
|
+
destroy: () => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Creates a derived state from PluresDB data - allows transforming/filtering PluresDB data
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```svelte
|
|
55
|
+
* <script>
|
|
56
|
+
* import { pluresData, pluresDerived } from 'unum';
|
|
57
|
+
*
|
|
58
|
+
* const todos = pluresData('todos');
|
|
59
|
+
* const completedTodos = pluresDerived(todos, items => items.filter(item => item.completed));
|
|
60
|
+
* </script>
|
|
61
|
+
*
|
|
62
|
+
* <h2>Completed Todos</h2>
|
|
63
|
+
* <ul>
|
|
64
|
+
* {#each completedTodos.value as item}
|
|
65
|
+
* <li>{item.text}</li>
|
|
66
|
+
* {/each}
|
|
67
|
+
* </ul>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export function pluresDerived(pluresData: any, transformer: any): {
|
|
71
|
+
readonly value: any[];
|
|
72
|
+
destroy(): void;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Creates a two-way binding between a form input and PluresDB data
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```svelte
|
|
79
|
+
* <script>
|
|
80
|
+
* import { pluresBind } from 'unum';
|
|
81
|
+
*
|
|
82
|
+
* const userProfile = pluresData('userProfile');
|
|
83
|
+
* const nameBinding = pluresBind(userProfile, 'name');
|
|
84
|
+
* </script>
|
|
85
|
+
*
|
|
86
|
+
* <input type="text" bind:value={nameBinding.value} />
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export function pluresBind(pluresData: any, field: any): {
|
|
90
|
+
value: any;
|
|
91
|
+
destroy(): void;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Creates a reactive connection to a PluresDB path
|
|
95
|
+
* This is the primary API for Svelte 5 components to use PluresDB data
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```svelte
|
|
99
|
+
* <script>
|
|
100
|
+
* import { pluresData } from 'unum';
|
|
101
|
+
*
|
|
102
|
+
* // Create a reactive connection to PluresDB data
|
|
103
|
+
* const todos = pluresData('todos');
|
|
104
|
+
*
|
|
105
|
+
* // Access a specific todo by ID
|
|
106
|
+
* const todo = pluresData('todos', 'specific-id');
|
|
107
|
+
*
|
|
108
|
+
* // Create a new todo
|
|
109
|
+
* function addTodo(text) {
|
|
110
|
+
* todos.add({ text, completed: false });
|
|
111
|
+
* }
|
|
112
|
+
*
|
|
113
|
+
* // Toggle a todo's completed status
|
|
114
|
+
* function toggleTodo(id) {
|
|
115
|
+
* todo.update(id, current => ({ ...current, completed: !current.completed }));
|
|
116
|
+
* }
|
|
117
|
+
*
|
|
118
|
+
* // Delete a todo
|
|
119
|
+
* function deleteTodo(id) {
|
|
120
|
+
* todos.remove(id);
|
|
121
|
+
* }
|
|
122
|
+
* </script>
|
|
123
|
+
*
|
|
124
|
+
* <!-- Use the data directly in the template -->
|
|
125
|
+
* <ul>
|
|
126
|
+
* {#each todos.list() as item}
|
|
127
|
+
* <li>{item.text}</li>
|
|
128
|
+
* {/each}
|
|
129
|
+
* </ul>
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
export function gunData(path: any, id?: any): {
|
|
133
|
+
readonly state: {};
|
|
134
|
+
readonly value: {};
|
|
135
|
+
list: () => any[];
|
|
136
|
+
add: (data: any) => void;
|
|
137
|
+
update: (itemId: any, updater: any) => void;
|
|
138
|
+
remove: (itemId?: any) => void;
|
|
139
|
+
subscribe: (callback: any) => () => void;
|
|
140
|
+
destroy: () => void;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Creates a derived state from PluresDB data - allows transforming/filtering PluresDB data
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```svelte
|
|
147
|
+
* <script>
|
|
148
|
+
* import { pluresData, pluresDerived } from 'unum';
|
|
149
|
+
*
|
|
150
|
+
* const todos = pluresData('todos');
|
|
151
|
+
* const completedTodos = pluresDerived(todos, items => items.filter(item => item.completed));
|
|
152
|
+
* </script>
|
|
153
|
+
*
|
|
154
|
+
* <h2>Completed Todos</h2>
|
|
155
|
+
* <ul>
|
|
156
|
+
* {#each completedTodos.value as item}
|
|
157
|
+
* <li>{item.text}</li>
|
|
158
|
+
* {/each}
|
|
159
|
+
* </ul>
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
export function gunDerived(pluresData: any, transformer: any): {
|
|
163
|
+
readonly value: any[];
|
|
164
|
+
destroy(): void;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Creates a two-way binding between a form input and PluresDB data
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```svelte
|
|
171
|
+
* <script>
|
|
172
|
+
* import { pluresBind } from 'unum';
|
|
173
|
+
*
|
|
174
|
+
* const userProfile = pluresData('userProfile');
|
|
175
|
+
* const nameBinding = pluresBind(userProfile, 'name');
|
|
176
|
+
* </script>
|
|
177
|
+
*
|
|
178
|
+
* <input type="text" bind:value={nameBinding.value} />
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export function gunBind(pluresData: any, field: any): {
|
|
182
|
+
value: any;
|
|
183
|
+
destroy(): void;
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=runes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runes.d.ts","sourceRoot":"","sources":["../src/runes.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH;;;;;;;;;EA+MC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;EAiCC;AAED;;;;;;;;;;;;;;GAcG;AACH;;;EA4BC;AA1VD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH;;;;;;;;;EA+MC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;EAiCC;AAED;;;;;;;;;;;;;;GAcG;AACH;;;EA4BC"}
|