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