@buoy-gg/redux 2.1.11 → 2.1.13
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/LICENSE +58 -0
- package/lib/commonjs/index.js +1 -179
- package/lib/commonjs/preset.js +1 -98
- package/lib/commonjs/redux/components/ReduxActionButton.js +1 -129
- package/lib/commonjs/redux/components/ReduxActionDetailContent.js +1 -380
- package/lib/commonjs/redux/components/ReduxActionDetailView.js +1 -401
- package/lib/commonjs/redux/components/ReduxActionInfoView.js +1 -838
- package/lib/commonjs/redux/components/ReduxActionItem.js +1 -366
- package/lib/commonjs/redux/components/ReduxDetailViewToggle.js +1 -134
- package/lib/commonjs/redux/components/ReduxIcon.js +1 -18
- package/lib/commonjs/redux/components/ReduxModal.js +1 -530
- package/lib/commonjs/redux/components/index.js +1 -52
- package/lib/commonjs/redux/hooks/index.js +1 -25
- package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +1 -197
- package/lib/commonjs/redux/hooks/useReduxActions.js +1 -75
- package/lib/commonjs/redux/index.js +1 -49
- package/lib/commonjs/redux/utils/autoInstrument.js +1 -270
- package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +1 -166
- package/lib/commonjs/redux/utils/createReduxHistoryAdapter.js +1 -146
- package/lib/commonjs/redux/utils/index.js +1 -111
- package/lib/commonjs/redux/utils/reduxActionStore.js +1 -358
- package/lib/module/index.js +1 -87
- package/lib/module/preset.js +1 -94
- package/lib/module/redux/components/ReduxActionButton.js +1 -126
- package/lib/module/redux/components/ReduxActionDetailContent.js +1 -376
- package/lib/module/redux/components/ReduxActionDetailView.js +1 -397
- package/lib/module/redux/components/ReduxActionInfoView.js +1 -833
- package/lib/module/redux/components/ReduxActionItem.js +1 -362
- package/lib/module/redux/components/ReduxDetailViewToggle.js +1 -129
- package/lib/module/redux/components/ReduxIcon.js +1 -8
- package/lib/module/redux/components/ReduxModal.js +1 -525
- package/lib/module/redux/components/index.js +1 -7
- package/lib/module/redux/hooks/index.js +1 -4
- package/lib/module/redux/hooks/useAutoInstrumentRedux.js +1 -193
- package/lib/module/redux/hooks/useReduxActions.js +1 -71
- package/lib/module/redux/index.js +1 -13
- package/lib/module/redux/utils/autoInstrument.js +1 -260
- package/lib/module/redux/utils/buoyReduxMiddleware.js +1 -157
- package/lib/module/redux/utils/createReduxHistoryAdapter.js +1 -142
- package/lib/module/redux/utils/index.js +1 -8
- package/lib/module/redux/utils/reduxActionStore.js +1 -354
- package/package.json +12 -12
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxActionButton.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxActionDetailContent.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxActionDetailView.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxActionInfoView.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxActionItem.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxDetailViewToggle.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxIcon.d.ts.map +0 -1
- package/lib/typescript/redux/components/ReduxModal.d.ts.map +0 -1
- package/lib/typescript/redux/components/index.d.ts.map +0 -1
- package/lib/typescript/redux/hooks/index.d.ts.map +0 -1
- package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts.map +0 -1
- package/lib/typescript/redux/hooks/useReduxActions.d.ts.map +0 -1
- package/lib/typescript/redux/index.d.ts.map +0 -1
- package/lib/typescript/redux/types/index.d.ts.map +0 -1
- package/lib/typescript/redux/utils/autoInstrument.d.ts.map +0 -1
- package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts.map +0 -1
- package/lib/typescript/redux/utils/createReduxHistoryAdapter.d.ts.map +0 -1
- package/lib/typescript/redux/utils/index.d.ts.map +0 -1
- package/lib/typescript/redux/utils/reduxActionStore.d.ts.map +0 -1
|
@@ -1,380 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReduxActionDetailContent = ReduxActionDetailContent;
|
|
7
|
-
exports.ReduxActionDetailFooter = ReduxActionDetailFooter;
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
11
|
-
var _dataViewer = require("@buoy-gg/shared-ui/dataViewer");
|
|
12
|
-
var _ReduxDetailViewToggle = require("./ReduxDetailViewToggle");
|
|
13
|
-
var _ReduxActionInfoView = require("./ReduxActionInfoView");
|
|
14
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
-
/**
|
|
16
|
-
* ReduxActionDetailContent
|
|
17
|
-
*
|
|
18
|
-
* Enhanced detail view for a Redux action with 3 view modes:
|
|
19
|
-
* - ACTION: View action details, payload, meta, error
|
|
20
|
-
* - STATE: View current state after action
|
|
21
|
-
* - DIFF: Compare prev vs next state
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get color for action type
|
|
26
|
-
*/
|
|
27
|
-
function getActionColor(type) {
|
|
28
|
-
if (type.includes("/pending")) return _sharedUi.macOSColors.semantic.warning;
|
|
29
|
-
if (type.includes("/fulfilled")) return _sharedUi.macOSColors.semantic.success;
|
|
30
|
-
if (type.includes("/rejected")) return _sharedUi.macOSColors.semantic.error;
|
|
31
|
-
if (type.startsWith("@@")) return _sharedUi.macOSColors.text.muted;
|
|
32
|
-
return _sharedUi.macOSColors.semantic.info;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Get short action label
|
|
37
|
-
*/
|
|
38
|
-
function getActionLabel(type) {
|
|
39
|
-
if (type.includes("/pending")) return "PENDING";
|
|
40
|
-
if (type.includes("/fulfilled")) return "FULFILLED";
|
|
41
|
-
if (type.includes("/rejected")) return "REJECTED";
|
|
42
|
-
if (type.startsWith("@@")) return "INTERNAL";
|
|
43
|
-
const parts = type.split("/");
|
|
44
|
-
return parts[parts.length - 1]?.toUpperCase() || "ACTION";
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Get the type (object, array, string, etc.)
|
|
49
|
-
*/
|
|
50
|
-
function getValueType(value) {
|
|
51
|
-
if (value === null) return "null";
|
|
52
|
-
if (value === undefined) return "undefined";
|
|
53
|
-
if (Array.isArray(value)) return "array";
|
|
54
|
-
return typeof value;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Format timestamp for display
|
|
59
|
-
*/
|
|
60
|
-
function formatTimestamp(timestamp) {
|
|
61
|
-
const date = new Date(timestamp);
|
|
62
|
-
return date.toLocaleTimeString("en-US", {
|
|
63
|
-
hour12: false,
|
|
64
|
-
hour: "2-digit",
|
|
65
|
-
minute: "2-digit",
|
|
66
|
-
second: "2-digit"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Diff mode tabs configuration
|
|
72
|
-
*/
|
|
73
|
-
const DIFF_MODE_TABS = [{
|
|
74
|
-
key: "tree",
|
|
75
|
-
label: "TREE VIEW"
|
|
76
|
-
}, {
|
|
77
|
-
key: "split",
|
|
78
|
-
label: "SPLIT VIEW"
|
|
79
|
-
}];
|
|
80
|
-
function ReduxActionDetailContent({
|
|
81
|
-
action,
|
|
82
|
-
actions,
|
|
83
|
-
selectedIndex,
|
|
84
|
-
onIndexChange,
|
|
85
|
-
disableInternalFooter = false
|
|
86
|
-
}) {
|
|
87
|
-
// View state
|
|
88
|
-
const [activeView, setActiveView] = (0, _react.useState)("action");
|
|
89
|
-
const [diffMode, setDiffMode] = (0, _react.useState)("tree");
|
|
90
|
-
const totalActions = actions.length;
|
|
91
|
-
const actionColor = getActionColor(action.type);
|
|
92
|
-
const actionLabel = getActionLabel(action.type);
|
|
93
|
-
const stateType = getValueType((0, _sharedUi.parseValue)(action.nextState));
|
|
94
|
-
|
|
95
|
-
// Actions are in reverse chronological order (newest first, oldest last)
|
|
96
|
-
const chronologicalNumber = totalActions - selectedIndex;
|
|
97
|
-
const prevChronologicalNumber = chronologicalNumber - 1;
|
|
98
|
-
|
|
99
|
-
// Get the previous action in chronological order (which is the NEXT index in the array)
|
|
100
|
-
const prevActionIndex = selectedIndex < totalActions - 1 ? selectedIndex + 1 : null;
|
|
101
|
-
const prevAction = prevActionIndex !== null ? actions[prevActionIndex] : null;
|
|
102
|
-
|
|
103
|
-
// Compare bar info for diff view
|
|
104
|
-
const leftEvent = (0, _react.useMemo)(() => ({
|
|
105
|
-
index: prevActionIndex ?? 0,
|
|
106
|
-
label: prevChronologicalNumber > 0 ? `#${prevChronologicalNumber}` : "Initial",
|
|
107
|
-
timestamp: prevAction ? formatTimestamp(prevAction.timestamp) : "",
|
|
108
|
-
relativeTime: prevAction ? (0, _sharedUi.formatRelativeTime)(new Date(prevAction.timestamp)) : "state",
|
|
109
|
-
badge: prevAction ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
110
|
-
style: [styles.actionBadgeSmall, {
|
|
111
|
-
backgroundColor: `${getActionColor(prevAction.type)}20`
|
|
112
|
-
}],
|
|
113
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
114
|
-
style: [styles.actionTextSmall, {
|
|
115
|
-
color: getActionColor(prevAction.type)
|
|
116
|
-
}],
|
|
117
|
-
children: getActionLabel(prevAction.type)
|
|
118
|
-
})
|
|
119
|
-
}) : undefined
|
|
120
|
-
}), [prevActionIndex, prevAction, prevChronologicalNumber]);
|
|
121
|
-
const rightEvent = (0, _react.useMemo)(() => ({
|
|
122
|
-
index: selectedIndex,
|
|
123
|
-
label: `#${chronologicalNumber}`,
|
|
124
|
-
timestamp: formatTimestamp(action.timestamp),
|
|
125
|
-
relativeTime: (0, _sharedUi.formatRelativeTime)(new Date(action.timestamp)),
|
|
126
|
-
badge: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
127
|
-
style: [styles.actionBadgeSmall, {
|
|
128
|
-
backgroundColor: `${actionColor}20`
|
|
129
|
-
}],
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
131
|
-
style: [styles.actionTextSmall, {
|
|
132
|
-
color: actionColor
|
|
133
|
-
}],
|
|
134
|
-
children: actionLabel
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
}), [selectedIndex, action.timestamp, actionColor, actionLabel, chronologicalNumber]);
|
|
138
|
-
|
|
139
|
-
// Render state view
|
|
140
|
-
const renderStateView = (0, _react.useCallback)(() => {
|
|
141
|
-
const parsed = (0, _sharedUi.parseValue)(action.nextState);
|
|
142
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
143
|
-
style: styles.contentCard,
|
|
144
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
145
|
-
style: styles.valueHeader,
|
|
146
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
147
|
-
style: styles.valueLabel,
|
|
148
|
-
children: "STATE AFTER ACTION"
|
|
149
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
150
|
-
style: styles.valueHeaderBadges,
|
|
151
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
152
|
-
style: [styles.actionBadge, {
|
|
153
|
-
backgroundColor: `${actionColor}20`
|
|
154
|
-
}],
|
|
155
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
156
|
-
style: [styles.actionText, {
|
|
157
|
-
color: actionColor
|
|
158
|
-
}],
|
|
159
|
-
children: actionLabel
|
|
160
|
-
})
|
|
161
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
162
|
-
style: styles.typeBadge,
|
|
163
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
164
|
-
style: styles.typeText,
|
|
165
|
-
children: stateType.toUpperCase()
|
|
166
|
-
})
|
|
167
|
-
})]
|
|
168
|
-
})]
|
|
169
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
170
|
-
style: styles.dataViewerContainer,
|
|
171
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.DataViewer, {
|
|
172
|
-
title: "",
|
|
173
|
-
data: parsed,
|
|
174
|
-
showTypeFilter: true,
|
|
175
|
-
rawMode: true,
|
|
176
|
-
initialExpanded: true
|
|
177
|
-
})
|
|
178
|
-
})]
|
|
179
|
-
});
|
|
180
|
-
}, [action.nextState, actionColor, actionLabel, stateType]);
|
|
181
|
-
|
|
182
|
-
// Render diff content
|
|
183
|
-
const renderDiffContent = (0, _react.useCallback)(() => {
|
|
184
|
-
const prevState = (0, _sharedUi.parseValue)(action.prevState);
|
|
185
|
-
const nextState = (0, _sharedUi.parseValue)(action.nextState);
|
|
186
|
-
if (diffMode === "split") {
|
|
187
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ScrollView, {
|
|
188
|
-
style: {
|
|
189
|
-
flex: 1
|
|
190
|
-
},
|
|
191
|
-
showsVerticalScrollIndicator: true,
|
|
192
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.SplitDiffViewer, {
|
|
193
|
-
oldValue: prevState,
|
|
194
|
-
newValue: nextState,
|
|
195
|
-
theme: _dataViewer.diffThemes.devToolsDefault,
|
|
196
|
-
options: {
|
|
197
|
-
hideLineNumbers: false,
|
|
198
|
-
disableWordDiff: false,
|
|
199
|
-
showDiffOnly: false,
|
|
200
|
-
compareMethod: "words",
|
|
201
|
-
contextLines: 3
|
|
202
|
-
},
|
|
203
|
-
showThemeName: false
|
|
204
|
-
})
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_dataViewer.TreeDiffViewer, {
|
|
208
|
-
oldValue: prevState,
|
|
209
|
-
newValue: nextState
|
|
210
|
-
});
|
|
211
|
-
}, [action.prevState, action.nextState, diffMode]);
|
|
212
|
-
|
|
213
|
-
// Navigation handlers
|
|
214
|
-
const handleFooterPrevious = (0, _react.useCallback)(() => {
|
|
215
|
-
onIndexChange(Math.min(totalActions - 1, selectedIndex + 1));
|
|
216
|
-
}, [selectedIndex, totalActions, onIndexChange]);
|
|
217
|
-
const handleFooterNext = (0, _react.useCallback)(() => {
|
|
218
|
-
onIndexChange(Math.max(0, selectedIndex - 1));
|
|
219
|
-
}, [selectedIndex, onIndexChange]);
|
|
220
|
-
const diffDisabled = totalActions <= 1;
|
|
221
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
222
|
-
style: styles.container,
|
|
223
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ReduxDetailViewToggle.ReduxDetailViewToggle, {
|
|
224
|
-
activeView: activeView,
|
|
225
|
-
onViewChange: setActiveView,
|
|
226
|
-
diffDisabled: diffDisabled
|
|
227
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
228
|
-
style: styles.contentArea,
|
|
229
|
-
children: [activeView === "action" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReduxActionInfoView.ReduxActionInfoView, {
|
|
230
|
-
action: action
|
|
231
|
-
}), activeView === "state" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
232
|
-
style: styles.stateContainer,
|
|
233
|
-
children: renderStateView()
|
|
234
|
-
}), activeView === "diff" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
235
|
-
style: styles.diffContainer,
|
|
236
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DiffModeTabs, {
|
|
237
|
-
tabs: DIFF_MODE_TABS,
|
|
238
|
-
activeTab: diffMode,
|
|
239
|
-
onTabChange: setDiffMode
|
|
240
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.CompareBar, {
|
|
241
|
-
leftEvent: leftEvent,
|
|
242
|
-
rightEvent: rightEvent
|
|
243
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
244
|
-
style: styles.diffContent,
|
|
245
|
-
children: renderDiffContent()
|
|
246
|
-
})]
|
|
247
|
-
})]
|
|
248
|
-
}), !disableInternalFooter && totalActions > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EventStepperFooter, {
|
|
249
|
-
currentIndex: chronologicalNumber - 1,
|
|
250
|
-
totalItems: totalActions,
|
|
251
|
-
onPrevious: handleFooterPrevious,
|
|
252
|
-
onNext: handleFooterNext,
|
|
253
|
-
itemLabel: "Action",
|
|
254
|
-
subtitle: (0, _sharedUi.formatRelativeTime)(new Date(action.timestamp)),
|
|
255
|
-
absolute: true
|
|
256
|
-
})]
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* External footer component for modal use
|
|
262
|
-
*/
|
|
263
|
-
function ReduxActionDetailFooter({
|
|
264
|
-
action,
|
|
265
|
-
actions,
|
|
266
|
-
selectedIndex,
|
|
267
|
-
onIndexChange
|
|
268
|
-
}) {
|
|
269
|
-
const totalActions = actions.length;
|
|
270
|
-
if (totalActions <= 1) return null;
|
|
271
|
-
const chronologicalNumber = totalActions - selectedIndex;
|
|
272
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.EventStepperFooter, {
|
|
273
|
-
currentIndex: chronologicalNumber - 1,
|
|
274
|
-
totalItems: totalActions,
|
|
275
|
-
onPrevious: () => onIndexChange(Math.min(totalActions - 1, selectedIndex + 1)),
|
|
276
|
-
onNext: () => onIndexChange(Math.max(0, selectedIndex - 1)),
|
|
277
|
-
itemLabel: "Action",
|
|
278
|
-
subtitle: (0, _sharedUi.formatRelativeTime)(new Date(action.timestamp))
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
const styles = _reactNative.StyleSheet.create({
|
|
282
|
-
container: {
|
|
283
|
-
flex: 1,
|
|
284
|
-
backgroundColor: _sharedUi.macOSColors.background.base
|
|
285
|
-
},
|
|
286
|
-
contentArea: {
|
|
287
|
-
flex: 1,
|
|
288
|
-
paddingBottom: 96
|
|
289
|
-
},
|
|
290
|
-
// State view styles
|
|
291
|
-
stateContainer: {
|
|
292
|
-
flex: 1,
|
|
293
|
-
padding: 14
|
|
294
|
-
},
|
|
295
|
-
contentCard: {
|
|
296
|
-
backgroundColor: _sharedUi.macOSColors.background.card,
|
|
297
|
-
borderRadius: 14,
|
|
298
|
-
padding: 14,
|
|
299
|
-
borderWidth: 1,
|
|
300
|
-
borderColor: _sharedUi.macOSColors.border.default
|
|
301
|
-
},
|
|
302
|
-
valueHeader: {
|
|
303
|
-
flexDirection: "row",
|
|
304
|
-
alignItems: "center",
|
|
305
|
-
justifyContent: "space-between",
|
|
306
|
-
marginBottom: 8
|
|
307
|
-
},
|
|
308
|
-
valueLabel: {
|
|
309
|
-
fontSize: 10,
|
|
310
|
-
color: _sharedUi.macOSColors.text.secondary,
|
|
311
|
-
fontFamily: "monospace",
|
|
312
|
-
letterSpacing: 0.5,
|
|
313
|
-
fontWeight: "600"
|
|
314
|
-
},
|
|
315
|
-
valueHeaderBadges: {
|
|
316
|
-
flexDirection: "row",
|
|
317
|
-
alignItems: "center",
|
|
318
|
-
gap: 6
|
|
319
|
-
},
|
|
320
|
-
actionBadge: {
|
|
321
|
-
paddingHorizontal: 8,
|
|
322
|
-
paddingVertical: 2,
|
|
323
|
-
borderRadius: 4
|
|
324
|
-
},
|
|
325
|
-
actionText: {
|
|
326
|
-
fontSize: 9,
|
|
327
|
-
fontWeight: "700",
|
|
328
|
-
fontFamily: "monospace",
|
|
329
|
-
letterSpacing: 0.3
|
|
330
|
-
},
|
|
331
|
-
typeBadge: {
|
|
332
|
-
paddingHorizontal: 8,
|
|
333
|
-
paddingVertical: 2,
|
|
334
|
-
borderRadius: 4,
|
|
335
|
-
backgroundColor: _sharedUi.macOSColors.background.input
|
|
336
|
-
},
|
|
337
|
-
typeText: {
|
|
338
|
-
fontSize: 9,
|
|
339
|
-
fontWeight: "600",
|
|
340
|
-
color: _sharedUi.macOSColors.text.muted,
|
|
341
|
-
fontFamily: "monospace"
|
|
342
|
-
},
|
|
343
|
-
valueBox: {
|
|
344
|
-
backgroundColor: _sharedUi.macOSColors.background.base,
|
|
345
|
-
borderRadius: 6,
|
|
346
|
-
borderWidth: 1,
|
|
347
|
-
borderColor: _sharedUi.macOSColors.border.input,
|
|
348
|
-
padding: 8
|
|
349
|
-
},
|
|
350
|
-
valueText: {
|
|
351
|
-
fontSize: 12,
|
|
352
|
-
color: _sharedUi.macOSColors.text.primary,
|
|
353
|
-
fontFamily: "monospace",
|
|
354
|
-
lineHeight: 18
|
|
355
|
-
},
|
|
356
|
-
// Diff view styles
|
|
357
|
-
diffContainer: {
|
|
358
|
-
flex: 1
|
|
359
|
-
},
|
|
360
|
-
diffContent: {
|
|
361
|
-
flex: 1,
|
|
362
|
-
paddingHorizontal: 14
|
|
363
|
-
},
|
|
364
|
-
// Action badges for compare bar
|
|
365
|
-
actionBadgeSmall: {
|
|
366
|
-
paddingHorizontal: 6,
|
|
367
|
-
paddingVertical: 1,
|
|
368
|
-
borderRadius: 3
|
|
369
|
-
},
|
|
370
|
-
actionTextSmall: {
|
|
371
|
-
fontSize: 8,
|
|
372
|
-
fontWeight: "700",
|
|
373
|
-
fontFamily: "monospace"
|
|
374
|
-
},
|
|
375
|
-
dataViewerContainer: {
|
|
376
|
-
marginTop: -12,
|
|
377
|
-
marginHorizontal: -12,
|
|
378
|
-
marginBottom: -12
|
|
379
|
-
}
|
|
380
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ReduxActionDetailContent=ReduxActionDetailContent,exports.ReduxActionDetailFooter=ReduxActionDetailFooter;var _reactNative=require("react-native"),_react=require("react"),_sharedUi=require("@buoy-gg/shared-ui"),_dataViewer=require("@buoy-gg/shared-ui/dataViewer"),_ReduxDetailViewToggle=require("./ReduxDetailViewToggle"),_ReduxActionInfoView=require("./ReduxActionInfoView"),_jsxRuntime=require("react/jsx-runtime");function getActionColor(e){return e.includes("/pending")?_sharedUi.macOSColors.semantic.warning:e.includes("/fulfilled")?_sharedUi.macOSColors.semantic.success:e.includes("/rejected")?_sharedUi.macOSColors.semantic.error:e.startsWith("@@")?_sharedUi.macOSColors.text.muted:_sharedUi.macOSColors.semantic.info}function getActionLabel(e){if(e.includes("/pending"))return"PENDING";if(e.includes("/fulfilled"))return"FULFILLED";if(e.includes("/rejected"))return"REJECTED";if(e.startsWith("@@"))return"INTERNAL";const t=e.split("/");return t[t.length-1]?.toUpperCase()||"ACTION"}function getValueType(e){return null===e?"null":void 0===e?"undefined":Array.isArray(e)?"array":typeof e}function formatTimestamp(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}const DIFF_MODE_TABS=[{key:"tree",label:"TREE VIEW"},{key:"split",label:"SPLIT VIEW"}];function ReduxActionDetailContent({action:e,actions:t,selectedIndex:a,onIndexChange:i,disableInternalFooter:r=!1}){const[n,o]=(0,_react.useState)("action"),[s,l]=(0,_react.useState)("tree"),d=t.length,c=getActionColor(e.type),u=getActionLabel(e.type),m=getValueType((0,_sharedUi.parseValue)(e.nextState)),x=d-a,_=x-1,g=a<d-1?a+1:null,h=null!==g?t[g]:null,f=(0,_react.useMemo)(()=>({index:g??0,label:_>0?`#${_}`:"Initial",timestamp:h?formatTimestamp(h.timestamp):"",relativeTime:h?(0,_sharedUi.formatRelativeTime)(new Date(h.timestamp)):"state",badge:h?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadgeSmall,{backgroundColor:`${getActionColor(h.type)}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionTextSmall,{color:getActionColor(h.type)}],children:getActionLabel(h.type)})}):void 0}),[g,h,_]),p=(0,_react.useMemo)(()=>({index:a,label:`#${x}`,timestamp:formatTimestamp(e.timestamp),relativeTime:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),badge:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadgeSmall,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionTextSmall,{color:c}],children:u})})}),[a,e.timestamp,c,u,x]),y=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.nextState);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentCard,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeader,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.valueLabel,children:"STATE AFTER ACTION"}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.valueHeaderBadges,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.actionBadge,{backgroundColor:`${c}20`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.actionText,{color:c}],children:u})}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.typeBadge,children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.typeText,children:m.toUpperCase()})})]})]}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.dataViewerContainer,children:(0,_jsxRuntime.jsx)(_dataViewer.DataViewer,{title:"",data:t,showTypeFilter:!0,rawMode:!0,initialExpanded:!0})})]})},[e.nextState,c,u,m]),j=(0,_react.useCallback)(()=>{const t=(0,_sharedUi.parseValue)(e.prevState),a=(0,_sharedUi.parseValue)(e.nextState);return"split"===s?(0,_jsxRuntime.jsx)(_reactNative.ScrollView,{style:{flex:1},showsVerticalScrollIndicator:!0,children:(0,_jsxRuntime.jsx)(_dataViewer.SplitDiffViewer,{oldValue:t,newValue:a,theme:_dataViewer.diffThemes.devToolsDefault,options:{hideLineNumbers:!1,disableWordDiff:!1,showDiffOnly:!1,compareMethod:"words",contextLines:3},showThemeName:!1})}):(0,_jsxRuntime.jsx)(_dataViewer.TreeDiffViewer,{oldValue:t,newValue:a})},[e.prevState,e.nextState,s]),b=(0,_react.useCallback)(()=>{i(Math.min(d-1,a+1))},[a,d,i]),R=(0,_react.useCallback)(()=>{i(Math.max(0,a-1))},[a,i]),C=d<=1;return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.container,children:[(0,_jsxRuntime.jsx)(_ReduxDetailViewToggle.ReduxDetailViewToggle,{activeView:n,onViewChange:o,diffDisabled:C}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.contentArea,children:["action"===n&&(0,_jsxRuntime.jsx)(_ReduxActionInfoView.ReduxActionInfoView,{action:e}),"state"===n&&(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.stateContainer,children:y()}),"diff"===n&&(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.diffContainer,children:[(0,_jsxRuntime.jsx)(_sharedUi.DiffModeTabs,{tabs:DIFF_MODE_TABS,activeTab:s,onTabChange:l}),(0,_jsxRuntime.jsx)(_sharedUi.CompareBar,{leftEvent:f,rightEvent:p}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.diffContent,children:j()})]})]}),!r&&d>1&&(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:x-1,totalItems:d,onPrevious:b,onNext:R,itemLabel:"Action",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp)),absolute:!0})]})}function ReduxActionDetailFooter({action:e,actions:t,selectedIndex:a,onIndexChange:i}){const r=t.length;if(r<=1)return null;const n=r-a;return(0,_jsxRuntime.jsx)(_sharedUi.EventStepperFooter,{currentIndex:n-1,totalItems:r,onPrevious:()=>i(Math.min(r-1,a+1)),onNext:()=>i(Math.max(0,a-1)),itemLabel:"Action",subtitle:(0,_sharedUi.formatRelativeTime)(new Date(e.timestamp))})}const styles=_reactNative.StyleSheet.create({container:{flex:1,backgroundColor:_sharedUi.macOSColors.background.base},contentArea:{flex:1,paddingBottom:96},stateContainer:{flex:1,padding:14},contentCard:{backgroundColor:_sharedUi.macOSColors.background.card,borderRadius:14,padding:14,borderWidth:1,borderColor:_sharedUi.macOSColors.border.default},valueHeader:{flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:8},valueLabel:{fontSize:10,color:_sharedUi.macOSColors.text.secondary,fontFamily:"monospace",letterSpacing:.5,fontWeight:"600"},valueHeaderBadges:{flexDirection:"row",alignItems:"center",gap:6},actionBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4},actionText:{fontSize:9,fontWeight:"700",fontFamily:"monospace",letterSpacing:.3},typeBadge:{paddingHorizontal:8,paddingVertical:2,borderRadius:4,backgroundColor:_sharedUi.macOSColors.background.input},typeText:{fontSize:9,fontWeight:"600",color:_sharedUi.macOSColors.text.muted,fontFamily:"monospace"},valueBox:{backgroundColor:_sharedUi.macOSColors.background.base,borderRadius:6,borderWidth:1,borderColor:_sharedUi.macOSColors.border.input,padding:8},valueText:{fontSize:12,color:_sharedUi.macOSColors.text.primary,fontFamily:"monospace",lineHeight:18},diffContainer:{flex:1},diffContent:{flex:1,paddingHorizontal:14},actionBadgeSmall:{paddingHorizontal:6,paddingVertical:1,borderRadius:3},actionTextSmall:{fontSize:8,fontWeight:"700",fontFamily:"monospace"},dataViewerContainer:{marginTop:-12,marginHorizontal:-12,marginBottom:-12}});
|