@biglogic/rgs 2.7.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/{dist/README.md → README.md} +16 -49
  2. package/{dist/markdown → markdown}/chapters/02-getting-started.md +3 -3
  3. package/{dist/markdown → markdown}/chapters/03-the-magnetar-way.md +1 -1
  4. package/{dist/markdown → markdown}/chapters/04-persistence-and-safety.md +1 -1
  5. package/{dist/markdown → markdown}/chapters/05-plugin-sdk.md +4 -4
  6. package/{dist/markdown → markdown}/chapters/05-plugins-and-extensibility.md +8 -8
  7. package/{dist/markdown → markdown}/chapters/08-migration-guide.md +3 -3
  8. package/package.json +16 -21
  9. package/dist/CODEOWNERS +0 -1
  10. package/dist/CONTRIBUTING.md +0 -65
  11. package/dist/package.json +0 -81
  12. /package/{dist/COPYRIGHT.md → COPYRIGHT.md} +0 -0
  13. /package/{dist/LICENSE → LICENSE} +0 -0
  14. /package/{dist/SECURITY.md → SECURITY.md} +0 -0
  15. /package/{dist/advanced.d.ts → advanced.d.ts} +0 -0
  16. /package/{dist/advanced.js → advanced.js} +0 -0
  17. /package/{dist/core → core}/advanced.d.ts +0 -0
  18. /package/{dist/core → core}/async.d.ts +0 -0
  19. /package/{dist/core → core}/hooks.d.ts +0 -0
  20. /package/{dist/core → core}/security.d.ts +0 -0
  21. /package/{dist/core → core}/store.d.ts +0 -0
  22. /package/{dist/core → core}/types.d.ts +0 -0
  23. /package/{dist/index.d.ts → index.d.ts} +0 -0
  24. /package/{dist/index.js → index.js} +0 -0
  25. /package/{dist/markdown → markdown}/SUMMARY.md +0 -0
  26. /package/{dist/markdown → markdown}/api.md +0 -0
  27. /package/{dist/markdown → markdown}/chapters/01-philosophy.md +0 -0
  28. /package/{dist/markdown → markdown}/chapters/06-case-studies.md +0 -0
  29. /package/{dist/markdown → markdown}/chapters/07-faq.md +0 -0
  30. /package/{dist/plugins → plugins}/index.d.ts +0 -0
  31. /package/{dist/plugins → plugins}/official/analytics.plugin.d.ts +0 -0
  32. /package/{dist/plugins → plugins}/official/debug.plugin.d.ts +0 -0
  33. /package/{dist/plugins → plugins}/official/devtools.plugin.d.ts +0 -0
  34. /package/{dist/plugins → plugins}/official/guard.plugin.d.ts +0 -0
  35. /package/{dist/plugins → plugins}/official/immer.plugin.d.ts +0 -0
  36. /package/{dist/plugins → plugins}/official/schema.plugin.d.ts +0 -0
  37. /package/{dist/plugins → plugins}/official/snapshot.plugin.d.ts +0 -0
  38. /package/{dist/plugins → plugins}/official/sync.plugin.d.ts +0 -0
  39. /package/{dist/plugins → plugins}/official/undo-redo.plugin.d.ts +0 -0
@@ -24,25 +24,25 @@ We took the simplicity of **React Globo State (RGS)** and fused it with the arch
24
24
 
25
25
  | Feature | useState | gState |
26
26
  |---------|----------|--------|
27
- | **State globale tra componenti** | ❌ Servono Context/props | ✅ Condivisione automatica |
28
- | **Provider wrapper** | ❌ Necessario | ✅ Non serve |
29
- | **Persistenza (localStorage)** | ❌ Manuale | ✅ Built-in |
30
- | **Crittografia dati** | ❌ | ✅ AES-256-GCM |
31
- | **Namespace/stores multipli** | ❌ | ✅ |
32
- | **Plugin (Immer, Undo/Redo)** | ❌ | ✅ |
27
+ | **Global state across components** | ❌ Need Context/props | ✅ Automatic sharing |
28
+ | **Provider wrapper** | ❌ Required | ✅ Not needed |
29
+ | **Persistence (localStorage)** | ❌ Manual | ✅ Built-in |
30
+ | **Data encryption** | ❌ | ✅ AES-256-GCM |
31
+ | **Multiple namespaces/stores** | ❌ | ✅ |
32
+ | **Plugins (Immer, Undo/Redo)** | ❌ | ✅ |
33
33
  | **Audit logging** | ❌ | ✅ |
34
34
  | **RBAC/GDPR consent** | ❌ | ✅ |
35
- | **SSR/Hydration** | ❌ Manuale | ✅ Automatico |
35
+ | **SSR/Hydration** | ❌ Manual | ✅ Automatic |
36
36
  | **Computed values** | ❌ | ✅ |
37
37
 
38
- ### Quando usare cosa?
38
+ ### When to use what?
39
39
 
40
- - **useState**: UI locale, un componente, state temporaneo
40
+ - **useState**: Local UI, single component, temporary state
41
41
  - **gState**:
42
- - State condiviso tra più componenti
43
- - Dati persistenti (preferenze, carrello, autenticazione)
44
- - Dati sensibili (crittografia)
45
- - Feature advanced (undo/redo, snapshots)
42
+ - Shared state across multiple components
43
+ - Persistent data (preferences, cart, authentication)
44
+ - Sensitive data (encryption)
45
+ - Advanced features (undo/redo, snapshots)
46
46
  - Enterprise (audit, RBAC, GDPR)
47
47
 
48
48
  ---
@@ -72,39 +72,6 @@ graph TB
72
72
  G --> O[Schema]
73
73
  G --> P[Analytics]
74
74
  ```
75
- ┌─────────────────────────────────────────────────────────────────┐
76
- │ React Globo State │
77
- │ "The Magnetar" │
78
- └─────────────────────────────────────────────────────────────────┘
79
-
80
- ┌─────────────────────┼─────────────────────┐
81
- ▼ ▼ ▼
82
- ┌───────────────┐ ┌───────────────┐ ┌───────────────┐
83
- │ gstate() │ │ useStore() │ │ createStore() │
84
- │ (One-liner) │ │ (Hook) │ │ (Classic) │
85
- └───────┬───────┘ └───────┬───────┘ └───────┬───────┘
86
- │ │ │
87
- └────────────────────┼────────────────────┘
88
-
89
- ┌────────────────┐
90
- │ IStore │
91
- │ (Core API) │
92
- └────────┬───────┘
93
-
94
- ┌──────────┬───────────┼───────────┬──────────┐
95
- ▼ ▼ ▼ ▼ ▼
96
- ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌────────┐ ┌─────────┐
97
- │ Storage │ │Immer │ │ Plugins │ │Security│ │ Async │
98
- │Adapter │ │Proxy │ │ System │ │ Layer │ │ Store │
99
- └────┬────┘ └────┬────┘ └────┬─────┘ └───┬────┘ └───┬────┘
100
- │ │ │ │ │
101
- ▼ ▼ ▼ ▼ ▼
102
- local ┌─────────┐ ┌──────┐ ┌─────────┐ ┌──────┐
103
- session │Frozen │ │Add │ │AES-256 │ │Fetch │
104
- memory │State │ │Hooks │ │Encryption│ │+Loading│
105
- └─────────┘ └──────┘ └─────────┘ │Error │
106
- └──────┘
107
- ```
108
75
 
109
76
  ### Core Components
110
77
 
@@ -132,7 +99,7 @@ graph TB
132
99
  Best for modern applications. Clean imports, zero global pollution.
133
100
 
134
101
  ```tsx
135
- import { gstate } from 'argis'
102
+ import { gstate } from '@biglogic/rgs'
136
103
 
137
104
  // Create store and hook in one line
138
105
  const useCounter = gstate({ count: 0 })
@@ -147,7 +114,7 @@ Best for shared state across the entire application.
147
114
 
148
115
  ```tsx
149
116
  // 1. Initialize once
150
- import { initState } from 'argis'
117
+ import { initState } from '@biglogic/rgs'
151
118
  initState({ namespace: 'app' })
152
119
 
153
120
  // 2. Use anywhere
@@ -237,7 +204,7 @@ Extend the core functionality dynamically with specialized modules.
237
204
  10. **GuardPlugin**: Data transformation layer.
238
205
 
239
206
  ```typescript
240
- import { createStore, PersistencePlugin, undoRedoPlugin } from 'argis'
207
+ import { createStore, PersistencePlugin, undoRedoPlugin } from '@biglogic/rgs'
241
208
 
242
209
  const store = createStore()
243
210
  store._addPlugin(PersistencePlugin({ storage: 'localStorage' }))
@@ -15,7 +15,7 @@ npm install rgs
15
15
  In your main entry file (e.g., `main.tsx` or `App.tsx`), wake up the engine once.
16
16
 
17
17
  ```typescript
18
- import { initState } from 'argis';
18
+ import { initState } from '@biglogic/rgs';
19
19
 
20
20
  // Initialize with optional settings
21
21
  initState({
@@ -29,7 +29,7 @@ initState({
29
29
  Use the `useStore` hook. No providers, no wrappers. Just raw, atomic power.
30
30
 
31
31
  ```tsx
32
- import { useStore } from 'argis';
32
+ import { useStore } from '@biglogic/rgs';
33
33
 
34
34
  function Counter() {
35
35
  // If 'count' doesn't exist yet, it defaults to undefined. Easy.
@@ -57,7 +57,7 @@ function Counter() {
57
57
  Need to access state outside of React components? Simple.
58
58
 
59
59
  ```typescript
60
- import { getStore } from 'argis';
60
+ import { getStore } from '@biglogic/rgs';
61
61
 
62
62
  const value = getStore()?.get('count');
63
63
  getStore()?.set('count', 9001);
@@ -9,7 +9,7 @@ It's a single function that creates the store and the hook simultaneously. **Zer
9
9
  Let's create a User Profile module.
10
10
 
11
11
  ```typescript
12
- import { gstate } from 'argis';
12
+ import { gstate } from '@biglogic/rgs';
13
13
 
14
14
  // 1. Define the state and create everything in ONE shot
15
15
  export const useUser = gstate({
@@ -58,7 +58,7 @@ store.set('user', (draft) => {
58
58
  Never trust data coming back from the server or saved in the browser 6 months ago. Use the **schemaPlugin**.
59
59
 
60
60
  ```typescript
61
- import { schemaPlugin } from 'argis';
61
+ import { schemaPlugin } from '@biglogic/rgs';
62
62
  import { z } from 'zod'; // Recommended!
63
63
 
64
64
  const store = initState();
@@ -19,7 +19,7 @@ A plugin is a module that:
19
19
  Every plugin implements the `IPlugin` interface:
20
20
 
21
21
  ```typescript
22
- import type { IPlugin, PluginContext } from 'argis'
22
+ import type { IPlugin, PluginContext } from '@biglogic/rgs'
23
23
 
24
24
  interface IPlugin {
25
25
  name: string
@@ -44,7 +44,7 @@ interface IPlugin {
44
44
  ### Example: A Simple Logger Plugin
45
45
 
46
46
  ```typescript
47
- import type { IPlugin, PluginContext } from 'argis'
47
+ import type { IPlugin, PluginContext } from '@biglogic/rgs'
48
48
 
49
49
  export const loggerPlugin = (): IPlugin => {
50
50
  return {
@@ -74,7 +74,7 @@ store._addPlugin(loggerPlugin())
74
74
  Plugins can expose methods accessible via `store.plugins.pluginName.methodName()`:
75
75
 
76
76
  ```typescript
77
- import type { IPlugin, PluginContext } from 'argis'
77
+ import type { IPlugin, PluginContext } from '@biglogic/rgs'
78
78
 
79
79
  export const counterPlugin = (): IPlugin => {
80
80
  let _count = 0
@@ -205,7 +205,7 @@ export const auditPlugin = (): IPlugin => {
205
205
  Here's a complete plugin that auto-saves to a custom backend:
206
206
 
207
207
  ```typescript
208
- import type { IPlugin, PluginContext } from 'argis'
208
+ import type { IPlugin, PluginContext } from '@biglogic/rgs'
209
209
 
210
210
  interface AutoSaveConfig {
211
211
  endpoint: string
@@ -23,7 +23,7 @@ RGS includes 8 official plugins:
23
23
  Import the official plugin and you'll see every state change, transaction, and execution time in the console or dev tools (Redux DevTools support included!).
24
24
 
25
25
  ```typescript
26
- import { devToolsPlugin } from 'argis';
26
+ import { devToolsPlugin } from '@biglogic/rgs';
27
27
 
28
28
  store._addPlugin(devToolsPlugin({ name: 'My Store' }));
29
29
  ```
@@ -35,7 +35,7 @@ store._addPlugin(devToolsPlugin({ name: 'My Store' }));
35
35
  Access your store directly from the browser console:
36
36
 
37
37
  ```typescript
38
- import { debugPlugin } from 'argis';
38
+ import { debugPlugin } from '@biglogic/rgs';
39
39
 
40
40
  // Always wrap in dev check
41
41
  if (process.env.NODE_ENV === 'development') {
@@ -76,7 +76,7 @@ store.set('session_token', tokenValue, {
76
76
  ## 🎲 4. Undo/Redo: History Management
77
77
 
78
78
  ```typescript
79
- import { undoRedoPlugin } from 'argis';
79
+ import { undoRedoPlugin } from '@biglogic/rgs';
80
80
 
81
81
  store._addPlugin(undoRedoPlugin({ limit: 50 }));
82
82
 
@@ -90,7 +90,7 @@ store.canRedo(); // boolean
90
90
  ## 📸 5. Snapshots: Save & Restore State
91
91
 
92
92
  ```typescript
93
- import { snapshotPlugin } from 'argis';
93
+ import { snapshotPlugin } from '@biglogic/rgs';
94
94
 
95
95
  store._addPlugin(snapshotPlugin());
96
96
 
@@ -113,7 +113,7 @@ store.clearSnapshots();
113
113
  Transform values before they hit the store:
114
114
 
115
115
  ```typescript
116
- import { guardPlugin } from 'argis';
116
+ import { guardPlugin } from '@biglogic/rgs';
117
117
 
118
118
  store._addPlugin(guardPlugin({
119
119
  'user_input': (val) => val.trim().toLowerCase()
@@ -125,7 +125,7 @@ store._addPlugin(guardPlugin({
125
125
  Validate values before setting:
126
126
 
127
127
  ```typescript
128
- import { schemaPlugin } from 'argis';
128
+ import { schemaPlugin } from '@biglogic/rgs';
129
129
 
130
130
  store._addPlugin(schemaPlugin({
131
131
  'email': (val) => {
@@ -138,7 +138,7 @@ store._addPlugin(schemaPlugin({
138
138
  ## 📊 8. Analytics: Track Changes
139
139
 
140
140
  ```typescript
141
- import { analyticsPlugin } from 'argis';
141
+ import { analyticsPlugin } from '@biglogic/rgs';
142
142
 
143
143
  store._addPlugin(analyticsPlugin({
144
144
  provider: (event) => {
@@ -152,7 +152,7 @@ store._addPlugin(analyticsPlugin({
152
152
  ## 🔄 9. Immer Integration
153
153
 
154
154
  ```typescript
155
- import { immerPlugin } from 'argis';
155
+ import { immerPlugin } from '@biglogic/rgs';
156
156
 
157
157
  store._addPlugin(immerPlugin());
158
158
 
@@ -58,7 +58,7 @@ const decoded = JSON.parse(atob(encoded)) // { secret: 'password123' }
58
58
  #### Example: Custom Error Logging
59
59
 
60
60
  ```typescript
61
- import { initState } from 'argis'
61
+ import { initState } from '@biglogic/rgs'
62
62
 
63
63
  const store = initState({
64
64
  namespace: 'myapp',
@@ -98,7 +98,7 @@ interface ErrorContext {
98
98
  #### Example: Custom Size Limit
99
99
 
100
100
  ```typescript
101
- import { createStore } from 'argis'
101
+ import { createStore } from '@biglogic/rgs'
102
102
 
103
103
  const store = createStore({
104
104
  maxObjectSize: 10 * 1024 * 1024, // 10MB limit
@@ -134,7 +134,7 @@ In previous versions, security rules were shared globally. Now, each store insta
134
134
  #### ❌ Deprecated Global Methods
135
135
 
136
136
  ```typescript
137
- import { addAccessRule, recordConsent } from 'argis'
137
+ import { addAccessRule, recordConsent } from '@biglogic/rgs'
138
138
 
139
139
  // ⚠️ DEPRECATED: These affect the 'default' store only and are less isolated
140
140
  addAccessRule('user_*', ['read', 'write'])
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@biglogic/rgs",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "Argis (RGS) - React Globo State: A react state everywhere made easy",
5
+ "deprecated": false,
6
+ "preferGlobal": true,
7
+ "type": "module",
5
8
  "keywords": [
6
9
  "rgs",
7
10
  "gstate",
@@ -18,31 +21,23 @@
18
21
  ],
19
22
  "license": "MIT",
20
23
  "author": "Dario Passariello",
21
- "type": "module",
22
- "exports": {
23
- ".": {
24
- "types": "./dist/index.d.ts",
25
- "default": "./dist/index.js"
26
- },
27
- "./advanced": {
28
- "types": "./dist/advanced.d.ts",
29
- "default": "./dist/advanced.js"
24
+ "contributors": [
25
+ {
26
+ "name": "Dario Passariello",
27
+ "email": "dariopassariello@gmail.com",
28
+ "url": "https://dario.passariello.ca/"
30
29
  },
31
- "./package.json": "./package.json"
32
- },
30
+ {
31
+ "name": "Valeria Cala Scaglitta",
32
+ "email": "valeriacalascaglitta@gmail.com"
33
+ }
34
+ ],
33
35
  "main": "./dist/index.js",
34
36
  "types": "./dist/index.d.ts",
35
- "files": [
36
- "dist"
37
- ],
38
37
  "scripts": {
39
38
  "build": "tsc --emitDeclarationOnly --outDir dist && node ./esbuild.config.mjs",
40
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./tests/jest/jest.config.ts",
41
- "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./tests/jest/jest.config.ts --watch",
42
- "test:e2e": "playwright test --config ./tests/playwright/playwright.config.ts",
43
- "type-check": "tsc --noEmit",
44
- "npm:publish": "npm run build && npm publish --access=public",
45
- "lint": "eslint . --ext .ts,.tsx --config tests/eslint/eslint.config.mjs"
39
+ "npm: pack": "npm run build && cd dist && npm pack",
40
+ "npm: publish": "npm run build && cd dist && npm publish --access=public"
46
41
  },
47
42
  "dependencies": {
48
43
  "immer": "^11.1.4"
package/dist/CODEOWNERS DELETED
@@ -1 +0,0 @@
1
- * @passariello
@@ -1,65 +0,0 @@
1
- # Contributing to RGS (Argis) - React Globo State
2
-
3
- Thank you for your interest in contributing!
4
-
5
- ## Development Setup
6
-
7
- ```bash
8
- # Clone the repository
9
- git clone https://github.com/dpassariello/rgs.git
10
- cd rgs
11
-
12
- # Install dependencies
13
- npm install
14
-
15
- # Run tests
16
- npm test
17
-
18
- # Run linter
19
- npm run lint
20
-
21
- # Build
22
- npm run build
23
- ```
24
-
25
- ## Code Style
26
-
27
- - Use TypeScript with strict mode
28
- - Follow ESLint rules
29
- - Add JSDoc comments for public APIs
30
- - Write tests for new features
31
-
32
- ## Testing
33
-
34
- ```bash
35
- # Run all tests
36
- npm test
37
-
38
- # Run tests in watch mode
39
- npm run test:watch
40
-
41
- # Run e2e tests
42
- npm run test:e2e
43
- ```
44
-
45
- ## Pull Request Process
46
-
47
- 1. Fork the repository
48
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
49
- 3. Make your changes
50
- 4. Ensure tests pass: `npm test`
51
- 5. Ensure linting passes: `npm run lint`
52
- 6. Commit your changes
53
- 7. Push to your fork
54
- 8. Open a Pull Request
55
-
56
- ## Release Process
57
-
58
- 1. Update version in `package.json`
59
- 2. Update CHANGELOG.md
60
- 3. Create a release on GitHub
61
- 4. NPM publish happens automatically via CI/CD
62
-
63
- ## License
64
-
65
- By contributing, you agree that your contributions will be licensed under the MIT License.
package/dist/package.json DELETED
@@ -1,81 +0,0 @@
1
- {
2
- "name": "@biglogic/rgs",
3
- "version": "2.7.0",
4
- "description": "Argis (RGS) - React Globo State: A react state everywhere made easy",
5
- "keywords": [
6
- "rgs",
7
- "gstate",
8
- "state-management",
9
- "react",
10
- "enterprise",
11
- "hooks",
12
- "global-state",
13
- "immer",
14
- "biglogic",
15
- "persistence",
16
- "react-globo-state",
17
- "argis"
18
- ],
19
- "license": "MIT",
20
- "author": "Dario Passariello",
21
- "type": "module",
22
- "exports": {
23
- ".": {
24
- "types": "./dist/index.d.ts",
25
- "default": "./dist/index.js"
26
- },
27
- "./advanced": {
28
- "types": "./dist/advanced.d.ts",
29
- "default": "./dist/advanced.js"
30
- },
31
- "./package.json": "./package.json"
32
- },
33
- "main": "./dist/index.js",
34
- "types": "./dist/index.d.ts",
35
- "files": [
36
- "dist"
37
- ],
38
- "scripts": {
39
- "build": "tsc --emitDeclarationOnly --outDir dist && node ./esbuild.config.mjs",
40
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./tests/jest/jest.config.ts",
41
- "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config ./tests/jest/jest.config.ts --watch",
42
- "test:e2e": "playwright test --config ./tests/playwright/playwright.config.ts",
43
- "type-check": "tsc --noEmit",
44
- "npm:publish": "npm run build && npm publish --access=public",
45
- "lint": "eslint . --ext .ts,.tsx --config tests/eslint/eslint.config.mjs"
46
- },
47
- "dependencies": {
48
- "immer": "^11.1.4"
49
- },
50
- "peerDependencies": {
51
- "react": ">=16.8.0",
52
- "react-dom": ">=16.8.0"
53
- },
54
- "devDependencies": {
55
- "@eslint/js": "10.0.1",
56
- "@playwright/test": "1.58.2",
57
- "@testing-library/dom": "10.4.1",
58
- "@testing-library/jest-dom": "6.9.1",
59
- "@testing-library/react": "16.3.2",
60
- "@types/jest": "30.0.0",
61
- "@types/node": "25.2.3",
62
- "@types/react": "19.2.14",
63
- "@types/react-dom": "19.2.3",
64
- "@typescript-eslint/eslint-plugin": "^8.55.0",
65
- "@typescript-eslint/parser": "^8.55.0",
66
- "dphelper": "2.6.3",
67
- "esbuild": "0.27.3",
68
- "esbuild-plugin-copy": "2.1.1",
69
- "eslint": "^10.0.0",
70
- "eslint-plugin-react": "7.37.5",
71
- "eslint-plugin-react-hooks": "7.0.1",
72
- "jest": "30.2.0",
73
- "jest-environment-jsdom": "30.2.0",
74
- "react": "19.2.4",
75
- "react-dom": "19.2.4",
76
- "ts-jest": "29.4.6",
77
- "tslib": "^2.8.1",
78
- "typescript": "^5.9.3",
79
- "typescript-eslint": "8.55.0"
80
- }
81
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes