@buoy-gg/redux 7.0.33 → 7.0.34
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/lib/commonjs/preset.js +14 -22
- package/lib/commonjs/redux/components/ReduxActionInfoView.js +8 -60
- package/lib/commonjs/redux/components/ReduxActionItem.js +64 -118
- package/lib/commonjs/redux/components/ReduxDetailViewToggle.js +15 -109
- package/lib/commonjs/redux/components/ReduxModal.js +24 -69
- package/lib/commonjs/redux/hooks/useReduxActions.js +16 -33
- package/lib/commonjs/redux/sync/reduxSyncAdapter.js +11 -29
- package/lib/commonjs/redux/utils/reduxActionStore.js +24 -94
- package/lib/commonjs/redux/utils/snapshotProvider.js +17 -80
- package/lib/module/preset.js +13 -20
- package/lib/module/redux/components/ReduxActionInfoView.js +1 -53
- package/lib/module/redux/components/ReduxActionItem.js +65 -119
- package/lib/module/redux/components/ReduxDetailViewToggle.js +17 -111
- package/lib/module/redux/components/ReduxModal.js +26 -71
- package/lib/module/redux/hooks/useReduxActions.js +17 -34
- package/lib/module/redux/sync/reduxSyncAdapter.js +12 -30
- package/lib/module/redux/utils/reduxActionStore.js +25 -95
- package/lib/module/redux/utils/snapshotProvider.js +18 -81
- package/lib/typescript/preset.d.ts +3 -9
- package/lib/typescript/preset.d.ts.map +1 -1
- package/lib/typescript/redux/components/ReduxActionInfoView.d.ts.map +1 -1
- package/lib/typescript/redux/components/ReduxActionItem.d.ts.map +1 -1
- package/lib/typescript/redux/components/ReduxDetailViewToggle.d.ts +2 -1
- package/lib/typescript/redux/components/ReduxDetailViewToggle.d.ts.map +1 -1
- package/lib/typescript/redux/components/ReduxModal.d.ts.map +1 -1
- package/lib/typescript/redux/hooks/useReduxActions.d.ts +3 -0
- package/lib/typescript/redux/hooks/useReduxActions.d.ts.map +1 -1
- package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts +68 -82
- package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts.map +1 -1
- package/lib/typescript/redux/utils/reduxActionStore.d.ts +2 -29
- package/lib/typescript/redux/utils/reduxActionStore.d.ts.map +1 -1
- package/package.json +4 -4
package/lib/commonjs/preset.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.createReduxTool =
|
|
7
|
-
exports.reduxToolPreset = void 0;
|
|
6
|
+
exports.reduxToolPreset = exports.createReduxTool = void 0;
|
|
8
7
|
var _ReduxModal = require("./redux/components/ReduxModal");
|
|
9
8
|
var _ReduxIcon = require("./redux/components/ReduxIcon");
|
|
9
|
+
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
/**
|
|
12
12
|
* Pre-configured Redux DevTools preset for FloatingDevTools
|
|
@@ -48,7 +48,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
48
48
|
* - State diff visualization
|
|
49
49
|
* - Filter by action type
|
|
50
50
|
*/
|
|
51
|
-
const reduxToolPreset = exports.reduxToolPreset = {
|
|
51
|
+
const reduxToolPreset = exports.reduxToolPreset = (0, _sharedUi.defineToolPreset)({
|
|
52
52
|
id: "redux",
|
|
53
53
|
name: "REDUX",
|
|
54
54
|
description: "Redux action & state inspector",
|
|
@@ -62,7 +62,7 @@ const reduxToolPreset = exports.reduxToolPreset = {
|
|
|
62
62
|
props: {
|
|
63
63
|
enableSharedModalDimensions: false
|
|
64
64
|
}
|
|
65
|
-
};
|
|
65
|
+
});
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Create a custom Redux DevTools configuration.
|
|
@@ -78,21 +78,13 @@ const reduxToolPreset = exports.reduxToolPreset = {
|
|
|
78
78
|
* });
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
color: options?.iconColor
|
|
92
|
-
}),
|
|
93
|
-
component: _ReduxModal.ReduxModal,
|
|
94
|
-
props: {
|
|
95
|
-
enableSharedModalDimensions: options?.enableSharedModalDimensions !== undefined ? options.enableSharedModalDimensions : false
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
81
|
+
const createReduxTool = exports.createReduxTool = (0, _sharedUi.createToolFactory)(reduxToolPreset, options => ({
|
|
82
|
+
enableSharedModalDimensions: options.enableSharedModalDimensions ?? false
|
|
83
|
+
}), options => ({
|
|
84
|
+
icon: ({
|
|
85
|
+
size
|
|
86
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ReduxIcon.ReduxIcon, {
|
|
87
|
+
size: size,
|
|
88
|
+
color: options.iconColor
|
|
89
|
+
})
|
|
90
|
+
}));
|
|
@@ -109,37 +109,6 @@ function SectionHeader({
|
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/**
|
|
113
|
-
* Info row component for key-value display
|
|
114
|
-
*/
|
|
115
|
-
function InfoRow({
|
|
116
|
-
label,
|
|
117
|
-
value,
|
|
118
|
-
valueColor,
|
|
119
|
-
mono = false,
|
|
120
|
-
testID
|
|
121
|
-
}) {
|
|
122
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
123
|
-
style: styles.infoRow,
|
|
124
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
125
|
-
style: styles.infoLabel,
|
|
126
|
-
children: label
|
|
127
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
128
|
-
style: [styles.infoValue, mono && styles.infoValueMono, valueColor && {
|
|
129
|
-
color: valueColor
|
|
130
|
-
}]
|
|
131
|
-
// `ellipsizeMode="middle"` truncates the RENDERED text and iOS reports
|
|
132
|
-
// the truncated string back, so anything a test reads off one of these
|
|
133
|
-
// rows has to be short enough to fit on the line.
|
|
134
|
-
,
|
|
135
|
-
numberOfLines: 1,
|
|
136
|
-
ellipsizeMode: "middle",
|
|
137
|
-
testID: testID,
|
|
138
|
-
children: value
|
|
139
|
-
})]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
|
|
143
112
|
/**
|
|
144
113
|
* Format timestamp for display
|
|
145
114
|
*/
|
|
@@ -229,17 +198,17 @@ const ReduxActionInfoView = exports.ReduxActionInfoView = /*#__PURE__*/(0, _reac
|
|
|
229
198
|
title: "ACTION INFO"
|
|
230
199
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
231
200
|
style: styles.cardContent,
|
|
232
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
201
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
233
202
|
label: "Type",
|
|
234
203
|
value: action.type,
|
|
235
204
|
mono: true,
|
|
236
205
|
testID: `${_testIDs.REDUX_TEST_ID}-info-type`
|
|
237
|
-
}), action.sliceName && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
206
|
+
}), action.sliceName && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
238
207
|
label: "Slice",
|
|
239
208
|
value: action.sliceName,
|
|
240
209
|
mono: true,
|
|
241
210
|
testID: `${_testIDs.REDUX_TEST_ID}-info-slice`
|
|
242
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
211
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
243
212
|
label: "Action",
|
|
244
213
|
value: action.actionName,
|
|
245
214
|
mono: true,
|
|
@@ -411,11 +380,11 @@ const ReduxActionInfoView = exports.ReduxActionInfoView = /*#__PURE__*/(0, _reac
|
|
|
411
380
|
})
|
|
412
381
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
413
382
|
style: styles.cardContent,
|
|
414
|
-
children: [action.meta?.requestId && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
383
|
+
children: [action.meta?.requestId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
415
384
|
label: "Request ID",
|
|
416
385
|
value: action.meta.requestId,
|
|
417
386
|
mono: true
|
|
418
|
-
}), action.meta?.requestStatus && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
387
|
+
}), action.meta?.requestStatus && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
419
388
|
label: "Status",
|
|
420
389
|
value: action.meta.requestStatus.toUpperCase(),
|
|
421
390
|
valueColor: categoryInfo.color,
|
|
@@ -438,15 +407,15 @@ const ReduxActionInfoView = exports.ReduxActionInfoView = /*#__PURE__*/(0, _reac
|
|
|
438
407
|
children: JSON.stringify(action.meta.arg)
|
|
439
408
|
})
|
|
440
409
|
})]
|
|
441
|
-
}), action.meta?.rejectedWithValue && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
410
|
+
}), action.meta?.rejectedWithValue && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
442
411
|
label: "Rejected With Value",
|
|
443
412
|
value: "true",
|
|
444
413
|
valueColor: _sharedUi.buoyColors.error
|
|
445
|
-
}), action.meta?.aborted && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
414
|
+
}), action.meta?.aborted && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
446
415
|
label: "Aborted",
|
|
447
416
|
value: "true",
|
|
448
417
|
valueColor: _sharedUi.buoyColors.warning
|
|
449
|
-
}), action.meta?.condition && /*#__PURE__*/(0, _jsxRuntime.jsx)(InfoRow, {
|
|
418
|
+
}), action.meta?.condition && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.InfoRow, {
|
|
450
419
|
label: "Condition",
|
|
451
420
|
value: "true",
|
|
452
421
|
valueColor: _sharedUi.night.color.textTertiary
|
|
@@ -609,27 +578,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
609
578
|
padding: 14,
|
|
610
579
|
gap: 10
|
|
611
580
|
},
|
|
612
|
-
infoRow: {
|
|
613
|
-
flexDirection: "row",
|
|
614
|
-
alignItems: "center",
|
|
615
|
-
justifyContent: "space-between"
|
|
616
|
-
},
|
|
617
|
-
infoLabel: {
|
|
618
|
-
fontSize: 11,
|
|
619
|
-
color: _sharedUi.night.color.textTertiary,
|
|
620
|
-
fontWeight: "500"
|
|
621
|
-
},
|
|
622
|
-
infoValue: {
|
|
623
|
-
fontSize: 11,
|
|
624
|
-
color: _sharedUi.night.color.text,
|
|
625
|
-
fontWeight: "500",
|
|
626
|
-
flex: 1,
|
|
627
|
-
textAlign: "right",
|
|
628
|
-
marginLeft: 12
|
|
629
|
-
},
|
|
630
|
-
infoValueMono: {
|
|
631
|
-
fontFamily: "monospace"
|
|
632
|
-
},
|
|
633
581
|
badgeRow: {
|
|
634
582
|
flexDirection: "row",
|
|
635
583
|
flexWrap: "wrap",
|
|
@@ -240,119 +240,76 @@ const ReduxActionItem = exports.ReduxActionItem = /*#__PURE__*/(0, _react.memo)(
|
|
|
240
240
|
// Get color for this operation's badge
|
|
241
241
|
const opColor = getOperationColor(operationIndex);
|
|
242
242
|
|
|
243
|
-
//
|
|
244
|
-
|
|
243
|
+
// The async-sequence chip ("1/2 #3") sits in front of whatever indicator
|
|
244
|
+
// the row shows; the ⚡ / 🕒 indicators and the mono action verb are drawn
|
|
245
|
+
// by the shared ChangeRow.
|
|
246
|
+
const sequenceChip = hasLinkedActions ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
247
|
+
style: [styles.asyncSequenceBadge, {
|
|
248
|
+
backgroundColor: opColor.bg
|
|
249
|
+
}],
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
251
|
+
style: [styles.asyncSequenceText, {
|
|
252
|
+
color: opColor.text
|
|
253
|
+
}],
|
|
254
|
+
testID: testID ? `${testID}-seq` : undefined,
|
|
255
|
+
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
256
|
+
})
|
|
257
|
+
}) : undefined;
|
|
258
|
+
const common = {
|
|
259
|
+
statusColor,
|
|
260
|
+
statusLabel,
|
|
261
|
+
sublabel,
|
|
262
|
+
primaryText,
|
|
263
|
+
timestamp: action.timestamp,
|
|
264
|
+
onPress: () => onPress(action),
|
|
265
|
+
testID,
|
|
266
|
+
accessibilityLabel: `${primaryText}, ${statusLabel}, ${sublabel}`
|
|
267
|
+
};
|
|
245
268
|
if (action.isSlowAction) {
|
|
246
|
-
//
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
261
|
-
style: styles.slowBadge,
|
|
262
|
-
testID: testID ? `${testID}-slow` : undefined,
|
|
263
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Clock, {
|
|
264
|
-
size: 12,
|
|
265
|
-
color: _sharedUi.buoyColors.error
|
|
266
|
-
})
|
|
267
|
-
})]
|
|
269
|
+
// Slow action warning (with the sequence chip when part of a flow).
|
|
270
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
271
|
+
...common,
|
|
272
|
+
badgePrefix: sequenceChip,
|
|
273
|
+
slow: true
|
|
268
274
|
});
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
})
|
|
284
|
-
})
|
|
285
|
-
style: styles.errorBadge,
|
|
286
|
-
testID: testID ? `${testID}-error` : undefined,
|
|
287
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertCircle, {
|
|
288
|
-
size: 12,
|
|
289
|
-
color: _sharedUi.buoyColors.error
|
|
290
|
-
})
|
|
291
|
-
})]
|
|
275
|
+
}
|
|
276
|
+
if (action.category === "rejected") {
|
|
277
|
+
// Error badge for rejected actions.
|
|
278
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
279
|
+
...common,
|
|
280
|
+
customBadge: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
281
|
+
style: styles.badgeContainer,
|
|
282
|
+
children: [sequenceChip, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
283
|
+
style: styles.errorBadge,
|
|
284
|
+
testID: testID ? `${testID}-error` : undefined,
|
|
285
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.AlertCircle, {
|
|
286
|
+
size: 12,
|
|
287
|
+
color: _sharedUi.buoyColors.error
|
|
288
|
+
})
|
|
289
|
+
})]
|
|
290
|
+
})
|
|
292
291
|
});
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}],
|
|
301
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
302
|
-
style: [styles.asyncSequenceText, {
|
|
303
|
-
color: opColor.text
|
|
304
|
-
}],
|
|
305
|
-
testID: testID ? `${testID}-seq` : undefined,
|
|
306
|
-
children: [asyncPosition, "/", linkedCount, " #", operationIndex]
|
|
307
|
-
})
|
|
308
|
-
}), action.hasStateChange && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
309
|
-
style: styles.changeBadge,
|
|
310
|
-
testID: testID ? `${testID}-change` : undefined,
|
|
311
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Zap, {
|
|
312
|
-
size: 12,
|
|
313
|
-
color: _sharedUi.buoyColors.warning
|
|
314
|
-
})
|
|
315
|
-
})]
|
|
292
|
+
}
|
|
293
|
+
if (hasLinkedActions) {
|
|
294
|
+
// Linked indicator for async actions.
|
|
295
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
296
|
+
...common,
|
|
297
|
+
badgePrefix: sequenceChip,
|
|
298
|
+
changed: action.hasStateChange
|
|
316
299
|
});
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}],
|
|
325
|
-
testID: testID ? `${testID}-badge` : undefined,
|
|
326
|
-
children: actionBadge
|
|
327
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
328
|
-
style: styles.changeBadge,
|
|
329
|
-
testID: testID ? `${testID}-change` : undefined,
|
|
330
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.Zap, {
|
|
331
|
-
size: 12,
|
|
332
|
-
color: _sharedUi.buoyColors.warning
|
|
333
|
-
})
|
|
334
|
-
})]
|
|
300
|
+
}
|
|
301
|
+
if (action.hasStateChange) {
|
|
302
|
+
// State change indicator with the action verb.
|
|
303
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
304
|
+
...common,
|
|
305
|
+
badgeText: actionBadge,
|
|
306
|
+
changed: true
|
|
335
307
|
});
|
|
336
308
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
accessibilityLabel: `${primaryText}, ${statusLabel}, ${sublabel}`,
|
|
342
|
-
statusDotColor: statusColor,
|
|
343
|
-
statusLabel: statusLabel,
|
|
344
|
-
statusSublabel: sublabel,
|
|
345
|
-
primaryText: primaryText,
|
|
346
|
-
bottomRightText: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.RelativeTime, {
|
|
347
|
-
timestamp: action.timestamp
|
|
348
|
-
})
|
|
349
|
-
// Use customBadge if we have special indicators, otherwise show action badge as text
|
|
350
|
-
,
|
|
351
|
-
customBadge: customBadge,
|
|
352
|
-
badgeText: customBadge ? undefined : actionBadge,
|
|
353
|
-
badgeColor: statusColor,
|
|
354
|
-
showChevron: true,
|
|
355
|
-
onPress: () => onPress(action)
|
|
309
|
+
// Nothing special: CompactRow's plain badge with the action verb.
|
|
310
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ChangeRow, {
|
|
311
|
+
...common,
|
|
312
|
+
plainBadgeText: actionBadge
|
|
356
313
|
});
|
|
357
314
|
});
|
|
358
315
|
const styles = _reactNative.StyleSheet.create({
|
|
@@ -361,17 +318,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
361
318
|
alignItems: "center",
|
|
362
319
|
gap: 4
|
|
363
320
|
},
|
|
364
|
-
actionBadgeText: {
|
|
365
|
-
fontSize: 11,
|
|
366
|
-
fontWeight: "600",
|
|
367
|
-
fontFamily: "monospace"
|
|
368
|
-
},
|
|
369
|
-
changeBadge: {
|
|
370
|
-
paddingHorizontal: 4
|
|
371
|
-
},
|
|
372
|
-
slowBadge: {
|
|
373
|
-
paddingHorizontal: 4
|
|
374
|
-
},
|
|
375
321
|
errorBadge: {
|
|
376
322
|
paddingHorizontal: 4
|
|
377
323
|
},
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.ReduxDetailViewToggle = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _reactNative = require("react-native");
|
|
9
8
|
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
10
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
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); }
|
|
@@ -13,132 +12,39 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
13
12
|
* ReduxDetailViewToggle
|
|
14
13
|
*
|
|
15
14
|
* Three-card toggle for switching between Action, State, and Diff views.
|
|
16
|
-
*
|
|
15
|
+
* The cards themselves are the shared `DetailViewToggle`; this file owns
|
|
16
|
+
* the redux view list and testID prefix.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
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 = [{
|
|
20
22
|
key: "action",
|
|
21
23
|
label: "ACTION",
|
|
22
24
|
description: "View action details",
|
|
23
|
-
icon: _sharedUi.FileText
|
|
24
|
-
// Active-card chrome takes the single night accent (the per-view
|
|
25
|
-
// warning/info/success tints were selection chrome, not data).
|
|
26
|
-
activeColor: _sharedUi.night.color.accent
|
|
25
|
+
icon: _sharedUi.FileText
|
|
27
26
|
}, {
|
|
28
27
|
key: "state",
|
|
29
28
|
label: "STATE",
|
|
30
29
|
description: "View current state",
|
|
31
|
-
icon: _sharedUi.Database
|
|
32
|
-
activeColor: _sharedUi.night.color.accent
|
|
30
|
+
icon: _sharedUi.Database
|
|
33
31
|
}, {
|
|
34
32
|
key: "diff",
|
|
35
33
|
label: "DIFF",
|
|
36
34
|
description: "Compare changes",
|
|
37
|
-
icon: _sharedUi.GitBranch
|
|
38
|
-
activeColor: _sharedUi.night.color.accent
|
|
35
|
+
icon: _sharedUi.GitBranch
|
|
39
36
|
}];
|
|
37
|
+
const DIFF_DISABLED = ["diff"];
|
|
40
38
|
const ReduxDetailViewToggle = exports.ReduxDetailViewToggle = /*#__PURE__*/(0, _react.memo)(function ReduxDetailViewToggle({
|
|
41
39
|
activeView,
|
|
42
40
|
onViewChange,
|
|
43
41
|
diffDisabled = false
|
|
44
42
|
}) {
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
52
|
-
style: [styles.card, isActive && [styles.cardActive, {
|
|
53
|
-
borderColor: config.activeColor
|
|
54
|
-
}], isDisabled && styles.cardDisabled],
|
|
55
|
-
onPress: () => !isDisabled && onViewChange(config.key),
|
|
56
|
-
activeOpacity: isDisabled ? 1 : 0.8,
|
|
57
|
-
disabled: isDisabled,
|
|
58
|
-
testID: `buoy-redux-view-${config.key}`,
|
|
59
|
-
accessibilityRole: "button",
|
|
60
|
-
accessibilityLabel: config.label,
|
|
61
|
-
accessibilityState: {
|
|
62
|
-
selected: isActive,
|
|
63
|
-
disabled: isDisabled
|
|
64
|
-
},
|
|
65
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
66
|
-
style: styles.cardContent,
|
|
67
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(IconComponent, {
|
|
68
|
-
size: 14,
|
|
69
|
-
color: isActive ? config.activeColor : isDisabled ? _sharedUi.night.color.textTertiary : _sharedUi.night.color.textSecondary
|
|
70
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
71
|
-
style: [styles.cardLabel, isActive && [styles.cardLabelActive, {
|
|
72
|
-
color: config.activeColor
|
|
73
|
-
}], isDisabled && styles.cardLabelDisabled],
|
|
74
|
-
children: config.label
|
|
75
|
-
})]
|
|
76
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
77
|
-
style: [styles.cardDescription, isActive && styles.cardDescriptionActive, isDisabled && styles.cardDescriptionDisabled],
|
|
78
|
-
children: config.description
|
|
79
|
-
})]
|
|
80
|
-
}, config.key);
|
|
81
|
-
})
|
|
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"
|
|
82
49
|
});
|
|
83
|
-
});
|
|
84
|
-
const styles = _reactNative.StyleSheet.create({
|
|
85
|
-
container: {
|
|
86
|
-
flexDirection: "row",
|
|
87
|
-
gap: 8,
|
|
88
|
-
padding: 14,
|
|
89
|
-
// Transparent so the night sheet's star field shows through.
|
|
90
|
-
backgroundColor: "transparent"
|
|
91
|
-
},
|
|
92
|
-
card: {
|
|
93
|
-
flex: 1,
|
|
94
|
-
backgroundColor: _sharedUi.night.color.surface,
|
|
95
|
-
borderRadius: 12,
|
|
96
|
-
borderWidth: 1,
|
|
97
|
-
borderColor: _sharedUi.night.color.border,
|
|
98
|
-
padding: 10,
|
|
99
|
-
gap: 4
|
|
100
|
-
},
|
|
101
|
-
cardActive: {
|
|
102
|
-
borderWidth: 1.5,
|
|
103
|
-
backgroundColor: _sharedUi.night.color.accentSoft,
|
|
104
|
-
shadowColor: _sharedUi.night.color.accent,
|
|
105
|
-
shadowOffset: {
|
|
106
|
-
width: 0,
|
|
107
|
-
height: 2
|
|
108
|
-
},
|
|
109
|
-
shadowOpacity: 0.1,
|
|
110
|
-
shadowRadius: 8,
|
|
111
|
-
elevation: 3
|
|
112
|
-
},
|
|
113
|
-
cardDisabled: {
|
|
114
|
-
opacity: 0.5
|
|
115
|
-
},
|
|
116
|
-
cardContent: {
|
|
117
|
-
flexDirection: "row",
|
|
118
|
-
alignItems: "center",
|
|
119
|
-
gap: 6
|
|
120
|
-
},
|
|
121
|
-
cardLabel: {
|
|
122
|
-
fontSize: 10,
|
|
123
|
-
fontWeight: "700",
|
|
124
|
-
letterSpacing: 0.5,
|
|
125
|
-
color: _sharedUi.night.color.textSecondary
|
|
126
|
-
},
|
|
127
|
-
cardLabelActive: {
|
|
128
|
-
color: _sharedUi.night.color.text
|
|
129
|
-
},
|
|
130
|
-
cardLabelDisabled: {
|
|
131
|
-
color: _sharedUi.night.color.textTertiary
|
|
132
|
-
},
|
|
133
|
-
cardDescription: {
|
|
134
|
-
fontSize: 9,
|
|
135
|
-
color: _sharedUi.night.color.textTertiary,
|
|
136
|
-
lineHeight: 12
|
|
137
|
-
},
|
|
138
|
-
cardDescriptionActive: {
|
|
139
|
-
color: _sharedUi.night.color.textSecondary
|
|
140
|
-
},
|
|
141
|
-
cardDescriptionDisabled: {
|
|
142
|
-
color: _sharedUi.night.color.textTertiary
|
|
143
|
-
}
|
|
144
50
|
});
|
|
@@ -271,49 +271,29 @@ function ReduxModal({
|
|
|
271
271
|
onBack: onBack
|
|
272
272
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Content, {
|
|
273
273
|
title: "",
|
|
274
|
-
children: isSearchActive ? /*#__PURE__*/(0, _jsxRuntime.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
// still armed.
|
|
298
|
-
,
|
|
299
|
-
onBlur: () => {
|
|
300
|
-
if (searchText.length === 0) setIsSearchActive(false);
|
|
301
|
-
},
|
|
302
|
-
accessibilityLabel: "Search action types",
|
|
303
|
-
autoCapitalize: "none",
|
|
304
|
-
autoCorrect: false,
|
|
305
|
-
returnKeyType: "search"
|
|
306
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
307
|
-
onPress: closeSearch,
|
|
308
|
-
style: styles.headerSearchClear,
|
|
309
|
-
testID: `${_testIDs.REDUX_TEST_ID}-search-clear`,
|
|
310
|
-
accessibilityRole: "button",
|
|
311
|
-
accessibilityLabel: "Close search",
|
|
312
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.X, {
|
|
313
|
-
size: 14,
|
|
314
|
-
color: _sharedUi.night.color.textSecondary
|
|
315
|
-
})
|
|
316
|
-
})]
|
|
274
|
+
children: isSearchActive ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_sharedUi.ModalHeader.Search, {
|
|
275
|
+
value: searchText,
|
|
276
|
+
onChangeText: handleSearch,
|
|
277
|
+
onCancel: closeSearch,
|
|
278
|
+
placeholder: "Search action types...",
|
|
279
|
+
accessibilityLabel: "Search action types",
|
|
280
|
+
iconSize: 14,
|
|
281
|
+
testID: `${_testIDs.REDUX_TEST_ID}-search-field`,
|
|
282
|
+
containerTestID: `${_testIDs.REDUX_TEST_ID}-search`,
|
|
283
|
+
clearTestID: `${_testIDs.REDUX_TEST_ID}-search-clear`
|
|
284
|
+
// Stay open while the query still filters the list.
|
|
285
|
+
//
|
|
286
|
+
// Collapsing it on blur hid the reason rows were missing: the
|
|
287
|
+
// header went back to its chips — which count the WHOLE
|
|
288
|
+
// capture, not the filtered list — while the list stayed
|
|
289
|
+
// narrowed, so the tool showed "4 actions" above a single row
|
|
290
|
+
// and offered nothing to explain the gap. The only way back
|
|
291
|
+
// was to reopen a field the user had no reason to think was
|
|
292
|
+
// still armed.
|
|
293
|
+
,
|
|
294
|
+
onBlur: () => {
|
|
295
|
+
if (searchText.length === 0) setIsSearchActive(false);
|
|
296
|
+
}
|
|
317
297
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
318
298
|
style: styles.headerChipRow,
|
|
319
299
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
@@ -508,11 +488,7 @@ function ReduxModal({
|
|
|
508
488
|
keyExtractor: keyExtractor,
|
|
509
489
|
contentContainerStyle: styles.listContent,
|
|
510
490
|
showsVerticalScrollIndicator: true,
|
|
511
|
-
|
|
512
|
-
initialNumToRender: 12,
|
|
513
|
-
maxToRenderPerBatch: 8,
|
|
514
|
-
windowSize: 5,
|
|
515
|
-
updateCellsBatchingPeriod: 50
|
|
491
|
+
..._sharedUi.EVENT_LIST_PRESET
|
|
516
492
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(EmptyState, {
|
|
517
493
|
isEnabled: isEnabled,
|
|
518
494
|
query: searchText,
|
|
@@ -598,27 +574,6 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
598
574
|
// Transparent so JsModal's ToolBackground shows through (the modal paints opaque base beneath it).
|
|
599
575
|
backgroundColor: "transparent"
|
|
600
576
|
},
|
|
601
|
-
headerSearchContainer: {
|
|
602
|
-
flexDirection: "row",
|
|
603
|
-
alignItems: "center",
|
|
604
|
-
backgroundColor: _sharedUi.night.color.surfaceElevated,
|
|
605
|
-
borderRadius: 10,
|
|
606
|
-
borderWidth: 1,
|
|
607
|
-
borderColor: _sharedUi.night.color.border,
|
|
608
|
-
paddingHorizontal: 12,
|
|
609
|
-
paddingVertical: 5
|
|
610
|
-
},
|
|
611
|
-
headerSearchInput: {
|
|
612
|
-
flex: 1,
|
|
613
|
-
color: _sharedUi.night.color.text,
|
|
614
|
-
fontSize: 13,
|
|
615
|
-
marginLeft: 6,
|
|
616
|
-
paddingVertical: 2
|
|
617
|
-
},
|
|
618
|
-
headerSearchClear: {
|
|
619
|
-
marginLeft: 6,
|
|
620
|
-
padding: 4
|
|
621
|
-
},
|
|
622
577
|
headerChipRow: {
|
|
623
578
|
flexDirection: "row",
|
|
624
579
|
alignItems: "center",
|