@buoy-gg/storage 7.0.41 → 7.0.42

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 (180) hide show
  1. package/README.md +11 -90
  2. package/lib/commonjs/index.js +1 -353
  3. package/lib/commonjs/preset.js +1 -85
  4. package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +1 -36
  5. package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -12
  6. package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +1 -24
  7. package/lib/commonjs/storage/components/GameUIStorageBrowser.js +3 -1259
  8. package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +1 -257
  9. package/lib/commonjs/storage/components/MMKVInstanceSelector.js +1 -419
  10. package/lib/commonjs/storage/components/SelectionActionBar.js +1 -207
  11. package/lib/commonjs/storage/components/StorageActionButtons.js +1 -242
  12. package/lib/commonjs/storage/components/StorageBrowserMode.js +1 -61
  13. package/lib/commonjs/storage/components/StorageEventActionButton.js +1 -121
  14. package/lib/commonjs/storage/components/StorageEventCard.js +1 -118
  15. package/lib/commonjs/storage/components/StorageEventDetailContent.js +1 -494
  16. package/lib/commonjs/storage/components/StorageEventFilterView.js +1 -160
  17. package/lib/commonjs/storage/components/StorageEventsSection.js +1 -24
  18. package/lib/commonjs/storage/components/StorageFilterCards.js +1 -231
  19. package/lib/commonjs/storage/components/StorageKeyCard.js +1 -520
  20. package/lib/commonjs/storage/components/StorageKeyDetailScreen.js +1 -579
  21. package/lib/commonjs/storage/components/StorageKeyRow.js +1 -559
  22. package/lib/commonjs/storage/components/StorageKeySection.js +1 -160
  23. package/lib/commonjs/storage/components/StorageKeyStats.js +1 -345
  24. package/lib/commonjs/storage/components/StorageModalWithTabs.js +1 -954
  25. package/lib/commonjs/storage/components/StorageSaveNotice.js +1 -171
  26. package/lib/commonjs/storage/components/StorageSection.js +1 -43
  27. package/lib/commonjs/storage/components/StorageTypeFilterBar.js +1 -144
  28. package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +1 -141
  29. package/lib/commonjs/storage/hooks/useMMKVInstances.js +1 -210
  30. package/lib/commonjs/storage/hooks/useMMKVKeys.js +1 -376
  31. package/lib/commonjs/storage/hooks/useSecureStoreKeys.js +1 -202
  32. package/lib/commonjs/storage/hooks/useStorageEvents.js +1 -61
  33. package/lib/commonjs/storage/stores/storageEventStore.js +1 -312
  34. package/lib/commonjs/storage/sync/storageSyncAdapter.js +1 -492
  35. package/lib/commonjs/storage/types.js +1 -5
  36. package/lib/commonjs/storage/utils/AsyncStorageListener.js +1 -691
  37. package/lib/commonjs/storage/utils/AsyncStorageListener.web.js +1 -89
  38. package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +1 -203
  39. package/lib/commonjs/storage/utils/MMKVListener.js +1 -416
  40. package/lib/commonjs/storage/utils/SecureStoreRegistry.js +1 -200
  41. package/lib/commonjs/storage/utils/asyncStorageCompat.js +1 -89
  42. package/lib/commonjs/storage/utils/browserStorageLifecycle.js +1 -10
  43. package/lib/commonjs/storage/utils/browserStorageLifecycle.web.js +1 -70
  44. package/lib/commonjs/storage/utils/clearAllStorage.js +1 -48
  45. package/lib/commonjs/storage/utils/deleteStorageKeys.js +1 -82
  46. package/lib/commonjs/storage/utils/lineDiff.js +1 -30
  47. package/lib/commonjs/storage/utils/mmkvAvailability.js +1 -62
  48. package/lib/commonjs/storage/utils/mmkvAvailability.web.js +1 -21
  49. package/lib/commonjs/storage/utils/mmkvTypeDetection.js +1 -154
  50. package/lib/commonjs/storage/utils/requiredStorageKeyScope.js +1 -17
  51. package/lib/commonjs/storage/utils/setStorageValue.js +1 -218
  52. package/lib/commonjs/storage/utils/snapshotProvider.js +1 -382
  53. package/lib/commonjs/storage/utils/storageActionHelpers.js +1 -46
  54. package/lib/commonjs/storage/utils/storageBrowserRefresh.js +1 -49
  55. package/lib/commonjs/storage/utils/storageLabels.js +1 -13
  56. package/lib/commonjs/storage/utils/storageLabels.web.js +1 -13
  57. package/lib/commonjs/storage/utils/storageOps.js +1 -53
  58. package/lib/commonjs/storage/utils/storageQueryUtils.js +1 -35
  59. package/lib/commonjs/storage/utils/storageTimeTravelUtils.js +1 -288
  60. package/lib/commonjs/storage/utils/valueType.js +1 -83
  61. package/lib/module/index.js +1 -114
  62. package/lib/module/preset.js +1 -82
  63. package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +1 -32
  64. package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -9
  65. package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +1 -10
  66. package/lib/module/storage/components/GameUIStorageBrowser.js +3 -1257
  67. package/lib/module/storage/components/MMKVInstanceInfoPanel.js +1 -253
  68. package/lib/module/storage/components/MMKVInstanceSelector.js +1 -415
  69. package/lib/module/storage/components/SelectionActionBar.js +1 -204
  70. package/lib/module/storage/components/StorageActionButtons.js +1 -238
  71. package/lib/module/storage/components/StorageBrowserMode.js +1 -57
  72. package/lib/module/storage/components/StorageEventActionButton.js +1 -118
  73. package/lib/module/storage/components/StorageEventCard.js +1 -113
  74. package/lib/module/storage/components/StorageEventDetailContent.js +1 -490
  75. package/lib/module/storage/components/StorageEventFilterView.js +1 -156
  76. package/lib/module/storage/components/StorageEventsSection.js +1 -20
  77. package/lib/module/storage/components/StorageFilterCards.js +1 -227
  78. package/lib/module/storage/components/StorageKeyCard.js +1 -517
  79. package/lib/module/storage/components/StorageKeyDetailScreen.js +1 -577
  80. package/lib/module/storage/components/StorageKeyRow.js +1 -554
  81. package/lib/module/storage/components/StorageKeySection.js +1 -155
  82. package/lib/module/storage/components/StorageKeyStats.js +1 -342
  83. package/lib/module/storage/components/StorageModalWithTabs.js +1 -949
  84. package/lib/module/storage/components/StorageSaveNotice.js +1 -168
  85. package/lib/module/storage/components/StorageSection.js +1 -40
  86. package/lib/module/storage/components/StorageTypeFilterBar.js +1 -139
  87. package/lib/module/storage/hooks/useAsyncStorageKeys.js +1 -136
  88. package/lib/module/storage/hooks/useMMKVInstances.js +1 -204
  89. package/lib/module/storage/hooks/useMMKVKeys.js +1 -371
  90. package/lib/module/storage/hooks/useSecureStoreKeys.js +1 -199
  91. package/lib/module/storage/hooks/useStorageEvents.js +1 -58
  92. package/lib/module/storage/stores/storageEventStore.js +1 -301
  93. package/lib/module/storage/sync/storageSyncAdapter.js +1 -486
  94. package/lib/module/storage/types.js +1 -3
  95. package/lib/module/storage/utils/AsyncStorageListener.js +1 -679
  96. package/lib/module/storage/utils/AsyncStorageListener.web.js +1 -76
  97. package/lib/module/storage/utils/MMKVInstanceRegistry.js +1 -197
  98. package/lib/module/storage/utils/MMKVListener.js +1 -403
  99. package/lib/module/storage/utils/SecureStoreRegistry.js +1 -194
  100. package/lib/module/storage/utils/asyncStorageCompat.js +1 -81
  101. package/lib/module/storage/utils/browserStorageLifecycle.js +1 -6
  102. package/lib/module/storage/utils/browserStorageLifecycle.web.js +1 -66
  103. package/lib/module/storage/utils/clearAllStorage.js +1 -43
  104. package/lib/module/storage/utils/deleteStorageKeys.js +1 -78
  105. package/lib/module/storage/utils/lineDiff.js +1 -12
  106. package/lib/module/storage/utils/mmkvAvailability.js +1 -56
  107. package/lib/module/storage/utils/mmkvAvailability.web.js +1 -15
  108. package/lib/module/storage/utils/mmkvTypeDetection.js +1 -148
  109. package/lib/module/storage/utils/requiredStorageKeyScope.js +1 -13
  110. package/lib/module/storage/utils/setStorageValue.js +1 -209
  111. package/lib/module/storage/utils/snapshotProvider.js +1 -380
  112. package/lib/module/storage/utils/storageActionHelpers.js +1 -42
  113. package/lib/module/storage/utils/storageBrowserRefresh.js +1 -44
  114. package/lib/module/storage/utils/storageLabels.js +1 -9
  115. package/lib/module/storage/utils/storageLabels.web.js +1 -9
  116. package/lib/module/storage/utils/storageOps.js +1 -46
  117. package/lib/module/storage/utils/storageQueryUtils.js +1 -30
  118. package/lib/module/storage/utils/storageTimeTravelUtils.js +1 -281
  119. package/lib/module/storage/utils/valueType.js +1 -76
  120. package/lib/web/index.mjs +2 -3
  121. package/package.json +5 -5
  122. package/lib/typescript/index.d.ts.map +0 -1
  123. package/lib/typescript/preset.d.ts.map +0 -1
  124. package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +0 -1
  125. package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +0 -1
  126. package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +0 -1
  127. package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +0 -1
  128. package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +0 -1
  129. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +0 -1
  130. package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +0 -1
  131. package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +0 -1
  132. package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +0 -1
  133. package/lib/typescript/storage/components/StorageEventActionButton.d.ts.map +0 -1
  134. package/lib/typescript/storage/components/StorageEventCard.d.ts.map +0 -1
  135. package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +0 -1
  136. package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +0 -1
  137. package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +0 -1
  138. package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +0 -1
  139. package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +0 -1
  140. package/lib/typescript/storage/components/StorageKeyDetailScreen.d.ts.map +0 -1
  141. package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +0 -1
  142. package/lib/typescript/storage/components/StorageKeySection.d.ts.map +0 -1
  143. package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +0 -1
  144. package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +0 -1
  145. package/lib/typescript/storage/components/StorageSaveNotice.d.ts.map +0 -1
  146. package/lib/typescript/storage/components/StorageSection.d.ts.map +0 -1
  147. package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts.map +0 -1
  148. package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +0 -1
  149. package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +0 -1
  150. package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +0 -1
  151. package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts.map +0 -1
  152. package/lib/typescript/storage/hooks/useStorageEvents.d.ts.map +0 -1
  153. package/lib/typescript/storage/stores/storageEventStore.d.ts.map +0 -1
  154. package/lib/typescript/storage/sync/storageSyncAdapter.d.ts.map +0 -1
  155. package/lib/typescript/storage/types.d.ts.map +0 -1
  156. package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +0 -1
  157. package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts.map +0 -1
  158. package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +0 -1
  159. package/lib/typescript/storage/utils/MMKVListener.d.ts.map +0 -1
  160. package/lib/typescript/storage/utils/SecureStoreRegistry.d.ts.map +0 -1
  161. package/lib/typescript/storage/utils/asyncStorageCompat.d.ts.map +0 -1
  162. package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts.map +0 -1
  163. package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts.map +0 -1
  164. package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +0 -1
  165. package/lib/typescript/storage/utils/deleteStorageKeys.d.ts.map +0 -1
  166. package/lib/typescript/storage/utils/lineDiff.d.ts.map +0 -1
  167. package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +0 -1
  168. package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts.map +0 -1
  169. package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +0 -1
  170. package/lib/typescript/storage/utils/requiredStorageKeyScope.d.ts.map +0 -1
  171. package/lib/typescript/storage/utils/setStorageValue.d.ts.map +0 -1
  172. package/lib/typescript/storage/utils/snapshotProvider.d.ts.map +0 -1
  173. package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +0 -1
  174. package/lib/typescript/storage/utils/storageBrowserRefresh.d.ts.map +0 -1
  175. package/lib/typescript/storage/utils/storageLabels.d.ts.map +0 -1
  176. package/lib/typescript/storage/utils/storageLabels.web.d.ts.map +0 -1
  177. package/lib/typescript/storage/utils/storageOps.d.ts.map +0 -1
  178. package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +0 -1
  179. package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts.map +0 -1
  180. package/lib/typescript/storage/utils/valueType.d.ts.map +0 -1
@@ -1,171 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StorageSaveNotice = StorageSaveNotice;
7
- var _react = require("react");
8
- var _reactNative = require("react-native");
9
- var _sharedUi = require("@buoy-gg/shared-ui");
10
- var _jsxRuntime = require("react/jsx-runtime");
11
- /**
12
- * What a storage edit actually did, as a toast.
13
- *
14
- * ONE SENTENCE, EVERY TIME, NO DETECTION. Saving used to report success and
15
- * stop, which is misleading for any key an app has already read into memory:
16
- * the write lands on disk, the screen does not move, and the next time the
17
- * owner saves it writes its own copy back over the edit.
18
- *
19
- * The obvious fix — work out which live store owns the key and offer to make it
20
- * re-read — was built and then removed on purpose. It required knowing what is
21
- * linked to what, and every route to that knowledge is a guess: key names
22
- * collide across backends, only zustand stores register with Buoy at all, and a
23
- * store can register after the lookup ran. A tool that is right most of the
24
- * time is the problem here, not the fix. There is also no general mechanism to
25
- * reach for — the app owns its cache, and only the app can invalidate it.
26
- *
27
- * So it promises the one thing true for every key, every backend and every
28
- * persistence library, in dev and in release — "applies on next launch" — and
29
- * says it in five words, because a toast is read at a glance or not at all.
30
- * Making a change live NOW is a different operation and lives in the state
31
- * tools, where the store you mean is the one you are already looking at.
32
- *
33
- * WHY IT FLOATS. It first shipped inline, above the filter cards and INSIDE the
34
- * scroller — so it scrolled away with the content and you had to go looking for
35
- * the thing that was meant to catch your eye. It is pinned over the top of the
36
- * tool now, and takes itself away, because a message about a save you just made
37
- * has a short useful life and should not need dismissing.
38
- */
39
-
40
- /** Five words is one glance, so it does not need to linger like a sentence. */const VISIBLE_MS = 2600;
41
- const FADE_MS = 180;
42
- function StorageSaveNotice({
43
- onDone
44
- }) {
45
- const progress = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
46
-
47
- // Latest-ref: the host passes an inline arrow, and depending on it directly
48
- // would restart the animation on every parent render — the toast would never
49
- // reach its own fade-out.
50
- const onDoneRef = (0, _react.useRef)(onDone);
51
- onDoneRef.current = onDone;
52
- (0, _react.useEffect)(() => {
53
- const animation = _reactNative.Animated.sequence([_reactNative.Animated.timing(progress, {
54
- toValue: 1,
55
- duration: FADE_MS,
56
- easing: _reactNative.Easing.out(_reactNative.Easing.quad),
57
- useNativeDriver: true
58
- }), _reactNative.Animated.delay(VISIBLE_MS), _reactNative.Animated.timing(progress, {
59
- toValue: 0,
60
- duration: FADE_MS,
61
- easing: _reactNative.Easing.in(_reactNative.Easing.quad),
62
- useNativeDriver: true
63
- })]);
64
- animation.start(({
65
- finished
66
- }) => {
67
- // Only when it ran to the end: a stop() from unmount must not call back
68
- // into a host that is already tearing this down.
69
- if (finished) onDoneRef.current();
70
- });
71
- return () => animation.stop();
72
- }, [progress]);
73
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
74
- pointerEvents: "box-none",
75
- style: [styles.wrap, {
76
- opacity: progress,
77
- transform: [{
78
- translateY: progress.interpolate({
79
- inputRange: [0, 1],
80
- outputRange: [-10, 0]
81
- })
82
- }]
83
- }],
84
- testID: "buoy-storage-save-notice",
85
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
86
- activeOpacity: 0.85,
87
- onPress: () => onDoneRef.current(),
88
- style: styles.toast,
89
- accessibilityRole: "button"
90
- // The visible text is a fragment; the label is the whole thought, for
91
- // anyone who gets this read aloud rather than glanced at.
92
- ,
93
- accessibilityLabel: "Saved. Applies on the app's next launch. Tap to dismiss.",
94
- testID: "buoy-storage-save-notice-dismiss",
95
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
96
- style: styles.tick,
97
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Check, {
98
- size: 10,
99
- color: _sharedUi.macOSColors.semantic.success
100
- })
101
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
102
- style: styles.saved,
103
- children: "Saved"
104
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
105
- style: styles.divider
106
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
107
- style: styles.detail,
108
- children: "applies on next launch"
109
- })]
110
- })
111
- });
112
- }
113
- const styles = _reactNative.StyleSheet.create({
114
- wrap: {
115
- // Pinned over the tool rather than laid out in it, so the scroller cannot
116
- // carry it away. `box-none` keeps the untouched margins clickable.
117
- position: "absolute",
118
- top: 10,
119
- left: 12,
120
- right: 12,
121
- // Above the list, the filter cards and the sticky headers.
122
- zIndex: 100,
123
- elevation: 100,
124
- alignItems: "center"
125
- },
126
- toast: {
127
- // Sized to its content: a five-word toast that spans the tool reads as a
128
- // banner, which is the thing this stopped being.
129
- flexDirection: "row",
130
- alignItems: "center",
131
- paddingVertical: 7,
132
- paddingLeft: 8,
133
- paddingRight: 12,
134
- borderRadius: 999,
135
- backgroundColor: _sharedUi.macOSColors.background.card,
136
- borderWidth: _reactNative.StyleSheet.hairlineWidth,
137
- borderColor: _sharedUi.macOSColors.border.default,
138
- shadowColor: "#000",
139
- shadowOpacity: 0.4,
140
- shadowRadius: 14,
141
- shadowOffset: {
142
- width: 0,
143
- height: 5
144
- }
145
- },
146
- tick: {
147
- width: 16,
148
- height: 16,
149
- borderRadius: 8,
150
- marginRight: 7,
151
- alignItems: "center",
152
- justifyContent: "center",
153
- backgroundColor: _sharedUi.macOSColors.semantic.successBackground
154
- },
155
- saved: {
156
- color: _sharedUi.macOSColors.text.primary,
157
- fontSize: 12,
158
- fontWeight: "600"
159
- },
160
- divider: {
161
- width: _reactNative.StyleSheet.hairlineWidth,
162
- alignSelf: "stretch",
163
- marginHorizontal: 8,
164
- backgroundColor: _sharedUi.macOSColors.border.default
165
- },
166
- // The consequence is the part people already half-know, so it recedes.
167
- detail: {
168
- color: _sharedUi.macOSColors.text.muted,
169
- fontSize: 12
170
- }
171
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageSaveNotice=StorageSaveNotice;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const VISIBLE_MS=2600;const FADE_MS=180;function StorageSaveNotice({onDone:i}){const e=(0,_react.useRef)(new _reactNative.Animated.Value(0)).current;const t=(0,_react.useRef)(i);t.current=i;(0,_react.useEffect)(()=>{const a=_reactNative.Animated.sequence([_reactNative.Animated.timing(e,{toValue:1,duration:FADE_MS,easing:_reactNative.Easing.out(_reactNative.Easing.quad),useNativeDriver:true}),_reactNative.Animated.delay(VISIBLE_MS),_reactNative.Animated.timing(e,{toValue:0,duration:FADE_MS,easing:_reactNative.Easing.in(_reactNative.Easing.quad),useNativeDriver:true})]);a.start(({finished:r})=>{if(r)t.current()});return()=>a.stop()},[e]);return(0,_jsxRuntime.jsx)(_reactNative.Animated.View,{pointerEvents:"box-none",style:[styles.wrap,{opacity:e,transform:[{translateY:e.interpolate({inputRange:[0,1],outputRange:[-10,0]})}]}],testID:"buoy-storage-save-notice",children:(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{activeOpacity:.85,onPress:()=>t.current(),style:styles.toast,accessibilityRole:"button",accessibilityLabel:"Saved. Applies on the app's next launch. Tap to dismiss.",testID:"buoy-storage-save-notice-dismiss",children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.tick,children:(0,_jsxRuntime.jsx)(_sharedUi.Check,{size:10,color:_sharedUi.macOSColors.semantic.success})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.saved,children:"Saved"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.divider}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.detail,children:"applies on next launch"})]})})}const styles=_reactNative.StyleSheet.create({wrap:{position:"absolute",top:10,left:12,right:12,zIndex:100,elevation:100,alignItems:"center"},toast:{flexDirection:"row",alignItems:"center",paddingVertical:7,paddingLeft:8,paddingRight:12,borderRadius:999,backgroundColor:_sharedUi.macOSColors.background.card,borderWidth:_reactNative.StyleSheet.hairlineWidth,borderColor:_sharedUi.macOSColors.border.default,shadowColor:"#000",shadowOpacity:.4,shadowRadius:14,shadowOffset:{width:0,height:5}},tick:{width:16,height:16,borderRadius:8,marginRight:7,alignItems:"center",justifyContent:"center",backgroundColor:_sharedUi.macOSColors.semantic.successBackground},saved:{color:_sharedUi.macOSColors.text.primary,fontSize:12,fontWeight:"600"},divider:{width:_reactNative.StyleSheet.hairlineWidth,alignSelf:"stretch",marginHorizontal:8,backgroundColor:_sharedUi.macOSColors.border.default},detail:{color:_sharedUi.macOSColors.text.muted,fontSize:12}});
@@ -1,43 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StorageSection = StorageSection;
7
- var _sharedUi = require("@buoy-gg/shared-ui");
8
- var _useAsyncStorageKeys = require("../hooks/useAsyncStorageKeys");
9
- var _jsxRuntime = require("react/jsx-runtime");
10
- /**
11
- * Storage section component for the dev tools console.
12
- * Shows storage statistics and provides access to storage browser.
13
- */
14
- function StorageSection({
15
- onPress
16
- }) {
17
- const {
18
- storageKeys
19
- } = (0, _useAsyncStorageKeys.useAsyncStorageKeys)();
20
-
21
- // Filter out dev tool keys for the count
22
- const appKeys = storageKeys.filter(k => !(0, _sharedUi.isDevToolsStorageKey)(k.key));
23
- const asyncCount = appKeys.length;
24
- const total = asyncCount;
25
- const getStorageSubtitle = () => {
26
- if (total === 0) {
27
- return "Empty";
28
- }
29
-
30
- // For now, only AsyncStorage is supported
31
- return `${asyncCount} Async`;
32
- };
33
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CyberpunkSectionButton, {
34
- id: "storage",
35
- title: "STORAGE",
36
- subtitle: getStorageSubtitle(),
37
- icon: _sharedUi.HardDrive,
38
- iconColor: "#00FF88",
39
- iconBackgroundColor: "rgba(0, 255, 136, 0.1)",
40
- onPress: onPress,
41
- index: 2
42
- });
43
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageSection=StorageSection;var _sharedUi=require("@buoy-gg/shared-ui");var _useAsyncStorageKeys=require("../hooks/useAsyncStorageKeys");var _jsxRuntime=require("react/jsx-runtime");function StorageSection({onPress:t}){const{storageKeys:r}=(0,_useAsyncStorageKeys.useAsyncStorageKeys)();const o=r.filter(i=>!(0,_sharedUi.isDevToolsStorageKey)(i.key));const e=o.length;const s=e;const n=()=>{if(s===0){return"Empty"}return`${e} Async`};return(0,_jsxRuntime.jsx)(_sharedUi.CyberpunkSectionButton,{id:"storage",title:"STORAGE",subtitle:n(),icon:_sharedUi.HardDrive,iconColor:"#00FF88",iconBackgroundColor:"rgba(0, 255, 136, 0.1)",onPress:t,index:2})}
@@ -1,144 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.StorageTypeFilterBar = StorageTypeFilterBar;
7
- exports.countByStorageType = countByStorageType;
8
- var _storageLabels = require("../utils/storageLabels");
9
- var _reactNative = require("react-native");
10
- var _sharedUi = require("@buoy-gg/shared-ui");
11
- var _jsxRuntime = require("react/jsx-runtime");
12
- /**
13
- * "Which backend?" — the pill row shared by the Keys and Events tabs.
14
- *
15
- * Both tabs answer questions about the same three backends, so asking the
16
- * question two different ways (or, as it was, only on one tab) is a gap rather
17
- * than a simplification: you filter the key list to Keychain, switch to Events
18
- * to see what wrote to it, and you're looking at everything again.
19
- *
20
- * The selection is owned by the modal and passed to both, so switching tabs
21
- * keeps the filter you set.
22
- *
23
- * Each pill carries the count it WOULD show, computed before the type filter is
24
- * applied — a count that collapsed to zero the moment you picked another type
25
- * would tell you nothing about where to look next.
26
- */
27
-
28
- /**
29
- * One entry per pill. This was four near-identical blocks of JSX differing only
30
- * in three colours and a label, which is how "All Types" ended up with a
31
- * hover-grey active state while the others used their own hue.
32
- */
33
- const SEGMENTS = [{
34
- id: "all",
35
- label: "All Types",
36
- color: null
37
- }, {
38
- id: "async",
39
- label: _storageLabels.storageLabels.async,
40
- color: _sharedUi.macOSColors.semantic.warning
41
- }, {
42
- id: "mmkv",
43
- label: _storageLabels.storageLabels.mmkv,
44
- color: _sharedUi.macOSColors.semantic.info
45
- }, {
46
- id: "secure",
47
- label: "Secure",
48
- color: _sharedUi.macOSColors.semantic.success
49
- }];
50
- function StorageTypeFilterBar({
51
- active,
52
- onChange,
53
- counts
54
- }) {
55
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
56
- style: styles.row,
57
- children: SEGMENTS.filter(segment => _storageLabels.storageLabels.hasSecure || segment.id !== 'secure').map(segment => {
58
- const isActive = active === segment.id;
59
- const accent = segment.color ?? _sharedUi.night.color.accent;
60
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
61
- testID: `buoy-storage-type-${segment.id}`,
62
- accessibilityRole: "button",
63
- accessibilityLabel: `Filter by ${segment.label}`,
64
- accessibilityState: {
65
- selected: isActive
66
- },
67
- activeOpacity: 0.8,
68
- onPress: () => onChange(segment.id),
69
- style: [styles.pill, {
70
- borderColor: _sharedUi.night.color.border
71
- }, isActive && [styles.pillActive, segment.color ? {
72
- backgroundColor: segment.color + "15",
73
- borderColor: segment.color + "40"
74
- } : {
75
- backgroundColor: _sharedUi.night.color.accentSoft,
76
- borderColor: _sharedUi.night.color.accentBorderStrong
77
- }]],
78
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
79
- style: [styles.label, isActive && {
80
- color: accent,
81
- fontWeight: "600"
82
- }],
83
- children: segment.label
84
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
85
- style: [styles.value, {
86
- color: isActive ? accent : _sharedUi.night.color.textTertiary
87
- }],
88
- children: counts[segment.id]
89
- })]
90
- }, segment.id);
91
- })
92
- });
93
- }
94
-
95
- /** Tally a list of things that each know which backend they came from. */
96
- function countByStorageType(items) {
97
- const counts = {
98
- all: items.length,
99
- async: 0,
100
- mmkv: 0,
101
- secure: 0
102
- };
103
- for (const item of items) counts[item.storageType] += 1;
104
- return counts;
105
- }
106
- const styles = _reactNative.StyleSheet.create({
107
- row: {
108
- flexDirection: "row",
109
- gap: 8,
110
- marginTop: 2
111
- },
112
- pill: {
113
- flex: 1,
114
- backgroundColor: _sharedUi.night.color.buttonSurface,
115
- borderRadius: 8,
116
- borderWidth: 1,
117
- borderColor: _sharedUi.night.color.border,
118
- paddingVertical: 6,
119
- paddingHorizontal: 8,
120
- alignItems: "center",
121
- justifyContent: "center",
122
- minHeight: 32
123
- },
124
- pillActive: {
125
- borderWidth: 1,
126
- transform: [{
127
- scale: 1.005
128
- }]
129
- },
130
- label: {
131
- fontSize: 9,
132
- color: _sharedUi.night.color.textSecondary,
133
- textTransform: "uppercase",
134
- letterSpacing: 0.4,
135
- fontWeight: "500",
136
- marginBottom: 1
137
- },
138
- value: {
139
- fontSize: 12,
140
- fontWeight: "600",
141
- fontFamily: _sharedUi.monoFont,
142
- lineHeight: 14
143
- }
144
- });
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageTypeFilterBar=StorageTypeFilterBar;exports.countByStorageType=countByStorageType;var _storageLabels=require("../utils/storageLabels");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SEGMENTS=[{id:"all",label:"All Types",color:null},{id:"async",label:_storageLabels.storageLabels.async,color:_sharedUi.macOSColors.semantic.warning},{id:"mmkv",label:_storageLabels.storageLabels.mmkv,color:_sharedUi.macOSColors.semantic.info},{id:"secure",label:"Secure",color:_sharedUi.macOSColors.semantic.success}];function StorageTypeFilterBar({active:r,onChange:o,counts:l}){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.row,children:SEGMENTS.filter(e=>_storageLabels.storageLabels.hasSecure||e.id!=="secure").map(e=>{const t=r===e.id;const i=e.color??_sharedUi.night.color.accent;return(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{testID:`buoy-storage-type-${e.id}`,accessibilityRole:"button",accessibilityLabel:`Filter by ${e.label}`,accessibilityState:{selected:t},activeOpacity:.8,onPress:()=>o(e.id),style:[styles.pill,{borderColor:_sharedUi.night.color.border},t&&[styles.pillActive,e.color?{backgroundColor:e.color+"15",borderColor:e.color+"40"}:{backgroundColor:_sharedUi.night.color.accentSoft,borderColor:_sharedUi.night.color.accentBorderStrong}]],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.label,t&&{color:i,fontWeight:"600"}],children:e.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.value,{color:t?i:_sharedUi.night.color.textTertiary}],children:l[e.id]})]},e.id)})})}function countByStorageType(r){const o={all:r.length,async:0,mmkv:0,secure:0};for(const l of r)o[l.storageType]+=1;return o}const styles=_reactNative.StyleSheet.create({row:{flexDirection:"row",gap:8,marginTop:2},pill:{flex:1,backgroundColor:_sharedUi.night.color.buttonSurface,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border,paddingVertical:6,paddingHorizontal:8,alignItems:"center",justifyContent:"center",minHeight:32},pillActive:{borderWidth:1,transform:[{scale:1.005}]},label:{fontSize:9,color:_sharedUi.night.color.textSecondary,textTransform:"uppercase",letterSpacing:.4,fontWeight:"500",marginBottom:1},value:{fontSize:12,fontWeight:"600",fontFamily:_sharedUi.monoFont,lineHeight:14}});
@@ -1,141 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useAsyncStorageKeys = useAsyncStorageKeys;
7
- var _react = require("react");
8
- var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
9
- var _asyncStorageCompat = require("../utils/asyncStorageCompat");
10
- var _requiredStorageKeyScope = require("../utils/requiredStorageKeyScope");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- function useAsyncStorageKeys(requiredStorageKeys = []) {
13
- // State management
14
- const [storageKeys, setStorageKeys] = (0, _react.useState)([]);
15
- const [isLoading, setIsLoading] = (0, _react.useState)(true);
16
- const [error, setError] = (0, _react.useState)(null);
17
-
18
- // Callers routinely pass a fresh array literal (or rely on the `= []`
19
- // default, which is a new array every render). Depending on its identity
20
- // would recreate `fetchStorageData` each render, re-fire the effect, and
21
- // loop AsyncStorage.getAllKeys/multiGet forever. Depend on a stable content
22
- // signature instead, and read the latest array via a ref inside the fetch.
23
- const requiredSignature = JSON.stringify(requiredStorageKeys);
24
- const requiredRef = (0, _react.useRef)(requiredStorageKeys);
25
- requiredRef.current = requiredStorageKeys;
26
-
27
- // Fetch all keys and values from AsyncStorage
28
- const fetchStorageData = (0, _react.useCallback)(async () => {
29
- const requiredStorageKeys = requiredRef.current;
30
- setIsLoading(true);
31
- setError(null);
32
- try {
33
- // 1. Get all keys from AsyncStorage
34
- const allKeys = await _asyncStorage.default.getAllKeys();
35
- if (!allKeys || allKeys.length === 0) {
36
- setStorageKeys([]);
37
- setIsLoading(false);
38
- return;
39
- }
40
-
41
- // 2. Get all values (compat helper normalizes v2 multiGet / v3 getMany)
42
- const allKeyValuePairs = await (0, _asyncStorageCompat.readMany)(allKeys);
43
-
44
- // 3. Process keys into StorageKeyInfo format
45
- const allStorageKeys = [];
46
- allKeyValuePairs.forEach(([key, value]) => {
47
- // Parse value
48
- let parsedValue = value;
49
- if (value) {
50
- try {
51
- parsedValue = JSON.parse(value);
52
- } catch {
53
- parsedValue = value; // Keep as string if not JSON
54
- }
55
- }
56
-
57
- // Check if this is a required key scoped to AsyncStorage
58
- const requiredConfig = requiredStorageKeys.find(req => {
59
- if (!(0, _requiredStorageKeyScope.requiredKeyAppliesTo)(req, 'async')) return false;
60
- if (typeof req === 'string') return req === key;
61
- return req.key === key;
62
- });
63
-
64
- // Determine status
65
- let status = 'optional_present';
66
- if (requiredConfig) {
67
- if (parsedValue === undefined || parsedValue === null) {
68
- status = 'required_missing';
69
- } else if (typeof requiredConfig === 'object' && requiredConfig.expectedValue !== undefined) {
70
- status = parsedValue === requiredConfig.expectedValue ? 'required_present' : 'required_wrong_value';
71
- } else if (typeof requiredConfig === 'object' && requiredConfig.expectedType !== undefined) {
72
- const actualType = parsedValue === null ? 'null' : typeof parsedValue;
73
- status = actualType.toLowerCase() === requiredConfig.expectedType.toLowerCase() ? 'required_present' : 'required_wrong_type';
74
- } else {
75
- status = 'required_present';
76
- }
77
- }
78
- const keyInfo = {
79
- key,
80
- value: parsedValue,
81
- storageType: 'async',
82
- status,
83
- category: requiredConfig ? 'required' : 'optional',
84
- ...(typeof requiredConfig === 'object' && requiredConfig.expectedValue !== undefined && {
85
- expectedValue: requiredConfig.expectedValue
86
- }),
87
- ...(typeof requiredConfig === 'object' && requiredConfig.expectedType !== undefined && {
88
- expectedType: requiredConfig.expectedType
89
- }),
90
- ...(typeof requiredConfig === 'object' && requiredConfig.description !== undefined && {
91
- description: requiredConfig.description
92
- })
93
- };
94
- allStorageKeys.push(keyInfo);
95
- });
96
-
97
- // 4. Add missing required keys (Async-scoped only)
98
- requiredStorageKeys.forEach(req => {
99
- if (!(0, _requiredStorageKeyScope.requiredKeyAppliesTo)(req, 'async')) return;
100
- const key = typeof req === 'string' ? req : req.key;
101
- const exists = allStorageKeys.some(k => k.key === key);
102
- if (!exists) {
103
- allStorageKeys.push({
104
- key,
105
- value: undefined,
106
- storageType: 'async',
107
- status: 'required_missing',
108
- category: 'required',
109
- ...(typeof req === 'object' && req.expectedValue !== undefined && {
110
- expectedValue: req.expectedValue
111
- }),
112
- ...(typeof req === 'object' && req.expectedType !== undefined && {
113
- expectedType: req.expectedType
114
- }),
115
- ...(typeof req === 'object' && req.description !== undefined && {
116
- description: req.description
117
- })
118
- });
119
- }
120
- });
121
- setStorageKeys(allStorageKeys);
122
- } catch (err) {
123
- setError(err instanceof Error ? err : new Error('Failed to fetch storage data'));
124
- setStorageKeys([]);
125
- } finally {
126
- setIsLoading(false);
127
- }
128
- // eslint-disable-next-line react-hooks/exhaustive-deps
129
- }, [requiredSignature]);
130
-
131
- // Initial fetch
132
- (0, _react.useEffect)(() => {
133
- fetchStorageData();
134
- }, [fetchStorageData]);
135
- return {
136
- storageKeys,
137
- isLoading,
138
- error,
139
- refresh: fetchStorageData
140
- };
141
- }
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useAsyncStorageKeys=useAsyncStorageKeys;var _react=require("react");var _asyncStorage=_interopRequireDefault(require("@react-native-async-storage/async-storage"));var _asyncStorageCompat=require("../utils/asyncStorageCompat");var _requiredStorageKeyScope=require("../utils/requiredStorageKeyScope");function _interopRequireDefault(s){return s&&s.__esModule?s:{default:s}}function useAsyncStorageKeys(s=[]){const[g,u]=(0,_react.useState)([]);const[x,d]=(0,_react.useState)(true);const[_,y]=(0,_react.useState)(null);const S=JSON.stringify(s);const f=(0,_react.useRef)(s);f.current=s;const p=(0,_react.useCallback)(async()=>{const l=f.current;d(true);y(null);try{const o=await _asyncStorage.default.getAllKeys();if(!o||o.length===0){u([]);d(false);return}const T=await(0,_asyncStorageCompat.readMany)(o);const c=[];T.forEach(([t,n])=>{let r=n;if(n){try{r=JSON.parse(n)}catch{r=n}}const e=l.find(a=>{if(!(0,_requiredStorageKeyScope.requiredKeyAppliesTo)(a,"async"))return false;if(typeof a==="string")return a===t;return a.key===t});let i="optional_present";if(e){if(r===void 0||r===null){i="required_missing"}else if(typeof e==="object"&&e.expectedValue!==void 0){i=r===e.expectedValue?"required_present":"required_wrong_value"}else if(typeof e==="object"&&e.expectedType!==void 0){const a=r===null?"null":typeof r;i=a.toLowerCase()===e.expectedType.toLowerCase()?"required_present":"required_wrong_type"}else{i="required_present"}}const K={key:t,value:r,storageType:"async",status:i,category:e?"required":"optional",...typeof e==="object"&&e.expectedValue!==void 0&&{expectedValue:e.expectedValue},...typeof e==="object"&&e.expectedType!==void 0&&{expectedType:e.expectedType},...typeof e==="object"&&e.description!==void 0&&{description:e.description}};c.push(K)});l.forEach(t=>{if(!(0,_requiredStorageKeyScope.requiredKeyAppliesTo)(t,"async"))return;const n=typeof t==="string"?t:t.key;const r=c.some(e=>e.key===n);if(!r){c.push({key:n,value:void 0,storageType:"async",status:"required_missing",category:"required",...typeof t==="object"&&t.expectedValue!==void 0&&{expectedValue:t.expectedValue},...typeof t==="object"&&t.expectedType!==void 0&&{expectedType:t.expectedType},...typeof t==="object"&&t.description!==void 0&&{description:t.description}})}});u(c)}catch(o){y(o instanceof Error?o:new Error("Failed to fetch storage data"));u([])}finally{d(false)}},[S]);(0,_react.useEffect)(()=>{p()},[p]);return{storageKeys:g,isLoading:x,error:_,refresh:p}}