@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,517 +1 @@
1
- "use strict";
2
-
3
- import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
4
- import { AlertCircle, CheckCircle2, Eye, XCircle, HardDrive, Database, Shield, gameUIColors, macOSColors, night, monoFont } from "@buoy-gg/shared-ui";
5
- import { getStorageTypeLabel, getStorageTypeHexColor } from "../utils/storageQueryUtils";
6
- import { getValueTypeLabel } from "../utils/valueType";
7
- import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
8
-
9
- // Stable constants moved to module scope to prevent re-renders [[memory:4875251]]
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- const HIT_SLOP = {
12
- top: 6,
13
- bottom: 6,
14
- left: 6,
15
- right: 6
16
- };
17
-
18
- // MMKV Instance color palette - consistent colors per instance
19
- const INSTANCE_COLORS = [macOSColors.semantic.info,
20
- // Blue
21
- macOSColors.semantic.success,
22
- // Green
23
- macOSColors.semantic.warning,
24
- // Orange
25
- macOSColors.semantic.debug,
26
- // Purple
27
- '#FF6B9D',
28
- // Pink
29
- '#00D9FF' // Cyan
30
- ];
31
-
32
- /**
33
- * Get consistent color for an MMKV instance based on its ID
34
- * Uses simple hash to ensure same instance always gets same color
35
- */
36
- function getInstanceColor(instanceId) {
37
- const hash = instanceId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
38
- return INSTANCE_COLORS[hash % INSTANCE_COLORS.length];
39
- }
40
- const getStatusConfig = status => {
41
- switch (status) {
42
- case "required_present":
43
- return {
44
- icon: CheckCircle2,
45
- color: macOSColors.semantic.success,
46
- bgColor: macOSColors.semantic.successBackground,
47
- borderColor: macOSColors.semantic.success + "40",
48
- label: "REQUIRED",
49
- labelColor: macOSColors.semantic.success
50
- };
51
- case "required_missing":
52
- return {
53
- icon: AlertCircle,
54
- color: macOSColors.semantic.error,
55
- bgColor: macOSColors.semantic.errorBackground,
56
- borderColor: macOSColors.semantic.error + "50",
57
- label: "MISSING",
58
- labelColor: macOSColors.semantic.error
59
- };
60
- case "required_wrong_value":
61
- return {
62
- icon: XCircle,
63
- color: macOSColors.semantic.warning,
64
- bgColor: macOSColors.semantic.warningBackground,
65
- borderColor: macOSColors.semantic.warning + "50",
66
- label: "WRONG S",
67
- labelColor: macOSColors.semantic.warning
68
- };
69
- case "required_wrong_type":
70
- return {
71
- icon: XCircle,
72
- color: macOSColors.semantic.info,
73
- bgColor: macOSColors.semantic.infoBackground,
74
- borderColor: macOSColors.semantic.info + "50",
75
- label: "WRONG TYPE",
76
- labelColor: macOSColors.semantic.info
77
- };
78
- case "optional_present":
79
- return {
80
- icon: Eye,
81
- color: macOSColors.semantic.debug,
82
- bgColor: macOSColors.semantic.infoBackground,
83
- borderColor: macOSColors.semantic.debug + "40",
84
- label: "OPTIONAL",
85
- labelColor: macOSColors.semantic.debug
86
- };
87
- }
88
- };
89
- const getStorageIcon = storageType => {
90
- switch (storageType) {
91
- case "mmkv":
92
- return HardDrive;
93
- case "async":
94
- return Database;
95
- case "secure":
96
- return Shield;
97
- default:
98
- return Database;
99
- // Default fallback
100
- }
101
- };
102
-
103
- /**
104
- * Storage key card component following composition principles [[rule3]]
105
- *
106
- * Applied principles:
107
- * - Decompose by Responsibility: Single purpose component for storage key display
108
- * - Prefer Composition over Configuration: Reuses existing patterns from EnvVarCard
109
- * - Extract Reusable Logic: Shares formatValue and status config patterns
110
- */
111
- export function StorageKeyCard({
112
- storageKey,
113
- isExpanded,
114
- onToggle
115
- }) {
116
- const config = getStatusConfig(storageKey.status);
117
- const StatusIcon = config.icon;
118
- const StorageIcon = getStorageIcon(storageKey.storageType);
119
- const hasValue = storageKey.value !== undefined && storageKey.value !== null;
120
- const hasExpectedValue = storageKey.expectedValue !== undefined;
121
- const hasExpectedType = storageKey.expectedType !== undefined;
122
- const storageTypeColor = getStorageTypeHexColor(storageKey.storageType);
123
- const storageTypeLabel = getStorageTypeLabel(storageKey.storageType);
124
- return /*#__PURE__*/_jsxs(View, {
125
- style: [styles.storageKeyCard, {
126
- borderColor: config.borderColor
127
- }],
128
- children: [/*#__PURE__*/_jsxs(TouchableOpacity, {
129
- accessibilityLabel: "Storage key card",
130
- accessibilityHint: "View storage key card",
131
- "sentry-label": `ignore storage key card ${storageKey.key}`,
132
- accessibilityRole: "button",
133
- style: styles.cardHeader,
134
- onPress: onToggle,
135
- children: [/*#__PURE__*/_jsxs(View, {
136
- style: styles.cardHeaderLeft,
137
- children: [/*#__PURE__*/_jsx(View, {
138
- style: [styles.iconContainer, {
139
- backgroundColor: config.bgColor
140
- }],
141
- children: /*#__PURE__*/_jsx(StatusIcon, {
142
- size: 14,
143
- color: config.color
144
- })
145
- }), /*#__PURE__*/_jsxs(View, {
146
- style: styles.cardHeaderInfo,
147
- children: [/*#__PURE__*/_jsx(Text, {
148
- style: styles.storageKeyText,
149
- children: storageKey.key
150
- }), storageKey.description ? /*#__PURE__*/_jsx(Text, {
151
- style: styles.descriptionText,
152
- children: storageKey.description
153
- }) : null, /*#__PURE__*/_jsxs(View, {
154
- style: styles.cardHeaderMeta,
155
- children: [/*#__PURE__*/_jsx(View, {
156
- style: [styles.statusBadge, {
157
- backgroundColor: config.bgColor
158
- }],
159
- children: /*#__PURE__*/_jsx(Text, {
160
- style: [styles.statusText, {
161
- color: config.labelColor
162
- }],
163
- children: config.label
164
- })
165
- }), /*#__PURE__*/_jsxs(View, {
166
- style: [styles.storageBadge, {
167
- backgroundColor: `${storageTypeColor}15`
168
- }],
169
- children: [/*#__PURE__*/_jsx(StorageIcon, {
170
- size: 10,
171
- color: storageTypeColor
172
- }), /*#__PURE__*/_jsx(Text, {
173
- style: [styles.storageText, {
174
- color: storageTypeColor
175
- }],
176
- children: storageTypeLabel
177
- })]
178
- }), storageKey.storageType === 'mmkv' && storageKey.instanceId && /*#__PURE__*/_jsxs(View, {
179
- style: [styles.instanceBadge, {
180
- backgroundColor: getInstanceColor(storageKey.instanceId) + '20',
181
- borderColor: getInstanceColor(storageKey.instanceId) + '40'
182
- }],
183
- children: [/*#__PURE__*/_jsx(HardDrive, {
184
- size: 9,
185
- color: getInstanceColor(storageKey.instanceId)
186
- }), /*#__PURE__*/_jsx(Text, {
187
- style: [styles.instanceText, {
188
- color: getInstanceColor(storageKey.instanceId)
189
- }],
190
- children: storageKey.instanceId
191
- })]
192
- }), hasValue && /*#__PURE__*/_jsx(View, {
193
- style: styles.valueBadge,
194
- children: /*#__PURE__*/_jsx(Text, {
195
- style: styles.valueText,
196
- children: storageKey.valueType ? storageKey.valueType.toUpperCase() : getValueTypeLabel(storageKey.value)
197
- })
198
- })]
199
- })]
200
- })]
201
- }), /*#__PURE__*/_jsx(View, {
202
- style: styles.cardHeaderRight,
203
- children: /*#__PURE__*/_jsx(View, {
204
- style: styles.actionButton,
205
- children: /*#__PURE__*/_jsx(Eye, {
206
- size: 12,
207
- color: night.color.textSecondary
208
- })
209
- })
210
- })]
211
- }), isExpanded && hasValue && /*#__PURE__*/_jsxs(View, {
212
- style: styles.cardBody,
213
- children: [/*#__PURE__*/_jsx(View, {
214
- style: styles.dataViewerContainer,
215
- children: (() => {
216
- const parsed = typeof storageKey.value === "string" ? (() => {
217
- try {
218
- return JSON.parse(storageKey.value);
219
- } catch {
220
- return storageKey.value;
221
- }
222
- })() : storageKey.value;
223
- const isSimple = typeof parsed === "string" || typeof parsed === "number" || typeof parsed === "boolean";
224
- return isSimple ? /*#__PURE__*/_jsxs(View, {
225
- style: styles.simpleValueContainer,
226
- children: [/*#__PURE__*/_jsx(Text, {
227
- style: styles.simpleValueLabel,
228
- children: "Current Value:"
229
- }), /*#__PURE__*/_jsx(View, {
230
- style: styles.simpleValueBox,
231
- children: /*#__PURE__*/_jsx(Text, {
232
- style: styles.simpleValueContent,
233
- selectable: true,
234
- children: String(parsed)
235
- })
236
- }), /*#__PURE__*/_jsxs(Text, {
237
- style: styles.valueTypeText,
238
- children: ["Type: ", getValueTypeLabel(storageKey.value)]
239
- })]
240
- }) : /*#__PURE__*/_jsx(DataViewer, {
241
- title: "Current Value",
242
- data: parsed,
243
- showTypeFilter: false,
244
- rawMode: true
245
- });
246
- })()
247
- }), hasExpectedValue && /*#__PURE__*/_jsxs(View, {
248
- style: styles.valueContainer,
249
- children: [/*#__PURE__*/_jsx(Text, {
250
- style: styles.valueLabel,
251
- children: "Expected Value:"
252
- }), /*#__PURE__*/_jsx(View, {
253
- style: styles.expectedValueBox,
254
- children: /*#__PURE__*/_jsx(Text, {
255
- style: styles.expectedValueContent,
256
- selectable: true,
257
- children: storageKey.expectedValue
258
- })
259
- })]
260
- }), hasExpectedType && storageKey.expectedType && /*#__PURE__*/_jsxs(View, {
261
- style: styles.valueContainer,
262
- children: [/*#__PURE__*/_jsx(Text, {
263
- style: styles.valueLabel,
264
- children: "Expected Type:"
265
- }), /*#__PURE__*/_jsx(View, {
266
- style: styles.expectedValueBox,
267
- children: /*#__PURE__*/_jsx(Text, {
268
- style: styles.expectedValueContent,
269
- selectable: true,
270
- children: storageKey.expectedType.toUpperCase()
271
- })
272
- }), /*#__PURE__*/_jsxs(Text, {
273
- style: styles.typeHelperText,
274
- children: ["Current type: ", getValueTypeLabel(storageKey.value)]
275
- })]
276
- }), storageKey.lastUpdated ? /*#__PURE__*/_jsx(View, {
277
- style: styles.metaInfo,
278
- children: /*#__PURE__*/_jsxs(Text, {
279
- style: styles.metaLabel,
280
- children: ["Last updated: ", storageKey.lastUpdated.toLocaleString()]
281
- })
282
- }) : null]
283
- }), isExpanded && !hasValue && /*#__PURE__*/_jsxs(View, {
284
- style: styles.cardBody,
285
- children: [/*#__PURE__*/_jsxs(View, {
286
- style: styles.emptyValueContainer,
287
- children: [/*#__PURE__*/_jsx(AlertCircle, {
288
- size: 16,
289
- color: macOSColors.semantic.warning
290
- }), /*#__PURE__*/_jsx(Text, {
291
- style: styles.emptyValueText,
292
- children: "Storage key not found or empty"
293
- })]
294
- }), hasExpectedValue && /*#__PURE__*/_jsxs(View, {
295
- style: styles.valueContainer,
296
- children: [/*#__PURE__*/_jsx(Text, {
297
- style: styles.valueLabel,
298
- children: "Expected Value:"
299
- }), /*#__PURE__*/_jsx(View, {
300
- style: styles.expectedValueBox,
301
- children: /*#__PURE__*/_jsx(Text, {
302
- style: styles.expectedValueContent,
303
- selectable: true,
304
- children: storageKey.expectedValue
305
- })
306
- })]
307
- })]
308
- })]
309
- });
310
- }
311
- const styles = StyleSheet.create({
312
- storageKeyCard: {
313
- backgroundColor: night.color.surface,
314
- borderRadius: 8,
315
- borderWidth: 1,
316
- overflow: "hidden"
317
- },
318
- cardHeader: {
319
- padding: 12,
320
- flexDirection: "row",
321
- alignItems: "center",
322
- justifyContent: "space-between"
323
- },
324
- cardHeaderLeft: {
325
- flexDirection: "row",
326
- alignItems: "center",
327
- flex: 1,
328
- minWidth: 0
329
- },
330
- iconContainer: {
331
- padding: 6,
332
- borderRadius: 6,
333
- marginRight: 10
334
- },
335
- cardHeaderInfo: {
336
- flex: 1,
337
- minWidth: 0,
338
- gap: 4
339
- },
340
- storageKeyText: {
341
- color: night.color.text,
342
- fontWeight: "500",
343
- fontSize: 12,
344
- flexWrap: "wrap",
345
- flex: 1
346
- },
347
- descriptionText: {
348
- color: night.color.textSecondary,
349
- fontSize: 10,
350
- marginTop: 2,
351
- flexWrap: "wrap"
352
- },
353
- cardHeaderMeta: {
354
- flexDirection: "row",
355
- alignItems: "center",
356
- gap: 6,
357
- flexWrap: "wrap"
358
- },
359
- statusBadge: {
360
- paddingHorizontal: 6,
361
- paddingVertical: 2,
362
- borderRadius: 4
363
- },
364
- statusText: {
365
- fontSize: 9,
366
- fontWeight: "600",
367
- letterSpacing: 0.5
368
- },
369
- storageBadge: {
370
- paddingHorizontal: 6,
371
- paddingVertical: 2,
372
- borderRadius: 4,
373
- flexDirection: "row",
374
- alignItems: "center",
375
- gap: 4
376
- },
377
- storageText: {
378
- fontSize: 9,
379
- fontWeight: "600"
380
- },
381
- instanceBadge: {
382
- paddingHorizontal: 6,
383
- paddingVertical: 3,
384
- borderRadius: 4,
385
- borderWidth: 1,
386
- flexDirection: 'row',
387
- alignItems: 'center',
388
- gap: 4
389
- },
390
- instanceText: {
391
- fontSize: 9,
392
- fontWeight: "700",
393
- fontFamily: monoFont,
394
- letterSpacing: 0.3
395
- },
396
- valueBadge: {
397
- paddingHorizontal: 4,
398
- paddingVertical: 2,
399
- backgroundColor: night.color.surfaceElevated,
400
- borderRadius: 3
401
- },
402
- valueText: {
403
- fontSize: 8,
404
- color: night.color.textSecondary,
405
- fontWeight: "500"
406
- },
407
- cardHeaderRight: {
408
- marginLeft: 8
409
- },
410
- actionButton: {
411
- padding: 4,
412
- borderRadius: 4,
413
- backgroundColor: night.color.surfaceElevated
414
- },
415
- cardBody: {
416
- borderTopWidth: 1,
417
- borderTopColor: night.color.separator,
418
- padding: 12,
419
- gap: 12
420
- },
421
- dataViewerContainer: {
422
- marginTop: 8
423
- },
424
- simpleValueContainer: {
425
- gap: 8
426
- },
427
- simpleValueLabel: {
428
- color: night.color.textSecondary,
429
- fontSize: 10,
430
- fontWeight: "500",
431
- textTransform: "uppercase",
432
- letterSpacing: 0.5
433
- },
434
- simpleValueBox: {
435
- backgroundColor: night.color.bg,
436
- borderRadius: 4,
437
- padding: 10,
438
- borderWidth: 1,
439
- borderColor: night.color.border
440
- },
441
- simpleValueContent: {
442
- color: gameUIColors.success,
443
- fontSize: 12,
444
- fontFamily: monoFont,
445
- lineHeight: 16
446
- },
447
- valueTypeText: {
448
- color: night.color.textTertiary,
449
- fontSize: 9,
450
- fontStyle: "italic"
451
- },
452
- valueContainer: {
453
- gap: 6
454
- },
455
- valueLabel: {
456
- color: night.color.textSecondary,
457
- fontSize: 10,
458
- fontWeight: "500",
459
- textTransform: "uppercase",
460
- letterSpacing: 0.5
461
- },
462
- valueBox: {
463
- backgroundColor: night.color.bg,
464
- borderRadius: 4,
465
- padding: 8,
466
- borderWidth: 1,
467
- borderColor: night.color.border
468
- },
469
- valueContent: {
470
- color: night.color.text,
471
- fontSize: 10,
472
- fontFamily: monoFont,
473
- lineHeight: 14
474
- },
475
- expectedValueBox: {
476
- backgroundColor: night.color.bg,
477
- borderRadius: 4,
478
- padding: 8,
479
- borderWidth: 1,
480
- borderColor: night.color.border
481
- },
482
- expectedValueContent: {
483
- color: night.color.text,
484
- fontSize: 10,
485
- fontFamily: monoFont,
486
- lineHeight: 14
487
- },
488
- emptyValueContainer: {
489
- flexDirection: "row",
490
- alignItems: "center",
491
- gap: 6,
492
- padding: 8,
493
- backgroundColor: gameUIColors.warning + "0D",
494
- borderRadius: 4,
495
- borderWidth: 1,
496
- borderColor: gameUIColors.warning + "1A"
497
- },
498
- emptyValueText: {
499
- color: gameUIColors.warning,
500
- fontSize: 10,
501
- fontStyle: "italic"
502
- },
503
- typeHelperText: {
504
- color: night.color.textSecondary,
505
- fontSize: 9,
506
- marginTop: 4,
507
- textAlign: "center"
508
- },
509
- metaInfo: {
510
- marginTop: 8
511
- },
512
- metaLabel: {
513
- color: night.color.textTertiary,
514
- fontSize: 9,
515
- fontStyle: "italic"
516
- }
517
- });
1
+ "use strict";import{View as l,Text as a,StyleSheet as H,TouchableOpacity as W}from"react-native";import{AlertCircle as C,CheckCircle2 as L,Eye as x,XCircle as T,HardDrive as S,Database as V,Shield as R,gameUIColors as u,macOSColors as o,night as n,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as D,getStorageTypeHexColor as E}from"../utils/storageQueryUtils";import{getValueTypeLabel as y}from"../utils/valueType";import{DataViewer as _}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i}from"react/jsx-runtime";const P={top:6,bottom:6,left:6,right:6};const v=[o.semantic.info,o.semantic.success,o.semantic.warning,o.semantic.debug,"#FF6B9D","#00D9FF"];function g(r){const s=r.split("").reduce((b,c)=>b+c.charCodeAt(0),0);return v[s%v.length]}const F=r=>{switch(r){case"required_present":return{icon:L,color:o.semantic.success,bgColor:o.semantic.successBackground,borderColor:o.semantic.success+"40",label:"REQUIRED",labelColor:o.semantic.success};case"required_missing":return{icon:C,color:o.semantic.error,bgColor:o.semantic.errorBackground,borderColor:o.semantic.error+"50",label:"MISSING",labelColor:o.semantic.error};case"required_wrong_value":return{icon:T,color:o.semantic.warning,bgColor:o.semantic.warningBackground,borderColor:o.semantic.warning+"50",label:"WRONG S",labelColor:o.semantic.warning};case"required_wrong_type":return{icon:T,color:o.semantic.info,bgColor:o.semantic.infoBackground,borderColor:o.semantic.info+"50",label:"WRONG TYPE",labelColor:o.semantic.info};case"optional_present":return{icon:x,color:o.semantic.debug,bgColor:o.semantic.infoBackground,borderColor:o.semantic.debug+"40",label:"OPTIONAL",labelColor:o.semantic.debug}}};const O=r=>{switch(r){case"mmkv":return S;case"async":return V;case"secure":return R;default:return V}};export function StorageKeyCard({storageKey:r,isExpanded:s,onToggle:b}){const c=F(r.status);const w=c.icon;const I=O(r.storageType);const m=r.value!==void 0&&r.value!==null;const f=r.expectedValue!==void 0;const B=r.expectedType!==void 0;const h=E(r.storageType);const k=D(r.storageType);return i(l,{style:[e.storageKeyCard,{borderColor:c.borderColor}],children:[i(W,{accessibilityLabel:"Storage key card",accessibilityHint:"View storage key card","sentry-label":`ignore storage key card ${r.key}`,accessibilityRole:"button",style:e.cardHeader,onPress:b,children:[i(l,{style:e.cardHeaderLeft,children:[t(l,{style:[e.iconContainer,{backgroundColor:c.bgColor}],children:t(w,{size:14,color:c.color})}),i(l,{style:e.cardHeaderInfo,children:[t(a,{style:e.storageKeyText,children:r.key}),r.description?t(a,{style:e.descriptionText,children:r.description}):null,i(l,{style:e.cardHeaderMeta,children:[t(l,{style:[e.statusBadge,{backgroundColor:c.bgColor}],children:t(a,{style:[e.statusText,{color:c.labelColor}],children:c.label})}),i(l,{style:[e.storageBadge,{backgroundColor:`${h}15`}],children:[t(I,{size:10,color:h}),t(a,{style:[e.storageText,{color:h}],children:k})]}),r.storageType==="mmkv"&&r.instanceId&&i(l,{style:[e.instanceBadge,{backgroundColor:g(r.instanceId)+"20",borderColor:g(r.instanceId)+"40"}],children:[t(S,{size:9,color:g(r.instanceId)}),t(a,{style:[e.instanceText,{color:g(r.instanceId)}],children:r.instanceId})]}),m&&t(l,{style:e.valueBadge,children:t(a,{style:e.valueText,children:r.valueType?r.valueType.toUpperCase():y(r.value)})})]})]})]}),t(l,{style:e.cardHeaderRight,children:t(l,{style:e.actionButton,children:t(x,{size:12,color:n.color.textSecondary})})})]}),s&&m&&i(l,{style:e.cardBody,children:[t(l,{style:e.dataViewerContainer,children:(()=>{const d=typeof r.value==="string"?(()=>{try{return JSON.parse(r.value)}catch{return r.value}})():r.value;const z=typeof d==="string"||typeof d==="number"||typeof d==="boolean";return z?i(l,{style:e.simpleValueContainer,children:[t(a,{style:e.simpleValueLabel,children:"Current Value:"}),t(l,{style:e.simpleValueBox,children:t(a,{style:e.simpleValueContent,selectable:true,children:String(d)})}),i(a,{style:e.valueTypeText,children:["Type: ",y(r.value)]})]}):t(_,{title:"Current Value",data:d,showTypeFilter:false,rawMode:true})})()}),f&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]}),B&&r.expectedType&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Type:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedType.toUpperCase()})}),i(a,{style:e.typeHelperText,children:["Current type: ",y(r.value)]})]}),r.lastUpdated?t(l,{style:e.metaInfo,children:i(a,{style:e.metaLabel,children:["Last updated: ",r.lastUpdated.toLocaleString()]})}):null]}),s&&!m&&i(l,{style:e.cardBody,children:[i(l,{style:e.emptyValueContainer,children:[t(C,{size:16,color:o.semantic.warning}),t(a,{style:e.emptyValueText,children:"Storage key not found or empty"})]}),f&&i(l,{style:e.valueContainer,children:[t(a,{style:e.valueLabel,children:"Expected Value:"}),t(l,{style:e.expectedValueBox,children:t(a,{style:e.expectedValueContent,selectable:true,children:r.expectedValue})})]})]})]})}const e=H.create({storageKeyCard:{backgroundColor:n.color.surface,borderRadius:8,borderWidth:1,overflow:"hidden"},cardHeader:{padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between"},cardHeaderLeft:{flexDirection:"row",alignItems:"center",flex:1,minWidth:0},iconContainer:{padding:6,borderRadius:6,marginRight:10},cardHeaderInfo:{flex:1,minWidth:0,gap:4},storageKeyText:{color:n.color.text,fontWeight:"500",fontSize:12,flexWrap:"wrap",flex:1},descriptionText:{color:n.color.textSecondary,fontSize:10,marginTop:2,flexWrap:"wrap"},cardHeaderMeta:{flexDirection:"row",alignItems:"center",gap:6,flexWrap:"wrap"},statusBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},statusText:{fontSize:9,fontWeight:"600",letterSpacing:.5},storageBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,flexDirection:"row",alignItems:"center",gap:4},storageText:{fontSize:9,fontWeight:"600"},instanceBadge:{paddingHorizontal:6,paddingVertical:3,borderRadius:4,borderWidth:1,flexDirection:"row",alignItems:"center",gap:4},instanceText:{fontSize:9,fontWeight:"700",fontFamily:p,letterSpacing:.3},valueBadge:{paddingHorizontal:4,paddingVertical:2,backgroundColor:n.color.surfaceElevated,borderRadius:3},valueText:{fontSize:8,color:n.color.textSecondary,fontWeight:"500"},cardHeaderRight:{marginLeft:8},actionButton:{padding:4,borderRadius:4,backgroundColor:n.color.surfaceElevated},cardBody:{borderTopWidth:1,borderTopColor:n.color.separator,padding:12,gap:12},dataViewerContainer:{marginTop:8},simpleValueContainer:{gap:8},simpleValueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},simpleValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:10,borderWidth:1,borderColor:n.color.border},simpleValueContent:{color:u.success,fontSize:12,fontFamily:p,lineHeight:16},valueTypeText:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"},valueContainer:{gap:6},valueLabel:{color:n.color.textSecondary,fontSize:10,fontWeight:"500",textTransform:"uppercase",letterSpacing:.5},valueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},valueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},expectedValueBox:{backgroundColor:n.color.bg,borderRadius:4,padding:8,borderWidth:1,borderColor:n.color.border},expectedValueContent:{color:n.color.text,fontSize:10,fontFamily:p,lineHeight:14},emptyValueContainer:{flexDirection:"row",alignItems:"center",gap:6,padding:8,backgroundColor:u.warning+"0D",borderRadius:4,borderWidth:1,borderColor:u.warning+"1A"},emptyValueText:{color:u.warning,fontSize:10,fontStyle:"italic"},typeHelperText:{color:n.color.textSecondary,fontSize:9,marginTop:4,textAlign:"center"},metaInfo:{marginTop:8},metaLabel:{color:n.color.textTertiary,fontSize:9,fontStyle:"italic"}});