@buoy-gg/storage 1.7.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 (187) hide show
  1. package/README.md +607 -0
  2. package/lib/commonjs/index.js +34 -0
  3. package/lib/commonjs/package.json +1 -0
  4. package/lib/commonjs/preset.js +94 -0
  5. package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +356 -0
  6. package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +29 -0
  7. package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +121 -0
  8. package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +419 -0
  9. package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +122 -0
  10. package/lib/commonjs/storage/components/GameUIStorageBrowser.js +924 -0
  11. package/lib/commonjs/storage/components/GameUIStorageStats.js +746 -0
  12. package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +257 -0
  13. package/lib/commonjs/storage/components/MMKVInstanceSelector.js +418 -0
  14. package/lib/commonjs/storage/components/SelectionActionBar.js +224 -0
  15. package/lib/commonjs/storage/components/StorageActionButtons.js +239 -0
  16. package/lib/commonjs/storage/components/StorageActions.js +192 -0
  17. package/lib/commonjs/storage/components/StorageBrowserMode.js +31 -0
  18. package/lib/commonjs/storage/components/StorageEventDetailContent.js +1025 -0
  19. package/lib/commonjs/storage/components/StorageEventFilterView.js +141 -0
  20. package/lib/commonjs/storage/components/StorageEventListener.js +357 -0
  21. package/lib/commonjs/storage/components/StorageEventsSection.js +24 -0
  22. package/lib/commonjs/storage/components/StorageFilterCards.js +345 -0
  23. package/lib/commonjs/storage/components/StorageFilterViewV2.js +42 -0
  24. package/lib/commonjs/storage/components/StorageKeyCard.js +516 -0
  25. package/lib/commonjs/storage/components/StorageKeyRow.js +356 -0
  26. package/lib/commonjs/storage/components/StorageKeySection.js +105 -0
  27. package/lib/commonjs/storage/components/StorageKeyStats.js +344 -0
  28. package/lib/commonjs/storage/components/StorageModalWithTabs.js +871 -0
  29. package/lib/commonjs/storage/components/StorageSection.js +43 -0
  30. package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +126 -0
  31. package/lib/commonjs/storage/hooks/useMMKVInstances.js +221 -0
  32. package/lib/commonjs/storage/hooks/useMMKVKeys.js +362 -0
  33. package/lib/commonjs/storage/hooks/useTickEverySecond.js +21 -0
  34. package/lib/commonjs/storage/index.js +148 -0
  35. package/lib/commonjs/storage/types.js +5 -0
  36. package/lib/commonjs/storage/utils/AsyncStorageListener.js +510 -0
  37. package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +202 -0
  38. package/lib/commonjs/storage/utils/MMKVListener.js +380 -0
  39. package/lib/commonjs/storage/utils/clearAllStorage.js +47 -0
  40. package/lib/commonjs/storage/utils/index.js +180 -0
  41. package/lib/commonjs/storage/utils/lineDiff.js +363 -0
  42. package/lib/commonjs/storage/utils/mmkvAvailability.js +62 -0
  43. package/lib/commonjs/storage/utils/mmkvTypeDetection.js +139 -0
  44. package/lib/commonjs/storage/utils/objectDiff.js +157 -0
  45. package/lib/commonjs/storage/utils/safeAsyncStorage.js +140 -0
  46. package/lib/commonjs/storage/utils/storageActionHelpers.js +46 -0
  47. package/lib/commonjs/storage/utils/storageQueryUtils.js +35 -0
  48. package/lib/commonjs/storage/utils/valueType.js +18 -0
  49. package/lib/module/index.js +7 -0
  50. package/lib/module/preset.js +89 -0
  51. package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +352 -0
  52. package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +25 -0
  53. package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +117 -0
  54. package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +415 -0
  55. package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +118 -0
  56. package/lib/module/storage/components/GameUIStorageBrowser.js +922 -0
  57. package/lib/module/storage/components/GameUIStorageStats.js +742 -0
  58. package/lib/module/storage/components/MMKVInstanceInfoPanel.js +253 -0
  59. package/lib/module/storage/components/MMKVInstanceSelector.js +414 -0
  60. package/lib/module/storage/components/SelectionActionBar.js +221 -0
  61. package/lib/module/storage/components/StorageActionButtons.js +236 -0
  62. package/lib/module/storage/components/StorageActions.js +189 -0
  63. package/lib/module/storage/components/StorageBrowserMode.js +27 -0
  64. package/lib/module/storage/components/StorageEventDetailContent.js +1020 -0
  65. package/lib/module/storage/components/StorageEventFilterView.js +137 -0
  66. package/lib/module/storage/components/StorageEventListener.js +354 -0
  67. package/lib/module/storage/components/StorageEventsSection.js +20 -0
  68. package/lib/module/storage/components/StorageFilterCards.js +341 -0
  69. package/lib/module/storage/components/StorageFilterViewV2.js +38 -0
  70. package/lib/module/storage/components/StorageKeyCard.js +513 -0
  71. package/lib/module/storage/components/StorageKeyRow.js +353 -0
  72. package/lib/module/storage/components/StorageKeySection.js +101 -0
  73. package/lib/module/storage/components/StorageKeyStats.js +340 -0
  74. package/lib/module/storage/components/StorageModalWithTabs.js +867 -0
  75. package/lib/module/storage/components/StorageSection.js +40 -0
  76. package/lib/module/storage/hooks/useAsyncStorageKeys.js +121 -0
  77. package/lib/module/storage/hooks/useMMKVInstances.js +216 -0
  78. package/lib/module/storage/hooks/useMMKVKeys.js +359 -0
  79. package/lib/module/storage/hooks/useTickEverySecond.js +18 -0
  80. package/lib/module/storage/index.js +25 -0
  81. package/lib/module/storage/types.js +3 -0
  82. package/lib/module/storage/utils/AsyncStorageListener.js +500 -0
  83. package/lib/module/storage/utils/MMKVInstanceRegistry.js +196 -0
  84. package/lib/module/storage/utils/MMKVListener.js +367 -0
  85. package/lib/module/storage/utils/clearAllStorage.js +42 -0
  86. package/lib/module/storage/utils/index.js +22 -0
  87. package/lib/module/storage/utils/lineDiff.js +359 -0
  88. package/lib/module/storage/utils/mmkvAvailability.js +56 -0
  89. package/lib/module/storage/utils/mmkvTypeDetection.js +133 -0
  90. package/lib/module/storage/utils/objectDiff.js +153 -0
  91. package/lib/module/storage/utils/safeAsyncStorage.js +134 -0
  92. package/lib/module/storage/utils/storageActionHelpers.js +42 -0
  93. package/lib/module/storage/utils/storageQueryUtils.js +30 -0
  94. package/lib/module/storage/utils/valueType.js +14 -0
  95. package/lib/typescript/index.d.ts +3 -0
  96. package/lib/typescript/index.d.ts.map +1 -0
  97. package/lib/typescript/preset.d.ts +90 -0
  98. package/lib/typescript/preset.d.ts.map +1 -0
  99. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +18 -0
  100. package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +1 -0
  101. package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts +7 -0
  102. package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +1 -0
  103. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +12 -0
  104. package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts.map +1 -0
  105. package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts +13 -0
  106. package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +1 -0
  107. package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts +64 -0
  108. package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +1 -0
  109. package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts +16 -0
  110. package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -0
  111. package/lib/typescript/storage/components/GameUIStorageStats.d.ts +7 -0
  112. package/lib/typescript/storage/components/GameUIStorageStats.d.ts.map +1 -0
  113. package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts +42 -0
  114. package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +1 -0
  115. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +35 -0
  116. package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +1 -0
  117. package/lib/typescript/storage/components/SelectionActionBar.d.ts +21 -0
  118. package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +1 -0
  119. package/lib/typescript/storage/components/StorageActionButtons.d.ts +21 -0
  120. package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -0
  121. package/lib/typescript/storage/components/StorageActions.d.ts +10 -0
  122. package/lib/typescript/storage/components/StorageActions.d.ts.map +1 -0
  123. package/lib/typescript/storage/components/StorageBrowserMode.d.ts +18 -0
  124. package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +1 -0
  125. package/lib/typescript/storage/components/StorageEventDetailContent.d.ts +40 -0
  126. package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +1 -0
  127. package/lib/typescript/storage/components/StorageEventFilterView.d.ts +11 -0
  128. package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +1 -0
  129. package/lib/typescript/storage/components/StorageEventListener.d.ts +6 -0
  130. package/lib/typescript/storage/components/StorageEventListener.d.ts.map +1 -0
  131. package/lib/typescript/storage/components/StorageEventsSection.d.ts +7 -0
  132. package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +1 -0
  133. package/lib/typescript/storage/components/StorageFilterCards.d.ts +36 -0
  134. package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +1 -0
  135. package/lib/typescript/storage/components/StorageFilterViewV2.d.ts +9 -0
  136. package/lib/typescript/storage/components/StorageFilterViewV2.d.ts.map +1 -0
  137. package/lib/typescript/storage/components/StorageKeyCard.d.ts +17 -0
  138. package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +1 -0
  139. package/lib/typescript/storage/components/StorageKeyRow.d.ts +15 -0
  140. package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +1 -0
  141. package/lib/typescript/storage/components/StorageKeySection.d.ts +25 -0
  142. package/lib/typescript/storage/components/StorageKeySection.d.ts.map +1 -0
  143. package/lib/typescript/storage/components/StorageKeyStats.d.ts +15 -0
  144. package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +1 -0
  145. package/lib/typescript/storage/components/StorageModalWithTabs.d.ts +13 -0
  146. package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +1 -0
  147. package/lib/typescript/storage/components/StorageSection.d.ts +10 -0
  148. package/lib/typescript/storage/components/StorageSection.d.ts.map +1 -0
  149. package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts +10 -0
  150. package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +1 -0
  151. package/lib/typescript/storage/hooks/useMMKVInstances.d.ts +114 -0
  152. package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +1 -0
  153. package/lib/typescript/storage/hooks/useMMKVKeys.d.ts +94 -0
  154. package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +1 -0
  155. package/lib/typescript/storage/hooks/useTickEverySecond.d.ts +6 -0
  156. package/lib/typescript/storage/hooks/useTickEverySecond.d.ts.map +1 -0
  157. package/lib/typescript/storage/index.d.ts +15 -0
  158. package/lib/typescript/storage/index.d.ts.map +1 -0
  159. package/lib/typescript/storage/types.d.ts +41 -0
  160. package/lib/typescript/storage/types.d.ts.map +1 -0
  161. package/lib/typescript/storage/utils/AsyncStorageListener.d.ts +195 -0
  162. package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +1 -0
  163. package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts +224 -0
  164. package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +1 -0
  165. package/lib/typescript/storage/utils/MMKVListener.d.ts +218 -0
  166. package/lib/typescript/storage/utils/MMKVListener.d.ts.map +1 -0
  167. package/lib/typescript/storage/utils/clearAllStorage.d.ts +11 -0
  168. package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +1 -0
  169. package/lib/typescript/storage/utils/index.d.ts +8 -0
  170. package/lib/typescript/storage/utils/index.d.ts.map +1 -0
  171. package/lib/typescript/storage/utils/lineDiff.d.ts +34 -0
  172. package/lib/typescript/storage/utils/lineDiff.d.ts.map +1 -0
  173. package/lib/typescript/storage/utils/mmkvAvailability.d.ts +23 -0
  174. package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +1 -0
  175. package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts +71 -0
  176. package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +1 -0
  177. package/lib/typescript/storage/utils/objectDiff.d.ts +35 -0
  178. package/lib/typescript/storage/utils/objectDiff.d.ts.map +1 -0
  179. package/lib/typescript/storage/utils/safeAsyncStorage.d.ts +56 -0
  180. package/lib/typescript/storage/utils/safeAsyncStorage.d.ts.map +1 -0
  181. package/lib/typescript/storage/utils/storageActionHelpers.d.ts +5 -0
  182. package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +1 -0
  183. package/lib/typescript/storage/utils/storageQueryUtils.d.ts +6 -0
  184. package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +1 -0
  185. package/lib/typescript/storage/utils/valueType.d.ts +3 -0
  186. package/lib/typescript/storage/utils/valueType.d.ts.map +1 -0
  187. package/package.json +68 -0
@@ -0,0 +1,224 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SelectionActionBar = SelectionActionBar;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ // Lazy load the license hooks to avoid circular dependencies
14
+ let _useIsPro = null;
15
+ let _licenseLoadAttempted = false;
16
+ function loadLicenseModule() {
17
+ if (_licenseLoadAttempted) return;
18
+ _licenseLoadAttempted = true;
19
+ try {
20
+ const mod = require("@buoy-gg/license");
21
+ if (mod) {
22
+ _useIsPro = mod.useIsPro ?? null;
23
+ }
24
+ } catch {
25
+ // License package not available
26
+ }
27
+ }
28
+ function getUseIsPro() {
29
+ loadLicenseModule();
30
+ return _useIsPro ?? (() => false);
31
+ }
32
+ function SelectionActionBar({
33
+ selectedKeys,
34
+ mmkvInstances,
35
+ onDeleteComplete,
36
+ onSelectAll,
37
+ onClearSelection,
38
+ totalVisibleKeys
39
+ }) {
40
+ const [showUpgradeModal, setShowUpgradeModal] = (0, _react.useState)(false);
41
+
42
+ // Check Pro status internally
43
+ const useIsPro = getUseIsPro();
44
+ const isPro = useIsPro();
45
+ const selectedCount = selectedKeys.length;
46
+ const allSelected = selectedCount === totalVisibleKeys && totalVisibleKeys > 0;
47
+
48
+ // Generate copy data for selected keys
49
+ const getCopyData = () => {
50
+ const data = {};
51
+ selectedKeys.forEach(key => {
52
+ const prefix = key.instanceId ? `[${key.storageType}:${key.instanceId}]` : `[${key.storageType}]`;
53
+ data[`${prefix} ${key.key}`] = key.value;
54
+ });
55
+ return {
56
+ selectedCount,
57
+ keys: data,
58
+ timestamp: new Date().toISOString()
59
+ };
60
+ };
61
+
62
+ // Handle delete selected keys
63
+ const handleDeleteSelected = () => {
64
+ if (selectedCount === 0) return;
65
+
66
+ // Gate delete behind Pro
67
+ if (!isPro) {
68
+ setShowUpgradeModal(true);
69
+ return;
70
+ }
71
+ _reactNative.Alert.alert("Delete Selected Keys", `Delete ${selectedCount} selected key${selectedCount > 1 ? "s" : ""}? This cannot be undone.`, [{
72
+ text: "Cancel",
73
+ style: "cancel"
74
+ }, {
75
+ text: "Delete",
76
+ style: "destructive",
77
+ onPress: async () => {
78
+ try {
79
+ // Group keys by storage type
80
+ const asyncKeys = selectedKeys.filter(k => k.storageType === "async");
81
+ const mmkvKeys = selectedKeys.filter(k => k.storageType === "mmkv");
82
+
83
+ // Delete AsyncStorage keys
84
+ if (asyncKeys.length > 0) {
85
+ await _asyncStorage.default.multiRemove(asyncKeys.map(k => k.key));
86
+ }
87
+
88
+ // Delete MMKV keys
89
+ if (mmkvKeys.length > 0) {
90
+ // Group by instance
91
+ const byInstance = {};
92
+ mmkvKeys.forEach(k => {
93
+ const instanceId = k.instanceId || "default";
94
+ if (!byInstance[instanceId]) byInstance[instanceId] = [];
95
+ byInstance[instanceId].push(k.key);
96
+ });
97
+
98
+ // Delete from each instance
99
+ Object.entries(byInstance).forEach(([instanceId, keys]) => {
100
+ const inst = mmkvInstances.find(i => i.id === instanceId);
101
+ if (inst) {
102
+ keys.forEach(key => inst.instance.delete(key));
103
+ }
104
+ });
105
+ }
106
+ onDeleteComplete?.();
107
+ } catch (error) {
108
+ _reactNative.Alert.alert("Error", `Failed to delete keys: ${error}`);
109
+ }
110
+ }
111
+ }]);
112
+ };
113
+ if (selectedCount === 0) {
114
+ return null;
115
+ }
116
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
117
+ style: styles.container,
118
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
119
+ style: styles.leftSection,
120
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
121
+ style: styles.selectAllButton,
122
+ onPress: allSelected ? onClearSelection : onSelectAll,
123
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CheckSquare, {
124
+ size: 14,
125
+ color: allSelected ? _sharedUi.macOSColors.semantic.info : _sharedUi.macOSColors.text.secondary
126
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
127
+ style: styles.selectAllText,
128
+ children: allSelected ? "Deselect All" : "Select All"
129
+ })]
130
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
131
+ style: styles.countBadge,
132
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
133
+ style: styles.countText,
134
+ children: [selectedCount, " selected"]
135
+ })
136
+ })]
137
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
138
+ style: styles.actionsSection,
139
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CopyButton, {
140
+ value: getCopyData(),
141
+ size: 14,
142
+ buttonStyle: styles.actionButton,
143
+ colors: {
144
+ idle: _sharedUi.macOSColors.semantic.info,
145
+ success: _sharedUi.macOSColors.semantic.success,
146
+ error: _sharedUi.macOSColors.semantic.error
147
+ }
148
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
149
+ style: styles.actionButton,
150
+ onPress: handleDeleteSelected,
151
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
152
+ size: 14,
153
+ color: _sharedUi.macOSColors.semantic.error
154
+ })
155
+ })]
156
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ProUpgradeModal, {
157
+ visible: showUpgradeModal,
158
+ onClose: () => setShowUpgradeModal(false),
159
+ featureName: "Storage Editing"
160
+ })]
161
+ });
162
+ }
163
+ const styles = _reactNative.StyleSheet.create({
164
+ container: {
165
+ flexDirection: "row",
166
+ alignItems: "center",
167
+ justifyContent: "space-between",
168
+ backgroundColor: _sharedUi.macOSColors.semantic.info + "15",
169
+ borderRadius: 8,
170
+ borderWidth: 1,
171
+ borderColor: _sharedUi.macOSColors.semantic.info + "30",
172
+ paddingHorizontal: 12,
173
+ paddingVertical: 8,
174
+ marginBottom: 10
175
+ },
176
+ leftSection: {
177
+ flexDirection: "row",
178
+ alignItems: "center",
179
+ gap: 12
180
+ },
181
+ selectAllButton: {
182
+ flexDirection: "row",
183
+ alignItems: "center",
184
+ gap: 6,
185
+ paddingVertical: 4,
186
+ paddingHorizontal: 8,
187
+ backgroundColor: _sharedUi.macOSColors.background.card,
188
+ borderRadius: 6,
189
+ borderWidth: 1,
190
+ borderColor: _sharedUi.macOSColors.border.default
191
+ },
192
+ selectAllText: {
193
+ fontSize: 11,
194
+ fontWeight: "600",
195
+ color: _sharedUi.macOSColors.text.secondary
196
+ },
197
+ countBadge: {
198
+ backgroundColor: _sharedUi.macOSColors.semantic.info + "20",
199
+ paddingHorizontal: 8,
200
+ paddingVertical: 4,
201
+ borderRadius: 6
202
+ },
203
+ countText: {
204
+ fontSize: 11,
205
+ fontWeight: "700",
206
+ color: _sharedUi.macOSColors.semantic.info,
207
+ fontFamily: "monospace"
208
+ },
209
+ actionsSection: {
210
+ flexDirection: "row",
211
+ alignItems: "center",
212
+ gap: 8
213
+ },
214
+ actionButton: {
215
+ width: 28,
216
+ height: 28,
217
+ alignItems: "center",
218
+ justifyContent: "center",
219
+ borderRadius: 6,
220
+ backgroundColor: _sharedUi.macOSColors.background.card,
221
+ borderWidth: 1,
222
+ borderColor: _sharedUi.macOSColors.border.default
223
+ }
224
+ });
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StorageActionButtons = StorageActionButtons;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _sharedUi = require("@buoy-gg/shared-ui");
10
+ var _asyncStorage = _interopRequireDefault(require("@react-native-async-storage/async-storage"));
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ // Lazy load the license hooks to avoid circular dependencies
14
+ let _useIsPro = null;
15
+ let _licenseLoadAttempted = false;
16
+ function loadLicenseModule() {
17
+ if (_licenseLoadAttempted) return;
18
+ _licenseLoadAttempted = true;
19
+ try {
20
+ const mod = require("@buoy-gg/license");
21
+ if (mod) {
22
+ _useIsPro = mod.useIsPro ?? null;
23
+ }
24
+ } catch {
25
+ // License package not available
26
+ }
27
+ }
28
+ function getUseIsPro() {
29
+ loadLicenseModule();
30
+ return _useIsPro ?? (() => false);
31
+ }
32
+ function StorageActionButtons({
33
+ copyValue,
34
+ mmkvInstances = [],
35
+ activeStorageType = "all",
36
+ onClearComplete,
37
+ isSelectMode = false,
38
+ onToggleSelectMode,
39
+ selectedCount = 0
40
+ }) {
41
+ const [showUpgradeModal, setShowUpgradeModal] = (0, _react.useState)(false);
42
+
43
+ // Check Pro status internally
44
+ const useIsPro = getUseIsPro();
45
+ const isPro = useIsPro();
46
+ const handleClearAsyncStorage = () => {
47
+ // Gate clear behind Pro
48
+ if (!isPro) {
49
+ setShowUpgradeModal(true);
50
+ return;
51
+ }
52
+ _reactNative.Alert.alert("Clear AsyncStorage", "Delete all AsyncStorage keys? This cannot be undone.", [{
53
+ text: "Cancel",
54
+ style: "cancel"
55
+ }, {
56
+ text: "Clear",
57
+ style: "destructive",
58
+ onPress: async () => {
59
+ try {
60
+ await _asyncStorage.default.clear();
61
+ onClearComplete?.();
62
+ } catch (error) {
63
+ _reactNative.Alert.alert("Error", `Failed: ${error}`);
64
+ }
65
+ }
66
+ }]);
67
+ };
68
+ const handleClearMMKV = (instanceId, instanceName) => {
69
+ // Gate clear behind Pro
70
+ if (!isPro) {
71
+ setShowUpgradeModal(true);
72
+ return;
73
+ }
74
+ _reactNative.Alert.alert(`Clear ${instanceName}`, `Delete all keys from ${instanceName}? This cannot be undone.`, [{
75
+ text: "Cancel",
76
+ style: "cancel"
77
+ }, {
78
+ text: "Clear",
79
+ style: "destructive",
80
+ onPress: () => {
81
+ try {
82
+ const inst = mmkvInstances.find(i => i.id === instanceId);
83
+ if (inst) {
84
+ inst.instance.clearAll();
85
+ onClearComplete?.();
86
+ }
87
+ } catch (error) {
88
+ _reactNative.Alert.alert("Error", `Failed: ${error}`);
89
+ }
90
+ }
91
+ }]);
92
+ };
93
+ const handleClearAllMMKV = () => {
94
+ // Gate clear behind Pro
95
+ if (!isPro) {
96
+ setShowUpgradeModal(true);
97
+ return;
98
+ }
99
+ _reactNative.Alert.alert("Clear All MMKV", `Delete all keys from ${mmkvInstances.length} instances? This cannot be undone.`, [{
100
+ text: "Cancel",
101
+ style: "cancel"
102
+ }, {
103
+ text: "Clear All",
104
+ style: "destructive",
105
+ onPress: () => {
106
+ try {
107
+ mmkvInstances.forEach(inst => inst.instance.clearAll());
108
+ onClearComplete?.();
109
+ } catch (error) {
110
+ _reactNative.Alert.alert("Error", `Failed: ${error}`);
111
+ }
112
+ }
113
+ }]);
114
+ };
115
+ const handleClearAll = () => {
116
+ // Gate clear behind Pro
117
+ if (!isPro) {
118
+ setShowUpgradeModal(true);
119
+ return;
120
+ }
121
+ _reactNative.Alert.alert("Clear All Storage", "Delete all storage data? This cannot be undone.", [{
122
+ text: "Cancel",
123
+ style: "cancel"
124
+ }, {
125
+ text: "Clear All",
126
+ style: "destructive",
127
+ onPress: async () => {
128
+ try {
129
+ await _asyncStorage.default.clear();
130
+ mmkvInstances.forEach(inst => inst.instance.clearAll());
131
+ onClearComplete?.();
132
+ } catch (error) {
133
+ _reactNative.Alert.alert("Error", `Failed: ${error}`);
134
+ }
135
+ }
136
+ }]);
137
+ };
138
+ const showAsyncActions = activeStorageType === "all" || activeStorageType === "async";
139
+ const showMMKVActions = activeStorageType === "all" || activeStorageType === "mmkv";
140
+
141
+ // Determine which clear actions to show based on active filter
142
+ const showClearAll = activeStorageType === "all";
143
+ const showClearAsync = showAsyncActions && !showClearAll;
144
+ const showClearMMKVIndividual = showMMKVActions && !showClearAll;
145
+ const showClearAllMMKV = showMMKVActions && mmkvInstances.length > 1 && !showClearAll;
146
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
147
+ style: styles.container,
148
+ children: [onToggleSelectMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
149
+ onPress: onToggleSelectMode,
150
+ style: [styles.actionButton, isSelectMode && styles.actionButtonActive],
151
+ children: isSelectMode ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
152
+ style: styles.selectModeActiveContainer,
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
154
+ size: 14,
155
+ color: _sharedUi.macOSColors.semantic.info
156
+ }), selectedCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
157
+ style: styles.selectedCountText,
158
+ children: selectedCount
159
+ })]
160
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SquareDashed, {
161
+ size: 16,
162
+ color: _sharedUi.macOSColors.text.secondary
163
+ })
164
+ }), !isSelectMode && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CopyButton, {
165
+ value: copyValue,
166
+ size: 16,
167
+ buttonStyle: styles.actionButton,
168
+ colors: {
169
+ idle: _sharedUi.macOSColors.text.secondary,
170
+ success: _sharedUi.macOSColors.semantic.success,
171
+ error: _sharedUi.macOSColors.semantic.error
172
+ }
173
+ }), !isSelectMode && showClearAll && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
174
+ onPress: handleClearAll,
175
+ style: styles.actionButton,
176
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
177
+ size: 16,
178
+ color: _sharedUi.macOSColors.semantic.error
179
+ })
180
+ }), !isSelectMode && showClearAsync && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
181
+ onPress: handleClearAsyncStorage,
182
+ style: styles.actionButton,
183
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
184
+ size: 16,
185
+ color: _sharedUi.macOSColors.semantic.error
186
+ })
187
+ }), !isSelectMode && showClearAllMMKV && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
188
+ onPress: handleClearAllMMKV,
189
+ style: styles.actionButton,
190
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
191
+ size: 16,
192
+ color: _sharedUi.macOSColors.semantic.error
193
+ })
194
+ }), !isSelectMode && showClearMMKVIndividual && mmkvInstances.length === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
195
+ onPress: () => handleClearMMKV(mmkvInstances[0].id, mmkvInstances[0].id),
196
+ style: styles.actionButton,
197
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
198
+ size: 16,
199
+ color: _sharedUi.macOSColors.semantic.error
200
+ })
201
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ProUpgradeModal, {
202
+ visible: showUpgradeModal,
203
+ onClose: () => setShowUpgradeModal(false),
204
+ featureName: "Storage Editing"
205
+ })]
206
+ });
207
+ }
208
+ const styles = _reactNative.StyleSheet.create({
209
+ container: {
210
+ flexDirection: "row",
211
+ alignItems: "center",
212
+ gap: 8
213
+ },
214
+ actionButton: {
215
+ width: 32,
216
+ height: 32,
217
+ alignItems: "center",
218
+ justifyContent: "center",
219
+ borderRadius: 6,
220
+ backgroundColor: _sharedUi.macOSColors.background.input,
221
+ borderWidth: 1,
222
+ borderColor: _sharedUi.macOSColors.border.default
223
+ },
224
+ actionButtonActive: {
225
+ backgroundColor: _sharedUi.macOSColors.semantic.info + "20",
226
+ borderColor: _sharedUi.macOSColors.semantic.info + "40"
227
+ },
228
+ selectModeActiveContainer: {
229
+ flexDirection: "row",
230
+ alignItems: "center",
231
+ gap: 2
232
+ },
233
+ selectedCountText: {
234
+ fontSize: 10,
235
+ fontWeight: "700",
236
+ color: _sharedUi.macOSColors.semantic.info,
237
+ fontFamily: "monospace"
238
+ }
239
+ });
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StorageActions = StorageActions;
7
+ var _reactNative = require("react-native");
8
+ var _react = require("react");
9
+ var _clearAllStorage = require("../utils/clearAllStorage");
10
+ var _sharedUi = require("@buoy-gg/shared-ui");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ // Lazy load the license hooks to avoid circular dependencies
13
+ let _useIsPro = null;
14
+ let _licenseLoadAttempted = false;
15
+ function loadLicenseModule() {
16
+ if (_licenseLoadAttempted) return;
17
+ _licenseLoadAttempted = true;
18
+ try {
19
+ const mod = require("@buoy-gg/license");
20
+ if (mod) {
21
+ _useIsPro = mod.useIsPro ?? null;
22
+ }
23
+ } catch {
24
+ // License package not available
25
+ }
26
+ }
27
+ function getUseIsPro() {
28
+ loadLicenseModule();
29
+ return _useIsPro ?? (() => false);
30
+ }
31
+ function StorageActions({
32
+ storageKeys,
33
+ onClearAll,
34
+ onRefresh,
35
+ totalCount
36
+ }) {
37
+ const [isRefreshing, setIsRefreshing] = (0, _react.useState)(false);
38
+ const [showUpgradeModal, setShowUpgradeModal] = (0, _react.useState)(false);
39
+
40
+ // Check Pro status internally
41
+ const useIsPro = getUseIsPro();
42
+ const isPro = useIsPro();
43
+ const handleRefresh = (0, _react.useCallback)(async () => {
44
+ setIsRefreshing(true);
45
+ try {
46
+ await onRefresh();
47
+ } finally {
48
+ setTimeout(() => setIsRefreshing(false), 500);
49
+ }
50
+ }, [onRefresh]);
51
+ const handleClear = () => {
52
+ // Gate clear behind Pro
53
+ if (!isPro) {
54
+ setShowUpgradeModal(true);
55
+ return;
56
+ }
57
+ _reactNative.Alert.alert("Clear Storage", "Choose what to clear:", [{
58
+ text: "Cancel",
59
+ style: "cancel"
60
+ }, {
61
+ text: "Clear App Data",
62
+ onPress: handleClearAppData
63
+ }, {
64
+ text: "Clear Everything",
65
+ style: "destructive",
66
+ onPress: handleClearEverything
67
+ }]);
68
+ };
69
+ const handleClearAppData = async () => {
70
+ try {
71
+ await onClearAll();
72
+ await onRefresh(); // Auto-refresh after clearing
73
+ } catch (error) {
74
+ _reactNative.Alert.alert("Error", `Failed to clear storage: ${error}`);
75
+ }
76
+ };
77
+ const handleClearEverything = async () => {
78
+ // Clear everything directly without extra confirmation
79
+ try {
80
+ await (0, _clearAllStorage.clearAllStorageIncludingDevTools)();
81
+ await onRefresh(); // Auto-refresh after clearing
82
+
83
+ // Show success message briefly
84
+ _reactNative.Alert.alert("Success", "All storage cleared including dev tools settings.", [{
85
+ text: "OK"
86
+ }], {
87
+ cancelable: true
88
+ });
89
+ } catch (error) {
90
+ _reactNative.Alert.alert("Error", `Failed to clear all storage: ${error}`);
91
+ }
92
+ };
93
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
94
+ style: styles.headerContainer,
95
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
96
+ style: styles.leftSection,
97
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
98
+ style: styles.keyCount,
99
+ children: [totalCount, " ", totalCount === 1 ? "key" : "keys", " found"]
100
+ })
101
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
102
+ style: styles.headerActions,
103
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
104
+ "sentry-label": "ignore storage refresh button",
105
+ onPress: handleRefresh,
106
+ style: [styles.iconButton, isRefreshing && styles.activeButton],
107
+ accessibilityLabel: "Refresh storage",
108
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.RefreshCw, {
109
+ size: 16,
110
+ color: isRefreshing ? "#10B981" : "#9CA3AF"
111
+ })
112
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CopyButton, {
113
+ value: storageKeys,
114
+ size: 16,
115
+ buttonStyle: styles.iconButton,
116
+ colors: {
117
+ idle: "#3B82F6",
118
+ success: "#10B981",
119
+ error: "#F87171"
120
+ }
121
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
122
+ "sentry-label": "ignore storage clear button",
123
+ onPress: handleClear,
124
+ style: styles.iconButton,
125
+ accessibilityLabel: "Clear storage",
126
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Trash2, {
127
+ size: 16,
128
+ color: "#F87171"
129
+ })
130
+ })]
131
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ProUpgradeModal, {
132
+ visible: showUpgradeModal,
133
+ onClose: () => setShowUpgradeModal(false),
134
+ featureName: "Storage Editing"
135
+ })]
136
+ });
137
+ }
138
+ const styles = _reactNative.StyleSheet.create({
139
+ // Header styles matching Sentry pattern
140
+ headerContainer: {
141
+ flexDirection: "row",
142
+ alignItems: "center",
143
+ justifyContent: "space-between",
144
+ paddingHorizontal: 12,
145
+ paddingVertical: 8,
146
+ backgroundColor: "rgba(255, 255, 255, 0.03)",
147
+ borderRadius: 8,
148
+ marginBottom: 12,
149
+ borderWidth: 1,
150
+ borderColor: "rgba(255, 255, 255, 0.08)"
151
+ },
152
+ leftSection: {
153
+ flexDirection: "row",
154
+ alignItems: "center",
155
+ gap: 8
156
+ },
157
+ keyCount: {
158
+ color: "#9CA3AF",
159
+ fontSize: 12,
160
+ fontWeight: "500"
161
+ },
162
+ copiedBadge: {
163
+ backgroundColor: "#10B981",
164
+ paddingHorizontal: 8,
165
+ paddingVertical: 3,
166
+ borderRadius: 10
167
+ },
168
+ copiedText: {
169
+ color: "#FFFFFF",
170
+ fontSize: 10,
171
+ fontWeight: "600"
172
+ },
173
+ headerActions: {
174
+ flexDirection: "row",
175
+ alignItems: "center",
176
+ gap: 8
177
+ },
178
+ iconButton: {
179
+ width: 32,
180
+ height: 32,
181
+ borderRadius: 6,
182
+ backgroundColor: "rgba(255, 255, 255, 0.03)",
183
+ borderWidth: 1,
184
+ borderColor: "rgba(255, 255, 255, 0.08)",
185
+ alignItems: "center",
186
+ justifyContent: "center"
187
+ },
188
+ activeButton: {
189
+ backgroundColor: "rgba(16, 185, 129, 0.1)",
190
+ borderColor: "rgba(16, 185, 129, 0.2)"
191
+ }
192
+ });
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.StorageBrowserMode = StorageBrowserMode;
7
+ var _GameUIStorageBrowser = require("./GameUIStorageBrowser");
8
+ var _jsxRuntime = require("react/jsx-runtime");
9
+ /**
10
+ * Storage browser mode component
11
+ * Displays storage keys with game UI styled interface
12
+ */
13
+ function StorageBrowserMode({
14
+ requiredStorageKeys = [],
15
+ showFilters = false,
16
+ ignoredPatterns = new Set(),
17
+ onTogglePattern,
18
+ onAddPattern,
19
+ searchQuery = "",
20
+ storageDataRef
21
+ }) {
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GameUIStorageBrowser.GameUIStorageBrowser, {
23
+ requiredStorageKeys: requiredStorageKeys,
24
+ showFilters: showFilters,
25
+ ignoredPatterns: ignoredPatterns,
26
+ onTogglePattern: onTogglePattern,
27
+ onAddPattern: onAddPattern,
28
+ searchQuery: searchQuery,
29
+ storageDataRef: storageDataRef
30
+ });
31
+ }