@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,554 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { memo } from "react";
|
|
4
|
-
import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
|
|
5
|
-
import { macOSColors, night, CompactRow, TypeBadge, HardDrive, Square, CheckSquare, Edit3, EyeOff, Pin, Trash2, ExpandedInfoRow, PillBadge, monoFont } from "@buoy-gg/shared-ui";
|
|
6
|
-
import { getStorageTypeLabel } from "../utils/storageQueryUtils";
|
|
7
|
-
import { getValueTypeLabel, getValueTypeWithPreview, parseStorageValue } from "../utils/valueType";
|
|
8
|
-
import { DataViewer } from "@buoy-gg/shared-ui/dataViewer";
|
|
9
|
-
|
|
10
|
-
// MMKV Instance color palette - consistent colors per instance
|
|
11
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
|
-
const INSTANCE_COLORS = [macOSColors.semantic.info,
|
|
13
|
-
// Blue
|
|
14
|
-
macOSColors.semantic.success,
|
|
15
|
-
// Green
|
|
16
|
-
macOSColors.semantic.warning,
|
|
17
|
-
// Orange
|
|
18
|
-
macOSColors.semantic.debug,
|
|
19
|
-
// Purple
|
|
20
|
-
'#FF6B9D',
|
|
21
|
-
// Pink
|
|
22
|
-
'#00D9FF' // Cyan
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Get consistent color for an MMKV instance based on its ID
|
|
27
|
-
* Uses simple hash to ensure same instance always gets same color
|
|
28
|
-
*/
|
|
29
|
-
function getInstanceColor(instanceId) {
|
|
30
|
-
const hash = instanceId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
31
|
-
return INSTANCE_COLORS[hash % INSTANCE_COLORS.length];
|
|
32
|
-
}
|
|
33
|
-
/** Exported for the key DETAIL screen, so card and detail can't disagree
|
|
34
|
-
* about what a status is called or what color it wears. */
|
|
35
|
-
export const getStatusConfig = status => {
|
|
36
|
-
switch (status) {
|
|
37
|
-
case "required_present":
|
|
38
|
-
return {
|
|
39
|
-
label: "Valid",
|
|
40
|
-
color: macOSColors.semantic.success,
|
|
41
|
-
sublabel: "Required"
|
|
42
|
-
};
|
|
43
|
-
case "required_missing":
|
|
44
|
-
return {
|
|
45
|
-
label: "Missing",
|
|
46
|
-
color: macOSColors.semantic.error,
|
|
47
|
-
sublabel: "Required"
|
|
48
|
-
};
|
|
49
|
-
case "required_wrong_value":
|
|
50
|
-
return {
|
|
51
|
-
label: "Wrong",
|
|
52
|
-
color: macOSColors.semantic.warning,
|
|
53
|
-
sublabel: "Invalid value"
|
|
54
|
-
};
|
|
55
|
-
case "required_wrong_type":
|
|
56
|
-
return {
|
|
57
|
-
label: "Type Error",
|
|
58
|
-
color: macOSColors.semantic.info,
|
|
59
|
-
sublabel: "Wrong type"
|
|
60
|
-
};
|
|
61
|
-
case "optional_present":
|
|
62
|
-
return {
|
|
63
|
-
label: "Set",
|
|
64
|
-
color: macOSColors.semantic.debug,
|
|
65
|
-
sublabel: "Optional"
|
|
66
|
-
};
|
|
67
|
-
// Runtime data can carry a status the union doesn't know (a stale
|
|
68
|
-
// snapshot, a newer adapter) — a devtool must render it, not redbox.
|
|
69
|
-
default:
|
|
70
|
-
return {
|
|
71
|
-
label: "Set",
|
|
72
|
-
color: macOSColors.text.secondary,
|
|
73
|
-
sublabel: String(status)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
const formatValue = value => {
|
|
78
|
-
if (value === undefined || value === null) {
|
|
79
|
-
return "undefined";
|
|
80
|
-
}
|
|
81
|
-
const str = typeof value === "string" ? value : JSON.stringify(value);
|
|
82
|
-
return str;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// Memo justified by profiling (tool-bench 2026-07-06): the browser tab
|
|
86
|
-
// renders every key row on each parent render (ScrollView, no
|
|
87
|
-
// virtualization) — memo keeps unchanged keys from re-rendering.
|
|
88
|
-
export const StorageKeyRow = /*#__PURE__*/memo(function StorageKeyRow({
|
|
89
|
-
storageKey,
|
|
90
|
-
isExpanded,
|
|
91
|
-
onPress,
|
|
92
|
-
isSelectMode = false,
|
|
93
|
-
isSelected = false,
|
|
94
|
-
onSelectionChange,
|
|
95
|
-
eventCount,
|
|
96
|
-
onViewHistory,
|
|
97
|
-
onHideKey,
|
|
98
|
-
isPinned = false,
|
|
99
|
-
onTogglePin,
|
|
100
|
-
onEditKey,
|
|
101
|
-
onToggleKey,
|
|
102
|
-
onDeleteKey,
|
|
103
|
-
editBlockedReason
|
|
104
|
-
}) {
|
|
105
|
-
const canEdit = onEditKey != null && editBlockedReason == null;
|
|
106
|
-
const config = getStatusConfig(storageKey.status);
|
|
107
|
-
const hasValue = storageKey.value !== undefined && storageKey.value !== null;
|
|
108
|
-
|
|
109
|
-
// Booleans get a dedicated colored badge instead of an inline text preview so
|
|
110
|
-
// their value is scannable at a glance.
|
|
111
|
-
const isBoolean = hasValue && typeof storageKey.value === "boolean";
|
|
112
|
-
|
|
113
|
-
// Format primary text - show the key
|
|
114
|
-
const primaryText = storageKey.key;
|
|
115
|
-
|
|
116
|
-
// Show storage type as secondary text
|
|
117
|
-
const storageTypeLabel = getStorageTypeLabel(storageKey.storageType);
|
|
118
|
-
|
|
119
|
-
// Shared with the editor screen, so the card and the thing it opens can't
|
|
120
|
-
// disagree about whether a key holds a container.
|
|
121
|
-
const parsedValue = parseStorageValue(storageKey.value);
|
|
122
|
-
|
|
123
|
-
/** The tree only renders for containers. */
|
|
124
|
-
const showsTree = parsedValue !== null && typeof parsedValue === "object";
|
|
125
|
-
|
|
126
|
-
// Create expanded content for value and storage details
|
|
127
|
-
const expandedContent = /*#__PURE__*/_jsxs(View, {
|
|
128
|
-
style: styles.expandedContainer,
|
|
129
|
-
children: [/*#__PURE__*/_jsx(ExpandedInfoRow, {
|
|
130
|
-
label: "Storage",
|
|
131
|
-
children: /*#__PURE__*/_jsx(PillBadge, {
|
|
132
|
-
color: getStorageTypeColor(storageKey.storageType),
|
|
133
|
-
children: storageTypeLabel
|
|
134
|
-
})
|
|
135
|
-
}), storageKey.storageType === 'mmkv' && storageKey.instanceId && /*#__PURE__*/_jsx(ExpandedInfoRow, {
|
|
136
|
-
label: "Instance",
|
|
137
|
-
children: /*#__PURE__*/_jsx(PillBadge, {
|
|
138
|
-
color: getInstanceColor(storageKey.instanceId),
|
|
139
|
-
icon: /*#__PURE__*/_jsx(HardDrive, {
|
|
140
|
-
size: 9,
|
|
141
|
-
color: getInstanceColor(storageKey.instanceId)
|
|
142
|
-
}),
|
|
143
|
-
children: storageKey.instanceId
|
|
144
|
-
})
|
|
145
|
-
}), eventCount != null && eventCount > 0 && /*#__PURE__*/_jsxs(ExpandedInfoRow, {
|
|
146
|
-
label: "Updates",
|
|
147
|
-
children: [/*#__PURE__*/_jsx(PillBadge, {
|
|
148
|
-
color: macOSColors.semantic.warning,
|
|
149
|
-
children: String(eventCount)
|
|
150
|
-
}), eventCount > 1 && onViewHistory && /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
151
|
-
onPress: onViewHistory,
|
|
152
|
-
testID: "buoy-storage-key-history",
|
|
153
|
-
accessibilityLabel: `View history for ${storageKey.key}`,
|
|
154
|
-
accessibilityRole: "button",
|
|
155
|
-
style: styles.viewHistoryButton,
|
|
156
|
-
hitSlop: {
|
|
157
|
-
top: 6,
|
|
158
|
-
bottom: 6,
|
|
159
|
-
left: 6,
|
|
160
|
-
right: 6
|
|
161
|
-
},
|
|
162
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
163
|
-
style: styles.viewHistoryText,
|
|
164
|
-
children: "view history \u2192"
|
|
165
|
-
})
|
|
166
|
-
})]
|
|
167
|
-
}), showsTree ? /*#__PURE__*/_jsx(View, {
|
|
168
|
-
style: styles.dataViewerContainer,
|
|
169
|
-
children: /*#__PURE__*/_jsx(DataViewer, {
|
|
170
|
-
data: parsedValue,
|
|
171
|
-
title: "",
|
|
172
|
-
showTypeFilter: true,
|
|
173
|
-
rawMode: true,
|
|
174
|
-
initialExpanded: true
|
|
175
|
-
})
|
|
176
|
-
}) : /*#__PURE__*/_jsxs(View, {
|
|
177
|
-
style: styles.expandedRow,
|
|
178
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
179
|
-
style: styles.expandedLabel,
|
|
180
|
-
children: "Value:"
|
|
181
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
182
|
-
style: styles.expandedValue,
|
|
183
|
-
numberOfLines: 3,
|
|
184
|
-
children: formatValue(storageKey.value) || "undefined"
|
|
185
|
-
})]
|
|
186
|
-
}), storageKey.status === "required_wrong_type" && storageKey.expectedType && /*#__PURE__*/_jsxs(_Fragment, {
|
|
187
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
188
|
-
style: styles.expandedRow,
|
|
189
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
190
|
-
style: styles.expandedLabel,
|
|
191
|
-
children: "Type:"
|
|
192
|
-
}), /*#__PURE__*/_jsx(TypeBadge, {
|
|
193
|
-
type: getValueTypeLabel(storageKey.value)
|
|
194
|
-
})]
|
|
195
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
196
|
-
style: styles.expandedRow,
|
|
197
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
198
|
-
style: styles.expandedLabel,
|
|
199
|
-
children: "Expected:"
|
|
200
|
-
}), /*#__PURE__*/_jsx(TypeBadge, {
|
|
201
|
-
type: storageKey.expectedType
|
|
202
|
-
})]
|
|
203
|
-
})]
|
|
204
|
-
}), storageKey.status === "required_wrong_value" && storageKey.expectedValue && /*#__PURE__*/_jsxs(View, {
|
|
205
|
-
style: styles.expandedRow,
|
|
206
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
207
|
-
style: styles.expandedLabel,
|
|
208
|
-
children: "Expected:"
|
|
209
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
210
|
-
style: styles.expandedExpected,
|
|
211
|
-
children: String(storageKey.expectedValue)
|
|
212
|
-
})]
|
|
213
|
-
}), storageKey.description ? /*#__PURE__*/_jsxs(View, {
|
|
214
|
-
style: styles.expandedRow,
|
|
215
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
216
|
-
style: styles.expandedLabel,
|
|
217
|
-
children: "Info:"
|
|
218
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
219
|
-
style: styles.expandedDescription,
|
|
220
|
-
children: storageKey.description
|
|
221
|
-
})]
|
|
222
|
-
}) : null, editBlockedReason ? /*#__PURE__*/_jsxs(View, {
|
|
223
|
-
style: styles.expandedRow,
|
|
224
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
225
|
-
style: styles.expandedLabel,
|
|
226
|
-
children: "Edit:"
|
|
227
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
228
|
-
style: styles.expandedDescription,
|
|
229
|
-
children: editBlockedReason
|
|
230
|
-
})]
|
|
231
|
-
}) : null, onTogglePin || onHideKey || canEdit ? /*#__PURE__*/_jsxs(View, {
|
|
232
|
-
style: styles.actionRow,
|
|
233
|
-
children: [canEdit ? /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
234
|
-
style: styles.editButton
|
|
235
|
-
// One handle for both jobs on purpose: this is the card's single
|
|
236
|
-
// "change it" affordance, and which of the two it performs is the
|
|
237
|
-
// key's type, not a different control.
|
|
238
|
-
,
|
|
239
|
-
testID: "buoy-storage-key-edit",
|
|
240
|
-
accessibilityLabel: isBoolean && onToggleKey ? `Toggle ${storageKey.key}` : `Edit ${storageKey.key}`,
|
|
241
|
-
accessibilityRole: "button",
|
|
242
|
-
onPress: () => isBoolean && onToggleKey ? onToggleKey(storageKey) : onEditKey?.(storageKey),
|
|
243
|
-
hitSlop: {
|
|
244
|
-
top: 6,
|
|
245
|
-
bottom: 6,
|
|
246
|
-
left: 6,
|
|
247
|
-
right: 6
|
|
248
|
-
},
|
|
249
|
-
children: [/*#__PURE__*/_jsx(Edit3, {
|
|
250
|
-
size: 13,
|
|
251
|
-
color: night.color.onAccent
|
|
252
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
253
|
-
style: styles.editButtonText,
|
|
254
|
-
children: isBoolean && onToggleKey ? "Toggle" : "Edit"
|
|
255
|
-
})]
|
|
256
|
-
}) : null, onTogglePin ? /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
257
|
-
style: [styles.actionChip, isPinned && styles.actionChipActive],
|
|
258
|
-
testID: "buoy-storage-key-pin",
|
|
259
|
-
accessibilityLabel: isPinned ? `Unpin ${storageKey.key}` : `Pin ${storageKey.key} to top`,
|
|
260
|
-
accessibilityRole: "button",
|
|
261
|
-
onPress: () => onTogglePin(storageKey.key),
|
|
262
|
-
hitSlop: {
|
|
263
|
-
top: 6,
|
|
264
|
-
bottom: 6,
|
|
265
|
-
left: 6,
|
|
266
|
-
right: 6
|
|
267
|
-
},
|
|
268
|
-
children: [/*#__PURE__*/_jsx(Pin, {
|
|
269
|
-
size: 12,
|
|
270
|
-
active: isPinned,
|
|
271
|
-
color: night.color.accent
|
|
272
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
273
|
-
style: [styles.actionChipText, {
|
|
274
|
-
color: night.color.accent
|
|
275
|
-
}],
|
|
276
|
-
children: isPinned ? "Unpin" : "Pin to top"
|
|
277
|
-
})]
|
|
278
|
-
}) : null, onHideKey ? /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
279
|
-
style: styles.actionChip,
|
|
280
|
-
testID: "buoy-storage-key-hide",
|
|
281
|
-
accessibilityLabel: `Hide ${storageKey.key} from list`,
|
|
282
|
-
accessibilityRole: "button",
|
|
283
|
-
onPress: () => onHideKey(storageKey),
|
|
284
|
-
hitSlop: {
|
|
285
|
-
top: 6,
|
|
286
|
-
bottom: 6,
|
|
287
|
-
left: 6,
|
|
288
|
-
right: 6
|
|
289
|
-
},
|
|
290
|
-
children: [/*#__PURE__*/_jsx(EyeOff, {
|
|
291
|
-
size: 12,
|
|
292
|
-
color: night.color.warning
|
|
293
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
294
|
-
style: [styles.actionChipText, {
|
|
295
|
-
color: night.color.warning
|
|
296
|
-
}],
|
|
297
|
-
children: "Hide from list"
|
|
298
|
-
})]
|
|
299
|
-
}) : null, canEdit && onDeleteKey ? /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
300
|
-
style: [styles.actionChip, styles.dangerChip],
|
|
301
|
-
testID: "buoy-storage-key-delete",
|
|
302
|
-
accessibilityLabel: `Delete key ${storageKey.key}`,
|
|
303
|
-
accessibilityRole: "button",
|
|
304
|
-
onPress: () => onDeleteKey(storageKey),
|
|
305
|
-
hitSlop: {
|
|
306
|
-
top: 6,
|
|
307
|
-
bottom: 6,
|
|
308
|
-
left: 6,
|
|
309
|
-
right: 6
|
|
310
|
-
},
|
|
311
|
-
children: [/*#__PURE__*/_jsx(Trash2, {
|
|
312
|
-
size: 12,
|
|
313
|
-
color: night.color.danger
|
|
314
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
315
|
-
style: [styles.actionChipText, {
|
|
316
|
-
color: night.color.danger
|
|
317
|
-
}],
|
|
318
|
-
children: "Delete key"
|
|
319
|
-
})]
|
|
320
|
-
}) : null]
|
|
321
|
-
}) : null]
|
|
322
|
-
});
|
|
323
|
-
|
|
324
|
-
// Handle checkbox press in select mode
|
|
325
|
-
const handleCheckboxPress = () => {
|
|
326
|
-
onSelectionChange?.(storageKey, !isSelected);
|
|
327
|
-
};
|
|
328
|
-
|
|
329
|
-
// Create checkbox element for select mode
|
|
330
|
-
const selectionCheckbox = isSelectMode ? /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
331
|
-
onPress: handleCheckboxPress,
|
|
332
|
-
testID: `buoy-storage-checkbox-${storageKey.storageType}-${storageKey.key}`,
|
|
333
|
-
accessibilityLabel: `Select ${storageKey.key}`,
|
|
334
|
-
accessibilityRole: "checkbox",
|
|
335
|
-
accessibilityState: {
|
|
336
|
-
checked: isSelected
|
|
337
|
-
},
|
|
338
|
-
style: styles.checkboxContainer,
|
|
339
|
-
hitSlop: {
|
|
340
|
-
top: 8,
|
|
341
|
-
bottom: 8,
|
|
342
|
-
left: 8,
|
|
343
|
-
right: 8
|
|
344
|
-
},
|
|
345
|
-
children: isSelected ? /*#__PURE__*/_jsx(CheckSquare, {
|
|
346
|
-
size: 18,
|
|
347
|
-
color: night.color.accent
|
|
348
|
-
}) : /*#__PURE__*/_jsx(Square, {
|
|
349
|
-
size: 18,
|
|
350
|
-
color: night.color.textTertiary
|
|
351
|
-
})
|
|
352
|
-
}) : null;
|
|
353
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
354
|
-
style: [styles.rowContainer, isSelected && styles.rowContainerSelected],
|
|
355
|
-
children: [selectionCheckbox, /*#__PURE__*/_jsxs(View, {
|
|
356
|
-
style: styles.compactRowWrapper,
|
|
357
|
-
children: [/*#__PURE__*/_jsx(CompactRow, {
|
|
358
|
-
statusDotColor: config.color,
|
|
359
|
-
statusLabel: config.label,
|
|
360
|
-
statusSublabel: config.sublabel,
|
|
361
|
-
primaryText: primaryText,
|
|
362
|
-
secondaryText: hasValue ? isBoolean ? getValueTypeLabel(storageKey.value) : getValueTypeWithPreview(storageKey.value) : undefined,
|
|
363
|
-
secondaryAccessory: isBoolean ? /*#__PURE__*/_jsx(PillBadge, {
|
|
364
|
-
size: "sm",
|
|
365
|
-
color: storageKey.value ? macOSColors.semantic.success : macOSColors.semantic.error,
|
|
366
|
-
children: storageKey.value ? "true" : "false"
|
|
367
|
-
}) : undefined,
|
|
368
|
-
expandedContent: expandedContent,
|
|
369
|
-
isExpanded: isExpanded,
|
|
370
|
-
expandedGlowColor: config.color,
|
|
371
|
-
customBadge: /*#__PURE__*/_jsxs(View, {
|
|
372
|
-
style: styles.badgeRow,
|
|
373
|
-
children: [isPinned && /*#__PURE__*/_jsx(Pin, {
|
|
374
|
-
size: 12,
|
|
375
|
-
active: true,
|
|
376
|
-
color: night.color.accent
|
|
377
|
-
}), /*#__PURE__*/_jsx(PillBadge, {
|
|
378
|
-
color: getStorageTypeColor(storageKey.storageType),
|
|
379
|
-
children: storageTypeLabel
|
|
380
|
-
})]
|
|
381
|
-
}),
|
|
382
|
-
showChevron: !isSelectMode,
|
|
383
|
-
onPress: isSelectMode ? handleCheckboxPress : onPress ? () => onPress(storageKey) : undefined,
|
|
384
|
-
testID: `buoy-storage-row-${storageKey.storageType}-${storageKey.key}`,
|
|
385
|
-
accessibilityLabel: `${storageKey.storageType} ${storageKey.key}`
|
|
386
|
-
}), eventCount != null && eventCount > 1 && /*#__PURE__*/_jsx(View, {
|
|
387
|
-
style: [styles.absCountBadge, isExpanded && styles.absCountBadgeExpanded, {
|
|
388
|
-
backgroundColor: macOSColors.semantic.warning + "22",
|
|
389
|
-
borderColor: macOSColors.semantic.warning + "55"
|
|
390
|
-
}],
|
|
391
|
-
pointerEvents: "none",
|
|
392
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
393
|
-
style: [styles.absCountText, {
|
|
394
|
-
color: macOSColors.semantic.warning
|
|
395
|
-
}],
|
|
396
|
-
children: String(eventCount)
|
|
397
|
-
})
|
|
398
|
-
})]
|
|
399
|
-
})]
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
/** Exported for the key DETAIL screen — same reason as getStatusConfig. */
|
|
404
|
-
export const getStorageTypeColor = storageType => {
|
|
405
|
-
switch (storageType) {
|
|
406
|
-
case "mmkv":
|
|
407
|
-
return macOSColors.semantic.info;
|
|
408
|
-
case "async":
|
|
409
|
-
return macOSColors.semantic.warning;
|
|
410
|
-
case "secure":
|
|
411
|
-
return macOSColors.semantic.success;
|
|
412
|
-
default:
|
|
413
|
-
return macOSColors.text.secondary;
|
|
414
|
-
}
|
|
415
|
-
};
|
|
416
|
-
const styles = StyleSheet.create({
|
|
417
|
-
badgeRow: {
|
|
418
|
-
flexDirection: "row",
|
|
419
|
-
alignItems: "center",
|
|
420
|
-
gap: 6
|
|
421
|
-
},
|
|
422
|
-
expandedContainer: {
|
|
423
|
-
gap: 8
|
|
424
|
-
},
|
|
425
|
-
expandedRow: {
|
|
426
|
-
flexDirection: "row",
|
|
427
|
-
alignItems: "center",
|
|
428
|
-
gap: 10
|
|
429
|
-
},
|
|
430
|
-
expandedLabel: {
|
|
431
|
-
fontSize: 10,
|
|
432
|
-
color: night.color.textTertiary,
|
|
433
|
-
fontWeight: "600",
|
|
434
|
-
minWidth: 70,
|
|
435
|
-
fontFamily: monoFont
|
|
436
|
-
},
|
|
437
|
-
expandedValue: {
|
|
438
|
-
fontSize: 11,
|
|
439
|
-
color: night.color.textSecondary,
|
|
440
|
-
fontFamily: monoFont,
|
|
441
|
-
flex: 1
|
|
442
|
-
},
|
|
443
|
-
expandedExpected: {
|
|
444
|
-
fontSize: 11,
|
|
445
|
-
color: macOSColors.semantic.warning,
|
|
446
|
-
fontFamily: monoFont,
|
|
447
|
-
flex: 1
|
|
448
|
-
},
|
|
449
|
-
expandedDescription: {
|
|
450
|
-
fontSize: 11,
|
|
451
|
-
color: night.color.textSecondary,
|
|
452
|
-
flex: 1
|
|
453
|
-
},
|
|
454
|
-
dataViewerContainer: {
|
|
455
|
-
marginTop: 6,
|
|
456
|
-
marginBottom: 6,
|
|
457
|
-
backgroundColor: night.color.bg,
|
|
458
|
-
borderRadius: 6,
|
|
459
|
-
borderWidth: 1,
|
|
460
|
-
borderColor: night.color.border,
|
|
461
|
-
padding: 6
|
|
462
|
-
},
|
|
463
|
-
rowContainer: {
|
|
464
|
-
flexDirection: "row",
|
|
465
|
-
alignItems: "flex-start"
|
|
466
|
-
},
|
|
467
|
-
rowContainerSelected: {
|
|
468
|
-
backgroundColor: night.color.accentSoft,
|
|
469
|
-
borderRadius: 8
|
|
470
|
-
},
|
|
471
|
-
checkboxContainer: {
|
|
472
|
-
paddingLeft: 4,
|
|
473
|
-
paddingRight: 8,
|
|
474
|
-
paddingTop: 10,
|
|
475
|
-
alignSelf: "flex-start"
|
|
476
|
-
},
|
|
477
|
-
compactRowWrapper: {
|
|
478
|
-
flex: 1
|
|
479
|
-
},
|
|
480
|
-
absCountBadge: {
|
|
481
|
-
position: "absolute",
|
|
482
|
-
top: 4,
|
|
483
|
-
right: 10,
|
|
484
|
-
paddingHorizontal: 5,
|
|
485
|
-
paddingVertical: 1,
|
|
486
|
-
borderRadius: 4,
|
|
487
|
-
borderWidth: 1,
|
|
488
|
-
zIndex: 1
|
|
489
|
-
},
|
|
490
|
-
// The expanded CompactRow grows its wrapper margin from 3 to 12, so the
|
|
491
|
-
// badge has to drop with it or it floats above the card border.
|
|
492
|
-
absCountBadgeExpanded: {
|
|
493
|
-
top: 13
|
|
494
|
-
},
|
|
495
|
-
absCountText: {
|
|
496
|
-
fontSize: 9,
|
|
497
|
-
fontWeight: "700",
|
|
498
|
-
fontFamily: monoFont
|
|
499
|
-
},
|
|
500
|
-
actionRow: {
|
|
501
|
-
flexDirection: "row",
|
|
502
|
-
alignItems: "center",
|
|
503
|
-
flexWrap: "wrap",
|
|
504
|
-
gap: 8,
|
|
505
|
-
marginTop: 4
|
|
506
|
-
},
|
|
507
|
-
actionChip: {
|
|
508
|
-
flexDirection: "row",
|
|
509
|
-
alignItems: "center",
|
|
510
|
-
gap: 6,
|
|
511
|
-
paddingVertical: 6,
|
|
512
|
-
paddingHorizontal: 10,
|
|
513
|
-
borderRadius: 6,
|
|
514
|
-
backgroundColor: night.color.surface,
|
|
515
|
-
borderWidth: 1,
|
|
516
|
-
borderColor: night.color.border
|
|
517
|
-
},
|
|
518
|
-
dangerChip: {
|
|
519
|
-
borderColor: night.color.danger + "55"
|
|
520
|
-
},
|
|
521
|
-
actionChipActive: {
|
|
522
|
-
backgroundColor: night.color.accentSoft,
|
|
523
|
-
borderColor: night.color.accentBorderStrong
|
|
524
|
-
},
|
|
525
|
-
/** Filled, and first — the one action in this row that changes anything. */
|
|
526
|
-
editButton: {
|
|
527
|
-
flexDirection: "row",
|
|
528
|
-
alignItems: "center",
|
|
529
|
-
gap: 6,
|
|
530
|
-
paddingVertical: 8,
|
|
531
|
-
paddingHorizontal: 14,
|
|
532
|
-
borderRadius: 8,
|
|
533
|
-
backgroundColor: night.color.accent
|
|
534
|
-
},
|
|
535
|
-
editButtonText: {
|
|
536
|
-
color: night.color.onAccent,
|
|
537
|
-
fontSize: 12,
|
|
538
|
-
fontWeight: "700"
|
|
539
|
-
},
|
|
540
|
-
actionChipText: {
|
|
541
|
-
fontSize: 11,
|
|
542
|
-
fontWeight: "600",
|
|
543
|
-
fontFamily: monoFont
|
|
544
|
-
},
|
|
545
|
-
viewHistoryButton: {
|
|
546
|
-
marginLeft: 4
|
|
547
|
-
},
|
|
548
|
-
viewHistoryText: {
|
|
549
|
-
fontSize: 10,
|
|
550
|
-
fontWeight: "600",
|
|
551
|
-
fontFamily: monoFont,
|
|
552
|
-
color: night.color.accent
|
|
553
|
-
}
|
|
554
|
-
});
|
|
1
|
+
"use strict";import{memo as j}from"react";import{View as a,Text as l,StyleSheet as N,TouchableOpacity as s}from"react-native";import{macOSColors as r,night as n,CompactRow as U,TypeBadge as B,HardDrive as G,Square as J,CheckSquare as M,Edit3 as Q,EyeOff as X,Pin as W,Trash2 as Y,ExpandedInfoRow as I,PillBadge as h,monoFont as p}from"@buoy-gg/shared-ui";import{getStorageTypeLabel as Z}from"../utils/storageQueryUtils";import{getValueTypeLabel as _,getValueTypeWithPreview as K,parseStorageValue as ee}from"../utils/valueType";import{DataViewer as te}from"@buoy-gg/shared-ui/dataViewer";import{jsx as t,jsxs as i,Fragment as oe}from"react/jsx-runtime";const F=[r.semantic.info,r.semantic.success,r.semantic.warning,r.semantic.debug,"#FF6B9D","#00D9FF"];function $(c){const e=c.split("").reduce((f,x)=>f+x.charCodeAt(0),0);return F[e%F.length]}export const getStatusConfig=c=>{switch(c){case"required_present":return{label:"Valid",color:r.semantic.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:r.semantic.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:r.semantic.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:r.semantic.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:r.semantic.debug,sublabel:"Optional"};default:return{label:"Set",color:r.text.secondary,sublabel:String(c)}}};const ne=c=>{if(c===void 0||c===null){return"undefined"}const e=typeof c==="string"?c:JSON.stringify(c);return e};export const StorageKeyRow=j(function c({storageKey:e,isExpanded:f,onPress:x,isSelectMode:w=false,isSelected:m=false,onSelectionChange:q,eventCount:d,onViewHistory:D,onHideKey:C,isPinned:u=false,onTogglePin:S,onEditKey:L,onToggleKey:y,onDeleteKey:z,editBlockedReason:T}){const k=L!=null&&T==null;const g=getStatusConfig(e.status);const v=e.value!==void 0&&e.value!==null;const b=v&&typeof e.value==="boolean";const O=e.key;const V=Z(e.storageType);const R=ee(e.value);const A=R!==null&&typeof R==="object";const H=i(a,{style:o.expandedContainer,children:[t(I,{label:"Storage",children:t(h,{color:getStorageTypeColor(e.storageType),children:V})}),e.storageType==="mmkv"&&e.instanceId&&t(I,{label:"Instance",children:t(h,{color:$(e.instanceId),icon:t(G,{size:9,color:$(e.instanceId)}),children:e.instanceId})}),d!=null&&d>0&&i(I,{label:"Updates",children:[t(h,{color:r.semantic.warning,children:String(d)}),d>1&&D&&t(s,{onPress:D,testID:"buoy-storage-key-history",accessibilityLabel:`View history for ${e.key}`,accessibilityRole:"button",style:o.viewHistoryButton,hitSlop:{top:6,bottom:6,left:6,right:6},children:t(l,{style:o.viewHistoryText,children:"view history \u2192"})})]}),A?t(a,{style:o.dataViewerContainer,children:t(te,{data:R,title:"",showTypeFilter:true,rawMode:true,initialExpanded:true})}):i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Value:"}),t(l,{style:o.expandedValue,numberOfLines:3,children:ne(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&i(oe,{children:[i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Type:"}),t(B,{type:_(e.value)})]}),i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(B,{type:e.expectedType})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Expected:"}),t(l,{style:o.expandedExpected,children:String(e.expectedValue)})]}),e.description?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Info:"}),t(l,{style:o.expandedDescription,children:e.description})]}):null,T?i(a,{style:o.expandedRow,children:[t(l,{style:o.expandedLabel,children:"Edit:"}),t(l,{style:o.expandedDescription,children:T})]}):null,S||C||k?i(a,{style:o.actionRow,children:[k?i(s,{style:o.editButton,testID:"buoy-storage-key-edit",accessibilityLabel:b&&y?`Toggle ${e.key}`:`Edit ${e.key}`,accessibilityRole:"button",onPress:()=>b&&y?y(e):L?.(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Q,{size:13,color:n.color.onAccent}),t(l,{style:o.editButtonText,children:b&&y?"Toggle":"Edit"})]}):null,S?i(s,{style:[o.actionChip,u&&o.actionChipActive],testID:"buoy-storage-key-pin",accessibilityLabel:u?`Unpin ${e.key}`:`Pin ${e.key} to top`,accessibilityRole:"button",onPress:()=>S(e.key),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(W,{size:12,active:u,color:n.color.accent}),t(l,{style:[o.actionChipText,{color:n.color.accent}],children:u?"Unpin":"Pin to top"})]}):null,C?i(s,{style:o.actionChip,testID:"buoy-storage-key-hide",accessibilityLabel:`Hide ${e.key} from list`,accessibilityRole:"button",onPress:()=>C(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(X,{size:12,color:n.color.warning}),t(l,{style:[o.actionChipText,{color:n.color.warning}],children:"Hide from list"})]}):null,k&&z?i(s,{style:[o.actionChip,o.dangerChip],testID:"buoy-storage-key-delete",accessibilityLabel:`Delete key ${e.key}`,accessibilityRole:"button",onPress:()=>z(e),hitSlop:{top:6,bottom:6,left:6,right:6},children:[t(Y,{size:12,color:n.color.danger}),t(l,{style:[o.actionChipText,{color:n.color.danger}],children:"Delete key"})]}):null]}):null]});const E=()=>{q?.(e,!m)};const P=w?t(s,{onPress:E,testID:`buoy-storage-checkbox-${e.storageType}-${e.key}`,accessibilityLabel:`Select ${e.key}`,accessibilityRole:"checkbox",accessibilityState:{checked:m},style:o.checkboxContainer,hitSlop:{top:8,bottom:8,left:8,right:8},children:m?t(M,{size:18,color:n.color.accent}):t(J,{size:18,color:n.color.textTertiary})}):null;return i(a,{style:[o.rowContainer,m&&o.rowContainerSelected],children:[P,i(a,{style:o.compactRowWrapper,children:[t(U,{statusDotColor:g.color,statusLabel:g.label,statusSublabel:g.sublabel,primaryText:O,secondaryText:v?b?_(e.value):K(e.value):void 0,secondaryAccessory:b?t(h,{size:"sm",color:e.value?r.semantic.success:r.semantic.error,children:e.value?"true":"false"}):void 0,expandedContent:H,isExpanded:f,expandedGlowColor:g.color,customBadge:i(a,{style:o.badgeRow,children:[u&&t(W,{size:12,active:true,color:n.color.accent}),t(h,{color:getStorageTypeColor(e.storageType),children:V})]}),showChevron:!w,onPress:w?E:x?()=>x(e):void 0,testID:`buoy-storage-row-${e.storageType}-${e.key}`,accessibilityLabel:`${e.storageType} ${e.key}`}),d!=null&&d>1&&t(a,{style:[o.absCountBadge,f&&o.absCountBadgeExpanded,{backgroundColor:r.semantic.warning+"22",borderColor:r.semantic.warning+"55"}],pointerEvents:"none",children:t(l,{style:[o.absCountText,{color:r.semantic.warning}],children:String(d)})})]})]})});export const getStorageTypeColor=c=>{switch(c){case"mmkv":return r.semantic.info;case"async":return r.semantic.warning;case"secure":return r.semantic.success;default:return r.text.secondary}};const o=N.create({badgeRow:{flexDirection:"row",alignItems:"center",gap:6},expandedContainer:{gap:8},expandedRow:{flexDirection:"row",alignItems:"center",gap:10},expandedLabel:{fontSize:10,color:n.color.textTertiary,fontWeight:"600",minWidth:70,fontFamily:p},expandedValue:{fontSize:11,color:n.color.textSecondary,fontFamily:p,flex:1},expandedExpected:{fontSize:11,color:r.semantic.warning,fontFamily:p,flex:1},expandedDescription:{fontSize:11,color:n.color.textSecondary,flex:1},dataViewerContainer:{marginTop:6,marginBottom:6,backgroundColor:n.color.bg,borderRadius:6,borderWidth:1,borderColor:n.color.border,padding:6},rowContainer:{flexDirection:"row",alignItems:"flex-start"},rowContainerSelected:{backgroundColor:n.color.accentSoft,borderRadius:8},checkboxContainer:{paddingLeft:4,paddingRight:8,paddingTop:10,alignSelf:"flex-start"},compactRowWrapper:{flex:1},absCountBadge:{position:"absolute",top:4,right:10,paddingHorizontal:5,paddingVertical:1,borderRadius:4,borderWidth:1,zIndex:1},absCountBadgeExpanded:{top:13},absCountText:{fontSize:9,fontWeight:"700",fontFamily:p},actionRow:{flexDirection:"row",alignItems:"center",flexWrap:"wrap",gap:8,marginTop:4},actionChip:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:6,paddingHorizontal:10,borderRadius:6,backgroundColor:n.color.surface,borderWidth:1,borderColor:n.color.border},dangerChip:{borderColor:n.color.danger+"55"},actionChipActive:{backgroundColor:n.color.accentSoft,borderColor:n.color.accentBorderStrong},editButton:{flexDirection:"row",alignItems:"center",gap:6,paddingVertical:8,paddingHorizontal:14,borderRadius:8,backgroundColor:n.color.accent},editButtonText:{color:n.color.onAccent,fontSize:12,fontWeight:"700"},actionChipText:{fontSize:11,fontWeight:"600",fontFamily:p},viewHistoryButton:{marginLeft:4},viewHistoryText:{fontSize:10,fontWeight:"600",fontFamily:p,color:n.color.accent}});
|