@buoy-gg/redux 7.0.40 → 7.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -102
- package/lib/commonjs/index.js +1 -256
- package/lib/commonjs/preset.js +1 -90
- package/lib/commonjs/redux/components/ReduxActionButton.js +1 -131
- package/lib/commonjs/redux/components/ReduxActionDetailContent.js +1 -437
- package/lib/commonjs/redux/components/ReduxActionDetailView.js +1 -401
- package/lib/commonjs/redux/components/ReduxActionInfoView.js +1 -836
- package/lib/commonjs/redux/components/ReduxActionItem.js +1 -334
- package/lib/commonjs/redux/components/ReduxAutoInstrument.js +1 -20
- package/lib/commonjs/redux/components/ReduxDetailViewToggle.js +1 -50
- package/lib/commonjs/redux/components/ReduxIcon.js +1 -18
- package/lib/commonjs/redux/components/ReduxModal.js +1 -703
- package/lib/commonjs/redux/hooks/reduxPeer.js +1 -0
- package/lib/commonjs/redux/hooks/reduxPeer.web.js +1 -0
- package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +1 -187
- package/lib/commonjs/redux/hooks/useReduxActions.js +1 -58
- package/lib/commonjs/redux/sync/reduxSyncAdapter.js +1 -191
- package/lib/commonjs/redux/types/index.js +1 -1
- package/lib/commonjs/redux/utils/activeStoreRegistry.js +1 -104
- package/lib/commonjs/redux/utils/autoInstrument.js +1 -231
- package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +1 -202
- package/lib/commonjs/redux/utils/createReduxHistoryAdapter.js +1 -146
- package/lib/commonjs/redux/utils/devtoolsHook.js +1 -152
- package/lib/commonjs/redux/utils/reduxActionStore.js +1 -473
- package/lib/commonjs/redux/utils/snapshotProvider.js +1 -158
- package/lib/commonjs/redux/utils/testIDs.js +1 -75
- package/lib/module/index.js +1 -125
- package/lib/module/preset.js +1 -87
- package/lib/module/redux/components/ReduxActionButton.js +1 -128
- package/lib/module/redux/components/ReduxActionDetailContent.js +1 -433
- package/lib/module/redux/components/ReduxActionDetailView.js +1 -397
- package/lib/module/redux/components/ReduxActionInfoView.js +1 -831
- package/lib/module/redux/components/ReduxActionItem.js +1 -330
- package/lib/module/redux/components/ReduxAutoInstrument.js +1 -17
- package/lib/module/redux/components/ReduxDetailViewToggle.js +1 -45
- package/lib/module/redux/components/ReduxIcon.js +1 -8
- package/lib/module/redux/components/ReduxModal.js +1 -698
- package/lib/module/redux/hooks/reduxPeer.js +1 -0
- package/lib/module/redux/hooks/reduxPeer.web.js +1 -0
- package/lib/module/redux/hooks/useAutoInstrumentRedux.js +1 -183
- package/lib/module/redux/hooks/useReduxActions.js +1 -54
- package/lib/module/redux/sync/reduxSyncAdapter.js +1 -188
- package/lib/module/redux/types/index.js +1 -1
- package/lib/module/redux/utils/activeStoreRegistry.js +1 -92
- package/lib/module/redux/utils/autoInstrument.js +1 -201
- package/lib/module/redux/utils/buoyReduxMiddleware.js +1 -188
- package/lib/module/redux/utils/createReduxHistoryAdapter.js +1 -142
- package/lib/module/redux/utils/devtoolsHook.js +1 -145
- package/lib/module/redux/utils/reduxActionStore.js +1 -465
- package/lib/module/redux/utils/snapshotProvider.js +1 -157
- package/lib/module/redux/utils/testIDs.js +1 -68
- package/lib/typescript/redux/hooks/reduxPeer.d.ts +3 -0
- package/lib/typescript/redux/hooks/reduxPeer.web.d.ts +2 -0
- package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts +3 -15
- package/lib/web/index.mjs +1 -0
- package/package.json +36 -13
- 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/ReduxAutoInstrument.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/hooks/useAutoInstrumentRedux.d.ts.map +0 -1
- package/lib/typescript/redux/hooks/useReduxActions.d.ts.map +0 -1
- package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/redux/types/index.d.ts.map +0 -1
- package/lib/typescript/redux/utils/activeStoreRegistry.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/devtoolsHook.d.ts.map +0 -1
- package/lib/typescript/redux/utils/reduxActionStore.d.ts.map +0 -1
- package/lib/typescript/redux/utils/snapshotProvider.d.ts.map +0 -1
- package/lib/typescript/redux/utils/testIDs.d.ts.map +0 -1
|
@@ -1,397 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Detail view for inspecting a single Redux action
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { View, Text, StyleSheet, ScrollView } from "react-native";
|
|
9
|
-
import { macOSColors, night, TabSelector, DataInspector, CollapsibleSection, CopyButton, monoFont } from "@buoy-gg/shared-ui";
|
|
10
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
export function ReduxActionDetailView({
|
|
12
|
-
action
|
|
13
|
-
}) {
|
|
14
|
-
const [activeTab, setActiveTab] = useState("action");
|
|
15
|
-
const tabs = [{
|
|
16
|
-
key: "action",
|
|
17
|
-
label: "Action"
|
|
18
|
-
}, {
|
|
19
|
-
key: "state",
|
|
20
|
-
label: "State"
|
|
21
|
-
}, {
|
|
22
|
-
key: "diff",
|
|
23
|
-
label: "Diff"
|
|
24
|
-
}];
|
|
25
|
-
|
|
26
|
-
// Format timestamp
|
|
27
|
-
const formattedTime = new Date(action.timestamp).toLocaleTimeString();
|
|
28
|
-
|
|
29
|
-
// Generate copy text for the action
|
|
30
|
-
const getCopyText = () => {
|
|
31
|
-
return JSON.stringify({
|
|
32
|
-
type: action.type,
|
|
33
|
-
payload: action.payload,
|
|
34
|
-
timestamp: action.timestamp,
|
|
35
|
-
duration: action.duration,
|
|
36
|
-
hasStateChange: action.hasStateChange
|
|
37
|
-
}, null, 2);
|
|
38
|
-
};
|
|
39
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
40
|
-
style: styles.container,
|
|
41
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
42
|
-
style: styles.header,
|
|
43
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
44
|
-
style: styles.headerContent,
|
|
45
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
46
|
-
style: styles.actionType,
|
|
47
|
-
numberOfLines: 2,
|
|
48
|
-
children: action.type
|
|
49
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
50
|
-
style: styles.headerMeta,
|
|
51
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
52
|
-
style: styles.metaText,
|
|
53
|
-
children: formattedTime
|
|
54
|
-
}), action.duration !== undefined && /*#__PURE__*/_jsxs(Text, {
|
|
55
|
-
style: styles.durationText,
|
|
56
|
-
children: [action.duration.toFixed(2), "ms"]
|
|
57
|
-
}), action.hasStateChange && /*#__PURE__*/_jsx(View, {
|
|
58
|
-
style: styles.changeBadge,
|
|
59
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
60
|
-
style: styles.changeBadgeText,
|
|
61
|
-
children: "State Changed"
|
|
62
|
-
})
|
|
63
|
-
})]
|
|
64
|
-
})]
|
|
65
|
-
}), /*#__PURE__*/_jsx(CopyButton, {
|
|
66
|
-
value: getCopyText(),
|
|
67
|
-
size: 16
|
|
68
|
-
})]
|
|
69
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
70
|
-
style: styles.tabContainer,
|
|
71
|
-
children: /*#__PURE__*/_jsx(TabSelector, {
|
|
72
|
-
tabs: tabs,
|
|
73
|
-
activeTab: activeTab,
|
|
74
|
-
onTabChange: tab => setActiveTab(tab)
|
|
75
|
-
})
|
|
76
|
-
}), /*#__PURE__*/_jsxs(ScrollView, {
|
|
77
|
-
style: styles.content,
|
|
78
|
-
showsVerticalScrollIndicator: true,
|
|
79
|
-
children: [activeTab === "action" && /*#__PURE__*/_jsxs(View, {
|
|
80
|
-
style: styles.section,
|
|
81
|
-
children: [/*#__PURE__*/_jsx(CollapsibleSection, {
|
|
82
|
-
title: "Payload",
|
|
83
|
-
defaultOpen: true,
|
|
84
|
-
children: action.payload !== undefined ? /*#__PURE__*/_jsx(DataInspector, {
|
|
85
|
-
data: action.payload
|
|
86
|
-
}) : /*#__PURE__*/_jsx(Text, {
|
|
87
|
-
style: styles.emptyText,
|
|
88
|
-
children: "No payload"
|
|
89
|
-
})
|
|
90
|
-
}), /*#__PURE__*/_jsx(CollapsibleSection, {
|
|
91
|
-
title: "Full Action",
|
|
92
|
-
defaultOpen: false,
|
|
93
|
-
children: /*#__PURE__*/_jsx(DataInspector, {
|
|
94
|
-
data: action.action
|
|
95
|
-
})
|
|
96
|
-
})]
|
|
97
|
-
}), activeTab === "state" && /*#__PURE__*/_jsxs(View, {
|
|
98
|
-
style: styles.section,
|
|
99
|
-
children: [/*#__PURE__*/_jsx(CollapsibleSection, {
|
|
100
|
-
title: "Previous State",
|
|
101
|
-
defaultOpen: false,
|
|
102
|
-
children: /*#__PURE__*/_jsx(DataInspector, {
|
|
103
|
-
data: action.prevState
|
|
104
|
-
})
|
|
105
|
-
}), /*#__PURE__*/_jsx(CollapsibleSection, {
|
|
106
|
-
title: "Next State",
|
|
107
|
-
defaultOpen: true,
|
|
108
|
-
children: /*#__PURE__*/_jsx(DataInspector, {
|
|
109
|
-
data: action.nextState
|
|
110
|
-
})
|
|
111
|
-
})]
|
|
112
|
-
}), activeTab === "diff" && /*#__PURE__*/_jsx(View, {
|
|
113
|
-
style: styles.section,
|
|
114
|
-
children: action.hasStateChange ? /*#__PURE__*/_jsx(StateDiff, {
|
|
115
|
-
prevState: action.prevState,
|
|
116
|
-
nextState: action.nextState
|
|
117
|
-
}) : /*#__PURE__*/_jsx(View, {
|
|
118
|
-
style: styles.noChangeContainer,
|
|
119
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
120
|
-
style: styles.noChangeText,
|
|
121
|
-
children: "No state changes from this action"
|
|
122
|
-
})
|
|
123
|
-
})
|
|
124
|
-
})]
|
|
125
|
-
})]
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Component to show state diff
|
|
131
|
-
*/
|
|
132
|
-
function StateDiff({
|
|
133
|
-
prevState,
|
|
134
|
-
nextState
|
|
135
|
-
}) {
|
|
136
|
-
// Simple diff - find changed keys at top level
|
|
137
|
-
const changes = findChanges(prevState, nextState);
|
|
138
|
-
if (changes.length === 0) {
|
|
139
|
-
return /*#__PURE__*/_jsx(View, {
|
|
140
|
-
style: styles.noChangeContainer,
|
|
141
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
142
|
-
style: styles.noChangeText,
|
|
143
|
-
children: "No differences detected"
|
|
144
|
-
})
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
return /*#__PURE__*/_jsx(View, {
|
|
148
|
-
children: changes.map((change, index) => /*#__PURE__*/_jsxs(View, {
|
|
149
|
-
style: styles.diffItem,
|
|
150
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
151
|
-
style: styles.diffHeader,
|
|
152
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
153
|
-
style: [styles.diffTypeBadge, {
|
|
154
|
-
backgroundColor: change.type === "added" ? macOSColors.semantic.successBackground : change.type === "removed" ? macOSColors.semantic.errorBackground : macOSColors.semantic.warningBackground
|
|
155
|
-
}],
|
|
156
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
157
|
-
style: [styles.diffTypeText, {
|
|
158
|
-
color: change.type === "added" ? macOSColors.semantic.success : change.type === "removed" ? macOSColors.semantic.error : macOSColors.semantic.warning
|
|
159
|
-
}],
|
|
160
|
-
children: change.type.toUpperCase()
|
|
161
|
-
})
|
|
162
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
163
|
-
style: styles.diffPath,
|
|
164
|
-
children: change.path
|
|
165
|
-
})]
|
|
166
|
-
}), change.type === "modified" && /*#__PURE__*/_jsxs(View, {
|
|
167
|
-
style: styles.diffValues,
|
|
168
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
169
|
-
style: styles.diffValue,
|
|
170
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
171
|
-
style: styles.diffLabel,
|
|
172
|
-
children: "Before:"
|
|
173
|
-
}), /*#__PURE__*/_jsx(DataInspector, {
|
|
174
|
-
data: change.oldValue
|
|
175
|
-
})]
|
|
176
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
177
|
-
style: styles.diffValue,
|
|
178
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
179
|
-
style: styles.diffLabel,
|
|
180
|
-
children: "After:"
|
|
181
|
-
}), /*#__PURE__*/_jsx(DataInspector, {
|
|
182
|
-
data: change.newValue
|
|
183
|
-
})]
|
|
184
|
-
})]
|
|
185
|
-
}), change.type === "added" && /*#__PURE__*/_jsx(View, {
|
|
186
|
-
style: styles.diffValue,
|
|
187
|
-
children: /*#__PURE__*/_jsx(DataInspector, {
|
|
188
|
-
data: change.newValue
|
|
189
|
-
})
|
|
190
|
-
}), change.type === "removed" && /*#__PURE__*/_jsx(View, {
|
|
191
|
-
style: styles.diffValue,
|
|
192
|
-
children: /*#__PURE__*/_jsx(DataInspector, {
|
|
193
|
-
data: change.oldValue
|
|
194
|
-
})
|
|
195
|
-
})]
|
|
196
|
-
}, index))
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Find changes between two state objects
|
|
201
|
-
*/
|
|
202
|
-
function findChanges(prevState, nextState, path = "") {
|
|
203
|
-
const changes = [];
|
|
204
|
-
|
|
205
|
-
// Handle primitives
|
|
206
|
-
if (typeof prevState !== "object" || typeof nextState !== "object") {
|
|
207
|
-
if (prevState !== nextState) {
|
|
208
|
-
changes.push({
|
|
209
|
-
type: "modified",
|
|
210
|
-
path: path || "root",
|
|
211
|
-
oldValue: prevState,
|
|
212
|
-
newValue: nextState
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return changes;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Handle null
|
|
219
|
-
if (prevState === null || nextState === null) {
|
|
220
|
-
if (prevState !== nextState) {
|
|
221
|
-
changes.push({
|
|
222
|
-
type: "modified",
|
|
223
|
-
path: path || "root",
|
|
224
|
-
oldValue: prevState,
|
|
225
|
-
newValue: nextState
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
return changes;
|
|
229
|
-
}
|
|
230
|
-
const prevObj = prevState;
|
|
231
|
-
const nextObj = nextState;
|
|
232
|
-
|
|
233
|
-
// Find all keys
|
|
234
|
-
const allKeys = new Set([...Object.keys(prevObj), ...Object.keys(nextObj)]);
|
|
235
|
-
for (const key of allKeys) {
|
|
236
|
-
const newPath = path ? `${path}.${key}` : key;
|
|
237
|
-
const prevValue = prevObj[key];
|
|
238
|
-
const nextValue = nextObj[key];
|
|
239
|
-
if (!(key in prevObj)) {
|
|
240
|
-
// Key was added
|
|
241
|
-
changes.push({
|
|
242
|
-
type: "added",
|
|
243
|
-
path: newPath,
|
|
244
|
-
newValue: nextValue
|
|
245
|
-
});
|
|
246
|
-
} else if (!(key in nextObj)) {
|
|
247
|
-
// Key was removed
|
|
248
|
-
changes.push({
|
|
249
|
-
type: "removed",
|
|
250
|
-
path: newPath,
|
|
251
|
-
oldValue: prevValue
|
|
252
|
-
});
|
|
253
|
-
} else if (prevValue !== nextValue) {
|
|
254
|
-
// Value changed - check if we should recurse
|
|
255
|
-
if (typeof prevValue === "object" && typeof nextValue === "object" && prevValue !== null && nextValue !== null && !Array.isArray(prevValue) && !Array.isArray(nextValue)) {
|
|
256
|
-
// Recurse into objects (but limit depth)
|
|
257
|
-
if (newPath.split(".").length < 3) {
|
|
258
|
-
changes.push(...findChanges(prevValue, nextValue, newPath));
|
|
259
|
-
} else {
|
|
260
|
-
changes.push({
|
|
261
|
-
type: "modified",
|
|
262
|
-
path: newPath,
|
|
263
|
-
oldValue: prevValue,
|
|
264
|
-
newValue: nextValue
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
changes.push({
|
|
269
|
-
type: "modified",
|
|
270
|
-
path: newPath,
|
|
271
|
-
oldValue: prevValue,
|
|
272
|
-
newValue: nextValue
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
return changes;
|
|
278
|
-
}
|
|
279
|
-
const styles = StyleSheet.create({
|
|
280
|
-
container: {
|
|
281
|
-
flex: 1
|
|
282
|
-
},
|
|
283
|
-
header: {
|
|
284
|
-
flexDirection: "row",
|
|
285
|
-
alignItems: "flex-start",
|
|
286
|
-
justifyContent: "space-between",
|
|
287
|
-
paddingHorizontal: 12,
|
|
288
|
-
paddingVertical: 12,
|
|
289
|
-
backgroundColor: night.color.surface,
|
|
290
|
-
borderBottomWidth: 1,
|
|
291
|
-
borderBottomColor: night.color.border
|
|
292
|
-
},
|
|
293
|
-
headerContent: {
|
|
294
|
-
flex: 1,
|
|
295
|
-
marginRight: 12
|
|
296
|
-
},
|
|
297
|
-
actionType: {
|
|
298
|
-
fontSize: 14,
|
|
299
|
-
fontWeight: "600",
|
|
300
|
-
color: night.color.text,
|
|
301
|
-
fontFamily: monoFont,
|
|
302
|
-
marginBottom: 6
|
|
303
|
-
},
|
|
304
|
-
headerMeta: {
|
|
305
|
-
flexDirection: "row",
|
|
306
|
-
alignItems: "center",
|
|
307
|
-
gap: 12
|
|
308
|
-
},
|
|
309
|
-
metaText: {
|
|
310
|
-
fontSize: 11,
|
|
311
|
-
color: night.color.textTertiary
|
|
312
|
-
},
|
|
313
|
-
durationText: {
|
|
314
|
-
fontSize: 11,
|
|
315
|
-
color: night.color.textTertiary,
|
|
316
|
-
fontFamily: monoFont
|
|
317
|
-
},
|
|
318
|
-
changeBadge: {
|
|
319
|
-
backgroundColor: macOSColors.semantic.warningBackground,
|
|
320
|
-
paddingHorizontal: 6,
|
|
321
|
-
paddingVertical: 2,
|
|
322
|
-
borderRadius: 4
|
|
323
|
-
},
|
|
324
|
-
changeBadgeText: {
|
|
325
|
-
fontSize: 10,
|
|
326
|
-
color: macOSColors.semantic.warning,
|
|
327
|
-
fontWeight: "600"
|
|
328
|
-
},
|
|
329
|
-
tabContainer: {
|
|
330
|
-
paddingHorizontal: 12,
|
|
331
|
-
paddingVertical: 8
|
|
332
|
-
},
|
|
333
|
-
content: {
|
|
334
|
-
flex: 1
|
|
335
|
-
},
|
|
336
|
-
section: {
|
|
337
|
-
paddingHorizontal: 12,
|
|
338
|
-
paddingBottom: 20
|
|
339
|
-
},
|
|
340
|
-
emptyText: {
|
|
341
|
-
fontSize: 12,
|
|
342
|
-
color: night.color.textTertiary,
|
|
343
|
-
fontStyle: "italic",
|
|
344
|
-
padding: 8
|
|
345
|
-
},
|
|
346
|
-
noChangeContainer: {
|
|
347
|
-
padding: 20,
|
|
348
|
-
alignItems: "center"
|
|
349
|
-
},
|
|
350
|
-
noChangeText: {
|
|
351
|
-
fontSize: 13,
|
|
352
|
-
color: night.color.textTertiary
|
|
353
|
-
},
|
|
354
|
-
diffItem: {
|
|
355
|
-
marginBottom: 12,
|
|
356
|
-
backgroundColor: night.color.surface,
|
|
357
|
-
borderRadius: 8,
|
|
358
|
-
borderWidth: 1,
|
|
359
|
-
borderColor: night.color.border,
|
|
360
|
-
overflow: "hidden"
|
|
361
|
-
},
|
|
362
|
-
diffHeader: {
|
|
363
|
-
flexDirection: "row",
|
|
364
|
-
alignItems: "center",
|
|
365
|
-
gap: 8,
|
|
366
|
-
padding: 8,
|
|
367
|
-
borderBottomWidth: 1,
|
|
368
|
-
borderBottomColor: night.color.border
|
|
369
|
-
},
|
|
370
|
-
diffTypeBadge: {
|
|
371
|
-
paddingHorizontal: 6,
|
|
372
|
-
paddingVertical: 2,
|
|
373
|
-
borderRadius: 4
|
|
374
|
-
},
|
|
375
|
-
diffTypeText: {
|
|
376
|
-
fontSize: 10,
|
|
377
|
-
fontWeight: "700"
|
|
378
|
-
},
|
|
379
|
-
diffPath: {
|
|
380
|
-
fontSize: 12,
|
|
381
|
-
color: night.color.text,
|
|
382
|
-
fontFamily: monoFont
|
|
383
|
-
},
|
|
384
|
-
diffValues: {
|
|
385
|
-
padding: 8,
|
|
386
|
-
gap: 8
|
|
387
|
-
},
|
|
388
|
-
diffValue: {
|
|
389
|
-
padding: 8
|
|
390
|
-
},
|
|
391
|
-
diffLabel: {
|
|
392
|
-
fontSize: 11,
|
|
393
|
-
color: night.color.textTertiary,
|
|
394
|
-
marginBottom: 4,
|
|
395
|
-
fontWeight: "600"
|
|
396
|
-
}
|
|
397
|
-
});
|
|
1
|
+
"use strict";import{useState as V}from"react";import{View as n,Text as d,StyleSheet as S,ScrollView as w}from"react-native";import{macOSColors as y,night as l,TabSelector as B,DataInspector as u,CollapsibleSection as b,CopyButton as z,monoFont as C}from"@buoy-gg/shared-ui";import{jsx as e,jsxs as i}from"react/jsx-runtime";export function ReduxActionDetailView({action:o}){const[a,s]=V("action");const r=[{key:"action",label:"Action"},{key:"state",label:"State"},{key:"diff",label:"Diff"}];const h=new Date(o.timestamp).toLocaleTimeString();const g=()=>{return JSON.stringify({type:o.type,payload:o.payload,timestamp:o.timestamp,duration:o.duration,hasStateChange:o.hasStateChange},null,2)};return i(n,{style:t.container,children:[i(n,{style:t.header,children:[i(n,{style:t.headerContent,children:[e(d,{style:t.actionType,numberOfLines:2,children:o.type}),i(n,{style:t.headerMeta,children:[e(d,{style:t.metaText,children:h}),o.duration!==void 0&&i(d,{style:t.durationText,children:[o.duration.toFixed(2),"ms"]}),o.hasStateChange&&e(n,{style:t.changeBadge,children:e(d,{style:t.changeBadgeText,children:"State Changed"})})]})]}),e(z,{value:g(),size:16})]}),e(n,{style:t.tabContainer,children:e(B,{tabs:r,activeTab:a,onTabChange:x=>s(x)})}),i(w,{style:t.content,showsVerticalScrollIndicator:true,children:[a==="action"&&i(n,{style:t.section,children:[e(b,{title:"Payload",defaultOpen:true,children:o.payload!==void 0?e(u,{data:o.payload}):e(d,{style:t.emptyText,children:"No payload"})}),e(b,{title:"Full Action",defaultOpen:false,children:e(u,{data:o.action})})]}),a==="state"&&i(n,{style:t.section,children:[e(b,{title:"Previous State",defaultOpen:false,children:e(u,{data:o.prevState})}),e(b,{title:"Next State",defaultOpen:true,children:e(u,{data:o.nextState})})]}),a==="diff"&&e(n,{style:t.section,children:o.hasStateChange?e(k,{prevState:o.prevState,nextState:o.nextState}):e(n,{style:t.noChangeContainer,children:e(d,{style:t.noChangeText,children:"No state changes from this action"})})})]})]})}function k({prevState:o,nextState:a}){const s=T(o,a);if(s.length===0){return e(n,{style:t.noChangeContainer,children:e(d,{style:t.noChangeText,children:"No differences detected"})})}return e(n,{children:s.map((r,h)=>i(n,{style:t.diffItem,children:[i(n,{style:t.diffHeader,children:[e(n,{style:[t.diffTypeBadge,{backgroundColor:r.type==="added"?y.semantic.successBackground:r.type==="removed"?y.semantic.errorBackground:y.semantic.warningBackground}],children:e(d,{style:[t.diffTypeText,{color:r.type==="added"?y.semantic.success:r.type==="removed"?y.semantic.error:y.semantic.warning}],children:r.type.toUpperCase()})}),e(d,{style:t.diffPath,children:r.path})]}),r.type==="modified"&&i(n,{style:t.diffValues,children:[i(n,{style:t.diffValue,children:[e(d,{style:t.diffLabel,children:"Before:"}),e(u,{data:r.oldValue})]}),i(n,{style:t.diffValue,children:[e(d,{style:t.diffLabel,children:"After:"}),e(u,{data:r.newValue})]})]}),r.type==="added"&&e(n,{style:t.diffValue,children:e(u,{data:r.newValue})}),r.type==="removed"&&e(n,{style:t.diffValue,children:e(u,{data:r.oldValue})})]},h))})}function T(o,a,s=""){const r=[];if(typeof o!=="object"||typeof a!=="object"){if(o!==a){r.push({type:"modified",path:s||"root",oldValue:o,newValue:a})}return r}if(o===null||a===null){if(o!==a){r.push({type:"modified",path:s||"root",oldValue:o,newValue:a})}return r}const h=o;const g=a;const x=new Set([...Object.keys(h),...Object.keys(g)]);for(const p of x){const m=s?`${s}.${p}`:p;const c=h[p];const f=g[p];if(!(p in h)){r.push({type:"added",path:m,newValue:f})}else if(!(p in g)){r.push({type:"removed",path:m,oldValue:c})}else if(c!==f){if(typeof c==="object"&&typeof f==="object"&&c!==null&&f!==null&&!Array.isArray(c)&&!Array.isArray(f)){if(m.split(".").length<3){r.push(...T(c,f,m))}else{r.push({type:"modified",path:m,oldValue:c,newValue:f})}}else{r.push({type:"modified",path:m,oldValue:c,newValue:f})}}}return r}const t=S.create({container:{flex:1},header:{flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",paddingHorizontal:12,paddingVertical:12,backgroundColor:l.color.surface,borderBottomWidth:1,borderBottomColor:l.color.border},headerContent:{flex:1,marginRight:12},actionType:{fontSize:14,fontWeight:"600",color:l.color.text,fontFamily:C,marginBottom:6},headerMeta:{flexDirection:"row",alignItems:"center",gap:12},metaText:{fontSize:11,color:l.color.textTertiary},durationText:{fontSize:11,color:l.color.textTertiary,fontFamily:C},changeBadge:{backgroundColor:y.semantic.warningBackground,paddingHorizontal:6,paddingVertical:2,borderRadius:4},changeBadgeText:{fontSize:10,color:y.semantic.warning,fontWeight:"600"},tabContainer:{paddingHorizontal:12,paddingVertical:8},content:{flex:1},section:{paddingHorizontal:12,paddingBottom:20},emptyText:{fontSize:12,color:l.color.textTertiary,fontStyle:"italic",padding:8},noChangeContainer:{padding:20,alignItems:"center"},noChangeText:{fontSize:13,color:l.color.textTertiary},diffItem:{marginBottom:12,backgroundColor:l.color.surface,borderRadius:8,borderWidth:1,borderColor:l.color.border,overflow:"hidden"},diffHeader:{flexDirection:"row",alignItems:"center",gap:8,padding:8,borderBottomWidth:1,borderBottomColor:l.color.border},diffTypeBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},diffTypeText:{fontSize:10,fontWeight:"700"},diffPath:{fontSize:12,color:l.color.text,fontFamily:C},diffValues:{padding:8,gap:8},diffValue:{padding:8},diffLabel:{fontSize:11,color:l.color.textTertiary,marginBottom:4,fontWeight:"600"}});
|