@buoy-gg/storage 7.0.40 → 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 -86
- package/lib/commonjs/index.js +1 -346
- package/lib/commonjs/preset.js +1 -80
- 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 -1258
- package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +1 -257
- package/lib/commonjs/storage/components/MMKVInstanceSelector.js +1 -418
- package/lib/commonjs/storage/components/SelectionActionBar.js +1 -207
- package/lib/commonjs/storage/components/StorageActionButtons.js +1 -241
- 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 -117
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +1 -494
- package/lib/commonjs/storage/components/StorageEventFilterView.js +1 -159
- 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 -344
- 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 -143
- 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 -159
- 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 -478
- 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 -0
- 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 -0
- package/lib/commonjs/storage/utils/browserStorageLifecycle.web.js +1 -0
- 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 -0
- 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 -0
- package/lib/commonjs/storage/utils/storageLabels.web.js +1 -0
- 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 -112
- package/lib/module/preset.js +1 -76
- 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 -1256
- package/lib/module/storage/components/MMKVInstanceInfoPanel.js +1 -253
- package/lib/module/storage/components/MMKVInstanceSelector.js +1 -414
- package/lib/module/storage/components/SelectionActionBar.js +1 -204
- package/lib/module/storage/components/StorageActionButtons.js +1 -237
- 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 -112
- package/lib/module/storage/components/StorageEventDetailContent.js +1 -490
- package/lib/module/storage/components/StorageEventFilterView.js +1 -155
- 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 -341
- 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 -138
- 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 -156
- 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 -474
- 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 -0
- 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 -0
- package/lib/module/storage/utils/browserStorageLifecycle.web.js +1 -0
- 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 -0
- 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 -0
- package/lib/module/storage/utils/storageLabels.web.js +1 -0
- 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/typescript/index.d.ts +1 -0
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +0 -8
- package/lib/typescript/storage/components/StorageEventCard.d.ts +0 -7
- package/lib/typescript/storage/components/StorageKeyRow.d.ts +2 -6
- package/lib/typescript/storage/components/StorageTypeFilterBar.d.ts +0 -15
- package/lib/typescript/storage/hooks/useSecureStoreKeys.d.ts +2 -2
- package/lib/typescript/storage/sync/storageSyncAdapter.d.ts +7 -13
- package/lib/typescript/storage/utils/AsyncStorageListener.web.d.ts +24 -0
- package/lib/typescript/storage/utils/browserStorageLifecycle.d.ts +3 -0
- package/lib/typescript/storage/utils/browserStorageLifecycle.web.d.ts +2 -0
- package/lib/typescript/storage/utils/mmkvAvailability.web.d.ts +4 -0
- package/lib/typescript/storage/utils/storageLabels.d.ts +8 -0
- package/lib/typescript/storage/utils/storageLabels.web.d.ts +8 -0
- package/lib/web/index.mjs +4 -0
- package/package.json +40 -14
- package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +0 -356
- package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +0 -122
- package/lib/commonjs/storage/components/StorageKeyEditorScreen.js +0 -414
- package/lib/commonjs/storage/components/StorageScalarKeyEditor.js +0 -61
- package/lib/commonjs/storage/components/StorageValueEditModal.js +0 -24
- package/lib/commonjs/storage/hooks/useKeyEditor.js +0 -31
- package/lib/commonjs/storage/hooks/useTreeDraft.js +0 -25
- package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +0 -352
- package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +0 -118
- package/lib/module/storage/components/StorageKeyEditorScreen.js +0 -410
- package/lib/module/storage/components/StorageScalarKeyEditor.js +0 -57
- package/lib/module/storage/components/StorageValueEditModal.js +0 -20
- package/lib/module/storage/hooks/useKeyEditor.js +0 -27
- package/lib/module/storage/hooks/useTreeDraft.js +0 -21
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +0 -18
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +0 -1
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +0 -12
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.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/StorageKeyEditorScreen.d.ts +0 -42
- package/lib/typescript/storage/components/StorageKeyEditorScreen.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/StorageScalarKeyEditor.d.ts +0 -24
- package/lib/typescript/storage/components/StorageScalarKeyEditor.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/components/StorageValueEditModal.d.ts +0 -14
- package/lib/typescript/storage/components/StorageValueEditModal.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +0 -1
- package/lib/typescript/storage/hooks/useKeyEditor.d.ts +0 -27
- package/lib/typescript/storage/hooks/useKeyEditor.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/hooks/useTreeDraft.d.ts +0 -16
- package/lib/typescript/storage/hooks/useTreeDraft.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/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/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/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/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,160 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StorageKeySection = StorageKeySection;
|
|
7
|
-
exports.storageRowId = storageRowId;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _reactNative = require("react-native");
|
|
10
|
-
var _StorageKeyRow = require("./StorageKeyRow");
|
|
11
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
12
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
/**
|
|
14
|
-
* Identifies a ROW, not a key name — the same name routinely exists in more
|
|
15
|
-
* than one backend. Shared with the browser so both sides agree on the id.
|
|
16
|
-
*/
|
|
17
|
-
function storageRowId(storageKey) {
|
|
18
|
-
return storageKey.instanceId ? `${storageKey.storageType}-${storageKey.instanceId}-${storageKey.key}` : `${storageKey.storageType}-${storageKey.key}`;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Storage key section component following composition principles [[rule3]]
|
|
22
|
-
*
|
|
23
|
-
* Applied principles:
|
|
24
|
-
* - Decompose by Responsibility: Single purpose component for grouped storage keys
|
|
25
|
-
* - Prefer Composition over Configuration: Reuses patterns from EnvVarSection
|
|
26
|
-
* - Extract Reusable Logic: Shares expansion state management pattern
|
|
27
|
-
*/
|
|
28
|
-
function StorageKeySection({
|
|
29
|
-
title,
|
|
30
|
-
count,
|
|
31
|
-
keys,
|
|
32
|
-
emptyMessage,
|
|
33
|
-
headerColor,
|
|
34
|
-
isSelectMode = false,
|
|
35
|
-
selectedKeys = new Set(),
|
|
36
|
-
onSelectionChange,
|
|
37
|
-
eventCountByKey,
|
|
38
|
-
onViewHistory,
|
|
39
|
-
onHideKey,
|
|
40
|
-
pinnedKeys,
|
|
41
|
-
onTogglePin,
|
|
42
|
-
onEditKey,
|
|
43
|
-
onToggleKey,
|
|
44
|
-
onDeleteKey,
|
|
45
|
-
editBlockedFor,
|
|
46
|
-
onRowRef,
|
|
47
|
-
onOpenKey
|
|
48
|
-
}) {
|
|
49
|
-
/**
|
|
50
|
-
* Identifies a ROW, not a key name.
|
|
51
|
-
*
|
|
52
|
-
* The same name routinely exists in more than one place — an app that keeps
|
|
53
|
-
* `auth.refreshToken` in both MMKV and the keychain has two rows called
|
|
54
|
-
* that, and they are different values in different stores.
|
|
55
|
-
*/
|
|
56
|
-
const getKeyIdentifier = (0, _react.useCallback)(storageKey => storageRowId(storageKey), []);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Which ROW is expanded — by identifier, not by key name.
|
|
60
|
-
*
|
|
61
|
-
* Keyed by name, tapping one of a pair of same-named rows opened BOTH of
|
|
62
|
-
* them: two cards, two value trees, and two Edit buttons, one of which
|
|
63
|
-
* writes to a store you weren't looking at.
|
|
64
|
-
*/
|
|
65
|
-
const [expandedKey, setExpandedKey] = (0, _react.useState)(null);
|
|
66
|
-
const handleKeyPress = (0, _react.useCallback)(storageKey => {
|
|
67
|
-
// Fiber-driven automation can invoke the ROW's onPress prop directly,
|
|
68
|
-
// handing this a GestureResponderEvent instead of the key the row's own
|
|
69
|
-
// touchable wrapper binds. Rendering an event as a key produced a
|
|
70
|
-
// convincing all-"undefined" detail screen; refuse anything that isn't
|
|
71
|
-
// a key.
|
|
72
|
-
if (!storageKey || typeof storageKey.key !== "string") return;
|
|
73
|
-
if (onOpenKey) {
|
|
74
|
-
// Navigate-to-detail hosts: the card is a door, not a drawer.
|
|
75
|
-
onOpenKey(storageKey);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const id = getKeyIdentifier(storageKey);
|
|
79
|
-
setExpandedKey(prev => prev === id ? null : id);
|
|
80
|
-
}, [getKeyIdentifier, onOpenKey]);
|
|
81
|
-
if (keys.length === 0 && title === "Required Keys") {
|
|
82
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
83
|
-
style: styles.sectionContainer,
|
|
84
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
85
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
86
|
-
children: title
|
|
87
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge, {
|
|
88
|
-
count: 0,
|
|
89
|
-
color: headerColor
|
|
90
|
-
})]
|
|
91
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
92
|
-
style: styles.emptySection,
|
|
93
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
94
|
-
style: styles.emptySectionText,
|
|
95
|
-
children: emptyMessage
|
|
96
|
-
})
|
|
97
|
-
})]
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
if (keys.length === 0) return null;
|
|
101
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
102
|
-
style: styles.sectionContainer,
|
|
103
|
-
children: [title ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
104
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
105
|
-
children: title
|
|
106
|
-
}), count >= 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge, {
|
|
107
|
-
count: count,
|
|
108
|
-
color: headerColor
|
|
109
|
-
})]
|
|
110
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
111
|
-
style: styles.sectionContent,
|
|
112
|
-
children: keys.map(storageKey => {
|
|
113
|
-
// Create unique key by combining storage type, instance ID (if present), and key name
|
|
114
|
-
const uniqueKey = getKeyIdentifier(storageKey);
|
|
115
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
116
|
-
ref: onRowRef ? node => onRowRef(uniqueKey, node) : undefined,
|
|
117
|
-
collapsable: false,
|
|
118
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StorageKeyRow.StorageKeyRow, {
|
|
119
|
-
storageKey: storageKey,
|
|
120
|
-
isExpanded: !isSelectMode && expandedKey === uniqueKey,
|
|
121
|
-
onPress: handleKeyPress,
|
|
122
|
-
isSelectMode: isSelectMode,
|
|
123
|
-
isSelected: selectedKeys.has(uniqueKey),
|
|
124
|
-
onSelectionChange: onSelectionChange,
|
|
125
|
-
eventCount: eventCountByKey?.[storageKey.key],
|
|
126
|
-
onViewHistory: onViewHistory ? () => onViewHistory(storageKey.key) : undefined,
|
|
127
|
-
onHideKey: onHideKey,
|
|
128
|
-
onEditKey: onEditKey,
|
|
129
|
-
onToggleKey: onToggleKey,
|
|
130
|
-
onDeleteKey: onDeleteKey,
|
|
131
|
-
editBlockedReason: editBlockedFor?.(storageKey),
|
|
132
|
-
isPinned: pinnedKeys?.has(storageKey.key),
|
|
133
|
-
onTogglePin: onTogglePin
|
|
134
|
-
})
|
|
135
|
-
}, uniqueKey);
|
|
136
|
-
})
|
|
137
|
-
})]
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
const styles = _reactNative.StyleSheet.create({
|
|
141
|
-
sectionContainer: {
|
|
142
|
-
gap: 8
|
|
143
|
-
},
|
|
144
|
-
sectionContent: {
|
|
145
|
-
// No gap needed, StorageKeyRow has its own margins
|
|
146
|
-
},
|
|
147
|
-
emptySection: {
|
|
148
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
149
|
-
borderRadius: 6,
|
|
150
|
-
padding: 16,
|
|
151
|
-
borderWidth: 1,
|
|
152
|
-
borderColor: _sharedUi.night.color.border,
|
|
153
|
-
alignItems: "center"
|
|
154
|
-
},
|
|
155
|
-
emptySectionText: {
|
|
156
|
-
color: _sharedUi.night.color.textTertiary,
|
|
157
|
-
fontSize: 11,
|
|
158
|
-
textAlign: "center"
|
|
159
|
-
}
|
|
160
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeySection=StorageKeySection;exports.storageRowId=storageRowId;var _react=require("react");var _reactNative=require("react-native");var _StorageKeyRow=require("./StorageKeyRow");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function storageRowId(n){return n.instanceId?`${n.storageType}-${n.instanceId}-${n.key}`:`${n.storageType}-${n.key}`}function StorageKeySection({title:n,count:s,keys:r,emptyMessage:x,headerColor:d,isSelectMode:l=false,selectedKeys:S=new Set,onSelectionChange:h,eventCountByKey:y,onViewHistory:a,onHideKey:g,pinnedKeys:j,onTogglePin:p,onEditKey:f,onToggleKey:b,onDeleteKey:w,editBlockedFor:C,onRowRef:u,onOpenKey:i}){const o=(0,_react.useCallback)(e=>storageRowId(e),[]);const[T,v]=(0,_react.useState)(null);const k=(0,_react.useCallback)(e=>{if(!e||typeof e.key!=="string")return;if(i){i(e);return}const t=o(e);v(c=>c===t?null:t)},[o,i]);if(r.length===0&&n==="Required Keys"){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionContainer,children:[(0,_jsxRuntime.jsxs)(_sharedUi.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Title,{children:n}),(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge,{count:0,color:d})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.emptySection,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptySectionText,children:x})})]})}if(r.length===0)return null;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sectionContainer,children:[n?(0,_jsxRuntime.jsxs)(_sharedUi.SectionHeader,{children:[(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Title,{children:n}),s>=0&&(0,_jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge,{count:s,color:d})]}):null,(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.sectionContent,children:r.map(e=>{const t=o(e);return(0,_jsxRuntime.jsx)(_reactNative.View,{ref:u?c=>u(t,c):void 0,collapsable:false,children:(0,_jsxRuntime.jsx)(_StorageKeyRow.StorageKeyRow,{storageKey:e,isExpanded:!l&&T===t,onPress:k,isSelectMode:l,isSelected:S.has(t),onSelectionChange:h,eventCount:y?.[e.key],onViewHistory:a?()=>a(e.key):void 0,onHideKey:g,onEditKey:f,onToggleKey:b,onDeleteKey:w,editBlockedReason:C?.(e),isPinned:j?.has(e.key),onTogglePin:p})},t)})})]})}const styles=_reactNative.StyleSheet.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{backgroundColor:_sharedUi.night.color.surface,borderRadius:6,padding:16,borderWidth:1,borderColor:_sharedUi.night.color.border,alignItems:"center"},emptySectionText:{color:_sharedUi.night.color.textTertiary,fontSize:11,textAlign:"center"}});
|
|
@@ -1,344 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.StorageKeyStatsSection = StorageKeyStatsSection;
|
|
7
|
-
var _reactNative = require("react-native");
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _storageQueryUtils = require("../utils/storageQueryUtils");
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
// Variable type configurations matching env vars design
|
|
12
|
-
const variableTypeData = [{
|
|
13
|
-
key: "valid",
|
|
14
|
-
label: "Valid Keys",
|
|
15
|
-
description: "Correctly stored and accessible",
|
|
16
|
-
icon: _sharedUi.CheckCircle2,
|
|
17
|
-
color: "#10B981",
|
|
18
|
-
textColor: "#10B981",
|
|
19
|
-
bgColor: "rgba(16, 185, 129, 0.1)"
|
|
20
|
-
}, {
|
|
21
|
-
key: "missing",
|
|
22
|
-
label: "Missing Keys",
|
|
23
|
-
description: "Required but not found",
|
|
24
|
-
icon: _sharedUi.AlertCircle,
|
|
25
|
-
color: "#EF4444",
|
|
26
|
-
textColor: "#EF4444",
|
|
27
|
-
bgColor: "rgba(239, 68, 68, 0.1)"
|
|
28
|
-
}, {
|
|
29
|
-
key: "wrongValue",
|
|
30
|
-
label: "Wrong Values",
|
|
31
|
-
description: "Stored but incorrect value",
|
|
32
|
-
icon: _sharedUi.XCircle,
|
|
33
|
-
color: "#F97316",
|
|
34
|
-
textColor: "#F97316",
|
|
35
|
-
bgColor: "rgba(249, 115, 22, 0.1)"
|
|
36
|
-
}, {
|
|
37
|
-
key: "wrongType",
|
|
38
|
-
label: "Wrong Types",
|
|
39
|
-
description: "Value has incorrect data type",
|
|
40
|
-
icon: _sharedUi.XCircle,
|
|
41
|
-
color: "#0891B2",
|
|
42
|
-
textColor: "#0891B2",
|
|
43
|
-
bgColor: "rgba(8, 145, 178, 0.1)"
|
|
44
|
-
}, {
|
|
45
|
-
key: "optional",
|
|
46
|
-
label: "Optional Keys",
|
|
47
|
-
description: "Available but not required",
|
|
48
|
-
icon: _sharedUi.Eye,
|
|
49
|
-
color: "#8B5CF6",
|
|
50
|
-
textColor: "#8B5CF6",
|
|
51
|
-
bgColor: "rgba(139, 92, 246, 0.1)"
|
|
52
|
-
}];
|
|
53
|
-
|
|
54
|
-
// Storage type breakdown data
|
|
55
|
-
const storageTypeData = [{
|
|
56
|
-
key: "mmkv",
|
|
57
|
-
label: "MMKV",
|
|
58
|
-
description: "High-performance key-value storage",
|
|
59
|
-
icon: _sharedUi.Database
|
|
60
|
-
}, {
|
|
61
|
-
key: "async",
|
|
62
|
-
label: "AsyncStorage",
|
|
63
|
-
description: "React Native async storage",
|
|
64
|
-
icon: _sharedUi.Database
|
|
65
|
-
}, {
|
|
66
|
-
key: "secure",
|
|
67
|
-
label: "SecureStorage",
|
|
68
|
-
description: "Encrypted secure storage",
|
|
69
|
-
icon: _sharedUi.Shield
|
|
70
|
-
}];
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Storage key stats component following composition principles [[rule3]]
|
|
74
|
-
*
|
|
75
|
-
* Applied principles:
|
|
76
|
-
* - Decompose by Responsibility: Single purpose component for storage stats display
|
|
77
|
-
* - Prefer Composition over Configuration: Reuses patterns from EnvVarStats
|
|
78
|
-
* - Extract Reusable Logic: Shares visualization patterns with env vars
|
|
79
|
-
*/
|
|
80
|
-
function StorageKeyStatsSection({
|
|
81
|
-
stats
|
|
82
|
-
}) {
|
|
83
|
-
const {
|
|
84
|
-
totalCount,
|
|
85
|
-
missingCount,
|
|
86
|
-
wrongValueCount,
|
|
87
|
-
wrongTypeCount,
|
|
88
|
-
presentRequiredCount,
|
|
89
|
-
optionalCount,
|
|
90
|
-
mmkvCount,
|
|
91
|
-
asyncCount,
|
|
92
|
-
secureCount
|
|
93
|
-
} = stats;
|
|
94
|
-
|
|
95
|
-
// If no storage keys at all, show minimal stats
|
|
96
|
-
if (totalCount === 0) {
|
|
97
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
98
|
-
style: styles.statsContainer,
|
|
99
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
100
|
-
style: styles.sectionTitle,
|
|
101
|
-
children: "STORAGE BREAKDOWN"
|
|
102
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
103
|
-
style: styles.emptyState,
|
|
104
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
105
|
-
style: styles.emptyStateText,
|
|
106
|
-
children: "No storage keys detected"
|
|
107
|
-
})
|
|
108
|
-
})]
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
112
|
-
style: styles.statsContainer,
|
|
113
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
114
|
-
style: styles.breakdownSection,
|
|
115
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
116
|
-
style: styles.sectionTitle,
|
|
117
|
-
children: "KEY STATUS BREAKDOWN"
|
|
118
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
119
|
-
style: styles.breakdownList,
|
|
120
|
-
children: variableTypeData.map(item => {
|
|
121
|
-
let count = 0;
|
|
122
|
-
let shouldShow = false;
|
|
123
|
-
switch (item.key) {
|
|
124
|
-
case "valid":
|
|
125
|
-
count = presentRequiredCount;
|
|
126
|
-
shouldShow = count > 0;
|
|
127
|
-
break;
|
|
128
|
-
case "missing":
|
|
129
|
-
count = missingCount;
|
|
130
|
-
shouldShow = count > 0;
|
|
131
|
-
break;
|
|
132
|
-
case "wrongValue":
|
|
133
|
-
count = wrongValueCount;
|
|
134
|
-
shouldShow = count > 0;
|
|
135
|
-
break;
|
|
136
|
-
case "wrongType":
|
|
137
|
-
count = wrongTypeCount;
|
|
138
|
-
shouldShow = count > 0;
|
|
139
|
-
break;
|
|
140
|
-
case "optional":
|
|
141
|
-
count = optionalCount;
|
|
142
|
-
shouldShow = count > 0;
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
if (!shouldShow) return null;
|
|
146
|
-
const percentage = totalCount > 0 ? (count / totalCount * 100).toFixed(1) : "0";
|
|
147
|
-
const IconComponent = item.icon;
|
|
148
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
149
|
-
style: styles.breakdownItem,
|
|
150
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
151
|
-
style: styles.breakdownItemRow,
|
|
152
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
153
|
-
style: styles.breakdownItemLeft,
|
|
154
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
155
|
-
style: [styles.breakdownIcon, {
|
|
156
|
-
backgroundColor: item.bgColor
|
|
157
|
-
}],
|
|
158
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
159
|
-
size: 14,
|
|
160
|
-
color: item.color
|
|
161
|
-
})
|
|
162
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
163
|
-
style: styles.breakdownItemInfo,
|
|
164
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
165
|
-
style: styles.breakdownItemLabel,
|
|
166
|
-
children: item.label
|
|
167
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
168
|
-
style: styles.breakdownItemDesc,
|
|
169
|
-
children: item.description
|
|
170
|
-
})]
|
|
171
|
-
})]
|
|
172
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
173
|
-
style: styles.breakdownItemRight,
|
|
174
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
175
|
-
style: [styles.breakdownCount, {
|
|
176
|
-
color: item.textColor
|
|
177
|
-
}],
|
|
178
|
-
children: count
|
|
179
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
180
|
-
style: styles.breakdownPercentage,
|
|
181
|
-
children: [percentage, "%"]
|
|
182
|
-
})]
|
|
183
|
-
})]
|
|
184
|
-
})
|
|
185
|
-
}, item.key);
|
|
186
|
-
})
|
|
187
|
-
})]
|
|
188
|
-
}), (mmkvCount > 0 || asyncCount > 0 || secureCount > 0) && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
189
|
-
style: styles.breakdownSection,
|
|
190
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
191
|
-
style: styles.sectionTitle,
|
|
192
|
-
children: "STORAGE TYPE BREAKDOWN"
|
|
193
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
194
|
-
style: styles.breakdownList,
|
|
195
|
-
children: storageTypeData.map(item => {
|
|
196
|
-
let count = 0;
|
|
197
|
-
let shouldShow = false;
|
|
198
|
-
switch (item.key) {
|
|
199
|
-
case "mmkv":
|
|
200
|
-
count = mmkvCount;
|
|
201
|
-
shouldShow = count > 0;
|
|
202
|
-
break;
|
|
203
|
-
case "async":
|
|
204
|
-
count = asyncCount;
|
|
205
|
-
shouldShow = count > 0;
|
|
206
|
-
break;
|
|
207
|
-
case "secure":
|
|
208
|
-
count = secureCount;
|
|
209
|
-
shouldShow = count > 0;
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
if (!shouldShow) return null;
|
|
213
|
-
const percentage = totalCount > 0 ? (count / totalCount * 100).toFixed(1) : "0";
|
|
214
|
-
const IconComponent = item.icon;
|
|
215
|
-
const storageColor = (0, _storageQueryUtils.getStorageTypeHexColor)(item.key);
|
|
216
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
217
|
-
style: styles.breakdownItem,
|
|
218
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
219
|
-
style: styles.breakdownItemRow,
|
|
220
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
221
|
-
style: styles.breakdownItemLeft,
|
|
222
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
223
|
-
style: [styles.breakdownIcon, {
|
|
224
|
-
backgroundColor: `${storageColor}15`
|
|
225
|
-
}],
|
|
226
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
227
|
-
size: 14,
|
|
228
|
-
color: storageColor
|
|
229
|
-
})
|
|
230
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
231
|
-
style: styles.breakdownItemInfo,
|
|
232
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
233
|
-
style: styles.breakdownItemLabel,
|
|
234
|
-
children: item.label
|
|
235
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
236
|
-
style: styles.breakdownItemDesc,
|
|
237
|
-
children: item.description
|
|
238
|
-
})]
|
|
239
|
-
})]
|
|
240
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
241
|
-
style: styles.breakdownItemRight,
|
|
242
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
243
|
-
style: [styles.breakdownCount, {
|
|
244
|
-
color: storageColor
|
|
245
|
-
}],
|
|
246
|
-
children: count
|
|
247
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
248
|
-
style: styles.breakdownPercentage,
|
|
249
|
-
children: [percentage, "%"]
|
|
250
|
-
})]
|
|
251
|
-
})]
|
|
252
|
-
})
|
|
253
|
-
}, item.key);
|
|
254
|
-
})
|
|
255
|
-
})]
|
|
256
|
-
})]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
const styles = _reactNative.StyleSheet.create({
|
|
260
|
-
statsContainer: {
|
|
261
|
-
marginBottom: 24,
|
|
262
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
263
|
-
borderRadius: 8,
|
|
264
|
-
padding: 16,
|
|
265
|
-
borderWidth: 1,
|
|
266
|
-
borderColor: _sharedUi.night.color.border
|
|
267
|
-
},
|
|
268
|
-
// Section titles
|
|
269
|
-
sectionTitle: {
|
|
270
|
-
color: _sharedUi.night.color.textSecondary,
|
|
271
|
-
fontSize: 12,
|
|
272
|
-
fontWeight: "500",
|
|
273
|
-
marginBottom: 16,
|
|
274
|
-
textTransform: "uppercase",
|
|
275
|
-
letterSpacing: 0.5
|
|
276
|
-
},
|
|
277
|
-
// Breakdown section
|
|
278
|
-
breakdownSection: {
|
|
279
|
-
gap: 12,
|
|
280
|
-
marginBottom: 20
|
|
281
|
-
},
|
|
282
|
-
breakdownList: {
|
|
283
|
-
gap: 12
|
|
284
|
-
},
|
|
285
|
-
breakdownItem: {
|
|
286
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
287
|
-
padding: 12,
|
|
288
|
-
borderRadius: 8,
|
|
289
|
-
borderWidth: 1,
|
|
290
|
-
borderColor: _sharedUi.night.color.border
|
|
291
|
-
},
|
|
292
|
-
breakdownItemRow: {
|
|
293
|
-
flexDirection: "row",
|
|
294
|
-
alignItems: "center",
|
|
295
|
-
justifyContent: "space-between"
|
|
296
|
-
},
|
|
297
|
-
breakdownItemLeft: {
|
|
298
|
-
flexDirection: "row",
|
|
299
|
-
alignItems: "center",
|
|
300
|
-
gap: 12,
|
|
301
|
-
flex: 1,
|
|
302
|
-
minWidth: 0
|
|
303
|
-
},
|
|
304
|
-
breakdownIcon: {
|
|
305
|
-
padding: 8,
|
|
306
|
-
borderRadius: 8
|
|
307
|
-
},
|
|
308
|
-
breakdownItemInfo: {
|
|
309
|
-
flex: 1,
|
|
310
|
-
minWidth: 0
|
|
311
|
-
},
|
|
312
|
-
breakdownItemLabel: {
|
|
313
|
-
color: _sharedUi.night.color.text,
|
|
314
|
-
fontSize: 14,
|
|
315
|
-
fontWeight: "500"
|
|
316
|
-
},
|
|
317
|
-
breakdownItemDesc: {
|
|
318
|
-
color: _sharedUi.night.color.textSecondary,
|
|
319
|
-
fontSize: 12
|
|
320
|
-
},
|
|
321
|
-
breakdownItemRight: {
|
|
322
|
-
alignItems: "flex-end"
|
|
323
|
-
},
|
|
324
|
-
breakdownCount: {
|
|
325
|
-
fontSize: 16,
|
|
326
|
-
fontWeight: "600"
|
|
327
|
-
},
|
|
328
|
-
breakdownPercentage: {
|
|
329
|
-
color: _sharedUi.night.color.textTertiary,
|
|
330
|
-
fontSize: 10
|
|
331
|
-
},
|
|
332
|
-
// Empty state
|
|
333
|
-
emptyState: {
|
|
334
|
-
padding: 16,
|
|
335
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
336
|
-
borderRadius: 6,
|
|
337
|
-
alignItems: "center"
|
|
338
|
-
},
|
|
339
|
-
emptyStateText: {
|
|
340
|
-
color: _sharedUi.night.color.textTertiary,
|
|
341
|
-
fontSize: 11,
|
|
342
|
-
textAlign: "center"
|
|
343
|
-
}
|
|
344
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.StorageKeyStatsSection=StorageKeyStatsSection;var _storageLabels=require("../utils/storageLabels");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _storageQueryUtils=require("../utils/storageQueryUtils");var _jsxRuntime=require("react/jsx-runtime");const variableTypeData=[{key:"valid",label:"Valid Keys",description:"Correctly stored and accessible",icon:_sharedUi.CheckCircle2,color:"#10B981",textColor:"#10B981",bgColor:"rgba(16, 185, 129, 0.1)"},{key:"missing",label:"Missing Keys",description:"Required but not found",icon:_sharedUi.AlertCircle,color:"#EF4444",textColor:"#EF4444",bgColor:"rgba(239, 68, 68, 0.1)"},{key:"wrongValue",label:"Wrong Values",description:"Stored but incorrect value",icon:_sharedUi.XCircle,color:"#F97316",textColor:"#F97316",bgColor:"rgba(249, 115, 22, 0.1)"},{key:"wrongType",label:"Wrong Types",description:"Value has incorrect data type",icon:_sharedUi.XCircle,color:"#0891B2",textColor:"#0891B2",bgColor:"rgba(8, 145, 178, 0.1)"},{key:"optional",label:"Optional Keys",description:"Available but not required",icon:_sharedUi.Eye,color:"#8B5CF6",textColor:"#8B5CF6",bgColor:"rgba(139, 92, 246, 0.1)"}];const storageTypeData=[{key:"mmkv",label:_storageLabels.storageLabels.mmkv,description:_storageLabels.storageLabels.hasSecure?"Synchronous key-value storage":"Storage for this browser tab",icon:_sharedUi.Database},{key:"async",label:_storageLabels.storageLabels.asyncFull,description:_storageLabels.storageLabels.hasSecure?"React Native async storage":"Persistent storage for this origin",icon:_sharedUi.Database},{key:"secure",label:"SecureStorage",description:"Encrypted secure storage",icon:_sharedUi.Shield}];function StorageKeyStatsSection({stats:d}){const{totalCount:r,missingCount:b,wrongValueCount:g,wrongTypeCount:y,presentRequiredCount:u,optionalCount:w,mmkvCount:l,asyncCount:i,secureCount:c}=d;if(r===0){return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsContainer,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORAGE BREAKDOWN"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.emptyState,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.emptyStateText,children:"No storage keys detected"})})]})}return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.statsContainer,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"KEY STATUS BREAKDOWN"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.breakdownList,children:variableTypeData.map(t=>{let e=0;let o=false;switch(t.key){case"valid":e=u;o=e>0;break;case"missing":e=b;o=e>0;break;case"wrongValue":e=g;o=e>0;break;case"wrongType":e=y;o=e>0;break;case"optional":e=w;o=e>0;break}if(!o)return null;const n=r>0?(e/r*100).toFixed(1):"0";const s=t.icon;return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.breakdownItem,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemLeft,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.breakdownIcon,{backgroundColor:t.bgColor}],children:(0,_jsxRuntime.jsx)(s,{size:14,color:t.color})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.breakdownItemLabel,children:t.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.breakdownItemDesc,children:t.description})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemRight,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.breakdownCount,{color:t.textColor}],children:e}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.breakdownPercentage,children:[n,"%"]})]})]})},t.key)})})]}),(l>0||i>0||c>0)&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownSection,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sectionTitle,children:"STORAGE TYPE BREAKDOWN"}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.breakdownList,children:storageTypeData.map(t=>{let e=0;let o=false;switch(t.key){case"mmkv":e=l;o=e>0;break;case"async":e=i;o=e>0;break;case"secure":e=c;o=e>0;break}if(!o)return null;const n=r>0?(e/r*100).toFixed(1):"0";const s=t.icon;const a=(0,_storageQueryUtils.getStorageTypeHexColor)(t.key);return(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.breakdownItem,children:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemRow,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemLeft,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.breakdownIcon,{backgroundColor:`${a}15`}],children:(0,_jsxRuntime.jsx)(s,{size:14,color:a})}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemInfo,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.breakdownItemLabel,children:t.label}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.breakdownItemDesc,children:t.description})]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.breakdownItemRight,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.breakdownCount,{color:a}],children:e}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:styles.breakdownPercentage,children:[n,"%"]})]})]})},t.key)})})]})]})}const styles=_reactNative.StyleSheet.create({statsContainer:{marginBottom:24,backgroundColor:_sharedUi.night.color.surface,borderRadius:8,padding:16,borderWidth:1,borderColor:_sharedUi.night.color.border},sectionTitle:{color:_sharedUi.night.color.textSecondary,fontSize:12,fontWeight:"500",marginBottom:16,textTransform:"uppercase",letterSpacing:.5},breakdownSection:{gap:12,marginBottom:20},breakdownList:{gap:12},breakdownItem:{backgroundColor:_sharedUi.night.color.surfaceElevated,padding:12,borderRadius:8,borderWidth:1,borderColor:_sharedUi.night.color.border},breakdownItemRow:{flexDirection:"row",alignItems:"center",justifyContent:"space-between"},breakdownItemLeft:{flexDirection:"row",alignItems:"center",gap:12,flex:1,minWidth:0},breakdownIcon:{padding:8,borderRadius:8},breakdownItemInfo:{flex:1,minWidth:0},breakdownItemLabel:{color:_sharedUi.night.color.text,fontSize:14,fontWeight:"500"},breakdownItemDesc:{color:_sharedUi.night.color.textSecondary,fontSize:12},breakdownItemRight:{alignItems:"flex-end"},breakdownCount:{fontSize:16,fontWeight:"600"},breakdownPercentage:{color:_sharedUi.night.color.textTertiary,fontSize:10},emptyState:{padding:16,backgroundColor:_sharedUi.night.color.surfaceElevated,borderRadius:6,alignItems:"center"},emptyStateText:{color:_sharedUi.night.color.textTertiary,fontSize:11,textAlign:"center"}});
|