react-globo-state 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -122
- package/dist/README.md +2 -98
- package/dist/index.js +2 -1
- package/dist/package.json +36 -73
- package/package.json +36 -73
- package/dist/advanced.d.ts +0 -8
- package/dist/advanced.d.ts.map +0 -1
- package/dist/advanced.js +0 -1
- package/dist/core/store.d.ts +0 -8
- package/dist/core/store.d.ts.map +0 -1
- package/dist/core/types.d.ts +0 -69
- package/dist/core/types.d.ts.map +0 -1
- package/dist/engines/async.d.ts +0 -11
- package/dist/engines/async.d.ts.map +0 -1
- package/dist/global.d.ts +0 -36
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +0 -1
- package/dist/jest.setup.d.ts +0 -2
- package/dist/jest.setup.d.ts.map +0 -1
- package/dist/plugins/index.d.ts +0 -18
- package/dist/plugins/index.d.ts.map +0 -1
- package/dist/plugins/official/analytics.plugin.d.ts +0 -13
- package/dist/plugins/official/analytics.plugin.d.ts.map +0 -1
- package/dist/plugins/official/devtools.plugin.d.ts +0 -8
- package/dist/plugins/official/devtools.plugin.d.ts.map +0 -1
- package/dist/plugins/official/guard.plugin.d.ts +0 -7
- package/dist/plugins/official/guard.plugin.d.ts.map +0 -1
- package/dist/plugins/official/immer.plugin.d.ts +0 -7
- package/dist/plugins/official/immer.plugin.d.ts.map +0 -1
- package/dist/plugins/official/persistence.plugin.d.ts +0 -12
- package/dist/plugins/official/persistence.plugin.d.ts.map +0 -1
- package/dist/plugins/official/schema.plugin.d.ts +0 -6
- package/dist/plugins/official/schema.plugin.d.ts.map +0 -1
- package/dist/plugins/official/snapshot.plugin.d.ts +0 -6
- package/dist/plugins/official/snapshot.plugin.d.ts.map +0 -1
- package/dist/plugins/official/sync.plugin.d.ts +0 -8
- package/dist/plugins/official/sync.plugin.d.ts.map +0 -1
- package/dist/plugins/official/ttl.plugin.d.ts +0 -6
- package/dist/plugins/official/ttl.plugin.d.ts.map +0 -1
- package/dist/plugins/official/undo-redo.plugin.d.ts +0 -9
- package/dist/plugins/official/undo-redo.plugin.d.ts.map +0 -1
- package/dist/react/hooks.d.ts +0 -18
- package/dist/react/hooks.d.ts.map +0 -1
- package/dist/react/magnatar.d.ts +0 -22
- package/dist/react/magnatar.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,123 +1,3 @@
|
|
|
1
|
-
# React
|
|
1
|
+
# React-globo-state
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> Atomic, Immutable (Immer), Plugin-ready, and Zen-simple.
|
|
5
|
-
|
|
6
|
-
[](https://badge.fury.io/js/react-globo-state)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 🌟 Why Magnatar?
|
|
12
|
-
|
|
13
|
-
We took the simplicity of **React Globo State** and fused it with the architecture of a **High-Performance Kernel**. It's the only library that gives you:
|
|
14
|
-
|
|
15
|
-
- **💎 Absolute Immutability**: Powered by **Immer**. No more manual spreads or accidental mutations. State is frozen by default.
|
|
16
|
-
- **🔌 Kernel Plugins**: A real plugin architecture (`Logger`, `History`, `Undo/Redo`).
|
|
17
|
-
- **⚛️ Async-Native**: Built-in handling for loading/error/data with `createAsyncStore`.
|
|
18
|
-
- **🤖 Off-Main-Thread**: Offload state logic to **Web Workers** with zero effort.
|
|
19
|
-
- **🛡️ Type-Safety**: Strictly typed with TypeScript. No `any` leakage.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## ⚡ Zero-Boilerplate Quickstart
|
|
24
|
-
|
|
25
|
-
Choose your path. Both are nuclear-powered.
|
|
26
|
-
|
|
27
|
-
### Path A: The Global Singleton (The "Classic" Way)
|
|
28
|
-
|
|
29
|
-
Best for sharing state across your entire application.
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
// 1. Initialize once at the top level
|
|
33
|
-
import { initState } from 'react-globo-state'
|
|
34
|
-
initState({ namespace: 'prod_app' })
|
|
35
|
-
|
|
36
|
-
// 2. Set/Get anywhere (Vanilla JS or React)
|
|
37
|
-
gState.set('count', 10)
|
|
38
|
-
|
|
39
|
-
// 3. React Reactive Hook
|
|
40
|
-
const [count, setCount] = useGState('count')
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### Path B: The Magnatar Wrapper (The "Zen" Way)
|
|
44
|
-
|
|
45
|
-
Best for modularized, typed stores without global pollution.
|
|
46
|
-
|
|
47
|
-
```tsx
|
|
48
|
-
import { gstate } from 'react-globo-state'
|
|
49
|
-
|
|
50
|
-
// Create store and hook in one line
|
|
51
|
-
const useSettings = gstate({ theme: 'dark', volume: 80 })
|
|
52
|
-
|
|
53
|
-
// Use it
|
|
54
|
-
const [theme, setTheme] = useSettings('theme')
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## 🚀 Advanced Superpowers
|
|
60
|
-
|
|
61
|
-
### 🔬 Immutable Functional Updates (Immer)
|
|
62
|
-
|
|
63
|
-
Modify state as if it was a plain object. It's magically safe.
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
gState.set('user', (draft) => {
|
|
67
|
-
draft.profile.settings.loginAt = Date.now()
|
|
68
|
-
draft.roles.push('admin')
|
|
69
|
-
}) // Deeply updated, frozen and emitted.
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### ⚛️ Async Stores
|
|
73
|
-
|
|
74
|
-
Stop writing redundant `isLoading` booleans.
|
|
75
|
-
|
|
76
|
-
```tsx
|
|
77
|
-
const productStore = createAsyncStore(() => fetch('/api/product'))
|
|
78
|
-
const { data, loading, error, fetch } = useAsyncGState(productStore)
|
|
79
|
-
|
|
80
|
-
if (loading) return <Spinner />
|
|
81
|
-
return <div>{data.name}</div>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### 🔌 Official Plugins
|
|
85
|
-
|
|
86
|
-
Enable enterprise features in one line.
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
import { LoggerPlugin, HistoryPlugin } from 'react-globo-state'
|
|
90
|
-
|
|
91
|
-
gState._addPlugin(LoggerPlugin({ collapsed: true }))
|
|
92
|
-
gState._addPlugin(HistoryPlugin({ limit: 20 }))
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 📚 Core API Reference
|
|
98
|
-
|
|
99
|
-
### Global Injections
|
|
100
|
-
|
|
101
|
-
- `initState(config)`: Bootstraps the global `gState`.
|
|
102
|
-
- `gState.set(key, val, options?)`: The nuclear command to change state.
|
|
103
|
-
- `gState.get(key)`: Fast, immutable retrieval.
|
|
104
|
-
- `useGState(key)`: The reactive bridge.
|
|
105
|
-
|
|
106
|
-
### Heavy Duty
|
|
107
|
-
|
|
108
|
-
- `createStore(config)`: Manual store factory.
|
|
109
|
-
- `createAsyncStore(fetcher)`: Atomic async state management.
|
|
110
|
-
- `createWorkerStore(script)`: Off-main-thread state engine.
|
|
111
|
-
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
## 📄 License
|
|
115
|
-
|
|
116
|
-
MIT © [Dario Passariello](https://github.com/dpassariello)
|
|
117
|
-
|
|
118
|
-
---
|
|
119
|
-
|
|
120
|
-
<p align="center">
|
|
121
|
-
<b>Designed for those who build the future.</b><br/>
|
|
122
|
-
Made with ❤️ and a lot of caffe' espresso!
|
|
123
|
-
</p>
|
|
3
|
+
This project has been renamed.Install using [@biglogic/rgs](https://www.npmjs.com/package/@biglogic/rgs) instead
|
package/dist/README.md
CHANGED
|
@@ -1,99 +1,3 @@
|
|
|
1
|
-
# React
|
|
1
|
+
# React-globo-state
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> The most powerful state management engine for React. Built for those who demand industrial-grade reliability with a zero-boilerplate experience.
|
|
5
|
-
|
|
6
|
-
[](https://badge.fury.io/js/react-globo-state)
|
|
7
|
-
[](https://opensource.org/licenses/MIT)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 🌟 Why Magnatar?
|
|
12
|
-
|
|
13
|
-
We took the simplicity of **React Globo State** and fused it with the architecture of a **High-Performance Kernel**. It's the only library that gives you:
|
|
14
|
-
|
|
15
|
-
- **💎 Absolute Immutability**: Powered by **Immer**. No more manual spreads. State is frozen by default.
|
|
16
|
-
- **🛡️ Industrial-Grade Safety**: Deep Proxy guards that throw `Forbidden Mutation` errors if you try to bypass the kernel.
|
|
17
|
-
- **🔌 Enterprise Ecosystem**: A real plugin architecture with 10+ official modules (Sync, Storage, DevTools, etc.).
|
|
18
|
-
- **⚛️ Power on Demand**: Advanced async and persistence tools isolated in the `advanced` export.
|
|
19
|
-
- **🏗️ Stellar Architecture**: Zero circular dependencies. Modular, clean, and 100% type-safe.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## ⚡ Zero-Boilerplate Quickstart
|
|
24
|
-
|
|
25
|
-
### Path A: The Zen Way (Modular)
|
|
26
|
-
|
|
27
|
-
Best for modern applications. Clean imports, zero global pollution.
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { gstate } from 'react-globo-state'
|
|
31
|
-
|
|
32
|
-
// Create store and hook in one line
|
|
33
|
-
const useCounter = gstate({ count: 0 })
|
|
34
|
-
|
|
35
|
-
// In your component
|
|
36
|
-
const [count, setCount] = useCounter('count')
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
### Path B: The Classic Way (Global)
|
|
40
|
-
|
|
41
|
-
Best for shared state across the entire application.
|
|
42
|
-
|
|
43
|
-
```tsx
|
|
44
|
-
// 1. Initialize once
|
|
45
|
-
import { initState } from 'react-globo-state'
|
|
46
|
-
initState({ namespace: 'app' }, { injectGlobal: true })
|
|
47
|
-
|
|
48
|
-
// 2. Use anywhere
|
|
49
|
-
const [user, setUser] = useGState('user')
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
## 🚀 Advanced Superpowers
|
|
55
|
-
|
|
56
|
-
### 🔌 Official Plugin Ecosystem
|
|
57
|
-
|
|
58
|
-
Extend the core functionality dynamically with specialized modules.
|
|
59
|
-
|
|
60
|
-
1. **ImmerPlugin**: Adds `setWithProduce` for functional updates.
|
|
61
|
-
2. **UndoRedoPlugin**: Multi-level history management.
|
|
62
|
-
3. **PersistencePlugin**: Advanced storage with custom serialization.
|
|
63
|
-
4. **SyncPlugin**: Cross-tab state synchronization via BroadcastChannel.
|
|
64
|
-
5. **SchemaPlugin**: Runtime validation (perfect for Zod).
|
|
65
|
-
6. **DevToolsPlugin**: Redux DevTools integration.
|
|
66
|
-
7. **TTLPlugin**: Time-to-live management.
|
|
67
|
-
8. **AnalyticsPlugin**: Tracking bridge for metrics.
|
|
68
|
-
9. **SnapshotPlugin**: Manual state checkpointing.
|
|
69
|
-
10. **GuardPlugin**: Data transformation layer.
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { createStore, PersistencePlugin, undoRedoPlugin } from 'react-globo-state'
|
|
73
|
-
|
|
74
|
-
const store = createStore()
|
|
75
|
-
store._addPlugin(PersistencePlugin({ storage: 'localStorage' }))
|
|
76
|
-
store._addPlugin(undoRedoPlugin({ limit: 50 }))
|
|
77
|
-
|
|
78
|
-
// Undo like a pro
|
|
79
|
-
store.undo()
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### 🔬 Power Tools (Import from `react-globo-state/advanced`)
|
|
83
|
-
|
|
84
|
-
Need the heavy artillery? We've got you covered.
|
|
85
|
-
|
|
86
|
-
- `createAsyncStore(fetcher)`: Atomic async state management.
|
|
87
|
-
- `StorageAdapters`: High-level interfaces for any storage engine.
|
|
88
|
-
- `Middleware / IPlugin`: Build your own extensions.
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## 📄 License
|
|
93
|
-
|
|
94
|
-
MIT © [Dario Passariello](https://github.com/dpassariello)
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
**Designed for those who build the future.**
|
|
99
|
-
Made with ❤️ and a lot of caffe' espresso!
|
|
3
|
+
This project has been renamed.Install using [@biglogic/rgs](https://www.npmjs.com/package/@biglogic/rgs) instead
|
package/dist/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const run = () => {
|
|
2
|
+
};
|
package/dist/package.json
CHANGED
|
@@ -1,73 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-globo-state",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "A react state everywhere made easy",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
".":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"build": "tsc --emitDeclarationOnly --outDir dist && node ./esbuild.config.mjs",
|
|
38
|
-
"type-check": "tsc --noEmit",
|
|
39
|
-
"test": "jest --config tests/jest/jest.config.ts",
|
|
40
|
-
"test:pw": "playwright test --config tests/playwright/playwright.config.ts",
|
|
41
|
-
"lint": "eslint . --ext .ts,.tsx",
|
|
42
|
-
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
43
|
-
"npm:publish": "npm run build && npm publish"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"immer": "^11.1.4"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"react": ">=16.8.0",
|
|
50
|
-
"react-dom": ">=16.8.0"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@playwright/test": "1.58.2",
|
|
54
|
-
"@testing-library/dom": "10.4.1",
|
|
55
|
-
"@testing-library/jest-dom": "6.9.1",
|
|
56
|
-
"@testing-library/react": "16.3.2",
|
|
57
|
-
"@types/jest": "30.0.0",
|
|
58
|
-
"@types/node": "25.2.3",
|
|
59
|
-
"@types/react": "19.2.14",
|
|
60
|
-
"@types/react-dom": "19.2.3",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
62
|
-
"@typescript-eslint/parser": "^8.55.0",
|
|
63
|
-
"dphelper": "2.6.3",
|
|
64
|
-
"esbuild": "0.27.3",
|
|
65
|
-
"esbuild-plugin-copy": "2.1.1",
|
|
66
|
-
"eslint": "^10.0.0",
|
|
67
|
-
"jest": "30.2.0",
|
|
68
|
-
"jest-environment-jsdom": "30.2.0",
|
|
69
|
-
"ts-jest": "29.4.6",
|
|
70
|
-
"tslib": "^2.8.1",
|
|
71
|
-
"typescript": "^5.9.3"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-globo-state",
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "A react state everywhere made easy",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gstate",
|
|
7
|
+
"state-management",
|
|
8
|
+
"react",
|
|
9
|
+
"hooks",
|
|
10
|
+
"global-state",
|
|
11
|
+
"immer",
|
|
12
|
+
"persistence"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "node ./esbuild.config.mjs",
|
|
30
|
+
"npm:publish": "npm run build && npm publish"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.27.3",
|
|
34
|
+
"esbuild-plugin-copy": "^2.1.1"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,73 +1,36 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "react-globo-state",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "A react state everywhere made easy",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
".":
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"build": "tsc --emitDeclarationOnly --outDir dist && node ./esbuild.config.mjs",
|
|
38
|
-
"type-check": "tsc --noEmit",
|
|
39
|
-
"test": "jest --config tests/jest/jest.config.ts",
|
|
40
|
-
"test:pw": "playwright test --config tests/playwright/playwright.config.ts",
|
|
41
|
-
"lint": "eslint . --ext .ts,.tsx",
|
|
42
|
-
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
43
|
-
"npm:publish": "npm run build && npm publish"
|
|
44
|
-
},
|
|
45
|
-
"dependencies": {
|
|
46
|
-
"immer": "^11.1.4"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"react": ">=16.8.0",
|
|
50
|
-
"react-dom": ">=16.8.0"
|
|
51
|
-
},
|
|
52
|
-
"devDependencies": {
|
|
53
|
-
"@playwright/test": "1.58.2",
|
|
54
|
-
"@testing-library/dom": "10.4.1",
|
|
55
|
-
"@testing-library/jest-dom": "6.9.1",
|
|
56
|
-
"@testing-library/react": "16.3.2",
|
|
57
|
-
"@types/jest": "30.0.0",
|
|
58
|
-
"@types/node": "25.2.3",
|
|
59
|
-
"@types/react": "19.2.14",
|
|
60
|
-
"@types/react-dom": "19.2.3",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^8.55.0",
|
|
62
|
-
"@typescript-eslint/parser": "^8.55.0",
|
|
63
|
-
"dphelper": "2.6.3",
|
|
64
|
-
"esbuild": "0.27.3",
|
|
65
|
-
"esbuild-plugin-copy": "2.1.1",
|
|
66
|
-
"eslint": "^10.0.0",
|
|
67
|
-
"jest": "30.2.0",
|
|
68
|
-
"jest-environment-jsdom": "30.2.0",
|
|
69
|
-
"ts-jest": "29.4.6",
|
|
70
|
-
"tslib": "^2.8.1",
|
|
71
|
-
"typescript": "^5.9.3"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "react-globo-state",
|
|
3
|
+
"version": "2.1.1",
|
|
4
|
+
"description": "A react state everywhere made easy",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"gstate",
|
|
7
|
+
"state-management",
|
|
8
|
+
"react",
|
|
9
|
+
"hooks",
|
|
10
|
+
"global-state",
|
|
11
|
+
"immer",
|
|
12
|
+
"persistence"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./package.json": "./package.json"
|
|
22
|
+
},
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "node ./esbuild.config.mjs",
|
|
30
|
+
"npm:publish": "npm publish"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.27.3",
|
|
34
|
+
"esbuild-plugin-copy": "^2.1.1"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/dist/advanced.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Globo State v2.0.0 - Advanced Engine
|
|
3
|
-
* For the 1% who need the Formula 1 performance.
|
|
4
|
-
*/
|
|
5
|
-
export { createAsyncStore } from "./engines/async";
|
|
6
|
-
export { StorageAdapters } from "./core/store";
|
|
7
|
-
export type { AsyncState, Middleware, IPlugin, PluginContext } from "./core/types";
|
|
8
|
-
//# sourceMappingURL=advanced.d.ts.map
|
package/dist/advanced.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../advanced.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/advanced.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createAsyncStore as r}from"./engines/async";import{StorageAdapters as p}from"./core/store";export{p as StorageAdapters,r as createAsyncStore};
|
package/dist/core/store.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IStore, StoreConfig, CustomStorage } from './types';
|
|
2
|
-
export declare const StorageAdapters: {
|
|
3
|
-
local: () => CustomStorage | null;
|
|
4
|
-
session: () => CustomStorage | null;
|
|
5
|
-
memory: () => CustomStorage;
|
|
6
|
-
};
|
|
7
|
-
export declare const createStore: <S extends Record<string, any> = Record<string, any>>(config?: StoreConfig<S>) => IStore<S>;
|
|
8
|
-
//# sourceMappingURL=store.d.ts.map
|
package/dist/core/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../core/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EAAE,WAAW,EAEQ,aAAa,EACzC,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,eAAe;iBACf,aAAa,GAAG,IAAI;mBAClB,aAAa,GAAG,IAAI;kBACrB,aAAa;CAU1B,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAgPlH,CAAA"}
|
package/dist/core/types.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
export interface PersistOptions {
|
|
2
|
-
persist?: boolean;
|
|
3
|
-
secure?: boolean;
|
|
4
|
-
ttl?: number;
|
|
5
|
-
}
|
|
6
|
-
export interface StoreMetadata {
|
|
7
|
-
version: number;
|
|
8
|
-
lastUpdated: number;
|
|
9
|
-
}
|
|
10
|
-
export type StoreSubscriber = () => void;
|
|
11
|
-
export type Middleware = (key: string, value: any, meta: StoreMetadata) => void;
|
|
12
|
-
export type StateUpdater<T> = (draft: T) => void | T;
|
|
13
|
-
export type ComputedSelector<T> = (get: <V>(key: string) => V | null) => T;
|
|
14
|
-
export type WatcherCallback<T> = (value: T | null) => void;
|
|
15
|
-
export type PluginHookName = 'onInit' | 'onSet' | 'onGet' | 'onRemove' | 'onDestroy' | 'onTransaction';
|
|
16
|
-
export interface PluginContext<S extends Record<string, any> = any> {
|
|
17
|
-
store: IStore<S>;
|
|
18
|
-
key: string;
|
|
19
|
-
value: any;
|
|
20
|
-
version: number;
|
|
21
|
-
}
|
|
22
|
-
export interface IPlugin {
|
|
23
|
-
name: string;
|
|
24
|
-
hooks: {
|
|
25
|
-
[K in PluginHookName]?: (context: PluginContext) => void | Promise<void>;
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
export interface IStore<S extends Record<string, any> = Record<string, any>> {
|
|
29
|
-
set<K extends keyof S>(key: K, valOrUp: S[K] | StateUpdater<S[K]>, options?: PersistOptions): boolean;
|
|
30
|
-
set<T = any>(key: string, valOrUp: T | StateUpdater<T>, options?: PersistOptions): boolean;
|
|
31
|
-
get<K extends keyof S>(key: K): S[K] | null;
|
|
32
|
-
get<T = any>(key: string): T | null;
|
|
33
|
-
compute<T = any>(key: string, selector: ComputedSelector<T>): T;
|
|
34
|
-
watch<K extends keyof S>(key: K, callback: WatcherCallback<S[K]>): () => void;
|
|
35
|
-
watch<T = any>(key: string, callback: WatcherCallback<T>): () => void;
|
|
36
|
-
remove(key: keyof S | string): boolean;
|
|
37
|
-
delete(key: keyof S | string): boolean;
|
|
38
|
-
deleteAll(): boolean;
|
|
39
|
-
list(): Record<string, any>;
|
|
40
|
-
use(m: Middleware): void;
|
|
41
|
-
transaction(fn: () => void): void;
|
|
42
|
-
destroy(): void;
|
|
43
|
-
_addPlugin(plugin: IPlugin): void;
|
|
44
|
-
_removePlugin(name: string): void;
|
|
45
|
-
_subscribe(cb: StoreSubscriber): () => void;
|
|
46
|
-
_getVersion(key: string): number;
|
|
47
|
-
}
|
|
48
|
-
export interface StoreConfig<S = any> {
|
|
49
|
-
namespace?: string;
|
|
50
|
-
version?: number;
|
|
51
|
-
silent?: boolean;
|
|
52
|
-
debounceTime?: number;
|
|
53
|
-
storage?: CustomStorage | Storage;
|
|
54
|
-
migrate?: (oldState: any, oldVersion: number) => S;
|
|
55
|
-
}
|
|
56
|
-
export interface CustomStorage {
|
|
57
|
-
getItem(key: string): string | null;
|
|
58
|
-
setItem(key: string, value: string): void;
|
|
59
|
-
removeItem(key: string): void;
|
|
60
|
-
key(index: number): string | null;
|
|
61
|
-
length: number;
|
|
62
|
-
}
|
|
63
|
-
export interface AsyncState<T> {
|
|
64
|
-
data: T | null;
|
|
65
|
-
loading: boolean;
|
|
66
|
-
error: Error | null;
|
|
67
|
-
lastFetched: number | null;
|
|
68
|
-
}
|
|
69
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/core/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../core/types.ts"],"names":[],"mappings":"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"}
|
package/dist/engines/async.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { IStore, AsyncState } from "../core/types";
|
|
2
|
-
/**
|
|
3
|
-
* Async Store Factory: Manages the data/loading/error cycle and provides a fetch trigger.
|
|
4
|
-
*/
|
|
5
|
-
export declare const createAsyncStore: <T>(fetcher: () => Promise<T>, options?: {
|
|
6
|
-
key?: string;
|
|
7
|
-
persist?: boolean;
|
|
8
|
-
}) => IStore<AsyncState<T>> & {
|
|
9
|
-
fetch: () => Promise<void>;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=async.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../engines/async.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEvD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,EAChC,SAAS,MAAM,OAAO,CAAC,CAAC,CAAC,EACzB,UAAU;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,KAC5C,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAyBtD,CAAA"}
|
package/dist/global.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { IStore, StoreConfig, PersistOptions, StateUpdater, ComputedSelector, WatcherCallback } from './index'
|
|
2
|
-
|
|
3
|
-
declare global {
|
|
4
|
-
/** Create a new isolated store instance */
|
|
5
|
-
var createStore: <S extends Record<string, any> = Record<string, any>>(config?: StoreConfig<S>) => IStore<S>
|
|
6
|
-
|
|
7
|
-
/** Initialize the default global gState instance */
|
|
8
|
-
var initState: <S extends Record<string, any> = Record<string, any>>(config?: StoreConfig<S>) => IStore<S>
|
|
9
|
-
|
|
10
|
-
/** MAGNATAR WRAPPER: Create a typed store and its reactive hook in one line. */
|
|
11
|
-
var gstate: <S extends Record<string, any>>(initial: S, namespace?: string) => {
|
|
12
|
-
<K extends keyof S>(key: K): readonly [S[K], (val: S[K] | StateUpdater<S[K]>, options?: PersistOptions) => boolean]
|
|
13
|
-
store: IStore<S>
|
|
14
|
-
set: IStore<S>['set']
|
|
15
|
-
get: IStore<S>['get']
|
|
16
|
-
compute: IStore<S>['compute']
|
|
17
|
-
watch: IStore<S>['watch']
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** Legacy alias for initState */
|
|
21
|
-
var globoState: <S extends Record<string, any> = Record<string, any>>(config?: StoreConfig<S>) => IStore<S>
|
|
22
|
-
|
|
23
|
-
/** Completely dispose of the global gState */
|
|
24
|
-
var destroyState: () => void
|
|
25
|
-
|
|
26
|
-
/** The Default Global HyperStore instance */
|
|
27
|
-
var gState: IStore<any>
|
|
28
|
-
|
|
29
|
-
/** Reactive Hook for state management */
|
|
30
|
-
var useGState: <T = any, S extends Record<string, any> = any>(
|
|
31
|
-
key: Extract<keyof S, string> | string,
|
|
32
|
-
store?: IStore<S>
|
|
33
|
-
) => readonly [T, (val: T | StateUpdater<T>, options?: PersistOptions) => boolean]
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { }
|
package/dist/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* React Globo State v2.0.0 "The Magnatar"
|
|
3
|
-
* Product Edition: Simple by default, Power on demand.
|
|
4
|
-
*/
|
|
5
|
-
export { createStore } from "./core/store";
|
|
6
|
-
export { useGState, initState, destroyState } from "./react/hooks";
|
|
7
|
-
export { gstate } from "./react/magnatar";
|
|
8
|
-
export * from "./plugins/index";
|
|
9
|
-
export type { IStore, StoreConfig, PersistOptions, StateUpdater } from "./core/types";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGzC,cAAc,iBAAiB,CAAA;AAG/B,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/jest.setup.d.ts
DELETED
package/dist/jest.setup.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../jest.setup.ts"],"names":[],"mappings":""}
|
package/dist/plugins/index.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export * from "./official/immer.plugin";
|
|
2
|
-
export * from "./official/undo-redo.plugin";
|
|
3
|
-
export * from "./official/persistence.plugin";
|
|
4
|
-
export * from "./official/sync.plugin";
|
|
5
|
-
export * from "./official/schema.plugin";
|
|
6
|
-
export * from "./official/devtools.plugin";
|
|
7
|
-
export * from "./official/ttl.plugin";
|
|
8
|
-
export * from "./official/analytics.plugin";
|
|
9
|
-
export * from "./official/snapshot.plugin";
|
|
10
|
-
export * from "./official/guard.plugin";
|
|
11
|
-
import type { IPlugin } from "../core/types";
|
|
12
|
-
/**
|
|
13
|
-
* Official Logger Plugin: Professional change tracking.
|
|
14
|
-
*/
|
|
15
|
-
export declare const LoggerPlugin: (options?: {
|
|
16
|
-
collapsed?: boolean;
|
|
17
|
-
}) => IPlugin;
|
|
18
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../plugins/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AAEvC,OAAO,KAAK,EAAiB,OAAO,EAAE,MAAM,eAAe,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,UAAU;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,OAkB/D,CAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Analytics Plugin: Tracks state changes and sends them to a provider.
|
|
4
|
-
*/
|
|
5
|
-
export declare const AnalyticsPlugin: (options: {
|
|
6
|
-
provider: (event: {
|
|
7
|
-
key: string;
|
|
8
|
-
value: any;
|
|
9
|
-
action: string;
|
|
10
|
-
}) => void;
|
|
11
|
-
keys?: string[];
|
|
12
|
-
}) => IPlugin;
|
|
13
|
-
//# sourceMappingURL=analytics.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/analytics.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,SAAS;IACvC,QAAQ,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACvE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;CAChB,KAAG,OAcF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"devtools.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/devtools.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAkB5D,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Guard Plugin: Intercepts values before they hit the store.
|
|
4
|
-
* Useful for transforming data (e.g. trimming strings) or blocking invalid updates silently.
|
|
5
|
-
*/
|
|
6
|
-
export declare const GuardPlugin: (guards: Record<string, (val: any) => any>) => IPlugin;
|
|
7
|
-
//# sourceMappingURL=guard.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"guard.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/guard.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC,KAAG,OAgBtE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"immer.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/immer.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAO,OAW7B,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Persistence Plugin: Advanced storage management.
|
|
4
|
-
* Supports custom serialization and conditional saving.
|
|
5
|
-
*/
|
|
6
|
-
export declare const PersistencePlugin: (options: {
|
|
7
|
-
storage: Storage | "localStorage" | "sessionStorage";
|
|
8
|
-
keyPrefix?: string;
|
|
9
|
-
serialize?: (val: any) => string;
|
|
10
|
-
deserialize?: (val: string) => any;
|
|
11
|
-
}) => IPlugin;
|
|
12
|
-
//# sourceMappingURL=persistence.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/persistence.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS;IACzC,OAAO,EAAE,OAAO,GAAG,cAAc,GAAG,gBAAgB,CAAC;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC;IACjC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,GAAG,CAAA;CACnC,KAAG,OA6BF,CAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Schema Plugin: Validates state changes against a validator function.
|
|
4
|
-
*/
|
|
5
|
-
export declare const SchemaPlugin: (schemas: Record<string, (val: any) => boolean | string>) => IPlugin;
|
|
6
|
-
//# sourceMappingURL=schema.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/schema.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,MAAM,CAAC,KAAG,OAarF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/snapshot.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,cAAc,QAAO,OAsBjC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/sync.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAwB/D,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ttl.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/ttl.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAG,OAYvD,CAAA"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { IPlugin } from '../../core/types';
|
|
2
|
-
/**
|
|
3
|
-
* Undo/Redo Plugin: Multi-level history management for the store.
|
|
4
|
-
* Snapshots the entire store state for simple, robust rollbacks.
|
|
5
|
-
*/
|
|
6
|
-
export declare const undoRedoPlugin: (options?: {
|
|
7
|
-
limit?: number;
|
|
8
|
-
}) => IPlugin;
|
|
9
|
-
//# sourceMappingURL=undo-redo.plugin.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"undo-redo.plugin.d.ts","sourceRoot":"","sources":["../../../plugins/official/undo-redo.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,UAAU;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,KAAG,OAgE7D,CAAA"}
|
package/dist/react/hooks.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { IStore, StoreConfig, PersistOptions, StateUpdater } from "../core/types";
|
|
2
|
-
/**
|
|
3
|
-
* Initialize a global store instance.
|
|
4
|
-
* @param config Store configuration
|
|
5
|
-
* @param options Initialization options (e.g. injectGlobal: true)
|
|
6
|
-
*/
|
|
7
|
-
export declare const initState: <S extends Record<string, any>>(config?: StoreConfig<S>, options?: {
|
|
8
|
-
injectGlobal?: boolean;
|
|
9
|
-
}) => IStore<S>;
|
|
10
|
-
/**
|
|
11
|
-
* Cleanup the global state.
|
|
12
|
-
*/
|
|
13
|
-
export declare const destroyState: () => void;
|
|
14
|
-
/**
|
|
15
|
-
* Reactive Hook for state management.
|
|
16
|
-
*/
|
|
17
|
-
export declare const useGState: <T = any, S extends Record<string, any> = any>(key: Extract<keyof S, string> | string, store?: IStore<S>) => readonly [T, (val: T | StateUpdater<T>, options?: PersistOptions) => boolean];
|
|
18
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../react/hooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAItF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACrD,SAAS,WAAW,CAAC,CAAC,CAAC,EACvB,UAAU;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,KACnC,MAAM,CAAC,CAAC,CAOV,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,YAMxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EACpE,KAAK,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG,MAAM,EACtC,QAAQ,MAAM,CAAC,CAAC,CAAC,wBAoBI,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,YAAY,cAAc,aAKnE,CAAA"}
|
package/dist/react/magnatar.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { IStore, StateUpdater, PersistOptions } from "../core/types";
|
|
2
|
-
/**
|
|
3
|
-
* MAGNATAR WRAPPER: The peak of simplicity.
|
|
4
|
-
* One function to create a typed store and its reactive hook simultaneously.
|
|
5
|
-
*/
|
|
6
|
-
export declare function gstate<S extends Record<string, any>>(initial: S, namespace?: string): (<K extends keyof S>(key: K) => readonly [S[K], (val: S[K] | StateUpdater<S[K]>, options?: PersistOptions) => boolean]) & {
|
|
7
|
-
store: IStore<S>;
|
|
8
|
-
set: {
|
|
9
|
-
<K extends keyof S>(key: K, valOrUp: S[K] | StateUpdater<S[K]>, options?: PersistOptions): boolean;
|
|
10
|
-
<T = any>(key: string, valOrUp: T | StateUpdater<T>, options?: PersistOptions): boolean;
|
|
11
|
-
};
|
|
12
|
-
get: {
|
|
13
|
-
<K extends keyof S>(key: K): S[K] | null;
|
|
14
|
-
<T = any>(key: string): T | null;
|
|
15
|
-
};
|
|
16
|
-
compute: <T = any>(key: string, selector: import("../core/types").ComputedSelector<T>) => T;
|
|
17
|
-
watch: {
|
|
18
|
-
<K extends keyof S>(key: K, callback: import("../core/types").WatcherCallback<S[K]>): () => void;
|
|
19
|
-
<T = any>(key: string, callback: import("../core/types").WatcherCallback<T>): () => void;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=magnatar.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"magnatar.d.ts","sourceRoot":"","sources":["../../react/magnatar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEzE;;;GAGG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,KAMpE,CAAC,SAAS,MAAM,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;EASxC"}
|