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