@buoy-gg/redux 7.0.41 → 7.0.43
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 -106
- 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 -337
- 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 -17
- package/lib/commonjs/redux/hooks/reduxPeer.web.js +1 -10
- package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +1 -177
- 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 -333
- 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 -13
- package/lib/module/redux/hooks/reduxPeer.web.js +1 -6
- package/lib/module/redux/hooks/useAutoInstrumentRedux.js +1 -173
- 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/web/index.mjs +1 -2
- package/package.json +5 -8
- 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/reduxPeer.d.ts.map +0 -1
- package/lib/typescript/redux/hooks/reduxPeer.web.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,337 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReduxActionItem = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
|
-
var _reduxActionStore = require("../utils/reduxActionStore");
|
|
11
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
/**
|
|
13
|
-
* Compact list item for displaying a Redux action
|
|
14
|
-
* Uses shared CompactRow for consistent styling with React Query devtools
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Color palette for async operation badges
|
|
19
|
-
* Each operation gets a distinct color to make matching easy
|
|
20
|
-
*/
|
|
21
|
-
const OPERATION_COLORS = [{
|
|
22
|
-
bg: "rgba(99, 102, 241, 0.25)",
|
|
23
|
-
text: "#818CF8"
|
|
24
|
-
},
|
|
25
|
-
// indigo
|
|
26
|
-
{
|
|
27
|
-
bg: "rgba(236, 72, 153, 0.25)",
|
|
28
|
-
text: "#F472B6"
|
|
29
|
-
},
|
|
30
|
-
// pink
|
|
31
|
-
{
|
|
32
|
-
bg: "rgba(14, 165, 233, 0.25)",
|
|
33
|
-
text: "#38BDF8"
|
|
34
|
-
},
|
|
35
|
-
// sky
|
|
36
|
-
{
|
|
37
|
-
bg: "rgba(245, 158, 11, 0.25)",
|
|
38
|
-
text: "#FBBF24"
|
|
39
|
-
},
|
|
40
|
-
// amber
|
|
41
|
-
{
|
|
42
|
-
bg: "rgba(16, 185, 129, 0.25)",
|
|
43
|
-
text: "#34D399"
|
|
44
|
-
},
|
|
45
|
-
// emerald
|
|
46
|
-
{
|
|
47
|
-
bg: "rgba(168, 85, 247, 0.25)",
|
|
48
|
-
text: "#C084FC"
|
|
49
|
-
},
|
|
50
|
-
// purple
|
|
51
|
-
{
|
|
52
|
-
bg: "rgba(239, 68, 68, 0.25)",
|
|
53
|
-
text: "#F87171"
|
|
54
|
-
},
|
|
55
|
-
// red
|
|
56
|
-
{
|
|
57
|
-
bg: "rgba(20, 184, 166, 0.25)",
|
|
58
|
-
text: "#2DD4BF"
|
|
59
|
-
} // teal
|
|
60
|
-
];
|
|
61
|
-
function getOperationColor(index) {
|
|
62
|
-
if (index <= 0) return {
|
|
63
|
-
bg: "rgba(142, 142, 147, 0.2)",
|
|
64
|
-
text: _sharedUi.buoyColors.textSecondary
|
|
65
|
-
};
|
|
66
|
-
return OPERATION_COLORS[(index - 1) % OPERATION_COLORS.length];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Slice color palette - consistent colors per slice name
|
|
71
|
-
* Makes it easy to visually track actions from the same slice
|
|
72
|
-
*/
|
|
73
|
-
const SLICE_COLORS = {
|
|
74
|
-
cart: "#10B981",
|
|
75
|
-
// emerald - shopping/commerce
|
|
76
|
-
user: "#3B82F6",
|
|
77
|
-
// blue - user related
|
|
78
|
-
auth: "#8B5CF6",
|
|
79
|
-
// purple - authentication
|
|
80
|
-
app: "#6366F1",
|
|
81
|
-
// indigo - app-wide
|
|
82
|
-
ui: "#EC4899",
|
|
83
|
-
// pink - UI state
|
|
84
|
-
settings: "#F59E0B",
|
|
85
|
-
// amber - settings
|
|
86
|
-
api: "#14B8A6",
|
|
87
|
-
// teal - API calls
|
|
88
|
-
data: "#06B6D4" // cyan - data management
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Get consistent color for a slice based on its name
|
|
93
|
-
*/
|
|
94
|
-
function getSliceColor(sliceName) {
|
|
95
|
-
if (!sliceName) return "#6B7280"; // gray for unknown
|
|
96
|
-
|
|
97
|
-
const lowerSlice = sliceName.toLowerCase();
|
|
98
|
-
|
|
99
|
-
// Check for exact match first
|
|
100
|
-
if (SLICE_COLORS[lowerSlice]) {
|
|
101
|
-
return SLICE_COLORS[lowerSlice];
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Check for partial matches
|
|
105
|
-
for (const [key, color] of Object.entries(SLICE_COLORS)) {
|
|
106
|
-
if (lowerSlice.includes(key)) {
|
|
107
|
-
return color;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Generate consistent color from slice name hash
|
|
112
|
-
const hash = sliceName.split('').reduce((acc, char) => acc + char.charCodeAt(0), 0);
|
|
113
|
-
const hue = hash * 137 % 360;
|
|
114
|
-
return `hsl(${hue}, 70%, 60%)`;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Get status label based on category and slice
|
|
119
|
-
*/
|
|
120
|
-
function getStatusLabel(category, sliceName) {
|
|
121
|
-
switch (category) {
|
|
122
|
-
case "pending":
|
|
123
|
-
return "Pending";
|
|
124
|
-
case "fulfilled":
|
|
125
|
-
return "Success";
|
|
126
|
-
case "rejected":
|
|
127
|
-
return "Error";
|
|
128
|
-
case "internal":
|
|
129
|
-
return "Internal";
|
|
130
|
-
case "query":
|
|
131
|
-
return "Query";
|
|
132
|
-
case "mutation":
|
|
133
|
-
return "Mutation";
|
|
134
|
-
default:
|
|
135
|
-
// For regular actions, show slice name if available
|
|
136
|
-
return sliceName ? sliceName.charAt(0).toUpperCase() + sliceName.slice(1) : "Action";
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Get color for action category
|
|
142
|
-
*/
|
|
143
|
-
function getStatusColor(category, hasStateChange, sliceName) {
|
|
144
|
-
switch (category) {
|
|
145
|
-
case "pending":
|
|
146
|
-
return _sharedUi.buoyColors.warning;
|
|
147
|
-
case "fulfilled":
|
|
148
|
-
return _sharedUi.buoyColors.success;
|
|
149
|
-
case "rejected":
|
|
150
|
-
return _sharedUi.buoyColors.error;
|
|
151
|
-
case "internal":
|
|
152
|
-
return _sharedUi.buoyColors.textMuted;
|
|
153
|
-
case "query":
|
|
154
|
-
return _sharedUi.buoyColors.info;
|
|
155
|
-
case "mutation":
|
|
156
|
-
return _sharedUi.buoyColors.info;
|
|
157
|
-
default:
|
|
158
|
-
// For regular actions, use slice-based color
|
|
159
|
-
return getSliceColor(sliceName);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Get sublabel with duration and diff info
|
|
165
|
-
*/
|
|
166
|
-
function getSublabel(action) {
|
|
167
|
-
const parts = [];
|
|
168
|
-
|
|
169
|
-
// Add duration if available and meaningful
|
|
170
|
-
if (action.duration !== undefined && action.duration >= 0.1) {
|
|
171
|
-
parts.push(`${action.duration.toFixed(1)}ms`);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Add diff summary - be more descriptive
|
|
175
|
-
if (action.hasStateChange) {
|
|
176
|
-
if (action.changedKeysCount && action.changedKeysCount > 0) {
|
|
177
|
-
parts.push(`${action.changedKeysCount} key${action.changedKeysCount > 1 ? 's' : ''} changed`);
|
|
178
|
-
} else {
|
|
179
|
-
parts.push(action.diffSummary || "state changed");
|
|
180
|
-
}
|
|
181
|
-
} else {
|
|
182
|
-
parts.push("no state change");
|
|
183
|
-
}
|
|
184
|
-
return parts.join(" · ");
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Get action name badge text
|
|
189
|
-
*/
|
|
190
|
-
function getActionBadge(action) {
|
|
191
|
-
// Show the action name in uppercase (e.g., ADDITEM, ORDERCOMPLETED)
|
|
192
|
-
return action.actionName?.toUpperCase() || action.type.split('/').pop()?.toUpperCase() || "";
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Get primary text - use action name for cleaner display
|
|
197
|
-
*/
|
|
198
|
-
function getPrimaryText(action) {
|
|
199
|
-
// For internal actions, show the full type
|
|
200
|
-
if (action.category === "internal") {
|
|
201
|
-
return action.type;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// The real type, minus a thunk's status suffix (the status has its own
|
|
205
|
-
// label). It used to be rebuilt from the uppercased actionName and then
|
|
206
|
-
// lowercased, so `offers/dismissError` read as `offers/dismisserror`.
|
|
207
|
-
const parts = action.type.split("/");
|
|
208
|
-
if (parts.length >= 3 && ["pending", "fulfilled", "rejected"].includes(parts[parts.length - 1])) {
|
|
209
|
-
return parts.slice(0, -1).join("/");
|
|
210
|
-
}
|
|
211
|
-
return action.type;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Memo justified by profiling (tool-bench 2026-07-06): ReduxActionItem
|
|
215
|
-
// x172 renders during a 5s idle dwell at 200 seeded actions. The relative
|
|
216
|
-
// timestamp is delegated to the shared <RelativeTime/> leaf so the 5s
|
|
217
|
-
// tick re-renders only that Text, not this row.
|
|
218
|
-
const ReduxActionItem = exports.ReduxActionItem = /*#__PURE__*/(0, _react.memo)(function ReduxActionItem({
|
|
219
|
-
action,
|
|
220
|
-
onPress,
|
|
221
|
-
linkedCount,
|
|
222
|
-
testID
|
|
223
|
-
}) {
|
|
224
|
-
const sliceName = action.sliceName ?? undefined;
|
|
225
|
-
const statusColor = getStatusColor(action.category, action.hasStateChange, sliceName);
|
|
226
|
-
const statusLabel = getStatusLabel(action.category, sliceName);
|
|
227
|
-
const sublabel = getSublabel(action);
|
|
228
|
-
const primaryText = getPrimaryText(action);
|
|
229
|
-
const actionBadge = getActionBadge(action);
|
|
230
|
-
|
|
231
|
-
// Check for linked async actions. The COUNT comes from the list (see the
|
|
232
|
-
// prop's doc); the ordered list is only needed to say where in the flow this
|
|
233
|
-
// action sits, and only when there is a flow at all.
|
|
234
|
-
const hasLinkedActions = (linkedCount ?? 0) > 1;
|
|
235
|
-
const linkedActions = hasLinkedActions ? _reduxActionStore.reduxActionStore.getLinkedActions(action) : [];
|
|
236
|
-
|
|
237
|
-
// Get position in async sequence (1/2, 2/2, etc.)
|
|
238
|
-
const asyncPosition = hasLinkedActions ? linkedActions.findIndex(a => a.id === action.id) + 1 : 0;
|
|
239
|
-
|
|
240
|
-
// Get sequential operation index to distinguish concurrent requests (#1, #2, etc.)
|
|
241
|
-
const operationIndex = hasLinkedActions && action.meta?.requestId ? _reduxActionStore.reduxActionStore.getAsyncOperationIndex(action.meta.requestId) : 0;
|
|
242
|
-
|
|
243
|
-
// Get color for this operation's badge
|
|
244
|
-
const opColor = getOperationColor(operationIndex);
|
|
245
|
-
|
|
246
|
-
// The async-sequence chip ("1/2 #3") sits in front of whatever indicator
|
|
247
|
-
// the row shows; the ⚡ / 🕒 indicators and the mono action verb are drawn
|
|
248
|
-
// by the shared ChangeRow.
|
|
249
|
-
const sequenceChip = hasLinkedActions ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
250
|
-
style: [styles.asyncSequenceBadge, {
|
|
251
|
-
backgroundColor: opColor.bg
|
|
252
|
-
}],
|
|
253
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
254
|
-
style: [styles.asyncSequenceText, {
|
|
255
|
-
color: opColor.text
|
|
256
|
-
}],
|
|
257
|
-
testID: testID ? `${testID}-seq` : undefined,
|
|
258
|
-
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
259
|
-
})
|
|
260
|
-
}) : undefined;
|
|
261
|
-
const common = {
|
|
262
|
-
statusColor,
|
|
263
|
-
statusLabel,
|
|
264
|
-
sublabel,
|
|
265
|
-
primaryText,
|
|
266
|
-
timestamp: action.timestamp,
|
|
267
|
-
onPress: () => onPress(action),
|
|
268
|
-
testID,
|
|
269
|
-
accessibilityLabel: `${primaryText}, ${statusLabel}, ${sublabel}`
|
|
270
|
-
};
|
|
271
|
-
if (action.isSlowAction) {
|
|
272
|
-
// Slow action warning (with the sequence chip when part of a flow).
|
|
273
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
274
|
-
...common,
|
|
275
|
-
badgePrefix: sequenceChip,
|
|
276
|
-
slow: true
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
if (action.category === "rejected") {
|
|
280
|
-
// Error badge for rejected actions.
|
|
281
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
282
|
-
...common,
|
|
283
|
-
customBadge: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
284
|
-
style: styles.badgeContainer,
|
|
285
|
-
children: [sequenceChip, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
286
|
-
style: styles.errorBadge,
|
|
287
|
-
testID: testID ? `${testID}-error` : undefined,
|
|
288
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertCircle, {
|
|
289
|
-
size: 12,
|
|
290
|
-
color: _sharedUi.buoyColors.error
|
|
291
|
-
})
|
|
292
|
-
})]
|
|
293
|
-
})
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
if (hasLinkedActions) {
|
|
297
|
-
// Linked indicator for async actions.
|
|
298
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
299
|
-
...common,
|
|
300
|
-
badgePrefix: sequenceChip,
|
|
301
|
-
changed: action.hasStateChange
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
if (action.hasStateChange) {
|
|
305
|
-
// State change indicator with the action verb.
|
|
306
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
307
|
-
...common,
|
|
308
|
-
badgeText: actionBadge,
|
|
309
|
-
changed: true
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
// Nothing special: CompactRow's plain badge with the action verb.
|
|
313
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
314
|
-
...common,
|
|
315
|
-
plainBadgeText: actionBadge
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
const styles = _reactNative.StyleSheet.create({
|
|
319
|
-
badgeContainer: {
|
|
320
|
-
flexDirection: "row",
|
|
321
|
-
alignItems: "center",
|
|
322
|
-
gap: 4
|
|
323
|
-
},
|
|
324
|
-
errorBadge: {
|
|
325
|
-
paddingHorizontal: 4
|
|
326
|
-
},
|
|
327
|
-
asyncSequenceBadge: {
|
|
328
|
-
paddingHorizontal: 6,
|
|
329
|
-
paddingVertical: 2,
|
|
330
|
-
borderRadius: 4
|
|
331
|
-
},
|
|
332
|
-
asyncSequenceText: {
|
|
333
|
-
fontSize: 10,
|
|
334
|
-
fontWeight: "600",
|
|
335
|
-
fontFamily: _sharedUi.monoFont
|
|
336
|
-
}
|
|
337
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ReduxActionItem=void 0;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _reduxActionStore=require("../utils/reduxActionStore");var _jsxRuntime=require("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(t){if(t<=0)return{bg:"rgba(142, 142, 147, 0.2)",text:_sharedUi.buoyColors.textSecondary};return OPERATION_COLORS[(t-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(t){if(!t)return"#6B7280";const e=t.toLowerCase();if(SLICE_COLORS[e]){return SLICE_COLORS[e]}for(const[r,n]of Object.entries(SLICE_COLORS)){if(e.includes(r)){return n}}const s=t.split("").reduce((r,n)=>r+n.charCodeAt(0),0);const u=s*137%360;return`hsl(${u}, 70%, 60%)`}function getStatusLabel(t,e){switch(t){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 e?e.charAt(0).toUpperCase()+e.slice(1):"Action"}}function getStatusColor(t,e,s){switch(t){case"pending":return _sharedUi.buoyColors.warning;case"fulfilled":return _sharedUi.buoyColors.success;case"rejected":return _sharedUi.buoyColors.error;case"internal":return _sharedUi.buoyColors.textMuted;case"query":return _sharedUi.buoyColors.info;case"mutation":return _sharedUi.buoyColors.info;default:return getSliceColor(s)}}function getSublabel(t){const e=[];if(t.duration!==void 0&&t.duration>=.1){e.push(`${t.duration.toFixed(1)}ms`)}if(t.hasStateChange){if(t.changedKeysCount&&t.changedKeysCount>0){e.push(`${t.changedKeysCount} key${t.changedKeysCount>1?"s":""} changed`)}else{e.push(t.diffSummary||"state changed")}}else{e.push("no state change")}return e.join(" \xB7 ")}function getActionBadge(t){return t.actionName?.toUpperCase()||t.type.split("/").pop()?.toUpperCase()||""}function getPrimaryText(t){if(t.category==="internal"){return t.type}const e=t.type.split("/");if(e.length>=3&&["pending","fulfilled","rejected"].includes(e[e.length-1])){return e.slice(0,-1).join("/")}return t.type}const ReduxActionItem=exports.ReduxActionItem=(0,_react.memo)(function t({action:e,onPress:s,linkedCount:u,testID:r}){const n=e.sliceName??void 0;const x=getStatusColor(e.category,e.hasStateChange,n);const c=getStatusLabel(e.category,n);const d=getSublabel(e);const g=getPrimaryText(e);const l=getActionBadge(e);const o=(u??0)>1;const b=o?_reduxActionStore.reduxActionStore.getLinkedActions(e):[];const y=o?b.findIndex(p=>p.id===e.id)+1:0;const h=o&&e.meta?.requestId?_reduxActionStore.reduxActionStore.getAsyncOperationIndex(e.meta.requestId):0;const f=getOperationColor(h);const i=o?(0,_jsxRuntime.jsx)(_reactNative.View,{style:[styles.asyncSequenceBadge,{backgroundColor:f.bg}],children:(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[styles.asyncSequenceText,{color:f.text}],testID:r?`${r}-seq`:void 0,children:[y,"/",u," #",h]})}):void 0;const a={statusColor:x,statusLabel:c,sublabel:d,primaryText:g,timestamp:e.timestamp,onPress:()=>s(e),testID:r,accessibilityLabel:`${g}, ${c}, ${d}`};if(e.isSlowAction){return(0,_jsxRuntime.jsx)(_sharedUi.ChangeRow,{...a,badgePrefix:i,slow:true})}if(e.category==="rejected"){return(0,_jsxRuntime.jsx)(_sharedUi.ChangeRow,{...a,customBadge:(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.badgeContainer,children:[i,(0,_jsxRuntime.jsx)(_reactNative.View,{style:styles.errorBadge,testID:r?`${r}-error`:void 0,children:(0,_jsxRuntime.jsx)(_sharedUi.AlertCircle,{size:12,color:_sharedUi.buoyColors.error})})]})})}if(o){return(0,_jsxRuntime.jsx)(_sharedUi.ChangeRow,{...a,badgePrefix:i,changed:e.hasStateChange})}if(e.hasStateChange){return(0,_jsxRuntime.jsx)(_sharedUi.ChangeRow,{...a,badgeText:l,changed:true})}return(0,_jsxRuntime.jsx)(_sharedUi.ChangeRow,{...a,plainBadgeText:l})});const styles=_reactNative.StyleSheet.create({badgeContainer:{flexDirection:"row",alignItems:"center",gap:4},errorBadge:{paddingHorizontal:4},asyncSequenceBadge:{paddingHorizontal:6,paddingVertical:2,borderRadius:4},asyncSequenceText:{fontSize:10,fontWeight:"600",fontFamily:_sharedUi.monoFont}});
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReduxAutoInstrument = ReduxAutoInstrument;
|
|
7
|
-
var _useAutoInstrumentRedux = require("../hooks/useAutoInstrumentRedux");
|
|
8
|
-
/**
|
|
9
|
-
* Headless startup instrumentation. Auto-rendered by FloatingDevTools (same
|
|
10
|
-
* pattern as RouteTracker & the overlay tools) so the Redux store is bound
|
|
11
|
-
* from app mount — action log, MCP getState/dispatch, and desktop sync all
|
|
12
|
-
* work WITHOUT the user ever opening the Redux tool. Renders nothing.
|
|
13
|
-
*
|
|
14
|
-
* Safe anywhere: if react-redux is missing or there's no Provider above, the
|
|
15
|
-
* hook records the diagnostic and fails gracefully.
|
|
16
|
-
*/
|
|
17
|
-
function ReduxAutoInstrument() {
|
|
18
|
-
(0, _useAutoInstrumentRedux.useAutoInstrumentRedux)();
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ReduxAutoInstrument=ReduxAutoInstrument;var _useAutoInstrumentRedux=require("../hooks/useAutoInstrumentRedux");function ReduxAutoInstrument(){(0,_useAutoInstrumentRedux.useAutoInstrumentRedux)();return null}
|
|
@@ -1,50 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ReduxDetailViewToggle = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
-
/**
|
|
12
|
-
* ReduxDetailViewToggle
|
|
13
|
-
*
|
|
14
|
-
* Three-card toggle for switching between Action, State, and Diff views.
|
|
15
|
-
* The cards themselves are the shared `DetailViewToggle`; this file owns
|
|
16
|
-
* the redux view list and testID prefix.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
// Active-card chrome takes the single night accent (the per-view
|
|
20
|
-
// warning/info/success tints were selection chrome, not data).
|
|
21
|
-
const VIEWS = [{
|
|
22
|
-
key: "action",
|
|
23
|
-
label: "ACTION",
|
|
24
|
-
description: "View action details",
|
|
25
|
-
icon: _sharedUi.FileText
|
|
26
|
-
}, {
|
|
27
|
-
key: "state",
|
|
28
|
-
label: "STATE",
|
|
29
|
-
description: "View current state",
|
|
30
|
-
icon: _sharedUi.Database
|
|
31
|
-
}, {
|
|
32
|
-
key: "diff",
|
|
33
|
-
label: "DIFF",
|
|
34
|
-
description: "Compare changes",
|
|
35
|
-
icon: _sharedUi.GitBranch
|
|
36
|
-
}];
|
|
37
|
-
const DIFF_DISABLED = ["diff"];
|
|
38
|
-
const ReduxDetailViewToggle = exports.ReduxDetailViewToggle = /*#__PURE__*/(0, _react.memo)(function ReduxDetailViewToggle({
|
|
39
|
-
activeView,
|
|
40
|
-
onViewChange,
|
|
41
|
-
diffDisabled = false
|
|
42
|
-
}) {
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.DetailViewToggle, {
|
|
44
|
-
views: VIEWS,
|
|
45
|
-
activeView: activeView,
|
|
46
|
-
onViewChange: onViewChange,
|
|
47
|
-
disabledKeys: diffDisabled ? DIFF_DISABLED : undefined,
|
|
48
|
-
testIDPrefix: "buoy-redux"
|
|
49
|
-
});
|
|
50
|
-
});
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.ReduxDetailViewToggle=void 0;var _react=_interopRequireWildcard(require("react"));var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");function _interopRequireWildcard(s,o){if("function"==typeof WeakMap)var a=new WeakMap,u=new WeakMap;return(_interopRequireWildcard=function(e,c){if(!c&&e&&e.__esModule)return e;var t,n,r={__proto__:null,default:e};if(null===e||"object"!=typeof e&&"function"!=typeof e)return r;if(t=c?u:a){if(t.has(e))return t.get(e);t.set(e,r)}for(const i in e)"default"!==i&&{}.hasOwnProperty.call(e,i)&&((n=(t=Object.defineProperty)&&Object.getOwnPropertyDescriptor(e,i))&&(n.get||n.set)?t(r,i,n):r[i]=e[i]);return r})(s,o)}const VIEWS=[{key:"action",label:"ACTION",description:"View action details",icon:_sharedUi.FileText},{key:"state",label:"STATE",description:"View current state",icon:_sharedUi.Database},{key:"diff",label:"DIFF",description:"Compare changes",icon:_sharedUi.GitBranch}];const DIFF_DISABLED=["diff"];const ReduxDetailViewToggle=exports.ReduxDetailViewToggle=(0,_react.memo)(function s({activeView:o,onViewChange:a,diffDisabled:u=false}){return(0,_jsxRuntime.jsx)(_sharedUi.DetailViewToggle,{views:VIEWS,activeView:o,onViewChange:a,disabledKeys:u?DIFF_DISABLED:void 0,testIDPrefix:"buoy-redux"})});
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "REDUX_ICON_COLOR", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _floatingToolsCore.REDUX_ICON_COLOR;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "ReduxIcon", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _floatingToolsCore.ReduxIcon;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
var _floatingToolsCore = require("@buoy-gg/floating-tools-core");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"REDUX_ICON_COLOR",{enumerable:true,get:function(){return _floatingToolsCore.REDUX_ICON_COLOR}});Object.defineProperty(exports,"ReduxIcon",{enumerable:true,get:function(){return _floatingToolsCore.ReduxIcon}});var _floatingToolsCore=require("@buoy-gg/floating-tools-core");
|