@buoy-gg/jotai 3.0.1 → 4.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.
- package/lib/commonjs/index.js +98 -1
- package/lib/commonjs/jotai/components/JotaiAtomBrowser.js +300 -1
- package/lib/commonjs/jotai/components/JotaiAtomChangeItem.js +113 -1
- package/lib/commonjs/jotai/components/JotaiAtomDetailContent.js +754 -1
- package/lib/commonjs/jotai/components/JotaiEventFilterView.js +305 -1
- package/lib/commonjs/jotai/components/JotaiIcon.js +35 -1
- package/lib/commonjs/jotai/components/JotaiModal.js +567 -1
- package/lib/commonjs/jotai/components/index.js +59 -1
- package/lib/commonjs/jotai/hooks/useJotaiAtomChanges.js +83 -1
- package/lib/commonjs/jotai/index.js +85 -1
- package/lib/commonjs/jotai/sync/jotaiSyncAdapter.js +38 -0
- package/lib/commonjs/jotai/utils/jotaiStateStore.js +399 -1
- package/lib/commonjs/jotai/utils/watchAtoms.js +149 -1
- package/lib/commonjs/preset.js +98 -1
- package/lib/module/index.js +79 -1
- package/lib/module/jotai/components/JotaiAtomBrowser.js +296 -1
- package/lib/module/jotai/components/JotaiAtomChangeItem.js +109 -1
- package/lib/module/jotai/components/JotaiAtomDetailContent.js +748 -1
- package/lib/module/jotai/components/JotaiEventFilterView.js +301 -1
- package/lib/module/jotai/components/JotaiIcon.js +31 -1
- package/lib/module/jotai/components/JotaiModal.js +563 -1
- package/lib/module/jotai/components/index.js +8 -1
- package/lib/module/jotai/hooks/useJotaiAtomChanges.js +79 -1
- package/lib/module/jotai/index.js +10 -1
- package/lib/module/jotai/sync/jotaiSyncAdapter.js +35 -0
- package/lib/module/jotai/utils/jotaiStateStore.js +395 -1
- package/lib/module/jotai/utils/watchAtoms.js +144 -1
- package/lib/module/preset.js +94 -1
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiAtomBrowser.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiAtomChangeItem.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiAtomDetailContent.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiEventFilterView.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiIcon.d.ts.map +1 -0
- package/lib/typescript/jotai/components/JotaiModal.d.ts.map +1 -0
- package/lib/typescript/jotai/components/index.d.ts.map +1 -0
- package/lib/typescript/jotai/hooks/useJotaiAtomChanges.d.ts.map +1 -0
- package/lib/typescript/jotai/index.d.ts.map +1 -0
- package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts +23 -0
- package/lib/typescript/jotai/sync/jotaiSyncAdapter.d.ts.map +1 -0
- package/lib/typescript/jotai/types/index.d.ts +11 -0
- package/lib/typescript/jotai/types/index.d.ts.map +1 -0
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts +29 -1
- package/lib/typescript/jotai/utils/jotaiStateStore.d.ts.map +1 -0
- package/lib/typescript/jotai/utils/watchAtoms.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1,305 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.JotaiEventFilterView = JotaiEventFilterView;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
var _jotaiStateStore = require("../utils/jotaiStateStore");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* JotaiEventFilterView
|
|
14
|
+
*
|
|
15
|
+
* Filter configuration UI for hiding atoms from the Atoms and Events tabs.
|
|
16
|
+
* Mirrors ZustandEventFilterView.tsx from @buoy-gg/zustand.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function getAtomColorForPattern(pattern, atoms) {
|
|
20
|
+
const match = atoms.find(a => a.label.toLowerCase().includes(pattern.toLowerCase()));
|
|
21
|
+
return match ? match.color : null;
|
|
22
|
+
}
|
|
23
|
+
function JotaiEventFilterView({
|
|
24
|
+
ignoredPatterns,
|
|
25
|
+
onTogglePattern,
|
|
26
|
+
onAddPattern,
|
|
27
|
+
atoms
|
|
28
|
+
}) {
|
|
29
|
+
const [newPattern, setNewPattern] = (0, _react.useState)("");
|
|
30
|
+
const handleAddPattern = () => {
|
|
31
|
+
const trimmed = newPattern.trim();
|
|
32
|
+
if (trimmed && !ignoredPatterns.has(trimmed)) {
|
|
33
|
+
onAddPattern(trimmed);
|
|
34
|
+
setNewPattern("");
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
38
|
+
style: styles.container,
|
|
39
|
+
contentContainerStyle: styles.scrollContent,
|
|
40
|
+
showsVerticalScrollIndicator: false,
|
|
41
|
+
nestedScrollEnabled: true,
|
|
42
|
+
children: [/*#__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.Icon, {
|
|
46
|
+
icon: _sharedUi.Filter,
|
|
47
|
+
color: _sharedUi.buoyColors.textSecondary,
|
|
48
|
+
size: 12
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
50
|
+
children: "REGISTERED ATOMS"
|
|
51
|
+
})]
|
|
52
|
+
}), atoms.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
53
|
+
style: styles.emptyText,
|
|
54
|
+
children: "No atoms registered yet."
|
|
55
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
56
|
+
style: styles.atomList,
|
|
57
|
+
contentContainerStyle: styles.atomListContent,
|
|
58
|
+
nestedScrollEnabled: true,
|
|
59
|
+
children: atoms.map(atom => {
|
|
60
|
+
const atomColor = _jotaiStateStore.jotaiStateStore.getAtomColor(atom.label);
|
|
61
|
+
const isFiltered = Array.from(ignoredPatterns).some(p => atom.label.toLowerCase().includes(p.toLowerCase()));
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
63
|
+
style: [styles.atomRow, isFiltered && styles.atomRowFiltered],
|
|
64
|
+
onPress: () => onTogglePattern(atom.label),
|
|
65
|
+
activeOpacity: 0.7,
|
|
66
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
67
|
+
style: [styles.atomDot, {
|
|
68
|
+
backgroundColor: atomColor
|
|
69
|
+
}]
|
|
70
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
71
|
+
style: [styles.atomRowText, {
|
|
72
|
+
color: atomColor
|
|
73
|
+
}, isFiltered && styles.atomRowTextFiltered],
|
|
74
|
+
numberOfLines: 1,
|
|
75
|
+
children: atom.label
|
|
76
|
+
}), isFiltered ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
|
+
style: styles.filteredLabel,
|
|
78
|
+
children: "filtered"
|
|
79
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
80
|
+
style: [styles.addLabel, {
|
|
81
|
+
color: atomColor
|
|
82
|
+
}],
|
|
83
|
+
children: "+ add"
|
|
84
|
+
})]
|
|
85
|
+
}, atom.label);
|
|
86
|
+
})
|
|
87
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
88
|
+
style: styles.addInputWrapper,
|
|
89
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
90
|
+
value: newPattern,
|
|
91
|
+
onChangeText: setNewPattern,
|
|
92
|
+
onSubmitEditing: handleAddPattern,
|
|
93
|
+
placeholder: "Type a pattern and press Enter...",
|
|
94
|
+
placeholderTextColor: _sharedUi.macOSColors.text.muted,
|
|
95
|
+
returnKeyType: "done",
|
|
96
|
+
autoCapitalize: "none",
|
|
97
|
+
autoCorrect: false,
|
|
98
|
+
style: styles.patternInput
|
|
99
|
+
})
|
|
100
|
+
})]
|
|
101
|
+
}), ignoredPatterns.size > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
102
|
+
style: styles.section,
|
|
103
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
104
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Icon, {
|
|
105
|
+
icon: _sharedUi.Filter,
|
|
106
|
+
color: _sharedUi.buoyColors.textSecondary,
|
|
107
|
+
size: 12
|
|
108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
109
|
+
children: "ACTIVE FILTERS"
|
|
110
|
+
})]
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
112
|
+
style: styles.patternList,
|
|
113
|
+
children: Array.from(ignoredPatterns).map(pattern => {
|
|
114
|
+
const atomColor = getAtomColorForPattern(pattern, atoms);
|
|
115
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
116
|
+
style: styles.patternRow,
|
|
117
|
+
onPress: () => onTogglePattern(pattern),
|
|
118
|
+
activeOpacity: 0.8,
|
|
119
|
+
children: [atomColor ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
120
|
+
style: [styles.atomDot, {
|
|
121
|
+
backgroundColor: atomColor
|
|
122
|
+
}]
|
|
123
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
124
|
+
style: [styles.patternText, atomColor ? {
|
|
125
|
+
color: atomColor
|
|
126
|
+
} : null],
|
|
127
|
+
numberOfLines: 1,
|
|
128
|
+
children: pattern
|
|
129
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
|
|
130
|
+
size: 12,
|
|
131
|
+
color: _sharedUi.buoyColors.primary + "80"
|
|
132
|
+
})]
|
|
133
|
+
}, pattern);
|
|
134
|
+
})
|
|
135
|
+
})]
|
|
136
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
137
|
+
style: styles.section,
|
|
138
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
139
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Icon, {
|
|
140
|
+
icon: _sharedUi.Filter,
|
|
141
|
+
color: _sharedUi.buoyColors.textSecondary,
|
|
142
|
+
size: 12
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
144
|
+
children: "HOW ATOM FILTERS WORK"
|
|
145
|
+
})]
|
|
146
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
147
|
+
style: styles.howItWorksText,
|
|
148
|
+
children: "Patterns hide matching atoms from both the Atoms tab and the Events tab. Tap an atom above to quickly add it as a filter."
|
|
149
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
150
|
+
style: styles.examplesContainer,
|
|
151
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
152
|
+
style: styles.examplesTitle,
|
|
153
|
+
children: "EXAMPLES:"
|
|
154
|
+
}), ["• count -> hides countAtom from atoms & events", "• auth -> hides authAtom, authStatusAtom", "• user -> hides userAtom from both tabs"].map(ex => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
155
|
+
style: styles.exampleItem,
|
|
156
|
+
children: ex
|
|
157
|
+
}, ex))]
|
|
158
|
+
})]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
const styles = _reactNative.StyleSheet.create({
|
|
163
|
+
container: {
|
|
164
|
+
flex: 1,
|
|
165
|
+
backgroundColor: _sharedUi.buoyColors.base
|
|
166
|
+
},
|
|
167
|
+
scrollContent: {
|
|
168
|
+
paddingTop: 16,
|
|
169
|
+
paddingHorizontal: 16,
|
|
170
|
+
paddingBottom: 24,
|
|
171
|
+
gap: 16
|
|
172
|
+
},
|
|
173
|
+
section: {
|
|
174
|
+
backgroundColor: _sharedUi.buoyColors.card,
|
|
175
|
+
borderRadius: 16,
|
|
176
|
+
borderWidth: 1,
|
|
177
|
+
borderColor: _sharedUi.buoyColors.border,
|
|
178
|
+
overflow: "hidden"
|
|
179
|
+
},
|
|
180
|
+
atomList: {
|
|
181
|
+
maxHeight: 180
|
|
182
|
+
},
|
|
183
|
+
atomListContent: {
|
|
184
|
+
paddingHorizontal: 16,
|
|
185
|
+
paddingTop: 8,
|
|
186
|
+
paddingBottom: 16,
|
|
187
|
+
gap: 10
|
|
188
|
+
},
|
|
189
|
+
atomRow: {
|
|
190
|
+
flexDirection: "row",
|
|
191
|
+
alignItems: "center",
|
|
192
|
+
gap: 10,
|
|
193
|
+
paddingVertical: 10,
|
|
194
|
+
paddingHorizontal: 12,
|
|
195
|
+
backgroundColor: _sharedUi.buoyColors.hover,
|
|
196
|
+
borderRadius: 8,
|
|
197
|
+
borderWidth: 1,
|
|
198
|
+
borderColor: _sharedUi.buoyColors.border
|
|
199
|
+
},
|
|
200
|
+
atomRowFiltered: {
|
|
201
|
+
opacity: 0.45
|
|
202
|
+
},
|
|
203
|
+
atomDot: {
|
|
204
|
+
width: 7,
|
|
205
|
+
height: 7,
|
|
206
|
+
borderRadius: 3.5
|
|
207
|
+
},
|
|
208
|
+
atomRowText: {
|
|
209
|
+
flex: 1,
|
|
210
|
+
fontSize: 12,
|
|
211
|
+
fontWeight: "600",
|
|
212
|
+
fontFamily: "monospace"
|
|
213
|
+
},
|
|
214
|
+
atomRowTextFiltered: {
|
|
215
|
+
color: _sharedUi.macOSColors.text.muted,
|
|
216
|
+
textDecorationLine: "line-through"
|
|
217
|
+
},
|
|
218
|
+
filteredLabel: {
|
|
219
|
+
fontSize: 10,
|
|
220
|
+
fontWeight: "500",
|
|
221
|
+
color: _sharedUi.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: _sharedUi.buoyColors.hover,
|
|
246
|
+
borderRadius: 8,
|
|
247
|
+
borderWidth: 1,
|
|
248
|
+
borderColor: _sharedUi.buoyColors.border,
|
|
249
|
+
gap: 8
|
|
250
|
+
},
|
|
251
|
+
patternText: {
|
|
252
|
+
flex: 1,
|
|
253
|
+
fontSize: 12,
|
|
254
|
+
fontFamily: "monospace",
|
|
255
|
+
color: _sharedUi.buoyColors.text
|
|
256
|
+
},
|
|
257
|
+
howItWorksText: {
|
|
258
|
+
fontSize: 11,
|
|
259
|
+
color: _sharedUi.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: _sharedUi.buoyColors.border,
|
|
271
|
+
marginTop: 12
|
|
272
|
+
},
|
|
273
|
+
examplesTitle: {
|
|
274
|
+
fontSize: 10,
|
|
275
|
+
fontWeight: "600",
|
|
276
|
+
color: _sharedUi.buoyColors.textMuted,
|
|
277
|
+
fontFamily: "monospace",
|
|
278
|
+
letterSpacing: 0.5,
|
|
279
|
+
marginBottom: 6
|
|
280
|
+
},
|
|
281
|
+
exampleItem: {
|
|
282
|
+
fontSize: 10,
|
|
283
|
+
color: _sharedUi.buoyColors.textMuted,
|
|
284
|
+
fontFamily: "monospace",
|
|
285
|
+
lineHeight: 16
|
|
286
|
+
},
|
|
287
|
+
emptyText: {
|
|
288
|
+
fontSize: 11,
|
|
289
|
+
color: _sharedUi.macOSColors.text.muted,
|
|
290
|
+
paddingHorizontal: 16,
|
|
291
|
+
paddingVertical: 12,
|
|
292
|
+
fontFamily: "monospace"
|
|
293
|
+
},
|
|
294
|
+
patternInput: {
|
|
295
|
+
borderWidth: 1,
|
|
296
|
+
borderColor: _sharedUi.buoyColors.primary + "40",
|
|
297
|
+
borderRadius: 8,
|
|
298
|
+
paddingHorizontal: 12,
|
|
299
|
+
paddingVertical: 8,
|
|
300
|
+
fontSize: 12,
|
|
301
|
+
color: _sharedUi.buoyColors.text,
|
|
302
|
+
fontFamily: "monospace",
|
|
303
|
+
backgroundColor: _sharedUi.buoyColors.input
|
|
304
|
+
}
|
|
305
|
+
});
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.JOTAI_ICON_COLOR = void 0;
|
|
7
|
+
exports.JotaiIcon = JotaiIcon;
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* Jotai DevTools icon
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const JOTAI_ICON_COLOR = exports.JOTAI_ICON_COLOR = "#6C47FF";
|
|
15
|
+
function JotaiIcon({
|
|
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 || JOTAI_ICON_COLOR,
|
|
30
|
+
fontWeight: "700"
|
|
31
|
+
},
|
|
32
|
+
children: "J"
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|