@buoy-gg/storage 1.7.2
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 +607 -0
- package/lib/commonjs/index.js +34 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/preset.js +94 -0
- package/lib/commonjs/storage/components/DiffViewer/DiffOptionsPanel.js +356 -0
- package/lib/commonjs/storage/components/DiffViewer/TreeDiffViewer.js +29 -0
- package/lib/commonjs/storage/components/DiffViewer/components/DiffSummary.js +121 -0
- package/lib/commonjs/storage/components/DiffViewer/modes/ThemedSplitView.js +419 -0
- package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +122 -0
- package/lib/commonjs/storage/components/GameUIStorageBrowser.js +924 -0
- package/lib/commonjs/storage/components/GameUIStorageStats.js +746 -0
- package/lib/commonjs/storage/components/MMKVInstanceInfoPanel.js +257 -0
- package/lib/commonjs/storage/components/MMKVInstanceSelector.js +418 -0
- package/lib/commonjs/storage/components/SelectionActionBar.js +224 -0
- package/lib/commonjs/storage/components/StorageActionButtons.js +239 -0
- package/lib/commonjs/storage/components/StorageActions.js +192 -0
- package/lib/commonjs/storage/components/StorageBrowserMode.js +31 -0
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +1025 -0
- package/lib/commonjs/storage/components/StorageEventFilterView.js +141 -0
- package/lib/commonjs/storage/components/StorageEventListener.js +357 -0
- package/lib/commonjs/storage/components/StorageEventsSection.js +24 -0
- package/lib/commonjs/storage/components/StorageFilterCards.js +345 -0
- package/lib/commonjs/storage/components/StorageFilterViewV2.js +42 -0
- package/lib/commonjs/storage/components/StorageKeyCard.js +516 -0
- package/lib/commonjs/storage/components/StorageKeyRow.js +356 -0
- package/lib/commonjs/storage/components/StorageKeySection.js +105 -0
- package/lib/commonjs/storage/components/StorageKeyStats.js +344 -0
- package/lib/commonjs/storage/components/StorageModalWithTabs.js +871 -0
- package/lib/commonjs/storage/components/StorageSection.js +43 -0
- package/lib/commonjs/storage/hooks/useAsyncStorageKeys.js +126 -0
- package/lib/commonjs/storage/hooks/useMMKVInstances.js +221 -0
- package/lib/commonjs/storage/hooks/useMMKVKeys.js +362 -0
- package/lib/commonjs/storage/hooks/useTickEverySecond.js +21 -0
- package/lib/commonjs/storage/index.js +148 -0
- package/lib/commonjs/storage/types.js +5 -0
- package/lib/commonjs/storage/utils/AsyncStorageListener.js +510 -0
- package/lib/commonjs/storage/utils/MMKVInstanceRegistry.js +202 -0
- package/lib/commonjs/storage/utils/MMKVListener.js +380 -0
- package/lib/commonjs/storage/utils/clearAllStorage.js +47 -0
- package/lib/commonjs/storage/utils/index.js +180 -0
- package/lib/commonjs/storage/utils/lineDiff.js +363 -0
- package/lib/commonjs/storage/utils/mmkvAvailability.js +62 -0
- package/lib/commonjs/storage/utils/mmkvTypeDetection.js +139 -0
- package/lib/commonjs/storage/utils/objectDiff.js +157 -0
- package/lib/commonjs/storage/utils/safeAsyncStorage.js +140 -0
- package/lib/commonjs/storage/utils/storageActionHelpers.js +46 -0
- package/lib/commonjs/storage/utils/storageQueryUtils.js +35 -0
- package/lib/commonjs/storage/utils/valueType.js +18 -0
- package/lib/module/index.js +7 -0
- package/lib/module/preset.js +89 -0
- package/lib/module/storage/components/DiffViewer/DiffOptionsPanel.js +352 -0
- package/lib/module/storage/components/DiffViewer/TreeDiffViewer.js +25 -0
- package/lib/module/storage/components/DiffViewer/components/DiffSummary.js +117 -0
- package/lib/module/storage/components/DiffViewer/modes/ThemedSplitView.js +415 -0
- package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +118 -0
- package/lib/module/storage/components/GameUIStorageBrowser.js +922 -0
- package/lib/module/storage/components/GameUIStorageStats.js +742 -0
- package/lib/module/storage/components/MMKVInstanceInfoPanel.js +253 -0
- package/lib/module/storage/components/MMKVInstanceSelector.js +414 -0
- package/lib/module/storage/components/SelectionActionBar.js +221 -0
- package/lib/module/storage/components/StorageActionButtons.js +236 -0
- package/lib/module/storage/components/StorageActions.js +189 -0
- package/lib/module/storage/components/StorageBrowserMode.js +27 -0
- package/lib/module/storage/components/StorageEventDetailContent.js +1020 -0
- package/lib/module/storage/components/StorageEventFilterView.js +137 -0
- package/lib/module/storage/components/StorageEventListener.js +354 -0
- package/lib/module/storage/components/StorageEventsSection.js +20 -0
- package/lib/module/storage/components/StorageFilterCards.js +341 -0
- package/lib/module/storage/components/StorageFilterViewV2.js +38 -0
- package/lib/module/storage/components/StorageKeyCard.js +513 -0
- package/lib/module/storage/components/StorageKeyRow.js +353 -0
- package/lib/module/storage/components/StorageKeySection.js +101 -0
- package/lib/module/storage/components/StorageKeyStats.js +340 -0
- package/lib/module/storage/components/StorageModalWithTabs.js +867 -0
- package/lib/module/storage/components/StorageSection.js +40 -0
- package/lib/module/storage/hooks/useAsyncStorageKeys.js +121 -0
- package/lib/module/storage/hooks/useMMKVInstances.js +216 -0
- package/lib/module/storage/hooks/useMMKVKeys.js +359 -0
- package/lib/module/storage/hooks/useTickEverySecond.js +18 -0
- package/lib/module/storage/index.js +25 -0
- package/lib/module/storage/types.js +3 -0
- package/lib/module/storage/utils/AsyncStorageListener.js +500 -0
- package/lib/module/storage/utils/MMKVInstanceRegistry.js +196 -0
- package/lib/module/storage/utils/MMKVListener.js +367 -0
- package/lib/module/storage/utils/clearAllStorage.js +42 -0
- package/lib/module/storage/utils/index.js +22 -0
- package/lib/module/storage/utils/lineDiff.js +359 -0
- package/lib/module/storage/utils/mmkvAvailability.js +56 -0
- package/lib/module/storage/utils/mmkvTypeDetection.js +133 -0
- package/lib/module/storage/utils/objectDiff.js +153 -0
- package/lib/module/storage/utils/safeAsyncStorage.js +134 -0
- package/lib/module/storage/utils/storageActionHelpers.js +42 -0
- package/lib/module/storage/utils/storageQueryUtils.js +30 -0
- package/lib/module/storage/utils/valueType.js +14 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts +90 -0
- package/lib/typescript/preset.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts +18 -0
- package/lib/typescript/storage/components/DiffViewer/DiffOptionsPanel.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts +7 -0
- package/lib/typescript/storage/components/DiffViewer/TreeDiffViewer.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts +12 -0
- package/lib/typescript/storage/components/DiffViewer/components/DiffSummary.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts +13 -0
- package/lib/typescript/storage/components/DiffViewer/modes/ThemedSplitView.d.ts.map +1 -0
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts +64 -0
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +1 -0
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts +16 -0
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -0
- package/lib/typescript/storage/components/GameUIStorageStats.d.ts +7 -0
- package/lib/typescript/storage/components/GameUIStorageStats.d.ts.map +1 -0
- package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts +42 -0
- package/lib/typescript/storage/components/MMKVInstanceInfoPanel.d.ts.map +1 -0
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts +35 -0
- package/lib/typescript/storage/components/MMKVInstanceSelector.d.ts.map +1 -0
- package/lib/typescript/storage/components/SelectionActionBar.d.ts +21 -0
- package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageActionButtons.d.ts +21 -0
- package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageActions.d.ts +10 -0
- package/lib/typescript/storage/components/StorageActions.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageBrowserMode.d.ts +18 -0
- package/lib/typescript/storage/components/StorageBrowserMode.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts +40 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventFilterView.d.ts +11 -0
- package/lib/typescript/storage/components/StorageEventFilterView.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventListener.d.ts +6 -0
- package/lib/typescript/storage/components/StorageEventListener.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventsSection.d.ts +7 -0
- package/lib/typescript/storage/components/StorageEventsSection.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageFilterCards.d.ts +36 -0
- package/lib/typescript/storage/components/StorageFilterCards.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageFilterViewV2.d.ts +9 -0
- package/lib/typescript/storage/components/StorageFilterViewV2.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyCard.d.ts +17 -0
- package/lib/typescript/storage/components/StorageKeyCard.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyRow.d.ts +15 -0
- package/lib/typescript/storage/components/StorageKeyRow.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeySection.d.ts +25 -0
- package/lib/typescript/storage/components/StorageKeySection.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageKeyStats.d.ts +15 -0
- package/lib/typescript/storage/components/StorageKeyStats.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts +13 -0
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageSection.d.ts +10 -0
- package/lib/typescript/storage/components/StorageSection.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts +10 -0
- package/lib/typescript/storage/hooks/useAsyncStorageKeys.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useMMKVInstances.d.ts +114 -0
- package/lib/typescript/storage/hooks/useMMKVInstances.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useMMKVKeys.d.ts +94 -0
- package/lib/typescript/storage/hooks/useMMKVKeys.d.ts.map +1 -0
- package/lib/typescript/storage/hooks/useTickEverySecond.d.ts +6 -0
- package/lib/typescript/storage/hooks/useTickEverySecond.d.ts.map +1 -0
- package/lib/typescript/storage/index.d.ts +15 -0
- package/lib/typescript/storage/index.d.ts.map +1 -0
- package/lib/typescript/storage/types.d.ts +41 -0
- package/lib/typescript/storage/types.d.ts.map +1 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts +195 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +1 -0
- package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts +224 -0
- package/lib/typescript/storage/utils/MMKVInstanceRegistry.d.ts.map +1 -0
- package/lib/typescript/storage/utils/MMKVListener.d.ts +218 -0
- package/lib/typescript/storage/utils/MMKVListener.d.ts.map +1 -0
- package/lib/typescript/storage/utils/clearAllStorage.d.ts +11 -0
- package/lib/typescript/storage/utils/clearAllStorage.d.ts.map +1 -0
- package/lib/typescript/storage/utils/index.d.ts +8 -0
- package/lib/typescript/storage/utils/index.d.ts.map +1 -0
- package/lib/typescript/storage/utils/lineDiff.d.ts +34 -0
- package/lib/typescript/storage/utils/lineDiff.d.ts.map +1 -0
- package/lib/typescript/storage/utils/mmkvAvailability.d.ts +23 -0
- package/lib/typescript/storage/utils/mmkvAvailability.d.ts.map +1 -0
- package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts +71 -0
- package/lib/typescript/storage/utils/mmkvTypeDetection.d.ts.map +1 -0
- package/lib/typescript/storage/utils/objectDiff.d.ts +35 -0
- package/lib/typescript/storage/utils/objectDiff.d.ts.map +1 -0
- package/lib/typescript/storage/utils/safeAsyncStorage.d.ts +56 -0
- package/lib/typescript/storage/utils/safeAsyncStorage.d.ts.map +1 -0
- package/lib/typescript/storage/utils/storageActionHelpers.d.ts +5 -0
- package/lib/typescript/storage/utils/storageActionHelpers.d.ts.map +1 -0
- package/lib/typescript/storage/utils/storageQueryUtils.d.ts +6 -0
- package/lib/typescript/storage/utils/storageQueryUtils.d.ts.map +1 -0
- package/lib/typescript/storage/utils/valueType.d.ts +3 -0
- package/lib/typescript/storage/utils/valueType.d.ts.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StorageKeyRow = StorageKeyRow;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
+
var _storageQueryUtils = require("../utils/storageQueryUtils");
|
|
10
|
+
var _valueType = require("../utils/valueType");
|
|
11
|
+
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
// MMKV Instance color palette - consistent colors per instance
|
|
14
|
+
const INSTANCE_COLORS = [_sharedUi.macOSColors.semantic.info,
|
|
15
|
+
// Blue
|
|
16
|
+
_sharedUi.macOSColors.semantic.success,
|
|
17
|
+
// Green
|
|
18
|
+
_sharedUi.macOSColors.semantic.warning,
|
|
19
|
+
// Orange
|
|
20
|
+
_sharedUi.macOSColors.semantic.debug,
|
|
21
|
+
// Purple
|
|
22
|
+
'#FF6B9D',
|
|
23
|
+
// Pink
|
|
24
|
+
'#00D9FF' // Cyan
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get consistent color for an MMKV instance based on its ID
|
|
29
|
+
* Uses simple hash to ensure same instance always gets same color
|
|
30
|
+
*/
|
|
31
|
+
function getInstanceColor(instanceId) {
|
|
32
|
+
const hash = instanceId.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
33
|
+
return INSTANCE_COLORS[hash % INSTANCE_COLORS.length];
|
|
34
|
+
}
|
|
35
|
+
const getStatusConfig = status => {
|
|
36
|
+
switch (status) {
|
|
37
|
+
case "required_present":
|
|
38
|
+
return {
|
|
39
|
+
label: "Valid",
|
|
40
|
+
color: _sharedUi.macOSColors.semantic.success,
|
|
41
|
+
sublabel: "Required"
|
|
42
|
+
};
|
|
43
|
+
case "required_missing":
|
|
44
|
+
return {
|
|
45
|
+
label: "Missing",
|
|
46
|
+
color: _sharedUi.macOSColors.semantic.error,
|
|
47
|
+
sublabel: "Required"
|
|
48
|
+
};
|
|
49
|
+
case "required_wrong_value":
|
|
50
|
+
return {
|
|
51
|
+
label: "Wrong",
|
|
52
|
+
color: _sharedUi.macOSColors.semantic.warning,
|
|
53
|
+
sublabel: "Invalid value"
|
|
54
|
+
};
|
|
55
|
+
case "required_wrong_type":
|
|
56
|
+
return {
|
|
57
|
+
label: "Type Error",
|
|
58
|
+
color: _sharedUi.macOSColors.semantic.info,
|
|
59
|
+
sublabel: "Wrong type"
|
|
60
|
+
};
|
|
61
|
+
case "optional_present":
|
|
62
|
+
return {
|
|
63
|
+
label: "Set",
|
|
64
|
+
color: _sharedUi.macOSColors.semantic.debug,
|
|
65
|
+
sublabel: "Optional"
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const formatValue = value => {
|
|
70
|
+
if (value === undefined || value === null) {
|
|
71
|
+
return "undefined";
|
|
72
|
+
}
|
|
73
|
+
const str = typeof value === "string" ? value : JSON.stringify(value);
|
|
74
|
+
return str;
|
|
75
|
+
};
|
|
76
|
+
function StorageKeyRow({
|
|
77
|
+
storageKey,
|
|
78
|
+
isExpanded,
|
|
79
|
+
onPress,
|
|
80
|
+
isSelectMode = false,
|
|
81
|
+
isSelected = false,
|
|
82
|
+
onSelectionChange
|
|
83
|
+
}) {
|
|
84
|
+
const config = getStatusConfig(storageKey.status);
|
|
85
|
+
const hasValue = storageKey.value !== undefined && storageKey.value !== null;
|
|
86
|
+
|
|
87
|
+
// Format primary text - show the key
|
|
88
|
+
const primaryText = storageKey.key;
|
|
89
|
+
|
|
90
|
+
// Show storage type as secondary text
|
|
91
|
+
const storageTypeLabel = (0, _storageQueryUtils.getStorageTypeLabel)(storageKey.storageType);
|
|
92
|
+
|
|
93
|
+
// Check if value is JSON object/array for DataViewer
|
|
94
|
+
const isJsonData = storageKey.value && (typeof storageKey.value === "object" || typeof storageKey.value === "string" && (storageKey.value.startsWith("{") || storageKey.value.startsWith("[")));
|
|
95
|
+
|
|
96
|
+
// Parse JSON string if needed
|
|
97
|
+
let parsedValue = storageKey.value;
|
|
98
|
+
if (typeof storageKey.value === "string" && isJsonData) {
|
|
99
|
+
try {
|
|
100
|
+
parsedValue = JSON.parse(storageKey.value);
|
|
101
|
+
} catch {
|
|
102
|
+
// Keep original if parse fails
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Create expanded content for value and storage details
|
|
107
|
+
const expandedContent = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
108
|
+
style: styles.expandedContainer,
|
|
109
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
110
|
+
style: styles.expandedRow,
|
|
111
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
112
|
+
style: styles.expandedLabel,
|
|
113
|
+
children: "Storage:"
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
115
|
+
style: [styles.storageBadge, {
|
|
116
|
+
backgroundColor: getStorageTypeColor(storageKey.storageType) + "12",
|
|
117
|
+
borderColor: getStorageTypeColor(storageKey.storageType) + "25"
|
|
118
|
+
}],
|
|
119
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
120
|
+
style: [styles.storageBadgeText, {
|
|
121
|
+
color: getStorageTypeColor(storageKey.storageType)
|
|
122
|
+
}],
|
|
123
|
+
children: storageTypeLabel
|
|
124
|
+
})
|
|
125
|
+
})]
|
|
126
|
+
}), storageKey.storageType === 'mmkv' && storageKey.instanceId && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
127
|
+
style: styles.expandedRow,
|
|
128
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
129
|
+
style: styles.expandedLabel,
|
|
130
|
+
children: "Instance:"
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
132
|
+
style: [styles.instanceBadge, {
|
|
133
|
+
backgroundColor: getInstanceColor(storageKey.instanceId) + '20',
|
|
134
|
+
borderColor: getInstanceColor(storageKey.instanceId) + '40'
|
|
135
|
+
}],
|
|
136
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.HardDrive, {
|
|
137
|
+
size: 9,
|
|
138
|
+
color: getInstanceColor(storageKey.instanceId)
|
|
139
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
140
|
+
style: [styles.instanceText, {
|
|
141
|
+
color: getInstanceColor(storageKey.instanceId)
|
|
142
|
+
}],
|
|
143
|
+
children: storageKey.instanceId
|
|
144
|
+
})]
|
|
145
|
+
})]
|
|
146
|
+
}), isJsonData && typeof parsedValue === "object" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
147
|
+
style: styles.dataViewerContainer,
|
|
148
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
149
|
+
data: parsedValue,
|
|
150
|
+
title: "Value"
|
|
151
|
+
})
|
|
152
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
153
|
+
style: styles.expandedRow,
|
|
154
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
155
|
+
style: styles.expandedLabel,
|
|
156
|
+
children: "Value:"
|
|
157
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
158
|
+
style: styles.expandedValue,
|
|
159
|
+
numberOfLines: 3,
|
|
160
|
+
children: formatValue(storageKey.value) || "undefined"
|
|
161
|
+
})]
|
|
162
|
+
}), storageKey.status === "required_wrong_type" && storageKey.expectedType && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
163
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
164
|
+
style: styles.expandedRow,
|
|
165
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
166
|
+
style: styles.expandedLabel,
|
|
167
|
+
children: "Type:"
|
|
168
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.TypeBadge, {
|
|
169
|
+
type: (0, _valueType.getValueTypeLabel)(storageKey.value)
|
|
170
|
+
})]
|
|
171
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
172
|
+
style: styles.expandedRow,
|
|
173
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
174
|
+
style: styles.expandedLabel,
|
|
175
|
+
children: "Expected:"
|
|
176
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.TypeBadge, {
|
|
177
|
+
type: storageKey.expectedType
|
|
178
|
+
})]
|
|
179
|
+
})]
|
|
180
|
+
}), storageKey.status === "required_wrong_value" && storageKey.expectedValue && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
181
|
+
style: styles.expandedRow,
|
|
182
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
183
|
+
style: styles.expandedLabel,
|
|
184
|
+
children: "Expected:"
|
|
185
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
186
|
+
style: styles.expandedExpected,
|
|
187
|
+
children: String(storageKey.expectedValue)
|
|
188
|
+
})]
|
|
189
|
+
}), storageKey.description && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
190
|
+
style: styles.expandedRow,
|
|
191
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
192
|
+
style: styles.expandedLabel,
|
|
193
|
+
children: "Info:"
|
|
194
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
195
|
+
style: styles.expandedDescription,
|
|
196
|
+
children: storageKey.description
|
|
197
|
+
})]
|
|
198
|
+
})]
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// Create storage type badge
|
|
202
|
+
const storageBadge = /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
203
|
+
style: [styles.storageBadge, {
|
|
204
|
+
backgroundColor: getStorageTypeColor(storageKey.storageType) + "12",
|
|
205
|
+
borderColor: getStorageTypeColor(storageKey.storageType) + "25"
|
|
206
|
+
}],
|
|
207
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
208
|
+
style: [styles.storageBadgeText, {
|
|
209
|
+
color: getStorageTypeColor(storageKey.storageType)
|
|
210
|
+
}],
|
|
211
|
+
children: storageTypeLabel
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
// Handle checkbox press in select mode
|
|
216
|
+
const handleCheckboxPress = () => {
|
|
217
|
+
onSelectionChange?.(storageKey, !isSelected);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Create checkbox element for select mode
|
|
221
|
+
const selectionCheckbox = isSelectMode ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
222
|
+
onPress: handleCheckboxPress,
|
|
223
|
+
style: styles.checkboxContainer,
|
|
224
|
+
hitSlop: {
|
|
225
|
+
top: 8,
|
|
226
|
+
bottom: 8,
|
|
227
|
+
left: 8,
|
|
228
|
+
right: 8
|
|
229
|
+
},
|
|
230
|
+
children: isSelected ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CheckSquare, {
|
|
231
|
+
size: 18,
|
|
232
|
+
color: _sharedUi.macOSColors.semantic.info
|
|
233
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Square, {
|
|
234
|
+
size: 18,
|
|
235
|
+
color: _sharedUi.macOSColors.text.muted
|
|
236
|
+
})
|
|
237
|
+
}) : null;
|
|
238
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
239
|
+
style: [styles.rowContainer, isSelected && styles.rowContainerSelected],
|
|
240
|
+
children: [selectionCheckbox, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
241
|
+
style: styles.compactRowWrapper,
|
|
242
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompactRow, {
|
|
243
|
+
statusDotColor: config.color,
|
|
244
|
+
statusLabel: config.label,
|
|
245
|
+
statusSublabel: config.sublabel,
|
|
246
|
+
primaryText: primaryText,
|
|
247
|
+
secondaryText: hasValue ? (0, _valueType.getValueTypeLabel)(storageKey.value) : undefined,
|
|
248
|
+
expandedContent: expandedContent,
|
|
249
|
+
isExpanded: isExpanded,
|
|
250
|
+
expandedGlowColor: config.color,
|
|
251
|
+
customBadge: storageBadge,
|
|
252
|
+
showChevron: !isSelectMode,
|
|
253
|
+
onPress: isSelectMode ? handleCheckboxPress : onPress ? () => onPress(storageKey) : undefined
|
|
254
|
+
})
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
const getStorageTypeColor = storageType => {
|
|
259
|
+
switch (storageType) {
|
|
260
|
+
case "mmkv":
|
|
261
|
+
return _sharedUi.macOSColors.semantic.info;
|
|
262
|
+
case "async":
|
|
263
|
+
return _sharedUi.macOSColors.semantic.warning;
|
|
264
|
+
case "secure":
|
|
265
|
+
return _sharedUi.macOSColors.semantic.success;
|
|
266
|
+
default:
|
|
267
|
+
return _sharedUi.macOSColors.text.secondary;
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
const styles = _reactNative.StyleSheet.create({
|
|
271
|
+
expandedContainer: {
|
|
272
|
+
gap: 8
|
|
273
|
+
},
|
|
274
|
+
expandedRow: {
|
|
275
|
+
flexDirection: "row",
|
|
276
|
+
alignItems: "center",
|
|
277
|
+
gap: 10
|
|
278
|
+
},
|
|
279
|
+
expandedLabel: {
|
|
280
|
+
fontSize: 10,
|
|
281
|
+
color: _sharedUi.macOSColors.text.muted,
|
|
282
|
+
fontWeight: "600",
|
|
283
|
+
minWidth: 70,
|
|
284
|
+
fontFamily: "monospace"
|
|
285
|
+
},
|
|
286
|
+
expandedValue: {
|
|
287
|
+
fontSize: 11,
|
|
288
|
+
color: _sharedUi.macOSColors.text.secondary,
|
|
289
|
+
fontFamily: "monospace",
|
|
290
|
+
flex: 1
|
|
291
|
+
},
|
|
292
|
+
expandedExpected: {
|
|
293
|
+
fontSize: 11,
|
|
294
|
+
color: _sharedUi.macOSColors.semantic.warning,
|
|
295
|
+
fontFamily: "monospace",
|
|
296
|
+
flex: 1
|
|
297
|
+
},
|
|
298
|
+
expandedDescription: {
|
|
299
|
+
fontSize: 11,
|
|
300
|
+
color: _sharedUi.macOSColors.text.secondary,
|
|
301
|
+
flex: 1
|
|
302
|
+
},
|
|
303
|
+
dataViewerContainer: {
|
|
304
|
+
marginTop: 6,
|
|
305
|
+
marginBottom: 6,
|
|
306
|
+
backgroundColor: _sharedUi.macOSColors.background.base,
|
|
307
|
+
borderRadius: 6,
|
|
308
|
+
borderWidth: 1,
|
|
309
|
+
borderColor: _sharedUi.macOSColors.border.default,
|
|
310
|
+
padding: 6
|
|
311
|
+
},
|
|
312
|
+
storageBadge: {
|
|
313
|
+
paddingHorizontal: 8,
|
|
314
|
+
paddingVertical: 3,
|
|
315
|
+
borderRadius: 999,
|
|
316
|
+
borderWidth: 1
|
|
317
|
+
},
|
|
318
|
+
storageBadgeText: {
|
|
319
|
+
fontSize: 10,
|
|
320
|
+
fontWeight: "700",
|
|
321
|
+
fontFamily: "monospace",
|
|
322
|
+
letterSpacing: 0.5
|
|
323
|
+
},
|
|
324
|
+
instanceBadge: {
|
|
325
|
+
paddingHorizontal: 8,
|
|
326
|
+
paddingVertical: 3,
|
|
327
|
+
borderRadius: 999,
|
|
328
|
+
borderWidth: 1,
|
|
329
|
+
flexDirection: 'row',
|
|
330
|
+
alignItems: 'center',
|
|
331
|
+
gap: 4
|
|
332
|
+
},
|
|
333
|
+
instanceText: {
|
|
334
|
+
fontSize: 10,
|
|
335
|
+
fontWeight: "700",
|
|
336
|
+
fontFamily: "monospace",
|
|
337
|
+
letterSpacing: 0.3
|
|
338
|
+
},
|
|
339
|
+
rowContainer: {
|
|
340
|
+
flexDirection: "row",
|
|
341
|
+
alignItems: "flex-start"
|
|
342
|
+
},
|
|
343
|
+
rowContainerSelected: {
|
|
344
|
+
backgroundColor: _sharedUi.macOSColors.semantic.info + "08",
|
|
345
|
+
borderRadius: 8
|
|
346
|
+
},
|
|
347
|
+
checkboxContainer: {
|
|
348
|
+
paddingLeft: 4,
|
|
349
|
+
paddingRight: 8,
|
|
350
|
+
paddingTop: 10,
|
|
351
|
+
alignSelf: "flex-start"
|
|
352
|
+
},
|
|
353
|
+
compactRowWrapper: {
|
|
354
|
+
flex: 1
|
|
355
|
+
}
|
|
356
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StorageKeySection = StorageKeySection;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _StorageKeyRow = require("./StorageKeyRow");
|
|
10
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* Storage key section component following composition principles [[rule3]]
|
|
14
|
+
*
|
|
15
|
+
* Applied principles:
|
|
16
|
+
* - Decompose by Responsibility: Single purpose component for grouped storage keys
|
|
17
|
+
* - Prefer Composition over Configuration: Reuses patterns from EnvVarSection
|
|
18
|
+
* - Extract Reusable Logic: Shares expansion state management pattern
|
|
19
|
+
*/
|
|
20
|
+
function StorageKeySection({
|
|
21
|
+
title,
|
|
22
|
+
count,
|
|
23
|
+
keys,
|
|
24
|
+
emptyMessage,
|
|
25
|
+
headerColor,
|
|
26
|
+
isSelectMode = false,
|
|
27
|
+
selectedKeys = new Set(),
|
|
28
|
+
onSelectionChange
|
|
29
|
+
}) {
|
|
30
|
+
const [expandedKey, setExpandedKey] = (0, _react.useState)(null);
|
|
31
|
+
const handleKeyPress = (0, _react.useCallback)(storageKey => {
|
|
32
|
+
setExpandedKey(prev => prev === storageKey.key ? null : storageKey.key);
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
// Generate unique identifier for a storage key
|
|
36
|
+
const getKeyIdentifier = (0, _react.useCallback)(storageKey => {
|
|
37
|
+
return storageKey.instanceId ? `${storageKey.storageType}-${storageKey.instanceId}-${storageKey.key}` : `${storageKey.storageType}-${storageKey.key}`;
|
|
38
|
+
}, []);
|
|
39
|
+
if (keys.length === 0 && title === "Required Keys") {
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
41
|
+
style: styles.sectionContainer,
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
43
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
44
|
+
children: title
|
|
45
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge, {
|
|
46
|
+
count: 0,
|
|
47
|
+
color: headerColor
|
|
48
|
+
})]
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
50
|
+
style: styles.emptySection,
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
52
|
+
style: styles.emptySectionText,
|
|
53
|
+
children: emptyMessage
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (keys.length === 0) return null;
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
60
|
+
style: styles.sectionContainer,
|
|
61
|
+
children: [title && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_sharedUi.SectionHeader, {
|
|
62
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Title, {
|
|
63
|
+
children: title
|
|
64
|
+
}), count >= 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.SectionHeader.Badge, {
|
|
65
|
+
count: count,
|
|
66
|
+
color: headerColor
|
|
67
|
+
})]
|
|
68
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
69
|
+
style: styles.sectionContent,
|
|
70
|
+
children: keys.map(storageKey => {
|
|
71
|
+
// Create unique key by combining storage type, instance ID (if present), and key name
|
|
72
|
+
const uniqueKey = getKeyIdentifier(storageKey);
|
|
73
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_StorageKeyRow.StorageKeyRow, {
|
|
74
|
+
storageKey: storageKey,
|
|
75
|
+
isExpanded: !isSelectMode && expandedKey === storageKey.key,
|
|
76
|
+
onPress: handleKeyPress,
|
|
77
|
+
isSelectMode: isSelectMode,
|
|
78
|
+
isSelected: selectedKeys.has(uniqueKey),
|
|
79
|
+
onSelectionChange: onSelectionChange
|
|
80
|
+
}, uniqueKey);
|
|
81
|
+
})
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
const styles = _reactNative.StyleSheet.create({
|
|
86
|
+
sectionContainer: {
|
|
87
|
+
gap: 8
|
|
88
|
+
},
|
|
89
|
+
sectionContent: {
|
|
90
|
+
// No gap needed, StorageKeyRow has its own margins
|
|
91
|
+
},
|
|
92
|
+
emptySection: {
|
|
93
|
+
backgroundColor: "rgba(255, 255, 255, 0.02)",
|
|
94
|
+
borderRadius: 6,
|
|
95
|
+
padding: 16,
|
|
96
|
+
borderWidth: 1,
|
|
97
|
+
borderColor: "rgba(255, 255, 255, 0.05)",
|
|
98
|
+
alignItems: "center"
|
|
99
|
+
},
|
|
100
|
+
emptySectionText: {
|
|
101
|
+
color: "#6B7280",
|
|
102
|
+
fontSize: 11,
|
|
103
|
+
textAlign: "center"
|
|
104
|
+
}
|
|
105
|
+
});
|