memorio 2.2.0 → 2.5.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.
- package/COPYRIGHT.md +6 -0
- package/FUNDING.yml +12 -0
- package/LICENSE.md +14 -8
- package/README.md +63 -60
- package/SECURITY.md +3 -0
- package/index.js +1 -1
- package/index.js.map +7 -0
- package/index.mjs +23 -0
- package/index.mjs.map +7 -0
- package/package.json +16 -29
- package/types/useObserver.d.ts +9 -4
package/COPYRIGHT.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Copyright
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Dario Passariello. All rights reserved.
|
|
4
|
+
<https://dario.passariello.ca>
|
|
5
|
+
|
|
6
|
+
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
|
package/FUNDING.yml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# These are supported funding model platforms
|
|
2
|
+
|
|
3
|
+
github: passariello
|
|
4
|
+
patreon: passariello
|
|
5
|
+
ko_fi: passariello
|
|
6
|
+
liberapay: passariello
|
|
7
|
+
issuehunt: passariello
|
|
8
|
+
custom:
|
|
9
|
+
[
|
|
10
|
+
"https://dario.passariello.ca",
|
|
11
|
+
"https://www.indiegogo.com/individuals/28513718",
|
|
12
|
+
]
|
package/LICENSE.md
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (
|
|
3
|
+
Copyright (c) 2025 Dario Passariello
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
4
14
|
|
|
5
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
6
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
7
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
8
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
9
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
10
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## CC BY 4.0
|
|
14
|
-
|
|
15
|
-
Attribution 4.0 International <https://creativecommons.org/licenses/by/4.0/>
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|

|
|
12
12
|

|
|
13
13
|
|
|
14
|
-

|
|
15
15
|
|
|
16
|
-
License is
|
|
16
|
+
License is MIT - free to use, modify, and distribute
|
|
17
17
|
|
|
18
18
|
## Table of Contents
|
|
19
19
|
|
|
@@ -26,6 +26,7 @@ License is private completely free to use (no modification)
|
|
|
26
26
|
- [useObserver Pattern](#useobserver-pattern)
|
|
27
27
|
- [Store](#store)
|
|
28
28
|
- [Session](#session)
|
|
29
|
+
- [Cache](#cache)
|
|
29
30
|
- [idb](#idb)
|
|
30
31
|
- [Testing](#testing)
|
|
31
32
|
- [Security](#security)
|
|
@@ -40,6 +41,18 @@ License is private completely free to use (no modification)
|
|
|
40
41
|
- Comprehensive test coverage
|
|
41
42
|
- Easy debugging with proxy-based state
|
|
42
43
|
|
|
44
|
+
## ⚠️ Enterprise Use
|
|
45
|
+
|
|
46
|
+
For **enterprise-level applications** requiring advanced state management, we recommend using **[@biglogic/rgs](https://npmjs.com/package/@biglogic/rgs)** instead of Memorio.
|
|
47
|
+
|
|
48
|
+
RGS provides:
|
|
49
|
+
- Enhanced scalability for large applications
|
|
50
|
+
- Advanced middleware support
|
|
51
|
+
- Enterprise-grade security features
|
|
52
|
+
- Professional support and maintenance
|
|
53
|
+
|
|
54
|
+
Memorio is ideal for small to medium projects, prototypes, and learning purposes.
|
|
55
|
+
|
|
43
56
|
## Installation
|
|
44
57
|
|
|
45
58
|
```bash
|
|
@@ -87,9 +100,10 @@ observer(
|
|
|
87
100
|
// useObserver Pattern
|
|
88
101
|
// Example: if you change the state.counter you get a console.log
|
|
89
102
|
useObserver(
|
|
90
|
-
() => {
|
|
103
|
+
(newValue, oldValue) => {
|
|
91
104
|
console.log(`Counter changed from ${oldValue} to ${newValue}`);
|
|
92
|
-
},
|
|
105
|
+
},
|
|
106
|
+
[state.counter]
|
|
93
107
|
);
|
|
94
108
|
|
|
95
109
|
|
|
@@ -118,9 +132,6 @@ const userName = state.user.name;
|
|
|
118
132
|
// Listing all states
|
|
119
133
|
console.log(state.list);
|
|
120
134
|
|
|
121
|
-
// Locking state (for Objects or Arrays)
|
|
122
|
-
state.user.lock();
|
|
123
|
-
|
|
124
135
|
// Removing state
|
|
125
136
|
state.remove('user');
|
|
126
137
|
|
|
@@ -129,70 +140,39 @@ state.removeAll();
|
|
|
129
140
|
|
|
130
141
|
```
|
|
131
142
|
|
|
132
|
-
### Observer
|
|
143
|
+
### Observer
|
|
133
144
|
|
|
134
|
-
|
|
145
|
+
> ⚠️ **Deprecated**: For React applications, use [`useObserver`](#useobserver-pattern) instead. The `observer` function is kept for non-React contexts.
|
|
135
146
|
|
|
136
|
-
|
|
147
|
+
## useObserver
|
|
137
148
|
|
|
138
|
-
|
|
139
|
-
observer(
|
|
140
|
-
'state.user',
|
|
141
|
-
(newValue, oldValue) => {
|
|
142
|
-
console.log('User updated:', newValue);
|
|
143
|
-
}
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
1. You can use in a function outside React
|
|
149
|
-
2. In a javascript function
|
|
150
|
-
3. in a setTimeout
|
|
149
|
+
useObserver is a React hook for observing Memorio state changes with auto-discovery:
|
|
151
150
|
|
|
152
151
|
```js
|
|
153
152
|
|
|
154
|
-
//
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
);
|
|
162
|
-
|
|
163
|
-
// With React useEffect to avoid multiple observer after update
|
|
164
|
-
useEffect(
|
|
165
|
-
() => {
|
|
166
|
-
observer(
|
|
167
|
-
'state.user',
|
|
168
|
-
() => {
|
|
169
|
-
setUser(state.user);
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
}, []
|
|
153
|
+
// Basic useObserver - array syntax with state path
|
|
154
|
+
useObserver(
|
|
155
|
+
(newValue, oldValue) => {
|
|
156
|
+
console.log('User updated:', newValue);
|
|
157
|
+
},
|
|
158
|
+
[state.user]
|
|
173
159
|
);
|
|
174
160
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
## useObserver Pattern
|
|
178
|
-
|
|
179
|
-
useObserve changes with React-like useEffect syntax:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
|
|
183
|
-
// Basic useObserver
|
|
161
|
+
// Multiple states
|
|
184
162
|
useObserver(
|
|
185
|
-
|
|
186
|
-
console.log('
|
|
187
|
-
|
|
188
|
-
|
|
163
|
+
(newValue, oldValue) => {
|
|
164
|
+
console.log('State changed:', newValue);
|
|
165
|
+
},
|
|
166
|
+
[state.user, state.counter, state.settings]
|
|
189
167
|
);
|
|
190
168
|
|
|
191
169
|
```
|
|
192
170
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
171
|
+
**Key differences from observer:**
|
|
172
|
+
1. Uses **array syntax** `[state.property]` instead of string path `'state.property'`
|
|
173
|
+
2. Automatically cleans up on component unmount
|
|
174
|
+
3. Works only inside React components
|
|
175
|
+
4. Callback receives `(newValue, oldValue)` parameters
|
|
196
176
|
|
|
197
177
|
## Store
|
|
198
178
|
|
|
@@ -241,6 +221,29 @@ session.remove('userSession');
|
|
|
241
221
|
session.removeAll();
|
|
242
222
|
```
|
|
243
223
|
|
|
224
|
+
## Cache
|
|
225
|
+
|
|
226
|
+
In-memory cache for temporary data storage:
|
|
227
|
+
|
|
228
|
+
```js
|
|
229
|
+
// Setting cache data
|
|
230
|
+
cache.set('tempData', { computed: true, value: 42 });
|
|
231
|
+
|
|
232
|
+
// Getting cache data
|
|
233
|
+
const cached = cache.get('tempData');
|
|
234
|
+
|
|
235
|
+
// Checking cache size
|
|
236
|
+
const cacheSize = cache.size();
|
|
237
|
+
|
|
238
|
+
// Removing cache data
|
|
239
|
+
cache.remove('tempData');
|
|
240
|
+
|
|
241
|
+
// Clearing all cache data
|
|
242
|
+
cache.removeAll();
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
**Note:** Cache data is stored in memory and will be lost on page refresh.
|
|
246
|
+
|
|
244
247
|
## idb
|
|
245
248
|
|
|
246
249
|
Permanent storage using browser database:
|
|
@@ -297,6 +300,6 @@ Security scans and reports are available at:
|
|
|
297
300
|
|
|
298
301
|
## License
|
|
299
302
|
|
|
300
|
-
|
|
303
|
+
MIT License
|
|
301
304
|
|
|
302
|
-
|
|
305
|
+
Copyrigth (c) [Dario Passariello](https://dario.passariello.ca/)
|
package/SECURITY.md
ADDED
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=(e,r)=>()=>(e&&(r=e(e=0)),r);var m,g=c(()=>{m={name:"memorio",version:"2.2.0",type:"module",private:!1,main:"index.js",license:"CC-BY 4.0",types:"index.d.ts",typings:"./types/*",description:"Memorio, State + Observer and Store for a easy life ",copyright:"Dario Passariello, BigLogic ca - a51.dev is a BigLogic project",homepage:"https://a51.gitbook.io/memorio",author:{name:"Dario Passariello",url:"https://dario.passariello.ca/",email:"dariopassariello@gmail.com"},support:{name:"Dario Passariello",url:"https://github.com/passariello/",email:"dariopassariello@gmail.com"},contributors:[{name:"Dario Passariello",email:"dariopassarielloa@gmail.com"},{name:"Valeria Cala Scaglitta",email:"valeriacalascaglitta@gmail.com"}],keywords:["biglogic","a51","memorio","state","store","observer","useObserver","dario","passariello"],funding:[{type:"patreon",url:"https://www.patreon.com/passariello"}],typing:["types/*"],exports:{import:"./index.js",require:"./index.js",default:"./index.js"},scripts:{build:"node ./esbuild.config.mjs",watch:'nodemon --watch * --exec "npm run build "',test:"cd tests/jest && npm run test","-----------":"","npm:publish":"npm run build && npm publish ./dist"},dependencies:{"dphelper.types":"0.0.20"},devDependencies:{"@babel/eslint-parser":"^7.28.6","@eslint/js":"9.39.2","@testing-library/jest-dom":"6.9.1","@types/jest":"30.0.0","@types/node":"25.0.10","@typescript-eslint/eslint-plugin":"8.54.0","@typescript-eslint/parser":"8.54.0",esbuild:"0.27.2","esbuild-node-externals":"1.20.1","esbuild-plugin-alias":"0.2.1","esbuild-plugin-clean":"1.0.1","esbuild-plugin-copy":"2.1.1","esbuild-sass-plugin":"3.6.0","esbuild-scss-modules-plugin":"1.1.1",eslint:"9.39.2",jest:"30.2.0","jest-environment-jsdom":"30.2.0","ts-jest":"29.4.6","ts-loader":"^9.5.4","ts-node":"10.9.2",tslib:"^2.8.1",typescript:"5.9.3"}}});var v,f=c(()=>{"use strict";s();g();Object.defineProperty(globalThis,"memorio",{value:{},writable:!1,configurable:!0,enumerable:!1});Object.defineProperty(globalThis,"events",{value:{},writable:!0,enumerable:!1});Object.defineProperty(memorio,"version",{writable:!1,enumerable:!1,value:m.version});v=["list","state","store","idb","observer","useObserver","remove","removeAll"]});var y=c(()=>{"use strict";s();Object.defineProperty(memorio,"dispatch",{writable:!1,enumerable:!1,value:{set:(e,r={})=>{dispatchEvent(new CustomEvent(String(e),r))},listen:(e,r=null,o=!1)=>{observer.list?.[e]?.length>0&&observer.remove(e);let a=t=>r?setTimeout(()=>r(t),1):null;globalThis.addEventListener(e,a),globalThis.events[e]=a},remove:e=>{globalThis.removeEventListener(e,globalThis.events[e]),delete globalThis.events[e]}}})});var h=c(()=>{"use strict";s();memorio.propertyName=function(e,r){return String(r).replace("() => ","")}});var j,S,O=c(()=>{"use strict";s();f();Object.defineProperty(memorio,"objPath",{writable:!1,enumerable:!1,value:(e,r,o=".")=>r.concat(e).join(o)});j=(e,r,o=[])=>{let a=t=>{let n=t.split(".");n.forEach((i,l)=>{let u=n.slice(0,l+1).join(".");globalThis.memorio.dispatch.set(u,{detail:{name:u}})})};return new Proxy(e,{get(t,n){if(n==="list")return console.log('Some state could be hidden when you use "state.list". Use "state" to see the complete list '),JSON.parse(JSON.stringify(state));if(n==="remove")return function(i){return delete t[i],!0};if(n==="removeAll")return function(){try{for(let i in t)typeof t[i]!="function"&&!["list","remove","removeAll"].includes(i)&&(Object.isFrozen(t[i])||delete t[i],delete t[i])}catch(i){console.error(i)}};if(Object.isFrozen(t[n]))return t[n];try{let i=Reflect.get(t,n);return i&&typeof i=="object"&&["Array","Object"].includes(i.constructor.name)?j(i,r,o.concat(n)):i}catch(i){console.error("Error: ",i);return}},set(t,n,i){if(v.includes(n))return console.error("key "+n+" is protected"),!1;if(t[n]&&typeof t[n]=="object"&&Object.isFrozen(t[n]))return console.error(`Error: state '${n}' is locked`),!1;try{let l=globalThis.memorio.objPath(n,o);return r({action:"set",path:l,target:t,newValue:i,previousValue:Reflect.get(t,n)}),a("state."+l),Reflect.set(t,n,i),t[n]&&typeof t[n]=="object"&&Reflect.defineProperty(t[n],"lock",{value(){Object.defineProperty(t,n,{writable:!1,enumerable:!1}),Object.freeze(t[n])}}),!0}catch(l){console.error("Error in set trap:",l);return}},deleteProperty(t,n){try{let i=globalThis.memorio.objPath(n,o);return r({action:"delete",path:i,target:t}),Reflect.deleteProperty(t,n)}catch(i){console.error("Error in deleteProperty trap:",i);return}}})};globalThis?.state?globalThis.state=state:globalThis.state=j({},()=>{});S=new WeakSet;S.add(state);setInterval(()=>{if(!S.has(state)){alert("Memorio state is compromised, check if you override it and please reload the page");for(let e=1;e<99999;e++)clearInterval(e);stop()}},1e3);Object.defineProperty(globalThis,"state",{enumerable:!1,configurable:!0})});var x=c(()=>{"use strict";s();globalThis.observer||(globalThis.observer=null);Object.defineProperty(globalThis,"observer",{enumerable:!1,configurable:!0});observer=(e,r=null,o=!0)=>{try{if(!(t=>t.split(".")[0]!=="state"?(console.error(`Observer Error: You need to declare 'state.' or 'store.'. The '${t}' string is incorrect!`),!1):!0)(e))return}catch(a){console.error(a);return}if(!e&&!r){console.error("Observer Error: You need to setup observer correctly, Some parameters are missed!");return}if(!e&&r){console.error("Observer Error: You need to declare what state need to be monitored as string like 'state.test'.");return}if(e&&!r){let a=(String(e),{detail:{name:String(e)}});globalThis.observer.list[e]&&globalThis.memorio.dispatch.remove(a),globalThis.observer.list[e]||globalThis.memorio.dispatch.listen(a),console.debug("called: ",e);return}if(e&&r){if(typeof e!="string"||typeof r!="function"){console.error("Observer Error: name of state need to be a 'string' like 'state.test' and the callback need to be a 'function'");return}globalThis.observer.list[e]&&globalThis.memorio.dispatch.remove(e,r,o),globalThis.observer.list[e]||globalThis.memorio.dispatch.listen(e,r,o);return}};Object.defineProperties(observer,{list:{get:()=>globalThis.events},remove:{value:e=>{e&&(globalThis.memorio.dispatch.remove(e),delete globalThis.events[e])}},removeAll:{get:()=>{Object.entries(observer.list).forEach(e=>{globalThis.events[e[0]]})}}});Object.freeze(observer)});var w=c(()=>{"use strict";s();globalThis.useObserver||(globalThis.useObserver=null);Object.defineProperty(globalThis,"useObserver",{enumerable:!1,configurable:!0});useObserver=(e,r)=>{let o=memorio.propertyName(state,r);try{return observer(o,()=>e()),!0}catch(a){console.error(a);return}};Object.freeze(useObserver)});var P=c(()=>{"use strict";s();Object.defineProperty(globalThis,"store",{value:new Proxy({},{}),enumerable:!1,configurable:!0});Object.defineProperties(store,{get:{value(e){if(e){try{let r=localStorage.getItem(e);return r&&JSON.parse(r)}catch(r){console.error(`Error parsing store item '${e}':`,r)}return null}}},set:{value(e,r){if(e){try{r==null?localStorage.setItem(e,JSON.stringify(null)):typeof r=="object"||typeof r=="number"||typeof r=="boolean"||typeof r=="string"?localStorage.setItem(e,JSON.stringify(r)):typeof r=="function"&&console.error("It's not secure to store functions.")}catch(o){console.error(`Error setting store item '${e}':`,o)}return null}}},remove:{value(e){if(e)return localStorage.getItem(e)?(localStorage.removeItem(e),!0):!1}},delete:{value(e){return store.remove(e),!0}},removeAll:{value(){return localStorage.clear(),!0}},clearAll:{value(){return store.removeAll(),!0}},quota:{value(){"storage"in navigator&&"estimate"in navigator.storage&&navigator.storage.estimate().then(({usage:e,quota:r})=>(e&&r&&console.debug(`Using ${e/1024} out of ${r/1024} Mb.`),[e/1024,r/1024])).catch(e=>{console.error("Error estimating quota:",e)})}},size:{value(){let e=0;for(let r in localStorage)if(localStorage.hasOwnProperty(r)){let o=localStorage.getItem(r);o&&(e+=o.length)}return e}}});Object.freeze(store)});var T=c(()=>{"use strict";s();Object.defineProperty(globalThis,"session",{value:new Proxy({},{}),enumerable:!1,configurable:!0});Object.defineProperties(session,{get:{value(e){if(e)try{let r=sessionStorage.getItem(e);return r&&JSON.parse(r)}catch(r){console.error(`Error parsing session item '${e}':`,r)}}},set:{value(e,r){if(e)try{r==null?sessionStorage.setItem(e,JSON.stringify(null)):typeof r=="object"||typeof r=="number"||typeof r=="boolean"||typeof r=="string"?sessionStorage.setItem(e,JSON.stringify(r)):typeof r=="function"&&console.error("It's not secure to session functions.")}catch(o){console.error(`Error setting session item '${e}':`,o)}}},remove:{value(e){if(e&&sessionStorage.getItem(e))return sessionStorage.removeItem(e),!0}},delete:{value(e){return session.remove(e),!0}},removeAll:{value(){return sessionStorage.clear(),!0}},clearAll:{value(){return session.removeAll(),!0}},quota:{value(){"storage"in navigator&&"estimate"in navigator.storage&&navigator.storage.estimate().then(({usage:e,quota:r})=>{e&&r&&console.debug(`Using ${e/1024} out of ${r/1024} Mb.`)}).catch(e=>{console.error("Error estimating quota:",e)})}},size:{value(){let e=0;for(let r in sessionStorage)if(sessionStorage.hasOwnProperty(r)){let o=sessionStorage.getItem(r);o&&(e+=o.length)}return e}}});Object.freeze(session)});var D=c(()=>{"use strict";s();Object.defineProperty(window,"cache",{value:new Proxy({},{}),enumerable:!1,configurable:!0})});var W={};var E=c(()=>{"use strict";s();idb.db.create=(e,r=1)=>{idb.db.support();let o=indexedDB.open(e,r);o.onerror=()=>{console.error(`IndexedDB error: ${o.errorCode}`)},o.onsuccess=()=>{console.debug("Successful database connection")},o.onupgradeneeded=()=>{console.debug("Database created")},idb.db.list()}});var H={};var I=c(()=>{"use strict";s();idb.db.list=()=>(indexedDB.databases().then(e=>e).then(e=>{e&&(idbases=e)}).catch(e=>{console.error(e)}),idb.db.size(),idbases);setInterval(()=>{idb.db.list()},1e3)});var K={};var $=c(()=>{"use strict";s();idb.db.exist=e=>idbases?.find(r=>r.name===e)!==void 0});var N={};var z=c(()=>{"use strict";s();idb.db.quota=()=>navigator.storage.estimate()});var Q={};var B=c(()=>{"use strict";s();idb.db.delete=e=>{if(console.log(`Remove ${e}...`),!!idb.db.exist(e))if(typeof layerpro=="function"){confirm(`Are you sure to remove "${e}" database?`,()=>{setTimeout(()=>{indexedDB.deleteDatabase(e),console.debug(`${e} removed`),idb.db.list()},1e3)},()=>alert("Operation cancelled."));return}else{confirm(`Are you sure to remove "${e}" database?`)?setTimeout(()=>{indexedDB.deleteDatabase(e),console.debug(`${e} removed`),idb.db.list()},1e3):alert("Operation cancelled.");return}}});var X={};var A=c(()=>{"use strict";s();idb.db.size=()=>{idbases?.map(e=>{if(!idb.db.exist(e))return null;let r=dphelper.array.findindex(idbases,e.name),o=indexedDB?.open(e.name,idb.db.version(e.name));return o.onerror=a=>console.error("Error on IndexedDB"),o.onsuccess=a=>{let t=a.target.result,n=[...t.objectStoreNames];((l,u)=>{let b=l.reduce((d,p)=>(d.push(idb.table.size(u,p)),d),[]);b.map(d=>{let p=d.reduce((U,k)=>U+k,0);return Number.parseInt(dphelper.dev.byteSize(p)),null}),idbases[r].size=b.length>0?b:0})(n,t)},null})}});var Z={};var q=c(()=>{"use strict";s();idb.db.version=e=>{let r=0;for(let o of idbases){o.name===e&&(r=o.version);break}return r}});var _={};var C=c(()=>{"use strict";s();idb.db.support=()=>{if("indexedDB"in window)return!0;console.error("Your browser doesn't support IndexedBD")}});var ee={};var J=c(()=>{"use strict";s();idb.table.create=(e,r)=>{try{let o=Number(idb.db.version(e))+1,a=indexedDB.open(e,o);try{a.onupgradeneeded=t=>{let n=t.target,i=n.result,l=i.createObjectStore(r,{keyPath:"id",unique:!0,autoincrement:!0});l.createIndex("id","id"),l.createIndex("data","data"),i.close(),a?.result?.close(),a=void 0,idb.db.list()}}catch(t){console.error(">>",t);return}}catch(o){console.error(">>>",o);return}return!1}});var re={};var R=c(()=>{"use strict";s();idb.table.size=(e,r)=>(idb.db.list(),new Promise((o,a)=>{if(e==null)return a();let t=event,n=0;e=t.target.result;let i=e.transaction([r]).objectStore(r).openCursor();i.onsuccess=(l=>{let u=l.target.result;if(u){let b=u.value,d=JSON.stringify(b);n+=d.length,u.continue()}else o(n)}),i.onerror=l=>a(`error in ${r}: ${l}`)}))});var te={};var V=c(()=>{"use strict";s();idb.data.delete=(e,r,o)=>{if(!idb.db.exist(e))return;let a=indexedDB.open(e,idb.db.version(e));a.onsuccess=()=>{let t=a.result,n=t.transaction(r,"readwrite");n.objectStore(r).put(o),a.onerror=l=>{console.debug(l,`Database insert error: ${l.target.errorCode}`)},n.onerror=l=>{console.debug(event,`Database insert error: ${l.target.errorCode}`)},t.close(),idb.db.list(),console.debug("Store inserted")}};idb.data.delete.all=(e,r)=>{idb.db.list();let o=indexedDB.open(e);o.onsuccess=a=>{let n=a.target.result.transaction(r).objectStore(r).set({});n.onsuccess=i=>{console.log(i)}}}});var oe={};var Y=c(()=>{"use strict";s();idb.data.set=(e,r,o)=>{if(!idb.exist(e))return;let a=indexedDB.open(e,idb.version(e));a.onsuccess=()=>{let t=a.result,n=t.transaction(r,"readwrite");n.objectStore(r).put(o),a.onerror=l=>{console.debug(l,`Database insert error: ${l.target.errorCode}`)},n.onerror=l=>{console.debug(event,`Database insert error: ${l.target.errorCode}`)},t.close(),idb.databases(),console.debug("IndexDB inserted")}}});var se={};var L,M=c(()=>{"use strict";s();idb.data.get=(e,r,o)=>{idb.db.list();let a=indexedDB.open(e);return a.onsuccess=t=>{let n=t.target.result,i=n.transaction(r).objectStore(r).get(o);i.onsuccess=l=>(L=i.result,i.result)},L}});var F=c(()=>{"use strict";s();Object.defineProperty(window,"idb",{value:{db:{},table:{},data:{}},writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(window,"idbases",{value:[],writable:!0,configurable:!0,enumerable:!1}),Promise.resolve().then(()=>E()),Promise.resolve().then(()=>I()),Promise.resolve().then(()=>$()),Promise.resolve().then(()=>z()),Promise.resolve().then(()=>B()),Promise.resolve().then(()=>A()),Promise.resolve().then(()=>q()),Promise.resolve().then(()=>C()),Promise.resolve().then(()=>J()),Promise.resolve().then(()=>R()),Promise.resolve().then(()=>V()),Promise.resolve().then(()=>Y()),Promise.resolve().then(()=>M()),Object.preventExtensions(idb),Object.seal(idb),Object.freeze(idb)});import"dphelper.types";import"dphelper.types";var s=c(()=>{f();y();h();O();x();w();P();T();D();F()});s();
|
|
1
|
+
var l=(e,r)=>()=>(e&&(r=e(e=0)),r);var p,h=l(()=>{p={name:"memorio",version:"2.5.0",type:"module",private:!1,main:"index.js",license:"MIT",typings:"./types/*",description:"Memorio, State + Observer and Store for an easy life",copyright:"Copyright (c) 2025 Dario Passariello",homepage:"https://a51.gitbook.io/memorio",author:{name:"Dario Passariello",url:"https://dario.passariello.ca/",email:"dariopassariello@gmail.com"},support:{name:"Dario Passariello",url:"https://github.com/passariello/",email:"dariopassariello@gmail.com"},contributors:[{name:"Dario Passariello",email:"dariopassarielloa@gmail.com"},{name:"Valeria Cala Scaglitta",email:"valeriacalascaglitta@gmail.com"}],keywords:["biglogic","a51","memorio","state","store","observer","useObserver","dario","passariello"],funding:[{type:"patreon",url:"https://www.patreon.com/passariello"}],typing:["types/*"],exports:{".":{types:"./types/index.d.ts",import:"./index.js",default:"./index.js"},"./types/*":"./types/*"},scripts:{build:"node ./esbuild.config.mjs",watch:'nodemon --watch * --exec "npm run build "',"npm:publish":"npm run build && npm publish ./dist",test:"cd tests && npm run test",lint:"cd tests && npm run lint",tsc:"cd tests && tsc --noEmit"},dependencies:{"dphelper.types":"0.0.20"},devDependencies:{"@types/node":"25.3.1",esbuild:"0.27.3","esbuild-node-externals":"1.20.1","esbuild-plugin-alias":"0.2.1","esbuild-plugin-copy":"2.1.1",typescript:"5.9.3"}}});var y,f=l(()=>{"use strict";a();h();Object.defineProperty(globalThis,"memorio",{value:{},writable:!1,configurable:!0,enumerable:!1});Object.defineProperty(globalThis,"events",{value:{},writable:!0,enumerable:!1});Object.defineProperty(memorio,"version",{writable:!1,enumerable:!1,value:p.version});y=["list","state","store","idb","observer","useObserver","remove","removeAll"]});var v=l(()=>{"use strict";a();Object.defineProperty(memorio,"dispatch",{writable:!1,enumerable:!1,value:{set:(e,r={})=>{globalThis.dispatchEvent(new CustomEvent(String(e),r))},listen:(e,r=null,o=!1)=>{globalThis.observer?.list?.[e]?.length>0&&globalThis.observer.remove(e);let n=t=>r?setTimeout(()=>r(t),1):null;globalThis.addEventListener(e,n),globalThis.events[e]=n},remove:e=>{globalThis.removeEventListener(e,globalThis.events[e]),delete globalThis.events[e]}}})});var T=l(()=>{"use strict";a();memorio.propertyName=(e,r)=>String(r).replace("() => ","")});var S,O,P=l(()=>{"use strict";a();f();Object.defineProperty(memorio,"objPath",{writable:!1,enumerable:!1,value:(e,r,o=".")=>{let n=r.concat(e).join(o);return globalThis.memorio._tracking&&globalThis.memorio._trackedPaths.add("state."+n),n}});globalThis.memorio._tracking=!1;globalThis.memorio._trackedPaths=new Set;globalThis.memorio._locked=!1;S=e=>new Proxy({},{get(r,o){return o===Symbol.toPrimitive||o==="toString"?()=>e:S(`${e}.${String(o)}`)}}),O=(e,r,o=[])=>{let n=t=>{globalThis.memorio.dispatch.set(t,{detail:{name:t}})};return new Proxy(e,{get(t,s){if(s==="__path")return o.length>0?"state."+o.join("."):"state";if(s==="path")return S("state");if(s==="list")return console.debug('Some state could be hidden when you use "state.list". Use "state" to see the complete list '),JSON.parse(JSON.stringify(globalThis.state));if(globalThis.memorio._tracking&&typeof s=="string"){let i=o.length>0?"state."+o.concat(s).join("."):"state."+s;globalThis.memorio._trackedPaths.add(i)}if(s==="remove")return i=>(delete t[i],!0);if(s==="removeAll")return()=>{try{for(let i in t)typeof t[i]!="function"&&!["list","remove","removeAll"].includes(i)&&(Object.isFrozen(t[i])||delete t[i],delete t[i])}catch(i){console.debug(i)}};if(Object.isFrozen(t[s]))return t[s];try{let i=Reflect.get(t,s);return i&&typeof i=="object"&&["Array","Object"].includes(i.constructor.name)?O(i,r,o.concat(s)):i}catch(i){console.error("Error: ",i);return}},set(t,s,i){if(globalThis.memorio._locked)return console.error("Error: state is locked. Use state.unlock() to enable modifications."),!1;if(y.includes(s))return console.error("key "+s+" is protected"),!1;if(t[s]&&typeof t[s]=="object"&&Object.isFrozen(t[s]))return console.error(`Error: state '${s}' is locked`),!1;try{let u=globalThis.memorio.objPath(s,o);return r({action:"set",path:u,target:t,newValue:i,previousValue:Reflect.get(t,s)}),n("state."+u),Reflect.set(t,s,i),t[s]&&typeof t[s]=="object"&&Reflect.defineProperty(t[s],"lock",{value:()=>{Object.defineProperty(t,s,{writable:!1,enumerable:!1}),Object.freeze(t[s])}}),!0}catch(u){console.error("Error in set trap:",u);return}},deleteProperty(t,s){try{let i=globalThis.memorio.objPath(s,o);return r({action:"delete",path:i,target:t}),Reflect.deleteProperty(t,s)}catch(i){console.error("Error in deleteProperty trap:",i);return}}})};globalThis?.state?globalThis.state=state:globalThis.state=O({},()=>{});globalThis.state.lock=()=>{globalThis.memorio._locked=!0,console.info("State is now locked. All modifications are blocked.")};globalThis.state.unlock=()=>{globalThis.memorio._locked=!1,console.info("State is now unlocked. Modifications are allowed.")};Object.defineProperty(globalThis,"state",{enumerable:!1,configurable:!0})});var j=l(()=>{"use strict";a();globalThis.observer||(globalThis.observer=null);Object.defineProperty(globalThis,"observer",{enumerable:!1,configurable:!0});globalThis.observer=(e,r=null,o=!0)=>{console.warn('DEPRECATED: "observer" is deprecated and will be removed in future versions. Please use "useObserver" instead.');try{if(!(t=>t.split(".")[0]!=="state"?(console.error(`Observer Error: You need to declare 'state.' or 'store.'. The '${t}' string is incorrect!`),!1):!0)(e))return}catch(n){console.error(n);return}if(!e&&!r){console.error("Observer Error: You need to setup observer correctly, Some parameters are missed!");return}if(!e&&r){console.error("Observer Error: You need to declare what state need to be monitored as string like 'state.test'.");return}if(e&&!r){let n=(String(e),{detail:{name:String(e)}});globalThis.observer.list[e]&&globalThis.memorio.dispatch.remove(n),globalThis.observer.list[e]||globalThis.memorio.dispatch.listen(n),console.debug("called: ",e);return}if(e&&r){if(typeof e!="string"||typeof r!="function"){console.error("Observer Error: name of state need to be a 'string' like 'state.test' and the callback need to be a 'function'");return}globalThis.observer.list[e]&&globalThis.memorio.dispatch.remove(e,r,o),globalThis.observer.list[e]||globalThis.memorio.dispatch.listen(e,r,o);return}};Object.defineProperties(globalThis.observer,{list:{get:()=>globalThis.events},remove:{value:e=>{e&&(globalThis.memorio.dispatch.remove(e),delete globalThis.events[e])}},removeAll:{get:()=>(Object.keys(globalThis.observer.list).forEach(e=>{globalThis.observer.remove(e)}),!0)}});Object.freeze(observer)});var w=l(()=>{"use strict";a();globalThis.useObserver||(globalThis.useObserver=null);Object.defineProperty(globalThis,"useObserver",{value:null,writable:!0,enumerable:!1,configurable:!0});globalThis.useObserver=((e,r)=>{if(!r||typeof e!="function")return()=>{};let o=[],n=Array.isArray(r)&&!r.__path?r:[r];try{return n.forEach(t=>{let s="";if(typeof t=="function"?s=globalThis.memorio.propertyName(globalThis.state,t):typeof t=="object"&&t!==null?s=t.__path||(typeof t.toString=="function"&&t.toString()!=="[object Object]"?t.toString():""):typeof t=="string"&&(t.startsWith("state.")||t.startsWith("store."))&&(s=t),s){s=s.replace(/^(\(\)\s*=>\s*)/,"").replace(/^globalThis\./,"").replace(/^state\./,"");let i=s.startsWith("store.")||s.startsWith("state.")?s:"state."+s;globalThis.memorio.dispatch.listen(i,()=>e()),o.push(i)}else{globalThis.memorio._trackedPaths.clear(),globalThis.memorio._tracking=!0;try{e()}catch{}globalThis.memorio._tracking=!1,globalThis.memorio._trackedPaths.forEach(i=>{o.includes(i)||(console.info(`useObserver: [Auto-Discovery] -> "${i}"`),globalThis.memorio.dispatch.listen(i,()=>e()),o.push(i))})}}),o.length>0?console.info(`useObserver: Monitoring ${o.length} paths.`):console.warn("useObserver: No paths resolved for monitoring. Check your dependencies!"),()=>{o.forEach(t=>{globalThis.memorio.dispatch&&typeof globalThis.memorio.dispatch.remove=="function"&&(globalThis.memorio.dispatch.remove(t),console.debug(`useObserver: Stopped monitoring "${t}"`))})}}catch(t){return console.debug("useObserver Error:",t),()=>{}}});Object.freeze(globalThis.useObserver)});var x=l(()=>{"use strict";a();Object.defineProperty(globalThis,"store",{value:new Proxy({},{}),enumerable:!1,configurable:!0});Object.defineProperties(store,{get:{value:e=>{if(e){try{let r=globalThis.localStorage.getItem(e);return r&&JSON.parse(r)}catch(r){console.debug(`Error parsing store item '${e}':`,r)}return null}}},set:{value:(e,r)=>{if(e){try{r==null?globalThis.localStorage.setItem(e,JSON.stringify(null)):typeof r=="object"||typeof r=="number"||typeof r=="boolean"||typeof r=="string"?globalThis.localStorage.setItem(e,JSON.stringify(r)):typeof r=="function"&&console.debug("It's not secure to store functions.")}catch(o){console.debug(`Error setting store item '${e}':`,o)}return null}}},remove:{value:e=>{if(e)return globalThis.localStorage.getItem(e)?(globalThis.localStorage.removeItem(e),!0):!1}},delete:{value:e=>(store.remove(e),!0)},removeAll:{value:()=>(globalThis.localStorage.clear(),!0)},clearAll:{value:()=>(store.removeAll(),!0)},quota:{value:async()=>globalThis.navigator&&"storage"in globalThis.navigator&&"estimate"in globalThis.navigator.storage?globalThis.navigator.storage.estimate().then(({usage:e,quota:r})=>(e&&r&&console.debug(`Using ${e/1024} out of ${r/1024} Mb.`),[e/1024,r/1024])).catch(e=>(console.debug("Error estimating quota:",e),[0,0])):[0,0]},size:{value:()=>{let e=0;return Object.keys(globalThis.localStorage).forEach(r=>{let o=globalThis.localStorage.getItem(r);o&&(e+=o.length)}),e}}});Object.freeze(store)});var E=l(()=>{"use strict";a();Object.defineProperty(globalThis,"session",{value:new Proxy({},{}),enumerable:!1,configurable:!0});Object.defineProperties(session,{get:{value:e=>{if(e)try{let r=globalThis.sessionStorage.getItem(e);return r&&JSON.parse(r)}catch(r){console.debug(`Error parsing session item '${e}':`,r)}}},set:{value:(e,r)=>{if(e)try{r==null?globalThis.sessionStorage.setItem(e,JSON.stringify(null)):typeof r=="object"||typeof r=="number"||typeof r=="boolean"||typeof r=="string"?globalThis.sessionStorage.setItem(e,JSON.stringify(r)):typeof r=="function"&&console.debug("It's not secure to session functions.")}catch(o){console.debug(`Error setting session item '${e}':`,o)}}},remove:{value:e=>{if(e&&globalThis.sessionStorage.getItem(e))return globalThis.sessionStorage.removeItem(e),!0}},delete:{value:e=>(session.remove(e),!0)},removeAll:{value:()=>(globalThis.sessionStorage.clear(),!0)},clearAll:{value:()=>(session.removeAll(),!0)},quota:{value:async()=>globalThis.navigator&&"storage"in globalThis.navigator&&"estimate"in globalThis.navigator.storage?globalThis.navigator.storage.estimate().then(({usage:e,quota:r})=>(e&&r&&console.debug(`Using ${e/1024} out of ${r/1024} Mb.`),[e/1024,r/1024])).catch(e=>(console.debug("Error estimating quota:",e),[0,0])):[0,0]},size:{value:()=>{let e=0;return Object.keys(globalThis.sessionStorage).forEach(r=>{let o=globalThis.sessionStorage.getItem(r);o&&(e+=o.length)}),e}}});Object.freeze(session)});var d,D=l(()=>{"use strict";a();d={};Object.defineProperty(globalThis,"cache",{value:new Proxy({},{get(e,r){let o=r;return o==="get"?n=>d[n]:o==="set"?(n,t)=>{d[n]=t}:o==="remove"?n=>(delete d[n],!0):o==="removeAll"?()=>(Object.keys(d).forEach(n=>delete d[n]),!0):o==="clear"?()=>(Object.keys(d).forEach(n=>delete d[n]),!0):d[o]},set(e,r,o){return d[r]=o,!0},deleteProperty(e,r){return delete d[r],!0}}),enumerable:!1,configurable:!0});Object.freeze(cache)});var U={};var $=l(()=>{"use strict";a();idb.db.create=(e,r=1)=>new Promise((o,n)=>{if(!idb.db.support())return n(new Error("IndexedDB not supported"));let t=globalThis.indexedDB.open(e,r);t.onerror=()=>{console.debug(`IndexedDB error: ${t.error?.message}`),n(t.error)},t.onsuccess=()=>{console.debug(`Database ${e} connected successfully`),idb.db.list(),o(t.result)},t.onupgradeneeded=()=>{console.debug(`Database ${e} upgrade/creation initiated`)}})});var W={};var k=l(()=>{"use strict";a();idb.db.list=async()=>{if(!("indexedDB"in globalThis)||!indexedDB.databases)return[];try{let e=await indexedDB.databases();return globalThis.idbases=e||[],await idb.db.size(),globalThis.idbases}catch(e){return console.error("Error listing databases:",e),[]}};idb.db.list()});var Y={};var I=l(()=>{"use strict";a();idb.db.exist=e=>idbases?.some(r=>r.name===e)});var L={};var z=l(()=>{"use strict";a();idb.db.quota=()=>navigator.storage.estimate()});var G={};var _=l(()=>{"use strict";a();idb.db.delete=e=>new Promise((r,o)=>{console.debug(`Removing database ${e}...`);let n=()=>{let t=indexedDB.deleteDatabase(e);t.onsuccess=()=>{console.debug(`${e} database removed successfully`),idb.db.list(),r()},t.onerror=()=>{console.error(`Error removing ${e}:`,t.error),o(t.error)},t.onblocked=()=>{console.warn(`Deletion of ${e} is blocked. Please close other tabs.`)}};confirm(`Are you sure you want to remove the "${e}" database?`)?n():(console.debug("Database deletion cancelled by user."),r())})});var H={};var A=l(()=>{"use strict";a();idb.db.size=async()=>{if(!(!idbases||idbases.length===0))for(let e=0;e<idbases.length;e++){let r=idbases[e];try{let o=await idb.db.create(r.name,r.version),n=Array.from(o.objectStoreNames),t=0;for(let s of n){let i=await idb.table.size(o,s);t+=i}r.size=t,o.close()}catch(o){console.debug(`Could not calculate size for ${r.name}:`,o)}}}});var K={};var B=l(()=>{"use strict";a();idb.db.version=e=>{let r=0;for(let o of idbases){o.name===e&&(r=o.version);break}return r}});var Q={};var q=l(()=>{"use strict";a();idb.db.support=()=>{let e="indexedDB"in globalThis;return e||console.debug("Your environment doesn't support IndexedDB"),e}});var X={};var R=l(()=>{"use strict";a();idb.table.create=(e,r)=>new Promise(async(o,n)=>{try{let s=(Number(idb.db.version(e))||0)+1,i=indexedDB.open(e,s);i.onupgradeneeded=u=>{let b=u.target.result;if(!b.objectStoreNames.contains(r)){let c=b.createObjectStore(r,{keyPath:"id",autoIncrement:!0});c.createIndex("id","id",{unique:!0}),c.createIndex("data","data",{unique:!1}),console.debug(`Table ${r} created in ${e}`)}},i.onsuccess=()=>{i.result.close(),idb.db.list(),o()},i.onerror=()=>{console.error(`Error creating table ${r}:`,i.error),n(i.error)}}catch(t){console.error("Critical error in table.create:",t),n(t)}})});var Z={};var N=l(()=>{"use strict";a();idb.table.size=(e,r)=>new Promise((o,n)=>{if(!e)return n(new Error("Database instance is required"));if(!e.objectStoreNames.contains(r))return o(0);let t=0,s=0,b=e.transaction([r],"readonly").objectStore(r).openCursor();b.onsuccess=async c=>{let g=c.target.result;if(g){try{let m=g.value;t+=JSON.stringify(m).length}catch(m){console.debug("Error stringifying IDB value tracking size:",m)}s++,s%200===0&&await new Promise(m=>setTimeout(m,0)),g.continue()}else o(t)},b.onerror=()=>{n(b.error)}})});var ee={};var C=l(()=>{"use strict";a();idb.data.delete=(e,r,o)=>new Promise((n,t)=>{let s=indexedDB.open(e);s.onsuccess=()=>{let i=s.result;if(!i.objectStoreNames.contains(r))return i.close(),t(new Error(`Table ${r} not found`));let c=i.transaction(r,"readwrite").objectStore(r).delete(o);c.onsuccess=()=>{i.close(),console.debug(`Record ${o} deleted from ${r}`),n()},c.onerror=()=>{i.close(),t(c.error)}},s.onerror=()=>t(s.error)});idb.data.delete.all=(e,r)=>new Promise((o,n)=>{let t=indexedDB.open(e);t.onsuccess=s=>{let i=s.target.result;if(!i.objectStoreNames.contains(r))return i.close(),n(new Error(`Table ${r} not found`));let c=i.transaction(r,"readwrite").objectStore(r).clear();c.onsuccess=()=>{i.close(),console.debug(`All data cleared from ${r}`),o()},c.onerror=()=>{i.close(),n(c.error)}},t.onerror=()=>n(t.error)})});var re={};var J=l(()=>{"use strict";a();idb.data.set=(e,r,o)=>new Promise((n,t)=>{let s=indexedDB.open(e);s.onsuccess=()=>{let i=s.result;if(!i.objectStoreNames.contains(r))return i.close(),t(new Error(`Table ${r} does not exist in ${e}`));let c=i.transaction(r,"readwrite").objectStore(r).put(o);c.onsuccess=()=>{i.close(),console.debug(`Data saved in ${e}.${r}`),n(c.result)},c.onerror=g=>{i.close(),console.debug(`Database insert error: ${c.error?.message}`),t(c.error)}},s.onerror=()=>{t(s.error)}})});var te={};var V=l(()=>{"use strict";a();idb.data.get=(e,r,o)=>new Promise((n,t)=>{let s=indexedDB.open(e);s.onsuccess=i=>{let u=i.target.result;if(!u.objectStoreNames.contains(r))return u.close(),t(new Error(`Table ${r} not found in ${e}`));let g=u.transaction(r,"readonly").objectStore(r).get(o);g.onsuccess=()=>{u.close(),n(g.result)},g.onerror=()=>{u.close(),t(g.error)}},s.onerror=()=>{t(s.error)}})});var M=l(()=>{"use strict";a();(async()=>(Object.defineProperty(globalThis,"idb",{value:{db:{},table:{},data:{}},writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"idbases",{value:[],writable:!0,configurable:!0,enumerable:!1}),await Promise.all([Promise.resolve().then(()=>($(),U)),Promise.resolve().then(()=>(k(),W)),Promise.resolve().then(()=>(I(),Y)),Promise.resolve().then(()=>(z(),L)),Promise.resolve().then(()=>(_(),G)),Promise.resolve().then(()=>(A(),H)),Promise.resolve().then(()=>(B(),K)),Promise.resolve().then(()=>(q(),Q)),Promise.resolve().then(()=>(R(),X)),Promise.resolve().then(()=>(N(),Z)),Promise.resolve().then(()=>(C(),ee)),Promise.resolve().then(()=>(J(),re)),Promise.resolve().then(()=>(V(),te))]),Object.preventExtensions(idb),Object.seal(idb),Object.freeze(idb)))()});import"dphelper.types";var a=l(()=>{f();v();T();P();j();w();x();E();D();M()});a();
|
package/index.js.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../functions/idb/tools/db.create.ts", "../functions/idb/tools/db.list.ts", "../functions/idb/tools/db.exist.ts", "../functions/idb/tools/db.quota.ts", "../functions/idb/tools/db.delete.ts", "../functions/idb/tools/db.size.ts", "../functions/idb/tools/db.version.ts", "../functions/idb/tools/db.support.ts", "../functions/idb/tools/table.create.ts", "../functions/idb/tools/table.size.ts", "../functions/idb/crud/data.delete.ts", "../functions/idb/crud/data.set.ts", "../functions/idb/crud/data.get.ts", "../index.ts", "../package.json", "../config/global.ts", "../config/dispatch.ts", "../config/constructor.ts", "../functions/logger/index.ts", "../functions/state/index.ts", "../functions/store/index.ts", "../functions/session/index.ts", "../functions/cache/index.ts", "../functions/idb/index.ts", "../functions/devtools/index.ts", "../functions/react.ts"],
|
|
4
|
+
"sourcesContent": ["/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.create = (dbName, ver = 1) => {\r\n\r\n idb.db.support()\r\n\r\n // let db\r\n const request = indexedDB.open(dbName, ver) as any\r\n\r\n // Event handling\r\n request.onerror = () => {\r\n console.error(`IndexedDB error: ${request.errorCode}`)\r\n }\r\n\r\n request.onsuccess = () => {\r\n console.debug(\"Successful database connection\")\r\n // db = request.result\r\n }\r\n\r\n request.onupgradeneeded = () => {\r\n console.debug(\"Database created\")\r\n }\r\n\r\n idb.db.list()\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.list = () => {\r\n indexedDB\r\n .databases()\r\n .then(result => result)\r\n .then(result => {\r\n if (!result) return\r\n idbases = result\r\n })\r\n .catch(err => {\r\n console.error(err)\r\n })\r\n idb.db.size()\r\n return idbases\r\n}\r\n\r\nsetInterval(() => {\r\n idb.db.list()\r\n}, 1000)\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.exist = (storeName: any) => {\r\n if (idbases?.find((db: any) => db.name === storeName) !== undefined)\r\n return true\r\n return false\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.quota = () => {\r\n return navigator.storage.estimate()\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.delete = (storeName: any) => {\r\n\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug(`Remove ${storeName}...`)\r\n }\r\n\r\n if (!idb.db.exist(storeName)) return\r\n\r\n if (typeof (globalThis as any).layerpro === \"function\") {\r\n\r\n // USE CONFIRM FROM LAYERPRO\r\n confirm(\r\n `Are you sure to remove \"${storeName}\" database?`,\r\n () => {\r\n setTimeout(() => {\r\n indexedDB.deleteDatabase(storeName)\r\n console.debug(`${storeName} removed`)\r\n idb.db.list()\r\n }, 1000)\r\n },\r\n () => alert(\"Operation cancelled.\")\r\n )\r\n return\r\n\r\n } else {\r\n\r\n if (confirm(`Are you sure to remove \"${storeName}\" database?`)) {\r\n setTimeout(() => {\r\n indexedDB.deleteDatabase(storeName)\r\n console.debug(`${storeName} removed`)\r\n idb.db.list()\r\n }, 1000)\r\n } else {\r\n alert(\"Operation cancelled.\")\r\n }\r\n return\r\n\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.size = () => {\r\n\r\n idbases?.map((dbName) => {\r\n\r\n if (!idb.db.exist(dbName)) return null\r\n\r\n const\r\n index = dphelper.array.findindex(idbases, dbName.name),\r\n request = indexedDB?.open(dbName.name, idb.db.version(dbName.name))\r\n\r\n request.onerror = (_event: any) => console.error(\"Error on IndexedDB\")\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const\r\n db = event.target.result,\r\n tableNames = [...db.objectStoreNames],\r\n\r\n t = (tableNames, db) => {\r\n const tableSizeGetters = tableNames.reduce(\r\n (acc, tableName) => {\r\n acc.push(idb.table.size(db, tableName))\r\n return acc\r\n }, []\r\n )\r\n\r\n tableSizeGetters.map(\r\n (sizes) => {\r\n const total = sizes.reduce((acc, val) => acc + val, 0)\r\n const sizeBytes = Number.parseInt(dphelper.dev.byteSize(total)) || 0\r\n return sizeBytes\r\n }\r\n )\r\n\r\n idbases[index].size = tableSizeGetters.length > 0 ? tableSizeGetters : 0\r\n }\r\n\r\n t(tableNames, db)\r\n }\r\n\r\n return null\r\n })\r\n}\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.version = (storeName: string) => {\r\n let idbVer = 0\r\n for (const v of idbases) {\r\n if (v.name === storeName) idbVer = v.version\r\n break\r\n }\r\n return idbVer\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.support = () => {\r\n if (\"indexedDB\" in window) {\r\n return true\r\n }\r\n console.error(\"Your browser doesn't support IndexedBD\")\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.table.create = (dbName, dbTable) => {\r\n\r\n try {\r\n const v = Number(idb.db.version(dbName)) + 1\r\n let request = indexedDB.open(dbName, v)\r\n\r\n try {\r\n request.onupgradeneeded = e => {\r\n\r\n const\r\n target = e.target as any,\r\n db = target.result\r\n\r\n const store = db.createObjectStore(\r\n dbTable,\r\n {\r\n keyPath: \"id\",\r\n unique: true,\r\n autoincrement: true\r\n }\r\n )\r\n\r\n store.createIndex(\"id\", \"id\")\r\n store.createIndex(\"data\", \"data\")\r\n\r\n db.close()\r\n request?.result?.close()\r\n request = undefined\r\n idb.db.list()\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(\">>\", err)\r\n return\r\n\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(\">>>\", err)\r\n return\r\n\r\n }\r\n\r\n return false\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.table.size = (db: any, table: any) => {\r\n\r\n idb.db.list()\r\n\r\n return new Promise(\r\n\r\n (resolve, reject) => {\r\n\r\n if (db == null) return reject()\r\n\r\n const e: any = event\r\n let size = 0\r\n db = e.target.result\r\n\r\n const transaction = db.transaction([table]).objectStore(table).openCursor()\r\n\r\n transaction.onsuccess = (\r\n\r\n (event: any) => {\r\n const cursor = event.target.result\r\n\r\n if (cursor) {\r\n const storedObject = cursor.value,\r\n json = JSON.stringify(storedObject)\r\n\r\n size += json.length\r\n cursor.continue()\r\n } else {\r\n resolve(size)\r\n }\r\n\r\n }\r\n\r\n )\r\n\r\n transaction.onerror = (err: any) => reject(`error in ${table}: ${err}`)\r\n }\r\n\r\n )\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.data.delete = (storeName: string, table: string, value: any) => {\r\n\r\n if (!idb.db.exist(storeName)) return\r\n\r\n const request = indexedDB.open(storeName, idb.db.version(storeName))\r\n\r\n request.onsuccess = () => {\r\n\r\n const\r\n db = request.result,\r\n transaction = db.transaction(table, \"readwrite\"),\r\n objectStore = transaction.objectStore(table)\r\n\r\n objectStore.put(value)\r\n\r\n request.onerror = (e: any) => {\r\n console.debug(e, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n transaction.onerror = (e: any) => {\r\n console.debug(event, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n db.close()\r\n idb.db.list()\r\n console.debug(\"Store inserted\")\r\n\r\n // Trigger React re-render\r\n if ((globalThis as any).memorioIdbTrigger) (globalThis as any).memorioIdbTrigger()\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n\r\n///\r\n\r\nidb.data.delete.all = (storeName: string, table: string) => {\r\n\r\n idb.db.list()\r\n\r\n const request = indexedDB.open(storeName)\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const db = event.target.result\r\n const Store = db\r\n .transaction(table)\r\n .objectStore(table)\r\n .set({})\r\n\r\n Store.onsuccess = (event: any) => {\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug(event)\r\n }\r\n }\r\n\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.data.set = (storeName: string, table: string, value: any) => {\r\n\r\n if (!idb.db?.exist(storeName)) return\r\n\r\n const request = indexedDB.open(storeName, idb.version(storeName))\r\n\r\n request.onsuccess = () => {\r\n const db = request.result\r\n const transaction = db.transaction(table, \"readwrite\")\r\n const objectStore = transaction.objectStore(table)\r\n objectStore.put(value)\r\n\r\n request.onerror = (e: any) => {\r\n console.debug(e, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n transaction.onerror = (e: any) => {\r\n console.debug(event, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n db.close()\r\n idb.databases()\r\n console.debug(\"IndexDB inserted\")\r\n\r\n // Trigger React re-render\r\n if ((globalThis as any).memorioIdbTrigger) (globalThis as any).memorioIdbTrigger()\r\n }\r\n\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nlet returnValue\r\n\r\nidb.data.get = (storeName: any, table: any, key: any) => {\r\n\r\n idb.db.list()\r\n\r\n const request = indexedDB.open(storeName)\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const\r\n db = event.target.result,\r\n Store = db\r\n .transaction(table)\r\n .objectStore(table)\r\n .get(key)\r\n\r\n Store.onsuccess = (_event: any) => {\r\n returnValue = Store.result\r\n return Store.result\r\n }\r\n\r\n }\r\n\r\n return returnValue\r\n\r\n}\r\n\r\nexport { }\r\n", "///////////////////////////////////////////////////////////////////////////////\r\n// MEMORIO - Lightweight State Management\r\n// Version: 3.0.0\r\n///////////////////////////////////////////////////////////////////////////////\r\n\r\n/**\r\n * CONFIGURATION\r\n *\r\n * To avoid polluting global scope, configure BEFORE importing Memorio:\r\n *\r\n * // Disable all globals\r\n * window.memorio = { globals: false }\r\n * import 'memorio'\r\n *\r\n * // Disable specific globals\r\n * window.memorio = { globals: { state: false, store: false } }\r\n * import 'memorio'\r\n *\r\n * // Or use direct module imports (recommended for tree-shaking)\r\n * import { state, store, session, cache } from 'memorio'\r\n *\r\n */\r\n\r\nimport './config/global'\r\nimport './config/dispatch'\r\nimport \"./config/constructor\"\r\n\r\nimport './functions/state'\r\nimport './functions/store'\r\nimport './functions/session'\r\nimport './functions/cache'\r\nimport './functions/idb'\r\nimport './functions/logger'\r\nimport './functions/devtools'\r\n\r\n// Detect React and make it globally available for useMemorio hook\r\n// React should be available as globalThis.React when using useMemorio hook\r\n// This is set by the React application before importing memorio\r\n\r\n// Export modules for direct import\r\nexport { } from './functions/state'\r\nexport { } from './functions/store'\r\nexport { } from './functions/session'\r\nexport { } from './functions/cache'\r\nexport { } from './functions/idb'\r\n\r\n// Export React integration\r\nexport { MemorioProvider, useMemorioState, useMemorio } from './functions/react'\r\n", "{\r\n \"name\": \"memorio\",\r\n \"version\": \"3.0.0\",\r\n \"type\": \"module\",\r\n \"main\": \"dist/index.js\",\r\n \"module\": \"dist/index.mjs\",\r\n \"license\": \"MIT\",\r\n \"types\": \"./index.d.ts\",\r\n \"typings\": \"./types/*\",\r\n \"description\": \"Memorio, State + Store for an easy life - Lightweight storage for small projects\",\r\n \"copyright\": \"Copyright (c) 2026 Dario Passariello\",\r\n \"homepage\": \"https://a51.gitbook.io/memorio\",\r\n \"author\": \"Dario Passariello <dariopassariello@gmail.com>\",\r\n \"support\": {\r\n \"name\": \"Dario Passariello\",\r\n \"url\": \"https://github.com/passariello/\",\r\n \"email\": \"dariopassariello@gmail.com\"\r\n },\r\n \"bugs\": {\r\n \"url\": \"https://github.com/passariello/\"\r\n },\r\n \"contributors\": [\r\n {\r\n \"name\": \"Dario Passariello\",\r\n \"email\": \"dariopassarielloa@gmail.com\"\r\n },\r\n {\r\n \"name\": \"Valeria Cala Scaglitta\",\r\n \"email\": \"valeriacalascaglitta@gmail.com\"\r\n }\r\n ],\r\n \"keywords\": [\r\n \"biglogic\",\r\n \"a51\",\r\n \"memorio\",\r\n \"state\",\r\n \"store\"\r\n ],\r\n \"funding\": [\r\n {\r\n \"type\": \"patreon\",\r\n \"url\": \"https://www.patreon.com/passariello\"\r\n }\r\n ],\r\n \"typing\": [\r\n \"types/*\"\r\n ],\r\n \"exports\": {\r\n \".\": {\r\n \"types\": \"./types/index.d.ts\",\r\n \"import\": \"./dist/index.mjs\",\r\n \"default\": \"./dist/index.js\"\r\n },\r\n \"./types/*\": \"./types/*\"\r\n },\r\n \"scripts\": {\r\n \"build\": \"rimraf dist && node esbuild.config.mjs\",\r\n \"dev\": \"node esbuild.config.mjs --watch-and-serve\",\r\n \"npm:pack\": \"npm run build && cd dist && npm pack\",\r\n \"npm:publish\": \"npm run build && npm publish ./dist\",\r\n \"test\": \"cd tests && npm run test\",\r\n \"lint\": \"cd tests && npm run lint\",\r\n \"tsc\": \"cd tests && tsc --noEmit\"\r\n },\r\n \"devDependencies\": {\r\n \"@types/node\": \"25.3.0\",\r\n \"esbuild\": \"0.27.3\",\r\n \"esbuild-node-externals\": \"1.20.1\",\r\n \"esbuild-plugin-alias\": \"0.2.1\",\r\n \"esbuild-plugin-copy\": \"2.1.1\",\r\n \"esbuild-sass-plugin\": \"3.6.0\",\r\n \"esbuild-scss-modules-plugin\": \"1.1.1\",\r\n \"jest-util\": \"30.2.0\",\r\n \"rimraf\": \"6.1.3\",\r\n \"ts-jest\": \"29.4.6\",\r\n \"tsx\": \"^4.21.0\",\r\n \"typescript\": \"5.9.3\"\r\n }\r\n}\r\n", "/**\r\n * MEMORIO GLOBAL CONFIGURATION\r\n *\r\n * This module initializes the global memorio object and its core properties.\r\n * It sets up version information and protected property names.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\nimport p from '../package.json' with { type: \"json\" }\r\n\r\n// Check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n/////////////////////////////////////\r\n\r\n// Sentinel value to represent undefined (since Proxy can't store undefined)\r\nconst UNDEFINED = Symbol('memorio-undefined')\r\n ; (globalThis as any).memorioUNDEFINED = UNDEFINED\r\nexport { UNDEFINED }\r\n\r\n// Only create globals if enabled\r\nif (shouldCreateGlobal('memorio')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'memorio',\r\n {\r\n value: {},\r\n writable: false,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n globalThis,\r\n 'events',\r\n {\r\n value: {},\r\n writable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n memorio,\r\n 'version',\r\n {\r\n writable: false,\r\n enumerable: false,\r\n value: p.version\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n memorio,\r\n 'debug',\r\n {\r\n writable: true,\r\n enumerable: true,\r\n value: false\r\n }\r\n )\r\n}\r\n\r\n/**\r\n * Protected property names that cannot be used as state keys.\r\n * These are reserved for internal memorio functionality.\r\n */\r\nexport const protect = [\r\n 'list',\r\n 'state',\r\n 'store',\r\n 'idb',\r\n 'remove',\r\n 'removeAll'\r\n]\r\n", "Object.defineProperty(\r\n memorio,\r\n 'dispatch',\r\n {\r\n writable: false,\r\n enumerable: false,\r\n value: {\r\n\r\n /**\r\n * Dispatches a custom event with the specified name and value.\r\n * @param name The name of the event.\r\n * @param value The value to pass with the event.\r\n */\r\n set: (name: string, value = {}) => {\r\n dispatchEvent(new CustomEvent(String(name), value))\r\n },\r\n\r\n /////////////////////////////////////////////////////\r\n\r\n /**\r\n * Listens for the specified event names and executes the callback when the event is triggered.\r\n * @param name The name of the event to listen for.\r\n * @param cb The callback function to execute when the event is triggered.\r\n * @param flag A flag to indicate whether to remove existing listeners (default is false).\r\n */\r\n listen: (name: string, cb: ((e: Event) => void) | null = null, _flag = false) => {\r\n const exec = (e: Event) => cb\r\n ? setTimeout(() => cb(e), 1)\r\n : null\r\n globalThis.addEventListener(name, exec as any)\r\n ; (globalThis as any).events = (globalThis as any).events || {}\r\n ; (globalThis as any).events[name] = exec\r\n },\r\n\r\n /////////////////////////////////////////////////////\r\n\r\n /**\r\n * Removes the event listener for the specified event names.\r\n * @param name The name of the event to remove the listener for.\r\n */\r\n remove: (name: string) => {\r\n const events = (globalThis as any).events || {}\r\n globalThis.removeEventListener(name, events[name] as any)\r\n delete events[name]\r\n }\r\n\r\n }\r\n }\r\n)\r\n", "/**\r\n * Extracts the function name from a container object.\r\n * @param container The container object.\r\n * @param object The function or property to extract name from.\r\n * @returns The extracted property name.\r\n */\r\n; (memorio as any).propertyName = function (_container: unknown, _object: unknown) {\r\n\r\n const t = String(_object).replace(\"() => \", \"\")\r\n return t\r\n\r\n return null // Or handle as needed if not found\r\n}\r\n", "/**\r\n * MEMORIO LOGGING MIDDLEWARE\r\n *\r\n * This module provides logging capabilities for Memorio state changes.\r\n * It can log to console and optionally to a custom log handler.\r\n */\r\n\r\ninterface LogEntry {\r\n timestamp: string\r\n module: 'state' | 'store' | 'session' | 'cache' | 'idb'\r\n action: 'get' | 'set' | 'delete' | 'clear'\r\n path: string\r\n value?: any\r\n previousValue?: any\r\n duration?: number\r\n}\r\n\r\ntype LogHandler = (entry: LogEntry) => void\r\n\r\ninterface LoggerConfig {\r\n enabled: boolean\r\n logToConsole: boolean\r\n customHandler?: LogHandler\r\n modules: ('state' | 'store' | 'session' | 'cache' | 'idb')[]\r\n maxEntries: number\r\n}\r\n\r\nconst defaultConfig: LoggerConfig = {\r\n enabled: true,\r\n logToConsole: true,\r\n modules: ['state', 'store', 'session', 'cache', 'idb'],\r\n maxEntries: 1000\r\n}\r\n\r\n// Helper to check if debug mode is enabled\r\nfunction isDebugEnabled(): boolean {\r\n return (globalThis as any).memorio?.debug === true\r\n}\r\n\r\nlet config: LoggerConfig = { ...defaultConfig }\r\nconst logHistory: LogEntry[] = []\r\n\r\n/**\r\n * Configure the logger\r\n */\r\nexport const configure = (options: Partial<LoggerConfig>): void => {\r\n config = { ...config, ...options }\r\n}\r\n\r\n/**\r\n * Enable or disable logging\r\n */\r\nexport const enable = (): void => {\r\n config.enabled = true\r\n}\r\n\r\n/**\r\n * Disable logging\r\n */\r\nexport const disable = (): void => {\r\n config.enabled = false\r\n}\r\n\r\n/**\r\n * Check if logging is enabled for a specific module\r\n */\r\nexport const isEnabled = (module: LoggerConfig['modules'][number]): boolean => {\r\n return config.enabled && config.modules.includes(module)\r\n}\r\n\r\n/**\r\n * Log an entry\r\n */\r\nexport const log = (\r\n module: LoggerConfig['modules'][number],\r\n action: LogEntry['action'],\r\n path: string,\r\n value?: any,\r\n previousValue?: any\r\n): void => {\r\n if (!isEnabled(module)) return\r\n\r\n const entry: LogEntry = {\r\n timestamp: new Date().toISOString(),\r\n module,\r\n action,\r\n path,\r\n value,\r\n previousValue\r\n }\r\n\r\n // Add to history\r\n logHistory.push(entry)\r\n if (logHistory.length > config.maxEntries) {\r\n logHistory.shift()\r\n }\r\n\r\n // Console output (only in debug mode)\r\n if (config.logToConsole && isDebugEnabled()) {\r\n const prefix = `[Memorio:${module.toUpperCase()}]`\r\n const color = getModuleColor(module)\r\n\r\n console.debug(\r\n `%c${prefix}%c ${action} ${path}`,\r\n `color: ${color}; font-weight: bold`,\r\n 'color: inherit'\r\n )\r\n\r\n if (value !== undefined) {\r\n console.debug(' \u2192 value:', value)\r\n }\r\n if (previousValue !== undefined) {\r\n console.debug(' \u2190 previous:', previousValue)\r\n }\r\n }\r\n\r\n // Custom handler\r\n if (config.customHandler) {\r\n config.customHandler(entry)\r\n }\r\n}\r\n\r\n/**\r\n * Get color for module\r\n */\r\nconst getModuleColor = (module: string): string => {\r\n const colors: Record<string, string> = {\r\n state: '#4CAF50',\r\n store: '#2196F3',\r\n session: '#FF9800',\r\n cache: '#9C27B0',\r\n idb: '#F44336'\r\n }\r\n return colors[module] || '#888888'\r\n}\r\n\r\n/**\r\n * Get log history\r\n */\r\nexport const getHistory = (): LogEntry[] => {\r\n return [...logHistory]\r\n}\r\n\r\n/**\r\n * Clear log history\r\n */\r\nexport const clearHistory = (): void => {\r\n logHistory.length = 0\r\n}\r\n\r\n/**\r\n * Get statistics\r\n */\r\nexport const getStats = (): Record<string, number> => {\r\n const stats: Record<string, number> = {\r\n total: logHistory.length,\r\n state: 0,\r\n store: 0,\r\n session: 0,\r\n cache: 0,\r\n idb: 0,\r\n set: 0,\r\n get: 0,\r\n delete: 0,\r\n clear: 0\r\n }\r\n\r\n logHistory.forEach(entry => {\r\n stats[entry.module]++\r\n stats[entry.action]++\r\n })\r\n\r\n return stats\r\n}\r\n\r\n/**\r\n * Export log entries for debugging\r\n */\r\nexport const exportLogs = (): string => {\r\n return JSON.stringify(logHistory, null, 2)\r\n}\r\n\r\n// Add to global memorio object\r\nif (typeof globalThis.memorio !== 'undefined') {\r\n Object.defineProperty(globalThis.memorio, 'logger', {\r\n enumerable: false,\r\n configurable: true,\r\n value: {\r\n configure,\r\n enable,\r\n disable,\r\n isEnabled,\r\n log,\r\n getHistory,\r\n clearHistory,\r\n getStats,\r\n exportLogs\r\n }\r\n })\r\n}\r\n", "/**\r\n * MEMORIO STATE MANAGEMENT\r\n *\r\n * This module provides reactive state management using Proxy.\r\n * It enables nested object tracking and dispatches events on state changes.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\nimport { protect } from \"../../config/global.js\"\r\n\r\n// Import logger for automatic logging\r\nimport '../../functions/logger'\r\n\r\n/**\r\n * React integration using useSyncExternalStore\r\n * This provides proper React 18+ integration without requiring hooks in library code\r\n */\r\n\r\n// Subscribe function for external store integration\r\nconst subscribers = new Set<() => void>()\r\n\r\nfunction subscribe(callback: () => void) {\r\n subscribers.add(callback)\r\n return () => subscribers.delete(callback)\r\n}\r\n\r\n// State version for change detection - updated on every state change\r\nlet stateVersion = 0\r\n\r\nfunction getSnapshot() {\r\n return stateVersion\r\n}\r\n\r\n// Call this to bump the version when state changes\r\nexport function bumpStateVersion() {\r\n stateVersion++\r\n}\r\n\r\nfunction getServerSnapshot() {\r\n return 0\r\n}\r\n\r\n// Export subscribe for useSyncExternalStore\r\nexport const memorioSubscribe = subscribe\r\nexport const memorioGetSnapshot = getSnapshot\r\nexport const memorioGetServerSnapshot = getServerSnapshot\r\n\r\n// Trigger all subscribers (call this when state changes)\r\nfunction triggerReact() {\r\n stateVersion++\r\n subscribers.forEach(cb => cb())\r\n}\r\n\r\nObject.defineProperty(\r\n memorio,\r\n 'objPath',\r\n {\r\n // configurable: true,\r\n writable: false,\r\n enumerable: false,\r\n value: (prop: string, object: string[], separator: string = '.'): string => {\r\n return object.concat(prop).join(separator)\r\n }\r\n }\r\n)\r\n\r\n/////////////////////////////////////////////////////\r\n\r\n/**\r\n * Builds a recursive proxy for reactive state management.\r\n * @param obj The target object to proxy.\r\n * @param callback Function called on state changes.\r\n * @param tree Current path in the object tree.\r\n * @returns A proxied object with reactive behavior.\r\n */\r\nexport const buildProxy = (obj: Record<string, any>, callback: (props: any) => void, tree: string[] = []): any => {\r\n\r\n // EVENT FUNCTION FOR OBSERVER\r\n const event = (name: string) => {\r\n const array = name.split('.')\r\n array.forEach(\r\n (x, i) => {\r\n const command = array.slice(0, i + 1).join('.')\r\n globalThis.memorio.dispatch.set(command, { detail: { name: command } })\r\n }\r\n )\r\n return\r\n }\r\n\r\n ///////////////////////////////////////////////\r\n\r\n // CREATE THE PROXY\r\n return new Proxy(\r\n obj,\r\n {\r\n get(target: any, prop: any) {\r\n // Handle special methods first\r\n\r\n if (prop === 'list') {\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug('Some state could be hidden when you use \"state.list\". Use \"state\" to see the complete list ')\r\n }\r\n return JSON.parse(JSON.stringify(target))\r\n }\r\n\r\n if (prop === 'remove') {\r\n return function (key: string) {\r\n delete target[key]\r\n return true\r\n }\r\n }\r\n\r\n if (prop === 'removeAll') {\r\n return function () {\r\n try {\r\n for (const key in target) {\r\n if (typeof target[key] !== 'function' && !['list', 'remove', 'removeAll'].includes(key)) {\r\n if (!Object.isFrozen(target[key])) delete target[key]\r\n delete target[key]\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n return\r\n }\r\n }\r\n\r\n if (Object.isFrozen(target[prop])) return target[prop]\r\n\r\n try {\r\n const value = Reflect.get(target, prop)\r\n if (value && typeof value === 'object' && ['Array', 'Object'].includes(value.constructor.name)) {\r\n return buildProxy(value, callback, tree.concat(prop as string))\r\n }\r\n return value\r\n } catch (error) {\r\n console.error('Error: ', error)\r\n return undefined\r\n }\r\n\r\n },\r\n\r\n set(target: any, key: string, value: any): boolean {\r\n\r\n // PROTECTED\r\n if (protect.includes(key)) {\r\n console.error('key ' + key + ' is protected')\r\n return false\r\n }\r\n\r\n // FREEZED\r\n if (target[key] && typeof target[key] === 'object' && Object.isFrozen(target[key])) {\r\n console.error(`Error: state '${key}' is locked`)\r\n return false\r\n }\r\n\r\n // ALLOWED SET\r\n\r\n try {\r\n\r\n const path = globalThis.memorio.objPath(key as string, tree)\r\n\r\n callback(\r\n {\r\n action: 'set',\r\n path,\r\n target,\r\n newValue: value,\r\n previousValue: Reflect.get(target, key)\r\n }\r\n )\r\n\r\n event('state.' + path)\r\n\r\n // Trigger React re-render if available\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('state', 'set', path, value, Reflect.get(target, key))\r\n }\r\n\r\n // Handle undefined values - use a sentinel to distinguish from missing properties\r\n if (value === undefined) {\r\n // Use a special marker object to represent undefined\r\n ; (target as any)[key] = globalThis.memorio\r\n } else {\r\n Reflect.set(target, key, value)\r\n }\r\n\r\n // DEFINE LOCK PROPERTY FUNCTION\r\n if (target[key] && typeof target[key] === 'object') {\r\n\r\n Reflect.defineProperty(\r\n target[key],\r\n 'lock',\r\n {\r\n value() {\r\n Object.defineProperty(\r\n target,\r\n key,\r\n {\r\n writable: false,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.freeze(target[key])\r\n }\r\n }\r\n )\r\n\r\n }\r\n\r\n return true\r\n\r\n } catch (error) {\r\n\r\n console.error('Error in set trap:', error)\r\n return false\r\n\r\n }\r\n\r\n },\r\n\r\n deleteProperty(target: any, prop: string | symbol): boolean {\r\n try {\r\n const path = globalThis.memorio.objPath(prop as string, tree)\r\n callback({ action: 'delete', path, target })\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('state', 'delete', path, undefined, Reflect.get(target, prop))\r\n }\r\n\r\n return Reflect.deleteProperty(target, prop)\r\n } catch (error) {\r\n console.error('Error in deleteProperty trap:', error)\r\n return false\r\n }\r\n }\r\n\r\n }\r\n\r\n )\r\n\r\n}\r\n\r\n// Export state for module usage\r\nexport const state = buildProxy({}, () => { })\r\n\r\n// SET STATE AS PROXY (only if global enabled)\r\nif (shouldCreateGlobal('state')) {\r\n globalThis.state = state\r\n\r\n ///////////////////////////////////////////////\r\n\r\n // DEFINE THE STATE IN GLOBAL\r\n Object.defineProperty(\r\n globalThis,\r\n 'state',\r\n {\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n", "/**\r\n * MEMORIO STORE (localStorage)\r\n *\r\n * This module provides localStorage persistence with a simple API.\r\n * It handles JSON serialization/deserialization automatically.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Logger import\r\nimport '../../functions/logger'\r\n\r\n// STORE\r\nconst storeProxy: any = new Proxy({}, {})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('store')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'store',\r\n {\r\n value: storeProxy,\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n\r\nObject.defineProperties(\r\n storeProxy,\r\n {\r\n /**\r\n * Gets a value from localStorage.\r\n * @param name The key to retrieve.\r\n * @returns The parsed value or null if not found.\r\n */\r\n get: {\r\n value(name: string) {\r\n if (!name) return\r\n try {\r\n const item = localStorage.getItem(name)\r\n if (item) return JSON.parse(item)\r\n return item\r\n } catch (err) {\r\n console.error(`Error parsing store item '${name}':`, err)\r\n }\r\n return null\r\n }\r\n },\r\n\r\n /**\r\n * Sets a value in localStorage.\r\n * @param name The key to set.\r\n * @param value The value to store (objects, arrays, primitives).\r\n */\r\n set: {\r\n value(name: string, value: any) {\r\n if (!name) return\r\n try {\r\n\r\n if (value === null || value === undefined) localStorage.setItem(name, JSON.stringify(null))\r\n else if (typeof value === 'object' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') localStorage.setItem(name, JSON.stringify(value))\r\n else if (typeof value === 'function') console.error('It\\'s not secure to store functions.')\r\n\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n const previous = localStorage.getItem(name)\r\n globalThis.memorio.logger.log('store', 'set', name, value, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(`Error setting store item '${name}':`, err)\r\n\r\n }\r\n return null\r\n }\r\n },\r\n\r\n /**\r\n * Removes a value from localStorage.\r\n * @param name The key to remove.\r\n * @returns True if removed, false if not found.\r\n */\r\n remove: {\r\n value(name: string) {\r\n if (!name) return\r\n if (localStorage.getItem(name)) {\r\n const previous = localStorage.getItem(name)\r\n localStorage.removeItem(name)\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('store', 'delete', name, undefined, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n return true\r\n }\r\n return false\r\n }\r\n },\r\n\r\n /**\r\n * Alias for remove.\r\n * @param name The key to delete.\r\n */\r\n delete: {\r\n value(name: string) {\r\n storeProxy.remove(name)\r\n return true\r\n }\r\n\r\n },\r\n\r\n /**\r\n * Clears all items from localStorage.\r\n */\r\n removeAll: {\r\n value() {\r\n localStorage.clear()\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('store', 'clear', '*')\r\n }\r\n\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Alias for removeAll.\r\n */\r\n clearAll: {\r\n value() {\r\n storeProxy.removeAll()\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Estimates storage quota usage.\r\n * @returns Promise with [usage, quota] in KB.\r\n */\r\n quota: {\r\n value() {\r\n if ('storage' in navigator && 'estimate' in navigator.storage) {\r\n navigator.storage.estimate()\r\n .then(\r\n ({ usage, quota }) => {\r\n if (usage && quota) {\r\n console.debug(`Using ${usage / 1024} out of ${quota / 1024} Mb.`)\r\n return [usage / 1024, quota / 1024]\r\n }\r\n }\r\n )\r\n .catch(err => { console.error('Error estimating quota:', err) })\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Calculates total size of all localStorage items.\r\n * @returns Total size in characters.\r\n */\r\n size: {\r\n value() {\r\n let totalSize = 0\r\n for (const key in localStorage) {\r\n if (Object.prototype.hasOwnProperty.call(localStorage, key)) {\r\n const item = localStorage.getItem(key)\r\n if (item) totalSize += item.length\r\n }\r\n }\r\n return totalSize\r\n }\r\n },\r\n\r\n /**\r\n * Get a list of all store items.\r\n * @returns Object with all store items.\r\n */\r\n list: {\r\n value() {\r\n const result: Record<string, any> = {}\r\n for (const key in localStorage) {\r\n if (Object.prototype.hasOwnProperty.call(localStorage, key)) {\r\n try {\r\n result[key] = JSON.parse(localStorage.getItem(key) || 'null')\r\n } catch {\r\n result[key] = localStorage.getItem(key)\r\n }\r\n }\r\n }\r\n return result\r\n }\r\n }\r\n\r\n }\r\n)\r\n\r\nObject.freeze(storeProxy)\r\n\r\n// Export store for module usage\r\nexport const store = storeProxy\r\n", "/**\r\n * MEMORIO SESSION (sessionStorage)\r\n *\r\n * This module provides sessionStorage persistence with a simple API.\r\n * Data is cleared when the browser tab is closed.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Remove the old reactTrigger code\r\n\r\n// Logger import\r\nimport '../../functions/logger'\r\n\r\n// Session proxy\r\nconst sessionProxy: any = new Proxy({}, {})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('session')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'session',\r\n {\r\n value: sessionProxy,\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n\r\nObject.defineProperties(\r\n sessionProxy,\r\n {\r\n /**\r\n * Gets a value from sessionStorage.\r\n * @param name The key to retrieve.\r\n * @returns The parsed value or null if not found.\r\n */\r\n get: {\r\n value(name: string) {\r\n if (!name) return\r\n try {\r\n const item = sessionStorage.getItem(name)\r\n if (item) return JSON.parse(item)\r\n return item\r\n } catch (err) {\r\n console.error(`Error parsing session item '${name}':`, err)\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Sets a value in sessionStorage.\r\n * @param name The key to set.\r\n * @param value The value to store.\r\n */\r\n set: {\r\n value(name: string, value: any) {\r\n if (!name) return\r\n try {\r\n\r\n if (value === null || value === undefined) sessionStorage.setItem(name, JSON.stringify(null))\r\n else if (typeof value === 'object' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') sessionStorage.setItem(name, JSON.stringify(value))\r\n else if (typeof value === 'function') console.error('It\\'s not secure to session functions.')\r\n\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n const previous = sessionStorage.getItem(name)\r\n globalThis.memorio.logger.log('session', 'set', name, value, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(`Error setting session item '${name}':`, err)\r\n\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Removes a value from sessionStorage.\r\n * @param name The key to remove.\r\n * @returns True if removed.\r\n */\r\n remove: {\r\n value(name: string) {\r\n if (!name) return\r\n if (sessionStorage.getItem(name)) {\r\n const previous = sessionStorage.getItem(name)\r\n sessionStorage.removeItem(name)\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('session', 'delete', name, undefined, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n return true\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Alias for remove.\r\n * @param name The key to delete.\r\n */\r\n delete: {\r\n value(name: string) {\r\n session.remove(name)\r\n return true\r\n }\r\n\r\n },\r\n\r\n /**\r\n * Clears all sessionStorage items.\r\n */\r\n removeAll: {\r\n value() {\r\n sessionStorage.clear()\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('session', 'clear', '*')\r\n }\r\n\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Alias for removeAll.\r\n */\r\n clearAll: {\r\n value() {\r\n session.removeAll()\r\n return true\r\n }\r\n },\r\n\r\n quota: {\r\n value() {\r\n if ('storage' in navigator && 'estimate' in navigator.storage) {\r\n navigator.storage.estimate()\r\n .then(\r\n ({ usage, quota }) => {\r\n if (usage && quota) console.debug(`Using ${usage / 1024} out of ${quota / 1024} Mb.`)\r\n }\r\n )\r\n .catch(err => { console.error('Error estimating quota:', err) })\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Gets total size of all sessionStorage items.\r\n * @returns Total size in characters.\r\n */\r\n size: {\r\n value() {\r\n let totalSize = 0\r\n for (const key in sessionStorage) {\r\n if (Object.prototype.hasOwnProperty.call(sessionStorage, key)) {\r\n const item = sessionStorage.getItem(key)\r\n if (item) {\r\n totalSize += item.length\r\n }\r\n }\r\n }\r\n return totalSize\r\n }\r\n },\r\n\r\n /**\r\n * Get a list of all session items.\r\n * @returns Object with all session items.\r\n */\r\n list: {\r\n value() {\r\n const result: Record<string, any> = {}\r\n for (const key in sessionStorage) {\r\n if (Object.prototype.hasOwnProperty.call(sessionStorage, key)) {\r\n try {\r\n result[key] = JSON.parse(sessionStorage.getItem(key) || 'null')\r\n } catch {\r\n result[key] = sessionStorage.getItem(key)\r\n }\r\n }\r\n }\r\n return result\r\n }\r\n }\r\n\r\n }\r\n)\r\n\r\nObject.freeze(session)\r\n", "/**\r\n * MEMORIO CACHE (In-Memory)\r\n *\r\n * This module provides in-memory caching using a simple object.\r\n * Data is lost on page refresh.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\n\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Logger import\r\nimport '../logger'\r\n\r\n// Define cache on globalThis\r\nconst cacheProxy = new Proxy({}, {\r\n set(target, prop, value) {\r\n const previousValue = (target as any)[prop]\r\n ; (target as any)[prop] = value\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'set', String(prop), value, previousValue)\r\n }\r\n\r\n return true\r\n },\r\n deleteProperty(target, prop) {\r\n const previousValue = (target as any)[prop]\r\n delete (target as any)[prop]\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'delete', String(prop), undefined, previousValue)\r\n }\r\n\r\n return true\r\n },\r\n get(target: any, prop) {\r\n // Add clear method\r\n if (prop === 'clear') {\r\n return () => {\r\n Object.keys(target).forEach(key => {\r\n delete target[key]\r\n })\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'clear', '*')\r\n }\r\n }\r\n }\r\n return (target as any)[prop]\r\n }\r\n})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('cache')) {\r\n Object.defineProperty(globalThis, 'cache', {\r\n value: cacheProxy,\r\n enumerable: false,\r\n configurable: true\r\n })\r\n}\r\n\r\n// Export cache for module usage\r\nexport const cache = cacheProxy\r\n\r\nexport { }\r\n", "\r\n/**\r\n * MEMORIO INDEXEDDB\r\n *\r\n * This module provides IndexedDB browser database functionality.\r\n * It enables persistent storage for large amounts of structured data.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// React trigger mechanism - accessible to CRUD operations\r\nconst reactTrigger = (() => {\r\n let trigger: any = null\r\n let tick = 0\r\n\r\n if (typeof (globalThis as any).useEffect !== 'undefined') {\r\n try {\r\n const React = (globalThis as any).React\r\n if (React && React.useState) {\r\n const [, setTickState] = React.useState(0)\r\n trigger = () => {\r\n tick++\r\n setTickState(tick)\r\n }\r\n }\r\n } catch (_e) { }\r\n }\r\n\r\n return trigger\r\n})()\r\n\r\n // Export for use in CRUD operations\r\n ; (globalThis as any).memorioIdbTrigger = () => { if (reactTrigger) reactTrigger() }\r\n\r\n(\r\n () => {\r\n\r\n // Only create globals if enabled\r\n if (shouldCreateGlobal('idb')) {\r\n Object.defineProperty(\r\n window,\r\n \"idb\",\r\n {\r\n value: {\r\n db: {},\r\n table: {},\r\n data: {}\r\n },\r\n writable: true,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n window,\r\n \"idbases\",\r\n {\r\n value: [],\r\n writable: true,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n }\r\n\r\n // Export for module usage\r\n const idb = {\r\n db: {},\r\n table: {},\r\n data: {}\r\n }\r\n\r\n // setTimeout(\r\n // () => {\r\n import('./tools/db.create')\r\n import('./tools/db.list')\r\n import('./tools/db.exist')\r\n import('./tools/db.quota')\r\n import('./tools/db.delete')\r\n import('./tools/db.size')\r\n import('./tools/db.version')\r\n import('./tools/db.support')\r\n import('./tools/table.create')\r\n import('./tools/table.size')\r\n\r\n import('./crud/data.delete')\r\n import('./crud/data.set')\r\n import('./crud/data.get')\r\n // }, 0\r\n // )\r\n\r\n if (shouldCreateGlobal('idb')) {\r\n Object.preventExtensions(idb)\r\n Object.seal(idb)\r\n Object.freeze(idb)\r\n }\r\n\r\n }\r\n)()\r\n", "/**\r\n * MEMORIO DEVTOOLS\r\n *\r\n * This module provides browser DevTools integration for Memorio.\r\n * It exposes state, store, session, cache and IDB to the browser console\r\n * for debugging and inspection.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Helper to check if debug mode is enabled\r\nfunction isDebugEnabled(): boolean {\r\n return (globalThis as any).memorio?.debug === true\r\n}\r\n\r\ninterface DevToolsStats {\r\n stateKeys: number\r\n storeKeys: number\r\n sessionKeys: number\r\n cacheKeys: number\r\n idbDatabases: number\r\n lastUpdate: string\r\n}\r\n\r\n/**\r\n * Inspect all Memorio modules\r\n */\r\nexport const inspect = (): void => {\r\n if (!isDebugEnabled()) return\r\n console.debug('%c\uD83E\uDDE0 Memorio State Inspector', 'font-size: 16px; font-weight: bold; color: #4CAF50')\r\n console.debug('')\r\n\r\n // State\r\n if (globalThis.state) {\r\n console.debug('%c\uD83D\uDCE6 STATE', 'color: #4CAF50; font-weight: bold')\r\n console.table(globalThis.state.list ? globalThis.state.list() : globalThis.state)\r\n console.debug('')\r\n }\r\n\r\n // Store\r\n if (globalThis.store) {\r\n console.debug('%c\uD83C\uDFEA STORE', 'color: #2196F3; font-weight: bold')\r\n console.table(globalThis.store.list ? globalThis.store.list() : globalThis.store)\r\n console.debug('')\r\n }\r\n\r\n // Session\r\n if (globalThis.session) {\r\n console.debug('%c\uD83D\uDD10 SESSION', 'color: #FF9800; font-weight: bold')\r\n console.table(globalThis.session.list ? globalThis.session.list() : globalThis.session)\r\n console.debug('')\r\n }\r\n\r\n // Cache\r\n if (globalThis.cache) {\r\n console.debug('%c\u26A1 CACHE', 'color: #9C27B0; font-weight: bold')\r\n console.table(globalThis.cache.list ? globalThis.cache.list() : globalThis.cache)\r\n console.debug('')\r\n }\r\n}\r\n\r\n/**\r\n * Get statistics about all modules\r\n */\r\nexport const stats = (): DevToolsStats => {\r\n const getKeys = (obj: any): number => {\r\n if (!obj) return 0\r\n if (typeof obj.list === 'function') {\r\n const list = obj.list()\r\n return Object.keys(list).length\r\n }\r\n return Object.keys(obj).length\r\n }\r\n\r\n return {\r\n stateKeys: getKeys(globalThis.state),\r\n storeKeys: getKeys(globalThis.store),\r\n sessionKeys: getKeys(globalThis.session),\r\n cacheKeys: getKeys(globalThis.cache),\r\n idbDatabases: 0, // Would require async IDB check\r\n lastUpdate: new Date().toISOString()\r\n }\r\n}\r\n\r\n/**\r\n * Clear all data from a specific module\r\n */\r\nexport const clear = (module: 'state' | 'store' | 'session' | 'cache'): void => {\r\n if (globalThis[module] && typeof (globalThis[module] as any).clear === 'function') {\r\n (globalThis[module] as any).clear()\r\n if (isDebugEnabled()) {\r\n console.debug(`%c\u2713 Cleared ${module}`, 'color: #4CAF50')\r\n }\r\n } else {\r\n console.error(`Module ${module} not found or does not support clear()`)\r\n }\r\n}\r\n\r\n/**\r\n * Clear all modules\r\n */\r\nexport const clearAll = (): void => {\r\n clear('state')\r\n clear('store')\r\n clear('session')\r\n clear('cache')\r\n if (isDebugEnabled()) {\r\n console.debug('%c\u2713 Cleared all Memorio modules', 'color: #4CAF50; font-weight: bold')\r\n }\r\n}\r\n\r\n/**\r\n * Watch a specific path for changes\r\n */\r\nexport const watch = (module: string, path: string): void => {\r\n if (!isDebugEnabled()) return\r\n\r\n console.debug(`%c\uD83D\uDC41 Watching ${module}.${path}`, 'color: #FF9800')\r\n\r\n const target = globalThis[module as keyof typeof globalThis]\r\n if (target) {\r\n // Simple watch implementation - logs access\r\n const original = (target as any)[path]\r\n if (original !== undefined) {\r\n Object.defineProperty(target, path, {\r\n get: function () {\r\n console.debug(`%c\uD83D\uDC41 Access: ${module}.${path}`, 'color: #FF9800')\r\n return original\r\n },\r\n set: function (value) {\r\n console.debug(`%c\uD83D\uDC41 Change: ${module}.${path} =`, 'color: #FF9800', value)\r\n return value\r\n }\r\n })\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Export all data as JSON\r\n */\r\nexport const exportData = (): string => {\r\n const data = {\r\n state: globalThis.state?.list ? globalThis.state.list() : globalThis.state,\r\n store: globalThis.store?.list ? globalThis.store.list() : globalThis.store,\r\n session: globalThis.session?.list ? globalThis.session.list() : globalThis.session,\r\n cache: globalThis.cache?.list ? globalThis.cache.list() : globalThis.cache,\r\n exportedAt: new Date().toISOString()\r\n }\r\n\r\n return JSON.stringify(data, null, 2)\r\n}\r\n\r\n/**\r\n * Import data from JSON\r\n */\r\nexport const importData = (jsonString: string): void => {\r\n try {\r\n const data = JSON.parse(jsonString)\r\n\r\n if (data.state) {\r\n Object.entries(data.state).forEach(([key, value]) => {\r\n if (globalThis.state) (globalThis.state as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.store) {\r\n Object.entries(data.store).forEach(([key, value]) => {\r\n if (globalThis.store) (globalThis.store as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.session) {\r\n Object.entries(data.session).forEach(([key, value]) => {\r\n if (globalThis.session) (globalThis.session as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.cache) {\r\n Object.entries(data.cache).forEach(([key, value]) => {\r\n if (globalThis.cache) (globalThis.cache as any)[key] = value\r\n })\r\n }\r\n\r\n if (isDebugEnabled()) {\r\n console.debug('%c\u2713 Data imported successfully', 'color: #4CAF50')\r\n }\r\n } catch (error) {\r\n console.error('%c\u2717 Import failed:', 'color: #F44336', error)\r\n }\r\n}\r\n\r\n/**\r\n * Show help\r\n */\r\nexport const help = (): void => {\r\n if (!isDebugEnabled()) return\r\n console.debug(`\r\n%c\uD83E\uDDE0 Memorio DevTools Help\r\n\r\nAvailable commands:\r\n memorio.devtools.inspect() - Inspect all state modules\r\n memorio.devtools.stats() - Show statistics\r\n memorio.devtools.clear('module') - Clear specific module\r\n memorio.devtools.clearAll() - Clear all modules\r\n memorio.devtools.watch('module', 'path') - Watch a path\r\n memorio.devtools.exportData() - Export all data as JSON\r\n memorio.devtools.importData(json) - Import data from JSON\r\n memorio.devtools.help() - Show this help\r\n\r\nShortcuts:\r\n state - globalThis.state\r\n store - globalThis.store\r\n session - globalThis.session\r\n cache - globalThis.cache\r\n\r\nShortcuts are also available in console as:\r\n $state, $store, $session, $cache\r\n`, 'font-family: monospace; font-size: 12px')\r\n}\r\n\r\n// Add to global memorio object\r\nif (typeof globalThis.memorio !== 'undefined') {\r\n Object.defineProperty(globalThis.memorio, 'devtools', {\r\n enumerable: false,\r\n configurable: true,\r\n value: {\r\n inspect,\r\n stats,\r\n clear,\r\n clearAll,\r\n watch,\r\n exportData,\r\n importData,\r\n help\r\n }\r\n })\r\n}\r\n\r\n// Also expose as global shortcuts for easy console access (only if enabled)\r\nif (shouldCreateGlobal('devtools')) {\r\n Object.defineProperty(globalThis, '$state', {\r\n get: () => globalThis.state,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$store', {\r\n get: () => globalThis.store,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$session', {\r\n get: () => globalThis.session,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$cache', {\r\n get: () => globalThis.cache,\r\n configurable: true\r\n })\r\n\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug('%c\uD83E\uDDE0 Memorio DevTools loaded. Type memorio.devtools.help() for info.', 'color: #4CAF50; font-weight: bold')\r\n }\r\n}\r\n", "/**\r\n * Memorio React Integration\r\n *\r\n * AUTOMATIC USAGE - No hooks needed!\r\n *\r\n * Wrap your app with MemorioProvider once:\r\n *\r\n * import { MemorioProvider } from 'memorio'\r\n *\r\n * <MemorioProvider>\r\n * <App />\r\n * </MemorioProvider>\r\n *\r\n * Then use global state anywhere - NO HOOKS NEEDED!\r\n *\r\n * function MyComponent() {\r\n * useEffect(() => {\r\n * console.log(state.test) // \u2705 Automatic!\r\n * }, [state.test])\r\n *\r\n * return <button onClick={() => state.test = 123}>Click</button>\r\n * }\r\n */\r\n\r\n// Get React lazily - will be available when used in React app\r\nfunction getReact() {\r\n const React = (globalThis as any).React\r\n if (!React) {\r\n throw new Error('React not found. Make sure React is installed and memorio is imported in a React app.')\r\n }\r\n return React\r\n}\r\n\r\n// Import subscribe from state module\r\nimport { memorioSubscribe } from './state'\r\n\r\n// Create Context lazily\r\nfunction getContext() {\r\n return getReact().createContext(null)\r\n}\r\n\r\n// Provider component - wrap your app with this ONCE\r\nexport function MemorioProvider({ children }: { children: any }) {\r\n const React = getReact()\r\n\r\n // Force re-render on any state change\r\n const [, setTick] = React.useState(0)\r\n\r\n React.useEffect(() => {\r\n const unsubscribe = memorioSubscribe(() => {\r\n setTick((t: number) => t + 1)\r\n })\r\n return unsubscribe\r\n }, [])\r\n\r\n const MemorioContext = getContext()\r\n return React.createElement(MemorioContext.Provider, { value: true }, children)\r\n}\r\n\r\n// Legacy hook - still available for compatibility\r\nexport function useMemorioState() {\r\n const React = getReact()\r\n const [, setTick] = React.useState(0)\r\n\r\n React.useEffect(() => {\r\n const unsubscribe = memorioSubscribe(() => {\r\n setTick((t: number) => t + 1)\r\n })\r\n return unsubscribe\r\n }, [])\r\n}\r\n\r\nexport function useMemorio() {\r\n return (globalThis as any).state\r\n}\r\n"],
|
|
5
|
+
"mappings": "weAAA,IAAAA,GAAA,OAAAC,EAAAC,EAAA,kBAOA,IAAI,GAAG,OAAS,CAACC,EAAQC,EAAM,IAAM,CAEnC,IAAI,GAAG,QAAQ,EAGf,IAAMC,EAAU,UAAU,KAAKF,EAAQC,CAAG,EAG1CC,EAAQ,QAAU,IAAM,CACtB,QAAQ,MAAM,oBAAoBA,EAAQ,SAAS,EAAE,CACvD,EAEAA,EAAQ,UAAY,IAAM,CACxB,QAAQ,MAAM,gCAAgC,CAEhD,EAEAA,EAAQ,gBAAkB,IAAM,CAC9B,QAAQ,MAAM,kBAAkB,CAClC,EAEA,IAAI,GAAG,KAAK,CACd,IC7BA,IAAAC,GAAA,OAAAC,EAAAC,EAAA,kBAOA,IAAI,GAAG,KAAO,KACZ,UACG,UAAU,EACV,KAAKC,GAAUA,CAAM,EACrB,KAAKA,GAAU,CACTA,IACL,QAAUA,EACZ,CAAC,EACA,MAAMC,GAAO,CACZ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,OAAO,eAAe,WAAY,SAAU,CAC1C,IAAK,IAAM,WAAW,MACtB,aAAc,EAChB,CAAC,EAED,OAAO,eAAe,WAAY,SAAU,CAC1C,IAAK,IAAM,WAAW,MACtB,aAAc,EAChB,CAAC,EAED,OAAO,eAAe,WAAY,WAAY,CAC5C,IAAK,IAAM,WAAW,QACtB,aAAc,EAChB,CAAC,EAED,OAAO,eAAe,WAAY,SAAU,CAC1C,IAAK,IAAM,WAAW,MACtB,aAAc,EAChB,CAAC,EAEI,WAAmB,SAAS,OAC/B,QAAQ,MAAM,8EAAwE,mCAAmC,GCzP7H,SAASuB,GAAW,CAClB,IAAMC,EAAS,WAAmB,MAClC,GAAI,CAACA,EACH,MAAM,IAAI,MAAM,uFAAuF,EAEzG,OAAOA,CACT,CAMA,SAASC,IAAa,CACpB,OAAOF,EAAS,EAAE,cAAc,IAAI,CACtC,CAGO,SAASG,GAAgB,CAAE,SAAAC,CAAS,EAAsB,CAC/D,IAAMH,EAAQD,EAAS,EAGjB,CAAC,CAAEK,CAAO,EAAIJ,EAAM,SAAS,CAAC,EAEpCA,EAAM,UAAU,IACMK,EAAiB,IAAM,CACzCD,EAASE,GAAcA,EAAI,CAAC,CAC9B,CAAC,EAEA,CAAC,CAAC,EAEL,IAAMC,EAAiBN,GAAW,EAClC,OAAOD,EAAM,cAAcO,EAAe,SAAU,CAAE,MAAO,EAAK,EAAGJ,CAAQ,CAC/E,CAGO,SAASK,IAAkB,CAChC,IAAMR,EAAQD,EAAS,EACjB,CAAC,CAAEK,CAAO,EAAIJ,EAAM,SAAS,CAAC,EAEpCA,EAAM,UAAU,IACMK,EAAiB,IAAM,CACzCD,EAASE,GAAcA,EAAI,CAAC,CAC9B,CAAC,EAEA,CAAC,CAAC,CACP,CAEO,SAASG,IAAa,CAC3B,OAAQ,WAAmB,KAC7B",
|
|
6
|
+
"names": ["db_create_exports", "init_db_create", "__esmMin", "dbName", "ver", "request", "db_list_exports", "init_db_list", "__esmMin", "result", "err", "db_exist_exports", "init_db_exist", "__esmMin", "storeName", "db", "db_quota_exports", "init_db_quota", "__esmMin", "db_delete_exports", "init_db_delete", "__esmMin", "storeName", "db_size_exports", "init_db_size", "__esmMin", "dbName", "index", "request", "_event", "event", "db", "tableNames", "tableSizeGetters", "acc", "tableName", "sizes", "total", "val", "db_version_exports", "init_db_version", "__esmMin", "storeName", "idbVer", "v", "db_support_exports", "init_db_support", "__esmMin", "table_create_exports", "init_table_create", "__esmMin", "dbName", "dbTable", "v", "request", "e", "target", "db", "store", "err", "table_size_exports", "init_table_size", "__esmMin", "db", "table", "resolve", "reject", "e", "size", "transaction", "event", "cursor", "storedObject", "json", "err", "data_delete_exports", "init_data_delete", "__esmMin", "storeName", "table", "value", "request", "db", "transaction", "e", "event", "Store", "data_set_exports", "init_data_set", "__esmMin", "storeName", "table", "value", "request", "db", "transaction", "e", "data_get_exports", "returnValue", "init_data_get", "__esmMin", "storeName", "table", "key", "request", "event", "db", "Store", "_event", "index_exports", "__export", "MemorioProvider", "useMemorio", "useMemorioState", "package_default", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "UNDEFINED", "shouldCreateGlobal", "package_default", "protect", "name", "value", "cb", "_flag", "exec", "e", "events", "_container", "_object", "defaultConfig", "isDebugEnabled", "config", "logHistory", "configure", "options", "enable", "disable", "isEnabled", "module", "log", "action", "path", "value", "previousValue", "entry", "prefix", "color", "getModuleColor", "getHistory", "clearHistory", "getStats", "stats", "exportLogs", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "subscribe", "callback", "stateVersion", "memorioSubscribe", "subscribe", "triggerReact", "stateVersion", "subscribers", "cb", "prop", "object", "separator", "buildProxy", "obj", "callback", "tree", "event", "name", "array", "x", "i", "command", "target", "key", "error", "value", "protect", "path", "state", "shouldCreateGlobal", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "storeProxy", "item", "err", "value", "previous", "usage", "quota", "totalSize", "key", "result", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "sessionProxy", "item", "err", "value", "previous", "usage", "quota", "totalSize", "key", "result", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "cacheProxy", "target", "prop", "value", "previousValue", "key", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "reactTrigger", "trigger", "tick", "React", "setTickState", "idb", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "isDebugEnabled", "inspect", "stats", "getKeys", "obj", "list", "clear", "module", "clearAll", "watch", "path", "target", "original", "value", "exportData", "data", "importData", "jsonString", "key", "error", "help", "getReact", "React", "getContext", "MemorioProvider", "children", "setTick", "memorioSubscribe", "t", "MemorioContext", "useMemorioState", "useMemorio"]
|
|
7
|
+
}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var a=(e,o)=>()=>(e&&(o=e(e=0)),o);var $e={};var N=a(()=>{"use strict";idb.db.create=(e,o=1)=>{idb.db.support();let t=indexedDB.open(e,o);t.onerror=()=>{console.error(`IndexedDB error: ${t.errorCode}`)},t.onsuccess=()=>{console.debug("Successful database connection")},t.onupgradeneeded=()=>{console.debug("Database created")},idb.db.list()}});var ze={};var q=a(()=>{"use strict";idb.db.list=()=>(indexedDB.databases().then(e=>e).then(e=>{e&&(idbases=e)}).catch(e=>{console.error(e)}),idb.db.size(),idbases);setInterval(()=>{idb.db.list()},1e3)});var Re={};var G=a(()=>{"use strict";idb.db.exist=e=>idbases?.find(o=>o.name===e)!==void 0});var Ae={};var H=a(()=>{"use strict";idb.db.quota=()=>navigator.storage.estimate()});var Fe={};var K=a(()=>{"use strict";idb.db.delete=e=>{if(globalThis.memorio?.debug&&console.debug(`Remove ${e}...`),!!idb.db.exist(e))if(typeof globalThis.layerpro=="function"){confirm(`Are you sure to remove "${e}" database?`,()=>{setTimeout(()=>{indexedDB.deleteDatabase(e),console.debug(`${e} removed`),idb.db.list()},1e3)},()=>alert("Operation cancelled."));return}else{confirm(`Are you sure to remove "${e}" database?`)?setTimeout(()=>{indexedDB.deleteDatabase(e),console.debug(`${e} removed`),idb.db.list()},1e3):alert("Operation cancelled.");return}}});var Je={};var U=a(()=>{"use strict";idb.db.size=()=>{idbases?.map(e=>{if(!idb.db.exist(e))return null;let o=dphelper.array.findindex(idbases,e.name),t=indexedDB?.open(e.name,idb.db.version(e.name));return t.onerror=n=>console.error("Error on IndexedDB"),t.onsuccess=n=>{let r=n.target.result,s=[...r.objectStoreNames];((l,u)=>{let m=l.reduce((d,D)=>(d.push(idb.table.size(u,D)),d),[]);m.map(d=>{let D=d.reduce((te,re)=>te+re,0);return Number.parseInt(dphelper.dev.byteSize(D))||0}),idbases[o].size=m.length>0?m:0})(s,r)},null})}});var Be={};var V=a(()=>{"use strict";idb.db.version=e=>{let o=0;for(let t of idbases){t.name===e&&(o=t.version);break}return o}});var Me={};var k=a(()=>{"use strict";idb.db.support=()=>{if("indexedDB"in window)return!0;console.error("Your browser doesn't support IndexedBD")}});var Le={};var _=a(()=>{"use strict";idb.table.create=(e,o)=>{try{let t=Number(idb.db.version(e))+1,n=indexedDB.open(e,t);try{n.onupgradeneeded=r=>{let s=r.target,i=s.result,l=i.createObjectStore(o,{keyPath:"id",unique:!0,autoincrement:!0});l.createIndex("id","id"),l.createIndex("data","data"),i.close(),n?.result?.close(),n=void 0,idb.db.list()}}catch(r){console.error(">>",r);return}}catch(t){console.error(">>>",t);return}return!1}});var Ne={};var W=a(()=>{"use strict";idb.table.size=(e,o)=>(idb.db.list(),new Promise((t,n)=>{if(e==null)return n();let r=event,s=0;e=r.target.result;let i=e.transaction([o]).objectStore(o).openCursor();i.onsuccess=(l=>{let u=l.target.result;if(u){let m=u.value,d=JSON.stringify(m);s+=d.length,u.continue()}else t(s)}),i.onerror=l=>n(`error in ${o}: ${l}`)}))});var qe={};var Y=a(()=>{"use strict";idb.data.delete=(e,o,t)=>{if(!idb.db.exist(e))return;let n=indexedDB.open(e,idb.db.version(e));n.onsuccess=()=>{let r=n.result,s=r.transaction(o,"readwrite");s.objectStore(o).put(t),n.onerror=l=>{console.debug(l,`Database insert error: ${l.target.errorCode}`)},s.onerror=l=>{console.debug(event,`Database insert error: ${l.target.errorCode}`)},r.close(),idb.db.list(),console.debug("Store inserted"),globalThis.memorioIdbTrigger&&globalThis.memorioIdbTrigger()}};idb.data.delete.all=(e,o)=>{idb.db.list();let t=indexedDB.open(e);t.onsuccess=n=>{let s=n.target.result.transaction(o).objectStore(o).set({});s.onsuccess=i=>{globalThis.memorio?.debug&&console.debug(i)}}}});var Ge={};var Q=a(()=>{"use strict";idb.data.set=(e,o,t)=>{if(!idb.db?.exist(e))return;let n=indexedDB.open(e,idb.version(e));n.onsuccess=()=>{let r=n.result,s=r.transaction(o,"readwrite");s.objectStore(o).put(t),n.onerror=l=>{console.debug(l,`Database insert error: ${l.target.errorCode}`)},s.onerror=l=>{console.debug(event,`Database insert error: ${l.target.errorCode}`)},r.close(),idb.databases(),console.debug("IndexDB inserted"),globalThis.memorioIdbTrigger&&globalThis.memorioIdbTrigger()}}});var He={};var X,Z=a(()=>{"use strict";idb.data.get=(e,o,t)=>{idb.db.list();let n=indexedDB.open(e);return n.onsuccess=r=>{let s=r.target.result,i=s.transaction(o).objectStore(o).get(t);i.onsuccess=l=>(X=i.result,i.result)},X}});var F={name:"memorio",version:"3.0.0",type:"module",main:"dist/index.js",module:"dist/index.mjs",license:"MIT",types:"./index.d.ts",typings:"./types/*",description:"Memorio, State + Store for an easy life - Lightweight storage for small projects",copyright:"Copyright (c) 2026 Dario Passariello",homepage:"https://a51.gitbook.io/memorio",author:"Dario Passariello <dariopassariello@gmail.com>",support:{name:"Dario Passariello",url:"https://github.com/passariello/",email:"dariopassariello@gmail.com"},bugs:{url:"https://github.com/passariello/"},contributors:[{name:"Dario Passariello",email:"dariopassarielloa@gmail.com"},{name:"Valeria Cala Scaglitta",email:"valeriacalascaglitta@gmail.com"}],keywords:["biglogic","a51","memorio","state","store"],funding:[{type:"patreon",url:"https://www.patreon.com/passariello"}],typing:["types/*"],exports:{".":{types:"./types/index.d.ts",import:"./dist/index.mjs",default:"./dist/index.js"},"./types/*":"./types/*"},scripts:{build:"rimraf dist && node esbuild.config.mjs",dev:"node esbuild.config.mjs --watch-and-serve","npm:pack":"npm run build && cd dist && npm pack","npm:publish":"npm run build && npm publish ./dist",test:"cd tests && npm run test",lint:"cd tests && npm run lint",tsc:"cd tests && tsc --noEmit"},devDependencies:{"@types/node":"25.3.0",esbuild:"0.27.3","esbuild-node-externals":"1.20.1","esbuild-plugin-alias":"0.2.1","esbuild-plugin-copy":"2.1.1","esbuild-sass-plugin":"3.6.0","esbuild-scss-modules-plugin":"1.1.1","jest-util":"30.2.0",rimraf:"6.1.3","ts-jest":"29.4.6",tsx:"^4.21.0",typescript:"5.9.3"}};var ne=globalThis.memorio||{},y=ne.globals;function ie(e){return y===!1?!1:y&&typeof y=="object"?y[e]!==!1:!0}var le=Symbol("memorio-undefined");globalThis.memorioUNDEFINED=le;ie("memorio")&&(Object.defineProperty(globalThis,"memorio",{value:{},writable:!1,configurable:!0,enumerable:!1}),Object.defineProperty(globalThis,"events",{value:{},writable:!0,enumerable:!1}),Object.defineProperty(memorio,"version",{writable:!1,enumerable:!1,value:F.version}),Object.defineProperty(memorio,"debug",{writable:!0,enumerable:!0,value:!1}));var J=["list","state","store","idb","remove","removeAll"];Object.defineProperty(memorio,"dispatch",{writable:!1,enumerable:!1,value:{set:(e,o={})=>{dispatchEvent(new CustomEvent(String(e),o))},listen:(e,o=null,t=!1)=>{let n=r=>o?setTimeout(()=>o(r),1):null;globalThis.addEventListener(e,n),globalThis.events=globalThis.events||{},globalThis.events[e]=n},remove:e=>{let o=globalThis.events||{};globalThis.removeEventListener(e,o[e]),delete o[e]}}});memorio.propertyName=function(e,o){return String(o).replace("() => ","")};var ae={enabled:!0,logToConsole:!0,modules:["state","store","session","cache","idb"],maxEntries:1e3};function ce(){return globalThis.memorio?.debug===!0}var c={...ae},g=[],ue=e=>{c={...c,...e}},ge=()=>{c.enabled=!0},be=()=>{c.enabled=!1},B=e=>c.enabled&&c.modules.includes(e),de=(e,o,t,n,r)=>{if(!B(e))return;let s={timestamp:new Date().toISOString(),module:e,action:o,path:t,value:n,previousValue:r};if(g.push(s),g.length>c.maxEntries&&g.shift(),c.logToConsole&&ce()){let i=`[Memorio:${e.toUpperCase()}]`,l=fe(e);console.debug(`%c${i}%c ${o} ${t}`,`color: ${l}; font-weight: bold`,"color: inherit"),n!==void 0&&console.debug(" \u2192 value:",n),r!==void 0&&console.debug(" \u2190 previous:",r)}c.customHandler&&c.customHandler(s)},fe=e=>({state:"#4CAF50",store:"#2196F3",session:"#FF9800",cache:"#9C27B0",idb:"#F44336"})[e]||"#888888",me=()=>[...g],pe=()=>{g.length=0},he=()=>{let e={total:g.length,state:0,store:0,session:0,cache:0,idb:0,set:0,get:0,delete:0,clear:0};return g.forEach(o=>{e[o.module]++,e[o.action]++}),e},ye=()=>JSON.stringify(g,null,2);typeof globalThis.memorio<"u"&&Object.defineProperty(globalThis.memorio,"logger",{enumerable:!1,configurable:!0,value:{configure:ue,enable:ge,disable:be,isEnabled:B,log:de,getHistory:me,clearHistory:pe,getStats:he,exportLogs:ye}});var Te=globalThis.memorio||{},T=Te.globals;function ve(e){return T===!1?!1:T&&typeof T=="object"?T[e]!==!1:!0}var v=new Set;function Se(e){return v.add(e),()=>v.delete(e)}var xe=0;var I=Se;function je(){xe++,v.forEach(e=>e())}Object.defineProperty(memorio,"objPath",{writable:!1,enumerable:!1,value:(e,o,t=".")=>o.concat(e).join(t)});var M=(e,o,t=[])=>{let n=r=>{let s=r.split(".");s.forEach((i,l)=>{let u=s.slice(0,l+1).join(".");globalThis.memorio.dispatch.set(u,{detail:{name:u}})})};return new Proxy(e,{get(r,s){if(s==="list")return globalThis.memorio?.debug&&console.debug('Some state could be hidden when you use "state.list". Use "state" to see the complete list '),JSON.parse(JSON.stringify(r));if(s==="remove")return function(i){return delete r[i],!0};if(s==="removeAll")return function(){try{for(let i in r)typeof r[i]!="function"&&!["list","remove","removeAll"].includes(i)&&(Object.isFrozen(r[i])||delete r[i],delete r[i])}catch(i){console.error(i)}};if(Object.isFrozen(r[s]))return r[s];try{let i=Reflect.get(r,s);return i&&typeof i=="object"&&["Array","Object"].includes(i.constructor.name)?M(i,o,t.concat(s)):i}catch(i){console.error("Error: ",i);return}},set(r,s,i){if(J.includes(s))return console.error("key "+s+" is protected"),!1;if(r[s]&&typeof r[s]=="object"&&Object.isFrozen(r[s]))return console.error(`Error: state '${s}' is locked`),!1;try{let l=globalThis.memorio.objPath(s,t);return o({action:"set",path:l,target:r,newValue:i,previousValue:Reflect.get(r,s)}),n("state."+l),v.size>0&&je(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("state","set",l,i,Reflect.get(r,s)),i===void 0?r[s]=globalThis.memorio:Reflect.set(r,s,i),r[s]&&typeof r[s]=="object"&&Reflect.defineProperty(r[s],"lock",{value(){Object.defineProperty(r,s,{writable:!1,enumerable:!1}),Object.freeze(r[s])}}),!0}catch(l){return console.error("Error in set trap:",l),!1}},deleteProperty(r,s){try{let i=globalThis.memorio.objPath(s,t);return o({action:"delete",path:i,target:r}),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("state","delete",i,void 0,Reflect.get(r,s)),Reflect.deleteProperty(r,s)}catch(i){return console.error("Error in deleteProperty trap:",i),!1}}})},b=M({},()=>{});ve("state")&&(globalThis.state=b,Object.defineProperty(globalThis,"state",{enumerable:!1,configurable:!0}));var Oe=globalThis.memorio||{},S=Oe.globals;function Ce(e){return S===!1?!1:S&&typeof S=="object"?S[e]!==!1:!0}var x=b.subscribers||new Set;function $(){x.forEach(e=>e())}var p=new Proxy({},{});Ce("store")&&Object.defineProperty(globalThis,"store",{value:p,enumerable:!1,configurable:!0});Object.defineProperties(p,{get:{value(e){if(e){try{let o=localStorage.getItem(e);return o&&JSON.parse(o)}catch(o){console.error(`Error parsing store item '${e}':`,o)}return null}}},set:{value(e,o){if(e){try{if(o==null?localStorage.setItem(e,JSON.stringify(null)):typeof o=="object"||typeof o=="number"||typeof o=="boolean"||typeof o=="string"?localStorage.setItem(e,JSON.stringify(o)):typeof o=="function"&&console.error("It's not secure to store functions."),x.size>0&&$(),typeof globalThis.memorio?.logger?.log=="function"){let t=localStorage.getItem(e);globalThis.memorio.logger.log("store","set",e,o,t?JSON.parse(t):void 0)}}catch(t){console.error(`Error setting store item '${e}':`,t)}return null}}},remove:{value(e){if(e){if(localStorage.getItem(e)){let o=localStorage.getItem(e);return localStorage.removeItem(e),x.size>0&&$(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("store","delete",e,void 0,o?JSON.parse(o):void 0),!0}return!1}}},delete:{value(e){return p.remove(e),!0}},removeAll:{value(){return localStorage.clear(),x.size>0&&$(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("store","clear","*"),!0}},clearAll:{value(){return p.removeAll(),!0}},quota:{value(){"storage"in navigator&&"estimate"in navigator.storage&&navigator.storage.estimate().then(({usage:e,quota:o})=>{if(e&&o)return console.debug(`Using ${e/1024} out of ${o/1024} Mb.`),[e/1024,o/1024]}).catch(e=>{console.error("Error estimating quota:",e)})}},size:{value(){let e=0;for(let o in localStorage)if(Object.prototype.hasOwnProperty.call(localStorage,o)){let t=localStorage.getItem(o);t&&(e+=t.length)}return e}},list:{value(){let e={};for(let o in localStorage)if(Object.prototype.hasOwnProperty.call(localStorage,o))try{e[o]=JSON.parse(localStorage.getItem(o)||"null")}catch{e[o]=localStorage.getItem(o)}return e}}});Object.freeze(p);var we=globalThis.memorio||{},j=we.globals;function Ee(e){return j===!1?!1:j&&typeof j=="object"?j[e]!==!1:!0}var O=b.subscribers||new Set;function z(){O.forEach(e=>e())}var L=new Proxy({},{});Ee("session")&&Object.defineProperty(globalThis,"session",{value:L,enumerable:!1,configurable:!0});Object.defineProperties(L,{get:{value(e){if(e)try{let o=sessionStorage.getItem(e);return o&&JSON.parse(o)}catch(o){console.error(`Error parsing session item '${e}':`,o)}}},set:{value(e,o){if(e)try{if(o==null?sessionStorage.setItem(e,JSON.stringify(null)):typeof o=="object"||typeof o=="number"||typeof o=="boolean"||typeof o=="string"?sessionStorage.setItem(e,JSON.stringify(o)):typeof o=="function"&&console.error("It's not secure to session functions."),O.size>0&&z(),typeof globalThis.memorio?.logger?.log=="function"){let t=sessionStorage.getItem(e);globalThis.memorio.logger.log("session","set",e,o,t?JSON.parse(t):void 0)}}catch(t){console.error(`Error setting session item '${e}':`,t)}}},remove:{value(e){if(e&&sessionStorage.getItem(e)){let o=sessionStorage.getItem(e);return sessionStorage.removeItem(e),O.size>0&&z(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("session","delete",e,void 0,o?JSON.parse(o):void 0),!0}}},delete:{value(e){return session.remove(e),!0}},removeAll:{value(){return sessionStorage.clear(),O.size>0&&z(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("session","clear","*"),!0}},clearAll:{value(){return session.removeAll(),!0}},quota:{value(){"storage"in navigator&&"estimate"in navigator.storage&&navigator.storage.estimate().then(({usage:e,quota:o})=>{e&&o&&console.debug(`Using ${e/1024} out of ${o/1024} Mb.`)}).catch(e=>{console.error("Error estimating quota:",e)})}},size:{value(){let e=0;for(let o in sessionStorage)if(Object.prototype.hasOwnProperty.call(sessionStorage,o)){let t=sessionStorage.getItem(o);t&&(e+=t.length)}return e}},list:{value(){let e={};for(let o in sessionStorage)if(Object.prototype.hasOwnProperty.call(sessionStorage,o))try{e[o]=JSON.parse(sessionStorage.getItem(o)||"null")}catch{e[o]=sessionStorage.getItem(o)}return e}}});Object.freeze(session);var Pe=globalThis.memorio||{},C=Pe.globals;function De(e){return C===!1?!1:C&&typeof C=="object"?C[e]!==!1:!0}var w=b.subscribers||new Set;function R(){w.forEach(e=>e())}var Ie=new Proxy({},{set(e,o,t){let n=e[o];return e[o]=t,w.size>0&&R(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("cache","set",String(o),t,n),!0},deleteProperty(e,o){let t=e[o];return delete e[o],w.size>0&&R(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("cache","delete",String(o),void 0,t),!0},get(e,o){return o==="clear"?()=>{Object.keys(e).forEach(t=>{delete e[t]}),w.size>0&&R(),typeof globalThis.memorio?.logger?.log=="function"&&globalThis.memorio.logger.log("cache","clear","*")}:e[o]}});De("cache")&&Object.defineProperty(globalThis,"cache",{value:Ie,enumerable:!1,configurable:!0});var Ke=globalThis.memorio||{},E=Ke.globals;function ee(e){return E===!1?!1:E&&typeof E=="object"?E[e]!==!1:!0}var oe=(()=>{let e=null,o=0;if(typeof globalThis.useEffect<"u")try{let t=globalThis.React;if(t&&t.useState){let[,n]=t.useState(0);e=()=>{o++,n(o)}}}catch{}return e})();globalThis.memorioIdbTrigger=()=>{oe&&oe()};(()=>{ee("idb")&&(Object.defineProperty(window,"idb",{value:{db:{},table:{},data:{}},writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(window,"idbases",{value:[],writable:!0,configurable:!0,enumerable:!1}));let e={db:{},table:{},data:{}};Promise.resolve().then(()=>N()),Promise.resolve().then(()=>q()),Promise.resolve().then(()=>G()),Promise.resolve().then(()=>H()),Promise.resolve().then(()=>K()),Promise.resolve().then(()=>U()),Promise.resolve().then(()=>V()),Promise.resolve().then(()=>k()),Promise.resolve().then(()=>_()),Promise.resolve().then(()=>W()),Promise.resolve().then(()=>Y()),Promise.resolve().then(()=>Q()),Promise.resolve().then(()=>Z()),ee("idb")&&(Object.preventExtensions(e),Object.seal(e),Object.freeze(e))})();var Ue=globalThis.memorio||{},P=Ue.globals;function Ve(e){return P===!1?!1:P&&typeof P=="object"?P[e]!==!1:!0}function f(){return globalThis.memorio?.debug===!0}var ke=()=>{f()&&(console.debug("%c\u{1F9E0} Memorio State Inspector","font-size: 16px; font-weight: bold; color: #4CAF50"),console.debug(""),globalThis.state&&(console.debug("%c\u{1F4E6} STATE","color: #4CAF50; font-weight: bold"),console.table(globalThis.state.list?globalThis.state.list():globalThis.state),console.debug("")),globalThis.store&&(console.debug("%c\u{1F3EA} STORE","color: #2196F3; font-weight: bold"),console.table(globalThis.store.list?globalThis.store.list():globalThis.store),console.debug("")),globalThis.session&&(console.debug("%c\u{1F510} SESSION","color: #FF9800; font-weight: bold"),console.table(globalThis.session.list?globalThis.session.list():globalThis.session),console.debug("")),globalThis.cache&&(console.debug("%c\u26A1 CACHE","color: #9C27B0; font-weight: bold"),console.table(globalThis.cache.list?globalThis.cache.list():globalThis.cache),console.debug("")))},_e=()=>{let e=o=>{if(!o)return 0;if(typeof o.list=="function"){let t=o.list();return Object.keys(t).length}return Object.keys(o).length};return{stateKeys:e(globalThis.state),storeKeys:e(globalThis.store),sessionKeys:e(globalThis.session),cacheKeys:e(globalThis.cache),idbDatabases:0,lastUpdate:new Date().toISOString()}},h=e=>{globalThis[e]&&typeof globalThis[e].clear=="function"?(globalThis[e].clear(),f()&&console.debug(`%c\u2713 Cleared ${e}`,"color: #4CAF50")):console.error(`Module ${e} not found or does not support clear()`)},We=()=>{h("state"),h("store"),h("session"),h("cache"),f()&&console.debug("%c\u2713 Cleared all Memorio modules","color: #4CAF50; font-weight: bold")},Ye=(e,o)=>{if(!f())return;console.debug(`%c\u{1F441} Watching ${e}.${o}`,"color: #FF9800");let t=globalThis[e];if(t){let n=t[o];n!==void 0&&Object.defineProperty(t,o,{get:function(){return console.debug(`%c\u{1F441} Access: ${e}.${o}`,"color: #FF9800"),n},set:function(r){return console.debug(`%c\u{1F441} Change: ${e}.${o} =`,"color: #FF9800",r),r}})}},Qe=()=>{let e={state:globalThis.state?.list?globalThis.state.list():globalThis.state,store:globalThis.store?.list?globalThis.store.list():globalThis.store,session:globalThis.session?.list?globalThis.session.list():globalThis.session,cache:globalThis.cache?.list?globalThis.cache.list():globalThis.cache,exportedAt:new Date().toISOString()};return JSON.stringify(e,null,2)},Xe=e=>{try{let o=JSON.parse(e);o.state&&Object.entries(o.state).forEach(([t,n])=>{globalThis.state&&(globalThis.state[t]=n)}),o.store&&Object.entries(o.store).forEach(([t,n])=>{globalThis.store&&(globalThis.store[t]=n)}),o.session&&Object.entries(o.session).forEach(([t,n])=>{globalThis.session&&(globalThis.session[t]=n)}),o.cache&&Object.entries(o.cache).forEach(([t,n])=>{globalThis.cache&&(globalThis.cache[t]=n)}),f()&&console.debug("%c\u2713 Data imported successfully","color: #4CAF50")}catch(o){console.error("%c\u2717 Import failed:","color: #F44336",o)}},Ze=()=>{f()&&console.debug(`
|
|
2
|
+
%c\u{1F9E0} Memorio DevTools Help
|
|
3
|
+
|
|
4
|
+
Available commands:
|
|
5
|
+
memorio.devtools.inspect() - Inspect all state modules
|
|
6
|
+
memorio.devtools.stats() - Show statistics
|
|
7
|
+
memorio.devtools.clear('module') - Clear specific module
|
|
8
|
+
memorio.devtools.clearAll() - Clear all modules
|
|
9
|
+
memorio.devtools.watch('module', 'path') - Watch a path
|
|
10
|
+
memorio.devtools.exportData() - Export all data as JSON
|
|
11
|
+
memorio.devtools.importData(json) - Import data from JSON
|
|
12
|
+
memorio.devtools.help() - Show this help
|
|
13
|
+
|
|
14
|
+
Shortcuts:
|
|
15
|
+
state - globalThis.state
|
|
16
|
+
store - globalThis.store
|
|
17
|
+
session - globalThis.session
|
|
18
|
+
cache - globalThis.cache
|
|
19
|
+
|
|
20
|
+
Shortcuts are also available in console as:
|
|
21
|
+
$state, $store, $session, $cache
|
|
22
|
+
`,"font-family: monospace; font-size: 12px")};typeof globalThis.memorio<"u"&&Object.defineProperty(globalThis.memorio,"devtools",{enumerable:!1,configurable:!0,value:{inspect:ke,stats:_e,clear:h,clearAll:We,watch:Ye,exportData:Qe,importData:Xe,help:Ze}});Ve("devtools")&&(Object.defineProperty(globalThis,"$state",{get:()=>globalThis.state,configurable:!0}),Object.defineProperty(globalThis,"$store",{get:()=>globalThis.store,configurable:!0}),Object.defineProperty(globalThis,"$session",{get:()=>globalThis.session,configurable:!0}),Object.defineProperty(globalThis,"$cache",{get:()=>globalThis.cache,configurable:!0}),globalThis.memorio?.debug&&console.debug("%c\u{1F9E0} Memorio DevTools loaded. Type memorio.devtools.help() for info.","color: #4CAF50; font-weight: bold"));function A(){let e=globalThis.React;if(!e)throw new Error("React not found. Make sure React is installed and memorio is imported in a React app.");return e}function eo(){return A().createContext(null)}function oo({children:e}){let o=A(),[,t]=o.useState(0);o.useEffect(()=>I(()=>{t(s=>s+1)}),[]);let n=eo();return o.createElement(n.Provider,{value:!0},e)}function to(){let e=A(),[,o]=e.useState(0);e.useEffect(()=>I(()=>{o(n=>n+1)}),[])}function ro(){return globalThis.state}export{oo as MemorioProvider,ro as useMemorio,to as useMemorioState};
|
|
23
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../functions/idb/tools/db.create.ts", "../functions/idb/tools/db.list.ts", "../functions/idb/tools/db.exist.ts", "../functions/idb/tools/db.quota.ts", "../functions/idb/tools/db.delete.ts", "../functions/idb/tools/db.size.ts", "../functions/idb/tools/db.version.ts", "../functions/idb/tools/db.support.ts", "../functions/idb/tools/table.create.ts", "../functions/idb/tools/table.size.ts", "../functions/idb/crud/data.delete.ts", "../functions/idb/crud/data.set.ts", "../functions/idb/crud/data.get.ts", "../package.json", "../config/global.ts", "../config/dispatch.ts", "../config/constructor.ts", "../functions/logger/index.ts", "../functions/state/index.ts", "../functions/store/index.ts", "../functions/session/index.ts", "../functions/cache/index.ts", "../functions/idb/index.ts", "../functions/devtools/index.ts", "../functions/react.ts"],
|
|
4
|
+
"sourcesContent": ["/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.create = (dbName, ver = 1) => {\r\n\r\n idb.db.support()\r\n\r\n // let db\r\n const request = indexedDB.open(dbName, ver) as any\r\n\r\n // Event handling\r\n request.onerror = () => {\r\n console.error(`IndexedDB error: ${request.errorCode}`)\r\n }\r\n\r\n request.onsuccess = () => {\r\n console.debug(\"Successful database connection\")\r\n // db = request.result\r\n }\r\n\r\n request.onupgradeneeded = () => {\r\n console.debug(\"Database created\")\r\n }\r\n\r\n idb.db.list()\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.list = () => {\r\n indexedDB\r\n .databases()\r\n .then(result => result)\r\n .then(result => {\r\n if (!result) return\r\n idbases = result\r\n })\r\n .catch(err => {\r\n console.error(err)\r\n })\r\n idb.db.size()\r\n return idbases\r\n}\r\n\r\nsetInterval(() => {\r\n idb.db.list()\r\n}, 1000)\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.exist = (storeName: any) => {\r\n if (idbases?.find((db: any) => db.name === storeName) !== undefined)\r\n return true\r\n return false\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.quota = () => {\r\n return navigator.storage.estimate()\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.delete = (storeName: any) => {\r\n\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug(`Remove ${storeName}...`)\r\n }\r\n\r\n if (!idb.db.exist(storeName)) return\r\n\r\n if (typeof (globalThis as any).layerpro === \"function\") {\r\n\r\n // USE CONFIRM FROM LAYERPRO\r\n confirm(\r\n `Are you sure to remove \"${storeName}\" database?`,\r\n () => {\r\n setTimeout(() => {\r\n indexedDB.deleteDatabase(storeName)\r\n console.debug(`${storeName} removed`)\r\n idb.db.list()\r\n }, 1000)\r\n },\r\n () => alert(\"Operation cancelled.\")\r\n )\r\n return\r\n\r\n } else {\r\n\r\n if (confirm(`Are you sure to remove \"${storeName}\" database?`)) {\r\n setTimeout(() => {\r\n indexedDB.deleteDatabase(storeName)\r\n console.debug(`${storeName} removed`)\r\n idb.db.list()\r\n }, 1000)\r\n } else {\r\n alert(\"Operation cancelled.\")\r\n }\r\n return\r\n\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.size = () => {\r\n\r\n idbases?.map((dbName) => {\r\n\r\n if (!idb.db.exist(dbName)) return null\r\n\r\n const\r\n index = dphelper.array.findindex(idbases, dbName.name),\r\n request = indexedDB?.open(dbName.name, idb.db.version(dbName.name))\r\n\r\n request.onerror = (_event: any) => console.error(\"Error on IndexedDB\")\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const\r\n db = event.target.result,\r\n tableNames = [...db.objectStoreNames],\r\n\r\n t = (tableNames, db) => {\r\n const tableSizeGetters = tableNames.reduce(\r\n (acc, tableName) => {\r\n acc.push(idb.table.size(db, tableName))\r\n return acc\r\n }, []\r\n )\r\n\r\n tableSizeGetters.map(\r\n (sizes) => {\r\n const total = sizes.reduce((acc, val) => acc + val, 0)\r\n const sizeBytes = Number.parseInt(dphelper.dev.byteSize(total)) || 0\r\n return sizeBytes\r\n }\r\n )\r\n\r\n idbases[index].size = tableSizeGetters.length > 0 ? tableSizeGetters : 0\r\n }\r\n\r\n t(tableNames, db)\r\n }\r\n\r\n return null\r\n })\r\n}\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.version = (storeName: string) => {\r\n let idbVer = 0\r\n for (const v of idbases) {\r\n if (v.name === storeName) idbVer = v.version\r\n break\r\n }\r\n return idbVer\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.db.support = () => {\r\n if (\"indexedDB\" in window) {\r\n return true\r\n }\r\n console.error(\"Your browser doesn't support IndexedBD\")\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.table.create = (dbName, dbTable) => {\r\n\r\n try {\r\n const v = Number(idb.db.version(dbName)) + 1\r\n let request = indexedDB.open(dbName, v)\r\n\r\n try {\r\n request.onupgradeneeded = e => {\r\n\r\n const\r\n target = e.target as any,\r\n db = target.result\r\n\r\n const store = db.createObjectStore(\r\n dbTable,\r\n {\r\n keyPath: \"id\",\r\n unique: true,\r\n autoincrement: true\r\n }\r\n )\r\n\r\n store.createIndex(\"id\", \"id\")\r\n store.createIndex(\"data\", \"data\")\r\n\r\n db.close()\r\n request?.result?.close()\r\n request = undefined\r\n idb.db.list()\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(\">>\", err)\r\n return\r\n\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(\">>>\", err)\r\n return\r\n\r\n }\r\n\r\n return false\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.table.size = (db: any, table: any) => {\r\n\r\n idb.db.list()\r\n\r\n return new Promise(\r\n\r\n (resolve, reject) => {\r\n\r\n if (db == null) return reject()\r\n\r\n const e: any = event\r\n let size = 0\r\n db = e.target.result\r\n\r\n const transaction = db.transaction([table]).objectStore(table).openCursor()\r\n\r\n transaction.onsuccess = (\r\n\r\n (event: any) => {\r\n const cursor = event.target.result\r\n\r\n if (cursor) {\r\n const storedObject = cursor.value,\r\n json = JSON.stringify(storedObject)\r\n\r\n size += json.length\r\n cursor.continue()\r\n } else {\r\n resolve(size)\r\n }\r\n\r\n }\r\n\r\n )\r\n\r\n transaction.onerror = (err: any) => reject(`error in ${table}: ${err}`)\r\n }\r\n\r\n )\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.data.delete = (storeName: string, table: string, value: any) => {\r\n\r\n if (!idb.db.exist(storeName)) return\r\n\r\n const request = indexedDB.open(storeName, idb.db.version(storeName))\r\n\r\n request.onsuccess = () => {\r\n\r\n const\r\n db = request.result,\r\n transaction = db.transaction(table, \"readwrite\"),\r\n objectStore = transaction.objectStore(table)\r\n\r\n objectStore.put(value)\r\n\r\n request.onerror = (e: any) => {\r\n console.debug(e, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n transaction.onerror = (e: any) => {\r\n console.debug(event, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n db.close()\r\n idb.db.list()\r\n console.debug(\"Store inserted\")\r\n\r\n // Trigger React re-render\r\n if ((globalThis as any).memorioIdbTrigger) (globalThis as any).memorioIdbTrigger()\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n\r\n///\r\n\r\nidb.data.delete.all = (storeName: string, table: string) => {\r\n\r\n idb.db.list()\r\n\r\n const request = indexedDB.open(storeName)\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const db = event.target.result\r\n const Store = db\r\n .transaction(table)\r\n .objectStore(table)\r\n .set({})\r\n\r\n Store.onsuccess = (event: any) => {\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug(event)\r\n }\r\n }\r\n\r\n }\r\n\r\n return\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nidb.data.set = (storeName: string, table: string, value: any) => {\r\n\r\n if (!idb.db?.exist(storeName)) return\r\n\r\n const request = indexedDB.open(storeName, idb.version(storeName))\r\n\r\n request.onsuccess = () => {\r\n const db = request.result\r\n const transaction = db.transaction(table, \"readwrite\")\r\n const objectStore = transaction.objectStore(table)\r\n objectStore.put(value)\r\n\r\n request.onerror = (e: any) => {\r\n console.debug(e, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n transaction.onerror = (e: any) => {\r\n console.debug(event, `Database insert error: ${e.target.errorCode}`)\r\n }\r\n\r\n db.close()\r\n idb.databases()\r\n console.debug(\"IndexDB inserted\")\r\n\r\n // Trigger React re-render\r\n if ((globalThis as any).memorioIdbTrigger) (globalThis as any).memorioIdbTrigger()\r\n }\r\n\r\n}\r\n\r\nexport { }\r\n", "/*!\r\n Memorio\r\n Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>\r\n Licensed under PRIVATE License, see\r\n https://dario.passariello.ca\r\n*/\r\n\r\nlet returnValue\r\n\r\nidb.data.get = (storeName: any, table: any, key: any) => {\r\n\r\n idb.db.list()\r\n\r\n const request = indexedDB.open(storeName)\r\n\r\n request.onsuccess = (event: any) => {\r\n\r\n const\r\n db = event.target.result,\r\n Store = db\r\n .transaction(table)\r\n .objectStore(table)\r\n .get(key)\r\n\r\n Store.onsuccess = (_event: any) => {\r\n returnValue = Store.result\r\n return Store.result\r\n }\r\n\r\n }\r\n\r\n return returnValue\r\n\r\n}\r\n\r\nexport { }\r\n", "{\r\n \"name\": \"memorio\",\r\n \"version\": \"3.0.0\",\r\n \"type\": \"module\",\r\n \"main\": \"dist/index.js\",\r\n \"module\": \"dist/index.mjs\",\r\n \"license\": \"MIT\",\r\n \"types\": \"./index.d.ts\",\r\n \"typings\": \"./types/*\",\r\n \"description\": \"Memorio, State + Store for an easy life - Lightweight storage for small projects\",\r\n \"copyright\": \"Copyright (c) 2026 Dario Passariello\",\r\n \"homepage\": \"https://a51.gitbook.io/memorio\",\r\n \"author\": \"Dario Passariello <dariopassariello@gmail.com>\",\r\n \"support\": {\r\n \"name\": \"Dario Passariello\",\r\n \"url\": \"https://github.com/passariello/\",\r\n \"email\": \"dariopassariello@gmail.com\"\r\n },\r\n \"bugs\": {\r\n \"url\": \"https://github.com/passariello/\"\r\n },\r\n \"contributors\": [\r\n {\r\n \"name\": \"Dario Passariello\",\r\n \"email\": \"dariopassarielloa@gmail.com\"\r\n },\r\n {\r\n \"name\": \"Valeria Cala Scaglitta\",\r\n \"email\": \"valeriacalascaglitta@gmail.com\"\r\n }\r\n ],\r\n \"keywords\": [\r\n \"biglogic\",\r\n \"a51\",\r\n \"memorio\",\r\n \"state\",\r\n \"store\"\r\n ],\r\n \"funding\": [\r\n {\r\n \"type\": \"patreon\",\r\n \"url\": \"https://www.patreon.com/passariello\"\r\n }\r\n ],\r\n \"typing\": [\r\n \"types/*\"\r\n ],\r\n \"exports\": {\r\n \".\": {\r\n \"types\": \"./types/index.d.ts\",\r\n \"import\": \"./dist/index.mjs\",\r\n \"default\": \"./dist/index.js\"\r\n },\r\n \"./types/*\": \"./types/*\"\r\n },\r\n \"scripts\": {\r\n \"build\": \"rimraf dist && node esbuild.config.mjs\",\r\n \"dev\": \"node esbuild.config.mjs --watch-and-serve\",\r\n \"npm:pack\": \"npm run build && cd dist && npm pack\",\r\n \"npm:publish\": \"npm run build && npm publish ./dist\",\r\n \"test\": \"cd tests && npm run test\",\r\n \"lint\": \"cd tests && npm run lint\",\r\n \"tsc\": \"cd tests && tsc --noEmit\"\r\n },\r\n \"devDependencies\": {\r\n \"@types/node\": \"25.3.0\",\r\n \"esbuild\": \"0.27.3\",\r\n \"esbuild-node-externals\": \"1.20.1\",\r\n \"esbuild-plugin-alias\": \"0.2.1\",\r\n \"esbuild-plugin-copy\": \"2.1.1\",\r\n \"esbuild-sass-plugin\": \"3.6.0\",\r\n \"esbuild-scss-modules-plugin\": \"1.1.1\",\r\n \"jest-util\": \"30.2.0\",\r\n \"rimraf\": \"6.1.3\",\r\n \"ts-jest\": \"29.4.6\",\r\n \"tsx\": \"^4.21.0\",\r\n \"typescript\": \"5.9.3\"\r\n }\r\n}\r\n", "/**\r\n * MEMORIO GLOBAL CONFIGURATION\r\n *\r\n * This module initializes the global memorio object and its core properties.\r\n * It sets up version information and protected property names.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\nimport p from '../package.json' with { type: \"json\" }\r\n\r\n// Check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n/////////////////////////////////////\r\n\r\n// Sentinel value to represent undefined (since Proxy can't store undefined)\r\nconst UNDEFINED = Symbol('memorio-undefined')\r\n ; (globalThis as any).memorioUNDEFINED = UNDEFINED\r\nexport { UNDEFINED }\r\n\r\n// Only create globals if enabled\r\nif (shouldCreateGlobal('memorio')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'memorio',\r\n {\r\n value: {},\r\n writable: false,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n globalThis,\r\n 'events',\r\n {\r\n value: {},\r\n writable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n memorio,\r\n 'version',\r\n {\r\n writable: false,\r\n enumerable: false,\r\n value: p.version\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n memorio,\r\n 'debug',\r\n {\r\n writable: true,\r\n enumerable: true,\r\n value: false\r\n }\r\n )\r\n}\r\n\r\n/**\r\n * Protected property names that cannot be used as state keys.\r\n * These are reserved for internal memorio functionality.\r\n */\r\nexport const protect = [\r\n 'list',\r\n 'state',\r\n 'store',\r\n 'idb',\r\n 'remove',\r\n 'removeAll'\r\n]\r\n", "Object.defineProperty(\r\n memorio,\r\n 'dispatch',\r\n {\r\n writable: false,\r\n enumerable: false,\r\n value: {\r\n\r\n /**\r\n * Dispatches a custom event with the specified name and value.\r\n * @param name The name of the event.\r\n * @param value The value to pass with the event.\r\n */\r\n set: (name: string, value = {}) => {\r\n dispatchEvent(new CustomEvent(String(name), value))\r\n },\r\n\r\n /////////////////////////////////////////////////////\r\n\r\n /**\r\n * Listens for the specified event names and executes the callback when the event is triggered.\r\n * @param name The name of the event to listen for.\r\n * @param cb The callback function to execute when the event is triggered.\r\n * @param flag A flag to indicate whether to remove existing listeners (default is false).\r\n */\r\n listen: (name: string, cb: ((e: Event) => void) | null = null, _flag = false) => {\r\n const exec = (e: Event) => cb\r\n ? setTimeout(() => cb(e), 1)\r\n : null\r\n globalThis.addEventListener(name, exec as any)\r\n ; (globalThis as any).events = (globalThis as any).events || {}\r\n ; (globalThis as any).events[name] = exec\r\n },\r\n\r\n /////////////////////////////////////////////////////\r\n\r\n /**\r\n * Removes the event listener for the specified event names.\r\n * @param name The name of the event to remove the listener for.\r\n */\r\n remove: (name: string) => {\r\n const events = (globalThis as any).events || {}\r\n globalThis.removeEventListener(name, events[name] as any)\r\n delete events[name]\r\n }\r\n\r\n }\r\n }\r\n)\r\n", "/**\r\n * Extracts the function name from a container object.\r\n * @param container The container object.\r\n * @param object The function or property to extract name from.\r\n * @returns The extracted property name.\r\n */\r\n; (memorio as any).propertyName = function (_container: unknown, _object: unknown) {\r\n\r\n const t = String(_object).replace(\"() => \", \"\")\r\n return t\r\n\r\n return null // Or handle as needed if not found\r\n}\r\n", "/**\r\n * MEMORIO LOGGING MIDDLEWARE\r\n *\r\n * This module provides logging capabilities for Memorio state changes.\r\n * It can log to console and optionally to a custom log handler.\r\n */\r\n\r\ninterface LogEntry {\r\n timestamp: string\r\n module: 'state' | 'store' | 'session' | 'cache' | 'idb'\r\n action: 'get' | 'set' | 'delete' | 'clear'\r\n path: string\r\n value?: any\r\n previousValue?: any\r\n duration?: number\r\n}\r\n\r\ntype LogHandler = (entry: LogEntry) => void\r\n\r\ninterface LoggerConfig {\r\n enabled: boolean\r\n logToConsole: boolean\r\n customHandler?: LogHandler\r\n modules: ('state' | 'store' | 'session' | 'cache' | 'idb')[]\r\n maxEntries: number\r\n}\r\n\r\nconst defaultConfig: LoggerConfig = {\r\n enabled: true,\r\n logToConsole: true,\r\n modules: ['state', 'store', 'session', 'cache', 'idb'],\r\n maxEntries: 1000\r\n}\r\n\r\n// Helper to check if debug mode is enabled\r\nfunction isDebugEnabled(): boolean {\r\n return (globalThis as any).memorio?.debug === true\r\n}\r\n\r\nlet config: LoggerConfig = { ...defaultConfig }\r\nconst logHistory: LogEntry[] = []\r\n\r\n/**\r\n * Configure the logger\r\n */\r\nexport const configure = (options: Partial<LoggerConfig>): void => {\r\n config = { ...config, ...options }\r\n}\r\n\r\n/**\r\n * Enable or disable logging\r\n */\r\nexport const enable = (): void => {\r\n config.enabled = true\r\n}\r\n\r\n/**\r\n * Disable logging\r\n */\r\nexport const disable = (): void => {\r\n config.enabled = false\r\n}\r\n\r\n/**\r\n * Check if logging is enabled for a specific module\r\n */\r\nexport const isEnabled = (module: LoggerConfig['modules'][number]): boolean => {\r\n return config.enabled && config.modules.includes(module)\r\n}\r\n\r\n/**\r\n * Log an entry\r\n */\r\nexport const log = (\r\n module: LoggerConfig['modules'][number],\r\n action: LogEntry['action'],\r\n path: string,\r\n value?: any,\r\n previousValue?: any\r\n): void => {\r\n if (!isEnabled(module)) return\r\n\r\n const entry: LogEntry = {\r\n timestamp: new Date().toISOString(),\r\n module,\r\n action,\r\n path,\r\n value,\r\n previousValue\r\n }\r\n\r\n // Add to history\r\n logHistory.push(entry)\r\n if (logHistory.length > config.maxEntries) {\r\n logHistory.shift()\r\n }\r\n\r\n // Console output (only in debug mode)\r\n if (config.logToConsole && isDebugEnabled()) {\r\n const prefix = `[Memorio:${module.toUpperCase()}]`\r\n const color = getModuleColor(module)\r\n\r\n console.debug(\r\n `%c${prefix}%c ${action} ${path}`,\r\n `color: ${color}; font-weight: bold`,\r\n 'color: inherit'\r\n )\r\n\r\n if (value !== undefined) {\r\n console.debug(' \u2192 value:', value)\r\n }\r\n if (previousValue !== undefined) {\r\n console.debug(' \u2190 previous:', previousValue)\r\n }\r\n }\r\n\r\n // Custom handler\r\n if (config.customHandler) {\r\n config.customHandler(entry)\r\n }\r\n}\r\n\r\n/**\r\n * Get color for module\r\n */\r\nconst getModuleColor = (module: string): string => {\r\n const colors: Record<string, string> = {\r\n state: '#4CAF50',\r\n store: '#2196F3',\r\n session: '#FF9800',\r\n cache: '#9C27B0',\r\n idb: '#F44336'\r\n }\r\n return colors[module] || '#888888'\r\n}\r\n\r\n/**\r\n * Get log history\r\n */\r\nexport const getHistory = (): LogEntry[] => {\r\n return [...logHistory]\r\n}\r\n\r\n/**\r\n * Clear log history\r\n */\r\nexport const clearHistory = (): void => {\r\n logHistory.length = 0\r\n}\r\n\r\n/**\r\n * Get statistics\r\n */\r\nexport const getStats = (): Record<string, number> => {\r\n const stats: Record<string, number> = {\r\n total: logHistory.length,\r\n state: 0,\r\n store: 0,\r\n session: 0,\r\n cache: 0,\r\n idb: 0,\r\n set: 0,\r\n get: 0,\r\n delete: 0,\r\n clear: 0\r\n }\r\n\r\n logHistory.forEach(entry => {\r\n stats[entry.module]++\r\n stats[entry.action]++\r\n })\r\n\r\n return stats\r\n}\r\n\r\n/**\r\n * Export log entries for debugging\r\n */\r\nexport const exportLogs = (): string => {\r\n return JSON.stringify(logHistory, null, 2)\r\n}\r\n\r\n// Add to global memorio object\r\nif (typeof globalThis.memorio !== 'undefined') {\r\n Object.defineProperty(globalThis.memorio, 'logger', {\r\n enumerable: false,\r\n configurable: true,\r\n value: {\r\n configure,\r\n enable,\r\n disable,\r\n isEnabled,\r\n log,\r\n getHistory,\r\n clearHistory,\r\n getStats,\r\n exportLogs\r\n }\r\n })\r\n}\r\n", "/**\r\n * MEMORIO STATE MANAGEMENT\r\n *\r\n * This module provides reactive state management using Proxy.\r\n * It enables nested object tracking and dispatches events on state changes.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\nimport { protect } from \"../../config/global.js\"\r\n\r\n// Import logger for automatic logging\r\nimport '../../functions/logger'\r\n\r\n/**\r\n * React integration using useSyncExternalStore\r\n * This provides proper React 18+ integration without requiring hooks in library code\r\n */\r\n\r\n// Subscribe function for external store integration\r\nconst subscribers = new Set<() => void>()\r\n\r\nfunction subscribe(callback: () => void) {\r\n subscribers.add(callback)\r\n return () => subscribers.delete(callback)\r\n}\r\n\r\n// State version for change detection - updated on every state change\r\nlet stateVersion = 0\r\n\r\nfunction getSnapshot() {\r\n return stateVersion\r\n}\r\n\r\n// Call this to bump the version when state changes\r\nexport function bumpStateVersion() {\r\n stateVersion++\r\n}\r\n\r\nfunction getServerSnapshot() {\r\n return 0\r\n}\r\n\r\n// Export subscribe for useSyncExternalStore\r\nexport const memorioSubscribe = subscribe\r\nexport const memorioGetSnapshot = getSnapshot\r\nexport const memorioGetServerSnapshot = getServerSnapshot\r\n\r\n// Trigger all subscribers (call this when state changes)\r\nfunction triggerReact() {\r\n stateVersion++\r\n subscribers.forEach(cb => cb())\r\n}\r\n\r\nObject.defineProperty(\r\n memorio,\r\n 'objPath',\r\n {\r\n // configurable: true,\r\n writable: false,\r\n enumerable: false,\r\n value: (prop: string, object: string[], separator: string = '.'): string => {\r\n return object.concat(prop).join(separator)\r\n }\r\n }\r\n)\r\n\r\n/////////////////////////////////////////////////////\r\n\r\n/**\r\n * Builds a recursive proxy for reactive state management.\r\n * @param obj The target object to proxy.\r\n * @param callback Function called on state changes.\r\n * @param tree Current path in the object tree.\r\n * @returns A proxied object with reactive behavior.\r\n */\r\nexport const buildProxy = (obj: Record<string, any>, callback: (props: any) => void, tree: string[] = []): any => {\r\n\r\n // EVENT FUNCTION FOR OBSERVER\r\n const event = (name: string) => {\r\n const array = name.split('.')\r\n array.forEach(\r\n (x, i) => {\r\n const command = array.slice(0, i + 1).join('.')\r\n globalThis.memorio.dispatch.set(command, { detail: { name: command } })\r\n }\r\n )\r\n return\r\n }\r\n\r\n ///////////////////////////////////////////////\r\n\r\n // CREATE THE PROXY\r\n return new Proxy(\r\n obj,\r\n {\r\n get(target: any, prop: any) {\r\n // Handle special methods first\r\n\r\n if (prop === 'list') {\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug('Some state could be hidden when you use \"state.list\". Use \"state\" to see the complete list ')\r\n }\r\n return JSON.parse(JSON.stringify(target))\r\n }\r\n\r\n if (prop === 'remove') {\r\n return function (key: string) {\r\n delete target[key]\r\n return true\r\n }\r\n }\r\n\r\n if (prop === 'removeAll') {\r\n return function () {\r\n try {\r\n for (const key in target) {\r\n if (typeof target[key] !== 'function' && !['list', 'remove', 'removeAll'].includes(key)) {\r\n if (!Object.isFrozen(target[key])) delete target[key]\r\n delete target[key]\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n return\r\n }\r\n }\r\n\r\n if (Object.isFrozen(target[prop])) return target[prop]\r\n\r\n try {\r\n const value = Reflect.get(target, prop)\r\n if (value && typeof value === 'object' && ['Array', 'Object'].includes(value.constructor.name)) {\r\n return buildProxy(value, callback, tree.concat(prop as string))\r\n }\r\n return value\r\n } catch (error) {\r\n console.error('Error: ', error)\r\n return undefined\r\n }\r\n\r\n },\r\n\r\n set(target: any, key: string, value: any): boolean {\r\n\r\n // PROTECTED\r\n if (protect.includes(key)) {\r\n console.error('key ' + key + ' is protected')\r\n return false\r\n }\r\n\r\n // FREEZED\r\n if (target[key] && typeof target[key] === 'object' && Object.isFrozen(target[key])) {\r\n console.error(`Error: state '${key}' is locked`)\r\n return false\r\n }\r\n\r\n // ALLOWED SET\r\n\r\n try {\r\n\r\n const path = globalThis.memorio.objPath(key as string, tree)\r\n\r\n callback(\r\n {\r\n action: 'set',\r\n path,\r\n target,\r\n newValue: value,\r\n previousValue: Reflect.get(target, key)\r\n }\r\n )\r\n\r\n event('state.' + path)\r\n\r\n // Trigger React re-render if available\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('state', 'set', path, value, Reflect.get(target, key))\r\n }\r\n\r\n // Handle undefined values - use a sentinel to distinguish from missing properties\r\n if (value === undefined) {\r\n // Use a special marker object to represent undefined\r\n ; (target as any)[key] = globalThis.memorio\r\n } else {\r\n Reflect.set(target, key, value)\r\n }\r\n\r\n // DEFINE LOCK PROPERTY FUNCTION\r\n if (target[key] && typeof target[key] === 'object') {\r\n\r\n Reflect.defineProperty(\r\n target[key],\r\n 'lock',\r\n {\r\n value() {\r\n Object.defineProperty(\r\n target,\r\n key,\r\n {\r\n writable: false,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.freeze(target[key])\r\n }\r\n }\r\n )\r\n\r\n }\r\n\r\n return true\r\n\r\n } catch (error) {\r\n\r\n console.error('Error in set trap:', error)\r\n return false\r\n\r\n }\r\n\r\n },\r\n\r\n deleteProperty(target: any, prop: string | symbol): boolean {\r\n try {\r\n const path = globalThis.memorio.objPath(prop as string, tree)\r\n callback({ action: 'delete', path, target })\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('state', 'delete', path, undefined, Reflect.get(target, prop))\r\n }\r\n\r\n return Reflect.deleteProperty(target, prop)\r\n } catch (error) {\r\n console.error('Error in deleteProperty trap:', error)\r\n return false\r\n }\r\n }\r\n\r\n }\r\n\r\n )\r\n\r\n}\r\n\r\n// Export state for module usage\r\nexport const state = buildProxy({}, () => { })\r\n\r\n// SET STATE AS PROXY (only if global enabled)\r\nif (shouldCreateGlobal('state')) {\r\n globalThis.state = state\r\n\r\n ///////////////////////////////////////////////\r\n\r\n // DEFINE THE STATE IN GLOBAL\r\n Object.defineProperty(\r\n globalThis,\r\n 'state',\r\n {\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n", "/**\r\n * MEMORIO STORE (localStorage)\r\n *\r\n * This module provides localStorage persistence with a simple API.\r\n * It handles JSON serialization/deserialization automatically.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Logger import\r\nimport '../../functions/logger'\r\n\r\n// STORE\r\nconst storeProxy: any = new Proxy({}, {})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('store')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'store',\r\n {\r\n value: storeProxy,\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n\r\nObject.defineProperties(\r\n storeProxy,\r\n {\r\n /**\r\n * Gets a value from localStorage.\r\n * @param name The key to retrieve.\r\n * @returns The parsed value or null if not found.\r\n */\r\n get: {\r\n value(name: string) {\r\n if (!name) return\r\n try {\r\n const item = localStorage.getItem(name)\r\n if (item) return JSON.parse(item)\r\n return item\r\n } catch (err) {\r\n console.error(`Error parsing store item '${name}':`, err)\r\n }\r\n return null\r\n }\r\n },\r\n\r\n /**\r\n * Sets a value in localStorage.\r\n * @param name The key to set.\r\n * @param value The value to store (objects, arrays, primitives).\r\n */\r\n set: {\r\n value(name: string, value: any) {\r\n if (!name) return\r\n try {\r\n\r\n if (value === null || value === undefined) localStorage.setItem(name, JSON.stringify(null))\r\n else if (typeof value === 'object' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') localStorage.setItem(name, JSON.stringify(value))\r\n else if (typeof value === 'function') console.error('It\\'s not secure to store functions.')\r\n\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n const previous = localStorage.getItem(name)\r\n globalThis.memorio.logger.log('store', 'set', name, value, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(`Error setting store item '${name}':`, err)\r\n\r\n }\r\n return null\r\n }\r\n },\r\n\r\n /**\r\n * Removes a value from localStorage.\r\n * @param name The key to remove.\r\n * @returns True if removed, false if not found.\r\n */\r\n remove: {\r\n value(name: string) {\r\n if (!name) return\r\n if (localStorage.getItem(name)) {\r\n const previous = localStorage.getItem(name)\r\n localStorage.removeItem(name)\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('store', 'delete', name, undefined, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n return true\r\n }\r\n return false\r\n }\r\n },\r\n\r\n /**\r\n * Alias for remove.\r\n * @param name The key to delete.\r\n */\r\n delete: {\r\n value(name: string) {\r\n storeProxy.remove(name)\r\n return true\r\n }\r\n\r\n },\r\n\r\n /**\r\n * Clears all items from localStorage.\r\n */\r\n removeAll: {\r\n value() {\r\n localStorage.clear()\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('store', 'clear', '*')\r\n }\r\n\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Alias for removeAll.\r\n */\r\n clearAll: {\r\n value() {\r\n storeProxy.removeAll()\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Estimates storage quota usage.\r\n * @returns Promise with [usage, quota] in KB.\r\n */\r\n quota: {\r\n value() {\r\n if ('storage' in navigator && 'estimate' in navigator.storage) {\r\n navigator.storage.estimate()\r\n .then(\r\n ({ usage, quota }) => {\r\n if (usage && quota) {\r\n console.debug(`Using ${usage / 1024} out of ${quota / 1024} Mb.`)\r\n return [usage / 1024, quota / 1024]\r\n }\r\n }\r\n )\r\n .catch(err => { console.error('Error estimating quota:', err) })\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Calculates total size of all localStorage items.\r\n * @returns Total size in characters.\r\n */\r\n size: {\r\n value() {\r\n let totalSize = 0\r\n for (const key in localStorage) {\r\n if (Object.prototype.hasOwnProperty.call(localStorage, key)) {\r\n const item = localStorage.getItem(key)\r\n if (item) totalSize += item.length\r\n }\r\n }\r\n return totalSize\r\n }\r\n },\r\n\r\n /**\r\n * Get a list of all store items.\r\n * @returns Object with all store items.\r\n */\r\n list: {\r\n value() {\r\n const result: Record<string, any> = {}\r\n for (const key in localStorage) {\r\n if (Object.prototype.hasOwnProperty.call(localStorage, key)) {\r\n try {\r\n result[key] = JSON.parse(localStorage.getItem(key) || 'null')\r\n } catch {\r\n result[key] = localStorage.getItem(key)\r\n }\r\n }\r\n }\r\n return result\r\n }\r\n }\r\n\r\n }\r\n)\r\n\r\nObject.freeze(storeProxy)\r\n\r\n// Export store for module usage\r\nexport const store = storeProxy\r\n", "/**\r\n * MEMORIO SESSION (sessionStorage)\r\n *\r\n * This module provides sessionStorage persistence with a simple API.\r\n * Data is cleared when the browser tab is closed.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Remove the old reactTrigger code\r\n\r\n// Logger import\r\nimport '../../functions/logger'\r\n\r\n// Session proxy\r\nconst sessionProxy: any = new Proxy({}, {})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('session')) {\r\n Object.defineProperty(\r\n globalThis,\r\n 'session',\r\n {\r\n value: sessionProxy,\r\n enumerable: false,\r\n configurable: true\r\n }\r\n )\r\n}\r\n\r\nObject.defineProperties(\r\n sessionProxy,\r\n {\r\n /**\r\n * Gets a value from sessionStorage.\r\n * @param name The key to retrieve.\r\n * @returns The parsed value or null if not found.\r\n */\r\n get: {\r\n value(name: string) {\r\n if (!name) return\r\n try {\r\n const item = sessionStorage.getItem(name)\r\n if (item) return JSON.parse(item)\r\n return item\r\n } catch (err) {\r\n console.error(`Error parsing session item '${name}':`, err)\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Sets a value in sessionStorage.\r\n * @param name The key to set.\r\n * @param value The value to store.\r\n */\r\n set: {\r\n value(name: string, value: any) {\r\n if (!name) return\r\n try {\r\n\r\n if (value === null || value === undefined) sessionStorage.setItem(name, JSON.stringify(null))\r\n else if (typeof value === 'object' || typeof value === 'number' || typeof value === 'boolean' || typeof value === 'string') sessionStorage.setItem(name, JSON.stringify(value))\r\n else if (typeof value === 'function') console.error('It\\'s not secure to session functions.')\r\n\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n const previous = sessionStorage.getItem(name)\r\n globalThis.memorio.logger.log('session', 'set', name, value, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n } catch (err) {\r\n\r\n console.error(`Error setting session item '${name}':`, err)\r\n\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Removes a value from sessionStorage.\r\n * @param name The key to remove.\r\n * @returns True if removed.\r\n */\r\n remove: {\r\n value(name: string) {\r\n if (!name) return\r\n if (sessionStorage.getItem(name)) {\r\n const previous = sessionStorage.getItem(name)\r\n sessionStorage.removeItem(name)\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('session', 'delete', name, undefined, previous ? JSON.parse(previous) : undefined)\r\n }\r\n\r\n return true\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Alias for remove.\r\n * @param name The key to delete.\r\n */\r\n delete: {\r\n value(name: string) {\r\n session.remove(name)\r\n return true\r\n }\r\n\r\n },\r\n\r\n /**\r\n * Clears all sessionStorage items.\r\n */\r\n removeAll: {\r\n value() {\r\n sessionStorage.clear()\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('session', 'clear', '*')\r\n }\r\n\r\n return true\r\n }\r\n },\r\n\r\n /**\r\n * Alias for removeAll.\r\n */\r\n clearAll: {\r\n value() {\r\n session.removeAll()\r\n return true\r\n }\r\n },\r\n\r\n quota: {\r\n value() {\r\n if ('storage' in navigator && 'estimate' in navigator.storage) {\r\n navigator.storage.estimate()\r\n .then(\r\n ({ usage, quota }) => {\r\n if (usage && quota) console.debug(`Using ${usage / 1024} out of ${quota / 1024} Mb.`)\r\n }\r\n )\r\n .catch(err => { console.error('Error estimating quota:', err) })\r\n }\r\n return\r\n }\r\n },\r\n\r\n /**\r\n * Gets total size of all sessionStorage items.\r\n * @returns Total size in characters.\r\n */\r\n size: {\r\n value() {\r\n let totalSize = 0\r\n for (const key in sessionStorage) {\r\n if (Object.prototype.hasOwnProperty.call(sessionStorage, key)) {\r\n const item = sessionStorage.getItem(key)\r\n if (item) {\r\n totalSize += item.length\r\n }\r\n }\r\n }\r\n return totalSize\r\n }\r\n },\r\n\r\n /**\r\n * Get a list of all session items.\r\n * @returns Object with all session items.\r\n */\r\n list: {\r\n value() {\r\n const result: Record<string, any> = {}\r\n for (const key in sessionStorage) {\r\n if (Object.prototype.hasOwnProperty.call(sessionStorage, key)) {\r\n try {\r\n result[key] = JSON.parse(sessionStorage.getItem(key) || 'null')\r\n } catch {\r\n result[key] = sessionStorage.getItem(key)\r\n }\r\n }\r\n }\r\n return result\r\n }\r\n }\r\n\r\n }\r\n)\r\n\r\nObject.freeze(session)\r\n", "/**\r\n * MEMORIO CACHE (In-Memory)\r\n *\r\n * This module provides in-memory caching using a simple object.\r\n * Data is lost on page refresh.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\n\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Import memorio global\r\nimport { state as globalState } from '../state'\r\n\r\n// React integration - reuse state subscribers\r\nconst subscribers = (globalState as any).subscribers || new Set<() => void>()\r\n\r\nfunction triggerReact() {\r\n subscribers.forEach((cb: () => void) => cb())\r\n}\r\n\r\n// Logger import\r\nimport '../logger'\r\n\r\n// Define cache on globalThis\r\nconst cacheProxy = new Proxy({}, {\r\n set(target, prop, value) {\r\n const previousValue = (target as any)[prop]\r\n ; (target as any)[prop] = value\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the change\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'set', String(prop), value, previousValue)\r\n }\r\n\r\n return true\r\n },\r\n deleteProperty(target, prop) {\r\n const previousValue = (target as any)[prop]\r\n delete (target as any)[prop]\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n\r\n // Log the delete\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'delete', String(prop), undefined, previousValue)\r\n }\r\n\r\n return true\r\n },\r\n get(target: any, prop) {\r\n // Add clear method\r\n if (prop === 'clear') {\r\n return () => {\r\n Object.keys(target).forEach(key => {\r\n delete target[key]\r\n })\r\n // Trigger React re-render\r\n if (subscribers.size > 0) triggerReact()\r\n // Log the clear\r\n if (typeof globalThis.memorio?.logger?.log === 'function') {\r\n globalThis.memorio.logger.log('cache', 'clear', '*')\r\n }\r\n }\r\n }\r\n return (target as any)[prop]\r\n }\r\n})\r\n\r\n// Only create global if enabled\r\nif (shouldCreateGlobal('cache')) {\r\n Object.defineProperty(globalThis, 'cache', {\r\n value: cacheProxy,\r\n enumerable: false,\r\n configurable: true\r\n })\r\n}\r\n\r\n// Export cache for module usage\r\nexport const cache = cacheProxy\r\n\r\nexport { }\r\n", "\r\n/**\r\n * MEMORIO INDEXEDDB\r\n *\r\n * This module provides IndexedDB browser database functionality.\r\n * It enables persistent storage for large amounts of structured data.\r\n * Auto-detects React and triggers useEffect when available.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// React trigger mechanism - accessible to CRUD operations\r\nconst reactTrigger = (() => {\r\n let trigger: any = null\r\n let tick = 0\r\n\r\n if (typeof (globalThis as any).useEffect !== 'undefined') {\r\n try {\r\n const React = (globalThis as any).React\r\n if (React && React.useState) {\r\n const [, setTickState] = React.useState(0)\r\n trigger = () => {\r\n tick++\r\n setTickState(tick)\r\n }\r\n }\r\n } catch (_e) { }\r\n }\r\n\r\n return trigger\r\n})()\r\n\r\n // Export for use in CRUD operations\r\n ; (globalThis as any).memorioIdbTrigger = () => { if (reactTrigger) reactTrigger() }\r\n\r\n(\r\n () => {\r\n\r\n // Only create globals if enabled\r\n if (shouldCreateGlobal('idb')) {\r\n Object.defineProperty(\r\n window,\r\n \"idb\",\r\n {\r\n value: {\r\n db: {},\r\n table: {},\r\n data: {}\r\n },\r\n writable: true,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n\r\n Object.defineProperty(\r\n window,\r\n \"idbases\",\r\n {\r\n value: [],\r\n writable: true,\r\n configurable: true,\r\n enumerable: false\r\n }\r\n )\r\n }\r\n\r\n // Export for module usage\r\n const idb = {\r\n db: {},\r\n table: {},\r\n data: {}\r\n }\r\n\r\n // setTimeout(\r\n // () => {\r\n import('./tools/db.create')\r\n import('./tools/db.list')\r\n import('./tools/db.exist')\r\n import('./tools/db.quota')\r\n import('./tools/db.delete')\r\n import('./tools/db.size')\r\n import('./tools/db.version')\r\n import('./tools/db.support')\r\n import('./tools/table.create')\r\n import('./tools/table.size')\r\n\r\n import('./crud/data.delete')\r\n import('./crud/data.set')\r\n import('./crud/data.get')\r\n // }, 0\r\n // )\r\n\r\n if (shouldCreateGlobal('idb')) {\r\n Object.preventExtensions(idb)\r\n Object.seal(idb)\r\n Object.freeze(idb)\r\n }\r\n\r\n }\r\n)()\r\n", "/**\r\n * MEMORIO DEVTOOLS\r\n *\r\n * This module provides browser DevTools integration for Memorio.\r\n * It exposes state, store, session, cache and IDB to the browser console\r\n * for debugging and inspection.\r\n *\r\n * CONFIGURATION:\r\n * Set window.memorio = { globals: false } before importing to disable global pollution\r\n */\r\n\r\n// Helper to check if globals should be created\r\nconst memorioConfig = (globalThis as any).memorio || {}\r\nconst globalsConfig = memorioConfig.globals\r\nfunction shouldCreateGlobal(name: string): boolean {\r\n if (globalsConfig === false) return false\r\n if (globalsConfig && typeof globalsConfig === 'object') {\r\n return globalsConfig[name] !== false\r\n }\r\n return true\r\n}\r\n\r\n// Helper to check if debug mode is enabled\r\nfunction isDebugEnabled(): boolean {\r\n return (globalThis as any).memorio?.debug === true\r\n}\r\n\r\ninterface DevToolsStats {\r\n stateKeys: number\r\n storeKeys: number\r\n sessionKeys: number\r\n cacheKeys: number\r\n idbDatabases: number\r\n lastUpdate: string\r\n}\r\n\r\n/**\r\n * Inspect all Memorio modules\r\n */\r\nexport const inspect = (): void => {\r\n if (!isDebugEnabled()) return\r\n console.debug('%c\uD83E\uDDE0 Memorio State Inspector', 'font-size: 16px; font-weight: bold; color: #4CAF50')\r\n console.debug('')\r\n\r\n // State\r\n if (globalThis.state) {\r\n console.debug('%c\uD83D\uDCE6 STATE', 'color: #4CAF50; font-weight: bold')\r\n console.table(globalThis.state.list ? globalThis.state.list() : globalThis.state)\r\n console.debug('')\r\n }\r\n\r\n // Store\r\n if (globalThis.store) {\r\n console.debug('%c\uD83C\uDFEA STORE', 'color: #2196F3; font-weight: bold')\r\n console.table(globalThis.store.list ? globalThis.store.list() : globalThis.store)\r\n console.debug('')\r\n }\r\n\r\n // Session\r\n if (globalThis.session) {\r\n console.debug('%c\uD83D\uDD10 SESSION', 'color: #FF9800; font-weight: bold')\r\n console.table(globalThis.session.list ? globalThis.session.list() : globalThis.session)\r\n console.debug('')\r\n }\r\n\r\n // Cache\r\n if (globalThis.cache) {\r\n console.debug('%c\u26A1 CACHE', 'color: #9C27B0; font-weight: bold')\r\n console.table(globalThis.cache.list ? globalThis.cache.list() : globalThis.cache)\r\n console.debug('')\r\n }\r\n}\r\n\r\n/**\r\n * Get statistics about all modules\r\n */\r\nexport const stats = (): DevToolsStats => {\r\n const getKeys = (obj: any): number => {\r\n if (!obj) return 0\r\n if (typeof obj.list === 'function') {\r\n const list = obj.list()\r\n return Object.keys(list).length\r\n }\r\n return Object.keys(obj).length\r\n }\r\n\r\n return {\r\n stateKeys: getKeys(globalThis.state),\r\n storeKeys: getKeys(globalThis.store),\r\n sessionKeys: getKeys(globalThis.session),\r\n cacheKeys: getKeys(globalThis.cache),\r\n idbDatabases: 0, // Would require async IDB check\r\n lastUpdate: new Date().toISOString()\r\n }\r\n}\r\n\r\n/**\r\n * Clear all data from a specific module\r\n */\r\nexport const clear = (module: 'state' | 'store' | 'session' | 'cache'): void => {\r\n if (globalThis[module] && typeof (globalThis[module] as any).clear === 'function') {\r\n (globalThis[module] as any).clear()\r\n if (isDebugEnabled()) {\r\n console.debug(`%c\u2713 Cleared ${module}`, 'color: #4CAF50')\r\n }\r\n } else {\r\n console.error(`Module ${module} not found or does not support clear()`)\r\n }\r\n}\r\n\r\n/**\r\n * Clear all modules\r\n */\r\nexport const clearAll = (): void => {\r\n clear('state')\r\n clear('store')\r\n clear('session')\r\n clear('cache')\r\n if (isDebugEnabled()) {\r\n console.debug('%c\u2713 Cleared all Memorio modules', 'color: #4CAF50; font-weight: bold')\r\n }\r\n}\r\n\r\n/**\r\n * Watch a specific path for changes\r\n */\r\nexport const watch = (module: string, path: string): void => {\r\n if (!isDebugEnabled()) return\r\n\r\n console.debug(`%c\uD83D\uDC41 Watching ${module}.${path}`, 'color: #FF9800')\r\n\r\n const target = globalThis[module as keyof typeof globalThis]\r\n if (target) {\r\n // Simple watch implementation - logs access\r\n const original = (target as any)[path]\r\n if (original !== undefined) {\r\n Object.defineProperty(target, path, {\r\n get: function () {\r\n console.debug(`%c\uD83D\uDC41 Access: ${module}.${path}`, 'color: #FF9800')\r\n return original\r\n },\r\n set: function (value) {\r\n console.debug(`%c\uD83D\uDC41 Change: ${module}.${path} =`, 'color: #FF9800', value)\r\n return value\r\n }\r\n })\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Export all data as JSON\r\n */\r\nexport const exportData = (): string => {\r\n const data = {\r\n state: globalThis.state?.list ? globalThis.state.list() : globalThis.state,\r\n store: globalThis.store?.list ? globalThis.store.list() : globalThis.store,\r\n session: globalThis.session?.list ? globalThis.session.list() : globalThis.session,\r\n cache: globalThis.cache?.list ? globalThis.cache.list() : globalThis.cache,\r\n exportedAt: new Date().toISOString()\r\n }\r\n\r\n return JSON.stringify(data, null, 2)\r\n}\r\n\r\n/**\r\n * Import data from JSON\r\n */\r\nexport const importData = (jsonString: string): void => {\r\n try {\r\n const data = JSON.parse(jsonString)\r\n\r\n if (data.state) {\r\n Object.entries(data.state).forEach(([key, value]) => {\r\n if (globalThis.state) (globalThis.state as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.store) {\r\n Object.entries(data.store).forEach(([key, value]) => {\r\n if (globalThis.store) (globalThis.store as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.session) {\r\n Object.entries(data.session).forEach(([key, value]) => {\r\n if (globalThis.session) (globalThis.session as any)[key] = value\r\n })\r\n }\r\n\r\n if (data.cache) {\r\n Object.entries(data.cache).forEach(([key, value]) => {\r\n if (globalThis.cache) (globalThis.cache as any)[key] = value\r\n })\r\n }\r\n\r\n if (isDebugEnabled()) {\r\n console.debug('%c\u2713 Data imported successfully', 'color: #4CAF50')\r\n }\r\n } catch (error) {\r\n console.error('%c\u2717 Import failed:', 'color: #F44336', error)\r\n }\r\n}\r\n\r\n/**\r\n * Show help\r\n */\r\nexport const help = (): void => {\r\n if (!isDebugEnabled()) return\r\n console.debug(`\r\n%c\uD83E\uDDE0 Memorio DevTools Help\r\n\r\nAvailable commands:\r\n memorio.devtools.inspect() - Inspect all state modules\r\n memorio.devtools.stats() - Show statistics\r\n memorio.devtools.clear('module') - Clear specific module\r\n memorio.devtools.clearAll() - Clear all modules\r\n memorio.devtools.watch('module', 'path') - Watch a path\r\n memorio.devtools.exportData() - Export all data as JSON\r\n memorio.devtools.importData(json) - Import data from JSON\r\n memorio.devtools.help() - Show this help\r\n\r\nShortcuts:\r\n state - globalThis.state\r\n store - globalThis.store\r\n session - globalThis.session\r\n cache - globalThis.cache\r\n\r\nShortcuts are also available in console as:\r\n $state, $store, $session, $cache\r\n`, 'font-family: monospace; font-size: 12px')\r\n}\r\n\r\n// Add to global memorio object\r\nif (typeof globalThis.memorio !== 'undefined') {\r\n Object.defineProperty(globalThis.memorio, 'devtools', {\r\n enumerable: false,\r\n configurable: true,\r\n value: {\r\n inspect,\r\n stats,\r\n clear,\r\n clearAll,\r\n watch,\r\n exportData,\r\n importData,\r\n help\r\n }\r\n })\r\n}\r\n\r\n// Also expose as global shortcuts for easy console access (only if enabled)\r\nif (shouldCreateGlobal('devtools')) {\r\n Object.defineProperty(globalThis, '$state', {\r\n get: () => globalThis.state,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$store', {\r\n get: () => globalThis.store,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$session', {\r\n get: () => globalThis.session,\r\n configurable: true\r\n })\r\n\r\n Object.defineProperty(globalThis, '$cache', {\r\n get: () => globalThis.cache,\r\n configurable: true\r\n })\r\n\r\n if ((globalThis as any).memorio?.debug) {\r\n console.debug('%c\uD83E\uDDE0 Memorio DevTools loaded. Type memorio.devtools.help() for info.', 'color: #4CAF50; font-weight: bold')\r\n }\r\n}\r\n", "/**\r\n * Memorio React Integration\r\n *\r\n * AUTOMATIC USAGE - No hooks needed!\r\n *\r\n * Wrap your app with MemorioProvider once:\r\n *\r\n * import { MemorioProvider } from 'memorio'\r\n *\r\n * <MemorioProvider>\r\n * <App />\r\n * </MemorioProvider>\r\n *\r\n * Then use global state anywhere - NO HOOKS NEEDED!\r\n *\r\n * function MyComponent() {\r\n * useEffect(() => {\r\n * console.log(state.test) // \u2705 Automatic!\r\n * }, [state.test])\r\n *\r\n * return <button onClick={() => state.test = 123}>Click</button>\r\n * }\r\n */\r\n\r\n// Get React lazily - will be available when used in React app\r\nfunction getReact() {\r\n const React = (globalThis as any).React\r\n if (!React) {\r\n throw new Error('React not found. Make sure React is installed and memorio is imported in a React app.')\r\n }\r\n return React\r\n}\r\n\r\n// Import subscribe from state module\r\nimport { memorioSubscribe } from './state'\r\n\r\n// Create Context lazily\r\nfunction getContext() {\r\n return getReact().createContext(null)\r\n}\r\n\r\n// Provider component - wrap your app with this ONCE\r\nexport function MemorioProvider({ children }: { children: any }) {\r\n const React = getReact()\r\n\r\n // Force re-render on any state change\r\n const [, setTick] = React.useState(0)\r\n\r\n React.useEffect(() => {\r\n const unsubscribe = memorioSubscribe(() => {\r\n setTick((t: number) => t + 1)\r\n })\r\n return unsubscribe\r\n }, [])\r\n\r\n const MemorioContext = getContext()\r\n return React.createElement(MemorioContext.Provider, { value: true }, children)\r\n}\r\n\r\n// Legacy hook - still available for compatibility\r\nexport function useMemorioState() {\r\n const React = getReact()\r\n const [, setTick] = React.useState(0)\r\n\r\n React.useEffect(() => {\r\n const unsubscribe = memorioSubscribe(() => {\r\n setTick((t: number) => t + 1)\r\n })\r\n return unsubscribe\r\n }, [])\r\n}\r\n\r\nexport function useMemorio() {\r\n return (globalThis as any).state\r\n}\r\n"],
|
|
5
|
+
"mappings": "mCAAA,IAAAA,GAAA,OAAAC,EAAAC,EAAA,kBA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EAEL,IAAMC,EAAiBN,GAAW,EAClC,OAAOD,EAAM,cAAcO,EAAe,SAAU,CAAE,MAAO,EAAK,EAAGJ,CAAQ,CAC/E,CAGO,SAASK,IAAkB,CAChC,IAAMR,EAAQD,EAAS,EACjB,CAAC,CAAEK,CAAO,EAAIJ,EAAM,SAAS,CAAC,EAEpCA,EAAM,UAAU,IACMK,EAAiB,IAAM,CACzCD,EAASE,GAAcA,EAAI,CAAC,CAC9B,CAAC,EAEA,CAAC,CAAC,CACP,CAEO,SAASG,IAAa,CAC3B,OAAQ,WAAmB,KAC7B",
|
|
6
|
+
"names": ["db_create_exports", "init_db_create", "__esmMin", "dbName", "ver", "request", "db_list_exports", "init_db_list", "__esmMin", "result", "err", "db_exist_exports", "init_db_exist", "__esmMin", "storeName", "db", "db_quota_exports", "init_db_quota", "__esmMin", "db_delete_exports", "init_db_delete", "__esmMin", "storeName", "db_size_exports", "init_db_size", "__esmMin", "dbName", "index", "request", "_event", "event", "db", "tableNames", "tableSizeGetters", "acc", "tableName", "sizes", "total", "val", "db_version_exports", "init_db_version", "__esmMin", "storeName", "idbVer", "v", "db_support_exports", "init_db_support", "__esmMin", "table_create_exports", "init_table_create", "__esmMin", "dbName", "dbTable", "v", "request", "e", "target", "db", "store", "err", "table_size_exports", "init_table_size", "__esmMin", "db", "table", "resolve", "reject", "e", "size", "transaction", "event", "cursor", "storedObject", "json", "err", "data_delete_exports", "init_data_delete", "__esmMin", "storeName", "table", "value", "request", "db", "transaction", "e", "event", "Store", "data_set_exports", "init_data_set", "__esmMin", "storeName", "table", "value", "request", "db", "transaction", "e", "data_get_exports", "returnValue", "init_data_get", "__esmMin", "storeName", "table", "key", "request", "event", "db", "Store", "_event", "package_default", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "UNDEFINED", "shouldCreateGlobal", "package_default", "protect", "name", "value", "cb", "_flag", "exec", "e", "events", "_container", "_object", "defaultConfig", "isDebugEnabled", "config", "logHistory", "configure", "options", "enable", "disable", "isEnabled", "module", "log", "action", "path", "value", "previousValue", "entry", "prefix", "color", "getModuleColor", "getHistory", "clearHistory", "getStats", "stats", "exportLogs", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "subscribe", "callback", "stateVersion", "memorioSubscribe", "subscribe", "triggerReact", "stateVersion", "subscribers", "cb", "prop", "object", "separator", "buildProxy", "obj", "callback", "tree", "event", "name", "array", "x", "i", "command", "target", "key", "error", "value", "protect", "path", "state", "shouldCreateGlobal", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "storeProxy", "item", "err", "value", "previous", "usage", "quota", "totalSize", "key", "result", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "sessionProxy", "item", "err", "value", "previous", "usage", "quota", "totalSize", "key", "result", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "subscribers", "state", "triggerReact", "cb", "cacheProxy", "target", "prop", "value", "previousValue", "key", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "reactTrigger", "trigger", "tick", "React", "setTickState", "idb", "memorioConfig", "globalsConfig", "shouldCreateGlobal", "name", "isDebugEnabled", "inspect", "stats", "getKeys", "obj", "list", "clear", "module", "clearAll", "watch", "path", "target", "original", "value", "exportData", "data", "importData", "jsonString", "key", "error", "help", "getReact", "React", "getContext", "MemorioProvider", "children", "setTick", "memorioSubscribe", "t", "MemorioContext", "useMemorioState", "useMemorio"]
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memorio",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "index.js",
|
|
7
|
-
"license": "
|
|
8
|
-
"types": "index.d.ts",
|
|
7
|
+
"license": "MIT",
|
|
9
8
|
"typings": "./types/*",
|
|
10
|
-
"description": "Memorio, State + Observer and Store for
|
|
11
|
-
"copyright": "
|
|
9
|
+
"description": "Memorio, State + Observer and Store for an easy life",
|
|
10
|
+
"copyright": "Copyright (c) 2025 Dario Passariello",
|
|
12
11
|
"homepage": "https://a51.gitbook.io/memorio",
|
|
13
12
|
"author": {
|
|
14
13
|
"name": "Dario Passariello",
|
|
@@ -51,42 +50,30 @@
|
|
|
51
50
|
"types/*"
|
|
52
51
|
],
|
|
53
52
|
"exports": {
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
".": {
|
|
54
|
+
"types": "./types/index.d.ts",
|
|
55
|
+
"import": "./index.js",
|
|
56
|
+
"default": "./index.js"
|
|
57
|
+
},
|
|
58
|
+
"./types/*": "./types/*"
|
|
57
59
|
},
|
|
58
60
|
"scripts": {
|
|
59
61
|
"build": "node ./esbuild.config.mjs",
|
|
60
62
|
"watch": "nodemon --watch * --exec \"npm run build \"",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
63
|
+
"npm:publish": "npm run build && npm publish ./dist",
|
|
64
|
+
"test": "cd tests && npm run test",
|
|
65
|
+
"lint": "cd tests && npm run lint",
|
|
66
|
+
"tsc": "cd tests && tsc --noEmit"
|
|
64
67
|
},
|
|
65
68
|
"dependencies": {
|
|
66
69
|
"dphelper.types": "0.0.20"
|
|
67
70
|
},
|
|
68
71
|
"devDependencies": {
|
|
69
|
-
"@
|
|
70
|
-
"
|
|
71
|
-
"@testing-library/jest-dom": "6.9.1",
|
|
72
|
-
"@types/jest": "30.0.0",
|
|
73
|
-
"@types/node": "25.0.10",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
75
|
-
"@typescript-eslint/parser": "8.54.0",
|
|
76
|
-
"esbuild": "0.27.2",
|
|
72
|
+
"@types/node": "25.3.1",
|
|
73
|
+
"esbuild": "0.27.3",
|
|
77
74
|
"esbuild-node-externals": "1.20.1",
|
|
78
75
|
"esbuild-plugin-alias": "0.2.1",
|
|
79
|
-
"esbuild-plugin-clean": "1.0.1",
|
|
80
76
|
"esbuild-plugin-copy": "2.1.1",
|
|
81
|
-
"esbuild-sass-plugin": "3.6.0",
|
|
82
|
-
"esbuild-scss-modules-plugin": "1.1.1",
|
|
83
|
-
"eslint": "9.39.2",
|
|
84
|
-
"jest": "30.2.0",
|
|
85
|
-
"jest-environment-jsdom": "30.2.0",
|
|
86
|
-
"ts-jest": "29.4.6",
|
|
87
|
-
"ts-loader": "^9.5.4",
|
|
88
|
-
"ts-node": "10.9.2",
|
|
89
|
-
"tslib": "^2.8.1",
|
|
90
77
|
"typescript": "5.9.3"
|
|
91
78
|
}
|
|
92
79
|
}
|
package/types/useObserver.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* useObserver run a callback anytime the associated state going to change
|
|
10
|
-
*
|
|
9
|
+
* useObserver run a callback anytime the associated state going to change.
|
|
10
|
+
* Returns a destructor function to remove the listener.
|
|
11
11
|
*/
|
|
12
12
|
interface _useObserver {
|
|
13
13
|
|
|
@@ -15,11 +15,16 @@ interface _useObserver {
|
|
|
15
15
|
* Generate your useObserver
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* useObserver(()=>
|
|
18
|
+
* const cleanup = useObserver(() => console.debug("Changed"), "state.test")
|
|
19
|
+
* cleanup() // Stop observing
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* useObserver(() => console.debug("Multiple changed"), [() => state.a, "state.b"])
|
|
19
23
|
*
|
|
20
24
|
* @since memorio 1.0.6
|
|
25
|
+
* @updated 2.5.0 - Added support for arrays and destructor
|
|
21
26
|
*/
|
|
22
|
-
(func: Function,
|
|
27
|
+
(func: Function, deps: any): (() => void)
|
|
23
28
|
|
|
24
29
|
}
|
|
25
30
|
|