@buoy-gg/zustand 6.0.0 → 6.0.1

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 (2) hide show
  1. package/README.md +42 -114
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,138 +1,66 @@
1
1
  # @buoy-gg/zustand
2
2
 
3
- Zustand store DevTools for React Native. Live state change monitoring, state inspection, and diff visualization for your Zustand stores.
3
+ [![npm version](https://img.shields.io/npm/v/@buoy-gg/zustand?style=flat-square&labelColor=1c1c1c&color=10B981)](https://www.npmjs.com/package/@buoy-gg/zustand) [![npm downloads](https://img.shields.io/npm/dm/@buoy-gg/zustand?style=flat-square&labelColor=1c1c1c&color=10B981)](https://www.npmjs.com/package/@buoy-gg/zustand)
4
4
 
5
- ## Setup
5
+ **Zustand devtools on the device — state diffs, jump-to-state, and one-tap store reset with no middleware.**
6
+
7
+ Part of [Buoy](https://github.com/Buoy-gg/buoy) — devtools that live inside your React Native app. Install it and it auto-appears in the floating menu from [`@buoy-gg/core`](https://www.npmjs.com/package/@buoy-gg/core).
8
+
9
+ ## Install
6
10
 
7
11
  ```bash
8
- npm install @buoy-gg/zustand
12
+ npm install @buoy-gg/core @buoy-gg/zustand
9
13
  ```
10
14
 
11
- ### One line — zero store modifications
15
+ ## Quick start
16
+
17
+ 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.
12
18
 
13
19
  ```tsx
14
- import { watchStores } from '@buoy-gg/zustand';
20
+ import { FloatingDevTools } from '@buoy-gg/core';
15
21
  import { useCounterStore } from './stores/counter';
16
22
  import { useAuthStore } from './stores/auth';
17
23
  import { useCartStore } from './stores/cart';
18
24
 
19
- // Call once at module scope (e.g. in _layout.tsx or App.tsx):
20
- watchStores({
21
- counterStore: useCounterStore,
22
- authStore: useAuthStore,
23
- cartStore: useCartStore,
24
- });
25
+ export default function App() {
26
+ return (
27
+ <>
28
+ <YourApp />
29
+ <FloatingDevTools
30
+ zustandStores={{
31
+ counterStore: useCounterStore,
32
+ authStore: useAuthStore,
33
+ cartStore: useCartStore,
34
+ }}
35
+ />
36
+ </>
37
+ );
38
+ }
25
39
  ```
26
40
 
27
- That's it. The Zustand tool appears automatically in FloatingDevTools.
28
-
29
- Your stores stay completely untouched — `watchStores` uses Zustand's built-in `.subscribe()` to observe changes from the outside. It never modifies `setState` or any store internals.
41
+ Prefer to wire it outside React? `watchStores({ counterStore: useCounterStore })` from `@buoy-gg/zustand` does the same thing at module scope.
30
42
 
31
- ### Safe by design
43
+ ## What you get
32
44
 
33
- - **Add in seconds** — one import, one function call
34
- - **Remove in seconds** — delete those two lines, done
35
- - **Cannot break your stores** — all listener code is wrapped in try/catch. Even if our code has a bug, your stores keep working normally
36
- - **No monkey-patching** — we call `.subscribe()`, the same API your own components use
45
+ - **Every state change, captured** — store name, update type (`setState`, `replace`, `persist`, `initial`), changed keys, and a diff summary
46
+ - **Side-by-side diffs** — additions, removals, and modifications highlighted, in tree or split view
47
+ - **Jump to state** — restore any store to a previously captured state instantly
48
+ - **One-tap reset** — send any store back to its initial state without restarting the app
49
+ - **Persist awareness** — stores using Zustand's `persist` middleware are auto-detected and tagged
50
+ - **Store color coding** — each store keeps a consistent color across the UI for easy tracking
51
+ - **Search & filter** — find changes by store name or changed keys, or show only updates that modified state
52
+ - **Optional `buoyDevTools()` middleware** — wrap individual stores for partial-state capture and per-update timing (flags updates over the 16ms frame budget)
37
53
 
38
- ### Cleanup (optional)
54
+ ## Desktop & AI
39
55
 
40
- ```tsx
41
- const cleanup = watchStores({ ... });
56
+ The same live session streams to [Buoy Desktop](https://github.com/Buoy-gg/Buoy-Desktop) (free, macOS/Windows/Linux) and to Claude Code or Cursor via the [Buoy MCP server](https://buoy.gg/buoy/latest/docs/mcp).
42
57
 
43
- // Later, to stop watching:
44
- cleanup();
45
- ```
58
+ ## Free vs Pro
46
59
 
47
- ## Advanced: middleware mode
60
+ Every tool is free. [Pro](https://buoy.gg/pricing) unlocks production builds, the MCP server, and unlimited capture. Every weekend, Pro features unlock free for everyone.
48
61
 
49
- If you want extra detail (the exact partial passed to `setState` and precise timing), you can opt into the middleware approach per-store:
62
+ ---
50
63
 
51
- ```tsx
52
- import { create } from 'zustand';
53
- import { buoyDevTools } from '@buoy-gg/zustand';
54
-
55
- const useCounterStore = create(
56
- buoyDevTools(
57
- (set) => ({
58
- count: 0,
59
- increment: () => set((s) => ({ count: s.count + 1 })),
60
- }),
61
- { name: 'counterStore' }
62
- )
63
- );
64
- ```
64
+ 📚 [Full docs](https://buoy.gg/buoy/latest/docs/tools/zustand) · [All Buoy tools](https://github.com/Buoy-gg/buoy)
65
65
 
66
- This wraps `setState` internally, so it captures what was passed and how long it took. Works with middleware chaining (persist, immer, etc.):
67
-
68
- ```tsx
69
- import { persist } from 'zustand/middleware';
70
-
71
- const useAuthStore = create(
72
- buoyDevTools(
73
- persist(
74
- (set) => ({ user: null, login: (u) => set({ user: u }) }),
75
- { name: 'auth-storage' }
76
- ),
77
- { name: 'authStore' }
78
- )
79
- );
80
- ```
81
-
82
- ## Features
83
-
84
- - **Live state change capture** — every state update is recorded with prev/next state
85
- - **State inspection** — full JSON viewer for state after each change
86
- - **State diffing** — tree view and split view comparing previous vs. next state
87
- - **Changed keys tracking** — see exactly which top-level keys changed per update
88
- - **Store color coding** — each store gets a consistent color for easy visual tracking
89
- - **Performance monitoring** — updates slower than 16ms are flagged (middleware mode)
90
- - **Persist awareness** — auto-detects stores using Zustand's persist middleware
91
- - **Search & filter** — search by store name or changed keys, filter to only state-changing updates
92
- - **Jump to state** — restore any store to a previously captured state
93
- - **Reset store** — reset any store to its initial state
94
- - **Copy to clipboard** — copy state data (Pro)
95
-
96
- ## Comparison
97
-
98
- | | `watchStores()` | `buoyDevTools()` middleware |
99
- |---|---|---|
100
- | Setup | One line, no store changes | Wrap each store's `create()` |
101
- | Risk | Zero — uses subscribe only | Low — wraps setState |
102
- | Captures partial | No | Yes |
103
- | Captures timing | No | Yes |
104
- | State diff | Yes | Yes |
105
- | Changed keys | Yes | Yes |
106
- | Persist detection | Yes | Yes |
107
-
108
- ## Exports
109
-
110
- ```tsx
111
- // Primary — non-intrusive
112
- import { watchStores } from '@buoy-gg/zustand';
113
-
114
- // Advanced — middleware
115
- import { buoyDevTools } from '@buoy-gg/zustand';
116
-
117
- // Preset
118
- import { zustandToolPreset, createZustandTool } from '@buoy-gg/zustand';
119
-
120
- // Hook
121
- import { useZustandStateChanges } from '@buoy-gg/zustand';
122
-
123
- // Components (for custom UIs)
124
- import {
125
- ZustandModal,
126
- ZustandStateChangeItem,
127
- ZustandStateDetailContent,
128
- ZustandIcon,
129
- } from '@buoy-gg/zustand';
130
-
131
- // Types
132
- import type {
133
- ZustandStateChange,
134
- ZustandStoreInfo,
135
- ZustandFilter,
136
- StateChangeCategory,
137
- } from '@buoy-gg/zustand';
138
- ```
66
+ Proprietary software. © Buoy LLC. [Terms](https://buoy.gg/terms)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/zustand",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Zustand store DevTools for React Native",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -26,8 +26,8 @@
26
26
  ],
27
27
  "sideEffects": false,
28
28
  "dependencies": {
29
- "@buoy-gg/shared-ui": "6.0.0",
30
- "@buoy-gg/license": "6.0.0"
29
+ "@buoy-gg/shared-ui": "6.0.1",
30
+ "@buoy-gg/license": "6.0.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "*",