@buoy-gg/zustand 7.0.36 → 7.0.39
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 +27 -5
- package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +3 -1
- package/lib/commonjs/zustand/utils/editableState.js +8 -1
- package/lib/commonjs/zustand/utils/zustandStateStore.js +4 -0
- package/lib/module/zustand/hooks/useZustandStateChanges.js +3 -1
- package/lib/module/zustand/utils/editableState.js +8 -1
- package/lib/module/zustand/utils/zustandStateStore.js +4 -0
- package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts.map +1 -1
- package/lib/typescript/zustand/utils/editableState.d.ts.map +1 -1
- package/lib/typescript/zustand/utils/zustandStateStore.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@buoy-gg/zustand) [](https://www.npmjs.com/package/@buoy-gg/zustand)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Inspect the Zustand stores you register with Buoy. Review changes, edit state, and restore retained snapshots.
|
|
6
6
|
|
|
7
|
-
Part of [Buoy](https://github.com/Buoy-gg/buoy)
|
|
7
|
+
Part of [Buoy](https://github.com/Buoy-gg/buoy). Install the package, complete account setup, and follow the integration steps below.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -12,6 +12,24 @@ Part of [Buoy](https://github.com/Buoy-gg/buoy) — devtools that live inside yo
|
|
|
12
12
|
npm install @buoy-gg/core @buoy-gg/zustand
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
## Before you start
|
|
16
|
+
|
|
17
|
+
Use a development build with `@buoy-gg/core` and a Free or Pro Buoy account key. From your app’s directory, sign in:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx --package=@buoy-gg/core buoy login
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
For Expo, initialize Buoy before rendering the menu:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Buoy } from "@buoy-gg/core";
|
|
27
|
+
|
|
28
|
+
Buoy.init({ licenseKey: process.env.EXPO_PUBLIC_BUOY_KEY });
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The login command writes the Expo key to `.env.local`. For React Native CLI, pass the key from your app’s environment configuration; React Native does not load `.env.local` automatically. Mount `FloatingDevTools` inside the same providers as your screens and restart the development server after installation. The [Quick Start](https://buoy.gg/buoy/latest/docs/quick-start) shows the complete root component setup.
|
|
32
|
+
|
|
15
33
|
## Quick start
|
|
16
34
|
|
|
17
35
|
Pass your stores to `FloatingDevTools` via the `zustandStores` prop — a named map of your store hooks. No middleware, no store changes; observation is subscribe-only, so your stores stay untouched.
|
|
@@ -40,6 +58,10 @@ export default function App() {
|
|
|
40
58
|
|
|
41
59
|
Prefer to wire it outside React? `watchStores({ counterStore: useCounterStore })` from `@buoy-gg/zustand` does the same thing at module scope.
|
|
42
60
|
|
|
61
|
+
## Check the integration
|
|
62
|
+
|
|
63
|
+
Change a value in a registered store through your app and find its diff in Buoy. Edits and resets change the real store; test with disposable data. Register the same store instances that your screens use.
|
|
64
|
+
|
|
43
65
|
## What you get
|
|
44
66
|
|
|
45
67
|
- **Every state change, captured** — store name, update type (`setState`, `replace`, `persist`, `initial`), changed keys, and a diff summary
|
|
@@ -53,11 +75,11 @@ Prefer to wire it outside React? `watchStores({ counterStore: useCounterStore })
|
|
|
53
75
|
|
|
54
76
|
## Desktop & AI
|
|
55
77
|
|
|
56
|
-
|
|
78
|
+
To connect a React Native app to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) or MCP, install `@buoy-gg/external-sync` and follow the [Desktop connection guide](https://buoy.gg/buoy/latest/docs/desktop). Sign in to Desktop separately. [MCP setup](https://buoy.gg/buoy/latest/docs/mcp) also requires a process account and Pro access. Available remote actions depend on the tool and app integration.
|
|
57
79
|
|
|
58
|
-
##
|
|
80
|
+
## Account and plan requirements
|
|
59
81
|
|
|
60
|
-
|
|
82
|
+
Use a Free or Pro Buoy account. History limits and paid features vary by tool; see [pricing](https://buoy.gg/pricing). Production access requires Pro where supported. Development-only hooks and actions remain unavailable in release builds.
|
|
61
83
|
|
|
62
84
|
---
|
|
63
85
|
|
|
@@ -63,7 +63,9 @@ function useZustandStateChanges() {
|
|
|
63
63
|
setFilter: log.setFilter,
|
|
64
64
|
stats,
|
|
65
65
|
stores,
|
|
66
|
-
|
|
66
|
+
// Not the shared log.clear: the store also owns each store's change
|
|
67
|
+
// count, and only clearStateChanges resets those with the list.
|
|
68
|
+
clearChanges: _zustandStateStore.zustandStateStore.clearStateChanges.bind(_zustandStateStore.zustandStateStore),
|
|
67
69
|
isEnabled: log.isEnabled,
|
|
68
70
|
toggleCapture: log.toggleCapture,
|
|
69
71
|
storeNames,
|
|
@@ -33,7 +33,14 @@ exports.stripFunctions = stripFunctions;
|
|
|
33
33
|
/** Bounds every recursive walk over store state. */
|
|
34
34
|
const STRIP_MAX_DEPTH = exports.STRIP_MAX_DEPTH = 8;
|
|
35
35
|
function isPlainObjectLike(v) {
|
|
36
|
-
|
|
36
|
+
// Only objects whose own enumerable keys ARE their data. A Map, Set, Date,
|
|
37
|
+
// RegExp or typed array has none, so walking it with Object.entries turns
|
|
38
|
+
// it into `{}` — which is how a restored store once got `{}` where the app
|
|
39
|
+
// kept a Map and crashed on `.values()`. Those go through as-is; the vault's
|
|
40
|
+
// superjson knows how to carry them.
|
|
41
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
|
|
42
|
+
const proto = Object.getPrototypeOf(v);
|
|
43
|
+
return proto === Object.prototype || proto === null;
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
/** Clone `value` without functions, recording their paths. */
|
|
@@ -133,6 +133,10 @@ class ZustandStateStore extends _sharedUi.ChangeLog {
|
|
|
133
133
|
store.stateChangeCount = 0;
|
|
134
134
|
}
|
|
135
135
|
this.clear();
|
|
136
|
+
// The browser keeps its store list in React state and only re-reads it
|
|
137
|
+
// on a store notification — `clear()` above only tells the change-log
|
|
138
|
+
// listeners, so without this the cards kept their old counts after Clear.
|
|
139
|
+
this.notifyStoreListeners();
|
|
136
140
|
}
|
|
137
141
|
|
|
138
142
|
// ---- Remote Mirror Mode ----
|
|
@@ -59,7 +59,9 @@ export function useZustandStateChanges() {
|
|
|
59
59
|
setFilter: log.setFilter,
|
|
60
60
|
stats,
|
|
61
61
|
stores,
|
|
62
|
-
|
|
62
|
+
// Not the shared log.clear: the store also owns each store's change
|
|
63
|
+
// count, and only clearStateChanges resets those with the list.
|
|
64
|
+
clearChanges: zustandStateStore.clearStateChanges.bind(zustandStateStore),
|
|
63
65
|
isEnabled: log.isEnabled,
|
|
64
66
|
toggleCapture: log.toggleCapture,
|
|
65
67
|
storeNames,
|
|
@@ -25,7 +25,14 @@
|
|
|
25
25
|
/** Bounds every recursive walk over store state. */
|
|
26
26
|
export const STRIP_MAX_DEPTH = 8;
|
|
27
27
|
export function isPlainObjectLike(v) {
|
|
28
|
-
|
|
28
|
+
// Only objects whose own enumerable keys ARE their data. A Map, Set, Date,
|
|
29
|
+
// RegExp or typed array has none, so walking it with Object.entries turns
|
|
30
|
+
// it into `{}` — which is how a restored store once got `{}` where the app
|
|
31
|
+
// kept a Map and crashed on `.values()`. Those go through as-is; the vault's
|
|
32
|
+
// superjson knows how to carry them.
|
|
33
|
+
if (typeof v !== "object" || v === null || Array.isArray(v)) return false;
|
|
34
|
+
const proto = Object.getPrototypeOf(v);
|
|
35
|
+
return proto === Object.prototype || proto === null;
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
/** Clone `value` without functions, recording their paths. */
|
|
@@ -129,6 +129,10 @@ class ZustandStateStore extends ChangeLog {
|
|
|
129
129
|
store.stateChangeCount = 0;
|
|
130
130
|
}
|
|
131
131
|
this.clear();
|
|
132
|
+
// The browser keeps its store list in React state and only re-reads it
|
|
133
|
+
// on a store notification — `clear()` above only tells the change-log
|
|
134
|
+
// listeners, so without this the cards kept their old counts after Clear.
|
|
135
|
+
this.notifyStoreListeners();
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
// ---- Remote Mirror Mode ----
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useZustandStateChanges.d.ts","sourceRoot":"","sources":["../../../../src/zustand/hooks/useZustandStateChanges.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,4BAA4B;IAC3C,iCAAiC;IACjC,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,qDAAqD;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,8BAA8B;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,6BAA6B;IAC7B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,wCAAwC;IACxC,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,yBAAyB,EAAE,MAAM,CAAC;QAClC,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,4BAA4B;IAC5B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,uCAAuC;IACvC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,6BAA6B;IAC7B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;CAC/D;AAiCD,wBAAgB,sBAAsB,IAAI,4BAA4B,
|
|
1
|
+
{"version":3,"file":"useZustandStateChanges.d.ts","sourceRoot":"","sources":["../../../../src/zustand/hooks/useZustandStateChanges.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAGlB,MAAM,WAAW,4BAA4B;IAC3C,iCAAiC;IACjC,YAAY,EAAE,kBAAkB,EAAE,CAAC;IACnC,qDAAqD;IACrD,eAAe,EAAE,kBAAkB,EAAE,CAAC;IACtC,8BAA8B;IAC9B,MAAM,EAAE,aAAa,CAAC;IACtB,6BAA6B;IAC7B,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;IAC/D,wCAAwC;IACxC,KAAK,EAAE;QACL,YAAY,EAAE,MAAM,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,yBAAyB,EAAE,MAAM,CAAC;QAClC,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,4BAA4B;IAC5B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,uCAAuC;IACvC,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,iCAAiC;IACjC,SAAS,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,aAAa,EAAE,MAAM,IAAI,CAAC;IAC1B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,6BAA6B;IAC7B,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;CAC/D;AAiCD,wBAAgB,sBAAsB,IAAI,4BAA4B,CA4CrE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editableState.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/editableState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"editableState.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/editableState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAS1E;AAED,8DAA8D;AAC9D,wBAAgB,cAAc,CAC5B,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,EACrB,KAAK,EAAE,MAAM,GACZ,OAAO,CA2BT;AAED,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,iFAAiF;IACjF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,0DAA0D;IAC1D,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,CAsClE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zustandStateStore.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/zustandStateStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAyClB,cAAM,iBAAkB,SAAQ,SAAS,CAAC,kBAAkB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CACV;IACZ,OAAO,CAAC,qBAAqB,CAEb;IAIhB,cAAc,CAAC,MAAM,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,SAAS,EAAE,OAAO,CAAC;QACnB,SAAS,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,mBAAmB,CAAC;QAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,GAAG,IAAI;IA2DR,eAAe,IAAI,kBAAkB,EAAE;IAIvC,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAI9D,iBAAiB,IAAI,IAAI;
|
|
1
|
+
{"version":3,"file":"zustandStateStore.d.ts","sourceRoot":"","sources":["../../../../src/zustand/utils/zustandStateStore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EAIV,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAyClB,cAAM,iBAAkB,SAAQ,SAAS,CAAC,kBAAkB,CAAC;IAC3D,OAAO,CAAC,MAAM,CAA4C;IAC1D,OAAO,CAAC,cAAc,CACV;IACZ,OAAO,CAAC,qBAAqB,CAEb;IAIhB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EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KACxC,GACA,IAAI;IAiBP,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKnC,SAAS,IAAI,gBAAgB,EAAE;IAI/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS;IAIpD,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAMnC,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,kBAAkB,EAAE;IA4B/D,QAAQ;;;;;;;IAsBR,mBAAmB,IAAI,MAAM,EAAE;IAM/B,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMhC,iBAAiB,CACf,QAAQ,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,KAAK,IAAI,GAC7C,MAAM,IAAI;IAOb,OAAO,CAAC,oBAAoB;CAI7B;AAED,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/zustand",
|
|
3
|
-
"version": "7.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.0.39",
|
|
4
|
+
"description": "Inspect registered Zustand stores, compare captured state changes and use supported reset or state-update actions.",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"**/snapshotProvider.ts"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@buoy-gg/
|
|
33
|
-
"@buoy-gg/
|
|
32
|
+
"@buoy-gg/license": "^7.0.39",
|
|
33
|
+
"@buoy-gg/shared-ui": "^7.0.39"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "*",
|