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