@plitzi/nexus 0.32.1 → 0.32.2
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/CHANGELOG.md +33 -0
- package/README.md +181 -22
- package/dist/advanced/index.d.ts +0 -2
- package/dist/advanced/index.mjs +10 -16
- package/dist/async/index.d.ts +0 -2
- package/dist/async/index.mjs +1 -3
- package/dist/createStore/createStore.d.ts +3 -43
- package/dist/createStore/createStore.mjs +73 -97
- package/dist/createStore/helpers/PathTrie.mjs +14 -14
- package/dist/createStore/helpers/createChainReads.d.ts +1 -1
- package/dist/createStore/helpers/createChainReads.mjs +26 -17
- package/dist/createStore/helpers/createSetState.mjs +11 -9
- package/dist/createStore/helpers/forwardParentChanges.mjs +16 -13
- package/dist/createStore/index.mjs +3 -3
- package/dist/derived/index.d.ts +0 -1
- package/dist/derived/index.mjs +1 -2
- package/dist/entities/createEntityStore.d.ts +0 -3
- package/dist/entities/createEntityStore.mjs +71 -78
- package/dist/env.d.ts +4 -0
- package/dist/env.mjs +3 -0
- package/dist/history/index.d.ts +0 -2
- package/dist/history/index.mjs +1 -2
- package/dist/index.d.ts +23 -16
- package/dist/index.mjs +15 -23
- package/dist/middleware/historyMiddleware.mjs +31 -31
- package/dist/middleware/persistMiddleware.mjs +11 -11
- package/dist/middleware/recorderMiddleware.d.ts +21 -0
- package/dist/middleware/recorderMiddleware.mjs +33 -0
- package/dist/{StoreContext.d.ts → react/StoreContext.d.ts} +1 -1
- package/dist/{StoreContext.mjs → react/StoreContext.mjs} +1 -1
- package/dist/{StoreProvider.d.ts → react/StoreProvider.d.ts} +4 -2
- package/dist/react/StoreProvider.mjs +62 -0
- package/dist/react/createStoreHook.d.ts +44 -0
- package/dist/react/createStoreHook.mjs +27 -0
- package/dist/{createStore → react}/hooks/shared.mjs +2 -2
- package/dist/{async → react}/hooks/useAsync.d.ts +1 -1
- package/dist/{async → react}/hooks/useAsync.mjs +1 -1
- package/dist/{async → react}/hooks/useAsyncValue.d.ts +1 -1
- package/dist/{async → react}/hooks/useAsyncValue.mjs +1 -1
- package/dist/{derived → react}/hooks/useDerived.d.ts +1 -1
- package/dist/{derived → react}/hooks/useDerived.mjs +1 -1
- package/dist/react/hooks/useEntity.d.ts +10 -0
- package/dist/react/hooks/useEntity.mjs +23 -0
- package/dist/{createStore → react}/hooks/useStore.mjs +2 -2
- package/dist/{createStore → react}/hooks/useStoreById.mjs +2 -2
- package/dist/{createStore → react}/hooks/useStoreGetter.mjs +1 -1
- package/dist/react/hooks/useStoreHistory.mjs +29 -0
- package/dist/{createStore → react}/hooks/useStoreSetter.mjs +1 -1
- package/dist/{createStore → react}/hooks/useStoreSync.mjs +2 -2
- package/dist/react/index.d.ts +17 -0
- package/dist/react/index.mjs +16 -0
- package/dist/{helpers → react}/useIsomorphicLayoutEffect.mjs +1 -1
- package/dist/types/StoreTypes.d.ts +3 -0
- package/dist/vue/index.d.ts +8 -0
- package/dist/vue/index.mjs +7 -0
- package/dist/vue/injection.d.ts +3 -0
- package/dist/vue/injection.mjs +13 -0
- package/dist/vue/useAsync.d.ts +3 -0
- package/dist/vue/useAsync.mjs +10 -0
- package/dist/vue/useDerived.d.ts +3 -0
- package/dist/vue/useDerived.mjs +10 -0
- package/dist/vue/useEntity.d.ts +11 -0
- package/dist/vue/useEntity.mjs +29 -0
- package/dist/vue/useStore.d.ts +13 -0
- package/dist/vue/useStore.mjs +31 -0
- package/dist/vue/useStoreHistory.d.ts +12 -0
- package/dist/vue/useStoreHistory.mjs +33 -0
- package/logo.svg +77 -22
- package/package.json +127 -58
- package/dist/StoreProvider.mjs +0 -57
- package/dist/history/hooks/useStoreHistory.mjs +0 -24
- /package/dist/{createStore → react}/hooks/shared.d.ts +0 -0
- /package/dist/{createStore → react}/hooks/useStore.d.ts +0 -0
- /package/dist/{createStore → react}/hooks/useStoreById.d.ts +0 -0
- /package/dist/{createStore → react}/hooks/useStoreGetter.d.ts +0 -0
- /package/dist/{history → react}/hooks/useStoreHistory.d.ts +0 -0
- /package/dist/{createStore → react}/hooks/useStoreSetter.d.ts +0 -0
- /package/dist/{createStore → react}/hooks/useStoreSync.d.ts +0 -0
- /package/dist/{helpers → react}/useIsomorphicLayoutEffect.d.ts +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PathOf, PathValue, StoreApi } from '../types';
|
|
2
|
+
import { Ref, WritableComputedRef } from 'vue';
|
|
3
|
+
export type UseStoreOptions<TState extends object> = {
|
|
4
|
+
store?: StoreApi<TState>;
|
|
5
|
+
};
|
|
6
|
+
export declare function useStoreValue<TState extends object>(options?: UseStoreOptions<TState>): Ref<TState>;
|
|
7
|
+
export declare function useStoreValue<TState extends object, P extends PathOf<TState>>(path: P, options?: UseStoreOptions<TState>): Ref<PathValue<TState, P> | undefined>;
|
|
8
|
+
export declare function useStore<TState extends object, P extends PathOf<TState>>(path: P, options?: UseStoreOptions<TState>): WritableComputedRef<PathValue<TState, P> | undefined>;
|
|
9
|
+
export declare function createStoreComposable<TState extends object>(): {
|
|
10
|
+
useStore: <P extends PathOf<TState>>(path: P, options?: UseStoreOptions<TState>) => WritableComputedRef<PathValue<TState, P> | undefined, PathValue<TState, P> | undefined>;
|
|
11
|
+
useStoreValue: <P extends PathOf<TState>>(path: P, options?: UseStoreOptions<TState>) => Ref<PathValue<TState, P> | undefined, PathValue<TState, P> | undefined>;
|
|
12
|
+
useStoreState: (options?: UseStoreOptions<TState>) => Ref<TState, TState>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { injectStore as e } from "./injection.mjs";
|
|
2
|
+
import { computed as t, onScopeDispose as n, shallowRef as r } from "vue";
|
|
3
|
+
//#region src/vue/useStore.ts
|
|
4
|
+
function i(e, t) {
|
|
5
|
+
let i = () => t === void 0 ? e.getState() : e.getPath(t), a = r(i());
|
|
6
|
+
return n(t === void 0 ? e.subscribe(() => {
|
|
7
|
+
a.value = i();
|
|
8
|
+
}) : e.subscribePath(t, () => {
|
|
9
|
+
a.value = i();
|
|
10
|
+
})), a;
|
|
11
|
+
}
|
|
12
|
+
function a(t, n) {
|
|
13
|
+
let r = typeof t == "string", a = r ? t : void 0;
|
|
14
|
+
return i(((r ? n : t) ?? {}).store ?? e(), a);
|
|
15
|
+
}
|
|
16
|
+
function o(n, r) {
|
|
17
|
+
let i = r?.store ?? e(), o = a(n, { store: i });
|
|
18
|
+
return t({
|
|
19
|
+
get: () => o.value,
|
|
20
|
+
set: (e) => i.set(n, e)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function s() {
|
|
24
|
+
return {
|
|
25
|
+
useStore: (e, t) => o(e, t),
|
|
26
|
+
useStoreValue: (e, t) => a(e, t),
|
|
27
|
+
useStoreState: (e) => a(e)
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { s as createStoreComposable, o as useStore, a as useStoreValue };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HistorySnapshot } from '../middleware/historyMiddleware';
|
|
2
|
+
import { StoreApi } from '../types';
|
|
3
|
+
import { ComputedRef } from 'vue';
|
|
4
|
+
export type UseStoreHistoryReturn<TState> = HistorySnapshot<TState> & {
|
|
5
|
+
undo: () => void;
|
|
6
|
+
redo: () => void;
|
|
7
|
+
travelTo: (index: number) => void;
|
|
8
|
+
clear: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function useStoreHistory<TState extends object>(options?: {
|
|
11
|
+
store?: StoreApi<TState>;
|
|
12
|
+
}): ComputedRef<UseStoreHistoryReturn<TState>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getStoreHistory as e } from "../middleware/historyMiddleware.mjs";
|
|
2
|
+
import { isProd as t } from "../env.mjs";
|
|
3
|
+
import { injectStore as n } from "./injection.mjs";
|
|
4
|
+
import { computed as r, onScopeDispose as i, shallowRef as a } from "vue";
|
|
5
|
+
//#region src/vue/useStoreHistory.ts
|
|
6
|
+
var o = {
|
|
7
|
+
entries: [],
|
|
8
|
+
index: -1,
|
|
9
|
+
canUndo: !1,
|
|
10
|
+
canRedo: !1
|
|
11
|
+
}, s = () => {}, c = /* @__PURE__ */ new WeakSet(), l = (e) => {
|
|
12
|
+
t || c.has(e) || (c.add(e), console.warn("[nexus] useStoreHistory: this store has no history. Add `historyMiddleware()` to its middlewares to record an action log — until then the composable returns an empty, no-op view."));
|
|
13
|
+
};
|
|
14
|
+
function u(t) {
|
|
15
|
+
let c = t?.store ?? n(), u = e(c);
|
|
16
|
+
u || l(c);
|
|
17
|
+
let d = a(u ? u.getSnapshot() : o);
|
|
18
|
+
u && i(u.subscribe(() => {
|
|
19
|
+
d.value = u.getSnapshot();
|
|
20
|
+
}));
|
|
21
|
+
let f = {
|
|
22
|
+
undo: u?.undo ?? s,
|
|
23
|
+
redo: u?.redo ?? s,
|
|
24
|
+
travelTo: u?.travelTo ?? s,
|
|
25
|
+
clear: u?.clear ?? s
|
|
26
|
+
};
|
|
27
|
+
return r(() => ({
|
|
28
|
+
...d.value,
|
|
29
|
+
...f
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { u as useStoreHistory };
|
package/logo.svg
CHANGED
|
@@ -1,29 +1,51 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="210" viewBox="0 0 640 210" fill="none" role="img" aria-label="@plitzi/nexus — one store, every framework">
|
|
2
2
|
<defs>
|
|
3
|
-
<linearGradient id="bg" x1="0" y1="0" x2="640" y2="
|
|
4
|
-
<stop stop-color="#
|
|
5
|
-
<stop offset="1" stop-color="#
|
|
3
|
+
<linearGradient id="bg" x1="0" y1="0" x2="640" y2="210" gradientUnits="userSpaceOnUse">
|
|
4
|
+
<stop stop-color="#0b0b11" />
|
|
5
|
+
<stop offset="1" stop-color="#15131f" />
|
|
6
6
|
</linearGradient>
|
|
7
|
+
<radialGradient id="glow" cx="0.5" cy="0.5" r="0.5">
|
|
8
|
+
<stop stop-color="#7c3aed" stop-opacity="0.55" />
|
|
9
|
+
<stop offset="1" stop-color="#7c3aed" stop-opacity="0" />
|
|
10
|
+
</radialGradient>
|
|
7
11
|
<linearGradient id="mark" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
-
<stop stop-color="#
|
|
12
|
+
<stop stop-color="#c4b5fd" />
|
|
9
13
|
<stop offset="1" stop-color="#7c3aed" />
|
|
10
14
|
</linearGradient>
|
|
11
|
-
<linearGradient id="
|
|
12
|
-
<stop stop-color="#
|
|
13
|
-
<stop offset="1" stop-color="#
|
|
15
|
+
<linearGradient id="hero" x1="0" y1="0" x2="1" y2="0">
|
|
16
|
+
<stop stop-color="#8b5cf6" />
|
|
17
|
+
<stop offset="1" stop-color="#6d28d9" />
|
|
14
18
|
</linearGradient>
|
|
19
|
+
<linearGradient id="word" x1="150" y1="0" x2="600" y2="0" gradientUnits="userSpaceOnUse">
|
|
20
|
+
<stop stop-color="#ffffff" />
|
|
21
|
+
<stop offset="1" stop-color="#b794f6" />
|
|
22
|
+
</linearGradient>
|
|
23
|
+
<linearGradient id="pill" x1="0" y1="0" x2="0" y2="1">
|
|
24
|
+
<stop stop-color="#ffffff" stop-opacity="0.10" />
|
|
25
|
+
<stop offset="1" stop-color="#ffffff" stop-opacity="0.025" />
|
|
26
|
+
</linearGradient>
|
|
27
|
+
<filter id="soft" x="-60%" y="-60%" width="220%" height="220%">
|
|
28
|
+
<feGaussianBlur stdDeviation="7" result="b" />
|
|
29
|
+
<feMerge>
|
|
30
|
+
<feMergeNode in="b" />
|
|
31
|
+
<feMergeNode in="SourceGraphic" />
|
|
32
|
+
</feMerge>
|
|
33
|
+
</filter>
|
|
15
34
|
</defs>
|
|
16
35
|
|
|
17
|
-
<rect width="640" height="
|
|
18
|
-
<rect x="0.5" y="0.5" width="639" height="
|
|
36
|
+
<rect width="640" height="210" rx="22" fill="url(#bg)" />
|
|
37
|
+
<rect x="0.5" y="0.5" width="639" height="209" rx="21.5" fill="none" stroke="#2a2740" />
|
|
19
38
|
|
|
20
|
-
|
|
39
|
+
<!-- ambient glow -->
|
|
40
|
+
<circle cx="92" cy="105" r="150" fill="url(#glow)" />
|
|
21
41
|
|
|
22
42
|
<!-- nexus mark -->
|
|
23
|
-
<g transform="translate(
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
43
|
+
<g transform="translate(92 105)">
|
|
44
|
+
<g filter="url(#soft)">
|
|
45
|
+
<rect x="-38" y="-38" width="76" height="76" rx="20" fill="url(#mark)" />
|
|
46
|
+
</g>
|
|
47
|
+
<g transform="scale(2.1)" stroke="#fff" stroke-linecap="round" stroke-linejoin="round">
|
|
48
|
+
<path d="M0 -8.5 7.4 -4.25 7.4 4.25 0 8.5 -7.4 4.25 -7.4 -4.25 Z" stroke-width="1.2" stroke-opacity="0.4" />
|
|
27
49
|
<g stroke-width="1.5">
|
|
28
50
|
<path d="M0 0 0 -8.5" />
|
|
29
51
|
<path d="M0 0 7.4 -4.25" />
|
|
@@ -33,7 +55,7 @@
|
|
|
33
55
|
<path d="M0 0 -7.4 -4.25" />
|
|
34
56
|
</g>
|
|
35
57
|
</g>
|
|
36
|
-
<g transform="scale(2.
|
|
58
|
+
<g transform="scale(2.1)" fill="#fff">
|
|
37
59
|
<circle cx="0" cy="-8.5" r="1.7" />
|
|
38
60
|
<circle cx="7.4" cy="-4.25" r="1.7" />
|
|
39
61
|
<circle cx="7.4" cy="4.25" r="1.7" />
|
|
@@ -45,13 +67,46 @@
|
|
|
45
67
|
</g>
|
|
46
68
|
|
|
47
69
|
<!-- wordmark -->
|
|
48
|
-
<text x="
|
|
70
|
+
<text x="166" y="70" font-family="'Inter', system-ui, sans-serif" font-size="46" font-weight="800" letter-spacing="-1.5" fill="url(#word)">
|
|
49
71
|
@plitzi/nexus
|
|
50
72
|
</text>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
path subscriptions · scoped stores · time-travel
|
|
73
|
+
|
|
74
|
+
<!-- punchy tagline -->
|
|
75
|
+
<text x="168" y="103" font-family="'Inter', system-ui, sans-serif" font-size="21" font-weight="600" letter-spacing="-0.3" fill="#ece7ff">
|
|
76
|
+
One store. Every framework.
|
|
56
77
|
</text>
|
|
78
|
+
|
|
79
|
+
<!-- hero attribute — the headline feature -->
|
|
80
|
+
<g>
|
|
81
|
+
<rect x="166" y="120" width="264" height="32" rx="16" fill="url(#hero)" filter="url(#soft)" />
|
|
82
|
+
<rect x="166" y="120" width="264" height="32" rx="16" fill="url(#hero)" />
|
|
83
|
+
<path transform="translate(186 136)" d="M2.2 -8 L-4.4 1.2 L0 1.2 L-2.2 8 L4.4 -1.2 L0 -1.2 Z" fill="#fff" />
|
|
84
|
+
<text x="200" y="141" font-family="'Inter', system-ui, sans-serif" font-size="14.5" font-weight="700" letter-spacing="-0.2" fill="#ffffff">
|
|
85
|
+
Re-renders only what changed
|
|
86
|
+
</text>
|
|
87
|
+
</g>
|
|
88
|
+
|
|
89
|
+
<!-- framework pills -->
|
|
90
|
+
<g font-family="'JetBrains Mono', ui-monospace, monospace" font-size="13" font-weight="500" letter-spacing="0.3" text-anchor="middle">
|
|
91
|
+
<g>
|
|
92
|
+
<rect x="166" y="164" width="74" height="28" rx="14" fill="url(#pill)" stroke="#a78bfa" stroke-opacity="0.4" />
|
|
93
|
+
<text x="203" y="182.5" fill="#d4c6ff">React</text>
|
|
94
|
+
</g>
|
|
95
|
+
<g>
|
|
96
|
+
<rect x="250" y="164" width="60" height="28" rx="14" fill="url(#pill)" stroke="#a78bfa" stroke-opacity="0.4" />
|
|
97
|
+
<text x="280" y="182.5" fill="#d4c6ff">Vue</text>
|
|
98
|
+
</g>
|
|
99
|
+
<g>
|
|
100
|
+
<rect x="320" y="164" width="66" height="28" rx="14" fill="url(#pill)" stroke="#a78bfa" stroke-opacity="0.4" />
|
|
101
|
+
<text x="353" y="182.5" fill="#d4c6ff">Next</text>
|
|
102
|
+
</g>
|
|
103
|
+
<g>
|
|
104
|
+
<rect x="396" y="164" width="80" height="28" rx="14" fill="url(#pill)" stroke="#a78bfa" stroke-opacity="0.4" />
|
|
105
|
+
<text x="436" y="182.5" fill="#d4c6ff">Svelte</text>
|
|
106
|
+
</g>
|
|
107
|
+
<g>
|
|
108
|
+
<rect x="486" y="164" width="100" height="28" rx="14" fill="url(#pill)" stroke="#a78bfa" stroke-opacity="0.4" />
|
|
109
|
+
<text x="536" y="182.5" fill="#d4c6ff">SSR · RSC</text>
|
|
110
|
+
</g>
|
|
111
|
+
</g>
|
|
57
112
|
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/nexus",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -24,29 +24,34 @@
|
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"eslint": "^9.39.4",
|
|
27
|
-
"react": "^19.2.
|
|
28
|
-
"react-dom": "^19.2.
|
|
27
|
+
"react": "^19.2.7",
|
|
28
|
+
"react-dom": "^19.2.7",
|
|
29
29
|
"typescript": "^6.0.3",
|
|
30
|
-
"vite": "^8.0.
|
|
31
|
-
"vitest": "^4.1.
|
|
30
|
+
"vite": "^8.0.16",
|
|
31
|
+
"vitest": "^4.1.9",
|
|
32
|
+
"vue": "^3.5.13"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"react": "^18.0.0 || ^19.0.0",
|
|
35
|
-
"react-dom": "^18.0.0 || ^19.0.0"
|
|
36
|
+
"react-dom": "^18.0.0 || ^19.0.0",
|
|
37
|
+
"vue": "^3.4.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"react": {
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
"react-dom": {
|
|
44
|
+
"optional": true
|
|
45
|
+
},
|
|
46
|
+
"vue": {
|
|
47
|
+
"optional": true
|
|
48
|
+
}
|
|
36
49
|
},
|
|
37
50
|
"exports": {
|
|
38
51
|
".": {
|
|
39
52
|
"types": "./dist/index.d.ts",
|
|
40
53
|
"import": "./dist/index.mjs"
|
|
41
54
|
},
|
|
42
|
-
"./StoreContext": {
|
|
43
|
-
"types": "./dist/StoreContext.d.ts",
|
|
44
|
-
"import": "./dist/StoreContext.mjs"
|
|
45
|
-
},
|
|
46
|
-
"./StoreProvider": {
|
|
47
|
-
"types": "./dist/StoreProvider.d.ts",
|
|
48
|
-
"import": "./dist/StoreProvider.mjs"
|
|
49
|
-
},
|
|
50
55
|
"./advanced": {
|
|
51
56
|
"types": "./dist/advanced/index.d.ts",
|
|
52
57
|
"import": "./dist/advanced/index.mjs"
|
|
@@ -63,14 +68,6 @@
|
|
|
63
68
|
"types": "./dist/async/createAsync.d.ts",
|
|
64
69
|
"import": "./dist/async/createAsync.mjs"
|
|
65
70
|
},
|
|
66
|
-
"./async/hooks/useAsync": {
|
|
67
|
-
"types": "./dist/async/hooks/useAsync.d.ts",
|
|
68
|
-
"import": "./dist/async/hooks/useAsync.mjs"
|
|
69
|
-
},
|
|
70
|
-
"./async/hooks/useAsyncValue": {
|
|
71
|
-
"types": "./dist/async/hooks/useAsyncValue.d.ts",
|
|
72
|
-
"import": "./dist/async/hooks/useAsyncValue.mjs"
|
|
73
|
-
},
|
|
74
71
|
"./async/index": {
|
|
75
72
|
"types": "./dist/async/index.d.ts",
|
|
76
73
|
"import": "./dist/async/index.mjs"
|
|
@@ -115,30 +112,6 @@
|
|
|
115
112
|
"types": "./dist/createStore/helpers/writeByPath.d.ts",
|
|
116
113
|
"import": "./dist/createStore/helpers/writeByPath.mjs"
|
|
117
114
|
},
|
|
118
|
-
"./createStore/hooks/shared": {
|
|
119
|
-
"types": "./dist/createStore/hooks/shared.d.ts",
|
|
120
|
-
"import": "./dist/createStore/hooks/shared.mjs"
|
|
121
|
-
},
|
|
122
|
-
"./createStore/hooks/useStore": {
|
|
123
|
-
"types": "./dist/createStore/hooks/useStore.d.ts",
|
|
124
|
-
"import": "./dist/createStore/hooks/useStore.mjs"
|
|
125
|
-
},
|
|
126
|
-
"./createStore/hooks/useStoreById": {
|
|
127
|
-
"types": "./dist/createStore/hooks/useStoreById.d.ts",
|
|
128
|
-
"import": "./dist/createStore/hooks/useStoreById.mjs"
|
|
129
|
-
},
|
|
130
|
-
"./createStore/hooks/useStoreGetter": {
|
|
131
|
-
"types": "./dist/createStore/hooks/useStoreGetter.d.ts",
|
|
132
|
-
"import": "./dist/createStore/hooks/useStoreGetter.mjs"
|
|
133
|
-
},
|
|
134
|
-
"./createStore/hooks/useStoreSetter": {
|
|
135
|
-
"types": "./dist/createStore/hooks/useStoreSetter.d.ts",
|
|
136
|
-
"import": "./dist/createStore/hooks/useStoreSetter.mjs"
|
|
137
|
-
},
|
|
138
|
-
"./createStore/hooks/useStoreSync": {
|
|
139
|
-
"types": "./dist/createStore/hooks/useStoreSync.d.ts",
|
|
140
|
-
"import": "./dist/createStore/hooks/useStoreSync.mjs"
|
|
141
|
-
},
|
|
142
115
|
"./createStore/index": {
|
|
143
116
|
"types": "./dist/createStore/index.d.ts",
|
|
144
117
|
"import": "./dist/createStore/index.mjs"
|
|
@@ -151,10 +124,6 @@
|
|
|
151
124
|
"types": "./dist/derived/createDerived.d.ts",
|
|
152
125
|
"import": "./dist/derived/createDerived.mjs"
|
|
153
126
|
},
|
|
154
|
-
"./derived/hooks/useDerived": {
|
|
155
|
-
"types": "./dist/derived/hooks/useDerived.d.ts",
|
|
156
|
-
"import": "./dist/derived/hooks/useDerived.mjs"
|
|
157
|
-
},
|
|
158
127
|
"./derived/index": {
|
|
159
128
|
"types": "./dist/derived/index.d.ts",
|
|
160
129
|
"import": "./dist/derived/index.mjs"
|
|
@@ -175,6 +144,10 @@
|
|
|
175
144
|
"types": "./dist/entities/index.d.ts",
|
|
176
145
|
"import": "./dist/entities/index.mjs"
|
|
177
146
|
},
|
|
147
|
+
"./env": {
|
|
148
|
+
"types": "./dist/env.d.ts",
|
|
149
|
+
"import": "./dist/env.mjs"
|
|
150
|
+
},
|
|
178
151
|
"./helpers/createObservable": {
|
|
179
152
|
"types": "./dist/helpers/createObservable.d.ts",
|
|
180
153
|
"import": "./dist/helpers/createObservable.mjs"
|
|
@@ -199,18 +172,10 @@
|
|
|
199
172
|
"types": "./dist/helpers/shallowEqual.d.ts",
|
|
200
173
|
"import": "./dist/helpers/shallowEqual.mjs"
|
|
201
174
|
},
|
|
202
|
-
"./helpers/useIsomorphicLayoutEffect": {
|
|
203
|
-
"types": "./dist/helpers/useIsomorphicLayoutEffect.d.ts",
|
|
204
|
-
"import": "./dist/helpers/useIsomorphicLayoutEffect.mjs"
|
|
205
|
-
},
|
|
206
175
|
"./history": {
|
|
207
176
|
"types": "./dist/history/index.d.ts",
|
|
208
177
|
"import": "./dist/history/index.mjs"
|
|
209
178
|
},
|
|
210
|
-
"./history/hooks/useStoreHistory": {
|
|
211
|
-
"types": "./dist/history/hooks/useStoreHistory.d.ts",
|
|
212
|
-
"import": "./dist/history/hooks/useStoreHistory.mjs"
|
|
213
|
-
},
|
|
214
179
|
"./history/index": {
|
|
215
180
|
"types": "./dist/history/index.d.ts",
|
|
216
181
|
"import": "./dist/history/index.mjs"
|
|
@@ -247,6 +212,10 @@
|
|
|
247
212
|
"types": "./dist/middleware/persistMiddleware.d.ts",
|
|
248
213
|
"import": "./dist/middleware/persistMiddleware.mjs"
|
|
249
214
|
},
|
|
215
|
+
"./middleware/recorderMiddleware": {
|
|
216
|
+
"types": "./dist/middleware/recorderMiddleware.d.ts",
|
|
217
|
+
"import": "./dist/middleware/recorderMiddleware.mjs"
|
|
218
|
+
},
|
|
250
219
|
"./middleware/reduxDevToolsMiddleware": {
|
|
251
220
|
"types": "./dist/middleware/reduxDevToolsMiddleware.d.ts",
|
|
252
221
|
"import": "./dist/middleware/reduxDevToolsMiddleware.mjs"
|
|
@@ -259,6 +228,74 @@
|
|
|
259
228
|
"types": "./dist/next/index.d.ts",
|
|
260
229
|
"import": "./dist/next/index.mjs"
|
|
261
230
|
},
|
|
231
|
+
"./react": {
|
|
232
|
+
"types": "./dist/react/index.d.ts",
|
|
233
|
+
"import": "./dist/react/index.mjs"
|
|
234
|
+
},
|
|
235
|
+
"./react/StoreContext": {
|
|
236
|
+
"types": "./dist/react/StoreContext.d.ts",
|
|
237
|
+
"import": "./dist/react/StoreContext.mjs"
|
|
238
|
+
},
|
|
239
|
+
"./react/StoreProvider": {
|
|
240
|
+
"types": "./dist/react/StoreProvider.d.ts",
|
|
241
|
+
"import": "./dist/react/StoreProvider.mjs"
|
|
242
|
+
},
|
|
243
|
+
"./react/createStoreHook": {
|
|
244
|
+
"types": "./dist/react/createStoreHook.d.ts",
|
|
245
|
+
"import": "./dist/react/createStoreHook.mjs"
|
|
246
|
+
},
|
|
247
|
+
"./react/hooks/shared": {
|
|
248
|
+
"types": "./dist/react/hooks/shared.d.ts",
|
|
249
|
+
"import": "./dist/react/hooks/shared.mjs"
|
|
250
|
+
},
|
|
251
|
+
"./react/hooks/useAsync": {
|
|
252
|
+
"types": "./dist/react/hooks/useAsync.d.ts",
|
|
253
|
+
"import": "./dist/react/hooks/useAsync.mjs"
|
|
254
|
+
},
|
|
255
|
+
"./react/hooks/useAsyncValue": {
|
|
256
|
+
"types": "./dist/react/hooks/useAsyncValue.d.ts",
|
|
257
|
+
"import": "./dist/react/hooks/useAsyncValue.mjs"
|
|
258
|
+
},
|
|
259
|
+
"./react/hooks/useDerived": {
|
|
260
|
+
"types": "./dist/react/hooks/useDerived.d.ts",
|
|
261
|
+
"import": "./dist/react/hooks/useDerived.mjs"
|
|
262
|
+
},
|
|
263
|
+
"./react/hooks/useEntity": {
|
|
264
|
+
"types": "./dist/react/hooks/useEntity.d.ts",
|
|
265
|
+
"import": "./dist/react/hooks/useEntity.mjs"
|
|
266
|
+
},
|
|
267
|
+
"./react/hooks/useStore": {
|
|
268
|
+
"types": "./dist/react/hooks/useStore.d.ts",
|
|
269
|
+
"import": "./dist/react/hooks/useStore.mjs"
|
|
270
|
+
},
|
|
271
|
+
"./react/hooks/useStoreById": {
|
|
272
|
+
"types": "./dist/react/hooks/useStoreById.d.ts",
|
|
273
|
+
"import": "./dist/react/hooks/useStoreById.mjs"
|
|
274
|
+
},
|
|
275
|
+
"./react/hooks/useStoreGetter": {
|
|
276
|
+
"types": "./dist/react/hooks/useStoreGetter.d.ts",
|
|
277
|
+
"import": "./dist/react/hooks/useStoreGetter.mjs"
|
|
278
|
+
},
|
|
279
|
+
"./react/hooks/useStoreHistory": {
|
|
280
|
+
"types": "./dist/react/hooks/useStoreHistory.d.ts",
|
|
281
|
+
"import": "./dist/react/hooks/useStoreHistory.mjs"
|
|
282
|
+
},
|
|
283
|
+
"./react/hooks/useStoreSetter": {
|
|
284
|
+
"types": "./dist/react/hooks/useStoreSetter.d.ts",
|
|
285
|
+
"import": "./dist/react/hooks/useStoreSetter.mjs"
|
|
286
|
+
},
|
|
287
|
+
"./react/hooks/useStoreSync": {
|
|
288
|
+
"types": "./dist/react/hooks/useStoreSync.d.ts",
|
|
289
|
+
"import": "./dist/react/hooks/useStoreSync.mjs"
|
|
290
|
+
},
|
|
291
|
+
"./react/index": {
|
|
292
|
+
"types": "./dist/react/index.d.ts",
|
|
293
|
+
"import": "./dist/react/index.mjs"
|
|
294
|
+
},
|
|
295
|
+
"./react/useIsomorphicLayoutEffect": {
|
|
296
|
+
"types": "./dist/react/useIsomorphicLayoutEffect.d.ts",
|
|
297
|
+
"import": "./dist/react/useIsomorphicLayoutEffect.mjs"
|
|
298
|
+
},
|
|
262
299
|
"./rsc/index": {
|
|
263
300
|
"import": "./dist/rsc/index.mjs"
|
|
264
301
|
},
|
|
@@ -272,6 +309,38 @@
|
|
|
272
309
|
"./types/index": {
|
|
273
310
|
"types": "./dist/types/index.d.ts",
|
|
274
311
|
"import": "./dist/types/index.mjs"
|
|
312
|
+
},
|
|
313
|
+
"./vue": {
|
|
314
|
+
"types": "./dist/vue/index.d.ts",
|
|
315
|
+
"import": "./dist/vue/index.mjs"
|
|
316
|
+
},
|
|
317
|
+
"./vue/index": {
|
|
318
|
+
"types": "./dist/vue/index.d.ts",
|
|
319
|
+
"import": "./dist/vue/index.mjs"
|
|
320
|
+
},
|
|
321
|
+
"./vue/injection": {
|
|
322
|
+
"types": "./dist/vue/injection.d.ts",
|
|
323
|
+
"import": "./dist/vue/injection.mjs"
|
|
324
|
+
},
|
|
325
|
+
"./vue/useAsync": {
|
|
326
|
+
"types": "./dist/vue/useAsync.d.ts",
|
|
327
|
+
"import": "./dist/vue/useAsync.mjs"
|
|
328
|
+
},
|
|
329
|
+
"./vue/useDerived": {
|
|
330
|
+
"types": "./dist/vue/useDerived.d.ts",
|
|
331
|
+
"import": "./dist/vue/useDerived.mjs"
|
|
332
|
+
},
|
|
333
|
+
"./vue/useEntity": {
|
|
334
|
+
"types": "./dist/vue/useEntity.d.ts",
|
|
335
|
+
"import": "./dist/vue/useEntity.mjs"
|
|
336
|
+
},
|
|
337
|
+
"./vue/useStore": {
|
|
338
|
+
"types": "./dist/vue/useStore.d.ts",
|
|
339
|
+
"import": "./dist/vue/useStore.mjs"
|
|
340
|
+
},
|
|
341
|
+
"./vue/useStoreHistory": {
|
|
342
|
+
"types": "./dist/vue/useStoreHistory.d.ts",
|
|
343
|
+
"import": "./dist/vue/useStoreHistory.mjs"
|
|
275
344
|
}
|
|
276
345
|
}
|
|
277
346
|
}
|
package/dist/StoreProvider.mjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { StoreContext as e, StoreRegistryContext as t } from "./StoreContext.mjs";
|
|
2
|
-
import n from "./createStore/hooks/useStoreSync.mjs";
|
|
3
|
-
import r from "./createStore/index.mjs";
|
|
4
|
-
import { isServerSnapshot as i, stripServerFlag as a } from "./rsc/index.mjs";
|
|
5
|
-
import { createContext as o, useContext as s, useEffect as c, useMemo as l, useRef as u } from "react";
|
|
6
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
7
|
-
//#region src/StoreProvider.tsx
|
|
8
|
-
var f = o(void 0), p = (e) => e.cascade === !0, m = ({ store: o, id: m, path: h, value: g, inherit: _, autoSync: v = !0, middlewares: y, children: b }) => {
|
|
9
|
-
let x = s(e), S = s(f), C = s(t), w = u(void 0), T = _ === "live", E = l(() => {
|
|
10
|
-
let e = _ === "snapshot" && x ? x.getState() : {}, t = typeof g == "function" ? g(e) : {
|
|
11
|
-
...e,
|
|
12
|
-
...g
|
|
13
|
-
};
|
|
14
|
-
return i(t) ? a(t) : t;
|
|
15
|
-
}, [
|
|
16
|
-
_,
|
|
17
|
-
x,
|
|
18
|
-
g
|
|
19
|
-
]), D = y ?? [], O = S ? [...S, ...D] : D, k = l(() => [...S ?? [], ...D.filter(p)], [S, y]);
|
|
20
|
-
w.current ||= o ?? r(() => E, {
|
|
21
|
-
id: m,
|
|
22
|
-
parent: T ? x : void 0,
|
|
23
|
-
middlewares: O.length > 0 ? O : void 0,
|
|
24
|
-
deferHydrate: !0
|
|
25
|
-
});
|
|
26
|
-
let A = l(() => m ? {
|
|
27
|
-
id: m,
|
|
28
|
-
store: w.current,
|
|
29
|
-
parent: C
|
|
30
|
-
} : C, [m, C]);
|
|
31
|
-
u(!1), c(() => {}, [m, C]), c(() => (T && !o && w.current?.reconnect?.(), () => {
|
|
32
|
-
T && !o && w.current?.destroy?.();
|
|
33
|
-
}), [T, o]);
|
|
34
|
-
let j = u(!1);
|
|
35
|
-
c(() => {
|
|
36
|
-
!j.current && w.current?.hydrate && (w.current.hydrate(), j.current = !0);
|
|
37
|
-
}, []);
|
|
38
|
-
let M = !!g && v;
|
|
39
|
-
return n(h, h ? g : E, {
|
|
40
|
-
enabled: M && !!h,
|
|
41
|
-
store: w.current
|
|
42
|
-
}), n(void 0, E, {
|
|
43
|
-
enabled: M && !h,
|
|
44
|
-
store: w.current
|
|
45
|
-
}), /* @__PURE__ */ d(f, {
|
|
46
|
-
value: k.length > 0 ? k : void 0,
|
|
47
|
-
children: /* @__PURE__ */ d(t, {
|
|
48
|
-
value: A,
|
|
49
|
-
children: /* @__PURE__ */ d(e, {
|
|
50
|
-
value: w.current,
|
|
51
|
-
children: b
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
};
|
|
56
|
-
//#endregion
|
|
57
|
-
export { m as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useResolvedStore as e } from "../../createStore/hooks/shared.mjs";
|
|
2
|
-
import { getStoreHistory as t } from "../../middleware/historyMiddleware.mjs";
|
|
3
|
-
import { useEffect as n, useSyncExternalStore as r } from "react";
|
|
4
|
-
//#region src/history/hooks/useStoreHistory.ts
|
|
5
|
-
var i = {
|
|
6
|
-
entries: [],
|
|
7
|
-
index: -1,
|
|
8
|
-
canUndo: !1,
|
|
9
|
-
canRedo: !1
|
|
10
|
-
}, a = () => {}, o = () => a, s = () => i;
|
|
11
|
-
function c() {
|
|
12
|
-
let i = e(void 0, "useStoreHistory"), c = t(i);
|
|
13
|
-
n(() => {}, [c, i]);
|
|
14
|
-
let l = c?.getSnapshot ?? s;
|
|
15
|
-
return {
|
|
16
|
-
...r(c?.subscribe ?? o, l, l),
|
|
17
|
-
undo: c?.undo ?? a,
|
|
18
|
-
redo: c?.redo ?? a,
|
|
19
|
-
travelTo: c?.travelTo ?? a,
|
|
20
|
-
clear: c?.clear ?? a
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { c as useStoreHistory };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|