@tanstack/query-devtools 5.0.3 → 5.1.0
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/build/Devtools/{B2H37NSB.js → BWLPXLBN.js} +1466 -390
- package/build/Devtools/{3Y5CBXUA.js → CRASJTHY.js} +1466 -390
- package/build/Devtools/{Y2E2LEWB.jsx → QHGCTHEZ.jsx} +1170 -142
- package/build/Devtools/{7SMWYMBY.jsx → QHLLQ2XL.jsx} +1170 -142
- package/build/chunk/{AHAJNSNO.jsx → JRAMSUCV.jsx} +5 -0
- package/build/dev.cjs +1478 -395
- package/build/dev.js +1 -1
- package/build/dev.jsx +2 -2
- package/build/index.cjs +1478 -395
- package/build/index.js +1 -1
- package/build/index.jsx +2 -2
- package/package.json +3 -3
- package/src/Devtools.tsx +773 -121
- package/src/__tests__/devtools.test.tsx +2 -0
- package/src/__tests__/utils.test.ts +1 -0
- package/src/icons/index.tsx +89 -0
- package/src/theme.ts +11 -11
- package/src/utils.tsx +46 -1
|
@@ -30,11 +30,13 @@ import {
|
|
|
30
30
|
onMount,
|
|
31
31
|
setAttribute,
|
|
32
32
|
splitProps,
|
|
33
|
+
spread,
|
|
33
34
|
template,
|
|
34
35
|
untrack,
|
|
36
|
+
use,
|
|
35
37
|
useContext,
|
|
36
38
|
useTransition
|
|
37
|
-
} from "../chunk/
|
|
39
|
+
} from "../chunk/JRAMSUCV.jsx";
|
|
38
40
|
|
|
39
41
|
// ../../node_modules/.pnpm/@tanstack+match-sorter-utils@8.8.4/node_modules/@tanstack/match-sorter-utils/build/lib/index.mjs
|
|
40
42
|
var characterMap = {
|
|
@@ -4073,6 +4075,29 @@ function createFocusScope(props, ref) {
|
|
|
4073
4075
|
});
|
|
4074
4076
|
});
|
|
4075
4077
|
}
|
|
4078
|
+
function createFormResetListener(element, handler) {
|
|
4079
|
+
createEffect(on(element, (element2) => {
|
|
4080
|
+
if (element2 == null) {
|
|
4081
|
+
return;
|
|
4082
|
+
}
|
|
4083
|
+
const form = getClosestForm(element2);
|
|
4084
|
+
if (form == null) {
|
|
4085
|
+
return;
|
|
4086
|
+
}
|
|
4087
|
+
form.addEventListener("reset", handler, {
|
|
4088
|
+
passive: true
|
|
4089
|
+
});
|
|
4090
|
+
onCleanup(() => {
|
|
4091
|
+
form.removeEventListener("reset", handler);
|
|
4092
|
+
});
|
|
4093
|
+
}));
|
|
4094
|
+
}
|
|
4095
|
+
function getClosestForm(element) {
|
|
4096
|
+
return isFormElement(element) ? element.form : element.closest("form");
|
|
4097
|
+
}
|
|
4098
|
+
function isFormElement(element) {
|
|
4099
|
+
return element.matches("textarea, input, select, button");
|
|
4100
|
+
}
|
|
4076
4101
|
var DATA_LIVE_ANNOUNCER_ATTR = "data-live-announcer";
|
|
4077
4102
|
function createHideOutside(props) {
|
|
4078
4103
|
createEffect(() => {
|
|
@@ -4508,7 +4533,72 @@ function createToggleState(props = {}) {
|
|
|
4508
4533
|
toggle
|
|
4509
4534
|
};
|
|
4510
4535
|
}
|
|
4536
|
+
var FORM_CONTROL_PROP_NAMES = ["id", "name", "validationState", "required", "disabled", "readOnly"];
|
|
4537
|
+
function createFormControl(props) {
|
|
4538
|
+
const defaultId = `form-control-${createUniqueId()}`;
|
|
4539
|
+
props = mergeDefaultProps({
|
|
4540
|
+
id: defaultId
|
|
4541
|
+
}, props);
|
|
4542
|
+
const [labelId, setLabelId] = createSignal();
|
|
4543
|
+
const [fieldId, setFieldId] = createSignal();
|
|
4544
|
+
const [descriptionId, setDescriptionId] = createSignal();
|
|
4545
|
+
const [errorMessageId, setErrorMessageId] = createSignal();
|
|
4546
|
+
const getAriaLabelledBy = (fieldId2, fieldAriaLabel, fieldAriaLabelledBy) => {
|
|
4547
|
+
const hasAriaLabelledBy = fieldAriaLabelledBy != null || labelId() != null;
|
|
4548
|
+
return [
|
|
4549
|
+
fieldAriaLabelledBy,
|
|
4550
|
+
labelId(),
|
|
4551
|
+
// If there is both an aria-label and aria-labelledby, add the field itself has an aria-labelledby
|
|
4552
|
+
hasAriaLabelledBy && fieldAriaLabel != null ? fieldId2 : void 0
|
|
4553
|
+
].filter(Boolean).join(" ") || void 0;
|
|
4554
|
+
};
|
|
4555
|
+
const getAriaDescribedBy = (fieldAriaDescribedBy) => {
|
|
4556
|
+
return [
|
|
4557
|
+
descriptionId(),
|
|
4558
|
+
// Use aria-describedby for error message because aria-errormessage is unsupported using VoiceOver or NVDA.
|
|
4559
|
+
// See https://github.com/adobe/react-spectrum/issues/1346#issuecomment-740136268
|
|
4560
|
+
errorMessageId(),
|
|
4561
|
+
fieldAriaDescribedBy
|
|
4562
|
+
].filter(Boolean).join(" ") || void 0;
|
|
4563
|
+
};
|
|
4564
|
+
const dataset = createMemo(() => ({
|
|
4565
|
+
"data-valid": access(props.validationState) === "valid" ? "" : void 0,
|
|
4566
|
+
"data-invalid": access(props.validationState) === "invalid" ? "" : void 0,
|
|
4567
|
+
"data-required": access(props.required) ? "" : void 0,
|
|
4568
|
+
"data-disabled": access(props.disabled) ? "" : void 0,
|
|
4569
|
+
"data-readonly": access(props.readOnly) ? "" : void 0
|
|
4570
|
+
}));
|
|
4571
|
+
const formControlContext = {
|
|
4572
|
+
name: () => access(props.name) ?? access(props.id),
|
|
4573
|
+
dataset,
|
|
4574
|
+
validationState: () => access(props.validationState),
|
|
4575
|
+
isRequired: () => access(props.required),
|
|
4576
|
+
isDisabled: () => access(props.disabled),
|
|
4577
|
+
isReadOnly: () => access(props.readOnly),
|
|
4578
|
+
labelId,
|
|
4579
|
+
fieldId,
|
|
4580
|
+
descriptionId,
|
|
4581
|
+
errorMessageId,
|
|
4582
|
+
getAriaLabelledBy,
|
|
4583
|
+
getAriaDescribedBy,
|
|
4584
|
+
generateId: createGenerateId(() => access(props.id)),
|
|
4585
|
+
registerLabel: createRegisterId(setLabelId),
|
|
4586
|
+
registerField: createRegisterId(setFieldId),
|
|
4587
|
+
registerDescription: createRegisterId(setDescriptionId),
|
|
4588
|
+
registerErrorMessage: createRegisterId(setErrorMessageId)
|
|
4589
|
+
};
|
|
4590
|
+
return {
|
|
4591
|
+
formControlContext
|
|
4592
|
+
};
|
|
4593
|
+
}
|
|
4511
4594
|
var FormControlContext = createContext();
|
|
4595
|
+
function useFormControlContext() {
|
|
4596
|
+
const context = useContext(FormControlContext);
|
|
4597
|
+
if (context === void 0) {
|
|
4598
|
+
throw new Error("[kobalte]: `useFormControlContext` must be used within a `FormControlContext.Provider` component");
|
|
4599
|
+
}
|
|
4600
|
+
return context;
|
|
4601
|
+
}
|
|
4512
4602
|
function Polymorphic(props) {
|
|
4513
4603
|
const [local, others] = splitProps(props, ["asChild", "as", "children"]);
|
|
4514
4604
|
if (!local.asChild) {
|
|
@@ -4559,6 +4649,60 @@ function combineProps2(baseProps, overrideProps) {
|
|
|
4559
4649
|
reverseEventHandlers: true
|
|
4560
4650
|
});
|
|
4561
4651
|
}
|
|
4652
|
+
function FormControlDescription(props) {
|
|
4653
|
+
const context = useFormControlContext();
|
|
4654
|
+
props = mergeDefaultProps({
|
|
4655
|
+
id: context.generateId("description")
|
|
4656
|
+
}, props);
|
|
4657
|
+
createEffect(() => onCleanup(context.registerDescription(props.id)));
|
|
4658
|
+
return createComponent(Polymorphic, mergeProps({
|
|
4659
|
+
as: "div"
|
|
4660
|
+
}, () => context.dataset(), props));
|
|
4661
|
+
}
|
|
4662
|
+
function FormControlErrorMessage(props) {
|
|
4663
|
+
const context = useFormControlContext();
|
|
4664
|
+
props = mergeDefaultProps({
|
|
4665
|
+
id: context.generateId("error-message")
|
|
4666
|
+
}, props);
|
|
4667
|
+
const [local, others] = splitProps(props, ["forceMount"]);
|
|
4668
|
+
const isInvalid = () => context.validationState() === "invalid";
|
|
4669
|
+
createEffect(() => {
|
|
4670
|
+
if (!isInvalid()) {
|
|
4671
|
+
return;
|
|
4672
|
+
}
|
|
4673
|
+
onCleanup(context.registerErrorMessage(others.id));
|
|
4674
|
+
});
|
|
4675
|
+
return createComponent(Show, {
|
|
4676
|
+
get when() {
|
|
4677
|
+
return local.forceMount || isInvalid();
|
|
4678
|
+
},
|
|
4679
|
+
get children() {
|
|
4680
|
+
return createComponent(Polymorphic, mergeProps({
|
|
4681
|
+
as: "div"
|
|
4682
|
+
}, () => context.dataset(), others));
|
|
4683
|
+
}
|
|
4684
|
+
});
|
|
4685
|
+
}
|
|
4686
|
+
function FormControlLabel(props) {
|
|
4687
|
+
let ref;
|
|
4688
|
+
const context = useFormControlContext();
|
|
4689
|
+
props = mergeDefaultProps({
|
|
4690
|
+
id: context.generateId("label")
|
|
4691
|
+
}, props);
|
|
4692
|
+
const [local, others] = splitProps(props, ["ref"]);
|
|
4693
|
+
const tagName = createTagName(() => ref, () => "label");
|
|
4694
|
+
createEffect(() => onCleanup(context.registerLabel(others.id)));
|
|
4695
|
+
return createComponent(Polymorphic, mergeProps({
|
|
4696
|
+
as: "label",
|
|
4697
|
+
ref(r$) {
|
|
4698
|
+
const _ref$ = mergeRefs((el) => ref = el, local.ref);
|
|
4699
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
4700
|
+
},
|
|
4701
|
+
get ["for"]() {
|
|
4702
|
+
return createMemo(() => tagName() === "label")() ? context.fieldId() : void 0;
|
|
4703
|
+
}
|
|
4704
|
+
}, () => context.dataset(), others));
|
|
4705
|
+
}
|
|
4562
4706
|
var RTL_SCRIPTS = /* @__PURE__ */ new Set(["Avst", "Arab", "Armi", "Syrc", "Samr", "Mand", "Thaa", "Mend", "Nkoo", "Adlm", "Rohg", "Hebr"]);
|
|
4563
4707
|
var RTL_LANGS = /* @__PURE__ */ new Set(["ae", "ar", "arc", "bcc", "bqi", "ckb", "dv", "fa", "glk", "he", "ku", "mzn", "nqo", "pnb", "ps", "sd", "ug", "ur", "yi"]);
|
|
4564
4708
|
function isRTL2(locale) {
|
|
@@ -7932,7 +8076,331 @@ var PaginationContext = createContext();
|
|
|
7932
8076
|
var PopoverContext = createContext();
|
|
7933
8077
|
var ProgressContext = createContext();
|
|
7934
8078
|
var RadioGroupContext = createContext();
|
|
8079
|
+
function useRadioGroupContext() {
|
|
8080
|
+
const context = useContext(RadioGroupContext);
|
|
8081
|
+
if (context === void 0) {
|
|
8082
|
+
throw new Error("[kobalte]: `useRadioGroupContext` must be used within a `RadioGroup` component");
|
|
8083
|
+
}
|
|
8084
|
+
return context;
|
|
8085
|
+
}
|
|
7935
8086
|
var RadioGroupItemContext = createContext();
|
|
8087
|
+
function useRadioGroupItemContext() {
|
|
8088
|
+
const context = useContext(RadioGroupItemContext);
|
|
8089
|
+
if (context === void 0) {
|
|
8090
|
+
throw new Error("[kobalte]: `useRadioGroupItemContext` must be used within a `RadioGroup.Item` component");
|
|
8091
|
+
}
|
|
8092
|
+
return context;
|
|
8093
|
+
}
|
|
8094
|
+
function RadioGroupItem(props) {
|
|
8095
|
+
const formControlContext = useFormControlContext();
|
|
8096
|
+
const radioGroupContext = useRadioGroupContext();
|
|
8097
|
+
const defaultId = `${formControlContext.generateId("item")}-${createUniqueId()}`;
|
|
8098
|
+
props = mergeDefaultProps({
|
|
8099
|
+
id: defaultId
|
|
8100
|
+
}, props);
|
|
8101
|
+
const [local, others] = splitProps(props, ["value", "disabled", "onPointerDown"]);
|
|
8102
|
+
const [inputId, setInputId] = createSignal();
|
|
8103
|
+
const [labelId, setLabelId] = createSignal();
|
|
8104
|
+
const [descriptionId, setDescriptionId] = createSignal();
|
|
8105
|
+
const [inputRef, setInputRef] = createSignal();
|
|
8106
|
+
const [isFocused, setIsFocused] = createSignal(false);
|
|
8107
|
+
const isSelected = createMemo(() => {
|
|
8108
|
+
return radioGroupContext.isSelectedValue(local.value);
|
|
8109
|
+
});
|
|
8110
|
+
const isDisabled = createMemo(() => {
|
|
8111
|
+
return local.disabled || formControlContext.isDisabled() || false;
|
|
8112
|
+
});
|
|
8113
|
+
const onPointerDown = (e2) => {
|
|
8114
|
+
callHandler(e2, local.onPointerDown);
|
|
8115
|
+
if (isFocused()) {
|
|
8116
|
+
e2.preventDefault();
|
|
8117
|
+
}
|
|
8118
|
+
};
|
|
8119
|
+
const dataset = createMemo(() => ({
|
|
8120
|
+
...formControlContext.dataset(),
|
|
8121
|
+
"data-disabled": isDisabled() ? "" : void 0,
|
|
8122
|
+
"data-checked": isSelected() ? "" : void 0
|
|
8123
|
+
}));
|
|
8124
|
+
const context = {
|
|
8125
|
+
value: () => local.value,
|
|
8126
|
+
dataset,
|
|
8127
|
+
isSelected,
|
|
8128
|
+
isDisabled,
|
|
8129
|
+
inputId,
|
|
8130
|
+
labelId,
|
|
8131
|
+
descriptionId,
|
|
8132
|
+
inputRef,
|
|
8133
|
+
select: () => radioGroupContext.setSelectedValue(local.value),
|
|
8134
|
+
generateId: createGenerateId(() => others.id),
|
|
8135
|
+
registerInput: createRegisterId(setInputId),
|
|
8136
|
+
registerLabel: createRegisterId(setLabelId),
|
|
8137
|
+
registerDescription: createRegisterId(setDescriptionId),
|
|
8138
|
+
setIsFocused,
|
|
8139
|
+
setInputRef
|
|
8140
|
+
};
|
|
8141
|
+
return createComponent(RadioGroupItemContext.Provider, {
|
|
8142
|
+
value: context,
|
|
8143
|
+
get children() {
|
|
8144
|
+
return createComponent(Polymorphic, mergeProps({
|
|
8145
|
+
as: "div",
|
|
8146
|
+
role: "group",
|
|
8147
|
+
onPointerDown
|
|
8148
|
+
}, dataset, others));
|
|
8149
|
+
}
|
|
8150
|
+
});
|
|
8151
|
+
}
|
|
8152
|
+
function RadioGroupItemControl(props) {
|
|
8153
|
+
const context = useRadioGroupItemContext();
|
|
8154
|
+
props = mergeDefaultProps({
|
|
8155
|
+
id: context.generateId("control")
|
|
8156
|
+
}, props);
|
|
8157
|
+
const [local, others] = splitProps(props, ["onClick", "onKeyDown"]);
|
|
8158
|
+
const onClick = (e2) => {
|
|
8159
|
+
callHandler(e2, local.onClick);
|
|
8160
|
+
context.select();
|
|
8161
|
+
context.inputRef()?.focus();
|
|
8162
|
+
};
|
|
8163
|
+
const onKeyDown = (e2) => {
|
|
8164
|
+
callHandler(e2, local.onKeyDown);
|
|
8165
|
+
if (e2.key === EventKey.Space) {
|
|
8166
|
+
context.select();
|
|
8167
|
+
context.inputRef()?.focus();
|
|
8168
|
+
}
|
|
8169
|
+
};
|
|
8170
|
+
return createComponent(Polymorphic, mergeProps({
|
|
8171
|
+
as: "div",
|
|
8172
|
+
onClick,
|
|
8173
|
+
onKeyDown
|
|
8174
|
+
}, () => context.dataset(), others));
|
|
8175
|
+
}
|
|
8176
|
+
function RadioGroupItemDescription(props) {
|
|
8177
|
+
const context = useRadioGroupItemContext();
|
|
8178
|
+
props = mergeDefaultProps({
|
|
8179
|
+
id: context.generateId("description")
|
|
8180
|
+
}, props);
|
|
8181
|
+
createEffect(() => onCleanup(context.registerDescription(props.id)));
|
|
8182
|
+
return createComponent(Polymorphic, mergeProps({
|
|
8183
|
+
as: "div"
|
|
8184
|
+
}, () => context.dataset(), props));
|
|
8185
|
+
}
|
|
8186
|
+
function RadioGroupItemIndicator(props) {
|
|
8187
|
+
const context = useRadioGroupItemContext();
|
|
8188
|
+
props = mergeDefaultProps({
|
|
8189
|
+
id: context.generateId("indicator")
|
|
8190
|
+
}, props);
|
|
8191
|
+
const [local, others] = splitProps(props, ["ref", "forceMount"]);
|
|
8192
|
+
const presence = createPresence(() => local.forceMount || context.isSelected());
|
|
8193
|
+
return createComponent(Show, {
|
|
8194
|
+
get when() {
|
|
8195
|
+
return presence.isPresent();
|
|
8196
|
+
},
|
|
8197
|
+
get children() {
|
|
8198
|
+
return createComponent(Polymorphic, mergeProps({
|
|
8199
|
+
as: "div",
|
|
8200
|
+
ref(r$) {
|
|
8201
|
+
const _ref$ = mergeRefs(presence.setRef, local.ref);
|
|
8202
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
8203
|
+
}
|
|
8204
|
+
}, () => context.dataset(), others));
|
|
8205
|
+
}
|
|
8206
|
+
});
|
|
8207
|
+
}
|
|
8208
|
+
var _tmpl$$6 = /* @__PURE__ */ template(`<input type="radio">`);
|
|
8209
|
+
function RadioGroupItemInput(props) {
|
|
8210
|
+
const formControlContext = useFormControlContext();
|
|
8211
|
+
const radioGroupContext = useRadioGroupContext();
|
|
8212
|
+
const radioContext = useRadioGroupItemContext();
|
|
8213
|
+
props = mergeDefaultProps({
|
|
8214
|
+
id: radioContext.generateId("input")
|
|
8215
|
+
}, props);
|
|
8216
|
+
const [local, others] = splitProps(props, ["ref", "style", "aria-labelledby", "aria-describedby", "onChange", "onFocus", "onBlur"]);
|
|
8217
|
+
const ariaLabelledBy = () => {
|
|
8218
|
+
return [
|
|
8219
|
+
local["aria-labelledby"],
|
|
8220
|
+
radioContext.labelId(),
|
|
8221
|
+
// If there is both an aria-label and aria-labelledby, add the input itself has an aria-labelledby
|
|
8222
|
+
local["aria-labelledby"] != null && others["aria-label"] != null ? others.id : void 0
|
|
8223
|
+
].filter(Boolean).join(" ") || void 0;
|
|
8224
|
+
};
|
|
8225
|
+
const ariaDescribedBy = () => {
|
|
8226
|
+
return [local["aria-describedby"], radioContext.descriptionId(), radioGroupContext.ariaDescribedBy()].filter(Boolean).join(" ") || void 0;
|
|
8227
|
+
};
|
|
8228
|
+
const onChange = (e2) => {
|
|
8229
|
+
callHandler(e2, local.onChange);
|
|
8230
|
+
e2.stopPropagation();
|
|
8231
|
+
radioGroupContext.setSelectedValue(radioContext.value());
|
|
8232
|
+
const target = e2.target;
|
|
8233
|
+
target.checked = radioContext.isSelected();
|
|
8234
|
+
};
|
|
8235
|
+
const onFocus = (e2) => {
|
|
8236
|
+
callHandler(e2, local.onFocus);
|
|
8237
|
+
radioContext.setIsFocused(true);
|
|
8238
|
+
};
|
|
8239
|
+
const onBlur = (e2) => {
|
|
8240
|
+
callHandler(e2, local.onBlur);
|
|
8241
|
+
radioContext.setIsFocused(false);
|
|
8242
|
+
};
|
|
8243
|
+
createEffect(() => onCleanup(radioContext.registerInput(others.id)));
|
|
8244
|
+
return (() => {
|
|
8245
|
+
const _el$ = _tmpl$$6();
|
|
8246
|
+
_el$.addEventListener("blur", onBlur);
|
|
8247
|
+
_el$.addEventListener("focus", onFocus);
|
|
8248
|
+
_el$.addEventListener("change", onChange);
|
|
8249
|
+
const _ref$ = mergeRefs(radioContext.setInputRef, local.ref);
|
|
8250
|
+
typeof _ref$ === "function" && use(_ref$, _el$);
|
|
8251
|
+
spread(_el$, mergeProps({
|
|
8252
|
+
get name() {
|
|
8253
|
+
return formControlContext.name();
|
|
8254
|
+
},
|
|
8255
|
+
get value() {
|
|
8256
|
+
return radioContext.value();
|
|
8257
|
+
},
|
|
8258
|
+
get checked() {
|
|
8259
|
+
return radioContext.isSelected();
|
|
8260
|
+
},
|
|
8261
|
+
get required() {
|
|
8262
|
+
return formControlContext.isRequired();
|
|
8263
|
+
},
|
|
8264
|
+
get disabled() {
|
|
8265
|
+
return radioContext.isDisabled();
|
|
8266
|
+
},
|
|
8267
|
+
get readonly() {
|
|
8268
|
+
return formControlContext.isReadOnly();
|
|
8269
|
+
},
|
|
8270
|
+
get style() {
|
|
8271
|
+
return {
|
|
8272
|
+
...visuallyHiddenStyles,
|
|
8273
|
+
...local.style
|
|
8274
|
+
};
|
|
8275
|
+
},
|
|
8276
|
+
get ["aria-labelledby"]() {
|
|
8277
|
+
return ariaLabelledBy();
|
|
8278
|
+
},
|
|
8279
|
+
get ["aria-describedby"]() {
|
|
8280
|
+
return ariaDescribedBy();
|
|
8281
|
+
}
|
|
8282
|
+
}, () => radioContext.dataset(), others), false, false);
|
|
8283
|
+
return _el$;
|
|
8284
|
+
})();
|
|
8285
|
+
}
|
|
8286
|
+
var _tmpl$$5 = /* @__PURE__ */ template(`<label>`);
|
|
8287
|
+
function RadioGroupItemLabel(props) {
|
|
8288
|
+
const context = useRadioGroupItemContext();
|
|
8289
|
+
props = mergeDefaultProps({
|
|
8290
|
+
id: context.generateId("label")
|
|
8291
|
+
}, props);
|
|
8292
|
+
createEffect(() => onCleanup(context.registerLabel(props.id)));
|
|
8293
|
+
return (() => {
|
|
8294
|
+
const _el$ = _tmpl$$5();
|
|
8295
|
+
spread(_el$, mergeProps({
|
|
8296
|
+
get ["for"]() {
|
|
8297
|
+
return context.inputId();
|
|
8298
|
+
}
|
|
8299
|
+
}, () => context.dataset(), props), false, false);
|
|
8300
|
+
return _el$;
|
|
8301
|
+
})();
|
|
8302
|
+
}
|
|
8303
|
+
function RadioGroupLabel(props) {
|
|
8304
|
+
return createComponent(FormControlLabel, mergeProps({
|
|
8305
|
+
as: "span"
|
|
8306
|
+
}, props));
|
|
8307
|
+
}
|
|
8308
|
+
function RadioGroupRoot(props) {
|
|
8309
|
+
let ref;
|
|
8310
|
+
const defaultId = `radiogroup-${createUniqueId()}`;
|
|
8311
|
+
props = mergeDefaultProps({
|
|
8312
|
+
id: defaultId,
|
|
8313
|
+
orientation: "vertical"
|
|
8314
|
+
}, props);
|
|
8315
|
+
const [local, formControlProps, others] = splitProps(props, ["ref", "value", "defaultValue", "onChange", "orientation", "aria-labelledby", "aria-describedby"], FORM_CONTROL_PROP_NAMES);
|
|
8316
|
+
const [selected, setSelected] = createControllableSignal({
|
|
8317
|
+
value: () => local.value,
|
|
8318
|
+
defaultValue: () => local.defaultValue,
|
|
8319
|
+
onChange: (value) => local.onChange?.(value)
|
|
8320
|
+
});
|
|
8321
|
+
const {
|
|
8322
|
+
formControlContext
|
|
8323
|
+
} = createFormControl(formControlProps);
|
|
8324
|
+
createFormResetListener(() => ref, () => setSelected(local.defaultValue ?? ""));
|
|
8325
|
+
const ariaLabelledBy = () => {
|
|
8326
|
+
return formControlContext.getAriaLabelledBy(access(formControlProps.id), others["aria-label"], local["aria-labelledby"]);
|
|
8327
|
+
};
|
|
8328
|
+
const ariaDescribedBy = () => {
|
|
8329
|
+
return formControlContext.getAriaDescribedBy(local["aria-describedby"]);
|
|
8330
|
+
};
|
|
8331
|
+
const isSelectedValue = (value) => {
|
|
8332
|
+
return value === selected();
|
|
8333
|
+
};
|
|
8334
|
+
const context = {
|
|
8335
|
+
ariaDescribedBy,
|
|
8336
|
+
isSelectedValue,
|
|
8337
|
+
setSelectedValue: (value) => {
|
|
8338
|
+
if (formControlContext.isReadOnly() || formControlContext.isDisabled()) {
|
|
8339
|
+
return;
|
|
8340
|
+
}
|
|
8341
|
+
setSelected(value);
|
|
8342
|
+
ref?.querySelectorAll("[type='radio']").forEach((el) => {
|
|
8343
|
+
const radio = el;
|
|
8344
|
+
radio.checked = isSelectedValue(radio.value);
|
|
8345
|
+
});
|
|
8346
|
+
}
|
|
8347
|
+
};
|
|
8348
|
+
return createComponent(FormControlContext.Provider, {
|
|
8349
|
+
value: formControlContext,
|
|
8350
|
+
get children() {
|
|
8351
|
+
return createComponent(RadioGroupContext.Provider, {
|
|
8352
|
+
value: context,
|
|
8353
|
+
get children() {
|
|
8354
|
+
return createComponent(Polymorphic, mergeProps({
|
|
8355
|
+
as: "div",
|
|
8356
|
+
ref(r$) {
|
|
8357
|
+
const _ref$ = mergeRefs((el) => ref = el, local.ref);
|
|
8358
|
+
typeof _ref$ === "function" && _ref$(r$);
|
|
8359
|
+
},
|
|
8360
|
+
role: "radiogroup",
|
|
8361
|
+
get id() {
|
|
8362
|
+
return access(formControlProps.id);
|
|
8363
|
+
},
|
|
8364
|
+
get ["aria-invalid"]() {
|
|
8365
|
+
return formControlContext.validationState() === "invalid" || void 0;
|
|
8366
|
+
},
|
|
8367
|
+
get ["aria-required"]() {
|
|
8368
|
+
return formControlContext.isRequired() || void 0;
|
|
8369
|
+
},
|
|
8370
|
+
get ["aria-disabled"]() {
|
|
8371
|
+
return formControlContext.isDisabled() || void 0;
|
|
8372
|
+
},
|
|
8373
|
+
get ["aria-readonly"]() {
|
|
8374
|
+
return formControlContext.isReadOnly() || void 0;
|
|
8375
|
+
},
|
|
8376
|
+
get ["aria-orientation"]() {
|
|
8377
|
+
return local.orientation;
|
|
8378
|
+
},
|
|
8379
|
+
get ["aria-labelledby"]() {
|
|
8380
|
+
return ariaLabelledBy();
|
|
8381
|
+
},
|
|
8382
|
+
get ["aria-describedby"]() {
|
|
8383
|
+
return ariaDescribedBy();
|
|
8384
|
+
}
|
|
8385
|
+
}, () => formControlContext.dataset(), others));
|
|
8386
|
+
}
|
|
8387
|
+
});
|
|
8388
|
+
}
|
|
8389
|
+
});
|
|
8390
|
+
}
|
|
8391
|
+
var index$7 = /* @__PURE__ */ Object.freeze({
|
|
8392
|
+
__proto__: null,
|
|
8393
|
+
Description: FormControlDescription,
|
|
8394
|
+
ErrorMessage: FormControlErrorMessage,
|
|
8395
|
+
Item: RadioGroupItem,
|
|
8396
|
+
ItemControl: RadioGroupItemControl,
|
|
8397
|
+
ItemDescription: RadioGroupItemDescription,
|
|
8398
|
+
ItemIndicator: RadioGroupItemIndicator,
|
|
8399
|
+
ItemInput: RadioGroupItemInput,
|
|
8400
|
+
ItemLabel: RadioGroupItemLabel,
|
|
8401
|
+
Label: RadioGroupLabel,
|
|
8402
|
+
Root: RadioGroupRoot
|
|
8403
|
+
});
|
|
7936
8404
|
var SelectContext = createContext();
|
|
7937
8405
|
var SwitchContext = createContext();
|
|
7938
8406
|
var TabsContext = createContext();
|
|
@@ -8176,17 +8644,17 @@ var tokens = {
|
|
|
8176
8644
|
900: "#054F31"
|
|
8177
8645
|
},
|
|
8178
8646
|
red: {
|
|
8179
|
-
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
|
|
8188
|
-
|
|
8189
|
-
|
|
8647
|
+
50: "#fef2f2",
|
|
8648
|
+
100: "#fee2e2",
|
|
8649
|
+
200: "#fecaca",
|
|
8650
|
+
300: "#fca5a5",
|
|
8651
|
+
400: "#f87171",
|
|
8652
|
+
500: "#ef4444",
|
|
8653
|
+
600: "#dc2626",
|
|
8654
|
+
700: "#b91c1c",
|
|
8655
|
+
800: "#991b1b",
|
|
8656
|
+
900: "#7f1d1d",
|
|
8657
|
+
950: "#450a0a"
|
|
8190
8658
|
},
|
|
8191
8659
|
yellow: {
|
|
8192
8660
|
25: "#FFFCF5",
|
|
@@ -9447,6 +9915,12 @@ function getQueryStatusColor({
|
|
|
9447
9915
|
}) {
|
|
9448
9916
|
return queryState.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
|
|
9449
9917
|
}
|
|
9918
|
+
function getMutationStatusColor({
|
|
9919
|
+
status,
|
|
9920
|
+
isPaused
|
|
9921
|
+
}) {
|
|
9922
|
+
return isPaused ? "purple" : status === "error" ? "red" : status === "pending" ? "yellow" : status === "success" ? "green" : "gray";
|
|
9923
|
+
}
|
|
9450
9924
|
function getQueryStatusColorByLabel(label) {
|
|
9451
9925
|
return label === "fresh" ? "green" : label === "stale" ? "yellow" : label === "paused" ? "purple" : label === "inactive" ? "gray" : "blue";
|
|
9452
9926
|
}
|
|
@@ -9468,6 +9942,18 @@ var sortFns = {
|
|
|
9468
9942
|
"query hash": queryHashSort,
|
|
9469
9943
|
"last updated": dateSort
|
|
9470
9944
|
};
|
|
9945
|
+
var getMutationStatusRank = (m) => m.state.isPaused ? 0 : m.state.status === "error" ? 2 : m.state.status === "pending" ? 1 : 3;
|
|
9946
|
+
var mutationDateSort = (a2, b2) => a2.state.submittedAt < b2.state.submittedAt ? 1 : -1;
|
|
9947
|
+
var mutationStatusSort = (a2, b2) => {
|
|
9948
|
+
if (getMutationStatusRank(a2) === getMutationStatusRank(b2)) {
|
|
9949
|
+
return mutationDateSort(a2, b2);
|
|
9950
|
+
}
|
|
9951
|
+
return getMutationStatusRank(a2) > getMutationStatusRank(b2) ? 1 : -1;
|
|
9952
|
+
};
|
|
9953
|
+
var mutationSortFns = {
|
|
9954
|
+
status: mutationStatusSort,
|
|
9955
|
+
"last updated": mutationDateSort
|
|
9956
|
+
};
|
|
9471
9957
|
var convertRemToPixels = (rem) => {
|
|
9472
9958
|
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
9473
9959
|
};
|
|
@@ -9867,51 +10353,122 @@ function Check(props) {
|
|
|
9867
10353
|
/></svg></Show>
|
|
9868
10354
|
</>;
|
|
9869
10355
|
}
|
|
9870
|
-
function
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9876
|
-
|
|
9877
|
-
|
|
9878
|
-
|
|
9879
|
-
|
|
9880
|
-
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9900
|
-
|
|
9901
|
-
|
|
9902
|
-
|
|
9903
|
-
|
|
9904
|
-
|
|
9905
|
-
|
|
9906
|
-
|
|
9907
|
-
|
|
9908
|
-
|
|
9909
|
-
|
|
9910
|
-
|
|
9911
|
-
|
|
9912
|
-
|
|
9913
|
-
|
|
9914
|
-
|
|
10356
|
+
function CheckCircle() {
|
|
10357
|
+
return <svg
|
|
10358
|
+
width="14"
|
|
10359
|
+
height="14"
|
|
10360
|
+
viewBox="0 0 24 24"
|
|
10361
|
+
fill="none"
|
|
10362
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10363
|
+
><path
|
|
10364
|
+
d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
|
|
10365
|
+
stroke="currentColor"
|
|
10366
|
+
stroke-width="2"
|
|
10367
|
+
stroke-linecap="round"
|
|
10368
|
+
stroke-linejoin="round"
|
|
10369
|
+
/></svg>;
|
|
10370
|
+
}
|
|
10371
|
+
function LoadingCircle() {
|
|
10372
|
+
return <svg
|
|
10373
|
+
width="14"
|
|
10374
|
+
height="14"
|
|
10375
|
+
viewBox="0 0 24 24"
|
|
10376
|
+
fill="none"
|
|
10377
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10378
|
+
>
|
|
10379
|
+
<path
|
|
10380
|
+
d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"
|
|
10381
|
+
stroke="currentColor"
|
|
10382
|
+
stroke-width="2"
|
|
10383
|
+
stroke-linecap="round"
|
|
10384
|
+
stroke-linejoin="round"
|
|
10385
|
+
/>
|
|
10386
|
+
<animateTransform
|
|
10387
|
+
attributeName="transform"
|
|
10388
|
+
attributeType="XML"
|
|
10389
|
+
type="rotate"
|
|
10390
|
+
from="0"
|
|
10391
|
+
to="360"
|
|
10392
|
+
dur="2s"
|
|
10393
|
+
repeatCount="indefinite"
|
|
10394
|
+
/>
|
|
10395
|
+
</svg>;
|
|
10396
|
+
}
|
|
10397
|
+
function XCircle() {
|
|
10398
|
+
return <svg
|
|
10399
|
+
width="14"
|
|
10400
|
+
height="14"
|
|
10401
|
+
viewBox="0 0 24 24"
|
|
10402
|
+
fill="none"
|
|
10403
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10404
|
+
><path
|
|
10405
|
+
d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
|
|
10406
|
+
stroke="currentColor"
|
|
10407
|
+
stroke-width="2"
|
|
10408
|
+
stroke-linecap="round"
|
|
10409
|
+
stroke-linejoin="round"
|
|
10410
|
+
/></svg>;
|
|
10411
|
+
}
|
|
10412
|
+
function PauseCircle() {
|
|
10413
|
+
return <svg
|
|
10414
|
+
width="14"
|
|
10415
|
+
height="14"
|
|
10416
|
+
viewBox="0 0 24 24"
|
|
10417
|
+
fill="none"
|
|
10418
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10419
|
+
><path
|
|
10420
|
+
d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
|
|
10421
|
+
stroke="currentColor"
|
|
10422
|
+
stroke-width="2"
|
|
10423
|
+
stroke-linecap="round"
|
|
10424
|
+
stroke-linejoin="round"
|
|
10425
|
+
/></svg>;
|
|
10426
|
+
}
|
|
10427
|
+
function TanstackLogo() {
|
|
10428
|
+
const id = createUniqueId();
|
|
10429
|
+
return <svg version="1.0" viewBox="0 0 633 633">
|
|
10430
|
+
<linearGradient
|
|
10431
|
+
id={`a-${id}`}
|
|
10432
|
+
x1="-666.45"
|
|
10433
|
+
x2="-666.45"
|
|
10434
|
+
y1="163.28"
|
|
10435
|
+
y2="163.99"
|
|
10436
|
+
gradientTransform="matrix(633 0 0 633 422177 -103358)"
|
|
10437
|
+
gradientUnits="userSpaceOnUse"
|
|
10438
|
+
>
|
|
10439
|
+
<stop stop-color="#6BDAFF" offset="0" />
|
|
10440
|
+
<stop stop-color="#F9FFB5" offset=".32" />
|
|
10441
|
+
<stop stop-color="#FFA770" offset=".71" />
|
|
10442
|
+
<stop stop-color="#FF7373" offset="1" />
|
|
10443
|
+
</linearGradient>
|
|
10444
|
+
<circle cx="316.5" cy="316.5" r="316.5" fill={`url(#a-${id})`} />
|
|
10445
|
+
<defs><filter
|
|
10446
|
+
id={`am-${id}`}
|
|
10447
|
+
x="-137.5"
|
|
10448
|
+
y="412"
|
|
10449
|
+
width="454"
|
|
10450
|
+
height="396.9"
|
|
10451
|
+
filterUnits="userSpaceOnUse"
|
|
10452
|
+
><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" /></filter></defs>
|
|
10453
|
+
<mask
|
|
10454
|
+
id={`b-${id}`}
|
|
10455
|
+
x="-137.5"
|
|
10456
|
+
y="412"
|
|
10457
|
+
width="454"
|
|
10458
|
+
height="396.9"
|
|
10459
|
+
maskUnits="userSpaceOnUse"
|
|
10460
|
+
><g filter={`url(#am-${id})`}><circle cx="316.5" cy="316.5" r="316.5" fill="#fff" /></g></mask>
|
|
10461
|
+
<g mask={`url(#b-${id})`}><ellipse
|
|
10462
|
+
cx="89.5"
|
|
10463
|
+
cy="610.5"
|
|
10464
|
+
rx="214.5"
|
|
10465
|
+
ry="186"
|
|
10466
|
+
fill="#015064"
|
|
10467
|
+
stroke="#00CFE2"
|
|
10468
|
+
stroke-width="25"
|
|
10469
|
+
/></g>
|
|
10470
|
+
<defs><filter
|
|
10471
|
+
id={`ah-${id}`}
|
|
9915
10472
|
x="316.5"
|
|
9916
10473
|
y="412"
|
|
9917
10474
|
width="454"
|
|
@@ -11065,9 +11622,13 @@ var DEFAULT_HEIGHT = 500;
|
|
|
11065
11622
|
var DEFAULT_WIDTH = 500;
|
|
11066
11623
|
var DEFAULT_SORT_FN_NAME = Object.keys(sortFns)[0];
|
|
11067
11624
|
var DEFAULT_SORT_ORDER = 1;
|
|
11625
|
+
var DEFAULT_MUTATION_SORT_FN_NAME = Object.keys(mutationSortFns)[0];
|
|
11068
11626
|
var [selectedQueryHash, setSelectedQueryHash] = createSignal(
|
|
11069
11627
|
null
|
|
11070
11628
|
);
|
|
11629
|
+
var [selectedMutationId, setSelectedMutationId] = createSignal(
|
|
11630
|
+
null
|
|
11631
|
+
);
|
|
11071
11632
|
var [panelWidth, setPanelWidth] = createSignal(0);
|
|
11072
11633
|
var DevtoolsComponent = (props) => {
|
|
11073
11634
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
@@ -11162,37 +11723,9 @@ var DevtoolsPanel = (props) => {
|
|
|
11162
11723
|
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
11163
11724
|
});
|
|
11164
11725
|
const [isResizing, setIsResizing] = createSignal(false);
|
|
11165
|
-
const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
|
|
11166
|
-
const sortOrder = createMemo(
|
|
11167
|
-
() => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
|
|
11168
|
-
);
|
|
11169
|
-
const [offline, setOffline] = createSignal(false);
|
|
11170
11726
|
const position = createMemo(
|
|
11171
11727
|
() => props.localStore.position || useQueryDevtoolsContext().position || POSITION
|
|
11172
11728
|
);
|
|
11173
|
-
const sortFn = createMemo(() => sortFns[sort()]);
|
|
11174
|
-
const onlineManager = createMemo(
|
|
11175
|
-
() => useQueryDevtoolsContext().onlineManager
|
|
11176
|
-
);
|
|
11177
|
-
const cache = createMemo(() => {
|
|
11178
|
-
return useQueryDevtoolsContext().client.getQueryCache();
|
|
11179
|
-
});
|
|
11180
|
-
const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
11181
|
-
return queryCache().getAll().length;
|
|
11182
|
-
}, false);
|
|
11183
|
-
const queries = createMemo(
|
|
11184
|
-
on(
|
|
11185
|
-
() => [queryCount(), props.localStore.filter, sort(), sortOrder()],
|
|
11186
|
-
() => {
|
|
11187
|
-
const curr = cache().getAll();
|
|
11188
|
-
const filtered = props.localStore.filter ? curr.filter(
|
|
11189
|
-
(item) => rankItem(item.queryHash, props.localStore.filter || "").passed
|
|
11190
|
-
) : [...curr];
|
|
11191
|
-
const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
|
|
11192
|
-
return sorted;
|
|
11193
|
-
}
|
|
11194
|
-
)
|
|
11195
|
-
);
|
|
11196
11729
|
const handleDragStart = (event) => {
|
|
11197
11730
|
const panelElement = event.currentTarget.parentElement;
|
|
11198
11731
|
if (!panelElement)
|
|
@@ -11237,8 +11770,6 @@ var DevtoolsPanel = (props) => {
|
|
|
11237
11770
|
document.addEventListener("mousemove", runDrag, false);
|
|
11238
11771
|
document.addEventListener("mouseup", unsub, false);
|
|
11239
11772
|
};
|
|
11240
|
-
setupQueryCacheSubscription();
|
|
11241
|
-
let queriesContainerRef;
|
|
11242
11773
|
let panelRef;
|
|
11243
11774
|
onMount(() => {
|
|
11244
11775
|
createResizeObserver(panelRef, ({ width }, el) => {
|
|
@@ -11247,9 +11778,6 @@ var DevtoolsPanel = (props) => {
|
|
|
11247
11778
|
}
|
|
11248
11779
|
});
|
|
11249
11780
|
});
|
|
11250
|
-
const setDevtoolsPosition = (pos) => {
|
|
11251
|
-
props.setLocalStore("position", pos);
|
|
11252
|
-
};
|
|
11253
11781
|
createEffect(() => {
|
|
11254
11782
|
const rootContainer = panelRef.parentElement?.parentElement?.parentElement;
|
|
11255
11783
|
if (!rootContainer)
|
|
@@ -11327,11 +11855,97 @@ var DevtoolsPanel = (props) => {
|
|
|
11327
11855
|
)}
|
|
11328
11856
|
onClick={() => props.setLocalStore("open", "false")}
|
|
11329
11857
|
><ChevronDown /></button>
|
|
11858
|
+
<ContentView
|
|
11859
|
+
localStore={props.localStore}
|
|
11860
|
+
setLocalStore={props.setLocalStore}
|
|
11861
|
+
/>
|
|
11862
|
+
</aside>;
|
|
11863
|
+
};
|
|
11864
|
+
var ContentView = (props) => {
|
|
11865
|
+
setupQueryCacheSubscription();
|
|
11866
|
+
setupMutationCacheSubscription();
|
|
11867
|
+
const theme = useTheme();
|
|
11868
|
+
const styles = createMemo(() => {
|
|
11869
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
11870
|
+
});
|
|
11871
|
+
const [selectedView, setSelectedView] = createSignal(
|
|
11872
|
+
"queries"
|
|
11873
|
+
);
|
|
11874
|
+
const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
|
|
11875
|
+
const sortOrder = createMemo(
|
|
11876
|
+
() => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
|
|
11877
|
+
);
|
|
11878
|
+
const mutationSort = createMemo(
|
|
11879
|
+
() => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME
|
|
11880
|
+
);
|
|
11881
|
+
const mutationSortOrder = createMemo(
|
|
11882
|
+
() => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER
|
|
11883
|
+
);
|
|
11884
|
+
const [offline, setOffline] = createSignal(false);
|
|
11885
|
+
const sortFn = createMemo(() => sortFns[sort()]);
|
|
11886
|
+
const mutationSortFn = createMemo(
|
|
11887
|
+
() => mutationSortFns[mutationSort()]
|
|
11888
|
+
);
|
|
11889
|
+
const onlineManager = createMemo(
|
|
11890
|
+
() => useQueryDevtoolsContext().onlineManager
|
|
11891
|
+
);
|
|
11892
|
+
const query_cache = createMemo(() => {
|
|
11893
|
+
return useQueryDevtoolsContext().client.getQueryCache();
|
|
11894
|
+
});
|
|
11895
|
+
const mutation_cache = createMemo(() => {
|
|
11896
|
+
return useQueryDevtoolsContext().client.getMutationCache();
|
|
11897
|
+
});
|
|
11898
|
+
const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
11899
|
+
return queryCache().getAll().length;
|
|
11900
|
+
}, false);
|
|
11901
|
+
const queries = createMemo(
|
|
11902
|
+
on(
|
|
11903
|
+
() => [queryCount(), props.localStore.filter, sort(), sortOrder()],
|
|
11904
|
+
() => {
|
|
11905
|
+
const curr = query_cache().getAll();
|
|
11906
|
+
const filtered = props.localStore.filter ? curr.filter(
|
|
11907
|
+
(item) => rankItem(item.queryHash, props.localStore.filter || "").passed
|
|
11908
|
+
) : [...curr];
|
|
11909
|
+
const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
|
|
11910
|
+
return sorted;
|
|
11911
|
+
}
|
|
11912
|
+
)
|
|
11913
|
+
);
|
|
11914
|
+
const mutationCount = createSubscribeToMutationCacheBatcher(
|
|
11915
|
+
(mutationCache) => {
|
|
11916
|
+
return mutationCache().getAll().length;
|
|
11917
|
+
},
|
|
11918
|
+
false
|
|
11919
|
+
);
|
|
11920
|
+
const mutations = createMemo(
|
|
11921
|
+
on(
|
|
11922
|
+
() => [
|
|
11923
|
+
mutationCount(),
|
|
11924
|
+
props.localStore.mutationFilter,
|
|
11925
|
+
mutationSort(),
|
|
11926
|
+
mutationSortOrder()
|
|
11927
|
+
],
|
|
11928
|
+
() => {
|
|
11929
|
+
const curr = mutation_cache().getAll();
|
|
11930
|
+
const filtered = props.localStore.mutationFilter ? curr.filter((item) => {
|
|
11931
|
+
const value = `${item.options.mutationKey ? JSON.stringify(item.options.mutationKey) + " - " : ""}${new Date(item.state.submittedAt).toLocaleString()}`;
|
|
11932
|
+
return rankItem(value, props.localStore.mutationFilter || "").passed;
|
|
11933
|
+
}) : [...curr];
|
|
11934
|
+
const sorted = mutationSortFn() ? filtered.sort(
|
|
11935
|
+
(a2, b2) => mutationSortFn()(a2, b2) * mutationSortOrder()
|
|
11936
|
+
) : filtered;
|
|
11937
|
+
return sorted;
|
|
11938
|
+
}
|
|
11939
|
+
)
|
|
11940
|
+
);
|
|
11941
|
+
const setDevtoolsPosition = (pos) => {
|
|
11942
|
+
props.setLocalStore("position", pos);
|
|
11943
|
+
};
|
|
11944
|
+
return <>
|
|
11330
11945
|
<div
|
|
11331
|
-
ref={queriesContainerRef}
|
|
11332
11946
|
class={clsx(
|
|
11333
11947
|
styles().queriesContainer,
|
|
11334
|
-
panelWidth() < secondBreakpoint && selectedQueryHash() && u`
|
|
11948
|
+
panelWidth() < secondBreakpoint && (selectedQueryHash() || selectedMutationId()) && u`
|
|
11335
11949
|
height: 50%;
|
|
11336
11950
|
max-height: 50%;
|
|
11337
11951
|
`,
|
|
@@ -11339,34 +11953,51 @@ var DevtoolsPanel = (props) => {
|
|
|
11339
11953
|
)}
|
|
11340
11954
|
>
|
|
11341
11955
|
<div class={clsx(styles().row, "tsqd-header")}>
|
|
11342
|
-
<
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
<span class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}>TANSTACK</span>
|
|
11348
|
-
<span
|
|
11349
|
-
class={clsx(
|
|
11350
|
-
styles().queryFlavorLogo,
|
|
11351
|
-
"tsqd-text-logo-query-flavor"
|
|
11352
|
-
)}
|
|
11956
|
+
<div class={styles().logoAndToggleContainer}>
|
|
11957
|
+
<button
|
|
11958
|
+
class={clsx(styles().logo, "tsqd-text-logo-container")}
|
|
11959
|
+
onClick={() => props.setLocalStore("open", "false")}
|
|
11960
|
+
aria-label="Close Tanstack query devtools"
|
|
11353
11961
|
>
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11359
|
-
|
|
11962
|
+
<span
|
|
11963
|
+
class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}
|
|
11964
|
+
>TANSTACK</span>
|
|
11965
|
+
<span
|
|
11966
|
+
class={clsx(
|
|
11967
|
+
styles().queryFlavorLogo,
|
|
11968
|
+
"tsqd-text-logo-query-flavor"
|
|
11969
|
+
)}
|
|
11970
|
+
>
|
|
11971
|
+
{useQueryDevtoolsContext().queryFlavor}
|
|
11972
|
+
{" v"}
|
|
11973
|
+
{useQueryDevtoolsContext().version}
|
|
11974
|
+
</span>
|
|
11975
|
+
</button>
|
|
11976
|
+
<index$7.Root
|
|
11977
|
+
class={clsx(styles().viewToggle)}
|
|
11978
|
+
value={selectedView()}
|
|
11979
|
+
onChange={(value) => {
|
|
11980
|
+
setSelectedView(value);
|
|
11981
|
+
setSelectedQueryHash(null);
|
|
11982
|
+
setSelectedMutationId(null);
|
|
11983
|
+
}}
|
|
11984
|
+
>
|
|
11985
|
+
<index$7.Item value="queries" class="tsqd-radio-toggle">
|
|
11986
|
+
<index$7.ItemInput />
|
|
11987
|
+
<index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
|
|
11988
|
+
<index$7.ItemLabel title="Toggle Queries View">Queries</index$7.ItemLabel>
|
|
11989
|
+
</index$7.Item>
|
|
11990
|
+
<index$7.Item value="mutations" class="tsqd-radio-toggle">
|
|
11991
|
+
<index$7.ItemInput />
|
|
11992
|
+
<index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
|
|
11993
|
+
<index$7.ItemLabel title="Toggle Mutations View">Mutations</index$7.ItemLabel>
|
|
11994
|
+
</index$7.Item>
|
|
11995
|
+
</index$7.Root>
|
|
11996
|
+
</div>
|
|
11997
|
+
<Show when={selectedView() === "queries"}><QueryStatusCount /></Show>
|
|
11998
|
+
<Show when={selectedView() === "mutations"}><MutationStatusCount /></Show>
|
|
11360
11999
|
</div>
|
|
11361
|
-
<div
|
|
11362
|
-
class={clsx(
|
|
11363
|
-
styles().row,
|
|
11364
|
-
u`
|
|
11365
|
-
gap: ${tokens.size[2.5]};
|
|
11366
|
-
`,
|
|
11367
|
-
"tsqd-filters-actions-container"
|
|
11368
|
-
)}
|
|
11369
|
-
>
|
|
12000
|
+
<div class={clsx(styles().row, "tsqd-filters-actions-container")}>
|
|
11370
12001
|
<div class={clsx(styles().filtersContainer, "tsqd-filters-container")}>
|
|
11371
12002
|
<div
|
|
11372
12003
|
class={clsx(
|
|
@@ -11379,9 +12010,15 @@ var DevtoolsPanel = (props) => {
|
|
|
11379
12010
|
aria-label="Filter queries by query key"
|
|
11380
12011
|
type="text"
|
|
11381
12012
|
placeholder="Filter"
|
|
11382
|
-
onInput={(e2) =>
|
|
12013
|
+
onInput={(e2) => {
|
|
12014
|
+
if (selectedView() === "queries") {
|
|
12015
|
+
props.setLocalStore("filter", e2.currentTarget.value);
|
|
12016
|
+
} else {
|
|
12017
|
+
props.setLocalStore("mutationFilter", e2.currentTarget.value);
|
|
12018
|
+
}
|
|
12019
|
+
}}
|
|
11383
12020
|
class="tsqd-query-filter-textfield"
|
|
11384
|
-
value={props.localStore.filter || ""}
|
|
12021
|
+
value={selectedView() === "queries" ? props.localStore.filter || "" : props.localStore.mutationFilter || ""}
|
|
11385
12022
|
/>
|
|
11386
12023
|
</div>
|
|
11387
12024
|
<div
|
|
@@ -11390,28 +12027,50 @@ var DevtoolsPanel = (props) => {
|
|
|
11390
12027
|
"tsqd-query-filter-sort-container"
|
|
11391
12028
|
)}
|
|
11392
12029
|
>
|
|
11393
|
-
<select
|
|
12030
|
+
<Show when={selectedView() === "queries"}><select
|
|
11394
12031
|
value={sort()}
|
|
11395
|
-
onChange={(e2) =>
|
|
12032
|
+
onChange={(e2) => {
|
|
12033
|
+
props.setLocalStore("sort", e2.currentTarget.value);
|
|
12034
|
+
}}
|
|
11396
12035
|
>{Object.keys(sortFns).map((key) => <option value={key}>
|
|
11397
12036
|
{"Sort by "}
|
|
11398
12037
|
{key}
|
|
11399
|
-
</option>)}</select>
|
|
12038
|
+
</option>)}</select></Show>
|
|
12039
|
+
<Show when={selectedView() === "mutations"}><select
|
|
12040
|
+
value={mutationSort()}
|
|
12041
|
+
onChange={(e2) => {
|
|
12042
|
+
props.setLocalStore("mutationSort", e2.currentTarget.value);
|
|
12043
|
+
}}
|
|
12044
|
+
>{Object.keys(mutationSortFns).map((key) => <option value={key}>
|
|
12045
|
+
{"Sort by "}
|
|
12046
|
+
{key}
|
|
12047
|
+
</option>)}</select></Show>
|
|
11400
12048
|
<ChevronDown />
|
|
11401
12049
|
</div>
|
|
11402
12050
|
<button
|
|
11403
12051
|
onClick={() => {
|
|
11404
|
-
|
|
12052
|
+
if (selectedView() === "queries") {
|
|
12053
|
+
props.setLocalStore("sortOrder", String(sortOrder() * -1));
|
|
12054
|
+
} else {
|
|
12055
|
+
props.setLocalStore(
|
|
12056
|
+
"mutationSortOrder",
|
|
12057
|
+
String(mutationSortOrder() * -1)
|
|
12058
|
+
);
|
|
12059
|
+
}
|
|
11405
12060
|
}}
|
|
11406
|
-
aria-label={`Sort order ${sortOrder() === -1 ? "descending" : "ascending"}`}
|
|
11407
|
-
aria-pressed={sortOrder() === -1}
|
|
12061
|
+
aria-label={`Sort order ${(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1 ? "descending" : "ascending"}`}
|
|
12062
|
+
aria-pressed={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
|
|
11408
12063
|
class="tsqd-query-filter-sort-order-btn"
|
|
11409
12064
|
>
|
|
11410
|
-
<Show
|
|
12065
|
+
<Show
|
|
12066
|
+
when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === 1}
|
|
12067
|
+
>
|
|
11411
12068
|
<span>Asc</span>
|
|
11412
12069
|
<ArrowUp />
|
|
11413
12070
|
</Show>
|
|
11414
|
-
<Show
|
|
12071
|
+
<Show
|
|
12072
|
+
when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
|
|
12073
|
+
>
|
|
11415
12074
|
<span>Desc</span>
|
|
11416
12075
|
<ArrowDown />
|
|
11417
12076
|
</Show>
|
|
@@ -11420,7 +12079,11 @@ var DevtoolsPanel = (props) => {
|
|
|
11420
12079
|
<div class={clsx(styles().actionsContainer, "tsqd-actions-container")}>
|
|
11421
12080
|
<button
|
|
11422
12081
|
onClick={() => {
|
|
11423
|
-
|
|
12082
|
+
if (selectedView() === "queries") {
|
|
12083
|
+
query_cache().clear();
|
|
12084
|
+
} else {
|
|
12085
|
+
mutation_cache().clear();
|
|
12086
|
+
}
|
|
11424
12087
|
}}
|
|
11425
12088
|
class={clsx(
|
|
11426
12089
|
styles().actionsBtn,
|
|
@@ -11428,7 +12091,7 @@ var DevtoolsPanel = (props) => {
|
|
|
11428
12091
|
"tsqd-action-clear-cache"
|
|
11429
12092
|
)}
|
|
11430
12093
|
aria-label="Clear query cache"
|
|
11431
|
-
title=
|
|
12094
|
+
title={`Clear ${selectedView()} cache`}
|
|
11432
12095
|
><Trash /></button>
|
|
11433
12096
|
<button
|
|
11434
12097
|
onClick={() => {
|
|
@@ -11610,15 +12273,22 @@ var DevtoolsPanel = (props) => {
|
|
|
11610
12273
|
</index$d.Root>
|
|
11611
12274
|
</div>
|
|
11612
12275
|
</div>
|
|
11613
|
-
<div
|
|
12276
|
+
<Show when={selectedView() === "queries"}><div
|
|
11614
12277
|
class={clsx(
|
|
11615
12278
|
styles().overflowQueryContainer,
|
|
11616
12279
|
"tsqd-queries-overflow-container"
|
|
11617
12280
|
)}
|
|
11618
|
-
><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div>
|
|
12281
|
+
><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div></Show>
|
|
12282
|
+
<Show when={selectedView() === "mutations"}><div
|
|
12283
|
+
class={clsx(
|
|
12284
|
+
styles().overflowQueryContainer,
|
|
12285
|
+
"tsqd-mutations-overflow-container"
|
|
12286
|
+
)}
|
|
12287
|
+
><div class="tsqd-mutations-container"><Key by={(m) => m.mutationId} each={mutations()}>{(mutation) => <MutationRow mutation={mutation()} />}</Key></div></div></Show>
|
|
11619
12288
|
</div>
|
|
11620
|
-
<Show when={selectedQueryHash()}><QueryDetails /></Show>
|
|
11621
|
-
|
|
12289
|
+
<Show when={selectedView() === "queries" && selectedQueryHash()}><QueryDetails /></Show>
|
|
12290
|
+
<Show when={selectedView() === "mutations" && selectedMutationId()}><MutationDetails /></Show>
|
|
12291
|
+
</>;
|
|
11622
12292
|
};
|
|
11623
12293
|
var QueryRow = (props) => {
|
|
11624
12294
|
const theme = useTheme();
|
|
@@ -11687,6 +12357,94 @@ var QueryRow = (props) => {
|
|
|
11687
12357
|
<Show when={isDisabled()}><div class="tsqd-query-disabled-indicator">disabled</div></Show>
|
|
11688
12358
|
</button></Show>;
|
|
11689
12359
|
};
|
|
12360
|
+
var MutationRow = (props) => {
|
|
12361
|
+
const theme = useTheme();
|
|
12362
|
+
const styles = createMemo(() => {
|
|
12363
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12364
|
+
});
|
|
12365
|
+
const { colors, alpha } = tokens;
|
|
12366
|
+
const t2 = (light, dark) => theme() === "dark" ? dark : light;
|
|
12367
|
+
const mutationState = createSubscribeToMutationCacheBatcher(
|
|
12368
|
+
(mutationCache) => {
|
|
12369
|
+
const mutations = mutationCache().getAll();
|
|
12370
|
+
const mutation = mutations.find(
|
|
12371
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12372
|
+
);
|
|
12373
|
+
return mutation?.state;
|
|
12374
|
+
}
|
|
12375
|
+
);
|
|
12376
|
+
const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12377
|
+
const mutations = mutationCache().getAll();
|
|
12378
|
+
const mutation = mutations.find(
|
|
12379
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12380
|
+
);
|
|
12381
|
+
if (!mutation)
|
|
12382
|
+
return false;
|
|
12383
|
+
return mutation.state.isPaused;
|
|
12384
|
+
});
|
|
12385
|
+
const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12386
|
+
const mutations = mutationCache().getAll();
|
|
12387
|
+
const mutation = mutations.find(
|
|
12388
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12389
|
+
);
|
|
12390
|
+
if (!mutation)
|
|
12391
|
+
return "idle";
|
|
12392
|
+
return mutation.state.status;
|
|
12393
|
+
});
|
|
12394
|
+
const color = createMemo(
|
|
12395
|
+
() => getMutationStatusColor({
|
|
12396
|
+
isPaused: isPaused(),
|
|
12397
|
+
status: status()
|
|
12398
|
+
})
|
|
12399
|
+
);
|
|
12400
|
+
const getObserverCountColorStyles = () => {
|
|
12401
|
+
if (color() === "gray") {
|
|
12402
|
+
return u`
|
|
12403
|
+
background-color: ${t2(colors[color()][200], colors[color()][700])};
|
|
12404
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12405
|
+
`;
|
|
12406
|
+
}
|
|
12407
|
+
return u`
|
|
12408
|
+
background-color: ${t2(
|
|
12409
|
+
colors[color()][200] + alpha[80],
|
|
12410
|
+
colors[color()][900]
|
|
12411
|
+
)};
|
|
12412
|
+
color: ${t2(colors[color()][800], colors[color()][300])};
|
|
12413
|
+
`;
|
|
12414
|
+
};
|
|
12415
|
+
return <Show when={mutationState()}><button
|
|
12416
|
+
onClick={() => {
|
|
12417
|
+
setSelectedMutationId(
|
|
12418
|
+
props.mutation.mutationId === selectedMutationId() ? null : props.mutation.mutationId
|
|
12419
|
+
);
|
|
12420
|
+
}}
|
|
12421
|
+
class={clsx(
|
|
12422
|
+
styles().queryRow,
|
|
12423
|
+
selectedMutationId() === props.mutation.mutationId && styles().selectedQueryRow,
|
|
12424
|
+
"tsqd-query-row"
|
|
12425
|
+
)}
|
|
12426
|
+
aria-label={`Mutation submitted at ${new Date(
|
|
12427
|
+
props.mutation.state.submittedAt
|
|
12428
|
+
).toLocaleString()}`}
|
|
12429
|
+
>
|
|
12430
|
+
<div
|
|
12431
|
+
class={clsx(getObserverCountColorStyles(), "tsqd-query-observer-count")}
|
|
12432
|
+
>
|
|
12433
|
+
<Show when={color() === "purple"}><PauseCircle /></Show>
|
|
12434
|
+
<Show when={color() === "green"}><CheckCircle /></Show>
|
|
12435
|
+
<Show when={color() === "red"}><XCircle /></Show>
|
|
12436
|
+
<Show when={color() === "yellow"}><LoadingCircle /></Show>
|
|
12437
|
+
</div>
|
|
12438
|
+
<code class="tsqd-query-hash">
|
|
12439
|
+
<Show when={props.mutation.options.mutationKey}>
|
|
12440
|
+
{JSON.stringify(props.mutation.options.mutationKey)}
|
|
12441
|
+
{" -"}
|
|
12442
|
+
{" "}
|
|
12443
|
+
</Show>
|
|
12444
|
+
{new Date(props.mutation.state.submittedAt).toLocaleString()}
|
|
12445
|
+
</code>
|
|
12446
|
+
</button></Show>;
|
|
12447
|
+
};
|
|
11690
12448
|
var QueryStatusCount = () => {
|
|
11691
12449
|
const stale = createSubscribeToQueryCacheBatcher(
|
|
11692
12450
|
(queryCache) => queryCache().getAll().filter((q) => getQueryStatusLabel(q) === "stale").length
|
|
@@ -11717,6 +12475,52 @@ var QueryStatusCount = () => {
|
|
|
11717
12475
|
<QueryStatus label="Inactive" color="gray" count={inactive()} />
|
|
11718
12476
|
</div>;
|
|
11719
12477
|
};
|
|
12478
|
+
var MutationStatusCount = () => {
|
|
12479
|
+
const success = createSubscribeToMutationCacheBatcher(
|
|
12480
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12481
|
+
(m) => getMutationStatusColor({
|
|
12482
|
+
isPaused: m.state.isPaused,
|
|
12483
|
+
status: m.state.status
|
|
12484
|
+
}) === "green"
|
|
12485
|
+
).length
|
|
12486
|
+
);
|
|
12487
|
+
const pending = createSubscribeToMutationCacheBatcher(
|
|
12488
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12489
|
+
(m) => getMutationStatusColor({
|
|
12490
|
+
isPaused: m.state.isPaused,
|
|
12491
|
+
status: m.state.status
|
|
12492
|
+
}) === "yellow"
|
|
12493
|
+
).length
|
|
12494
|
+
);
|
|
12495
|
+
const paused = createSubscribeToMutationCacheBatcher(
|
|
12496
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12497
|
+
(m) => getMutationStatusColor({
|
|
12498
|
+
isPaused: m.state.isPaused,
|
|
12499
|
+
status: m.state.status
|
|
12500
|
+
}) === "purple"
|
|
12501
|
+
).length
|
|
12502
|
+
);
|
|
12503
|
+
const error = createSubscribeToMutationCacheBatcher(
|
|
12504
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12505
|
+
(m) => getMutationStatusColor({
|
|
12506
|
+
isPaused: m.state.isPaused,
|
|
12507
|
+
status: m.state.status
|
|
12508
|
+
}) === "red"
|
|
12509
|
+
).length
|
|
12510
|
+
);
|
|
12511
|
+
const theme = useTheme();
|
|
12512
|
+
const styles = createMemo(() => {
|
|
12513
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12514
|
+
});
|
|
12515
|
+
return <div
|
|
12516
|
+
class={clsx(styles().queryStatusContainer, "tsqd-query-status-container")}
|
|
12517
|
+
>
|
|
12518
|
+
<QueryStatus label="Paused" color="purple" count={paused()} />
|
|
12519
|
+
<QueryStatus label="Pending" color="yellow" count={pending()} />
|
|
12520
|
+
<QueryStatus label="Success" color="green" count={success()} />
|
|
12521
|
+
<QueryStatus label="Error" color="red" count={error()} />
|
|
12522
|
+
</div>;
|
|
12523
|
+
};
|
|
11720
12524
|
var QueryStatus = (props) => {
|
|
11721
12525
|
const theme = useTheme();
|
|
11722
12526
|
const styles = createMemo(() => {
|
|
@@ -12125,21 +12929,145 @@ var QueryDetails = () => {
|
|
|
12125
12929
|
/></div>
|
|
12126
12930
|
</div></Show>;
|
|
12127
12931
|
};
|
|
12128
|
-
var
|
|
12932
|
+
var MutationDetails = () => {
|
|
12933
|
+
const theme = useTheme();
|
|
12934
|
+
const styles = createMemo(() => {
|
|
12935
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12936
|
+
});
|
|
12937
|
+
const { colors } = tokens;
|
|
12938
|
+
const t2 = (light, dark) => theme() === "dark" ? dark : light;
|
|
12939
|
+
const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12940
|
+
const mutations = mutationCache().getAll();
|
|
12941
|
+
const mutation = mutations.find(
|
|
12942
|
+
(m) => m.mutationId === selectedMutationId()
|
|
12943
|
+
);
|
|
12944
|
+
if (!mutation)
|
|
12945
|
+
return false;
|
|
12946
|
+
return mutation.state.isPaused;
|
|
12947
|
+
});
|
|
12948
|
+
const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12949
|
+
const mutations = mutationCache().getAll();
|
|
12950
|
+
const mutation = mutations.find(
|
|
12951
|
+
(m) => m.mutationId === selectedMutationId()
|
|
12952
|
+
);
|
|
12953
|
+
if (!mutation)
|
|
12954
|
+
return "idle";
|
|
12955
|
+
return mutation.state.status;
|
|
12956
|
+
});
|
|
12957
|
+
const color = createMemo(
|
|
12958
|
+
() => getMutationStatusColor({
|
|
12959
|
+
isPaused: isPaused(),
|
|
12960
|
+
status: status()
|
|
12961
|
+
})
|
|
12962
|
+
);
|
|
12963
|
+
const activeMutation = createSubscribeToMutationCacheBatcher(
|
|
12964
|
+
(mutationCache) => mutationCache().getAll().find((mutation) => mutation.mutationId === selectedMutationId()),
|
|
12965
|
+
false
|
|
12966
|
+
);
|
|
12967
|
+
const getQueryStatusColors = () => {
|
|
12968
|
+
if (color() === "gray") {
|
|
12969
|
+
return u`
|
|
12970
|
+
background-color: ${t2(colors[color()][200], colors[color()][700])};
|
|
12971
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12972
|
+
border-color: ${t2(colors[color()][400], colors[color()][600])};
|
|
12973
|
+
`;
|
|
12974
|
+
}
|
|
12975
|
+
return u`
|
|
12976
|
+
background-color: ${t2(colors[color()][100], colors[color()][900])};
|
|
12977
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12978
|
+
border-color: ${t2(colors[color()][400], colors[color()][600])};
|
|
12979
|
+
`;
|
|
12980
|
+
};
|
|
12981
|
+
return <Show when={activeMutation()}><div
|
|
12982
|
+
class={clsx(styles().detailsContainer, "tsqd-query-details-container")}
|
|
12983
|
+
>
|
|
12984
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutation Details</div>
|
|
12985
|
+
<div
|
|
12986
|
+
class={clsx(
|
|
12987
|
+
styles().detailsBody,
|
|
12988
|
+
"tsqd-query-details-summary-container"
|
|
12989
|
+
)}
|
|
12990
|
+
>
|
|
12991
|
+
<div class="tsqd-query-details-summary">
|
|
12992
|
+
<pre><code><Show
|
|
12993
|
+
when={activeMutation().options.mutationKey}
|
|
12994
|
+
fallback="No mutationKey found"
|
|
12995
|
+
>{displayValue(activeMutation().options.mutationKey, true)}</Show></code></pre>
|
|
12996
|
+
<span
|
|
12997
|
+
class={clsx(styles().queryDetailsStatus, getQueryStatusColors())}
|
|
12998
|
+
>
|
|
12999
|
+
<Show when={color() === "purple"}>pending</Show>
|
|
13000
|
+
<Show when={color() !== "purple"}>{status()}</Show>
|
|
13001
|
+
</span>
|
|
13002
|
+
</div>
|
|
13003
|
+
<div class="tsqd-query-details-last-updated">
|
|
13004
|
+
<span>Submitted At:</span>
|
|
13005
|
+
<span>{new Date(
|
|
13006
|
+
activeMutation().state.submittedAt
|
|
13007
|
+
).toLocaleTimeString()}</span>
|
|
13008
|
+
</div>
|
|
13009
|
+
</div>
|
|
13010
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Variables Details</div>
|
|
13011
|
+
<div
|
|
13012
|
+
style={{
|
|
13013
|
+
padding: "0.5rem"
|
|
13014
|
+
}}
|
|
13015
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13016
|
+
><Explorer
|
|
13017
|
+
label="Variables"
|
|
13018
|
+
defaultExpanded={["Variables"]}
|
|
13019
|
+
value={activeMutation().state.variables}
|
|
13020
|
+
/></div>
|
|
13021
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Context Details</div>
|
|
13022
|
+
<div
|
|
13023
|
+
style={{
|
|
13024
|
+
padding: "0.5rem"
|
|
13025
|
+
}}
|
|
13026
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13027
|
+
><Explorer
|
|
13028
|
+
label="Context"
|
|
13029
|
+
defaultExpanded={["Context"]}
|
|
13030
|
+
value={activeMutation().state.context}
|
|
13031
|
+
/></div>
|
|
13032
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
|
|
13033
|
+
<div
|
|
13034
|
+
style={{
|
|
13035
|
+
padding: "0.5rem"
|
|
13036
|
+
}}
|
|
13037
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13038
|
+
><Explorer
|
|
13039
|
+
label="Data"
|
|
13040
|
+
defaultExpanded={["Data"]}
|
|
13041
|
+
value={activeMutation().state.data}
|
|
13042
|
+
/></div>
|
|
13043
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutations Explorer</div>
|
|
13044
|
+
<div
|
|
13045
|
+
style={{
|
|
13046
|
+
padding: "0.5rem"
|
|
13047
|
+
}}
|
|
13048
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13049
|
+
><Explorer
|
|
13050
|
+
label="Mutation"
|
|
13051
|
+
defaultExpanded={["Mutation"]}
|
|
13052
|
+
value={activeMutation()}
|
|
13053
|
+
/></div>
|
|
13054
|
+
</div></Show>;
|
|
13055
|
+
};
|
|
13056
|
+
var queryCacheMap = /* @__PURE__ */ new Map();
|
|
12129
13057
|
var setupQueryCacheSubscription = () => {
|
|
12130
13058
|
const queryCache = createMemo(() => {
|
|
12131
13059
|
const client = useQueryDevtoolsContext().client;
|
|
12132
13060
|
return client.getQueryCache();
|
|
12133
13061
|
});
|
|
12134
13062
|
const unsub = queryCache().subscribe(() => {
|
|
12135
|
-
for (const [callback, setter] of
|
|
13063
|
+
for (const [callback, setter] of queryCacheMap.entries()) {
|
|
12136
13064
|
queueMicrotask(() => {
|
|
12137
13065
|
setter(callback(queryCache));
|
|
12138
13066
|
});
|
|
12139
13067
|
}
|
|
12140
13068
|
});
|
|
12141
13069
|
onCleanup(() => {
|
|
12142
|
-
|
|
13070
|
+
queryCacheMap.clear();
|
|
12143
13071
|
unsub();
|
|
12144
13072
|
});
|
|
12145
13073
|
return unsub;
|
|
@@ -12156,9 +13084,46 @@ var createSubscribeToQueryCacheBatcher = (callback, equalityCheck = true) => {
|
|
|
12156
13084
|
createEffect(() => {
|
|
12157
13085
|
setValue(callback(queryCache));
|
|
12158
13086
|
});
|
|
12159
|
-
|
|
13087
|
+
queryCacheMap.set(callback, setValue);
|
|
12160
13088
|
onCleanup(() => {
|
|
12161
|
-
|
|
13089
|
+
queryCacheMap.delete(callback);
|
|
13090
|
+
});
|
|
13091
|
+
return value;
|
|
13092
|
+
};
|
|
13093
|
+
var mutationCacheMap = /* @__PURE__ */ new Map();
|
|
13094
|
+
var setupMutationCacheSubscription = () => {
|
|
13095
|
+
const mutationCache = createMemo(() => {
|
|
13096
|
+
const client = useQueryDevtoolsContext().client;
|
|
13097
|
+
return client.getMutationCache();
|
|
13098
|
+
});
|
|
13099
|
+
const unsub = mutationCache().subscribe(() => {
|
|
13100
|
+
for (const [callback, setter] of mutationCacheMap.entries()) {
|
|
13101
|
+
queueMicrotask(() => {
|
|
13102
|
+
setter(callback(mutationCache));
|
|
13103
|
+
});
|
|
13104
|
+
}
|
|
13105
|
+
});
|
|
13106
|
+
onCleanup(() => {
|
|
13107
|
+
mutationCacheMap.clear();
|
|
13108
|
+
unsub();
|
|
13109
|
+
});
|
|
13110
|
+
return unsub;
|
|
13111
|
+
};
|
|
13112
|
+
var createSubscribeToMutationCacheBatcher = (callback, equalityCheck = true) => {
|
|
13113
|
+
const mutationCache = createMemo(() => {
|
|
13114
|
+
const client = useQueryDevtoolsContext().client;
|
|
13115
|
+
return client.getMutationCache();
|
|
13116
|
+
});
|
|
13117
|
+
const [value, setValue] = createSignal(
|
|
13118
|
+
callback(mutationCache),
|
|
13119
|
+
!equalityCheck ? { equals: false } : void 0
|
|
13120
|
+
);
|
|
13121
|
+
createEffect(() => {
|
|
13122
|
+
setValue(callback(mutationCache));
|
|
13123
|
+
});
|
|
13124
|
+
mutationCacheMap.set(callback, setValue);
|
|
13125
|
+
onCleanup(() => {
|
|
13126
|
+
mutationCacheMap.delete(callback);
|
|
12162
13127
|
});
|
|
12163
13128
|
return value;
|
|
12164
13129
|
};
|
|
@@ -12433,7 +13398,7 @@ var stylesFactory2 = (theme) => {
|
|
|
12433
13398
|
justify-content: space-between;
|
|
12434
13399
|
align-items: center;
|
|
12435
13400
|
padding: ${tokens.size[2]} ${tokens.size[2.5]};
|
|
12436
|
-
gap: ${tokens.size[
|
|
13401
|
+
gap: ${tokens.size[2.5]};
|
|
12437
13402
|
border-bottom: ${t2(colors.gray[300], colors.darkGray[500])} 1px solid;
|
|
12438
13403
|
align-items: center;
|
|
12439
13404
|
& > button {
|
|
@@ -12445,8 +13410,19 @@ var stylesFactory2 = (theme) => {
|
|
|
12445
13410
|
flex-direction: column;
|
|
12446
13411
|
}
|
|
12447
13412
|
`,
|
|
13413
|
+
logoAndToggleContainer: u`
|
|
13414
|
+
display: flex;
|
|
13415
|
+
gap: ${tokens.size[3]};
|
|
13416
|
+
align-items: center;
|
|
13417
|
+
`,
|
|
12448
13418
|
logo: u`
|
|
12449
13419
|
cursor: pointer;
|
|
13420
|
+
display: flex;
|
|
13421
|
+
flex-direction: column;
|
|
13422
|
+
background-color: transparent;
|
|
13423
|
+
border: none;
|
|
13424
|
+
gap: ${tokens.size[0.5]};
|
|
13425
|
+
padding: 0px;
|
|
12450
13426
|
&:hover {
|
|
12451
13427
|
opacity: 0.7;
|
|
12452
13428
|
}
|
|
@@ -12818,6 +13794,8 @@ var stylesFactory2 = (theme) => {
|
|
|
12818
13794
|
|
|
12819
13795
|
& pre {
|
|
12820
13796
|
margin: 0;
|
|
13797
|
+
display: flex;
|
|
13798
|
+
align-items: center;
|
|
12821
13799
|
}
|
|
12822
13800
|
`,
|
|
12823
13801
|
queryDetailsStatus: u`
|
|
@@ -12997,6 +13975,56 @@ var stylesFactory2 = (theme) => {
|
|
|
12997
13975
|
&:hover {
|
|
12998
13976
|
background-color: ${t2(colors.purple[100], colors.purple[900])};
|
|
12999
13977
|
}
|
|
13978
|
+
`,
|
|
13979
|
+
viewToggle: u`
|
|
13980
|
+
border-radius: ${tokens.border.radius.sm};
|
|
13981
|
+
background-color: ${t2(colors.gray[200], colors.darkGray[600])};
|
|
13982
|
+
border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
|
|
13983
|
+
display: flex;
|
|
13984
|
+
padding: 0;
|
|
13985
|
+
font-size: ${font.size.xs};
|
|
13986
|
+
color: ${t2(colors.gray[700], colors.gray[300])};
|
|
13987
|
+
overflow: hidden;
|
|
13988
|
+
|
|
13989
|
+
&:has(:focus-visible) {
|
|
13990
|
+
outline: 2px solid ${colors.blue[800]};
|
|
13991
|
+
}
|
|
13992
|
+
|
|
13993
|
+
& .tsqd-radio-toggle {
|
|
13994
|
+
opacity: 0.5;
|
|
13995
|
+
display: flex;
|
|
13996
|
+
& label {
|
|
13997
|
+
display: flex;
|
|
13998
|
+
align-items: center;
|
|
13999
|
+
cursor: pointer;
|
|
14000
|
+
line-height: ${font.lineHeight.md};
|
|
14001
|
+
}
|
|
14002
|
+
|
|
14003
|
+
& label:hover {
|
|
14004
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[500])};
|
|
14005
|
+
}
|
|
14006
|
+
}
|
|
14007
|
+
|
|
14008
|
+
& > [data-checked] {
|
|
14009
|
+
opacity: 1;
|
|
14010
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[400])};
|
|
14011
|
+
& label:hover {
|
|
14012
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[400])};
|
|
14013
|
+
}
|
|
14014
|
+
}
|
|
14015
|
+
|
|
14016
|
+
& .tsqd-radio-toggle:first-child {
|
|
14017
|
+
& label {
|
|
14018
|
+
padding: 0 ${tokens.size[1.5]} 0 ${tokens.size[2]};
|
|
14019
|
+
}
|
|
14020
|
+
border-right: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
|
|
14021
|
+
}
|
|
14022
|
+
|
|
14023
|
+
& .tsqd-radio-toggle:nth-child(2) {
|
|
14024
|
+
& label {
|
|
14025
|
+
padding: 0 ${tokens.size[2]} 0 ${tokens.size[1.5]};
|
|
14026
|
+
}
|
|
14027
|
+
}
|
|
13000
14028
|
`
|
|
13001
14029
|
};
|
|
13002
14030
|
};
|
|
@@ -13006,6 +14034,8 @@ export {
|
|
|
13006
14034
|
Devtools,
|
|
13007
14035
|
DevtoolsComponent,
|
|
13008
14036
|
DevtoolsPanel,
|
|
14037
|
+
MutationRow,
|
|
14038
|
+
MutationStatusCount,
|
|
13009
14039
|
QueryRow,
|
|
13010
14040
|
QueryStatus,
|
|
13011
14041
|
QueryStatusCount,
|
|
@@ -13217,8 +14247,6 @@ export {
|
|
|
13217
14247
|
* Credits to the zag team:
|
|
13218
14248
|
* https://github.com/chakra-ui/zag/blob/c1e6c7689b22bf58741ded7cf224dd9baec2a046/packages/utilities/form-utils/src/form.ts
|
|
13219
14249
|
*)
|
|
13220
|
-
|
|
13221
|
-
@kobalte/core/dist/esm/index.js:
|
|
13222
14250
|
(*!
|
|
13223
14251
|
* Portions of this file are based on code from react-spectrum.
|
|
13224
14252
|
* Apache License Version 2.0, Copyright 2020 Adobe.
|