@buoy-gg/react-query 2.1.1 → 2.1.2
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/react-query/components/DataEditorMode.js +9 -16
- package/lib/commonjs/react-query/components/MutationEditorMode.js +1 -3
- package/lib/commonjs/react-query/components/query-browser/ActionButton.js +40 -69
- package/lib/commonjs/react-query/components/query-browser/QueryActions.js +70 -84
- package/lib/commonjs/react-query/hooks/useActionButtons.js +7 -15
- package/lib/commonjs/react-query/hooks/useMutationActionButtons.js +1 -2
- package/lib/module/react-query/components/DataEditorMode.js +9 -16
- package/lib/module/react-query/components/MutationEditorMode.js +1 -3
- package/lib/module/react-query/components/query-browser/ActionButton.js +40 -70
- package/lib/module/react-query/components/query-browser/QueryActions.js +70 -84
- package/lib/module/react-query/hooks/useActionButtons.js +7 -15
- package/lib/module/react-query/hooks/useMutationActionButtons.js +1 -2
- package/lib/typescript/react-query/components/DataEditorMode.d.ts.map +1 -1
- package/lib/typescript/react-query/components/MutationEditorMode.d.ts.map +1 -1
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts +4 -42
- package/lib/typescript/react-query/components/query-browser/ActionButton.d.ts.map +1 -1
- package/lib/typescript/react-query/components/query-browser/QueryActions.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts +5 -8
- package/lib/typescript/react-query/hooks/useActionButtons.d.ts.map +1 -1
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts +1 -8
- package/lib/typescript/react-query/hooks/useMutationActionButtons.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -80,13 +80,11 @@ function DataEditorMode({
|
|
|
80
80
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
81
81
|
}],
|
|
82
82
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
83
|
-
style: styles.
|
|
83
|
+
style: styles.actionsRow,
|
|
84
84
|
children: actionButtons.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
85
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
86
85
|
onClick: action.onPress,
|
|
87
86
|
text: action.label,
|
|
88
|
-
|
|
89
|
-
_textColorClass: action.textColorClass,
|
|
87
|
+
variant: action.variant,
|
|
90
88
|
disabled: action.disabled
|
|
91
89
|
}, index))
|
|
92
90
|
})
|
|
@@ -114,13 +112,11 @@ function DataEditorActionsFooter({
|
|
|
114
112
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
115
113
|
}],
|
|
116
114
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
117
|
-
style: styles.
|
|
115
|
+
style: styles.actionsRow,
|
|
118
116
|
children: actionButtons.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
119
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
120
117
|
onClick: action.onPress,
|
|
121
118
|
text: action.label,
|
|
122
|
-
|
|
123
|
-
_textColorClass: action.textColorClass,
|
|
119
|
+
variant: action.variant,
|
|
124
120
|
disabled: action.disabled
|
|
125
121
|
}, index))
|
|
126
122
|
})
|
|
@@ -230,23 +226,20 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
230
226
|
lineHeight: 20,
|
|
231
227
|
maxWidth: 280
|
|
232
228
|
},
|
|
233
|
-
// Action footer
|
|
229
|
+
// Action footer - compact single row layout
|
|
234
230
|
actionFooter: {
|
|
235
231
|
borderTopWidth: 1,
|
|
236
232
|
borderTopColor: _sharedUi.buoyColors.border,
|
|
237
|
-
paddingTop:
|
|
233
|
+
paddingTop: 8,
|
|
238
234
|
paddingHorizontal: 12,
|
|
239
235
|
backgroundColor: _sharedUi.buoyColors.base,
|
|
240
236
|
borderBottomLeftRadius: 14,
|
|
241
237
|
borderBottomRightRadius: 14
|
|
242
238
|
},
|
|
243
|
-
|
|
239
|
+
actionsRow: {
|
|
244
240
|
flexDirection: "row",
|
|
245
|
-
|
|
246
|
-
gap:
|
|
247
|
-
// Reduced from 8
|
|
248
|
-
justifyContent: "space-between",
|
|
249
|
-
paddingBottom: 2
|
|
241
|
+
alignItems: "center",
|
|
242
|
+
gap: 8
|
|
250
243
|
},
|
|
251
244
|
// Query Explorer styled container matching QueryDetails
|
|
252
245
|
queryExplorerContainer: {
|
|
@@ -73,11 +73,9 @@ function MutationEditorMode({
|
|
|
73
73
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
74
74
|
style: styles.actionsGrid,
|
|
75
75
|
children: actionButtons.map((action, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
76
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
77
76
|
onClick: action.onPress,
|
|
78
77
|
text: action.label,
|
|
79
|
-
|
|
80
|
-
_textColorClass: action.textColorClass,
|
|
78
|
+
variant: action.variant,
|
|
81
79
|
disabled: action.disabled
|
|
82
80
|
}, index))
|
|
83
81
|
})
|
|
@@ -7,63 +7,54 @@ exports.default = ActionButton;
|
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
8
|
var _sharedUi = require("@buoy-gg/shared-ui");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
//
|
|
10
|
+
// Clean, minimal color config matching React Query DevTools style
|
|
11
11
|
const buttonConfigs = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
borderColor: _sharedUi.buoyColors.
|
|
16
|
-
textColor: _sharedUi.buoyColors.success
|
|
12
|
+
refetch: {
|
|
13
|
+
dotColor: _sharedUi.buoyColors.success,
|
|
14
|
+
textColor: _sharedUi.buoyColors.text,
|
|
15
|
+
borderColor: _sharedUi.buoyColors.border
|
|
17
16
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
borderColor: _sharedUi.buoyColors.
|
|
22
|
-
textColor: _sharedUi.buoyColors.warning
|
|
17
|
+
invalidate: {
|
|
18
|
+
dotColor: _sharedUi.buoyColors.warning,
|
|
19
|
+
textColor: _sharedUi.buoyColors.text,
|
|
20
|
+
borderColor: _sharedUi.buoyColors.border
|
|
23
21
|
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
borderColor: _sharedUi.buoyColors.
|
|
28
|
-
textColor: _sharedUi.buoyColors.textSecondary
|
|
22
|
+
reset: {
|
|
23
|
+
dotColor: _sharedUi.buoyColors.textSecondary,
|
|
24
|
+
textColor: _sharedUi.buoyColors.text,
|
|
25
|
+
borderColor: _sharedUi.buoyColors.border
|
|
29
26
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
borderColor: _sharedUi.buoyColors.error + "40"
|
|
34
|
-
textColor: _sharedUi.buoyColors.error
|
|
27
|
+
remove: {
|
|
28
|
+
dotColor: _sharedUi.buoyColors.error,
|
|
29
|
+
textColor: _sharedUi.buoyColors.error,
|
|
30
|
+
borderColor: _sharedUi.buoyColors.error + "40"
|
|
35
31
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
borderColor: _sharedUi.buoyColors.
|
|
40
|
-
textColor: _sharedUi.buoyColors.primary
|
|
32
|
+
triggerLoading: {
|
|
33
|
+
dotColor: _sharedUi.buoyColors.info,
|
|
34
|
+
textColor: _sharedUi.buoyColors.info,
|
|
35
|
+
borderColor: _sharedUi.buoyColors.info + "40"
|
|
41
36
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
borderColor: _sharedUi.buoyColors.
|
|
46
|
-
textColor: _sharedUi.buoyColors.textMuted
|
|
37
|
+
triggerError: {
|
|
38
|
+
dotColor: _sharedUi.buoyColors.error,
|
|
39
|
+
textColor: _sharedUi.buoyColors.error,
|
|
40
|
+
borderColor: _sharedUi.buoyColors.error + "40"
|
|
47
41
|
}
|
|
48
42
|
};
|
|
49
|
-
/**
|
|
43
|
+
/** Clean, minimal action button matching React Query DevTools style. */
|
|
50
44
|
function ActionButton({
|
|
51
45
|
onClick,
|
|
52
46
|
text,
|
|
53
|
-
|
|
54
|
-
bgColorClass,
|
|
47
|
+
variant,
|
|
55
48
|
disabled
|
|
56
49
|
}) {
|
|
57
|
-
|
|
58
|
-
const config = buttonConfigs[bgColorClass];
|
|
50
|
+
const config = buttonConfigs[variant];
|
|
59
51
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
60
52
|
"sentry-label": "ignore devtools action button",
|
|
61
53
|
disabled: disabled,
|
|
62
54
|
onPress: onClick,
|
|
63
55
|
style: [styles.button, {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
opacity: disabled ? 0.5 : 1
|
|
56
|
+
borderColor: disabled ? _sharedUi.buoyColors.border : config.borderColor,
|
|
57
|
+
opacity: disabled ? 0.4 : 1
|
|
67
58
|
}],
|
|
68
59
|
activeOpacity: 0.7,
|
|
69
60
|
accessibilityRole: "button",
|
|
@@ -73,7 +64,7 @@ function ActionButton({
|
|
|
73
64
|
},
|
|
74
65
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
75
66
|
style: [styles.dot, {
|
|
76
|
-
backgroundColor: disabled ? _sharedUi.buoyColors.textMuted : config.
|
|
67
|
+
backgroundColor: disabled ? _sharedUi.buoyColors.textMuted : config.dotColor
|
|
77
68
|
}]
|
|
78
69
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
79
70
|
style: [styles.text, {
|
|
@@ -88,40 +79,20 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
88
79
|
flexDirection: "row",
|
|
89
80
|
alignItems: "center",
|
|
90
81
|
justifyContent: "center",
|
|
91
|
-
borderRadius:
|
|
92
|
-
// rectangular button shape
|
|
82
|
+
borderRadius: 4,
|
|
93
83
|
borderWidth: 1,
|
|
94
|
-
paddingHorizontal:
|
|
95
|
-
paddingVertical:
|
|
96
|
-
|
|
97
|
-
minWidth: 80,
|
|
98
|
-
shadowOffset: {
|
|
99
|
-
width: 0,
|
|
100
|
-
height: 1
|
|
101
|
-
},
|
|
102
|
-
shadowOpacity: 0.2,
|
|
103
|
-
shadowRadius: 2,
|
|
104
|
-
elevation: 2
|
|
84
|
+
paddingHorizontal: 8,
|
|
85
|
+
paddingVertical: 4,
|
|
86
|
+
backgroundColor: "transparent"
|
|
105
87
|
},
|
|
106
88
|
dot: {
|
|
107
|
-
width:
|
|
108
|
-
height:
|
|
89
|
+
width: 6,
|
|
90
|
+
height: 6,
|
|
109
91
|
borderRadius: 3,
|
|
110
|
-
marginRight: 6
|
|
111
|
-
shadowColor: _sharedUi.buoyColors.text,
|
|
112
|
-
shadowOffset: {
|
|
113
|
-
width: 0,
|
|
114
|
-
height: 0
|
|
115
|
-
},
|
|
116
|
-
shadowOpacity: 0.6,
|
|
117
|
-
shadowRadius: 2
|
|
92
|
+
marginRight: 6
|
|
118
93
|
},
|
|
119
94
|
text: {
|
|
120
|
-
fontSize:
|
|
121
|
-
fontWeight: "
|
|
122
|
-
letterSpacing: 0.5,
|
|
123
|
-
textTransform: "uppercase",
|
|
124
|
-
fontFamily: "monospace",
|
|
125
|
-
height: 12
|
|
95
|
+
fontSize: 12,
|
|
96
|
+
fontWeight: "500"
|
|
126
97
|
}
|
|
127
98
|
});
|
|
@@ -29,108 +29,94 @@ function QueryActions({
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
const queryStatus = query.state.status;
|
|
32
|
+
const isFetching = (0, _getQueryStatusLabel.getQueryStatusLabel)(query) === "fetching";
|
|
32
33
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
33
34
|
style: styles.container,
|
|
34
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
35
|
-
style: styles.
|
|
36
|
-
children:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(0, _refetch.default)({
|
|
35
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
36
|
+
style: styles.section,
|
|
37
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
38
|
+
style: styles.sectionLabel,
|
|
39
|
+
children: "Actions"
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
41
|
+
style: styles.buttonsRow,
|
|
42
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
43
|
+
disabled: isFetching,
|
|
44
|
+
onClick: () => (0, _refetch.default)({
|
|
44
45
|
query
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"sentry-label": "ignore devtools query invalidate action",
|
|
52
|
-
disabled: queryStatus === "pending",
|
|
53
|
-
onClick: () => {
|
|
54
|
-
(0, _invalidate.default)({
|
|
46
|
+
}),
|
|
47
|
+
variant: "refetch",
|
|
48
|
+
text: "Refetch"
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
50
|
+
disabled: queryStatus === "pending",
|
|
51
|
+
onClick: () => (0, _invalidate.default)({
|
|
55
52
|
query,
|
|
56
53
|
queryClient
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"sentry-label": "ignore devtools query reset action",
|
|
64
|
-
disabled: queryStatus === "pending",
|
|
65
|
-
onClick: () => {
|
|
66
|
-
(0, _reset.default)({
|
|
67
|
-
queryClient,
|
|
68
|
-
query
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
bgColorClass: "btnReset",
|
|
72
|
-
text: "Reset",
|
|
73
|
-
_textColorClass: "btnReset"
|
|
74
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
75
|
-
"sentry-label": "ignore devtools query remove action",
|
|
76
|
-
disabled: (0, _getQueryStatusLabel.getQueryStatusLabel)(query) === "fetching",
|
|
77
|
-
onClick: () => {
|
|
78
|
-
(0, _remove.default)({
|
|
54
|
+
}),
|
|
55
|
+
variant: "invalidate",
|
|
56
|
+
text: "Invalidate"
|
|
57
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
58
|
+
disabled: queryStatus === "pending",
|
|
59
|
+
onClick: () => (0, _reset.default)({
|
|
79
60
|
queryClient,
|
|
80
61
|
query
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
62
|
+
}),
|
|
63
|
+
variant: "reset",
|
|
64
|
+
text: "Reset"
|
|
65
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
66
|
+
disabled: isFetching,
|
|
67
|
+
onClick: () => {
|
|
68
|
+
(0, _remove.default)({
|
|
69
|
+
queryClient,
|
|
70
|
+
query
|
|
71
|
+
});
|
|
72
|
+
setSelectedQuery(undefined);
|
|
73
|
+
},
|
|
74
|
+
variant: "remove",
|
|
75
|
+
text: "Remove"
|
|
76
|
+
})]
|
|
77
|
+
})]
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
79
|
+
style: styles.section,
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
81
|
+
style: styles.sectionLabel,
|
|
82
|
+
children: "Triggers"
|
|
83
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
84
|
+
style: styles.buttonsRow,
|
|
85
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
86
|
+
disabled: false,
|
|
87
|
+
onClick: () => (0, _triggerLoading.default)({
|
|
92
88
|
query
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"sentry-label": "ignore devtools query trigger error action",
|
|
100
|
-
disabled: queryStatus === "pending",
|
|
101
|
-
onClick: () => {
|
|
102
|
-
(0, _triggerError.default)({
|
|
89
|
+
}),
|
|
90
|
+
variant: "triggerLoading",
|
|
91
|
+
text: query.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading"
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ActionButton.default, {
|
|
93
|
+
disabled: queryStatus === "pending",
|
|
94
|
+
onClick: () => (0, _triggerError.default)({
|
|
103
95
|
query,
|
|
104
96
|
queryClient
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
_textColorClass: "btnTriggerLoadiError"
|
|
97
|
+
}),
|
|
98
|
+
variant: "triggerError",
|
|
99
|
+
text: queryStatus === "error" ? "Restore Error" : "Trigger Error"
|
|
100
|
+
})]
|
|
110
101
|
})]
|
|
111
102
|
})]
|
|
112
103
|
});
|
|
113
104
|
}
|
|
114
105
|
const styles = _reactNative.StyleSheet.create({
|
|
115
106
|
container: {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
padding: 16,
|
|
121
|
-
gap: 12
|
|
107
|
+
gap: 16
|
|
108
|
+
},
|
|
109
|
+
section: {
|
|
110
|
+
gap: 8
|
|
122
111
|
},
|
|
123
|
-
|
|
124
|
-
fontSize:
|
|
125
|
-
fontWeight: "
|
|
126
|
-
color: _sharedUi.buoyColors.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
fontFamily: "monospace",
|
|
130
|
-
letterSpacing: 1,
|
|
131
|
-
textTransform: "uppercase"
|
|
112
|
+
sectionLabel: {
|
|
113
|
+
fontSize: 11,
|
|
114
|
+
fontWeight: "600",
|
|
115
|
+
color: _sharedUi.buoyColors.textMuted,
|
|
116
|
+
textTransform: "uppercase",
|
|
117
|
+
letterSpacing: 0.5
|
|
132
118
|
},
|
|
133
|
-
|
|
119
|
+
buttonsRow: {
|
|
134
120
|
flexDirection: "row",
|
|
135
121
|
flexWrap: "wrap",
|
|
136
122
|
gap: 8
|
|
@@ -11,14 +11,12 @@ var _triggerError = _interopRequireDefault(require("../utils/actions/triggerErro
|
|
|
11
11
|
var _getQueryStatusLabel = require("../utils/getQueryStatusLabel");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
13
|
/**
|
|
14
|
-
* Derives
|
|
15
|
-
*
|
|
14
|
+
* Derives compact action button configuration for the footer. Returns 3 essential buttons
|
|
15
|
+
* (Refetch, Loading, Error) optimized for small device footprints.
|
|
16
16
|
*
|
|
17
17
|
* @param selectedQuery - The query to derive actions for
|
|
18
18
|
* @param queryClient - The query client for executing actions
|
|
19
19
|
* @param queryVersion - Optional version number that increments on query state changes.
|
|
20
|
-
* React Query mutates Query objects in place, so this version ensures
|
|
21
|
-
* the useMemo recomputes when state changes.
|
|
22
20
|
*/
|
|
23
21
|
function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
24
22
|
const actionButtons = (0, _react.useMemo)(() => {
|
|
@@ -26,24 +24,21 @@ function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
26
24
|
const isFetching = (0, _getQueryStatusLabel.getQueryStatusLabel)(selectedQuery) === "fetching";
|
|
27
25
|
const buttons = [{
|
|
28
26
|
label: "Refetch",
|
|
29
|
-
|
|
30
|
-
textColorClass: "btnRefetch",
|
|
27
|
+
variant: "refetch",
|
|
31
28
|
disabled: isFetching,
|
|
32
29
|
onPress: () => (0, _refetch.default)({
|
|
33
30
|
query: selectedQuery
|
|
34
31
|
})
|
|
35
32
|
}, {
|
|
36
|
-
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore" : "Loading",
|
|
37
|
-
|
|
38
|
-
textColorClass: "btnTriggerLoading",
|
|
33
|
+
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading",
|
|
34
|
+
variant: "triggerLoading",
|
|
39
35
|
disabled: false,
|
|
40
36
|
onPress: () => (0, _triggerLoading.default)({
|
|
41
37
|
query: selectedQuery
|
|
42
38
|
})
|
|
43
39
|
}, {
|
|
44
|
-
label: queryStatus === "error" ? "Restore" : "Error",
|
|
45
|
-
|
|
46
|
-
textColorClass: "btnTriggerLoadiError",
|
|
40
|
+
label: queryStatus === "error" ? "Restore Error" : "Trigger Error",
|
|
41
|
+
variant: "triggerError",
|
|
47
42
|
disabled: queryStatus === "pending",
|
|
48
43
|
onPress: () => (0, _triggerError.default)({
|
|
49
44
|
query: selectedQuery,
|
|
@@ -51,9 +46,6 @@ function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
51
46
|
})
|
|
52
47
|
}];
|
|
53
48
|
return buttons;
|
|
54
|
-
// queryVersion is the key dependency that ensures this recomputes when query state changes.
|
|
55
|
-
// React Query mutates Query objects in place, so comparing selectedQuery.state.* values
|
|
56
|
-
// doesn't work reliably (the "previous" and "current" values read from the same mutated object).
|
|
57
49
|
}, [selectedQuery, queryClient, queryVersion]);
|
|
58
50
|
return actionButtons;
|
|
59
51
|
}
|
|
@@ -14,8 +14,7 @@ function useMutationActionButtons(selectedMutation) {
|
|
|
14
14
|
const queryClient = (0, _reactQuery.useQueryClient)();
|
|
15
15
|
return (0, _react.useMemo)(() => [{
|
|
16
16
|
label: "Remove",
|
|
17
|
-
|
|
18
|
-
textColorClass: "btnRemove",
|
|
17
|
+
variant: "remove",
|
|
19
18
|
disabled: false,
|
|
20
19
|
onPress: () => queryClient.getMutationCache().remove(selectedMutation)
|
|
21
20
|
}], [selectedMutation, queryClient]);
|
|
@@ -74,13 +74,11 @@ export function DataEditorMode({
|
|
|
74
74
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
75
75
|
}],
|
|
76
76
|
children: /*#__PURE__*/_jsx(View, {
|
|
77
|
-
style: styles.
|
|
77
|
+
style: styles.actionsRow,
|
|
78
78
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
79
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
80
79
|
onClick: action.onPress,
|
|
81
80
|
text: action.label,
|
|
82
|
-
|
|
83
|
-
_textColorClass: action.textColorClass,
|
|
81
|
+
variant: action.variant,
|
|
84
82
|
disabled: action.disabled
|
|
85
83
|
}, index))
|
|
86
84
|
})
|
|
@@ -108,13 +106,11 @@ export function DataEditorActionsFooter({
|
|
|
108
106
|
paddingBottom: isFloatingMode ? 0 : insets.bottom + 8
|
|
109
107
|
}],
|
|
110
108
|
children: /*#__PURE__*/_jsx(View, {
|
|
111
|
-
style: styles.
|
|
109
|
+
style: styles.actionsRow,
|
|
112
110
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
113
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
114
111
|
onClick: action.onPress,
|
|
115
112
|
text: action.label,
|
|
116
|
-
|
|
117
|
-
_textColorClass: action.textColorClass,
|
|
113
|
+
variant: action.variant,
|
|
118
114
|
disabled: action.disabled
|
|
119
115
|
}, index))
|
|
120
116
|
})
|
|
@@ -224,23 +220,20 @@ const styles = StyleSheet.create({
|
|
|
224
220
|
lineHeight: 20,
|
|
225
221
|
maxWidth: 280
|
|
226
222
|
},
|
|
227
|
-
// Action footer
|
|
223
|
+
// Action footer - compact single row layout
|
|
228
224
|
actionFooter: {
|
|
229
225
|
borderTopWidth: 1,
|
|
230
226
|
borderTopColor: buoyColors.border,
|
|
231
|
-
paddingTop:
|
|
227
|
+
paddingTop: 8,
|
|
232
228
|
paddingHorizontal: 12,
|
|
233
229
|
backgroundColor: buoyColors.base,
|
|
234
230
|
borderBottomLeftRadius: 14,
|
|
235
231
|
borderBottomRightRadius: 14
|
|
236
232
|
},
|
|
237
|
-
|
|
233
|
+
actionsRow: {
|
|
238
234
|
flexDirection: "row",
|
|
239
|
-
|
|
240
|
-
gap:
|
|
241
|
-
// Reduced from 8
|
|
242
|
-
justifyContent: "space-between",
|
|
243
|
-
paddingBottom: 2
|
|
235
|
+
alignItems: "center",
|
|
236
|
+
gap: 8
|
|
244
237
|
},
|
|
245
238
|
// Query Explorer styled container matching QueryDetails
|
|
246
239
|
queryExplorerContainer: {
|
|
@@ -68,11 +68,9 @@ export function MutationEditorMode({
|
|
|
68
68
|
children: /*#__PURE__*/_jsx(View, {
|
|
69
69
|
style: styles.actionsGrid,
|
|
70
70
|
children: actionButtons.map((action, index) => /*#__PURE__*/_jsx(ActionButton, {
|
|
71
|
-
"sentry-label": `ignore action button ${action.label}`,
|
|
72
71
|
onClick: action.onPress,
|
|
73
72
|
text: action.label,
|
|
74
|
-
|
|
75
|
-
_textColorClass: action.textColorClass,
|
|
73
|
+
variant: action.variant,
|
|
76
74
|
disabled: action.disabled
|
|
77
75
|
}, index))
|
|
78
76
|
})
|
|
@@ -2,65 +2,55 @@
|
|
|
2
2
|
|
|
3
3
|
import { TouchableOpacity, Text, View, StyleSheet } from "react-native";
|
|
4
4
|
import { buoyColors } from "@buoy-gg/shared-ui";
|
|
5
|
-
|
|
6
|
-
// Define the color mappings using Buoy theme colors
|
|
7
5
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
// Clean, minimal color config matching React Query DevTools style
|
|
8
7
|
const buttonConfigs = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
borderColor: buoyColors.
|
|
13
|
-
textColor: buoyColors.success
|
|
8
|
+
refetch: {
|
|
9
|
+
dotColor: buoyColors.success,
|
|
10
|
+
textColor: buoyColors.text,
|
|
11
|
+
borderColor: buoyColors.border
|
|
14
12
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
borderColor: buoyColors.
|
|
19
|
-
textColor: buoyColors.warning
|
|
13
|
+
invalidate: {
|
|
14
|
+
dotColor: buoyColors.warning,
|
|
15
|
+
textColor: buoyColors.text,
|
|
16
|
+
borderColor: buoyColors.border
|
|
20
17
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
borderColor: buoyColors.
|
|
25
|
-
textColor: buoyColors.textSecondary
|
|
18
|
+
reset: {
|
|
19
|
+
dotColor: buoyColors.textSecondary,
|
|
20
|
+
textColor: buoyColors.text,
|
|
21
|
+
borderColor: buoyColors.border
|
|
26
22
|
},
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
borderColor: buoyColors.error + "40"
|
|
31
|
-
textColor: buoyColors.error
|
|
23
|
+
remove: {
|
|
24
|
+
dotColor: buoyColors.error,
|
|
25
|
+
textColor: buoyColors.error,
|
|
26
|
+
borderColor: buoyColors.error + "40"
|
|
32
27
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
borderColor: buoyColors.
|
|
37
|
-
textColor: buoyColors.primary
|
|
28
|
+
triggerLoading: {
|
|
29
|
+
dotColor: buoyColors.info,
|
|
30
|
+
textColor: buoyColors.info,
|
|
31
|
+
borderColor: buoyColors.info + "40"
|
|
38
32
|
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
borderColor: buoyColors.
|
|
43
|
-
textColor: buoyColors.textMuted
|
|
33
|
+
triggerError: {
|
|
34
|
+
dotColor: buoyColors.error,
|
|
35
|
+
textColor: buoyColors.error,
|
|
36
|
+
borderColor: buoyColors.error + "40"
|
|
44
37
|
}
|
|
45
38
|
};
|
|
46
|
-
/**
|
|
39
|
+
/** Clean, minimal action button matching React Query DevTools style. */
|
|
47
40
|
export default function ActionButton({
|
|
48
41
|
onClick,
|
|
49
42
|
text,
|
|
50
|
-
|
|
51
|
-
bgColorClass,
|
|
43
|
+
variant,
|
|
52
44
|
disabled
|
|
53
45
|
}) {
|
|
54
|
-
|
|
55
|
-
const config = buttonConfigs[bgColorClass];
|
|
46
|
+
const config = buttonConfigs[variant];
|
|
56
47
|
return /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
57
48
|
"sentry-label": "ignore devtools action button",
|
|
58
49
|
disabled: disabled,
|
|
59
50
|
onPress: onClick,
|
|
60
51
|
style: [styles.button, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
opacity: disabled ? 0.5 : 1
|
|
52
|
+
borderColor: disabled ? buoyColors.border : config.borderColor,
|
|
53
|
+
opacity: disabled ? 0.4 : 1
|
|
64
54
|
}],
|
|
65
55
|
activeOpacity: 0.7,
|
|
66
56
|
accessibilityRole: "button",
|
|
@@ -70,7 +60,7 @@ export default function ActionButton({
|
|
|
70
60
|
},
|
|
71
61
|
children: [/*#__PURE__*/_jsx(View, {
|
|
72
62
|
style: [styles.dot, {
|
|
73
|
-
backgroundColor: disabled ? buoyColors.textMuted : config.
|
|
63
|
+
backgroundColor: disabled ? buoyColors.textMuted : config.dotColor
|
|
74
64
|
}]
|
|
75
65
|
}), /*#__PURE__*/_jsx(Text, {
|
|
76
66
|
style: [styles.text, {
|
|
@@ -85,40 +75,20 @@ const styles = StyleSheet.create({
|
|
|
85
75
|
flexDirection: "row",
|
|
86
76
|
alignItems: "center",
|
|
87
77
|
justifyContent: "center",
|
|
88
|
-
borderRadius:
|
|
89
|
-
// rectangular button shape
|
|
78
|
+
borderRadius: 4,
|
|
90
79
|
borderWidth: 1,
|
|
91
|
-
paddingHorizontal:
|
|
92
|
-
paddingVertical:
|
|
93
|
-
|
|
94
|
-
minWidth: 80,
|
|
95
|
-
shadowOffset: {
|
|
96
|
-
width: 0,
|
|
97
|
-
height: 1
|
|
98
|
-
},
|
|
99
|
-
shadowOpacity: 0.2,
|
|
100
|
-
shadowRadius: 2,
|
|
101
|
-
elevation: 2
|
|
80
|
+
paddingHorizontal: 8,
|
|
81
|
+
paddingVertical: 4,
|
|
82
|
+
backgroundColor: "transparent"
|
|
102
83
|
},
|
|
103
84
|
dot: {
|
|
104
|
-
width:
|
|
105
|
-
height:
|
|
85
|
+
width: 6,
|
|
86
|
+
height: 6,
|
|
106
87
|
borderRadius: 3,
|
|
107
|
-
marginRight: 6
|
|
108
|
-
shadowColor: buoyColors.text,
|
|
109
|
-
shadowOffset: {
|
|
110
|
-
width: 0,
|
|
111
|
-
height: 0
|
|
112
|
-
},
|
|
113
|
-
shadowOpacity: 0.6,
|
|
114
|
-
shadowRadius: 2
|
|
88
|
+
marginRight: 6
|
|
115
89
|
},
|
|
116
90
|
text: {
|
|
117
|
-
fontSize:
|
|
118
|
-
fontWeight: "
|
|
119
|
-
letterSpacing: 0.5,
|
|
120
|
-
textTransform: "uppercase",
|
|
121
|
-
fontFamily: "monospace",
|
|
122
|
-
height: 12
|
|
91
|
+
fontSize: 12,
|
|
92
|
+
fontWeight: "500"
|
|
123
93
|
}
|
|
124
94
|
});
|
|
@@ -24,108 +24,94 @@ export default function QueryActions({
|
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
const queryStatus = query.state.status;
|
|
27
|
+
const isFetching = getQueryStatusLabel(query) === "fetching";
|
|
27
28
|
return /*#__PURE__*/_jsxs(View, {
|
|
28
29
|
style: styles.container,
|
|
29
|
-
children: [/*#__PURE__*/
|
|
30
|
-
style: styles.
|
|
31
|
-
children:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
refetch({
|
|
30
|
+
children: [/*#__PURE__*/_jsxs(View, {
|
|
31
|
+
style: styles.section,
|
|
32
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
33
|
+
style: styles.sectionLabel,
|
|
34
|
+
children: "Actions"
|
|
35
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
36
|
+
style: styles.buttonsRow,
|
|
37
|
+
children: [/*#__PURE__*/_jsx(ActionButton, {
|
|
38
|
+
disabled: isFetching,
|
|
39
|
+
onClick: () => refetch({
|
|
39
40
|
query
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"sentry-label": "ignore devtools query invalidate action",
|
|
47
|
-
disabled: queryStatus === "pending",
|
|
48
|
-
onClick: () => {
|
|
49
|
-
invalidate({
|
|
41
|
+
}),
|
|
42
|
+
variant: "refetch",
|
|
43
|
+
text: "Refetch"
|
|
44
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
45
|
+
disabled: queryStatus === "pending",
|
|
46
|
+
onClick: () => invalidate({
|
|
50
47
|
query,
|
|
51
48
|
queryClient
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"sentry-label": "ignore devtools query reset action",
|
|
59
|
-
disabled: queryStatus === "pending",
|
|
60
|
-
onClick: () => {
|
|
61
|
-
reset({
|
|
62
|
-
queryClient,
|
|
63
|
-
query
|
|
64
|
-
});
|
|
65
|
-
},
|
|
66
|
-
bgColorClass: "btnReset",
|
|
67
|
-
text: "Reset",
|
|
68
|
-
_textColorClass: "btnReset"
|
|
69
|
-
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
70
|
-
"sentry-label": "ignore devtools query remove action",
|
|
71
|
-
disabled: getQueryStatusLabel(query) === "fetching",
|
|
72
|
-
onClick: () => {
|
|
73
|
-
remove({
|
|
49
|
+
}),
|
|
50
|
+
variant: "invalidate",
|
|
51
|
+
text: "Invalidate"
|
|
52
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
53
|
+
disabled: queryStatus === "pending",
|
|
54
|
+
onClick: () => reset({
|
|
74
55
|
queryClient,
|
|
75
56
|
query
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
}),
|
|
58
|
+
variant: "reset",
|
|
59
|
+
text: "Reset"
|
|
60
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
61
|
+
disabled: isFetching,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
remove({
|
|
64
|
+
queryClient,
|
|
65
|
+
query
|
|
66
|
+
});
|
|
67
|
+
setSelectedQuery(undefined);
|
|
68
|
+
},
|
|
69
|
+
variant: "remove",
|
|
70
|
+
text: "Remove"
|
|
71
|
+
})]
|
|
72
|
+
})]
|
|
73
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
74
|
+
style: styles.section,
|
|
75
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
76
|
+
style: styles.sectionLabel,
|
|
77
|
+
children: "Triggers"
|
|
78
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
79
|
+
style: styles.buttonsRow,
|
|
80
|
+
children: [/*#__PURE__*/_jsx(ActionButton, {
|
|
81
|
+
disabled: false,
|
|
82
|
+
onClick: () => triggerLoading({
|
|
87
83
|
query
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
"sentry-label": "ignore devtools query trigger error action",
|
|
95
|
-
disabled: queryStatus === "pending",
|
|
96
|
-
onClick: () => {
|
|
97
|
-
triggerError({
|
|
84
|
+
}),
|
|
85
|
+
variant: "triggerLoading",
|
|
86
|
+
text: query.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading"
|
|
87
|
+
}), /*#__PURE__*/_jsx(ActionButton, {
|
|
88
|
+
disabled: queryStatus === "pending",
|
|
89
|
+
onClick: () => triggerError({
|
|
98
90
|
query,
|
|
99
91
|
queryClient
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
_textColorClass: "btnTriggerLoadiError"
|
|
92
|
+
}),
|
|
93
|
+
variant: "triggerError",
|
|
94
|
+
text: queryStatus === "error" ? "Restore Error" : "Trigger Error"
|
|
95
|
+
})]
|
|
105
96
|
})]
|
|
106
97
|
})]
|
|
107
98
|
});
|
|
108
99
|
}
|
|
109
100
|
const styles = StyleSheet.create({
|
|
110
101
|
container: {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
padding: 16,
|
|
116
|
-
gap: 12
|
|
102
|
+
gap: 16
|
|
103
|
+
},
|
|
104
|
+
section: {
|
|
105
|
+
gap: 8
|
|
117
106
|
},
|
|
118
|
-
|
|
119
|
-
fontSize:
|
|
120
|
-
fontWeight: "
|
|
121
|
-
color: buoyColors.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
fontFamily: "monospace",
|
|
125
|
-
letterSpacing: 1,
|
|
126
|
-
textTransform: "uppercase"
|
|
107
|
+
sectionLabel: {
|
|
108
|
+
fontSize: 11,
|
|
109
|
+
fontWeight: "600",
|
|
110
|
+
color: buoyColors.textMuted,
|
|
111
|
+
textTransform: "uppercase",
|
|
112
|
+
letterSpacing: 0.5
|
|
127
113
|
},
|
|
128
|
-
|
|
114
|
+
buttonsRow: {
|
|
129
115
|
flexDirection: "row",
|
|
130
116
|
flexWrap: "wrap",
|
|
131
117
|
gap: 8
|
|
@@ -6,14 +6,12 @@ import refetch from "../utils/actions/refetch";
|
|
|
6
6
|
import triggerError from "../utils/actions/triggerError";
|
|
7
7
|
import { getQueryStatusLabel } from "../utils/getQueryStatusLabel";
|
|
8
8
|
/**
|
|
9
|
-
* Derives
|
|
10
|
-
*
|
|
9
|
+
* Derives compact action button configuration for the footer. Returns 3 essential buttons
|
|
10
|
+
* (Refetch, Loading, Error) optimized for small device footprints.
|
|
11
11
|
*
|
|
12
12
|
* @param selectedQuery - The query to derive actions for
|
|
13
13
|
* @param queryClient - The query client for executing actions
|
|
14
14
|
* @param queryVersion - Optional version number that increments on query state changes.
|
|
15
|
-
* React Query mutates Query objects in place, so this version ensures
|
|
16
|
-
* the useMemo recomputes when state changes.
|
|
17
15
|
*/
|
|
18
16
|
export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
19
17
|
const actionButtons = useMemo(() => {
|
|
@@ -21,24 +19,21 @@ export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
21
19
|
const isFetching = getQueryStatusLabel(selectedQuery) === "fetching";
|
|
22
20
|
const buttons = [{
|
|
23
21
|
label: "Refetch",
|
|
24
|
-
|
|
25
|
-
textColorClass: "btnRefetch",
|
|
22
|
+
variant: "refetch",
|
|
26
23
|
disabled: isFetching,
|
|
27
24
|
onPress: () => refetch({
|
|
28
25
|
query: selectedQuery
|
|
29
26
|
})
|
|
30
27
|
}, {
|
|
31
|
-
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore" : "Loading",
|
|
32
|
-
|
|
33
|
-
textColorClass: "btnTriggerLoading",
|
|
28
|
+
label: selectedQuery.state.fetchStatus === "fetching" ? "Restore Loading" : "Trigger Loading",
|
|
29
|
+
variant: "triggerLoading",
|
|
34
30
|
disabled: false,
|
|
35
31
|
onPress: () => triggerLoading({
|
|
36
32
|
query: selectedQuery
|
|
37
33
|
})
|
|
38
34
|
}, {
|
|
39
|
-
label: queryStatus === "error" ? "Restore" : "Error",
|
|
40
|
-
|
|
41
|
-
textColorClass: "btnTriggerLoadiError",
|
|
35
|
+
label: queryStatus === "error" ? "Restore Error" : "Trigger Error",
|
|
36
|
+
variant: "triggerError",
|
|
42
37
|
disabled: queryStatus === "pending",
|
|
43
38
|
onPress: () => triggerError({
|
|
44
39
|
query: selectedQuery,
|
|
@@ -46,9 +41,6 @@ export function useActionButtons(selectedQuery, queryClient, queryVersion) {
|
|
|
46
41
|
})
|
|
47
42
|
}];
|
|
48
43
|
return buttons;
|
|
49
|
-
// queryVersion is the key dependency that ensures this recomputes when query state changes.
|
|
50
|
-
// React Query mutates Query objects in place, so comparing selectedQuery.state.* values
|
|
51
|
-
// doesn't work reliably (the "previous" and "current" values read from the same mutated object).
|
|
52
44
|
}, [selectedQuery, queryClient, queryVersion]);
|
|
53
45
|
return actionButtons;
|
|
54
46
|
}
|
|
@@ -10,8 +10,7 @@ export function useMutationActionButtons(selectedMutation) {
|
|
|
10
10
|
const queryClient = useQueryClient();
|
|
11
11
|
return useMemo(() => [{
|
|
12
12
|
label: "Remove",
|
|
13
|
-
|
|
14
|
-
textColorClass: "btnRemove",
|
|
13
|
+
variant: "remove",
|
|
15
14
|
disabled: false,
|
|
16
15
|
onPress: () => queryClient.getMutationCache().remove(selectedMutation)
|
|
17
16
|
}], [selectedMutation, queryClient]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataEditorMode.d.ts","sourceRoot":"","sources":["../../../../src/react-query/components/DataEditorMode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAkB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"DataEditorMode.d.ts","sourceRoot":"","sources":["../../../../src/react-query/components/DataEditorMode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAkB,MAAM,uBAAuB,CAAC;AAS9D,UAAU,mBAAmB;IAC3B,aAAa,EAAE,KAAK,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,cAAc,EACd,qBAA6B,EAC7B,YAAY,GACb,EAAE,mBAAmB,+BA4ErB;AAGD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,aAAa,EACb,cAAc,EACd,YAAY,GACb,EAAE;IACD,aAAa,EAAE,KAAK,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,wFAAwF;IACxF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,+BAyBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationEditorMode.d.ts","sourceRoot":"","sources":["../../../../src/react-query/components/MutationEditorMode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQjD,UAAU,uBAAuB;IAC/B,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,gBAAgB,EAChB,cAAc,GACf,EAAE,uBAAuB,+
|
|
1
|
+
{"version":3,"file":"MutationEditorMode.d.ts","sourceRoot":"","sources":["../../../../src/react-query/components/MutationEditorMode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAQjD,UAAU,uBAAuB;IAC/B,gBAAgB,EAAE,QAAQ,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,gBAAgB,EAChB,cAAc,GACf,EAAE,uBAAuB,+BAqEzB"}
|
|
@@ -1,49 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
btnRefetch: {
|
|
3
|
-
color: "#20C997";
|
|
4
|
-
backgroundColor: string;
|
|
5
|
-
borderColor: string;
|
|
6
|
-
textColor: "#20C997";
|
|
7
|
-
};
|
|
8
|
-
btnInvalidate: {
|
|
9
|
-
color: "#FFA94D";
|
|
10
|
-
backgroundColor: string;
|
|
11
|
-
borderColor: string;
|
|
12
|
-
textColor: "#FFA94D";
|
|
13
|
-
};
|
|
14
|
-
btnReset: {
|
|
15
|
-
color: "#A0A0A0";
|
|
16
|
-
backgroundColor: string;
|
|
17
|
-
borderColor: string;
|
|
18
|
-
textColor: "#A0A0A0";
|
|
19
|
-
};
|
|
20
|
-
btnRemove: {
|
|
21
|
-
color: "#EF4444";
|
|
22
|
-
backgroundColor: string;
|
|
23
|
-
borderColor: string;
|
|
24
|
-
textColor: "#EF4444";
|
|
25
|
-
};
|
|
26
|
-
btnTriggerLoading: {
|
|
27
|
-
color: "#20C997";
|
|
28
|
-
backgroundColor: string;
|
|
29
|
-
borderColor: string;
|
|
30
|
-
textColor: "#20C997";
|
|
31
|
-
};
|
|
32
|
-
btnTriggerLoadiError: {
|
|
33
|
-
color: "#888888";
|
|
34
|
-
backgroundColor: string;
|
|
35
|
-
borderColor: string;
|
|
36
|
-
textColor: "#888888";
|
|
37
|
-
};
|
|
38
|
-
};
|
|
1
|
+
export type ButtonVariant = "refetch" | "invalidate" | "reset" | "remove" | "triggerLoading" | "triggerError";
|
|
39
2
|
interface Props {
|
|
40
3
|
onClick: () => void;
|
|
41
4
|
text: string;
|
|
42
|
-
|
|
43
|
-
_textColorClass: keyof typeof buttonConfigs;
|
|
5
|
+
variant: ButtonVariant;
|
|
44
6
|
disabled: boolean;
|
|
45
7
|
}
|
|
46
|
-
/**
|
|
47
|
-
export default function ActionButton({ onClick, text,
|
|
8
|
+
/** Clean, minimal action button matching React Query DevTools style. */
|
|
9
|
+
export default function ActionButton({ onClick, text, variant, disabled, }: Props): import("react").JSX.Element;
|
|
48
10
|
export {};
|
|
49
11
|
//# sourceMappingURL=ActionButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../../../../src/react-query/components/query-browser/ActionButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionButton.d.ts","sourceRoot":"","sources":["../../../../../src/react-query/components/query-browser/ActionButton.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GACrB,SAAS,GACT,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,gBAAgB,GAChB,cAAc,CAAC;AAuCnB,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wEAAwE;AACxE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,OAAO,EACP,IAAI,EACJ,OAAO,EACP,QAAQ,GACT,EAAE,KAAK,+BAoCP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryActions.d.ts","sourceRoot":"","sources":["../../../../../src/react-query/components/query-browser/QueryActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,KAAK,EAAkB,MAAM,uBAAuB,CAAC;AAY9D,UAAU,KAAK;IACb,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B;
|
|
1
|
+
{"version":3,"file":"QueryActions.d.ts","sourceRoot":"","sources":["../../../../../src/react-query/components/query-browser/QueryActions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,KAAK,EAAkB,MAAM,uBAAuB,CAAC;AAY9D,UAAU,KAAK;IACb,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9D,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,KAAK,sCAoEtE"}
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { Query, QueryClient } from "@tanstack/react-query";
|
|
2
|
-
|
|
2
|
+
import type { ButtonVariant } from "../components/query-browser/ActionButton";
|
|
3
|
+
export interface ActionButtonConfig {
|
|
3
4
|
label: string;
|
|
4
|
-
|
|
5
|
-
textColorClass: "btnRefetch" | "btnTriggerLoading" | "btnTriggerLoadiError" | "btnRemove";
|
|
5
|
+
variant: ButtonVariant;
|
|
6
6
|
disabled: boolean;
|
|
7
7
|
onPress: () => void;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
* Derives
|
|
11
|
-
*
|
|
10
|
+
* Derives compact action button configuration for the footer. Returns 3 essential buttons
|
|
11
|
+
* (Refetch, Loading, Error) optimized for small device footprints.
|
|
12
12
|
*
|
|
13
13
|
* @param selectedQuery - The query to derive actions for
|
|
14
14
|
* @param queryClient - The query client for executing actions
|
|
15
15
|
* @param queryVersion - Optional version number that increments on query state changes.
|
|
16
|
-
* React Query mutates Query objects in place, so this version ensures
|
|
17
|
-
* the useMemo recomputes when state changes.
|
|
18
16
|
*/
|
|
19
17
|
export declare function useActionButtons(selectedQuery: Query, queryClient: QueryClient, queryVersion?: number): ActionButtonConfig[];
|
|
20
|
-
export {};
|
|
21
18
|
//# sourceMappingURL=useActionButtons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/react-query/hooks/useActionButtons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/react-query/hooks/useActionButtons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,aAAa,EAAE,KAAK,EACpB,WAAW,EAAE,WAAW,EACxB,YAAY,CAAC,EAAE,MAAM,GACpB,kBAAkB,EAAE,CA+BtB"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import { Mutation } from "@tanstack/react-query";
|
|
2
|
-
|
|
3
|
-
label: string;
|
|
4
|
-
bgColorClass: "btnRefetch" | "btnTriggerLoading" | "btnTriggerLoadiError" | "btnRemove";
|
|
5
|
-
textColorClass: "btnRefetch" | "btnTriggerLoading" | "btnTriggerLoadiError" | "btnRemove";
|
|
6
|
-
disabled: boolean;
|
|
7
|
-
onPress: () => void;
|
|
8
|
-
}
|
|
2
|
+
import type { ActionButtonConfig } from "./useActionButtons";
|
|
9
3
|
/**
|
|
10
4
|
* Supplies action button metadata for a selected mutation. Currently exposes a remove control but
|
|
11
5
|
* centralizes logic so future actions stay consistent across the UI.
|
|
12
6
|
*/
|
|
13
7
|
export declare function useMutationActionButtons(selectedMutation: Mutation): ActionButtonConfig[];
|
|
14
|
-
export {};
|
|
15
8
|
//# sourceMappingURL=useMutationActionButtons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/react-query/hooks/useMutationActionButtons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"useMutationActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/react-query/hooks/useMutationActionButtons.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAkB,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE7D;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,QAAQ,GACzB,kBAAkB,EAAE,CAatB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buoy-gg/react-query",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "react-query package",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
],
|
|
27
27
|
"sideEffects": false,
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@buoy-gg/floating-tools-core": "2.1.
|
|
30
|
-
"@buoy-gg/shared-ui": "2.1.
|
|
29
|
+
"@buoy-gg/floating-tools-core": "2.1.2",
|
|
30
|
+
"@buoy-gg/shared-ui": "2.1.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@tanstack/react-query": ">=5.0.0",
|