@buoy-gg/jotai 3.0.1 → 3.0.2

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