react-state-bucket 1.0.4 → 1.0.6

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 CHANGED
@@ -1,181 +1,237 @@
1
- # React State Bucket
1
+ <p align="center">
2
+ <a href="https://mui.com/core/" rel="noopener" target="_blank"><img width="120" src="https://api.mypiebd.com/uploads/2024/11/26/images/5c31a5fc731a89c82fd0e846dd69a99378243.png" alt="Material UI logo"></a>
3
+ </p>
2
4
 
3
- `react-state-bucket` is a lightweight state management library for React. It allows developers to create global states that can be accessed and modified from any component. The state can be stored in memory, session storage, or the URL query parameters, providing flexibility for different use cases.
5
+ <h1 align="center">React State Bucket</h1>
4
6
 
5
- ## Features
6
7
 
7
- - Lightweight and easy-to-use global state management.
8
- - Supports three storage options: memory, session storage, and URL.
9
- - Fully TypeScript-supported API.
10
- - React hook-based implementation for seamless integration.
11
- - Ideal for both small and large-scale React applications.
8
+ `react-state-bucket` is a lightweight and powerful package designed to manage states globally in React applications. It provides CRUD operations for your state data with ease, enabling developers to handle complex state management scenarios without the need for heavy libraries.
12
9
 
13
- ## Installation
10
+ This package supports multiple storage options, including:
14
11
 
15
- Install the package via npm or yarn:
12
+ - Memory (default)
13
+ - Session Storage
14
+ - Local Storage
15
+ - URL Query Parameters
16
+
17
+ ## Installation
16
18
 
17
19
  ```bash
18
20
  npm install react-state-bucket
19
21
  ```
20
22
 
21
- or
23
+ ## Features
22
24
 
23
- ```bash
24
- yarn add react-state-bucket
25
- ```
25
+ - **Global State Management**: Easily manage state across your entire React application.
26
+ - **CRUD Operations**: Create, Read, Update, and Delete state values effortlessly.
27
+ - **Multiple Storage Options**: Choose where to store your data ("memory", "session", "local", or "url").
28
+ - **Reactivity**: Automatically update components when the state changes.
29
+ - **Custom Hooks**: Seamlessly integrate with React’s functional components.
26
30
 
27
31
  ## Usage
28
32
 
29
- ### Importing the Package
30
-
31
- The package is designed for use with React's client-side components. Start by importing the required functionality:
33
+ ### Basic Example
32
34
 
33
- ```javascript
35
+ ```jsx
34
36
  "use client";
35
- import { createBucket } from "react-state-bucket";
36
- ```
37
37
 
38
- ### Creating a State
38
+ import React from "react";
39
+ import createBucket from "react-state-bucket";
39
40
 
40
- Use the `createBucket` function to define a global state. Provide an initial state object and optionally specify the storage type (`"memory"`, `"session"`, or `"url"`).
41
+ // Create a bucket with initial state
42
+ const useGlobalState = createBucket({ count: 0, user: "Guest" });
41
43
 
42
- ```javascript
43
- const useGlobalState = createBucket({
44
- count: 0,
45
- name: "React",
46
- }, {
47
- store: "memory", // Optional: Defaults to "memory"
48
- });
44
+ function App() {
45
+ const globalState = useGlobalState();
46
+
47
+ return (
48
+ <div>
49
+ <h1>Global State Management</h1>
50
+ <p>Count: {globalState.get("count")}</p>
51
+ <button onClick={() => globalState.set("count", globalState.get("count") + 1)}>Increment</button>
52
+ <button onClick={() => globalState.delete("count")}>Reset Count</button>
53
+ <pre>{JSON.stringify(globalState.getState(), null, 2)}</pre>
54
+ </div>
55
+ );
56
+ }
57
+
58
+ export default App;
49
59
  ```
50
60
 
51
- ### Using the State in Components
61
+ ### Using Multiple Buckets
62
+
63
+ ```jsx
64
+ const useUserBucket = createBucket({ name: "", age: 0 });
65
+ const useSettingsBucket = createBucket({ theme: "light", notifications: true });
66
+
67
+ function Profile() {
68
+ const userBucket = useUserBucket();
69
+ const settingsBucket = useSettingsBucket();
70
+
71
+ return (
72
+ <div>
73
+ <h1>User Profile</h1>
74
+ <button onClick={() => userBucket.set("name", "John Doe")}>Set Name</button>
75
+ <button onClick={() => settingsBucket.set("theme", "dark")}>Change Theme</button>
76
+ <pre>User State: {JSON.stringify(userBucket.getState(), null, 2)}</pre>
77
+ <p>Current Theme: {settingsBucket.get("theme")}</p>
78
+ </div>
79
+ );
80
+ }
81
+ ```
82
+
83
+ ### Storage Options Example
52
84
 
53
- Components can access and manipulate the state by calling the `useGlobalState` hook.
85
+ ```jsx
86
+ const usePersistentBucket = createBucket(
87
+ { token: "", language: "en" },
88
+ { store: "local" }
89
+ );
54
90
 
55
- #### Example:
91
+ function PersistentExample() {
92
+ const persistentBucket = usePersistentBucket();
93
+
94
+ return (
95
+ <div>
96
+ <h1>Persistent Bucket</h1>
97
+ <button onClick={() => persistentBucket.set("token", "abc123")}>Set Token</button>
98
+ <p>Token: {persistentBucket.get("token")}</p>
99
+ </div>
100
+ );
101
+ }
102
+ ```
103
+
104
+ ### Reusing State Across Components
105
+
106
+ ```jsx
107
+ "use client";
56
108
 
57
- ```javascript
58
109
  import React from "react";
110
+ import createBucket from "react-state-bucket";
111
+
112
+ // Create a global bucket
113
+ const useGlobalState = createBucket({ count: 0, user: "Guest" });
59
114
 
60
115
  function Counter() {
61
- const state = useGlobalState();
62
-
63
- return (
64
- <div>
65
- <h1>Count: {state.get("count")}</h1>
66
- <button onClick={() => state.set("count", state.get("count") + 1)}>
67
- Increment
68
- </button>
69
- <button onClick={() => state.delete("count")}>Reset</button>
70
- </div>
71
- );
116
+ const globalState = useGlobalState(); // Access bucket functions and trigger re-render on state updates
117
+
118
+ return (
119
+ <div>
120
+ <h2>Counter Component</h2>
121
+ <p>Count: {globalState.get("count")}</p>
122
+ <button onClick={() => globalState.set("count", globalState.get("count") + 1)}>
123
+ Increment Count
124
+ </button>
125
+ </div>
126
+ );
127
+ }
128
+
129
+ function UserDisplay() {
130
+ const globalState = useGlobalState(); // Reuse the same global bucket for reactivity
131
+
132
+ return (
133
+ <div>
134
+ <h2>User Component</h2>
135
+ <p>Current User: {globalState.get("user")}</p>
136
+ <button onClick={() => globalState.set("user", "John Doe")}>
137
+ Set User to John Doe
138
+ </button>
139
+ </div>
140
+ );
72
141
  }
73
142
 
74
143
  function App() {
75
- return (
76
- <div>
77
- <Counter />
78
- </div>
79
- );
144
+
145
+ return (
146
+ <div>
147
+ <h1>Global State Example</h1>
148
+ <Counter />
149
+ <UserDisplay />
150
+ <pre>Global State: {JSON.stringify(useGlobalState().getState(), null, 2)}</pre>
151
+ </div>
152
+ );
80
153
  }
81
154
 
82
155
  export default App;
83
156
  ```
84
157
 
85
- ### State API
86
-
87
- When you call the hook returned by `createBucket`, you gain access to a set of utility methods:
158
+ ## Direct Usage of Functions
88
159
 
89
- | Method | Description |
90
- | ----------------- | ---------------------------------------------------------- |
91
- | `set(key, value)` | Sets the value of a specific key in the state. |
92
- | `get(key)` | Gets the value of a specific key from the state. |
93
- | `delete(key)` | Deletes a specific key from the state. |
94
- | `clear()` | Clears all keys from the state. |
95
- | `getState()` | Retrieves the entire state object. |
96
- | `setState(state)` | Updates the state with a partial object. |
97
- | `isChange(key)` | Checks if a specific key has changed since the last clear. |
98
- | `getChanges()` | Retrieves an object representing all changed keys. |
99
- | `clearChanges()` | Clears the record of changes. |
160
+ The `createBucket` function provides direct access to the state management methods like `get`, `set`, `delete`, and others. For components that require re-rendering when the state changes, call the custom hook returned by `createBucket` within the component.
100
161
 
101
- ### Storage Options
162
+ ### Example
102
163
 
103
- The `createBucket` function supports three storage types:
164
+ ```jsx
165
+ const useGlobalState = createBucket({ count: 0, user: "Guest" });
104
166
 
105
- 1. **Memory (default):** Stores the state in memory for the duration of the session.
106
- 2. **Session:** Persists the state in `sessionStorage` across page reloads.
107
- 3. **URL:** Stores the state in the URL's query parameters, enabling sharable states.
108
-
109
- #### Example with URL Storage:
167
+ function Counter() {
110
168
 
111
- ```javascript
112
- const useURLState = createBucket({
113
- theme: "light",
114
- }, {
115
- store: "url",
116
- });
169
+ return (
170
+ <div>
171
+ <p>Count: {useGlobalState.get("count")}</p>
172
+ <button onClick={() => useGlobalState.set("count", useGlobalState.get("count") + 1)}>Increment</button>
173
+ </div>
174
+ );
175
+ }
117
176
 
118
- function ThemeSwitcher() {
119
- const state = useURLState();
177
+ function App() {
178
+ useGlobalState(); // Will automatically re-render when state updates
120
179
 
121
- return (
122
- <button onClick={() => state.set("theme", state.get("theme") === "light" ? "dark" : "light")}>
123
- Toggle Theme (Current: {state.get("theme")})
124
- </button>
125
- );
180
+ return (
181
+ <div>
182
+ <Counter />
183
+ </div>
184
+ );
126
185
  }
186
+
187
+ export default App;
127
188
  ```
128
189
 
129
- ## Real-World Example
130
190
 
131
- ### Managing a Multi-Step Form
132
191
 
133
- ```javascript
134
- const useFormState = createBucket({
135
- step: 1,
136
- formData: {},
137
- });
192
+ ## API Reference
138
193
 
139
- function MultiStepForm() {
140
- const state = useFormState();
194
+ ### `createBucket(initial: object, option?: BucketOptions)`
141
195
 
142
- const nextStep = () => state.set("step", state.get("step") + 1);
143
- const prevStep = () => state.set("step", state.get("step") - 1);
196
+ Creates a new bucket for managing the global state.
144
197
 
145
- return (
146
- <div>
147
- <h2>Step {state.get("step")}</h2>
148
- <button onClick={prevStep} disabled={state.get("step") === 1}>Back</button>
149
- <button onClick={nextStep}>Next</button>
150
- </div>
151
- );
152
- }
153
- ```
198
+ #### Parameters
154
199
 
155
- ## Best Practices
200
+ | Name | Type | Description |
201
+ | --------- | --------- | ----------------------------------------- |
202
+ | `initial` | `object` | Initial state values. |
203
+ | `option` | `object?` | Optional configuration (default: memory). |
156
204
 
157
- - Use `memory` storage for temporary UI states that don't need persistence.
158
- - Use `session` storage for states that should persist across page reloads but not sessions.
159
- - Use `url` storage for sharable states, like filters or query parameters.
205
+ #### `BucketOptions`
160
206
 
161
- ## FAQs
207
+ `BucketOptions` allows you to configure how and where the state is stored. It includes:
162
208
 
163
- ### 1. Can I use `react-state-bucket` in a server-side rendered (SSR) application?
164
- Currently, `react-state-bucket` is designed for client-side use only.
209
+ | Property | Type | Description |
210
+ | -------- | ------------------------------------- | ---------------------------------------------- |
211
+ | `store` | `'memory', 'session', 'local', 'url'` | Specifies the storage mechanism for the state. |
165
212
 
166
- ### 2. What happens if I try to set an undefined key?
167
- An error will be thrown, ensuring state integrity.
213
+ ### Returned Functions
168
214
 
169
- ### 3. Can I use this package with TypeScript?
170
- Yes, `react-state-bucket` fully supports TypeScript with type-safe APIs.
215
+ #### State Management
171
216
 
172
- ## GitHub Repository
217
+ | Function | Description |
218
+ | ----------------- | ----------------------------------------------------- |
219
+ | `set(key, value)` | Sets the value of a specific key in the state. |
220
+ | `get(key)` | Retrieves the value of a specific key from the state. |
221
+ | `delete(key)` | Removes a key-value pair from the state. |
222
+ | `clear()` | Clears all state values. |
223
+ | `getState()` | Returns the entire state as an object. |
224
+ | `setState(state)` | Updates the state with a partial object. |
173
225
 
174
- Find the source code and contribute to the project on GitHub:
175
- [https://github.com/devnax/react-state-bucket.git](https://github.com/devnax/react-state-bucket.git)
226
+ #### Change Detection
176
227
 
177
- [![npm version](https://img.shields.io/npm/v/react-state-bucket.svg)](https://www.npmjs.com/package/react-state-bucket)
228
+ | Function | Description |
229
+ | ---------------- | ------------------------------------------- |
230
+ | `isChange(key)` | Checks if a specific key has been modified. |
231
+ | `getChanges()` | Returns an array of keys that have changed. |
232
+ | `clearChanges()` | Resets the change detection for all keys. |
178
233
 
179
234
  ## License
180
235
 
181
- MIT
236
+ This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
237
+
package/dist/index.d.ts CHANGED
@@ -1,17 +1,27 @@
1
- type Option = {
2
- store?: "memory" | "session" | "url";
1
+ export type BucketOptions = {
2
+ store?: "memory" | "session" | "local" | "url";
3
3
  };
4
4
  export declare const createBucket: <IT extends {
5
5
  [key: string]: any;
6
- }>(initial: IT, option?: Option) => () => {
6
+ }>(initial: IT, option?: BucketOptions) => {
7
+ (): {
8
+ set: <T extends keyof IT>(key: T, value: IT[T]) => void;
9
+ get: <T extends keyof IT>(key: T) => IT[T];
10
+ delete: <T extends keyof IT>(key: T) => void;
11
+ clear: () => void;
12
+ getState: () => IT;
13
+ setState: (state: Partial<IT>) => void;
14
+ isChange: <T extends keyof IT>(key: T) => boolean | undefined;
15
+ getChanges: () => string[];
16
+ clearChanges: () => void;
17
+ };
7
18
  set: <T extends keyof IT>(key: T, value: IT[T]) => void;
8
19
  get: <T extends keyof IT>(key: T) => IT[T];
9
20
  delete: <T extends keyof IT>(key: T) => void;
10
21
  clear: () => void;
11
22
  getState: () => IT;
12
23
  setState: (state: Partial<IT>) => void;
13
- isChange: <T extends keyof IT>(key: T) => boolean;
14
- getChanges: () => { [key in keyof IT]: boolean; };
24
+ isChange: <T extends keyof IT>(key: T) => boolean | undefined;
25
+ getChanges: () => string[];
15
26
  clearChanges: () => void;
16
27
  };
17
- export {};
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useEffect, useId, useState } from "react";
2
+ import { useEffect, useId, useMemo, useState } from "react";
3
3
  export const createBucket = (initial, option) => {
4
4
  const hooks = new Map();
5
5
  let data = new Map();
@@ -8,22 +8,23 @@ export const createBucket = (initial, option) => {
8
8
  store: "memory",
9
9
  ...option,
10
10
  };
11
+ for (let key in initial) {
12
+ let value = initial[key];
13
+ data.set(key, value);
14
+ changes.set(key, true);
15
+ }
11
16
  const handleStorage = (isLoaded = true) => {
12
17
  if (typeof window !== 'undefined') {
13
18
  let url = new URL(window.location.href);
14
- if (_option.store === 'session') {
19
+ if (_option.store === 'session' || _option.store === 'local') {
20
+ let storage = _option.store === "session" ? sessionStorage : localStorage;
15
21
  for (let key in initial) {
16
- let has = sessionStorage.getItem(key) !== null;
22
+ let has = storage.getItem(key) !== null;
17
23
  if (isLoaded || !has) {
18
- if (data.has(key)) {
19
- sessionStorage.setItem(key, data.get(key));
20
- }
21
- else {
22
- sessionStorage.removeItem(key);
23
- }
24
+ data.has(key) ? storage.setItem(key, data.get(key)) : storage.removeItem(key);
24
25
  }
25
26
  else if (has) {
26
- data.set(key, sessionStorage.getItem(key));
27
+ data.set(key, storage.getItem(key));
27
28
  }
28
29
  }
29
30
  }
@@ -31,12 +32,7 @@ export const createBucket = (initial, option) => {
31
32
  for (let key in initial) {
32
33
  let has = url.searchParams.has(key);
33
34
  if (isLoaded || !has) {
34
- if (data.has(key)) {
35
- url.searchParams.set(key, data.get(key));
36
- }
37
- else {
38
- url.searchParams.delete(key);
39
- }
35
+ data.has(key) ? url.searchParams.set(key, data.get(key)) : url.searchParams.delete(key);
40
36
  }
41
37
  else if (has) {
42
38
  data.set(key, url.searchParams.get(key));
@@ -46,11 +42,6 @@ export const createBucket = (initial, option) => {
46
42
  }
47
43
  }
48
44
  };
49
- for (let key in initial) {
50
- let value = initial[key];
51
- data.set(key, value);
52
- changes.set(key, true);
53
- }
54
45
  handleStorage(false);
55
46
  let dispatch = () => {
56
47
  hooks.forEach(d => {
@@ -59,75 +50,78 @@ export const createBucket = (initial, option) => {
59
50
  }
60
51
  catch (error) { }
61
52
  });
53
+ handleStorage();
54
+ };
55
+ const set = (key, value) => {
56
+ if (!(key in initial))
57
+ throw new Error(`(${key}) Invalid key provided in the set function. Please verify the structure of the initial state data.`);
58
+ data.set(key, value);
59
+ changes.set(key, true);
60
+ dispatch();
61
+ };
62
+ const get = (key) => data.get(key);
63
+ const _delete = (key) => {
64
+ data.delete(key);
65
+ changes.set(key, true);
66
+ dispatch();
62
67
  };
68
+ const clear = () => {
69
+ for (let key in initial) {
70
+ data.delete(key);
71
+ changes.set(key, true);
72
+ }
73
+ dispatch();
74
+ };
75
+ const getState = () => {
76
+ let d = {};
77
+ for (let key in initial) {
78
+ d[key] = data.get(key);
79
+ }
80
+ return d;
81
+ };
82
+ const setState = (state) => {
83
+ for (let key in state) {
84
+ if (!(key in initial))
85
+ throw new Error(`(${key}) Invalid key provided in the setState function. Please verify the structure of the initial state data.`);
86
+ data.set(key, state[key]);
87
+ changes.set(key, true);
88
+ }
89
+ dispatch();
90
+ };
91
+ const isChange = (key) => changes.get(key);
92
+ const getChanges = () => Array.from(changes.keys()).filter((key) => changes.get(key));
93
+ const clearChanges = () => Array.from(changes.keys()).forEach((key) => changes.set(key, false));
63
94
  const useHook = () => {
64
95
  const id = useId();
65
- const [, setUp] = useState(0);
96
+ const [d, setUp] = useState(0);
66
97
  useEffect(() => {
67
98
  hooks.set(id, () => setUp(Math.random()));
68
99
  return () => {
69
100
  hooks.delete(id);
70
101
  };
71
102
  }, []);
103
+ const state = useMemo(() => getState(), [d]);
72
104
  return {
73
- set: (key, value) => {
74
- if (!(key in initial))
75
- throw new Error(`(${key}) Invalid key provided in the set function. Please verify the structure of the initial state data.`);
76
- data.set(key, value);
77
- changes.set(key, true);
78
- dispatch();
79
- handleStorage();
80
- },
81
- get: (key) => {
82
- return data.get(key);
83
- },
84
- delete: (key) => {
85
- data.delete(key);
86
- changes.set(key, true);
87
- dispatch();
88
- handleStorage();
89
- },
90
- clear: () => {
91
- for (let key in initial) {
92
- data.delete(key);
93
- changes.set(key, true);
94
- }
95
- dispatch();
96
- handleStorage();
97
- },
98
- getState: () => {
99
- let d = {};
100
- for (let key in initial) {
101
- d[key] = data.get(key);
102
- }
103
- return d;
104
- },
105
- setState: (state) => {
106
- for (let key in state) {
107
- if (!(key in initial))
108
- throw new Error(`(${key}) Invalid key provided in the setState function. Please verify the structure of the initial state data.`);
109
- data.set(key, state[key]);
110
- changes.set(key, true);
111
- }
112
- dispatch();
113
- handleStorage();
114
- },
115
- isChange: (key) => Boolean(changes.get(key)),
116
- getChanges: () => {
117
- let _changes = {};
118
- for (let key of changes.keys()) {
119
- if (changes.get(key))
120
- _changes[key] = true;
121
- }
122
- return _changes;
123
- },
124
- clearChanges: () => {
125
- for (let key of changes.keys()) {
126
- changes.set(key, false);
127
- }
128
- }
105
+ set,
106
+ get,
107
+ delete: _delete,
108
+ clear,
109
+ getState: () => state,
110
+ setState,
111
+ isChange,
112
+ getChanges,
113
+ clearChanges,
129
114
  };
130
115
  };
116
+ useHook.set = set;
117
+ useHook.get = get;
118
+ useHook.delete = _delete;
119
+ useHook.clear = clear;
120
+ useHook.getState = getState;
121
+ useHook.setState = setState;
122
+ useHook.isChange = isChange;
123
+ useHook.getChanges = getChanges;
124
+ useHook.clearChanges = clearChanges;
131
125
  return useHook;
132
126
  };
133
127
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,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