@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.
- package/README.md +11 -90
- package/lib/commonjs/index.js +1 -353
- package/lib/commonjs/preset.js +1 -85
- package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +1 -36
- package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -12
- package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +1 -24
- package/lib/commonjs/storage/components/GameUIStorageBrowser.js +3 -1259
- package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +1 -257
- package/lib/commonjs/storage/components/MMKVInstanceSelector.js +1 -419
- package/lib/commonjs/storage/components/SelectionActionBar.js +1 -207
- package/lib/commonjs/storage/components/StorageActionButtons.js +1 -242
- package/lib/commonjs/storage/components/StorageBrowserMode.js +1 -61
- package/lib/commonjs/storage/components/StorageEventActionButton.js +1 -121
- package/lib/commonjs/storage/components/StorageEventCard.js +1 -118
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +1 -494
- package/lib/commonjs/storage/components/StorageEventFilterView.js +1 -160
- package/lib/commonjs/storage/components/StorageEventsSection.js +1 -24
- package/lib/commonjs/storage/components/StorageFilterCards.js +1 -231
- package/lib/commonjs/storage/components/StorageKeyCard.js +1 -520
- package/lib/commonjs/storage/components/StorageKeyDetailScreen.js +1 -579
- package/lib/commonjs/storage/components/StorageKeyRow.js +1 -559
- package/lib/commonjs/storage/components/StorageKeySection.js +1 -160
- package/lib/commonjs/storage/components/StorageKeyStats.js +1 -345
- package/lib/commonjs/storage/components/StorageModalWithTabs.js +1 -954
- package/lib/commonjs/storage/components/StorageSaveNotice.js +1 -171
- package/lib/commonjs/storage/components/StorageSection.js +1 -43
- package/lib/commonjs/storage/components/StorageTypeFilterBar.js +1 -144
- package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +1 -141
- package/lib/commonjs/storage/hooks/useMMKVInstances.js +1 -210
- package/lib/commonjs/storage/hooks/useMMKVKeys.js +1 -376
- package/lib/commonjs/storage/hooks/useSecureStoreKeys.js +1 -202
- package/lib/commonjs/storage/hooks/useStorageEvents.js +1 -61
- package/lib/commonjs/storage/stores/storageEventStore.js +1 -312
- package/lib/commonjs/storage/sync/storageSyncAdapter.js +1 -492
- package/lib/commonjs/storage/types.js +1 -5
- package/lib/commonjs/storage/utils/AsyncStorageListener.js +1 -691
- package/lib/commonjs/storage/utils/AsyncStorageListener.web.js +1 -89
- package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +1 -203
- package/lib/commonjs/storage/utils/MMKVListener.js +1 -416
- package/lib/commonjs/storage/utils/SecureStoreRegistry.js +1 -200
- package/lib/commonjs/storage/utils/asyncStorageCompat.js +1 -89
- package/lib/commonjs/storage/utils/browserStorageLifecycle.js +1 -10
- package/lib/commonjs/storage/utils/browserStorageLifecycle.web.js +1 -70
- package/lib/commonjs/storage/utils/clearAllStorage.js +1 -48
- package/lib/commonjs/storage/utils/deleteStorageKeys.js +1 -82
- package/lib/commonjs/storage/utils/lineDiff.js +1 -30
- package/lib/commonjs/storage/utils/mmkvAvailability.js +1 -62
- package/lib/commonjs/storage/utils/mmkvAvailability.web.js +1 -21
- package/lib/commonjs/storage/utils/mmkvTypeDetection.js +1 -154
- package/lib/commonjs/storage/utils/requiredStorageKeyScope.js +1 -17
- package/lib/commonjs/storage/utils/setStorageValue.js +1 -218
- package/lib/commonjs/storage/utils/snapshotProvider.js +1 -382
- package/lib/commonjs/storage/utils/storageActionHelpers.js +1 -46
- package/lib/commonjs/storage/utils/storageBrowserRefresh.js +1 -49
- package/lib/commonjs/storage/utils/storageLabels.js +1 -13
- package/lib/commonjs/storage/utils/storageLabels.web.js +1 -13
- package/lib/commonjs/storage/utils/storageOps.js +1 -53
- package/lib/commonjs/storage/utils/storageQueryUtils.js +1 -35
- package/lib/commonjs/storage/utils/storageTimeTravelUtils.js +1 -288
- package/lib/commonjs/storage/utils/valueType.js +1 -83
- package/lib/module/index.js +1 -114
- package/lib/module/preset.js +1 -82
- package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +1 -32
- package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +1 -9
- package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +1 -10
- package/lib/module/storage/components/GameUIStorageBrowser.js +3 -1257
- package/lib/module/storage/components/MMKVInstanceInfoPanel.js +1 -253
- package/lib/module/storage/components/MMKVInstanceSelector.js +1 -415
- package/lib/module/storage/components/SelectionActionBar.js +1 -204
- package/lib/module/storage/components/StorageActionButtons.js +1 -238
- package/lib/module/storage/components/StorageBrowserMode.js +1 -57
- package/lib/module/storage/components/StorageEventActionButton.js +1 -118
- package/lib/module/storage/components/StorageEventCard.js +1 -113
- package/lib/module/storage/components/StorageEventDetailContent.js +1 -490
- package/lib/module/storage/components/StorageEventFilterView.js +1 -156
- package/lib/module/storage/components/StorageEventsSection.js +1 -20
- package/lib/module/storage/components/StorageFilterCards.js +1 -227
- package/lib/module/storage/components/StorageKeyCard.js +1 -517
- package/lib/module/storage/components/StorageKeyDetailScreen.js +1 -577
- package/lib/module/storage/components/StorageKeyRow.js +1 -554
- package/lib/module/storage/components/StorageKeySection.js +1 -155
- package/lib/module/storage/components/StorageKeyStats.js +1 -342
- package/lib/module/storage/components/StorageModalWithTabs.js +1 -949
- package/lib/module/storage/components/StorageSaveNotice.js +1 -168
- package/lib/module/storage/components/StorageSection.js +1 -40
- package/lib/module/storage/components/StorageTypeFilterBar.js +1 -139
- package/lib/module/storage/hooks/useAsyncStorageKeys.js +1 -136
- package/lib/module/storage/hooks/useMMKVInstances.js +1 -204
- package/lib/module/storage/hooks/useMMKVKeys.js +1 -371
- package/lib/module/storage/hooks/useSecureStoreKeys.js +1 -199
- package/lib/module/storage/hooks/useStorageEvents.js +1 -58
- package/lib/module/storage/stores/storageEventStore.js +1 -301
- package/lib/module/storage/sync/storageSyncAdapter.js +1 -486
- package/lib/module/storage/types.js +1 -3
- package/lib/module/storage/utils/AsyncStorageListener.js +1 -679
- package/lib/module/storage/utils/AsyncStorageListener.web.js +1 -76
- package/lib/module/storage/utils/MMKVInstanceRegistry.js +1 -197
- package/lib/module/storage/utils/MMKVListener.js +1 -403
- package/lib/module/storage/utils/SecureStoreRegistry.js +1 -194
- package/lib/module/storage/utils/asyncStorageCompat.js +1 -81
- package/lib/module/storage/utils/browserStorageLifecycle.js +1 -6
- package/lib/module/storage/utils/browserStorageLifecycle.web.js +1 -66
- package/lib/module/storage/utils/clearAllStorage.js +1 -43
- package/lib/module/storage/utils/deleteStorageKeys.js +1 -78
- package/lib/module/storage/utils/lineDiff.js +1 -12
- package/lib/module/storage/utils/mmkvAvailability.js +1 -56
- package/lib/module/storage/utils/mmkvAvailability.web.js +1 -15
- package/lib/module/storage/utils/mmkvTypeDetection.js +1 -148
- package/lib/module/storage/utils/requiredStorageKeyScope.js +1 -13
- package/lib/module/storage/utils/setStorageValue.js +1 -209
- package/lib/module/storage/utils/snapshotProvider.js +1 -380
- package/lib/module/storage/utils/storageActionHelpers.js +1 -42
- package/lib/module/storage/utils/storageBrowserRefresh.js +1 -44
- package/lib/module/storage/utils/storageLabels.js +1 -9
- package/lib/module/storage/utils/storageLabels.web.js +1 -9
- package/lib/module/storage/utils/storageOps.js +1 -46
- package/lib/module/storage/utils/storageQueryUtils.js +1 -30
- package/lib/module/storage/utils/storageTimeTravelUtils.js +1 -281
- package/lib/module/storage/utils/valueType.js +1 -76
- package/lib/web/index.mjs +2 -3
- package/package.json +5 -5
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +0 -1
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +0 -1
- package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +0 -1
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +0 -1
- package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageEventActionButton.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageEventCard.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageKeyDetailScreen.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageKeySection.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageSaveNotice.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageSection.d.ts.map +0 -1
- package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useStorageEvents.d.ts.map +0 -1
- package/lib/typescript/storage/stores/storageEventStore.d.ts.map +0 -1
- package/lib/typescript/storage/sync/storageSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/storage/types.d.ts.map +0 -1
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +0 -1
- package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts.map +0 -1
- package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +0 -1
- package/lib/typescript/storage/utils/MMKVListener.d.ts.map +0 -1
- package/lib/typescript/storage/utils/SecureStoreRegistry.d.ts.map +0 -1
- package/lib/typescript/storage/utils/asyncStorageCompat.d.ts.map +0 -1
- package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts.map +0 -1
- package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts.map +0 -1
- package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +0 -1
- package/lib/typescript/storage/utils/deleteStorageKeys.d.ts.map +0 -1
- package/lib/typescript/storage/utils/lineDiff.d.ts.map +0 -1
- package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +0 -1
- package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts.map +0 -1
- package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +0 -1
- package/lib/typescript/storage/utils/requiredStorageKeyScope.d.ts.map +0 -1
- package/lib/typescript/storage/utils/setStorageValue.d.ts.map +0 -1
- package/lib/typescript/storage/utils/snapshotProvider.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageBrowserRefresh.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageLabels.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageLabels.web.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageOps.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +0 -1
- package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts.map +0 -1
- package/lib/typescript/storage/utils/valueType.d.ts.map +0 -1
|
@@ -1,257 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MMKVInstanceInfoPanel = MMKVInstanceInfoPanel;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _useMMKVInstances = require("../hooks/useMMKVInstances");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
/**
|
|
12
|
-
* MMKVInstanceInfoPanel Component
|
|
13
|
-
*
|
|
14
|
-
* Displays detailed information about a selected MMKV instance:
|
|
15
|
-
* - Instance ID and path
|
|
16
|
-
* - Encryption status
|
|
17
|
-
* - Read-only status
|
|
18
|
-
* - Key count
|
|
19
|
-
* - Size (if available)
|
|
20
|
-
*
|
|
21
|
-
* Used in GameUIStorageBrowser below the instance selector.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* MMKV Instance Info Panel
|
|
26
|
-
*
|
|
27
|
-
* Shows metadata and statistics for a selected MMKV instance.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```typescript
|
|
31
|
-
* function MyStorageUI() {
|
|
32
|
-
* const [selectedInstance, setSelectedInstance] = useState('mmkv.default');
|
|
33
|
-
*
|
|
34
|
-
* return (
|
|
35
|
-
* <View>
|
|
36
|
-
* <MMKVInstanceSelector
|
|
37
|
-
* selectedInstanceId={selectedInstance}
|
|
38
|
-
* onSelectInstance={setSelectedInstance}
|
|
39
|
-
* />
|
|
40
|
-
* {selectedInstance && (
|
|
41
|
-
* <MMKVInstanceInfoPanel instanceId={selectedInstance} />
|
|
42
|
-
* )}
|
|
43
|
-
* </View>
|
|
44
|
-
* );
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
function MMKVInstanceInfoPanel({
|
|
49
|
-
instanceId
|
|
50
|
-
}) {
|
|
51
|
-
const instance = (0, _useMMKVInstances.useMMKVInstance)(instanceId);
|
|
52
|
-
if (!instance) {
|
|
53
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
54
|
-
style: styles.container,
|
|
55
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
56
|
-
style: styles.errorState,
|
|
57
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
58
|
-
style: styles.errorText,
|
|
59
|
-
children: ["Instance not found: ", instanceId]
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
65
|
-
style: styles.container,
|
|
66
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
67
|
-
style: styles.panel,
|
|
68
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
69
|
-
style: styles.header,
|
|
70
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
71
|
-
style: styles.headerTitle,
|
|
72
|
-
children: "Instance Details"
|
|
73
|
-
})
|
|
74
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
75
|
-
style: styles.infoGrid,
|
|
76
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InfoItem, {
|
|
77
|
-
label: "Instance ID",
|
|
78
|
-
value: instance.id,
|
|
79
|
-
valueStyle: styles.monoValue
|
|
80
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoItem, {
|
|
81
|
-
label: "Keys",
|
|
82
|
-
value: `${instance.keyCount} ${instance.keyCount === 1 ? 'key' : 'keys'}`,
|
|
83
|
-
highlight: true
|
|
84
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoItem, {
|
|
85
|
-
label: "Encryption",
|
|
86
|
-
value: instance.encrypted ? '🔒 Encrypted' : '🔓 Not encrypted',
|
|
87
|
-
valueColor: instance.encrypted ? _sharedUi.macOSColors.semantic.success : _sharedUi.night.color.textTertiary
|
|
88
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoItem, {
|
|
89
|
-
label: "Access",
|
|
90
|
-
value: instance.readOnly ? '👁️ Read-only' : '✏️ Read-write',
|
|
91
|
-
valueColor: instance.readOnly ? _sharedUi.macOSColors.semantic.warning : _sharedUi.night.color.textTertiary
|
|
92
|
-
}), instance.size !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoItem, {
|
|
93
|
-
label: "Size",
|
|
94
|
-
value: formatBytes(instance.size),
|
|
95
|
-
valueStyle: styles.monoValue
|
|
96
|
-
})]
|
|
97
|
-
}), instance.encrypted && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
98
|
-
style: styles.notice,
|
|
99
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
100
|
-
style: styles.noticeIcon,
|
|
101
|
-
children: "\uD83D\uDD12"
|
|
102
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
103
|
-
style: styles.noticeText,
|
|
104
|
-
children: "This instance is encrypted. Values are protected at rest."
|
|
105
|
-
})]
|
|
106
|
-
}), instance.readOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
107
|
-
style: [styles.notice, styles.noticeWarning],
|
|
108
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
109
|
-
style: styles.noticeIcon,
|
|
110
|
-
children: "\uD83D\uDC41\uFE0F"
|
|
111
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
112
|
-
style: [styles.noticeText, styles.noticeTextWarning],
|
|
113
|
-
children: "Read-only mode. Cannot modify values in this instance."
|
|
114
|
-
})]
|
|
115
|
-
})]
|
|
116
|
-
})
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* InfoItem Component - Displays a label-value pair
|
|
122
|
-
*/
|
|
123
|
-
function InfoItem({
|
|
124
|
-
label,
|
|
125
|
-
value,
|
|
126
|
-
valueStyle,
|
|
127
|
-
valueColor,
|
|
128
|
-
highlight
|
|
129
|
-
}) {
|
|
130
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
131
|
-
style: styles.infoItem,
|
|
132
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
133
|
-
style: styles.infoLabel,
|
|
134
|
-
children: label
|
|
135
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
136
|
-
style: [styles.infoValue, valueStyle, valueColor && {
|
|
137
|
-
color: valueColor
|
|
138
|
-
}, highlight && styles.infoValueHighlight],
|
|
139
|
-
children: value
|
|
140
|
-
})]
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Format bytes to human-readable string
|
|
146
|
-
*/
|
|
147
|
-
function formatBytes(bytes) {
|
|
148
|
-
if (bytes === 0) return '0 Bytes';
|
|
149
|
-
const k = 1024;
|
|
150
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
151
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
152
|
-
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
|
|
153
|
-
}
|
|
154
|
-
const styles = _reactNative.StyleSheet.create({
|
|
155
|
-
container: {
|
|
156
|
-
marginBottom: 12
|
|
157
|
-
},
|
|
158
|
-
// Error state
|
|
159
|
-
errorState: {
|
|
160
|
-
backgroundColor: _sharedUi.macOSColors.semantic.error + '15',
|
|
161
|
-
borderRadius: 12,
|
|
162
|
-
padding: 12,
|
|
163
|
-
borderWidth: 1,
|
|
164
|
-
borderColor: _sharedUi.macOSColors.semantic.error + '40'
|
|
165
|
-
},
|
|
166
|
-
errorText: {
|
|
167
|
-
fontSize: 12,
|
|
168
|
-
color: _sharedUi.macOSColors.semantic.error,
|
|
169
|
-
textAlign: 'center'
|
|
170
|
-
},
|
|
171
|
-
// Panel
|
|
172
|
-
panel: {
|
|
173
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
174
|
-
borderRadius: 12,
|
|
175
|
-
borderWidth: 1,
|
|
176
|
-
borderColor: _sharedUi.night.color.border,
|
|
177
|
-
overflow: 'hidden',
|
|
178
|
-
shadowColor: '#000000',
|
|
179
|
-
shadowOpacity: 0.03,
|
|
180
|
-
shadowRadius: 8,
|
|
181
|
-
shadowOffset: {
|
|
182
|
-
width: 0,
|
|
183
|
-
height: 2
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
// Header
|
|
187
|
-
header: {
|
|
188
|
-
padding: 12,
|
|
189
|
-
borderBottomWidth: 1,
|
|
190
|
-
borderBottomColor: _sharedUi.night.color.separator
|
|
191
|
-
},
|
|
192
|
-
headerTitle: {
|
|
193
|
-
fontSize: 11,
|
|
194
|
-
fontWeight: '600',
|
|
195
|
-
color: _sharedUi.night.color.text,
|
|
196
|
-
textTransform: "uppercase",
|
|
197
|
-
letterSpacing: 0.5
|
|
198
|
-
},
|
|
199
|
-
// Info grid
|
|
200
|
-
infoGrid: {
|
|
201
|
-
padding: 12,
|
|
202
|
-
gap: 10
|
|
203
|
-
},
|
|
204
|
-
infoItem: {
|
|
205
|
-
flexDirection: 'row',
|
|
206
|
-
justifyContent: 'space-between',
|
|
207
|
-
alignItems: 'center',
|
|
208
|
-
paddingVertical: 4
|
|
209
|
-
},
|
|
210
|
-
infoLabel: {
|
|
211
|
-
fontSize: 12,
|
|
212
|
-
color: _sharedUi.night.color.textTertiary,
|
|
213
|
-
fontWeight: '500'
|
|
214
|
-
},
|
|
215
|
-
infoValue: {
|
|
216
|
-
fontSize: 12,
|
|
217
|
-
color: _sharedUi.night.color.text,
|
|
218
|
-
fontWeight: '500'
|
|
219
|
-
},
|
|
220
|
-
infoValueHighlight: {
|
|
221
|
-
fontSize: 14,
|
|
222
|
-
fontWeight: '600',
|
|
223
|
-
color: _sharedUi.night.color.accent
|
|
224
|
-
},
|
|
225
|
-
monoValue: {
|
|
226
|
-
fontFamily: _sharedUi.monoFont
|
|
227
|
-
},
|
|
228
|
-
// Notices
|
|
229
|
-
notice: {
|
|
230
|
-
flexDirection: 'row',
|
|
231
|
-
alignItems: 'center',
|
|
232
|
-
gap: 8,
|
|
233
|
-
padding: 10,
|
|
234
|
-
margin: 12,
|
|
235
|
-
marginTop: 0,
|
|
236
|
-
backgroundColor: _sharedUi.macOSColors.semantic.success + '10',
|
|
237
|
-
borderRadius: 8,
|
|
238
|
-
borderWidth: 1,
|
|
239
|
-
borderColor: _sharedUi.macOSColors.semantic.success + '30'
|
|
240
|
-
},
|
|
241
|
-
noticeWarning: {
|
|
242
|
-
backgroundColor: _sharedUi.macOSColors.semantic.warning + '10',
|
|
243
|
-
borderColor: _sharedUi.macOSColors.semantic.warning + '30'
|
|
244
|
-
},
|
|
245
|
-
noticeIcon: {
|
|
246
|
-
fontSize: 14
|
|
247
|
-
},
|
|
248
|
-
noticeText: {
|
|
249
|
-
flex: 1,
|
|
250
|
-
fontSize: 11,
|
|
251
|
-
color: _sharedUi.macOSColors.semantic.success,
|
|
252
|
-
lineHeight: 16
|
|
253
|
-
},
|
|
254
|
-
noticeTextWarning: {
|
|
255
|
-
color: _sharedUi.macOSColors.semantic.warning
|
|
256
|
-
}
|
|
257
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MMKVInstanceInfoPanel=MMKVInstanceInfoPanel;var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _useMMKVInstances=require("../hooks/useMMKVInstances");var _jsxRuntime=require("react/jsx-runtime");function MMKVInstanceInfoPanel({instanceId:t}){const e=(0,_useMMKVInstances.useMMKVInstance)(t);if(!e){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.errorState,children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.errorText,children:["Instance not found: ",t]})})})}return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.panel,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.header,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerTitle,children:"Instance Details"})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoGrid,children:[(0,_jsxRuntime.jsx)(InfoItem,{label:"Instance ID",value:e.id,valueStyle:styles.monoValue}),(0,_jsxRuntime.jsx)(InfoItem,{label:"Keys",value:`${e.keyCount} ${e.keyCount===1?"key":"keys"}`,highlight:true}),(0,_jsxRuntime.jsx)(InfoItem,{label:"Encryption",value:e.encrypted?"\u{1F512} Encrypted":"\u{1F513} Not encrypted",valueColor:e.encrypted?_sharedUi.macOSColors.semantic.success:_sharedUi.night.color.textTertiary}),(0,_jsxRuntime.jsx)(InfoItem,{label:"Access",value:e.readOnly?"\u{1F441}\uFE0F Read-only":"\u270F\uFE0F Read-write",valueColor:e.readOnly?_sharedUi.macOSColors.semantic.warning:_sharedUi.night.color.textTertiary}),e.size!==void 0&&(0,_jsxRuntime.jsx)(InfoItem,{label:"Size",value:formatBytes(e.size),valueStyle:styles.monoValue})]}),e.encrypted&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.notice,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeIcon,children:"\u{1F512}"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeText,children:"This instance is encrypted. Values are protected at rest."})]}),e.readOnly&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:[styles.notice,styles.noticeWarning],children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.noticeIcon,children:"\u{1F441}\uFE0F"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.noticeText,styles.noticeTextWarning],children:"Read-only mode. Cannot modify values in this instance."})]})]})})}function InfoItem({label:t,value:e,valueStyle:r,valueColor:o,highlight:n}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.infoItem,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.infoLabel,children:t}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.infoValue,r,o&&{color:o},n&&styles.infoValueHighlight],children:e})]})}function formatBytes(t){if(t===0)return"0 Bytes";const e=1024;const r=["Bytes","KB","MB","GB"];const o=Math.floor(Math.log(t)/Math.log(e));return`${parseFloat((t/Math.pow(e,o)).toFixed(2))} ${r[o]}`}const styles=_reactNative.StyleSheet.create({container:{marginBottom:12},errorState:{backgroundColor:_sharedUi.macOSColors.semantic.error+"15",borderRadius:12,padding:12,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.error+"40"},errorText:{fontSize:12,color:_sharedUi.macOSColors.semantic.error,textAlign:"center"},panel:{backgroundColor:_sharedUi.night.color.surface,borderRadius:12,borderWidth:1,borderColor:_sharedUi.night.color.border,overflow:"hidden",shadowColor:"#000000",shadowOpacity:.03,shadowRadius:8,shadowOffset:{width:0,height:2}},header:{padding:12,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.separator},headerTitle:{fontSize:11,fontWeight:"600",color:_sharedUi.night.color.text,textTransform:"uppercase",letterSpacing:.5},infoGrid:{padding:12,gap:10},infoItem:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",paddingVertical:4},infoLabel:{fontSize:12,color:_sharedUi.night.color.textTertiary,fontWeight:"500"},infoValue:{fontSize:12,color:_sharedUi.night.color.text,fontWeight:"500"},infoValueHighlight:{fontSize:14,fontWeight:"600",color:_sharedUi.night.color.accent},monoValue:{fontFamily:_sharedUi.monoFont},notice:{flexDirection:"row",alignItems:"center",gap:8,padding:10,margin:12,marginTop:0,backgroundColor:_sharedUi.macOSColors.semantic.success+"10",borderRadius:8,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.success+"30"},noticeWarning:{backgroundColor:_sharedUi.macOSColors.semantic.warning+"10",borderColor:_sharedUi.macOSColors.semantic.warning+"30"},noticeIcon:{fontSize:14},noticeText:{flex:1,fontSize:11,color:_sharedUi.macOSColors.semantic.success,lineHeight:16},noticeTextWarning:{color:_sharedUi.macOSColors.semantic.warning}});
|
|
@@ -1,419 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.MMKVInstanceSelector = MMKVInstanceSelector;
|
|
7
|
-
var _storageLabels = require("../utils/storageLabels");
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _useMMKVInstances = require("../hooks/useMMKVInstances");
|
|
12
|
-
var _mmkvAvailability = require("../utils/mmkvAvailability");
|
|
13
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
-
/**
|
|
15
|
-
* MMKVInstanceSelector Component
|
|
16
|
-
*
|
|
17
|
-
* Dropdown selector for choosing between multiple MMKV instances.
|
|
18
|
-
* Shows instance ID, key count, and metadata badges (encrypted, read-only).
|
|
19
|
-
*
|
|
20
|
-
* Used in GameUIStorageBrowser when storage type filter is set to "mmkv".
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* MMKV Instance Selector Component
|
|
25
|
-
*
|
|
26
|
-
* Displays a dropdown to select between registered MMKV instances.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* function MyStorageUI() {
|
|
31
|
-
* const [selectedInstance, setSelectedInstance] = useState('mmkv.default');
|
|
32
|
-
*
|
|
33
|
-
* return (
|
|
34
|
-
* <MMKVInstanceSelector
|
|
35
|
-
* selectedInstanceId={selectedInstance}
|
|
36
|
-
* onSelectInstance={setSelectedInstance}
|
|
37
|
-
* />
|
|
38
|
-
* );
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
function MMKVInstanceSelector({
|
|
43
|
-
selectedInstanceId,
|
|
44
|
-
onSelectInstance,
|
|
45
|
-
showRefreshButton = true
|
|
46
|
-
}) {
|
|
47
|
-
const [isDropdownOpen, setIsDropdownOpen] = (0, _react.useState)(false);
|
|
48
|
-
const {
|
|
49
|
-
instances,
|
|
50
|
-
instanceCount,
|
|
51
|
-
refresh
|
|
52
|
-
} = (0, _useMMKVInstances.useMMKVInstances)(false);
|
|
53
|
-
|
|
54
|
-
// Find the selected instance
|
|
55
|
-
const selectedInstance = instances.find(inst => inst.id === selectedInstanceId);
|
|
56
|
-
|
|
57
|
-
// Handle instance selection
|
|
58
|
-
const handleSelectInstance = instanceId => {
|
|
59
|
-
onSelectInstance(instanceId);
|
|
60
|
-
setIsDropdownOpen(false);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// If MMKV is not available, show unavailable message
|
|
64
|
-
if (!(0, _mmkvAvailability.isMMKVAvailable)()) {
|
|
65
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
66
|
-
style: styles.container,
|
|
67
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
68
|
-
style: styles.unavailableState,
|
|
69
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
70
|
-
style: styles.unavailableTitle,
|
|
71
|
-
children: [_storageLabels.storageLabels.mmkv, " Not Available"]
|
|
72
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
73
|
-
style: styles.unavailableDescription,
|
|
74
|
-
children: (0, _mmkvAvailability.getMMKVUnavailableMessage)()
|
|
75
|
-
})]
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// If no instances registered, show message
|
|
81
|
-
if (instanceCount === 0) {
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
83
|
-
style: styles.container,
|
|
84
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
85
|
-
style: styles.emptyState,
|
|
86
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
87
|
-
style: styles.emptyStateTitle,
|
|
88
|
-
children: "No MMKV Instances Registered"
|
|
89
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
90
|
-
style: styles.emptyStateDescription,
|
|
91
|
-
children: "Register MMKV instances using registerMMKVInstance() to monitor them in dev tools."
|
|
92
|
-
}), showRefreshButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
93
|
-
style: styles.refreshButton,
|
|
94
|
-
onPress: refresh,
|
|
95
|
-
activeOpacity: 0.7,
|
|
96
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
97
|
-
style: styles.refreshButtonText,
|
|
98
|
-
children: "\u21BB Refresh"
|
|
99
|
-
})
|
|
100
|
-
})]
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
105
|
-
style: styles.container,
|
|
106
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
107
|
-
style: styles.selectorButton,
|
|
108
|
-
onPress: () => setIsDropdownOpen(true),
|
|
109
|
-
activeOpacity: 0.7,
|
|
110
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
111
|
-
style: styles.selectorContent,
|
|
112
|
-
children: selectedInstance ? /*#__PURE__*/(0, _jsxRuntime.jsx)(InstanceRow, {
|
|
113
|
-
instance: selectedInstance,
|
|
114
|
-
isSelected: true
|
|
115
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
|
-
style: styles.placeholderText,
|
|
117
|
-
children: "Select MMKV Instance"
|
|
118
|
-
})
|
|
119
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
120
|
-
style: styles.dropdownArrow,
|
|
121
|
-
children: "\u25BC"
|
|
122
|
-
})]
|
|
123
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Modal, {
|
|
124
|
-
visible: isDropdownOpen,
|
|
125
|
-
transparent: true,
|
|
126
|
-
animationType: "fade",
|
|
127
|
-
onRequestClose: () => setIsDropdownOpen(false),
|
|
128
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
129
|
-
style: styles.modalOverlay,
|
|
130
|
-
activeOpacity: 1,
|
|
131
|
-
onPress: () => setIsDropdownOpen(false),
|
|
132
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
133
|
-
style: styles.dropdownContainer,
|
|
134
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
135
|
-
style: styles.dropdownHeader,
|
|
136
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
137
|
-
style: styles.dropdownTitle,
|
|
138
|
-
children: ["Select MMKV Instance (", instanceCount, ")"]
|
|
139
|
-
}), showRefreshButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
140
|
-
style: styles.headerRefreshButton,
|
|
141
|
-
onPress: refresh,
|
|
142
|
-
activeOpacity: 0.7,
|
|
143
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
144
|
-
style: styles.headerRefreshText,
|
|
145
|
-
children: "\u21BB"
|
|
146
|
-
})
|
|
147
|
-
})]
|
|
148
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
149
|
-
style: styles.dropdownList,
|
|
150
|
-
children: instances.map(instance => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
151
|
-
style: [styles.dropdownItem, instance.id === selectedInstanceId && styles.dropdownItemSelected],
|
|
152
|
-
onPress: () => handleSelectInstance(instance.id),
|
|
153
|
-
activeOpacity: 0.7,
|
|
154
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InstanceRow, {
|
|
155
|
-
instance: instance,
|
|
156
|
-
isSelected: instance.id === selectedInstanceId
|
|
157
|
-
})
|
|
158
|
-
}, instance.id))
|
|
159
|
-
})]
|
|
160
|
-
})
|
|
161
|
-
})
|
|
162
|
-
})]
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Instance Row Component
|
|
168
|
-
*
|
|
169
|
-
* Displays a single MMKV instance with its metadata.
|
|
170
|
-
*/
|
|
171
|
-
function InstanceRow({
|
|
172
|
-
instance,
|
|
173
|
-
isSelected
|
|
174
|
-
}) {
|
|
175
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
176
|
-
style: styles.instanceRow,
|
|
177
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
178
|
-
style: styles.instanceLeft,
|
|
179
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
180
|
-
style: [styles.instanceId, isSelected && styles.instanceIdSelected],
|
|
181
|
-
numberOfLines: 1,
|
|
182
|
-
children: instance.id
|
|
183
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
184
|
-
style: styles.instanceBadges,
|
|
185
|
-
children: [instance.encrypted && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
186
|
-
style: [styles.badge, styles.badgeEncrypted],
|
|
187
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
188
|
-
style: styles.badgeText,
|
|
189
|
-
children: "\uD83D\uDD12 Encrypted"
|
|
190
|
-
})
|
|
191
|
-
}), instance.readOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
192
|
-
style: [styles.badge, styles.badgeReadOnly],
|
|
193
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
194
|
-
style: styles.badgeText,
|
|
195
|
-
children: "\uD83D\uDC41\uFE0F Read-only"
|
|
196
|
-
})
|
|
197
|
-
})]
|
|
198
|
-
})]
|
|
199
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
200
|
-
style: styles.instanceRight,
|
|
201
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
202
|
-
style: styles.keyCount,
|
|
203
|
-
children: instance.keyCount
|
|
204
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
205
|
-
style: styles.keyCountLabel,
|
|
206
|
-
children: "keys"
|
|
207
|
-
})]
|
|
208
|
-
})]
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
const styles = _reactNative.StyleSheet.create({
|
|
212
|
-
container: {
|
|
213
|
-
marginBottom: 12
|
|
214
|
-
},
|
|
215
|
-
// Unavailable state
|
|
216
|
-
unavailableState: {
|
|
217
|
-
backgroundColor: _sharedUi.macOSColors.semantic.warning + '15',
|
|
218
|
-
borderRadius: 12,
|
|
219
|
-
padding: 20,
|
|
220
|
-
borderWidth: 1,
|
|
221
|
-
borderColor: _sharedUi.macOSColors.semantic.warning + '40',
|
|
222
|
-
alignItems: 'center',
|
|
223
|
-
gap: 12
|
|
224
|
-
},
|
|
225
|
-
unavailableTitle: {
|
|
226
|
-
fontSize: 14,
|
|
227
|
-
fontWeight: '600',
|
|
228
|
-
color: _sharedUi.macOSColors.semantic.warning
|
|
229
|
-
},
|
|
230
|
-
unavailableDescription: {
|
|
231
|
-
fontSize: 12,
|
|
232
|
-
color: _sharedUi.night.color.textSecondary,
|
|
233
|
-
textAlign: 'center',
|
|
234
|
-
lineHeight: 18
|
|
235
|
-
},
|
|
236
|
-
// Empty state
|
|
237
|
-
emptyState: {
|
|
238
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
239
|
-
borderRadius: 12,
|
|
240
|
-
padding: 20,
|
|
241
|
-
borderWidth: 1,
|
|
242
|
-
borderColor: _sharedUi.night.color.border,
|
|
243
|
-
alignItems: 'center',
|
|
244
|
-
gap: 12
|
|
245
|
-
},
|
|
246
|
-
emptyStateTitle: {
|
|
247
|
-
fontSize: 14,
|
|
248
|
-
fontWeight: '600',
|
|
249
|
-
color: _sharedUi.night.color.text
|
|
250
|
-
},
|
|
251
|
-
emptyStateDescription: {
|
|
252
|
-
fontSize: 12,
|
|
253
|
-
color: _sharedUi.night.color.textTertiary,
|
|
254
|
-
textAlign: 'center',
|
|
255
|
-
lineHeight: 18
|
|
256
|
-
},
|
|
257
|
-
refreshButton: {
|
|
258
|
-
marginTop: 8,
|
|
259
|
-
paddingHorizontal: 16,
|
|
260
|
-
paddingVertical: 8,
|
|
261
|
-
backgroundColor: _sharedUi.night.color.accentSoft,
|
|
262
|
-
borderRadius: 8,
|
|
263
|
-
borderWidth: 1,
|
|
264
|
-
borderColor: _sharedUi.night.color.accentBorderStrong
|
|
265
|
-
},
|
|
266
|
-
refreshButtonText: {
|
|
267
|
-
fontSize: 12,
|
|
268
|
-
fontWeight: '600',
|
|
269
|
-
color: _sharedUi.night.color.accent
|
|
270
|
-
},
|
|
271
|
-
// Selector button
|
|
272
|
-
selectorButton: {
|
|
273
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
274
|
-
borderRadius: 12,
|
|
275
|
-
borderWidth: 1,
|
|
276
|
-
borderColor: _sharedUi.night.color.border,
|
|
277
|
-
padding: 12,
|
|
278
|
-
flexDirection: 'row',
|
|
279
|
-
alignItems: 'center',
|
|
280
|
-
justifyContent: 'space-between',
|
|
281
|
-
shadowColor: '#000000',
|
|
282
|
-
shadowOpacity: 0.03,
|
|
283
|
-
shadowRadius: 8,
|
|
284
|
-
shadowOffset: {
|
|
285
|
-
width: 0,
|
|
286
|
-
height: 2
|
|
287
|
-
}
|
|
288
|
-
},
|
|
289
|
-
selectorContent: {
|
|
290
|
-
flex: 1
|
|
291
|
-
},
|
|
292
|
-
placeholderText: {
|
|
293
|
-
fontSize: 13,
|
|
294
|
-
color: _sharedUi.night.color.placeholder,
|
|
295
|
-
fontStyle: 'italic'
|
|
296
|
-
},
|
|
297
|
-
dropdownArrow: {
|
|
298
|
-
fontSize: 10,
|
|
299
|
-
color: _sharedUi.night.color.textTertiary,
|
|
300
|
-
marginLeft: 8
|
|
301
|
-
},
|
|
302
|
-
// Modal overlay
|
|
303
|
-
modalOverlay: {
|
|
304
|
-
flex: 1,
|
|
305
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
306
|
-
justifyContent: 'center',
|
|
307
|
-
alignItems: 'center',
|
|
308
|
-
padding: 20
|
|
309
|
-
},
|
|
310
|
-
// Dropdown container
|
|
311
|
-
dropdownContainer: {
|
|
312
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
313
|
-
borderRadius: 16,
|
|
314
|
-
borderWidth: 1,
|
|
315
|
-
borderColor: _sharedUi.night.color.border,
|
|
316
|
-
width: '100%',
|
|
317
|
-
maxWidth: 500,
|
|
318
|
-
maxHeight: '70%',
|
|
319
|
-
shadowColor: '#000000',
|
|
320
|
-
shadowOpacity: 0.2,
|
|
321
|
-
shadowRadius: 20,
|
|
322
|
-
shadowOffset: {
|
|
323
|
-
width: 0,
|
|
324
|
-
height: 10
|
|
325
|
-
},
|
|
326
|
-
overflow: 'hidden'
|
|
327
|
-
},
|
|
328
|
-
dropdownHeader: {
|
|
329
|
-
flexDirection: 'row',
|
|
330
|
-
alignItems: 'center',
|
|
331
|
-
justifyContent: 'space-between',
|
|
332
|
-
padding: 16,
|
|
333
|
-
borderBottomWidth: 1,
|
|
334
|
-
borderBottomColor: _sharedUi.night.color.separator
|
|
335
|
-
},
|
|
336
|
-
dropdownTitle: {
|
|
337
|
-
fontSize: 14,
|
|
338
|
-
fontWeight: '600',
|
|
339
|
-
color: _sharedUi.night.color.text
|
|
340
|
-
},
|
|
341
|
-
headerRefreshButton: {
|
|
342
|
-
padding: 4
|
|
343
|
-
},
|
|
344
|
-
headerRefreshText: {
|
|
345
|
-
fontSize: 18,
|
|
346
|
-
color: _sharedUi.night.color.accent
|
|
347
|
-
},
|
|
348
|
-
dropdownList: {
|
|
349
|
-
maxHeight: 400
|
|
350
|
-
},
|
|
351
|
-
dropdownItem: {
|
|
352
|
-
padding: 12,
|
|
353
|
-
borderBottomWidth: 1,
|
|
354
|
-
borderBottomColor: _sharedUi.night.color.separator
|
|
355
|
-
},
|
|
356
|
-
dropdownItemSelected: {
|
|
357
|
-
backgroundColor: _sharedUi.night.color.accentSoft
|
|
358
|
-
},
|
|
359
|
-
// Instance row
|
|
360
|
-
instanceRow: {
|
|
361
|
-
flexDirection: 'row',
|
|
362
|
-
alignItems: 'center',
|
|
363
|
-
justifyContent: 'space-between',
|
|
364
|
-
gap: 12
|
|
365
|
-
},
|
|
366
|
-
instanceLeft: {
|
|
367
|
-
flex: 1,
|
|
368
|
-
gap: 6
|
|
369
|
-
},
|
|
370
|
-
instanceId: {
|
|
371
|
-
fontSize: 13,
|
|
372
|
-
fontWeight: '500',
|
|
373
|
-
color: _sharedUi.night.color.text,
|
|
374
|
-
fontFamily: _sharedUi.monoFont
|
|
375
|
-
},
|
|
376
|
-
instanceIdSelected: {
|
|
377
|
-
fontWeight: '600',
|
|
378
|
-
color: _sharedUi.night.color.accent
|
|
379
|
-
},
|
|
380
|
-
instanceBadges: {
|
|
381
|
-
flexDirection: 'row',
|
|
382
|
-
flexWrap: 'wrap',
|
|
383
|
-
gap: 6
|
|
384
|
-
},
|
|
385
|
-
badge: {
|
|
386
|
-
paddingHorizontal: 6,
|
|
387
|
-
paddingVertical: 2,
|
|
388
|
-
borderRadius: 4,
|
|
389
|
-
borderWidth: 1
|
|
390
|
-
},
|
|
391
|
-
badgeEncrypted: {
|
|
392
|
-
backgroundColor: _sharedUi.macOSColors.semantic.success + '15',
|
|
393
|
-
borderColor: _sharedUi.macOSColors.semantic.success + '40'
|
|
394
|
-
},
|
|
395
|
-
badgeReadOnly: {
|
|
396
|
-
backgroundColor: _sharedUi.macOSColors.semantic.warning + '15',
|
|
397
|
-
borderColor: _sharedUi.macOSColors.semantic.warning + '40'
|
|
398
|
-
},
|
|
399
|
-
badgeText: {
|
|
400
|
-
fontSize: 9,
|
|
401
|
-
fontWeight: '500',
|
|
402
|
-
color: _sharedUi.night.color.textSecondary
|
|
403
|
-
},
|
|
404
|
-
instanceRight: {
|
|
405
|
-
alignItems: 'flex-end'
|
|
406
|
-
},
|
|
407
|
-
keyCount: {
|
|
408
|
-
fontSize: 16,
|
|
409
|
-
fontWeight: '600',
|
|
410
|
-
color: _sharedUi.night.color.text,
|
|
411
|
-
fontFamily: _sharedUi.monoFont
|
|
412
|
-
},
|
|
413
|
-
keyCountLabel: {
|
|
414
|
-
fontSize: 9,
|
|
415
|
-
color: _sharedUi.night.color.textTertiary,
|
|
416
|
-
textTransform: "uppercase",
|
|
417
|
-
letterSpacing: 0.5
|
|
418
|
-
}
|
|
419
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.MMKVInstanceSelector=MMKVInstanceSelector;var _storageLabels=require("../utils/storageLabels");var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _useMMKVInstances=require("../hooks/useMMKVInstances");var _mmkvAvailability=require("../utils/mmkvAvailability");var _jsxRuntime=require("react/jsx-runtime");function MMKVInstanceSelector({selectedInstanceId:t,onSelectInstance:r,showRefreshButton:n=true}){const[c,o]=(0,_react.useState)(false);const{instances:i,instanceCount:a,refresh:s}=(0,_useMMKVInstances.useMMKVInstances)(false);const l=i.find(e=>e.id===t);const d=e=>{r(e);o(false)};if(!(0,_mmkvAvailability.isMMKVAvailable)()){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.unavailableState,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.unavailableTitle,children:[_storageLabels.storageLabels.mmkv," Not Available"]}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.unavailableDescription,children:(0,_mmkvAvailability.getMMKVUnavailableMessage)()})]})})}if(a===0){return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.container,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.emptyState,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateTitle,children:"No MMKV Instances Registered"}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateDescription,children:"Register MMKV instances using registerMMKVInstance() to monitor them in dev tools."}),n&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.refreshButton,onPress:s,activeOpacity:.7,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.refreshButtonText,children:"\u21BB Refresh"})})]})})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsxs)(_reactNative.TouchableOpacity,{style:styles.selectorButton,onPress:()=>o(true),activeOpacity:.7,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.selectorContent,children:l?(0,_jsxRuntime.jsx)(InstanceRow,{instance:l,isSelected:true}):(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.placeholderText,children:"Select MMKV Instance"})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.dropdownArrow,children:"\u25BC"})]}),(0,_jsxRuntime.jsx)(_reactNative.Modal,{visible:c,transparent:true,animationType:"fade",onRequestClose:()=>o(false),children:(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.modalOverlay,activeOpacity:1,onPress:()=>o(false),children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.dropdownContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.dropdownHeader,children:[(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.dropdownTitle,children:["Select MMKV Instance (",a,")"]}),n&&(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:styles.headerRefreshButton,onPress:s,activeOpacity:.7,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.headerRefreshText,children:"\u21BB"})})]}),(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:styles.dropdownList,children:i.map(e=>(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{style:[styles.dropdownItem,e.id===t&&styles.dropdownItemSelected],onPress:()=>d(e.id),activeOpacity:.7,children:(0,_jsxRuntime.jsx)(InstanceRow,{instance:e,isSelected:e.id===t})},e.id))})]})})})]})}function InstanceRow({instance:t,isSelected:r}){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.instanceRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.instanceLeft,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.instanceId,r&&styles.instanceIdSelected],numberOfLines:1,children:t.id}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.instanceBadges,children:[t.encrypted&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,styles.badgeEncrypted],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.badgeText,children:"\u{1F512} Encrypted"})}),t.readOnly&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.badge,styles.badgeReadOnly],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.badgeText,children:"\u{1F441}\uFE0F Read-only"})})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.instanceRight,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.keyCount,children:t.keyCount}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.keyCountLabel,children:"keys"})]})]})}const styles=_reactNative.StyleSheet.create({container:{marginBottom:12},unavailableState:{backgroundColor:_sharedUi.macOSColors.semantic.warning+"15",borderRadius:12,padding:20,borderWidth:1,borderColor:_sharedUi.macOSColors.semantic.warning+"40",alignItems:"center",gap:12},unavailableTitle:{fontSize:14,fontWeight:"600",color:_sharedUi.macOSColors.semantic.warning},unavailableDescription:{fontSize:12,color:_sharedUi.night.color.textSecondary,textAlign:"center",lineHeight:18},emptyState:{backgroundColor:_sharedUi.night.color.surface,borderRadius:12,padding:20,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center",gap:12},emptyStateTitle:{fontSize:14,fontWeight:"600",color:_sharedUi.night.color.text},emptyStateDescription:{fontSize:12,color:_sharedUi.night.color.textTertiary,textAlign:"center",lineHeight:18},refreshButton:{marginTop:8,paddingHorizontal:16,paddingVertical:8,backgroundColor:_sharedUi.night.color.accentSoft,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.accentBorderStrong},refreshButtonText:{fontSize:12,fontWeight:"600",color:_sharedUi.night.color.accent},selectorButton:{backgroundColor:_sharedUi.night.color.surface,borderRadius:12,borderWidth:1,borderColor:_sharedUi.night.color.border,padding:12,flexDirection:"row",alignItems:"center",justifyContent:"space-between",shadowColor:"#000000",shadowOpacity:.03,shadowRadius:8,shadowOffset:{width:0,height:2}},selectorContent:{flex:1},placeholderText:{fontSize:13,color:_sharedUi.night.color.placeholder,fontStyle:"italic"},dropdownArrow:{fontSize:10,color:_sharedUi.night.color.textTertiary,marginLeft:8},modalOverlay:{flex:1,backgroundColor:"rgba(0, 0, 0, 0.5)",justifyContent:"center",alignItems:"center",padding:20},dropdownContainer:{backgroundColor:_sharedUi.night.color.surface,borderRadius:16,borderWidth:1,borderColor:_sharedUi.night.color.border,width:"100%",maxWidth:500,maxHeight:"70%",shadowColor:"#000000",shadowOpacity:.2,shadowRadius:20,shadowOffset:{width:0,height:10},overflow:"hidden"},dropdownHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",padding:16,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.separator},dropdownTitle:{fontSize:14,fontWeight:"600",color:_sharedUi.night.color.text},headerRefreshButton:{padding:4},headerRefreshText:{fontSize:18,color:_sharedUi.night.color.accent},dropdownList:{maxHeight:400},dropdownItem:{padding:12,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.separator},dropdownItemSelected:{backgroundColor:_sharedUi.night.color.accentSoft},instanceRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:12},instanceLeft:{flex:1,gap:6},instanceId:{fontSize:13,fontWeight:"500",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},instanceIdSelected:{fontWeight:"600",color:_sharedUi.night.color.accent},instanceBadges:{flexDirection:"row",flexWrap:"wrap",gap:6},badge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4,borderWidth:1},badgeEncrypted:{backgroundColor:_sharedUi.macOSColors.semantic.success+"15",borderColor:_sharedUi.macOSColors.semantic.success+"40"},badgeReadOnly:{backgroundColor:_sharedUi.macOSColors.semantic.warning+"15",borderColor:_sharedUi.macOSColors.semantic.warning+"40"},badgeText:{fontSize:9,fontWeight:"500",color:_sharedUi.night.color.textSecondary},instanceRight:{alignItems:"flex-end"},keyCount:{fontSize:16,fontWeight:"600",color:_sharedUi.night.color.text,fontFamily:_sharedUi.monoFont},keyCountLabel:{fontSize:9,color:_sharedUi.night.color.textTertiary,textTransform:"uppercase",letterSpacing:.5}});
|