@buoy-gg/zustand 2.1.9 → 2.1.11

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/lib/commonjs/index.js +91 -1
  2. package/lib/commonjs/preset.js +102 -1
  3. package/lib/commonjs/zustand/components/ZustandActionButton.js +116 -1
  4. package/lib/commonjs/zustand/components/ZustandDetailViewToggle.js +134 -1
  5. package/lib/commonjs/zustand/components/ZustandEventFilterView.js +291 -1
  6. package/lib/commonjs/zustand/components/ZustandIcon.js +35 -1
  7. package/lib/commonjs/zustand/components/ZustandModal.js +603 -1
  8. package/lib/commonjs/zustand/components/ZustandStateChangeItem.js +165 -1
  9. package/lib/commonjs/zustand/components/ZustandStateDetailContent.js +352 -1
  10. package/lib/commonjs/zustand/components/ZustandStateInfoView.js +508 -1
  11. package/lib/commonjs/zustand/components/ZustandStoreBrowser.js +307 -1
  12. package/lib/commonjs/zustand/components/index.js +73 -1
  13. package/lib/commonjs/zustand/hooks/index.js +12 -1
  14. package/lib/commonjs/zustand/hooks/useZustandStateChanges.js +92 -1
  15. package/lib/commonjs/zustand/index.js +99 -1
  16. package/lib/commonjs/zustand/utils/buoyZustandMiddleware.js +220 -1
  17. package/lib/commonjs/zustand/utils/index.js +31 -1
  18. package/lib/commonjs/zustand/utils/zustandStateStore.js +361 -1
  19. package/lib/module/index.js +80 -1
  20. package/lib/module/preset.js +98 -1
  21. package/lib/module/zustand/components/ZustandActionButton.js +112 -1
  22. package/lib/module/zustand/components/ZustandDetailViewToggle.js +129 -1
  23. package/lib/module/zustand/components/ZustandEventFilterView.js +287 -1
  24. package/lib/module/zustand/components/ZustandIcon.js +32 -1
  25. package/lib/module/zustand/components/ZustandModal.js +599 -1
  26. package/lib/module/zustand/components/ZustandStateChangeItem.js +161 -1
  27. package/lib/module/zustand/components/ZustandStateDetailContent.js +348 -1
  28. package/lib/module/zustand/components/ZustandStateInfoView.js +503 -1
  29. package/lib/module/zustand/components/ZustandStoreBrowser.js +303 -1
  30. package/lib/module/zustand/components/index.js +10 -1
  31. package/lib/module/zustand/hooks/index.js +3 -1
  32. package/lib/module/zustand/hooks/useZustandStateChanges.js +88 -1
  33. package/lib/module/zustand/index.js +12 -1
  34. package/lib/module/zustand/utils/buoyZustandMiddleware.js +214 -1
  35. package/lib/module/zustand/utils/index.js +4 -1
  36. package/lib/module/zustand/utils/zustandStateStore.js +357 -1
  37. package/lib/typescript/index.d.ts.map +1 -0
  38. package/lib/typescript/preset.d.ts.map +1 -0
  39. package/lib/typescript/zustand/components/ZustandActionButton.d.ts.map +1 -0
  40. package/lib/typescript/zustand/components/ZustandDetailViewToggle.d.ts.map +1 -0
  41. package/lib/typescript/zustand/components/ZustandEventFilterView.d.ts.map +1 -0
  42. package/lib/typescript/zustand/components/ZustandIcon.d.ts.map +1 -0
  43. package/lib/typescript/zustand/components/ZustandModal.d.ts.map +1 -0
  44. package/lib/typescript/zustand/components/ZustandStateChangeItem.d.ts.map +1 -0
  45. package/lib/typescript/zustand/components/ZustandStateDetailContent.d.ts.map +1 -0
  46. package/lib/typescript/zustand/components/ZustandStateInfoView.d.ts.map +1 -0
  47. package/lib/typescript/zustand/components/ZustandStoreBrowser.d.ts.map +1 -0
  48. package/lib/typescript/zustand/components/index.d.ts.map +1 -0
  49. package/lib/typescript/zustand/hooks/index.d.ts.map +1 -0
  50. package/lib/typescript/zustand/hooks/useZustandStateChanges.d.ts.map +1 -0
  51. package/lib/typescript/zustand/index.d.ts.map +1 -0
  52. package/lib/typescript/zustand/types/index.d.ts.map +1 -0
  53. package/lib/typescript/zustand/utils/buoyZustandMiddleware.d.ts.map +1 -0
  54. package/lib/typescript/zustand/utils/index.d.ts.map +1 -0
  55. package/lib/typescript/zustand/utils/zustandStateStore.d.ts.map +1 -0
  56. package/package.json +10 -10
  57. package/LICENSE +0 -58
@@ -1 +1,287 @@
1
- "use strict";import{useState}from"react";import{View,Text,StyleSheet,TouchableOpacity,ScrollView}from"react-native";import{Filter,X,SectionHeader,AddFilterButton,AddFilterInput,macOSColors,buoyColors}from"@buoy-gg/shared-ui";import{zustandStateStore}from"../utils/zustandStateStore";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function getStoreColorForPattern(e,o){const t=o.find(o=>o.name.toLowerCase()===e.toLowerCase());return t?zustandStateStore.getStoreColor(t.name):null}function isStoreFiltered(e,o){return Array.from(o).some(o=>e.name.toLowerCase().includes(o.toLowerCase()))}export function ZustandEventFilterView({ignoredPatterns:e,onTogglePattern:o,onAddPattern:t,stores:r}){const[s,n]=useState(!1),[l,i]=useState("");return _jsxs(ScrollView,{style:styles.container,contentContainerStyle:styles.scrollContent,showsVerticalScrollIndicator:!1,children:[r.length>0&&_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Title,{children:"REGISTERED STORES"}),_jsx(SectionHeader.Badge,{count:r.length,color:buoyColors.primary})]}),_jsx(ScrollView,{style:styles.storeList,contentContainerStyle:styles.storeListContent,showsVerticalScrollIndicator:!0,nestedScrollEnabled:!0,children:r.map(o=>{const r=zustandStateStore.getStoreColor(o.name),s=isStoreFiltered(o,e);return _jsxs(TouchableOpacity,{style:[styles.storeRow,s&&styles.storeRowFiltered],onPress:()=>t(o.name),disabled:s,children:[_jsx(View,{style:[styles.storeDot,{backgroundColor:s?macOSColors.text.disabled:r}]}),_jsx(Text,{style:[styles.storeRowText,s&&styles.storeRowTextFiltered,!s&&{color:r}],numberOfLines:1,children:o.name}),_jsx(Text,s?{style:styles.filteredLabel,children:"hidden"}:{style:[styles.addLabel,{color:r+"99"}],children:"+ hide"})]},o.name)})})]}),_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Icon,{icon:Filter,color:buoyColors.primary,size:12}),_jsx(SectionHeader.Title,{children:"STORE NAME FILTERS"}),e.size>0&&_jsx(SectionHeader.Badge,{count:e.size,color:buoyColors.primary})]}),_jsx(View,{style:styles.addInputWrapper,children:s?_jsx(AddFilterInput,{value:l,onChange:i,onSubmit:()=>{const e=l.trim();e&&(t(e),i(""),n(!1))},onCancel:()=>{n(!1),i("")},placeholder:"Enter store name pattern to hide...",color:buoyColors.primary}):_jsx(AddFilterButton,{onPress:()=>n(!0),color:buoyColors.primary,label:"Add store name pattern"})}),e.size>0&&_jsx(View,{style:styles.patternList,children:Array.from(e).map(e=>{const t=getStoreColorForPattern(e,r);return _jsxs(TouchableOpacity,{style:styles.patternRow,onPress:()=>o(e),activeOpacity:.8,children:[t?_jsx(View,{style:[styles.storeDot,{backgroundColor:t}]}):null,_jsx(Text,{style:[styles.patternText,t?{color:t}:null],numberOfLines:1,children:e}),_jsx(X,{size:12,color:buoyColors.primary+"80"})]},e)})})]}),_jsxs(View,{style:styles.section,children:[_jsxs(SectionHeader,{children:[_jsx(SectionHeader.Icon,{icon:Filter,color:buoyColors.textSecondary,size:12}),_jsx(SectionHeader.Title,{children:"HOW EVENT FILTERS WORK"})]}),_jsx(Text,{style:styles.howItWorksText,children:"Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter."}),_jsxs(View,{style:styles.examplesContainer,children:[_jsx(Text,{style:styles.examplesTitle,children:"EXAMPLES:"}),["• auth → hides authStore from stores & events","• temp → hides tempStore, tempUserStore","• cart → hides cartStore from both tabs"].map(e=>_jsx(Text,{style:styles.exampleItem,children:e},e))]})]})]})}const styles=StyleSheet.create({container:{flex:1,backgroundColor:buoyColors.base},scrollContent:{paddingTop:16,paddingHorizontal:16,paddingBottom:24,gap:16},section:{backgroundColor:buoyColors.card,borderRadius:16,borderWidth:1,borderColor:buoyColors.border,overflow:"hidden"},storeList:{maxHeight:180},storeListContent:{paddingHorizontal:16,paddingTop:8,paddingBottom:16,gap:10},storeRow:{flexDirection:"row",alignItems:"center",gap:10,paddingVertical:10,paddingHorizontal:12,backgroundColor:buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:buoyColors.border},storeRowFiltered:{opacity:.45},storeDot:{width:7,height:7,borderRadius:3.5},storeRowText:{flex:1,fontSize:12,fontWeight:"600",fontFamily:"monospace"},storeRowTextFiltered:{color:macOSColors.text.muted,textDecorationLine:"line-through"},filteredLabel:{fontSize:10,fontWeight:"500",color:macOSColors.text.disabled,fontFamily:"monospace"},addLabel:{fontSize:10,fontWeight:"600",fontFamily:"monospace"},addInputWrapper:{paddingHorizontal:16,paddingTop:8,paddingBottom:8},patternList:{paddingHorizontal:16,paddingBottom:16,gap:8},patternRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",paddingVertical:10,paddingHorizontal:12,backgroundColor:buoyColors.hover,borderRadius:8,borderWidth:1,borderColor:buoyColors.border,gap:8},patternText:{flex:1,fontSize:12,fontFamily:"monospace",color:buoyColors.text},howItWorksText:{fontSize:11,color:buoyColors.textSecondary,lineHeight:16,marginTop:8,paddingHorizontal:16,fontFamily:"monospace"},examplesContainer:{paddingTop:8,paddingHorizontal:16,paddingBottom:16,borderTopWidth:1,borderTopColor:buoyColors.border,marginTop:12},examplesTitle:{fontSize:10,fontWeight:"600",color:buoyColors.textMuted,fontFamily:"monospace",letterSpacing:.5,marginBottom:6},exampleItem:{fontSize:10,color:buoyColors.textMuted,fontFamily:"monospace",lineHeight:16}});
1
+ "use strict";
2
+
3
+ import { useState } from "react";
4
+ import { View, Text, StyleSheet, TouchableOpacity, ScrollView } from "react-native";
5
+ import { Filter, X, SectionHeader, AddFilterButton, AddFilterInput, macOSColors, buoyColors } from "@buoy-gg/shared-ui";
6
+ import { zustandStateStore } from "../utils/zustandStateStore";
7
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ /** Returns the store color for a given pattern if it exactly matches a registered store name */
9
+ function getStoreColorForPattern(pattern, stores) {
10
+ const match = stores.find(s => s.name.toLowerCase() === pattern.toLowerCase());
11
+ return match ? zustandStateStore.getStoreColor(match.name) : null;
12
+ }
13
+
14
+ /** True if any active pattern filters out this store */
15
+ function isStoreFiltered(store, ignoredPatterns) {
16
+ return Array.from(ignoredPatterns).some(p => store.name.toLowerCase().includes(p.toLowerCase()));
17
+ }
18
+ export function ZustandEventFilterView({
19
+ ignoredPatterns,
20
+ onTogglePattern,
21
+ onAddPattern,
22
+ stores
23
+ }) {
24
+ const [showAddInput, setShowAddInput] = useState(false);
25
+ const [inputValue, setInputValue] = useState("");
26
+ const handleAddPattern = () => {
27
+ const trimmed = inputValue.trim();
28
+ if (trimmed) {
29
+ onAddPattern(trimmed);
30
+ setInputValue("");
31
+ setShowAddInput(false);
32
+ }
33
+ };
34
+ return /*#__PURE__*/_jsxs(ScrollView, {
35
+ style: styles.container,
36
+ contentContainerStyle: styles.scrollContent,
37
+ showsVerticalScrollIndicator: false,
38
+ children: [stores.length > 0 && /*#__PURE__*/_jsxs(View, {
39
+ style: styles.section,
40
+ children: [/*#__PURE__*/_jsxs(SectionHeader, {
41
+ children: [/*#__PURE__*/_jsx(SectionHeader.Title, {
42
+ children: "REGISTERED STORES"
43
+ }), /*#__PURE__*/_jsx(SectionHeader.Badge, {
44
+ count: stores.length,
45
+ color: buoyColors.primary
46
+ })]
47
+ }), /*#__PURE__*/_jsx(ScrollView, {
48
+ style: styles.storeList,
49
+ contentContainerStyle: styles.storeListContent,
50
+ showsVerticalScrollIndicator: true,
51
+ nestedScrollEnabled: true,
52
+ children: stores.map(store => {
53
+ const storeColor = zustandStateStore.getStoreColor(store.name);
54
+ const filtered = isStoreFiltered(store, ignoredPatterns);
55
+ return /*#__PURE__*/_jsxs(TouchableOpacity, {
56
+ style: [styles.storeRow, filtered && styles.storeRowFiltered],
57
+ onPress: () => onAddPattern(store.name),
58
+ disabled: filtered,
59
+ children: [/*#__PURE__*/_jsx(View, {
60
+ style: [styles.storeDot, {
61
+ backgroundColor: filtered ? macOSColors.text.disabled : storeColor
62
+ }]
63
+ }), /*#__PURE__*/_jsx(Text, {
64
+ style: [styles.storeRowText, filtered && styles.storeRowTextFiltered, !filtered && {
65
+ color: storeColor
66
+ }],
67
+ numberOfLines: 1,
68
+ children: store.name
69
+ }), filtered ? /*#__PURE__*/_jsx(Text, {
70
+ style: styles.filteredLabel,
71
+ children: "hidden"
72
+ }) : /*#__PURE__*/_jsx(Text, {
73
+ style: [styles.addLabel, {
74
+ color: storeColor + "99"
75
+ }],
76
+ children: "+ hide"
77
+ })]
78
+ }, store.name);
79
+ })
80
+ })]
81
+ }), /*#__PURE__*/_jsxs(View, {
82
+ style: styles.section,
83
+ children: [/*#__PURE__*/_jsxs(SectionHeader, {
84
+ children: [/*#__PURE__*/_jsx(SectionHeader.Icon, {
85
+ icon: Filter,
86
+ color: buoyColors.primary,
87
+ size: 12
88
+ }), /*#__PURE__*/_jsx(SectionHeader.Title, {
89
+ children: "STORE NAME FILTERS"
90
+ }), ignoredPatterns.size > 0 && /*#__PURE__*/_jsx(SectionHeader.Badge, {
91
+ count: ignoredPatterns.size,
92
+ color: buoyColors.primary
93
+ })]
94
+ }), /*#__PURE__*/_jsx(View, {
95
+ style: styles.addInputWrapper,
96
+ children: !showAddInput ? /*#__PURE__*/_jsx(AddFilterButton, {
97
+ onPress: () => setShowAddInput(true),
98
+ color: buoyColors.primary,
99
+ label: "Add store name pattern"
100
+ }) : /*#__PURE__*/_jsx(AddFilterInput, {
101
+ value: inputValue,
102
+ onChange: setInputValue,
103
+ onSubmit: handleAddPattern,
104
+ onCancel: () => {
105
+ setShowAddInput(false);
106
+ setInputValue("");
107
+ },
108
+ placeholder: "Enter store name pattern to hide...",
109
+ color: buoyColors.primary
110
+ })
111
+ }), ignoredPatterns.size > 0 && /*#__PURE__*/_jsx(View, {
112
+ style: styles.patternList,
113
+ children: Array.from(ignoredPatterns).map(pattern => {
114
+ const storeColor = getStoreColorForPattern(pattern, stores);
115
+ return /*#__PURE__*/_jsxs(TouchableOpacity, {
116
+ style: styles.patternRow,
117
+ onPress: () => onTogglePattern(pattern),
118
+ activeOpacity: 0.8,
119
+ children: [storeColor ? /*#__PURE__*/_jsx(View, {
120
+ style: [styles.storeDot, {
121
+ backgroundColor: storeColor
122
+ }]
123
+ }) : null, /*#__PURE__*/_jsx(Text, {
124
+ style: [styles.patternText, storeColor ? {
125
+ color: storeColor
126
+ } : null],
127
+ numberOfLines: 1,
128
+ children: pattern
129
+ }), /*#__PURE__*/_jsx(X, {
130
+ size: 12,
131
+ color: buoyColors.primary + "80"
132
+ })]
133
+ }, pattern);
134
+ })
135
+ })]
136
+ }), /*#__PURE__*/_jsxs(View, {
137
+ style: styles.section,
138
+ children: [/*#__PURE__*/_jsxs(SectionHeader, {
139
+ children: [/*#__PURE__*/_jsx(SectionHeader.Icon, {
140
+ icon: Filter,
141
+ color: buoyColors.textSecondary,
142
+ size: 12
143
+ }), /*#__PURE__*/_jsx(SectionHeader.Title, {
144
+ children: "HOW EVENT FILTERS WORK"
145
+ })]
146
+ }), /*#__PURE__*/_jsx(Text, {
147
+ style: styles.howItWorksText,
148
+ children: "Patterns hide matching stores from both the Stores tab and the Events tab. Tap a store above to quickly add it as a filter."
149
+ }), /*#__PURE__*/_jsxs(View, {
150
+ style: styles.examplesContainer,
151
+ children: [/*#__PURE__*/_jsx(Text, {
152
+ style: styles.examplesTitle,
153
+ children: "EXAMPLES:"
154
+ }), ["• auth → hides authStore from stores & events", "• temp → hides tempStore, tempUserStore", "• cart → hides cartStore from both tabs"].map(ex => /*#__PURE__*/_jsx(Text, {
155
+ style: styles.exampleItem,
156
+ children: ex
157
+ }, ex))]
158
+ })]
159
+ })]
160
+ });
161
+ }
162
+ const styles = StyleSheet.create({
163
+ container: {
164
+ flex: 1,
165
+ backgroundColor: buoyColors.base
166
+ },
167
+ scrollContent: {
168
+ paddingTop: 16,
169
+ paddingHorizontal: 16,
170
+ paddingBottom: 24,
171
+ gap: 16
172
+ },
173
+ section: {
174
+ backgroundColor: buoyColors.card,
175
+ borderRadius: 16,
176
+ borderWidth: 1,
177
+ borderColor: buoyColors.border,
178
+ overflow: "hidden"
179
+ },
180
+ storeList: {
181
+ maxHeight: 180
182
+ },
183
+ storeListContent: {
184
+ paddingHorizontal: 16,
185
+ paddingTop: 8,
186
+ paddingBottom: 16,
187
+ gap: 10
188
+ },
189
+ storeRow: {
190
+ flexDirection: "row",
191
+ alignItems: "center",
192
+ gap: 10,
193
+ paddingVertical: 10,
194
+ paddingHorizontal: 12,
195
+ backgroundColor: buoyColors.hover,
196
+ borderRadius: 8,
197
+ borderWidth: 1,
198
+ borderColor: buoyColors.border
199
+ },
200
+ storeRowFiltered: {
201
+ opacity: 0.45
202
+ },
203
+ storeDot: {
204
+ width: 7,
205
+ height: 7,
206
+ borderRadius: 3.5
207
+ },
208
+ storeRowText: {
209
+ flex: 1,
210
+ fontSize: 12,
211
+ fontWeight: "600",
212
+ fontFamily: "monospace"
213
+ },
214
+ storeRowTextFiltered: {
215
+ color: macOSColors.text.muted,
216
+ textDecorationLine: "line-through"
217
+ },
218
+ filteredLabel: {
219
+ fontSize: 10,
220
+ fontWeight: "500",
221
+ color: macOSColors.text.disabled,
222
+ fontFamily: "monospace"
223
+ },
224
+ addLabel: {
225
+ fontSize: 10,
226
+ fontWeight: "600",
227
+ fontFamily: "monospace"
228
+ },
229
+ addInputWrapper: {
230
+ paddingHorizontal: 16,
231
+ paddingTop: 8,
232
+ paddingBottom: 8
233
+ },
234
+ patternList: {
235
+ paddingHorizontal: 16,
236
+ paddingBottom: 16,
237
+ gap: 8
238
+ },
239
+ patternRow: {
240
+ flexDirection: "row",
241
+ alignItems: "center",
242
+ justifyContent: "space-between",
243
+ paddingVertical: 10,
244
+ paddingHorizontal: 12,
245
+ backgroundColor: buoyColors.hover,
246
+ borderRadius: 8,
247
+ borderWidth: 1,
248
+ borderColor: buoyColors.border,
249
+ gap: 8
250
+ },
251
+ patternText: {
252
+ flex: 1,
253
+ fontSize: 12,
254
+ fontFamily: "monospace",
255
+ color: buoyColors.text
256
+ },
257
+ howItWorksText: {
258
+ fontSize: 11,
259
+ color: buoyColors.textSecondary,
260
+ lineHeight: 16,
261
+ marginTop: 8,
262
+ paddingHorizontal: 16,
263
+ fontFamily: "monospace"
264
+ },
265
+ examplesContainer: {
266
+ paddingTop: 8,
267
+ paddingHorizontal: 16,
268
+ paddingBottom: 16,
269
+ borderTopWidth: 1,
270
+ borderTopColor: buoyColors.border,
271
+ marginTop: 12
272
+ },
273
+ examplesTitle: {
274
+ fontSize: 10,
275
+ fontWeight: "600",
276
+ color: buoyColors.textMuted,
277
+ fontFamily: "monospace",
278
+ letterSpacing: 0.5,
279
+ marginBottom: 6
280
+ },
281
+ exampleItem: {
282
+ fontSize: 10,
283
+ color: buoyColors.textMuted,
284
+ fontFamily: "monospace",
285
+ lineHeight: 16
286
+ }
287
+ });
@@ -1 +1,32 @@
1
- "use strict";import{View}from"react-native";import{Text}from"react-native";import{jsx as _jsx}from"react/jsx-runtime";const ZUSTAND_ICON_COLOR="#463B3F";export function ZustandIcon({size:t,color:e}){return _jsx(View,{style:{width:t,height:t,justifyContent:"center",alignItems:"center"},children:_jsx(Text,{style:{fontSize:.75*t,color:e||"#463B3F",fontWeight:"700"},children:"Z"})})}export{ZUSTAND_ICON_COLOR};
1
+ "use strict";
2
+
3
+ /**
4
+ * Zustand DevTools icon
5
+ */
6
+
7
+ import { View } from "react-native";
8
+ import { Text } from "react-native";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const ZUSTAND_ICON_COLOR = "#463B3F";
11
+ export function ZustandIcon({
12
+ size,
13
+ color
14
+ }) {
15
+ return /*#__PURE__*/_jsx(View, {
16
+ style: {
17
+ width: size,
18
+ height: size,
19
+ justifyContent: "center",
20
+ alignItems: "center"
21
+ },
22
+ children: /*#__PURE__*/_jsx(Text, {
23
+ style: {
24
+ fontSize: size * 0.75,
25
+ color: color || ZUSTAND_ICON_COLOR,
26
+ fontWeight: "700"
27
+ },
28
+ children: "Z"
29
+ })
30
+ });
31
+ }
32
+ export { ZUSTAND_ICON_COLOR };