@buoy-gg/storage 1.7.7 → 2.1.1
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/lib/commonjs/index.js +219 -16
- package/lib/commonjs/storage/components/DiffViewer/themes/diffThemes.js +35 -44
- package/lib/commonjs/storage/components/GameUIStorageBrowser.js +9 -23
- package/lib/commonjs/storage/components/SelectionActionBar.js +8 -22
- package/lib/commonjs/storage/components/StorageActionButtons.js +8 -22
- package/lib/commonjs/storage/components/StorageActions.js +8 -22
- package/lib/commonjs/storage/components/StorageEventActionButton.js +120 -0
- package/lib/commonjs/storage/components/StorageEventCard.js +112 -0
- package/lib/commonjs/storage/components/StorageEventDetailContent.js +331 -822
- package/lib/commonjs/storage/components/StorageModalWithTabs.js +43 -200
- package/lib/commonjs/storage/hooks/useStorageEvents.js +98 -0
- package/lib/commonjs/storage/index.js +111 -2
- package/lib/commonjs/storage/stores/storageEventStore.js +243 -0
- package/lib/commonjs/storage/utils/AsyncStorageListener.js +164 -35
- package/lib/commonjs/storage/utils/index.js +37 -0
- package/lib/commonjs/storage/utils/storageTimeTravelUtils.js +251 -0
- package/lib/module/index.js +74 -3
- package/lib/module/storage/components/DiffViewer/themes/diffThemes.js +35 -44
- package/lib/module/storage/components/GameUIStorageBrowser.js +9 -23
- package/lib/module/storage/components/SelectionActionBar.js +9 -24
- package/lib/module/storage/components/StorageActionButtons.js +9 -24
- package/lib/module/storage/components/StorageActions.js +9 -24
- package/lib/module/storage/components/StorageEventActionButton.js +117 -0
- package/lib/module/storage/components/StorageEventCard.js +107 -0
- package/lib/module/storage/components/StorageEventDetailContent.js +332 -824
- package/lib/module/storage/components/StorageModalWithTabs.js +45 -202
- package/lib/module/storage/hooks/useStorageEvents.js +95 -0
- package/lib/module/storage/index.js +7 -1
- package/lib/module/storage/stores/storageEventStore.js +231 -0
- package/lib/module/storage/utils/AsyncStorageListener.js +159 -33
- package/lib/module/storage/utils/index.js +4 -1
- package/lib/module/storage/utils/storageTimeTravelUtils.js +245 -0
- package/lib/typescript/index.d.ts +36 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts +1 -1
- package/lib/typescript/storage/components/DiffViewer/themes/diffThemes.d.ts.map +1 -1
- package/lib/typescript/storage/components/GameUIStorageBrowser.d.ts.map +1 -1
- package/lib/typescript/storage/components/SelectionActionBar.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageActionButtons.d.ts +0 -2
- package/lib/typescript/storage/components/StorageActionButtons.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageActions.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageEventActionButton.d.ts +37 -0
- package/lib/typescript/storage/components/StorageEventActionButton.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventCard.d.ts +40 -0
- package/lib/typescript/storage/components/StorageEventCard.d.ts.map +1 -0
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts +11 -3
- package/lib/typescript/storage/components/StorageEventDetailContent.d.ts.map +1 -1
- package/lib/typescript/storage/components/StorageModalWithTabs.d.ts.map +1 -1
- package/lib/typescript/storage/hooks/useStorageEvents.d.ts +51 -0
- package/lib/typescript/storage/hooks/useStorageEvents.d.ts.map +1 -0
- package/lib/typescript/storage/index.d.ts +4 -0
- package/lib/typescript/storage/index.d.ts.map +1 -1
- package/lib/typescript/storage/stores/storageEventStore.d.ts +113 -0
- package/lib/typescript/storage/stores/storageEventStore.d.ts.map +1 -0
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts +38 -1
- package/lib/typescript/storage/utils/AsyncStorageListener.d.ts.map +1 -1
- package/lib/typescript/storage/utils/index.d.ts +2 -1
- package/lib/typescript/storage/utils/index.d.ts.map +1 -1
- package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts +35 -0
- package/lib/typescript/storage/utils/storageTimeTravelUtils.d.ts.map +1 -0
- package/package.json +20 -4
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.StorageEventCard = void 0;
|
|
7
|
+
exports.getValueType = getValueType;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
+
var _storageActionHelpers = require("../utils/storageActionHelpers");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
/**
|
|
13
|
+
* StorageEventCard
|
|
14
|
+
*
|
|
15
|
+
* Shared card component for displaying storage events.
|
|
16
|
+
* Used by both Storage DevTools and Events DevTools for consistent UI.
|
|
17
|
+
* Uses CompactRow for consistent layout with Redux/React Query cards.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Value type for storage events */
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Compute value type from a value
|
|
24
|
+
*/
|
|
25
|
+
function getValueType(value) {
|
|
26
|
+
const parsed = (0, _sharedUi.parseValue)(value);
|
|
27
|
+
if (parsed === null) return "null";
|
|
28
|
+
if (parsed === undefined) return "undefined";
|
|
29
|
+
if (Array.isArray(parsed)) return "array";
|
|
30
|
+
if (typeof parsed === "boolean") return "boolean";
|
|
31
|
+
if (typeof parsed === "number") return "number";
|
|
32
|
+
if (typeof parsed === "string") return "string";
|
|
33
|
+
if (typeof parsed === "object") return "object";
|
|
34
|
+
return "undefined";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get color for action type
|
|
38
|
+
*/
|
|
39
|
+
function getActionColor(action) {
|
|
40
|
+
switch (action) {
|
|
41
|
+
// AsyncStorage & MMKV - Set operations
|
|
42
|
+
case "setItem":
|
|
43
|
+
case "multiSet":
|
|
44
|
+
case "set.string":
|
|
45
|
+
case "set.number":
|
|
46
|
+
case "set.boolean":
|
|
47
|
+
case "set.buffer":
|
|
48
|
+
return _sharedUi.macOSColors.semantic.success;
|
|
49
|
+
|
|
50
|
+
// AsyncStorage & MMKV - Remove/Delete operations
|
|
51
|
+
case "removeItem":
|
|
52
|
+
case "multiRemove":
|
|
53
|
+
case "clear":
|
|
54
|
+
case "delete":
|
|
55
|
+
case "clearAll":
|
|
56
|
+
return _sharedUi.macOSColors.semantic.error;
|
|
57
|
+
|
|
58
|
+
// AsyncStorage - Merge operations
|
|
59
|
+
case "mergeItem":
|
|
60
|
+
case "multiMerge":
|
|
61
|
+
return _sharedUi.macOSColors.semantic.info;
|
|
62
|
+
|
|
63
|
+
// MMKV - Get operations
|
|
64
|
+
case "get.string":
|
|
65
|
+
case "get.number":
|
|
66
|
+
case "get.boolean":
|
|
67
|
+
case "get.buffer":
|
|
68
|
+
return _sharedUi.macOSColors.semantic.warning;
|
|
69
|
+
default:
|
|
70
|
+
return _sharedUi.macOSColors.text.muted;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Get storage type label for sublabel
|
|
76
|
+
*/
|
|
77
|
+
function getStorageTypeSublabel(storageTypes, totalOps) {
|
|
78
|
+
const types = Array.from(storageTypes).map(t => t === "async" ? "Async" : "MMKV").join("/");
|
|
79
|
+
return `${types} · ${totalOps} op${totalOps !== 1 ? "s" : ""}`;
|
|
80
|
+
}
|
|
81
|
+
const StorageEventCard = exports.StorageEventCard = /*#__PURE__*/(0, _react.memo)(function StorageEventCard({
|
|
82
|
+
data,
|
|
83
|
+
onPress,
|
|
84
|
+
isSelected = false,
|
|
85
|
+
showChevron = true
|
|
86
|
+
}) {
|
|
87
|
+
const actionColor = getActionColor(data.lastAction);
|
|
88
|
+
const actionLabel = (0, _storageActionHelpers.translateStorageAction)(data.lastAction);
|
|
89
|
+
const totalOps = data.totalOperations ?? 1;
|
|
90
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompactRow
|
|
91
|
+
// Status section (left) - shows "Storage" with action-colored dot
|
|
92
|
+
, {
|
|
93
|
+
statusDotColor: actionColor,
|
|
94
|
+
statusLabel: "Storage",
|
|
95
|
+
statusSublabel: getStorageTypeSublabel(data.storageTypes, totalOps)
|
|
96
|
+
// Content section (middle) - shows the key name
|
|
97
|
+
,
|
|
98
|
+
primaryText: data.key
|
|
99
|
+
// Badge section (right) - shows action label (SET, REMOVE, etc.)
|
|
100
|
+
,
|
|
101
|
+
badgeText: actionLabel,
|
|
102
|
+
badgeColor: actionColor,
|
|
103
|
+
showChevron: showChevron
|
|
104
|
+
// Bottom right - timestamp
|
|
105
|
+
,
|
|
106
|
+
bottomRightText: (0, _sharedUi.formatRelativeTime)(data.lastEventTimestamp)
|
|
107
|
+
// Interaction
|
|
108
|
+
,
|
|
109
|
+
isSelected: isSelected,
|
|
110
|
+
onPress: onPress
|
|
111
|
+
});
|
|
112
|
+
});
|