cross-state 0.6.3 → 0.6.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 +3 -3
- package/dist/cjs/hash.cjs +368 -283
- package/dist/cjs/hash.cjs.map +1 -1
- package/dist/cjs/immer.cjs +1 -1
- package/dist/cjs/immer.cjs.map +1 -1
- package/dist/cjs/index.cjs +186 -174
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react.cjs +73 -12
- package/dist/cjs/react.cjs.map +1 -1
- package/dist/es/hash.mjs +369 -284
- package/dist/es/hash.mjs.map +1 -1
- package/dist/es/immer.mjs +1 -1
- package/dist/es/immer.mjs.map +1 -1
- package/dist/es/index.mjs +189 -177
- package/dist/es/index.mjs.map +1 -1
- package/dist/es/react.mjs +79 -18
- package/dist/es/react.mjs.map +1 -1
- package/dist/types/core/cache.d.ts +60 -0
- package/dist/types/core/commonTypes.d.ts +5 -5
- package/dist/types/core/index.d.ts +5 -8
- package/dist/types/core/resourceGroup.d.ts +9 -6
- package/dist/types/core/store.d.ts +40 -21
- package/dist/types/immer/immerActions.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/lib/applyPatches.d.ts +2 -0
- package/dist/types/lib/cacheState.d.ts +19 -0
- package/dist/types/lib/calculationHelper.d.ts +3 -3
- package/dist/types/lib/clone.d.ts +1 -0
- package/dist/types/lib/debounce.d.ts +6 -0
- package/dist/types/lib/diff.d.ts +14 -7
- package/dist/types/lib/{cache.d.ts → instanceCache.d.ts} +1 -1
- package/dist/types/lib/makeSelector.d.ts +2 -1
- package/dist/types/lib/maybeAsync.d.ts +3 -0
- package/dist/types/lib/path.d.ts +14 -0
- package/dist/types/lib/propAccess.d.ts +5 -12
- package/dist/types/lib/queue.d.ts +4 -2
- package/dist/types/lib/standardMethods.d.ts +25 -0
- package/dist/types/lib/throttle.d.ts +2 -1
- package/dist/types/lib/typeHelpers.d.ts +8 -0
- package/dist/types/persist/index.d.ts +3 -0
- package/dist/types/persist/persist.d.ts +33 -0
- package/dist/types/persist/persistPathHelpers.d.ts +6 -0
- package/dist/types/persist/persistStorage.d.ts +14 -0
- package/dist/types/react/index.d.ts +3 -4
- package/dist/types/react/read.d.ts +3 -4
- package/dist/types/react/storeScope.d.ts +1 -1
- package/dist/types/react/useCache.d.ts +14 -0
- package/dist/types/react/useProp.d.ts +3 -3
- package/dist/types/react/useStore.d.ts +1 -1
- package/package.json +53 -44
- package/dist/types/core/derivedStore.d.ts +0 -38
- package/dist/types/core/fetchStore.d.ts +0 -76
- package/dist/types/core/once.d.ts +0 -13
- package/dist/types/lib/storeActions.d.ts +0 -28
- package/react.d.ts +0 -1
- package/react.js +0 -1
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ npm install schummar-state
|
|
|
15
15
|
### Create a store
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { Store } from '
|
|
18
|
+
import { Store } from 'cross-state';
|
|
19
19
|
|
|
20
20
|
export const store = new Store({
|
|
21
21
|
counter: 0,
|
|
@@ -27,7 +27,7 @@ You can easily use multiple stores in parallel.
|
|
|
27
27
|
### Use store in a component
|
|
28
28
|
|
|
29
29
|
```tsx
|
|
30
|
-
import store from './store
|
|
30
|
+
import store from './store';
|
|
31
31
|
|
|
32
32
|
export function App() {
|
|
33
33
|
const counter = store.useState((state) => state.counter);
|
|
@@ -43,7 +43,7 @@ export function App() {
|
|
|
43
43
|
### Update a store
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
import store from './store
|
|
46
|
+
import store from './store';
|
|
47
47
|
|
|
48
48
|
export function App() {
|
|
49
49
|
const counter = store.useState((state) => state.counter);
|