@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,362 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Compact list item for displaying a Redux action
|
|
5
|
-
* Uses shared CompactRow for consistent styling with React Query devtools
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { View, Text, StyleSheet } from "react-native";
|
|
9
|
-
import { CompactRow, buoyColors, Zap, AlertCircle, Clock, useRelativeTime } from "@buoy-gg/shared-ui";
|
|
10
|
-
import { reduxActionStore } from "../utils/reduxActionStore";
|
|
11
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
/**
|
|
13
|
-
* Color palette for async operation badges
|
|
14
|
-
* Each operation gets a distinct color to make matching easy
|
|
15
|
-
*/
|
|
16
|
-
const OPERATION_COLORS = [{
|
|
17
|
-
bg: "rgba(99, 102, 241, 0.25)",
|
|
18
|
-
text: "#818CF8"
|
|
19
|
-
},
|
|
20
|
-
// indigo
|
|
21
|
-
{
|
|
22
|
-
bg: "rgba(236, 72, 153, 0.25)",
|
|
23
|
-
text: "#F472B6"
|
|
24
|
-
},
|
|
25
|
-
// pink
|
|
26
|
-
{
|
|
27
|
-
bg: "rgba(14, 165, 233, 0.25)",
|
|
28
|
-
text: "#38BDF8"
|
|
29
|
-
},
|
|
30
|
-
// sky
|
|
31
|
-
{
|
|
32
|
-
bg: "rgba(245, 158, 11, 0.25)",
|
|
33
|
-
text: "#FBBF24"
|
|
34
|
-
},
|
|
35
|
-
// amber
|
|
36
|
-
{
|
|
37
|
-
bg: "rgba(16, 185, 129, 0.25)",
|
|
38
|
-
text: "#34D399"
|
|
39
|
-
},
|
|
40
|
-
// emerald
|
|
41
|
-
{
|
|
42
|
-
bg: "rgba(168, 85, 247, 0.25)",
|
|
43
|
-
text: "#C084FC"
|
|
44
|
-
},
|
|
45
|
-
// purple
|
|
46
|
-
{
|
|
47
|
-
bg: "rgba(239, 68, 68, 0.25)",
|
|
48
|
-
text: "#F87171"
|
|
49
|
-
},
|
|
50
|
-
// red
|
|
51
|
-
{
|
|
52
|
-
bg: "rgba(20, 184, 166, 0.25)",
|
|
53
|
-
text: "#2DD4BF"
|
|
54
|
-
} // teal
|
|
55
|
-
];
|
|
56
|
-
function getOperationColor(index) {
|
|
57
|
-
if (index <= 0) return {
|
|
58
|
-
bg: "rgba(142, 142, 147, 0.2)",
|
|
59
|
-
text: buoyColors.textSecondary
|
|
60
|
-
};
|
|
61
|
-
return OPERATION_COLORS[(index - 1) % OPERATION_COLORS.length];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Slice color palette - consistent colors per slice name
|
|
66
|
-
* Makes it easy to visually track actions from the same slice
|
|
67
|
-
*/
|
|
68
|
-
const SLICE_COLORS = {
|
|
69
|
-
cart: "#10B981",
|
|
70
|
-
// emerald - shopping/commerce
|
|
71
|
-
user: "#3B82F6",
|
|
72
|
-
// blue - user related
|
|
73
|
-
auth: "#8B5CF6",
|
|
74
|
-
// purple - authentication
|
|
75
|
-
app: "#6366F1",
|
|
76
|
-
// indigo - app-wide
|
|
77
|
-
ui: "#EC4899",
|
|
78
|
-
// pink - UI state
|
|
79
|
-
settings: "#F59E0B",
|
|
80
|
-
// amber - settings
|
|
81
|
-
api: "#14B8A6",
|
|
82
|
-
// teal - API calls
|
|
83
|
-
data: "#06B6D4" // cyan - data management
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get consistent color for a slice based on its name
|
|
88
|
-
*/
|
|
89
|
-
function getSliceColor(sliceName) {
|
|
90
|
-
if (!sliceName) return "#6B7280"; // gray for unknown
|
|
91
|
-
|
|
92
|
-
const lowerSlice = sliceName.toLowerCase();
|
|
93
|
-
|
|
94
|
-
// Check for exact match first
|
|
95
|
-
if (SLICE_COLORS[lowerSlice]) {
|
|
96
|
-
return SLICE_COLORS[lowerSlice];
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Check for partial matches
|
|
100
|
-
for (const [key, color] of Object.entries(SLICE_COLORS)) {
|
|
101
|
-
if (lowerSlice.includes(key)) {
|
|
102
|
-
return color;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Generate consistent color from slice name hash
|
|
107
|
-
const hash = sliceName.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
108
|
-
const hue = hash * 137 % 360;
|
|
109
|
-
return `hsl(${hue}, 70%, 60%)`;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get status label based on category and slice
|
|
114
|
-
*/
|
|
115
|
-
function getStatusLabel(category, sliceName) {
|
|
116
|
-
switch (category) {
|
|
117
|
-
case "pending":
|
|
118
|
-
return "Pending";
|
|
119
|
-
case "fulfilled":
|
|
120
|
-
return "Success";
|
|
121
|
-
case "rejected":
|
|
122
|
-
return "Error";
|
|
123
|
-
case "internal":
|
|
124
|
-
return "Internal";
|
|
125
|
-
case "query":
|
|
126
|
-
return "Query";
|
|
127
|
-
case "mutation":
|
|
128
|
-
return "Mutation";
|
|
129
|
-
default:
|
|
130
|
-
// For regular actions, show slice name if available
|
|
131
|
-
return sliceName ? sliceName.charAt(0).toUpperCase() + sliceName.slice(1) : "Action";
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Get color for action category
|
|
137
|
-
*/
|
|
138
|
-
function getStatusColor(category, hasStateChange, sliceName) {
|
|
139
|
-
switch (category) {
|
|
140
|
-
case "pending":
|
|
141
|
-
return buoyColors.warning;
|
|
142
|
-
case "fulfilled":
|
|
143
|
-
return buoyColors.success;
|
|
144
|
-
case "rejected":
|
|
145
|
-
return buoyColors.error;
|
|
146
|
-
case "internal":
|
|
147
|
-
return buoyColors.textMuted;
|
|
148
|
-
case "query":
|
|
149
|
-
return buoyColors.info;
|
|
150
|
-
case "mutation":
|
|
151
|
-
return buoyColors.info;
|
|
152
|
-
default:
|
|
153
|
-
// For regular actions, use slice-based color
|
|
154
|
-
return getSliceColor(sliceName);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Get sublabel with duration and diff info
|
|
160
|
-
*/
|
|
161
|
-
function getSublabel(action) {
|
|
162
|
-
const parts = [];
|
|
163
|
-
|
|
164
|
-
// Add duration if available and meaningful
|
|
165
|
-
if (action.duration !== undefined && action.duration >= 0.1) {
|
|
166
|
-
parts.push(`${action.duration.toFixed(1)}ms`);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Add diff summary - be more descriptive
|
|
170
|
-
if (action.hasStateChange) {
|
|
171
|
-
if (action.changedKeysCount && action.changedKeysCount > 0) {
|
|
172
|
-
parts.push(`${action.changedKeysCount} key${action.changedKeysCount > 1 ? 's' : ''} changed`);
|
|
173
|
-
} else {
|
|
174
|
-
parts.push(action.diffSummary || "state changed");
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
parts.push("no state change");
|
|
178
|
-
}
|
|
179
|
-
return parts.join(" · ");
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Get action name badge text
|
|
184
|
-
*/
|
|
185
|
-
function getActionBadge(action) {
|
|
186
|
-
// Show the action name in uppercase (e.g., ADDITEM, ORDERCOMPLETED)
|
|
187
|
-
return action.actionName?.toUpperCase() || action.type.split('/').pop()?.toUpperCase() || "";
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Get primary text - use action name for cleaner display
|
|
192
|
-
*/
|
|
193
|
-
function getPrimaryText(action) {
|
|
194
|
-
// For internal actions, show the full type
|
|
195
|
-
if (action.category === "internal") {
|
|
196
|
-
return action.type;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// For others, show slice/actionName format
|
|
200
|
-
if (action.sliceName) {
|
|
201
|
-
return `${action.sliceName}/${action.actionName.toLowerCase()}`;
|
|
202
|
-
}
|
|
203
|
-
return action.type;
|
|
204
|
-
}
|
|
205
|
-
export function ReduxActionItem({
|
|
206
|
-
action,
|
|
207
|
-
onPress
|
|
208
|
-
}) {
|
|
209
|
-
const relativeTime = useRelativeTime(action.timestamp);
|
|
210
|
-
const sliceName = action.sliceName ?? undefined;
|
|
211
|
-
const statusColor = getStatusColor(action.category, action.hasStateChange, sliceName);
|
|
212
|
-
const statusLabel = getStatusLabel(action.category, sliceName);
|
|
213
|
-
const sublabel = getSublabel(action);
|
|
214
|
-
const primaryText = getPrimaryText(action);
|
|
215
|
-
const actionBadge = getActionBadge(action);
|
|
216
|
-
|
|
217
|
-
// Check for linked async actions
|
|
218
|
-
const linkedActions = reduxActionStore.getLinkedActions(action);
|
|
219
|
-
const linkedCount = linkedActions.length;
|
|
220
|
-
const hasLinkedActions = linkedCount > 1;
|
|
221
|
-
|
|
222
|
-
// Get position in async sequence (1/2, 2/2, etc.)
|
|
223
|
-
const asyncPosition = hasLinkedActions ? linkedActions.findIndex(a => a.id === action.id) + 1 : 0;
|
|
224
|
-
|
|
225
|
-
// Get sequential operation index to distinguish concurrent requests (#1, #2, etc.)
|
|
226
|
-
const operationIndex = hasLinkedActions && action.meta?.requestId ? reduxActionStore.getAsyncOperationIndex(action.meta.requestId) : 0;
|
|
227
|
-
|
|
228
|
-
// Get color for this operation's badge
|
|
229
|
-
const opColor = getOperationColor(operationIndex);
|
|
230
|
-
|
|
231
|
-
// Custom badge showing state change, slow action, or linked indicator
|
|
232
|
-
let customBadge = undefined;
|
|
233
|
-
if (action.isSlowAction) {
|
|
234
|
-
// Show slow action warning
|
|
235
|
-
customBadge = /*#__PURE__*/_jsxs(View, {
|
|
236
|
-
style: styles.badgeContainer,
|
|
237
|
-
children: [hasLinkedActions && /*#__PURE__*/_jsx(View, {
|
|
238
|
-
style: [styles.asyncSequenceBadge, {
|
|
239
|
-
backgroundColor: opColor.bg
|
|
240
|
-
}],
|
|
241
|
-
children: /*#__PURE__*/_jsxs(Text, {
|
|
242
|
-
style: [styles.asyncSequenceText, {
|
|
243
|
-
color: opColor.text
|
|
244
|
-
}],
|
|
245
|
-
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
246
|
-
})
|
|
247
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
248
|
-
style: styles.slowBadge,
|
|
249
|
-
children: /*#__PURE__*/_jsx(Clock, {
|
|
250
|
-
size: 12,
|
|
251
|
-
color: buoyColors.error
|
|
252
|
-
})
|
|
253
|
-
})]
|
|
254
|
-
});
|
|
255
|
-
} else if (action.category === "rejected") {
|
|
256
|
-
// Show error badge for rejected actions
|
|
257
|
-
customBadge = /*#__PURE__*/_jsxs(View, {
|
|
258
|
-
style: styles.badgeContainer,
|
|
259
|
-
children: [hasLinkedActions && /*#__PURE__*/_jsx(View, {
|
|
260
|
-
style: [styles.asyncSequenceBadge, {
|
|
261
|
-
backgroundColor: opColor.bg
|
|
262
|
-
}],
|
|
263
|
-
children: /*#__PURE__*/_jsxs(Text, {
|
|
264
|
-
style: [styles.asyncSequenceText, {
|
|
265
|
-
color: opColor.text
|
|
266
|
-
}],
|
|
267
|
-
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
268
|
-
})
|
|
269
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
270
|
-
style: styles.errorBadge,
|
|
271
|
-
children: /*#__PURE__*/_jsx(AlertCircle, {
|
|
272
|
-
size: 12,
|
|
273
|
-
color: buoyColors.error
|
|
274
|
-
})
|
|
275
|
-
})]
|
|
276
|
-
});
|
|
277
|
-
} else if (hasLinkedActions) {
|
|
278
|
-
// Show linked indicator for async actions
|
|
279
|
-
customBadge = /*#__PURE__*/_jsxs(View, {
|
|
280
|
-
style: styles.badgeContainer,
|
|
281
|
-
children: [/*#__PURE__*/_jsx(View, {
|
|
282
|
-
style: [styles.asyncSequenceBadge, {
|
|
283
|
-
backgroundColor: opColor.bg
|
|
284
|
-
}],
|
|
285
|
-
children: /*#__PURE__*/_jsxs(Text, {
|
|
286
|
-
style: [styles.asyncSequenceText, {
|
|
287
|
-
color: opColor.text
|
|
288
|
-
}],
|
|
289
|
-
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
290
|
-
})
|
|
291
|
-
}), action.hasStateChange && /*#__PURE__*/_jsx(View, {
|
|
292
|
-
style: styles.changeBadge,
|
|
293
|
-
children: /*#__PURE__*/_jsx(Zap, {
|
|
294
|
-
size: 12,
|
|
295
|
-
color: buoyColors.warning
|
|
296
|
-
})
|
|
297
|
-
})]
|
|
298
|
-
});
|
|
299
|
-
} else if (action.hasStateChange) {
|
|
300
|
-
// Show state change indicator with action badge
|
|
301
|
-
customBadge = /*#__PURE__*/_jsxs(View, {
|
|
302
|
-
style: styles.badgeContainer,
|
|
303
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
304
|
-
style: [styles.actionBadgeText, {
|
|
305
|
-
color: statusColor
|
|
306
|
-
}],
|
|
307
|
-
children: actionBadge
|
|
308
|
-
}), /*#__PURE__*/_jsx(View, {
|
|
309
|
-
style: styles.changeBadge,
|
|
310
|
-
children: /*#__PURE__*/_jsx(Zap, {
|
|
311
|
-
size: 12,
|
|
312
|
-
color: buoyColors.warning
|
|
313
|
-
})
|
|
314
|
-
})]
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
return /*#__PURE__*/_jsx(CompactRow, {
|
|
318
|
-
statusDotColor: statusColor,
|
|
319
|
-
statusLabel: statusLabel,
|
|
320
|
-
statusSublabel: sublabel,
|
|
321
|
-
primaryText: primaryText,
|
|
322
|
-
bottomRightText: relativeTime
|
|
323
|
-
// Use customBadge if we have special indicators, otherwise show action badge as text
|
|
324
|
-
,
|
|
325
|
-
customBadge: customBadge,
|
|
326
|
-
badgeText: customBadge ? undefined : actionBadge,
|
|
327
|
-
badgeColor: statusColor,
|
|
328
|
-
showChevron: true,
|
|
329
|
-
onPress: () => onPress(action)
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
const styles = StyleSheet.create({
|
|
333
|
-
badgeContainer: {
|
|
334
|
-
flexDirection: "row",
|
|
335
|
-
alignItems: "center",
|
|
336
|
-
gap: 4
|
|
337
|
-
},
|
|
338
|
-
actionBadgeText: {
|
|
339
|
-
fontSize: 11,
|
|
340
|
-
fontWeight: "600",
|
|
341
|
-
fontFamily: "monospace"
|
|
342
|
-
},
|
|
343
|
-
changeBadge: {
|
|
344
|
-
paddingHorizontal: 4
|
|
345
|
-
},
|
|
346
|
-
slowBadge: {
|
|
347
|
-
paddingHorizontal: 4
|
|
348
|
-
},
|
|
349
|
-
errorBadge: {
|
|
350
|
-
paddingHorizontal: 4
|
|
351
|
-
},
|
|
352
|
-
asyncSequenceBadge: {
|
|
353
|
-
paddingHorizontal: 6,
|
|
354
|
-
paddingVertical: 2,
|
|
355
|
-
borderRadius: 4
|
|
356
|
-
},
|
|
357
|
-
asyncSequenceText: {
|
|
358
|
-
fontSize: 10,
|
|
359
|
-
fontWeight: "600",
|
|
360
|
-
fontFamily: "monospace"
|
|
361
|
-
}
|
|
362
|
-
});
|
|
1
|
+
"use strict";import{View,Text,StyleSheet}from"react-native";import{CompactRow,buoyColors,Zap,AlertCircle,Clock,useRelativeTime}from"@buoy-gg/shared-ui";import{reduxActionStore}from"../utils/reduxActionStore";import{jsxs as _jsxs,jsx as _jsx}from"react/jsx-runtime";const OPERATION_COLORS=[{bg:"rgba(99, 102, 241, 0.25)",text:"#818CF8"},{bg:"rgba(236, 72, 153, 0.25)",text:"#F472B6"},{bg:"rgba(14, 165, 233, 0.25)",text:"#38BDF8"},{bg:"rgba(245, 158, 11, 0.25)",text:"#FBBF24"},{bg:"rgba(16, 185, 129, 0.25)",text:"#34D399"},{bg:"rgba(168, 85, 247, 0.25)",text:"#C084FC"},{bg:"rgba(239, 68, 68, 0.25)",text:"#F87171"},{bg:"rgba(20, 184, 166, 0.25)",text:"#2DD4BF"}];function getOperationColor(e){return e<=0?{bg:"rgba(142, 142, 147, 0.2)",text:buoyColors.textSecondary}:OPERATION_COLORS[(e-1)%OPERATION_COLORS.length]}const SLICE_COLORS={cart:"#10B981",user:"#3B82F6",auth:"#8B5CF6",app:"#6366F1",ui:"#EC4899",settings:"#F59E0B",api:"#14B8A6",data:"#06B6D4"};function getSliceColor(e){if(!e)return"#6B7280";const t=e.toLowerCase();if(SLICE_COLORS[t])return SLICE_COLORS[t];for(const[e,r]of Object.entries(SLICE_COLORS))if(t.includes(e))return r;return`hsl(${137*e.split("").reduce((e,t)=>e+t.charCodeAt(0),0)%360}, 70%, 60%)`}function getStatusLabel(e,t){switch(e){case"pending":return"Pending";case"fulfilled":return"Success";case"rejected":return"Error";case"internal":return"Internal";case"query":return"Query";case"mutation":return"Mutation";default:return t?t.charAt(0).toUpperCase()+t.slice(1):"Action"}}function getStatusColor(e,t,r){switch(e){case"pending":return buoyColors.warning;case"fulfilled":return buoyColors.success;case"rejected":return buoyColors.error;case"internal":return buoyColors.textMuted;case"query":case"mutation":return buoyColors.info;default:return getSliceColor(r)}}function getSublabel(e){const t=[];return void 0!==e.duration&&e.duration>=.1&&t.push(`${e.duration.toFixed(1)}ms`),e.hasStateChange?e.changedKeysCount&&e.changedKeysCount>0?t.push(`${e.changedKeysCount} key${e.changedKeysCount>1?"s":""} changed`):t.push(e.diffSummary||"state changed"):t.push("no state change"),t.join(" · ")}function getActionBadge(e){return e.actionName?.toUpperCase()||e.type.split("/").pop()?.toUpperCase()||""}function getPrimaryText(e){return"internal"===e.category?e.type:e.sliceName?`${e.sliceName}/${e.actionName.toLowerCase()}`:e.type}export function ReduxActionItem({action:e,onPress:t}){const r=useRelativeTime(e.timestamp),o=e.sliceName??void 0,s=getStatusColor(e.category,e.hasStateChange,o),n=getStatusLabel(e.category,o),a=getSublabel(e),i=getPrimaryText(e),c=getActionBadge(e),l=reduxActionStore.getLinkedActions(e),u=l.length,g=u>1,d=g?l.findIndex(t=>t.id===e.id)+1:0,y=g&&e.meta?.requestId?reduxActionStore.getAsyncOperationIndex(e.meta.requestId):0,x=getOperationColor(y);let C;return e.isSlowAction?C=_jsxs(View,{style:styles.badgeContainer,children:[g&&_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:x.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:x.text}],children:[d,"/",u," #",y]})}),_jsx(View,{style:styles.slowBadge,children:_jsx(Clock,{size:12,color:buoyColors.error})})]}):"rejected"===e.category?C=_jsxs(View,{style:styles.badgeContainer,children:[g&&_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:x.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:x.text}],children:[d,"/",u," #",y]})}),_jsx(View,{style:styles.errorBadge,children:_jsx(AlertCircle,{size:12,color:buoyColors.error})})]}):g?C=_jsxs(View,{style:styles.badgeContainer,children:[_jsx(View,{style:[styles.asyncSequenceBadge,{backgroundColor:x.bg}],children:_jsxs(Text,{style:[styles.asyncSequenceText,{color:x.text}],children:[d,"/",u," #",y]})}),e.hasStateChange&&_jsx(View,{style:styles.changeBadge,children:_jsx(Zap,{size:12,color:buoyColors.warning})})]}):e.hasStateChange&&(C=_jsxs(View,{style:styles.badgeContainer,children:[_jsx(Text,{style:[styles.actionBadgeText,{color:s}],children:c}),_jsx(View,{style:styles.changeBadge,children:_jsx(Zap,{size:12,color:buoyColors.warning})})]})),_jsx(CompactRow,{statusDotColor:s,statusLabel:n,statusSublabel:a,primaryText:i,bottomRightText:r,customBadge:C,badgeText:C?void 0:c,badgeColor:s,showChevron:!0,onPress:()=>t(e)})}const styles=StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},actionBadgeText:{fontSize:11,fontWeight:"600",fontFamily:"monospace"},changeBadge:{paddingHorizontal:4},slowBadge:{paddingHorizontal:4},errorBadge:{paddingHorizontal:4},asyncSequenceBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},asyncSequenceText:{fontSize:10,fontWeight:"600",fontFamily:"monospace"}});
|
|
@@ -1,129 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* ReduxDetailViewToggle
|
|
5
|
-
*
|
|
6
|
-
* Three-card toggle for switching between Action, State, and Diff views.
|
|
7
|
-
* Redux-specific component for the enhanced detail view.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import React, { memo } from "react";
|
|
11
|
-
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
12
|
-
import { macOSColors, FileText, Database, GitBranch } from "@buoy-gg/shared-ui";
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const VIEW_CONFIGS = [{
|
|
15
|
-
key: "action",
|
|
16
|
-
label: "ACTION",
|
|
17
|
-
description: "View action details",
|
|
18
|
-
icon: FileText,
|
|
19
|
-
activeColor: macOSColors.semantic.warning
|
|
20
|
-
}, {
|
|
21
|
-
key: "state",
|
|
22
|
-
label: "STATE",
|
|
23
|
-
description: "View current state",
|
|
24
|
-
icon: Database,
|
|
25
|
-
activeColor: macOSColors.semantic.info
|
|
26
|
-
}, {
|
|
27
|
-
key: "diff",
|
|
28
|
-
label: "DIFF",
|
|
29
|
-
description: "Compare changes",
|
|
30
|
-
icon: GitBranch,
|
|
31
|
-
activeColor: macOSColors.semantic.success
|
|
32
|
-
}];
|
|
33
|
-
export const ReduxDetailViewToggle = /*#__PURE__*/memo(function ReduxDetailViewToggle({
|
|
34
|
-
activeView,
|
|
35
|
-
onViewChange,
|
|
36
|
-
diffDisabled = false
|
|
37
|
-
}) {
|
|
38
|
-
return /*#__PURE__*/_jsx(View, {
|
|
39
|
-
style: styles.container,
|
|
40
|
-
children: VIEW_CONFIGS.map(config => {
|
|
41
|
-
const isActive = activeView === config.key;
|
|
42
|
-
const isDisabled = config.key === "diff" && diffDisabled;
|
|
43
|
-
const IconComponent = config.icon;
|
|
44
|
-
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
45
|
-
style: [styles.card, isActive && [styles.cardActive, {
|
|
46
|
-
borderColor: config.activeColor
|
|
47
|
-
}], isDisabled && styles.cardDisabled],
|
|
48
|
-
onPress: () => !isDisabled && onViewChange(config.key),
|
|
49
|
-
activeOpacity: isDisabled ? 1 : 0.8,
|
|
50
|
-
disabled: isDisabled,
|
|
51
|
-
children: [/*#__PURE__*/_jsxs(View, {
|
|
52
|
-
style: styles.cardContent,
|
|
53
|
-
children: [/*#__PURE__*/_jsx(IconComponent, {
|
|
54
|
-
size: 14,
|
|
55
|
-
color: isActive ? config.activeColor : isDisabled ? macOSColors.text.muted : macOSColors.text.secondary
|
|
56
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
57
|
-
style: [styles.cardLabel, isActive && [styles.cardLabelActive, {
|
|
58
|
-
color: config.activeColor
|
|
59
|
-
}], isDisabled && styles.cardLabelDisabled],
|
|
60
|
-
children: config.label
|
|
61
|
-
})]
|
|
62
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
63
|
-
style: [styles.cardDescription, isActive && styles.cardDescriptionActive, isDisabled && styles.cardDescriptionDisabled],
|
|
64
|
-
children: config.description
|
|
65
|
-
})]
|
|
66
|
-
}, config.key);
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
const styles = StyleSheet.create({
|
|
71
|
-
container: {
|
|
72
|
-
flexDirection: "row",
|
|
73
|
-
gap: 8,
|
|
74
|
-
padding: 14,
|
|
75
|
-
backgroundColor: macOSColors.background.base
|
|
76
|
-
},
|
|
77
|
-
card: {
|
|
78
|
-
flex: 1,
|
|
79
|
-
backgroundColor: macOSColors.background.card,
|
|
80
|
-
borderRadius: 12,
|
|
81
|
-
borderWidth: 1,
|
|
82
|
-
borderColor: macOSColors.border.default,
|
|
83
|
-
padding: 10,
|
|
84
|
-
gap: 4
|
|
85
|
-
},
|
|
86
|
-
cardActive: {
|
|
87
|
-
borderWidth: 1.5,
|
|
88
|
-
backgroundColor: "rgba(0, 184, 230, 0.05)",
|
|
89
|
-
shadowColor: macOSColors.semantic.info,
|
|
90
|
-
shadowOffset: {
|
|
91
|
-
width: 0,
|
|
92
|
-
height: 2
|
|
93
|
-
},
|
|
94
|
-
shadowOpacity: 0.1,
|
|
95
|
-
shadowRadius: 8,
|
|
96
|
-
elevation: 3
|
|
97
|
-
},
|
|
98
|
-
cardDisabled: {
|
|
99
|
-
opacity: 0.5
|
|
100
|
-
},
|
|
101
|
-
cardContent: {
|
|
102
|
-
flexDirection: "row",
|
|
103
|
-
alignItems: "center",
|
|
104
|
-
gap: 6
|
|
105
|
-
},
|
|
106
|
-
cardLabel: {
|
|
107
|
-
fontSize: 10,
|
|
108
|
-
fontWeight: "700",
|
|
109
|
-
letterSpacing: 0.5,
|
|
110
|
-
color: macOSColors.text.secondary
|
|
111
|
-
},
|
|
112
|
-
cardLabelActive: {
|
|
113
|
-
color: macOSColors.text.primary
|
|
114
|
-
},
|
|
115
|
-
cardLabelDisabled: {
|
|
116
|
-
color: macOSColors.text.muted
|
|
117
|
-
},
|
|
118
|
-
cardDescription: {
|
|
119
|
-
fontSize: 9,
|
|
120
|
-
color: macOSColors.text.muted,
|
|
121
|
-
lineHeight: 12
|
|
122
|
-
},
|
|
123
|
-
cardDescriptionActive: {
|
|
124
|
-
color: macOSColors.text.secondary
|
|
125
|
-
},
|
|
126
|
-
cardDescriptionDisabled: {
|
|
127
|
-
color: macOSColors.text.muted
|
|
128
|
-
}
|
|
129
|
-
});
|
|
1
|
+
"use strict";import React,{memo}from"react";import{View,Text,TouchableOpacity,StyleSheet}from"react-native";import{macOSColors,FileText,Database,GitBranch}from"@buoy-gg/shared-ui";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";const VIEW_CONFIGS=[{key:"action",label:"ACTION",description:"View action details",icon:FileText,activeColor:macOSColors.semantic.warning},{key:"state",label:"STATE",description:"View current state",icon:Database,activeColor:macOSColors.semantic.info},{key:"diff",label:"DIFF",description:"Compare changes",icon:GitBranch,activeColor:macOSColors.semantic.success}];export const ReduxDetailViewToggle=memo(function({activeView:e,onViewChange:o,diffDisabled:t=!1}){return _jsx(View,{style:styles.container,children:VIEW_CONFIGS.map(a=>{const r=e===a.key,c="diff"===a.key&&t,i=a.icon;return _jsxs(TouchableOpacity,{style:[styles.card,r&&[styles.cardActive,{borderColor:a.activeColor}],c&&styles.cardDisabled],onPress:()=>!c&&o(a.key),activeOpacity:c?1:.8,disabled:c,children:[_jsxs(View,{style:styles.cardContent,children:[_jsx(i,{size:14,color:r?a.activeColor:c?macOSColors.text.muted:macOSColors.text.secondary}),_jsx(Text,{style:[styles.cardLabel,r&&[styles.cardLabelActive,{color:a.activeColor}],c&&styles.cardLabelDisabled],children:a.label})]}),_jsx(Text,{style:[styles.cardDescription,r&&styles.cardDescriptionActive,c&&styles.cardDescriptionDisabled],children:a.description})]},a.key)})})});const styles=StyleSheet.create({container:{flexDirection:"row",gap:8,padding:14,backgroundColor:macOSColors.background.base},card:{flex:1,backgroundColor:macOSColors.background.card,borderRadius:12,borderWidth:1,borderColor:macOSColors.border.default,padding:10,gap:4},cardActive:{borderWidth:1.5,backgroundColor:"rgba(0, 184, 230, 0.05)",shadowColor:macOSColors.semantic.info,shadowOffset:{width:0,height:2},shadowOpacity:.1,shadowRadius:8,elevation:3},cardDisabled:{opacity:.5},cardContent:{flexDirection:"row",alignItems:"center",gap:6},cardLabel:{fontSize:10,fontWeight:"700",letterSpacing:.5,color:macOSColors.text.secondary},cardLabelActive:{color:macOSColors.text.primary},cardLabelDisabled:{color:macOSColors.text.muted},cardDescription:{fontSize:9,color:macOSColors.text.muted,lineHeight:12},cardDescriptionActive:{color:macOSColors.text.secondary},cardDescriptionDisabled:{color:macOSColors.text.muted}});
|
|
@@ -1,8 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Redux DevTools icon
|
|
5
|
-
* Re-exports from floating-tools-core for consistency
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { ReduxIcon, REDUX_ICON_COLOR } from "@buoy-gg/floating-tools-core";
|
|
1
|
+
"use strict";export{ReduxIcon,REDUX_ICON_COLOR}from"@buoy-gg/floating-tools-core";
|