@buoy-gg/zustand 2.1.11 → 2.1.13

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 (57) hide show
  1. package/LICENSE +58 -0
  2. package/lib/commonjs/index.js +1 -91
  3. package/lib/commonjs/preset.js +1 -102
  4. package/lib/commonjs/zustand/components/ZustandActionButton.js +1 -116
  5. package/lib/commonjs/zustand/components/ZustandDetailViewToggle.js +1 -134
  6. package/lib/commonjs/zustand/components/ZustandEventFilterView.js +1 -291
  7. package/lib/commonjs/zustand/components/ZustandIcon.js +1 -35
  8. package/lib/commonjs/zustand/components/ZustandModal.js +1 -603
  9. package/lib/commonjs/zustand/components/ZustandStateChangeItem.js +1 -165
  10. package/lib/commonjs/zustand/components/ZustandStateDetailContent.js +1 -352
  11. package/lib/commonjs/zustand/components/ZustandStateInfoView.js +1 -508
  12. package/lib/commonjs/zustand/components/ZustandStoreBrowser.js +1 -307
  13. package/lib/commonjs/zustand/components/index.js +1 -73
  14. package/lib/commonjs/zustand/hooks/index.js +1 -12
  15. package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +1 -92
  16. package/lib/commonjs/zustand/index.js +1 -99
  17. package/lib/commonjs/zustand/utils/buoyZustandMiddleware.js +1 -220
  18. package/lib/commonjs/zustand/utils/index.js +1 -31
  19. package/lib/commonjs/zustand/utils/zustandStateStore.js +1 -361
  20. package/lib/module/index.js +1 -80
  21. package/lib/module/preset.js +1 -98
  22. package/lib/module/zustand/components/ZustandActionButton.js +1 -112
  23. package/lib/module/zustand/components/ZustandDetailViewToggle.js +1 -129
  24. package/lib/module/zustand/components/ZustandEventFilterView.js +1 -287
  25. package/lib/module/zustand/components/ZustandIcon.js +1 -32
  26. package/lib/module/zustand/components/ZustandModal.js +1 -599
  27. package/lib/module/zustand/components/ZustandStateChangeItem.js +1 -161
  28. package/lib/module/zustand/components/ZustandStateDetailContent.js +1 -348
  29. package/lib/module/zustand/components/ZustandStateInfoView.js +1 -503
  30. package/lib/module/zustand/components/ZustandStoreBrowser.js +1 -303
  31. package/lib/module/zustand/components/index.js +1 -10
  32. package/lib/module/zustand/hooks/index.js +1 -3
  33. package/lib/module/zustand/hooks/useZustandStateChanges.js +1 -88
  34. package/lib/module/zustand/index.js +1 -12
  35. package/lib/module/zustand/utils/buoyZustandMiddleware.js +1 -214
  36. package/lib/module/zustand/utils/index.js +1 -4
  37. package/lib/module/zustand/utils/zustandStateStore.js +1 -357
  38. package/package.json +10 -10
  39. package/lib/typescript/index.d.ts.map +0 -1
  40. package/lib/typescript/preset.d.ts.map +0 -1
  41. package/lib/typescript/zustand/components/ZustandActionButton.d.ts.map +0 -1
  42. package/lib/typescript/zustand/components/ZustandDetailViewToggle.d.ts.map +0 -1
  43. package/lib/typescript/zustand/components/ZustandEventFilterView.d.ts.map +0 -1
  44. package/lib/typescript/zustand/components/ZustandIcon.d.ts.map +0 -1
  45. package/lib/typescript/zustand/components/ZustandModal.d.ts.map +0 -1
  46. package/lib/typescript/zustand/components/ZustandStateChangeItem.d.ts.map +0 -1
  47. package/lib/typescript/zustand/components/ZustandStateDetailContent.d.ts.map +0 -1
  48. package/lib/typescript/zustand/components/ZustandStateInfoView.d.ts.map +0 -1
  49. package/lib/typescript/zustand/components/ZustandStoreBrowser.d.ts.map +0 -1
  50. package/lib/typescript/zustand/components/index.d.ts.map +0 -1
  51. package/lib/typescript/zustand/hooks/index.d.ts.map +0 -1
  52. package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts.map +0 -1
  53. package/lib/typescript/zustand/index.d.ts.map +0 -1
  54. package/lib/typescript/zustand/types/index.d.ts.map +0 -1
  55. package/lib/typescript/zustand/utils/buoyZustandMiddleware.d.ts.map +0 -1
  56. package/lib/typescript/zustand/utils/index.d.ts.map +0 -1
  57. package/lib/typescript/zustand/utils/zustandStateStore.d.ts.map +0 -1
@@ -1,307 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ZustandStoreBrowser = ZustandStoreBrowser;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
11
- var _zustandStateStore = require("../utils/zustandStateStore");
12
- var _jsxRuntime = require("react/jsx-runtime");
13
- /**
14
- * ZustandStoreBrowser
15
- *
16
- * Browse tab — shows all registered Zustand stores and their current state.
17
- * Mirrors the Storage Browser pattern from @buoy-gg/storage.
18
- *
19
- * Each store is shown as an expandable row with its current state viewable
20
- * via the shared DataViewer component.
21
- */
22
-
23
- /**
24
- * Get a preview of the store's top-level keys
25
- */
26
- function getKeysPreview(store) {
27
- try {
28
- const state = store.api.getState();
29
- if (state && typeof state === "object") {
30
- const keys = Object.keys(state);
31
- const dataKeys = keys.filter(k => {
32
- const val = state[k];
33
- return typeof val !== "function";
34
- });
35
- if (dataKeys.length === 0) return "no data keys";
36
- if (dataKeys.length <= 3) return dataKeys.join(", ");
37
- return `${dataKeys.slice(0, 2).join(", ")} +${dataKeys.length - 2}`;
38
- }
39
- return "";
40
- } catch {
41
- return "";
42
- }
43
- }
44
- function StoreExpandedContent({
45
- store,
46
- onViewHistory
47
- }) {
48
- const state = store.api.getState();
49
- const displayState = (0, _react.useMemo)(() => {
50
- if (state && typeof state === "object") {
51
- const filtered = {};
52
- for (const [key, value] of Object.entries(state)) {
53
- if (typeof value !== "function") {
54
- filtered[key] = value;
55
- }
56
- }
57
- return (0, _sharedUi.parseValue)(filtered);
58
- }
59
- return (0, _sharedUi.parseValue)(state);
60
- }, [state]);
61
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
62
- style: expandedStyles.container,
63
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow, {
64
- label: "Type",
65
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.PillBadge, {
66
- color: store.color,
67
- children: "ZUSTAND"
68
- })
69
- }), store.stateChangeCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.ExpandedInfoRow, {
70
- label: "Changes",
71
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.PillBadge, {
72
- color: _sharedUi.buoyColors.warning,
73
- children: String(store.stateChangeCount)
74
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
75
- onPress: () => onViewHistory(store.name),
76
- style: expandedStyles.viewHistoryButton,
77
- hitSlop: {
78
- top: 6,
79
- bottom: 6,
80
- left: 6,
81
- right: 6
82
- },
83
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
84
- style: [expandedStyles.viewHistoryText, {
85
- color: store.color
86
- }],
87
- children: "view history \u2192"
88
- })
89
- })]
90
- }), store.isPersisted && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow, {
91
- label: "Persist",
92
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.PillBadge, {
93
- color: _sharedUi.buoyColors.info,
94
- icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Database, {
95
- size: 9,
96
- color: _sharedUi.buoyColors.info
97
- }),
98
- children: store.persistName || "persisted"
99
- })
100
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
101
- style: expandedStyles.dataContainer,
102
- children: displayState && typeof displayState === "object" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
103
- title: "",
104
- data: displayState,
105
- showTypeFilter: true,
106
- rawMode: true,
107
- initialExpanded: true
108
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
109
- style: expandedStyles.emptyText,
110
- children: "Empty state"
111
- })
112
- })]
113
- });
114
- }
115
- function EmptyBrowserState() {
116
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
117
- style: styles.emptyState,
118
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Box, {
119
- size: 32,
120
- color: _sharedUi.macOSColors.text.muted
121
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
122
- style: styles.emptyTitle,
123
- children: "No stores registered"
124
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
125
- style: styles.emptyText,
126
- children: "Use watchStores() to register your Zustand stores.\nThey will appear here with their current state."
127
- })]
128
- });
129
- }
130
- function ZustandStoreBrowser({
131
- stores,
132
- searchQuery,
133
- onViewHistory
134
- }) {
135
- const [expandedStore, setExpandedStore] = (0, _react.useState)(null);
136
-
137
- // Filter stores by search query
138
- const filteredStores = (0, _react.useMemo)(() => {
139
- if (!searchQuery) return stores;
140
- const search = searchQuery.toLowerCase();
141
- return stores.filter(s => s.name.toLowerCase().includes(search) || s.persistName && s.persistName.toLowerCase().includes(search));
142
- }, [stores, searchQuery]);
143
- const handleStorePress = (0, _react.useCallback)(store => {
144
- setExpandedStore(prev => prev === store.name ? null : store.name);
145
- }, []);
146
- if (filteredStores.length === 0 && !searchQuery) {
147
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyBrowserState, {});
148
- }
149
- if (filteredStores.length === 0 && searchQuery) {
150
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
151
- style: styles.emptyState,
152
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
153
- style: styles.emptyTitle,
154
- children: "No matching stores"
155
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
156
- style: styles.emptyText,
157
- children: ["No stores match \"", searchQuery, "\""]
158
- })]
159
- });
160
- }
161
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
162
- style: styles.container,
163
- contentContainerStyle: styles.scrollContent,
164
- showsVerticalScrollIndicator: true,
165
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
166
- style: styles.sectionHeader,
167
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
168
- style: styles.sectionTitle,
169
- children: "STORES"
170
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
171
- style: styles.sectionCountBadge,
172
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
173
- style: styles.sectionCountText,
174
- children: filteredStores.length
175
- })
176
- })]
177
- }), filteredStores.map(store => {
178
- const isExpanded = expandedStore === store.name;
179
- const keysPreview = getKeysPreview(store);
180
- const storeColor = _zustandStateStore.zustandStateStore.getStoreColor(store.name);
181
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
182
- style: styles.storeRowWrapper,
183
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompactRow, {
184
- statusDotColor: storeColor,
185
- statusLabel: store.name,
186
- statusSublabel: store.isPersisted ? "persisted" : "in-memory",
187
- primaryText: keysPreview,
188
- showChevron: true,
189
- isExpanded: isExpanded,
190
- onPress: () => handleStorePress(store),
191
- expandedContent: isExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StoreExpandedContent, {
192
- store: store,
193
- onViewHistory: onViewHistory
194
- }) : undefined
195
- }), store.stateChangeCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
196
- style: [styles.absCountBadge, {
197
- backgroundColor: storeColor + "22",
198
- borderColor: storeColor + "55"
199
- }],
200
- pointerEvents: "none",
201
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
202
- style: [styles.absCountText, {
203
- color: storeColor
204
- }],
205
- children: String(store.stateChangeCount)
206
- })
207
- })]
208
- }, store.name);
209
- })]
210
- });
211
- }
212
- const styles = _reactNative.StyleSheet.create({
213
- container: {
214
- flex: 1
215
- },
216
- storeRowWrapper: {
217
- position: "relative"
218
- },
219
- absCountBadge: {
220
- position: "absolute",
221
- top: 4,
222
- right: 10,
223
- paddingHorizontal: 5,
224
- paddingVertical: 1,
225
- borderRadius: 4,
226
- borderWidth: 1,
227
- zIndex: 1
228
- },
229
- absCountText: {
230
- fontSize: 9,
231
- fontWeight: "700",
232
- fontFamily: "monospace"
233
- },
234
- scrollContent: {
235
- paddingTop: 8,
236
- paddingBottom: 20
237
- },
238
- sectionHeader: {
239
- flexDirection: "row",
240
- alignItems: "center",
241
- paddingHorizontal: 16,
242
- paddingVertical: 8,
243
- gap: 8
244
- },
245
- sectionTitle: {
246
- fontSize: 11,
247
- fontWeight: "700",
248
- letterSpacing: 0.5,
249
- color: _sharedUi.macOSColors.text.muted
250
- },
251
- sectionCountBadge: {
252
- backgroundColor: _sharedUi.buoyColors.primary + "26",
253
- paddingHorizontal: 8,
254
- paddingVertical: 2,
255
- borderRadius: 4
256
- },
257
- sectionCountText: {
258
- fontSize: 10,
259
- fontWeight: "700",
260
- color: _sharedUi.buoyColors.primary,
261
- fontFamily: "monospace"
262
- },
263
- emptyState: {
264
- alignItems: "center",
265
- paddingVertical: 40
266
- },
267
- emptyTitle: {
268
- color: _sharedUi.macOSColors.text.primary,
269
- fontSize: 14,
270
- fontWeight: "600",
271
- marginTop: 12,
272
- marginBottom: 6
273
- },
274
- emptyText: {
275
- color: _sharedUi.macOSColors.text.muted,
276
- fontSize: 12,
277
- textAlign: "center",
278
- lineHeight: 18
279
- }
280
- });
281
- const expandedStyles = _reactNative.StyleSheet.create({
282
- container: {
283
- gap: 10
284
- },
285
- viewHistoryButton: {
286
- marginLeft: 4
287
- },
288
- viewHistoryText: {
289
- fontSize: 10,
290
- fontWeight: "600",
291
- fontFamily: "monospace"
292
- },
293
- dataContainer: {
294
- backgroundColor: _sharedUi.buoyColors.base,
295
- borderRadius: 6,
296
- borderWidth: 1,
297
- borderColor: _sharedUi.buoyColors.border,
298
- overflow: "hidden",
299
- minHeight: 60
300
- },
301
- emptyText: {
302
- color: _sharedUi.buoyColors.textMuted,
303
- fontSize: 12,
304
- padding: 14,
305
- fontStyle: "italic"
306
- }
307
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ZustandStoreBrowser=ZustandStoreBrowser;var _react=require("react"),_reactNative=require("react-native"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_zustandStateStore=require("../utils/zustandStateStore"),_jsxRuntime=require("react/jsx-runtime");function getKeysPreview(e){try{const t=e.api.getState();if(t&&"object"==typeof t){const e=Object.keys(t).filter(e=>"function"!=typeof t[e]);return 0===e.length?"no data keys":e.length<=3?e.join(", "):`${e.slice(0,2).join(", ")} +${e.length-2}`}return""}catch{return""}}function StoreExpandedContent({store:e,onViewHistory:t}){const s=e.api.getState(),r=(0,_react.useMemo)(()=>{if(s&&"object"==typeof s){const e={};for(const[t,r]of Object.entries(s))"function"!=typeof r&&(e[t]=r);return(0,_sharedUi.parseValue)(e)}return(0,_sharedUi.parseValue)(s)},[s]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:expandedStyles.container,children:[(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Type",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:e.color,children:"ZUSTAND"})}),e.stateChangeCount>0&&(0,_jsxRuntime.jsxs)(_sharedUi.ExpandedInfoRow,{label:"Changes",children:[(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.buoyColors.warning,children:String(e.stateChangeCount)}),(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>t(e.name),style:expandedStyles.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[expandedStyles.viewHistoryText,{color:e.color}],children:"view history →"})})]}),e.isPersisted&&(0,_jsxRuntime.jsx)(_sharedUi.ExpandedInfoRow,{label:"Persist",children:(0,_jsxRuntime.jsx)(_sharedUi.PillBadge,{color:_sharedUi.buoyColors.info,icon:(0,_jsxRuntime.jsx)(_sharedUi.Database,{size:9,color:_sharedUi.buoyColors.info}),children:e.persistName||"persisted"})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:expandedStyles.dataContainer,children:r&&"object"==typeof r?(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:r,showTypeFilter:!0,rawMode:!0,initialExpanded:!0}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:expandedStyles.emptyText,children:"Empty state"})})]})}function EmptyBrowserState(){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_sharedUi.Box,{size:32,color:_sharedUi.macOSColors.text.muted}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No stores registered"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyText,children:"Use watchStores() to register your Zustand stores.\nThey will appear here with their current state."})]})}function ZustandStoreBrowser({stores:e,searchQuery:t,onViewHistory:s}){const[r,i]=(0,_react.useState)(null),o=(0,_react.useMemo)(()=>{if(!t)return e;const s=t.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(s)||e.persistName&&e.persistName.toLowerCase().includes(s))},[e,t]),n=(0,_react.useCallback)(e=>{i(t=>t===e.name?null:e.name)},[]);return 0!==o.length||t?0===o.length&&t?(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyTitle,children:"No matching stores"}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.emptyText,children:['No stores match "',t,'"']})]}):(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!0,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORES"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionCountBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionCountText,children:o.length})})]}),o.map(e=>{const t=r===e.name,i=getKeysPreview(e),o=_zustandStateStore.zustandStateStore.getStoreColor(e.name);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.storeRowWrapper,children:[(0,_jsxRuntime.jsx)(_sharedUi.CompactRow,{statusDotColor:o,statusLabel:e.name,statusSublabel:e.isPersisted?"persisted":"in-memory",primaryText:i,showChevron:!0,isExpanded:t,onPress:()=>n(e),expandedContent:t?(0,_jsxRuntime.jsx)(StoreExpandedContent,{store:e,onViewHistory:s}):void 0}),e.stateChangeCount>0&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.absCountBadge,{backgroundColor:o+"22",borderColor:o+"55"}],pointerEvents:"none",children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.absCountText,{color:o}],children:String(e.stateChangeCount)})})]},e.name)})]}):(0,_jsxRuntime.jsx)(EmptyBrowserState,{})}const styles=_reactNative.StyleSheet.create({container:{flex:1},storeRowWrapper:{position:"relative"},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountText:{fontSize:9,fontWeight:"700",fontFamily:"monospace"},scrollContent:{paddingTop:8,paddingBottom:20},sectionHeader:{flexDirection:"row",alignItems:"center",paddingHorizontal:16,paddingVertical:8,gap:8},sectionTitle:{fontSize:11,fontWeight:"700",letterSpacing:.5,color:_sharedUi.macOSColors.text.muted},sectionCountBadge:{backgroundColor:_sharedUi.buoyColors.primary+"26",paddingHorizontal:8,paddingVertical:2,borderRadius:4},sectionCountText:{fontSize:10,fontWeight:"700",color:_sharedUi.buoyColors.primary,fontFamily:"monospace"},emptyState:{alignItems:"center",paddingVertical:40},emptyTitle:{color:_sharedUi.macOSColors.text.primary,fontSize:14,fontWeight:"600",marginTop:12,marginBottom:6},emptyText:{color:_sharedUi.macOSColors.text.muted,fontSize:12,textAlign:"center",lineHeight:18}}),expandedStyles=_reactNative.StyleSheet.create({container:{gap:10},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},dataContainer:{backgroundColor:_sharedUi.buoyColors.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.buoyColors.border,overflow:"hidden",minHeight:60},emptyText:{color:_sharedUi.buoyColors.textMuted,fontSize:12,padding:14,fontStyle:"italic"}});
@@ -1,73 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ZUSTAND_ICON_COLOR", {
7
- enumerable: true,
8
- get: function () {
9
- return _ZustandIcon.ZUSTAND_ICON_COLOR;
10
- }
11
- });
12
- Object.defineProperty(exports, "ZustandActionButton", {
13
- enumerable: true,
14
- get: function () {
15
- return _ZustandActionButton.ZustandActionButton;
16
- }
17
- });
18
- Object.defineProperty(exports, "ZustandDetailViewToggle", {
19
- enumerable: true,
20
- get: function () {
21
- return _ZustandDetailViewToggle.ZustandDetailViewToggle;
22
- }
23
- });
24
- Object.defineProperty(exports, "ZustandIcon", {
25
- enumerable: true,
26
- get: function () {
27
- return _ZustandIcon.ZustandIcon;
28
- }
29
- });
30
- Object.defineProperty(exports, "ZustandModal", {
31
- enumerable: true,
32
- get: function () {
33
- return _ZustandModal.ZustandModal;
34
- }
35
- });
36
- Object.defineProperty(exports, "ZustandStateChangeItem", {
37
- enumerable: true,
38
- get: function () {
39
- return _ZustandStateChangeItem.ZustandStateChangeItem;
40
- }
41
- });
42
- Object.defineProperty(exports, "ZustandStateDetailContent", {
43
- enumerable: true,
44
- get: function () {
45
- return _ZustandStateDetailContent.ZustandStateDetailContent;
46
- }
47
- });
48
- Object.defineProperty(exports, "ZustandStateDetailFooter", {
49
- enumerable: true,
50
- get: function () {
51
- return _ZustandStateDetailContent.ZustandStateDetailFooter;
52
- }
53
- });
54
- Object.defineProperty(exports, "ZustandStateInfoView", {
55
- enumerable: true,
56
- get: function () {
57
- return _ZustandStateInfoView.ZustandStateInfoView;
58
- }
59
- });
60
- Object.defineProperty(exports, "ZustandStoreBrowser", {
61
- enumerable: true,
62
- get: function () {
63
- return _ZustandStoreBrowser.ZustandStoreBrowser;
64
- }
65
- });
66
- var _ZustandModal = require("./ZustandModal");
67
- var _ZustandIcon = require("./ZustandIcon");
68
- var _ZustandStateChangeItem = require("./ZustandStateChangeItem");
69
- var _ZustandStateDetailContent = require("./ZustandStateDetailContent");
70
- var _ZustandStateInfoView = require("./ZustandStateInfoView");
71
- var _ZustandDetailViewToggle = require("./ZustandDetailViewToggle");
72
- var _ZustandActionButton = require("./ZustandActionButton");
73
- var _ZustandStoreBrowser = require("./ZustandStoreBrowser");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ZUSTAND_ICON_COLOR",{enumerable:!0,get:function(){return _ZustandIcon.ZUSTAND_ICON_COLOR}}),Object.defineProperty(exports,"ZustandActionButton",{enumerable:!0,get:function(){return _ZustandActionButton.ZustandActionButton}}),Object.defineProperty(exports,"ZustandDetailViewToggle",{enumerable:!0,get:function(){return _ZustandDetailViewToggle.ZustandDetailViewToggle}}),Object.defineProperty(exports,"ZustandIcon",{enumerable:!0,get:function(){return _ZustandIcon.ZustandIcon}}),Object.defineProperty(exports,"ZustandModal",{enumerable:!0,get:function(){return _ZustandModal.ZustandModal}}),Object.defineProperty(exports,"ZustandStateChangeItem",{enumerable:!0,get:function(){return _ZustandStateChangeItem.ZustandStateChangeItem}}),Object.defineProperty(exports,"ZustandStateDetailContent",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailContent}}),Object.defineProperty(exports,"ZustandStateDetailFooter",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailFooter}}),Object.defineProperty(exports,"ZustandStateInfoView",{enumerable:!0,get:function(){return _ZustandStateInfoView.ZustandStateInfoView}}),Object.defineProperty(exports,"ZustandStoreBrowser",{enumerable:!0,get:function(){return _ZustandStoreBrowser.ZustandStoreBrowser}});var _ZustandModal=require("./ZustandModal"),_ZustandIcon=require("./ZustandIcon"),_ZustandStateChangeItem=require("./ZustandStateChangeItem"),_ZustandStateDetailContent=require("./ZustandStateDetailContent"),_ZustandStateInfoView=require("./ZustandStateInfoView"),_ZustandDetailViewToggle=require("./ZustandDetailViewToggle"),_ZustandActionButton=require("./ZustandActionButton"),_ZustandStoreBrowser=require("./ZustandStoreBrowser");
@@ -1,12 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "useZustandStateChanges", {
7
- enumerable: true,
8
- get: function () {
9
- return _useZustandStateChanges.useZustandStateChanges;
10
- }
11
- });
12
- var _useZustandStateChanges = require("./useZustandStateChanges");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"useZustandStateChanges",{enumerable:!0,get:function(){return _useZustandStateChanges.useZustandStateChanges}});var _useZustandStateChanges=require("./useZustandStateChanges");
@@ -1,92 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useZustandStateChanges = useZustandStateChanges;
7
- var _react = require("react");
8
- var _zustandStateStore = require("../utils/zustandStateStore");
9
- /**
10
- * Hook for consuming Zustand state changes from the store
11
- *
12
- * Mirrors useReduxActions.ts from @buoy-gg/redux
13
- */
14
-
15
- function useZustandStateChanges() {
16
- const [stateChanges, setStateChanges] = (0, _react.useState)(() => _zustandStateStore.zustandStateStore.getStateChanges());
17
- const [stores, setStores] = (0, _react.useState)(() => _zustandStateStore.zustandStateStore.getStores());
18
- const [filter, setFilter] = (0, _react.useState)({});
19
- const [isEnabled, setIsEnabled] = (0, _react.useState)(() => _zustandStateStore.zustandStateStore.getEnabled());
20
-
21
- // Subscribe to state changes
22
- (0, _react.useEffect)(() => {
23
- const unsubChanges = _zustandStateStore.zustandStateStore.subscribe(newChanges => {
24
- setStateChanges(newChanges);
25
- });
26
- const unsubStores = _zustandStateStore.zustandStateStore.subscribeToStores(newStores => {
27
- setStores(newStores);
28
- });
29
- return () => {
30
- unsubChanges();
31
- unsubStores();
32
- };
33
- }, []);
34
-
35
- // Filter state changes — derive directly from state to avoid stale reads
36
- const filteredChanges = (0, _react.useMemo)(() => {
37
- let filtered = stateChanges;
38
- if (filter.searchText) {
39
- const search = filter.searchText.toLowerCase();
40
- filtered = filtered.filter(c => c.storeName.toLowerCase().includes(search) || c.partialPreview.toLowerCase().includes(search) || c.changedKeys.some(k => k.toLowerCase().includes(search)));
41
- }
42
- if (filter.storeNames && filter.storeNames.length > 0) {
43
- filtered = filtered.filter(c => filter.storeNames.includes(c.storeName));
44
- }
45
- if (filter.onlyWithChanges) {
46
- filtered = filtered.filter(c => c.hasStateChange);
47
- }
48
- return filtered;
49
- }, [stateChanges, filter]);
50
-
51
- // Get stats — derive directly from state
52
- const stats = (0, _react.useMemo)(() => {
53
- const total = stateChanges.length;
54
- const withChanges = stateChanges.filter(c => c.hasStateChange).length;
55
- return {
56
- totalChanges: total,
57
- changesWithStateChange: withChanges,
58
- changesWithoutStateChange: total - withChanges,
59
- storeCount: stores.length,
60
- averageDuration: 0
61
- };
62
- }, [stateChanges, stores]);
63
-
64
- // Get unique store names
65
- const storeNames = (0, _react.useMemo)(() => {
66
- return _zustandStateStore.zustandStateStore.getUniqueStoreNames();
67
- }, [stores]);
68
- const clearChanges = (0, _react.useCallback)(() => {
69
- _zustandStateStore.zustandStateStore.clearStateChanges();
70
- }, []);
71
- const toggleCapture = (0, _react.useCallback)(() => {
72
- const newEnabled = !isEnabled;
73
- _zustandStateStore.zustandStateStore.setEnabled(newEnabled);
74
- setIsEnabled(newEnabled);
75
- }, [isEnabled]);
76
- const getChangeById = (0, _react.useCallback)(id => {
77
- return _zustandStateStore.zustandStateStore.getStateChangeById(id);
78
- }, []);
79
- return {
80
- stateChanges,
81
- filteredChanges,
82
- filter,
83
- setFilter,
84
- stats,
85
- stores,
86
- clearChanges,
87
- isEnabled,
88
- toggleCapture,
89
- storeNames,
90
- getChangeById
91
- };
92
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useZustandStateChanges=useZustandStateChanges;var _react=require("react"),_zustandStateStore=require("../utils/zustandStateStore");function useZustandStateChanges(){const[t,e]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getStateChanges()),[a,s]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getStores()),[r,n]=(0,_react.useState)({}),[o,u]=(0,_react.useState)(()=>_zustandStateStore.zustandStateStore.getEnabled());(0,_react.useEffect)(()=>{const t=_zustandStateStore.zustandStateStore.subscribe(t=>{e(t)}),a=_zustandStateStore.zustandStateStore.subscribeToStores(t=>{s(t)});return()=>{t(),a()}},[]);const S=(0,_react.useMemo)(()=>{let e=t;if(r.searchText){const t=r.searchText.toLowerCase();e=e.filter(e=>e.storeName.toLowerCase().includes(t)||e.partialPreview.toLowerCase().includes(t)||e.changedKeys.some(e=>e.toLowerCase().includes(t)))}return r.storeNames&&r.storeNames.length>0&&(e=e.filter(t=>r.storeNames.includes(t.storeName))),r.onlyWithChanges&&(e=e.filter(t=>t.hasStateChange)),e},[t,r]),c=(0,_react.useMemo)(()=>{const e=t.length,s=t.filter(t=>t.hasStateChange).length;return{totalChanges:e,changesWithStateChange:s,changesWithoutStateChange:e-s,storeCount:a.length,averageDuration:0}},[t,a]),d=(0,_react.useMemo)(()=>_zustandStateStore.zustandStateStore.getUniqueStoreNames(),[a]),l=(0,_react.useCallback)(()=>{_zustandStateStore.zustandStateStore.clearStateChanges()},[]),g=(0,_react.useCallback)(()=>{const t=!o;_zustandStateStore.zustandStateStore.setEnabled(t),u(t)},[o]),h=(0,_react.useCallback)(t=>_zustandStateStore.zustandStateStore.getStateChangeById(t),[]);return{stateChanges:t,filteredChanges:S,filter:r,setFilter:n,stats:c,stores:a,clearChanges:l,isEnabled:o,toggleCapture:g,storeNames:d,getChangeById:h}}
@@ -1,99 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "ZUSTAND_ICON_COLOR", {
7
- enumerable: true,
8
- get: function () {
9
- return _ZustandIcon.ZUSTAND_ICON_COLOR;
10
- }
11
- });
12
- Object.defineProperty(exports, "ZustandActionButton", {
13
- enumerable: true,
14
- get: function () {
15
- return _ZustandActionButton.ZustandActionButton;
16
- }
17
- });
18
- Object.defineProperty(exports, "ZustandDetailViewToggle", {
19
- enumerable: true,
20
- get: function () {
21
- return _ZustandDetailViewToggle.ZustandDetailViewToggle;
22
- }
23
- });
24
- Object.defineProperty(exports, "ZustandIcon", {
25
- enumerable: true,
26
- get: function () {
27
- return _ZustandIcon.ZustandIcon;
28
- }
29
- });
30
- Object.defineProperty(exports, "ZustandModal", {
31
- enumerable: true,
32
- get: function () {
33
- return _ZustandModal.ZustandModal;
34
- }
35
- });
36
- Object.defineProperty(exports, "ZustandStateChangeItem", {
37
- enumerable: true,
38
- get: function () {
39
- return _ZustandStateChangeItem.ZustandStateChangeItem;
40
- }
41
- });
42
- Object.defineProperty(exports, "ZustandStateDetailContent", {
43
- enumerable: true,
44
- get: function () {
45
- return _ZustandStateDetailContent.ZustandStateDetailContent;
46
- }
47
- });
48
- Object.defineProperty(exports, "ZustandStateDetailFooter", {
49
- enumerable: true,
50
- get: function () {
51
- return _ZustandStateDetailContent.ZustandStateDetailFooter;
52
- }
53
- });
54
- Object.defineProperty(exports, "ZustandStateInfoView", {
55
- enumerable: true,
56
- get: function () {
57
- return _ZustandStateInfoView.ZustandStateInfoView;
58
- }
59
- });
60
- Object.defineProperty(exports, "buoyDevTools", {
61
- enumerable: true,
62
- get: function () {
63
- return _buoyZustandMiddleware.buoyDevTools;
64
- }
65
- });
66
- Object.defineProperty(exports, "isStoreInstrumented", {
67
- enumerable: true,
68
- get: function () {
69
- return _buoyZustandMiddleware.isStoreInstrumented;
70
- }
71
- });
72
- Object.defineProperty(exports, "useZustandStateChanges", {
73
- enumerable: true,
74
- get: function () {
75
- return _useZustandStateChanges.useZustandStateChanges;
76
- }
77
- });
78
- Object.defineProperty(exports, "watchStores", {
79
- enumerable: true,
80
- get: function () {
81
- return _buoyZustandMiddleware.watchStores;
82
- }
83
- });
84
- Object.defineProperty(exports, "zustandStateStore", {
85
- enumerable: true,
86
- get: function () {
87
- return _zustandStateStore.zustandStateStore;
88
- }
89
- });
90
- var _ZustandModal = require("./components/ZustandModal");
91
- var _ZustandIcon = require("./components/ZustandIcon");
92
- var _ZustandStateChangeItem = require("./components/ZustandStateChangeItem");
93
- var _ZustandStateDetailContent = require("./components/ZustandStateDetailContent");
94
- var _ZustandStateInfoView = require("./components/ZustandStateInfoView");
95
- var _ZustandDetailViewToggle = require("./components/ZustandDetailViewToggle");
96
- var _ZustandActionButton = require("./components/ZustandActionButton");
97
- var _zustandStateStore = require("./utils/zustandStateStore");
98
- var _buoyZustandMiddleware = require("./utils/buoyZustandMiddleware");
99
- var _useZustandStateChanges = require("./hooks/useZustandStateChanges");
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"ZUSTAND_ICON_COLOR",{enumerable:!0,get:function(){return _ZustandIcon.ZUSTAND_ICON_COLOR}}),Object.defineProperty(exports,"ZustandActionButton",{enumerable:!0,get:function(){return _ZustandActionButton.ZustandActionButton}}),Object.defineProperty(exports,"ZustandDetailViewToggle",{enumerable:!0,get:function(){return _ZustandDetailViewToggle.ZustandDetailViewToggle}}),Object.defineProperty(exports,"ZustandIcon",{enumerable:!0,get:function(){return _ZustandIcon.ZustandIcon}}),Object.defineProperty(exports,"ZustandModal",{enumerable:!0,get:function(){return _ZustandModal.ZustandModal}}),Object.defineProperty(exports,"ZustandStateChangeItem",{enumerable:!0,get:function(){return _ZustandStateChangeItem.ZustandStateChangeItem}}),Object.defineProperty(exports,"ZustandStateDetailContent",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailContent}}),Object.defineProperty(exports,"ZustandStateDetailFooter",{enumerable:!0,get:function(){return _ZustandStateDetailContent.ZustandStateDetailFooter}}),Object.defineProperty(exports,"ZustandStateInfoView",{enumerable:!0,get:function(){return _ZustandStateInfoView.ZustandStateInfoView}}),Object.defineProperty(exports,"buoyDevTools",{enumerable:!0,get:function(){return _buoyZustandMiddleware.buoyDevTools}}),Object.defineProperty(exports,"isStoreInstrumented",{enumerable:!0,get:function(){return _buoyZustandMiddleware.isStoreInstrumented}}),Object.defineProperty(exports,"useZustandStateChanges",{enumerable:!0,get:function(){return _useZustandStateChanges.useZustandStateChanges}}),Object.defineProperty(exports,"watchStores",{enumerable:!0,get:function(){return _buoyZustandMiddleware.watchStores}}),Object.defineProperty(exports,"zustandStateStore",{enumerable:!0,get:function(){return _zustandStateStore.zustandStateStore}});var _ZustandModal=require("./components/ZustandModal"),_ZustandIcon=require("./components/ZustandIcon"),_ZustandStateChangeItem=require("./components/ZustandStateChangeItem"),_ZustandStateDetailContent=require("./components/ZustandStateDetailContent"),_ZustandStateInfoView=require("./components/ZustandStateInfoView"),_ZustandDetailViewToggle=require("./components/ZustandDetailViewToggle"),_ZustandActionButton=require("./components/ZustandActionButton"),_zustandStateStore=require("./utils/zustandStateStore"),_buoyZustandMiddleware=require("./utils/buoyZustandMiddleware"),_useZustandStateChanges=require("./hooks/useZustandStateChanges");