@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",
|
|
@@ -9446,6 +9914,12 @@ function getQueryStatusColor({
|
|
|
9446
9914
|
}) {
|
|
9447
9915
|
return queryState.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
|
|
9448
9916
|
}
|
|
9917
|
+
function getMutationStatusColor({
|
|
9918
|
+
status,
|
|
9919
|
+
isPaused
|
|
9920
|
+
}) {
|
|
9921
|
+
return isPaused ? "purple" : status === "error" ? "red" : status === "pending" ? "yellow" : status === "success" ? "green" : "gray";
|
|
9922
|
+
}
|
|
9449
9923
|
function getQueryStatusColorByLabel(label) {
|
|
9450
9924
|
return label === "fresh" ? "green" : label === "stale" ? "yellow" : label === "paused" ? "purple" : label === "inactive" ? "gray" : "blue";
|
|
9451
9925
|
}
|
|
@@ -9467,6 +9941,18 @@ var sortFns = {
|
|
|
9467
9941
|
"query hash": queryHashSort,
|
|
9468
9942
|
"last updated": dateSort
|
|
9469
9943
|
};
|
|
9944
|
+
var getMutationStatusRank = (m) => m.state.isPaused ? 0 : m.state.status === "error" ? 2 : m.state.status === "pending" ? 1 : 3;
|
|
9945
|
+
var mutationDateSort = (a2, b2) => a2.state.submittedAt < b2.state.submittedAt ? 1 : -1;
|
|
9946
|
+
var mutationStatusSort = (a2, b2) => {
|
|
9947
|
+
if (getMutationStatusRank(a2) === getMutationStatusRank(b2)) {
|
|
9948
|
+
return mutationDateSort(a2, b2);
|
|
9949
|
+
}
|
|
9950
|
+
return getMutationStatusRank(a2) > getMutationStatusRank(b2) ? 1 : -1;
|
|
9951
|
+
};
|
|
9952
|
+
var mutationSortFns = {
|
|
9953
|
+
status: mutationStatusSort,
|
|
9954
|
+
"last updated": mutationDateSort
|
|
9955
|
+
};
|
|
9470
9956
|
var convertRemToPixels = (rem) => {
|
|
9471
9957
|
return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
9472
9958
|
};
|
|
@@ -9866,51 +10352,122 @@ function Check(props) {
|
|
|
9866
10352
|
/></svg></Show>
|
|
9867
10353
|
</>;
|
|
9868
10354
|
}
|
|
9869
|
-
function
|
|
9870
|
-
|
|
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
|
-
|
|
10355
|
+
function CheckCircle() {
|
|
10356
|
+
return <svg
|
|
10357
|
+
width="14"
|
|
10358
|
+
height="14"
|
|
10359
|
+
viewBox="0 0 24 24"
|
|
10360
|
+
fill="none"
|
|
10361
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10362
|
+
><path
|
|
10363
|
+
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"
|
|
10364
|
+
stroke="currentColor"
|
|
10365
|
+
stroke-width="2"
|
|
10366
|
+
stroke-linecap="round"
|
|
10367
|
+
stroke-linejoin="round"
|
|
10368
|
+
/></svg>;
|
|
10369
|
+
}
|
|
10370
|
+
function LoadingCircle() {
|
|
10371
|
+
return <svg
|
|
10372
|
+
width="14"
|
|
10373
|
+
height="14"
|
|
10374
|
+
viewBox="0 0 24 24"
|
|
10375
|
+
fill="none"
|
|
10376
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10377
|
+
>
|
|
10378
|
+
<path
|
|
10379
|
+
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"
|
|
10380
|
+
stroke="currentColor"
|
|
10381
|
+
stroke-width="2"
|
|
10382
|
+
stroke-linecap="round"
|
|
10383
|
+
stroke-linejoin="round"
|
|
10384
|
+
/>
|
|
10385
|
+
<animateTransform
|
|
10386
|
+
attributeName="transform"
|
|
10387
|
+
attributeType="XML"
|
|
10388
|
+
type="rotate"
|
|
10389
|
+
from="0"
|
|
10390
|
+
to="360"
|
|
10391
|
+
dur="2s"
|
|
10392
|
+
repeatCount="indefinite"
|
|
10393
|
+
/>
|
|
10394
|
+
</svg>;
|
|
10395
|
+
}
|
|
10396
|
+
function XCircle() {
|
|
10397
|
+
return <svg
|
|
10398
|
+
width="14"
|
|
10399
|
+
height="14"
|
|
10400
|
+
viewBox="0 0 24 24"
|
|
10401
|
+
fill="none"
|
|
10402
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10403
|
+
><path
|
|
10404
|
+
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"
|
|
10405
|
+
stroke="currentColor"
|
|
10406
|
+
stroke-width="2"
|
|
10407
|
+
stroke-linecap="round"
|
|
10408
|
+
stroke-linejoin="round"
|
|
10409
|
+
/></svg>;
|
|
10410
|
+
}
|
|
10411
|
+
function PauseCircle() {
|
|
10412
|
+
return <svg
|
|
10413
|
+
width="14"
|
|
10414
|
+
height="14"
|
|
10415
|
+
viewBox="0 0 24 24"
|
|
10416
|
+
fill="none"
|
|
10417
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
10418
|
+
><path
|
|
10419
|
+
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"
|
|
10420
|
+
stroke="currentColor"
|
|
10421
|
+
stroke-width="2"
|
|
10422
|
+
stroke-linecap="round"
|
|
10423
|
+
stroke-linejoin="round"
|
|
10424
|
+
/></svg>;
|
|
10425
|
+
}
|
|
10426
|
+
function TanstackLogo() {
|
|
10427
|
+
const id = createUniqueId();
|
|
10428
|
+
return <svg version="1.0" viewBox="0 0 633 633">
|
|
10429
|
+
<linearGradient
|
|
10430
|
+
id={`a-${id}`}
|
|
10431
|
+
x1="-666.45"
|
|
10432
|
+
x2="-666.45"
|
|
10433
|
+
y1="163.28"
|
|
10434
|
+
y2="163.99"
|
|
10435
|
+
gradientTransform="matrix(633 0 0 633 422177 -103358)"
|
|
10436
|
+
gradientUnits="userSpaceOnUse"
|
|
10437
|
+
>
|
|
10438
|
+
<stop stop-color="#6BDAFF" offset="0" />
|
|
10439
|
+
<stop stop-color="#F9FFB5" offset=".32" />
|
|
10440
|
+
<stop stop-color="#FFA770" offset=".71" />
|
|
10441
|
+
<stop stop-color="#FF7373" offset="1" />
|
|
10442
|
+
</linearGradient>
|
|
10443
|
+
<circle cx="316.5" cy="316.5" r="316.5" fill={`url(#a-${id})`} />
|
|
10444
|
+
<defs><filter
|
|
10445
|
+
id={`am-${id}`}
|
|
10446
|
+
x="-137.5"
|
|
10447
|
+
y="412"
|
|
10448
|
+
width="454"
|
|
10449
|
+
height="396.9"
|
|
10450
|
+
filterUnits="userSpaceOnUse"
|
|
10451
|
+
><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" /></filter></defs>
|
|
10452
|
+
<mask
|
|
10453
|
+
id={`b-${id}`}
|
|
10454
|
+
x="-137.5"
|
|
10455
|
+
y="412"
|
|
10456
|
+
width="454"
|
|
10457
|
+
height="396.9"
|
|
10458
|
+
maskUnits="userSpaceOnUse"
|
|
10459
|
+
><g filter={`url(#am-${id})`}><circle cx="316.5" cy="316.5" r="316.5" fill="#fff" /></g></mask>
|
|
10460
|
+
<g mask={`url(#b-${id})`}><ellipse
|
|
10461
|
+
cx="89.5"
|
|
10462
|
+
cy="610.5"
|
|
10463
|
+
rx="214.5"
|
|
10464
|
+
ry="186"
|
|
10465
|
+
fill="#015064"
|
|
10466
|
+
stroke="#00CFE2"
|
|
10467
|
+
stroke-width="25"
|
|
10468
|
+
/></g>
|
|
10469
|
+
<defs><filter
|
|
10470
|
+
id={`ah-${id}`}
|
|
9914
10471
|
x="316.5"
|
|
9915
10472
|
y="412"
|
|
9916
10473
|
width="454"
|
|
@@ -11063,9 +11620,13 @@ var DEFAULT_HEIGHT = 500;
|
|
|
11063
11620
|
var DEFAULT_WIDTH = 500;
|
|
11064
11621
|
var DEFAULT_SORT_FN_NAME = Object.keys(sortFns)[0];
|
|
11065
11622
|
var DEFAULT_SORT_ORDER = 1;
|
|
11623
|
+
var DEFAULT_MUTATION_SORT_FN_NAME = Object.keys(mutationSortFns)[0];
|
|
11066
11624
|
var [selectedQueryHash, setSelectedQueryHash] = createSignal(
|
|
11067
11625
|
null
|
|
11068
11626
|
);
|
|
11627
|
+
var [selectedMutationId, setSelectedMutationId] = createSignal(
|
|
11628
|
+
null
|
|
11629
|
+
);
|
|
11069
11630
|
var [panelWidth, setPanelWidth] = createSignal(0);
|
|
11070
11631
|
var DevtoolsComponent = (props) => {
|
|
11071
11632
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
@@ -11160,37 +11721,9 @@ var DevtoolsPanel = (props) => {
|
|
|
11160
11721
|
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
11161
11722
|
});
|
|
11162
11723
|
const [isResizing, setIsResizing] = createSignal(false);
|
|
11163
|
-
const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
|
|
11164
|
-
const sortOrder = createMemo(
|
|
11165
|
-
() => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
|
|
11166
|
-
);
|
|
11167
|
-
const [offline, setOffline] = createSignal(false);
|
|
11168
11724
|
const position = createMemo(
|
|
11169
11725
|
() => props.localStore.position || useQueryDevtoolsContext().position || POSITION
|
|
11170
11726
|
);
|
|
11171
|
-
const sortFn = createMemo(() => sortFns[sort()]);
|
|
11172
|
-
const onlineManager = createMemo(
|
|
11173
|
-
() => useQueryDevtoolsContext().onlineManager
|
|
11174
|
-
);
|
|
11175
|
-
const cache = createMemo(() => {
|
|
11176
|
-
return useQueryDevtoolsContext().client.getQueryCache();
|
|
11177
|
-
});
|
|
11178
|
-
const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
11179
|
-
return queryCache().getAll().length;
|
|
11180
|
-
}, false);
|
|
11181
|
-
const queries = createMemo(
|
|
11182
|
-
on(
|
|
11183
|
-
() => [queryCount(), props.localStore.filter, sort(), sortOrder()],
|
|
11184
|
-
() => {
|
|
11185
|
-
const curr = cache().getAll();
|
|
11186
|
-
const filtered = props.localStore.filter ? curr.filter(
|
|
11187
|
-
(item) => rankItem(item.queryHash, props.localStore.filter || "").passed
|
|
11188
|
-
) : [...curr];
|
|
11189
|
-
const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
|
|
11190
|
-
return sorted;
|
|
11191
|
-
}
|
|
11192
|
-
)
|
|
11193
|
-
);
|
|
11194
11727
|
const handleDragStart = (event) => {
|
|
11195
11728
|
const panelElement = event.currentTarget.parentElement;
|
|
11196
11729
|
if (!panelElement)
|
|
@@ -11235,8 +11768,6 @@ var DevtoolsPanel = (props) => {
|
|
|
11235
11768
|
document.addEventListener("mousemove", runDrag, false);
|
|
11236
11769
|
document.addEventListener("mouseup", unsub, false);
|
|
11237
11770
|
};
|
|
11238
|
-
setupQueryCacheSubscription();
|
|
11239
|
-
let queriesContainerRef;
|
|
11240
11771
|
let panelRef;
|
|
11241
11772
|
onMount(() => {
|
|
11242
11773
|
createResizeObserver(panelRef, ({ width }, el) => {
|
|
@@ -11245,9 +11776,6 @@ var DevtoolsPanel = (props) => {
|
|
|
11245
11776
|
}
|
|
11246
11777
|
});
|
|
11247
11778
|
});
|
|
11248
|
-
const setDevtoolsPosition = (pos) => {
|
|
11249
|
-
props.setLocalStore("position", pos);
|
|
11250
|
-
};
|
|
11251
11779
|
createEffect(() => {
|
|
11252
11780
|
const rootContainer = panelRef.parentElement?.parentElement?.parentElement;
|
|
11253
11781
|
if (!rootContainer)
|
|
@@ -11325,11 +11853,97 @@ var DevtoolsPanel = (props) => {
|
|
|
11325
11853
|
)}
|
|
11326
11854
|
onClick={() => props.setLocalStore("open", "false")}
|
|
11327
11855
|
><ChevronDown /></button>
|
|
11856
|
+
<ContentView
|
|
11857
|
+
localStore={props.localStore}
|
|
11858
|
+
setLocalStore={props.setLocalStore}
|
|
11859
|
+
/>
|
|
11860
|
+
</aside>;
|
|
11861
|
+
};
|
|
11862
|
+
var ContentView = (props) => {
|
|
11863
|
+
setupQueryCacheSubscription();
|
|
11864
|
+
setupMutationCacheSubscription();
|
|
11865
|
+
const theme = useTheme();
|
|
11866
|
+
const styles = createMemo(() => {
|
|
11867
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
11868
|
+
});
|
|
11869
|
+
const [selectedView, setSelectedView] = createSignal(
|
|
11870
|
+
"queries"
|
|
11871
|
+
);
|
|
11872
|
+
const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
|
|
11873
|
+
const sortOrder = createMemo(
|
|
11874
|
+
() => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
|
|
11875
|
+
);
|
|
11876
|
+
const mutationSort = createMemo(
|
|
11877
|
+
() => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME
|
|
11878
|
+
);
|
|
11879
|
+
const mutationSortOrder = createMemo(
|
|
11880
|
+
() => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER
|
|
11881
|
+
);
|
|
11882
|
+
const [offline, setOffline] = createSignal(false);
|
|
11883
|
+
const sortFn = createMemo(() => sortFns[sort()]);
|
|
11884
|
+
const mutationSortFn = createMemo(
|
|
11885
|
+
() => mutationSortFns[mutationSort()]
|
|
11886
|
+
);
|
|
11887
|
+
const onlineManager = createMemo(
|
|
11888
|
+
() => useQueryDevtoolsContext().onlineManager
|
|
11889
|
+
);
|
|
11890
|
+
const query_cache = createMemo(() => {
|
|
11891
|
+
return useQueryDevtoolsContext().client.getQueryCache();
|
|
11892
|
+
});
|
|
11893
|
+
const mutation_cache = createMemo(() => {
|
|
11894
|
+
return useQueryDevtoolsContext().client.getMutationCache();
|
|
11895
|
+
});
|
|
11896
|
+
const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
|
|
11897
|
+
return queryCache().getAll().length;
|
|
11898
|
+
}, false);
|
|
11899
|
+
const queries = createMemo(
|
|
11900
|
+
on(
|
|
11901
|
+
() => [queryCount(), props.localStore.filter, sort(), sortOrder()],
|
|
11902
|
+
() => {
|
|
11903
|
+
const curr = query_cache().getAll();
|
|
11904
|
+
const filtered = props.localStore.filter ? curr.filter(
|
|
11905
|
+
(item) => rankItem(item.queryHash, props.localStore.filter || "").passed
|
|
11906
|
+
) : [...curr];
|
|
11907
|
+
const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
|
|
11908
|
+
return sorted;
|
|
11909
|
+
}
|
|
11910
|
+
)
|
|
11911
|
+
);
|
|
11912
|
+
const mutationCount = createSubscribeToMutationCacheBatcher(
|
|
11913
|
+
(mutationCache) => {
|
|
11914
|
+
return mutationCache().getAll().length;
|
|
11915
|
+
},
|
|
11916
|
+
false
|
|
11917
|
+
);
|
|
11918
|
+
const mutations = createMemo(
|
|
11919
|
+
on(
|
|
11920
|
+
() => [
|
|
11921
|
+
mutationCount(),
|
|
11922
|
+
props.localStore.mutationFilter,
|
|
11923
|
+
mutationSort(),
|
|
11924
|
+
mutationSortOrder()
|
|
11925
|
+
],
|
|
11926
|
+
() => {
|
|
11927
|
+
const curr = mutation_cache().getAll();
|
|
11928
|
+
const filtered = props.localStore.mutationFilter ? curr.filter((item) => {
|
|
11929
|
+
const value = `${item.options.mutationKey ? JSON.stringify(item.options.mutationKey) + " - " : ""}${new Date(item.state.submittedAt).toLocaleString()}`;
|
|
11930
|
+
return rankItem(value, props.localStore.mutationFilter || "").passed;
|
|
11931
|
+
}) : [...curr];
|
|
11932
|
+
const sorted = mutationSortFn() ? filtered.sort(
|
|
11933
|
+
(a2, b2) => mutationSortFn()(a2, b2) * mutationSortOrder()
|
|
11934
|
+
) : filtered;
|
|
11935
|
+
return sorted;
|
|
11936
|
+
}
|
|
11937
|
+
)
|
|
11938
|
+
);
|
|
11939
|
+
const setDevtoolsPosition = (pos) => {
|
|
11940
|
+
props.setLocalStore("position", pos);
|
|
11941
|
+
};
|
|
11942
|
+
return <>
|
|
11328
11943
|
<div
|
|
11329
|
-
ref={queriesContainerRef}
|
|
11330
11944
|
class={clsx(
|
|
11331
11945
|
styles().queriesContainer,
|
|
11332
|
-
panelWidth() < secondBreakpoint && selectedQueryHash() && u`
|
|
11946
|
+
panelWidth() < secondBreakpoint && (selectedQueryHash() || selectedMutationId()) && u`
|
|
11333
11947
|
height: 50%;
|
|
11334
11948
|
max-height: 50%;
|
|
11335
11949
|
`,
|
|
@@ -11337,34 +11951,51 @@ var DevtoolsPanel = (props) => {
|
|
|
11337
11951
|
)}
|
|
11338
11952
|
>
|
|
11339
11953
|
<div class={clsx(styles().row, "tsqd-header")}>
|
|
11340
|
-
<
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
<span class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}>TANSTACK</span>
|
|
11346
|
-
<span
|
|
11347
|
-
class={clsx(
|
|
11348
|
-
styles().queryFlavorLogo,
|
|
11349
|
-
"tsqd-text-logo-query-flavor"
|
|
11350
|
-
)}
|
|
11954
|
+
<div class={styles().logoAndToggleContainer}>
|
|
11955
|
+
<button
|
|
11956
|
+
class={clsx(styles().logo, "tsqd-text-logo-container")}
|
|
11957
|
+
onClick={() => props.setLocalStore("open", "false")}
|
|
11958
|
+
aria-label="Close Tanstack query devtools"
|
|
11351
11959
|
>
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11960
|
+
<span
|
|
11961
|
+
class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}
|
|
11962
|
+
>TANSTACK</span>
|
|
11963
|
+
<span
|
|
11964
|
+
class={clsx(
|
|
11965
|
+
styles().queryFlavorLogo,
|
|
11966
|
+
"tsqd-text-logo-query-flavor"
|
|
11967
|
+
)}
|
|
11968
|
+
>
|
|
11969
|
+
{useQueryDevtoolsContext().queryFlavor}
|
|
11970
|
+
{" v"}
|
|
11971
|
+
{useQueryDevtoolsContext().version}
|
|
11972
|
+
</span>
|
|
11973
|
+
</button>
|
|
11974
|
+
<index$7.Root
|
|
11975
|
+
class={clsx(styles().viewToggle)}
|
|
11976
|
+
value={selectedView()}
|
|
11977
|
+
onChange={(value) => {
|
|
11978
|
+
setSelectedView(value);
|
|
11979
|
+
setSelectedQueryHash(null);
|
|
11980
|
+
setSelectedMutationId(null);
|
|
11981
|
+
}}
|
|
11982
|
+
>
|
|
11983
|
+
<index$7.Item value="queries" class="tsqd-radio-toggle">
|
|
11984
|
+
<index$7.ItemInput />
|
|
11985
|
+
<index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
|
|
11986
|
+
<index$7.ItemLabel title="Toggle Queries View">Queries</index$7.ItemLabel>
|
|
11987
|
+
</index$7.Item>
|
|
11988
|
+
<index$7.Item value="mutations" class="tsqd-radio-toggle">
|
|
11989
|
+
<index$7.ItemInput />
|
|
11990
|
+
<index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
|
|
11991
|
+
<index$7.ItemLabel title="Toggle Mutations View">Mutations</index$7.ItemLabel>
|
|
11992
|
+
</index$7.Item>
|
|
11993
|
+
</index$7.Root>
|
|
11994
|
+
</div>
|
|
11995
|
+
<Show when={selectedView() === "queries"}><QueryStatusCount /></Show>
|
|
11996
|
+
<Show when={selectedView() === "mutations"}><MutationStatusCount /></Show>
|
|
11358
11997
|
</div>
|
|
11359
|
-
<div
|
|
11360
|
-
class={clsx(
|
|
11361
|
-
styles().row,
|
|
11362
|
-
u`
|
|
11363
|
-
gap: ${tokens.size[2.5]};
|
|
11364
|
-
`,
|
|
11365
|
-
"tsqd-filters-actions-container"
|
|
11366
|
-
)}
|
|
11367
|
-
>
|
|
11998
|
+
<div class={clsx(styles().row, "tsqd-filters-actions-container")}>
|
|
11368
11999
|
<div class={clsx(styles().filtersContainer, "tsqd-filters-container")}>
|
|
11369
12000
|
<div
|
|
11370
12001
|
class={clsx(
|
|
@@ -11377,9 +12008,15 @@ var DevtoolsPanel = (props) => {
|
|
|
11377
12008
|
aria-label="Filter queries by query key"
|
|
11378
12009
|
type="text"
|
|
11379
12010
|
placeholder="Filter"
|
|
11380
|
-
onInput={(e2) =>
|
|
12011
|
+
onInput={(e2) => {
|
|
12012
|
+
if (selectedView() === "queries") {
|
|
12013
|
+
props.setLocalStore("filter", e2.currentTarget.value);
|
|
12014
|
+
} else {
|
|
12015
|
+
props.setLocalStore("mutationFilter", e2.currentTarget.value);
|
|
12016
|
+
}
|
|
12017
|
+
}}
|
|
11381
12018
|
class="tsqd-query-filter-textfield"
|
|
11382
|
-
value={props.localStore.filter || ""}
|
|
12019
|
+
value={selectedView() === "queries" ? props.localStore.filter || "" : props.localStore.mutationFilter || ""}
|
|
11383
12020
|
/>
|
|
11384
12021
|
</div>
|
|
11385
12022
|
<div
|
|
@@ -11388,28 +12025,50 @@ var DevtoolsPanel = (props) => {
|
|
|
11388
12025
|
"tsqd-query-filter-sort-container"
|
|
11389
12026
|
)}
|
|
11390
12027
|
>
|
|
11391
|
-
<select
|
|
12028
|
+
<Show when={selectedView() === "queries"}><select
|
|
11392
12029
|
value={sort()}
|
|
11393
|
-
onChange={(e2) =>
|
|
12030
|
+
onChange={(e2) => {
|
|
12031
|
+
props.setLocalStore("sort", e2.currentTarget.value);
|
|
12032
|
+
}}
|
|
11394
12033
|
>{Object.keys(sortFns).map((key) => <option value={key}>
|
|
11395
12034
|
{"Sort by "}
|
|
11396
12035
|
{key}
|
|
11397
|
-
</option>)}</select>
|
|
12036
|
+
</option>)}</select></Show>
|
|
12037
|
+
<Show when={selectedView() === "mutations"}><select
|
|
12038
|
+
value={mutationSort()}
|
|
12039
|
+
onChange={(e2) => {
|
|
12040
|
+
props.setLocalStore("mutationSort", e2.currentTarget.value);
|
|
12041
|
+
}}
|
|
12042
|
+
>{Object.keys(mutationSortFns).map((key) => <option value={key}>
|
|
12043
|
+
{"Sort by "}
|
|
12044
|
+
{key}
|
|
12045
|
+
</option>)}</select></Show>
|
|
11398
12046
|
<ChevronDown />
|
|
11399
12047
|
</div>
|
|
11400
12048
|
<button
|
|
11401
12049
|
onClick={() => {
|
|
11402
|
-
|
|
12050
|
+
if (selectedView() === "queries") {
|
|
12051
|
+
props.setLocalStore("sortOrder", String(sortOrder() * -1));
|
|
12052
|
+
} else {
|
|
12053
|
+
props.setLocalStore(
|
|
12054
|
+
"mutationSortOrder",
|
|
12055
|
+
String(mutationSortOrder() * -1)
|
|
12056
|
+
);
|
|
12057
|
+
}
|
|
11403
12058
|
}}
|
|
11404
|
-
aria-label={`Sort order ${sortOrder() === -1 ? "descending" : "ascending"}`}
|
|
11405
|
-
aria-pressed={sortOrder() === -1}
|
|
12059
|
+
aria-label={`Sort order ${(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1 ? "descending" : "ascending"}`}
|
|
12060
|
+
aria-pressed={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
|
|
11406
12061
|
class="tsqd-query-filter-sort-order-btn"
|
|
11407
12062
|
>
|
|
11408
|
-
<Show
|
|
12063
|
+
<Show
|
|
12064
|
+
when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === 1}
|
|
12065
|
+
>
|
|
11409
12066
|
<span>Asc</span>
|
|
11410
12067
|
<ArrowUp />
|
|
11411
12068
|
</Show>
|
|
11412
|
-
<Show
|
|
12069
|
+
<Show
|
|
12070
|
+
when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
|
|
12071
|
+
>
|
|
11413
12072
|
<span>Desc</span>
|
|
11414
12073
|
<ArrowDown />
|
|
11415
12074
|
</Show>
|
|
@@ -11418,7 +12077,11 @@ var DevtoolsPanel = (props) => {
|
|
|
11418
12077
|
<div class={clsx(styles().actionsContainer, "tsqd-actions-container")}>
|
|
11419
12078
|
<button
|
|
11420
12079
|
onClick={() => {
|
|
11421
|
-
|
|
12080
|
+
if (selectedView() === "queries") {
|
|
12081
|
+
query_cache().clear();
|
|
12082
|
+
} else {
|
|
12083
|
+
mutation_cache().clear();
|
|
12084
|
+
}
|
|
11422
12085
|
}}
|
|
11423
12086
|
class={clsx(
|
|
11424
12087
|
styles().actionsBtn,
|
|
@@ -11426,7 +12089,7 @@ var DevtoolsPanel = (props) => {
|
|
|
11426
12089
|
"tsqd-action-clear-cache"
|
|
11427
12090
|
)}
|
|
11428
12091
|
aria-label="Clear query cache"
|
|
11429
|
-
title=
|
|
12092
|
+
title={`Clear ${selectedView()} cache`}
|
|
11430
12093
|
><Trash /></button>
|
|
11431
12094
|
<button
|
|
11432
12095
|
onClick={() => {
|
|
@@ -11608,15 +12271,22 @@ var DevtoolsPanel = (props) => {
|
|
|
11608
12271
|
</index$d.Root>
|
|
11609
12272
|
</div>
|
|
11610
12273
|
</div>
|
|
11611
|
-
<div
|
|
12274
|
+
<Show when={selectedView() === "queries"}><div
|
|
11612
12275
|
class={clsx(
|
|
11613
12276
|
styles().overflowQueryContainer,
|
|
11614
12277
|
"tsqd-queries-overflow-container"
|
|
11615
12278
|
)}
|
|
11616
|
-
><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div>
|
|
12279
|
+
><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div></Show>
|
|
12280
|
+
<Show when={selectedView() === "mutations"}><div
|
|
12281
|
+
class={clsx(
|
|
12282
|
+
styles().overflowQueryContainer,
|
|
12283
|
+
"tsqd-mutations-overflow-container"
|
|
12284
|
+
)}
|
|
12285
|
+
><div class="tsqd-mutations-container"><Key by={(m) => m.mutationId} each={mutations()}>{(mutation) => <MutationRow mutation={mutation()} />}</Key></div></div></Show>
|
|
11617
12286
|
</div>
|
|
11618
|
-
<Show when={selectedQueryHash()}><QueryDetails /></Show>
|
|
11619
|
-
|
|
12287
|
+
<Show when={selectedView() === "queries" && selectedQueryHash()}><QueryDetails /></Show>
|
|
12288
|
+
<Show when={selectedView() === "mutations" && selectedMutationId()}><MutationDetails /></Show>
|
|
12289
|
+
</>;
|
|
11620
12290
|
};
|
|
11621
12291
|
var QueryRow = (props) => {
|
|
11622
12292
|
const theme = useTheme();
|
|
@@ -11685,6 +12355,94 @@ var QueryRow = (props) => {
|
|
|
11685
12355
|
<Show when={isDisabled()}><div class="tsqd-query-disabled-indicator">disabled</div></Show>
|
|
11686
12356
|
</button></Show>;
|
|
11687
12357
|
};
|
|
12358
|
+
var MutationRow = (props) => {
|
|
12359
|
+
const theme = useTheme();
|
|
12360
|
+
const styles = createMemo(() => {
|
|
12361
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12362
|
+
});
|
|
12363
|
+
const { colors, alpha } = tokens;
|
|
12364
|
+
const t2 = (light, dark) => theme() === "dark" ? dark : light;
|
|
12365
|
+
const mutationState = createSubscribeToMutationCacheBatcher(
|
|
12366
|
+
(mutationCache) => {
|
|
12367
|
+
const mutations = mutationCache().getAll();
|
|
12368
|
+
const mutation = mutations.find(
|
|
12369
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12370
|
+
);
|
|
12371
|
+
return mutation?.state;
|
|
12372
|
+
}
|
|
12373
|
+
);
|
|
12374
|
+
const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12375
|
+
const mutations = mutationCache().getAll();
|
|
12376
|
+
const mutation = mutations.find(
|
|
12377
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12378
|
+
);
|
|
12379
|
+
if (!mutation)
|
|
12380
|
+
return false;
|
|
12381
|
+
return mutation.state.isPaused;
|
|
12382
|
+
});
|
|
12383
|
+
const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12384
|
+
const mutations = mutationCache().getAll();
|
|
12385
|
+
const mutation = mutations.find(
|
|
12386
|
+
(m) => m.mutationId === props.mutation.mutationId
|
|
12387
|
+
);
|
|
12388
|
+
if (!mutation)
|
|
12389
|
+
return "idle";
|
|
12390
|
+
return mutation.state.status;
|
|
12391
|
+
});
|
|
12392
|
+
const color = createMemo(
|
|
12393
|
+
() => getMutationStatusColor({
|
|
12394
|
+
isPaused: isPaused(),
|
|
12395
|
+
status: status()
|
|
12396
|
+
})
|
|
12397
|
+
);
|
|
12398
|
+
const getObserverCountColorStyles = () => {
|
|
12399
|
+
if (color() === "gray") {
|
|
12400
|
+
return u`
|
|
12401
|
+
background-color: ${t2(colors[color()][200], colors[color()][700])};
|
|
12402
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12403
|
+
`;
|
|
12404
|
+
}
|
|
12405
|
+
return u`
|
|
12406
|
+
background-color: ${t2(
|
|
12407
|
+
colors[color()][200] + alpha[80],
|
|
12408
|
+
colors[color()][900]
|
|
12409
|
+
)};
|
|
12410
|
+
color: ${t2(colors[color()][800], colors[color()][300])};
|
|
12411
|
+
`;
|
|
12412
|
+
};
|
|
12413
|
+
return <Show when={mutationState()}><button
|
|
12414
|
+
onClick={() => {
|
|
12415
|
+
setSelectedMutationId(
|
|
12416
|
+
props.mutation.mutationId === selectedMutationId() ? null : props.mutation.mutationId
|
|
12417
|
+
);
|
|
12418
|
+
}}
|
|
12419
|
+
class={clsx(
|
|
12420
|
+
styles().queryRow,
|
|
12421
|
+
selectedMutationId() === props.mutation.mutationId && styles().selectedQueryRow,
|
|
12422
|
+
"tsqd-query-row"
|
|
12423
|
+
)}
|
|
12424
|
+
aria-label={`Mutation submitted at ${new Date(
|
|
12425
|
+
props.mutation.state.submittedAt
|
|
12426
|
+
).toLocaleString()}`}
|
|
12427
|
+
>
|
|
12428
|
+
<div
|
|
12429
|
+
class={clsx(getObserverCountColorStyles(), "tsqd-query-observer-count")}
|
|
12430
|
+
>
|
|
12431
|
+
<Show when={color() === "purple"}><PauseCircle /></Show>
|
|
12432
|
+
<Show when={color() === "green"}><CheckCircle /></Show>
|
|
12433
|
+
<Show when={color() === "red"}><XCircle /></Show>
|
|
12434
|
+
<Show when={color() === "yellow"}><LoadingCircle /></Show>
|
|
12435
|
+
</div>
|
|
12436
|
+
<code class="tsqd-query-hash">
|
|
12437
|
+
<Show when={props.mutation.options.mutationKey}>
|
|
12438
|
+
{JSON.stringify(props.mutation.options.mutationKey)}
|
|
12439
|
+
{" -"}
|
|
12440
|
+
{" "}
|
|
12441
|
+
</Show>
|
|
12442
|
+
{new Date(props.mutation.state.submittedAt).toLocaleString()}
|
|
12443
|
+
</code>
|
|
12444
|
+
</button></Show>;
|
|
12445
|
+
};
|
|
11688
12446
|
var QueryStatusCount = () => {
|
|
11689
12447
|
const stale = createSubscribeToQueryCacheBatcher(
|
|
11690
12448
|
(queryCache) => queryCache().getAll().filter((q) => getQueryStatusLabel(q) === "stale").length
|
|
@@ -11715,6 +12473,52 @@ var QueryStatusCount = () => {
|
|
|
11715
12473
|
<QueryStatus label="Inactive" color="gray" count={inactive()} />
|
|
11716
12474
|
</div>;
|
|
11717
12475
|
};
|
|
12476
|
+
var MutationStatusCount = () => {
|
|
12477
|
+
const success = createSubscribeToMutationCacheBatcher(
|
|
12478
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12479
|
+
(m) => getMutationStatusColor({
|
|
12480
|
+
isPaused: m.state.isPaused,
|
|
12481
|
+
status: m.state.status
|
|
12482
|
+
}) === "green"
|
|
12483
|
+
).length
|
|
12484
|
+
);
|
|
12485
|
+
const pending = createSubscribeToMutationCacheBatcher(
|
|
12486
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12487
|
+
(m) => getMutationStatusColor({
|
|
12488
|
+
isPaused: m.state.isPaused,
|
|
12489
|
+
status: m.state.status
|
|
12490
|
+
}) === "yellow"
|
|
12491
|
+
).length
|
|
12492
|
+
);
|
|
12493
|
+
const paused = createSubscribeToMutationCacheBatcher(
|
|
12494
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12495
|
+
(m) => getMutationStatusColor({
|
|
12496
|
+
isPaused: m.state.isPaused,
|
|
12497
|
+
status: m.state.status
|
|
12498
|
+
}) === "purple"
|
|
12499
|
+
).length
|
|
12500
|
+
);
|
|
12501
|
+
const error = createSubscribeToMutationCacheBatcher(
|
|
12502
|
+
(mutationCache) => mutationCache().getAll().filter(
|
|
12503
|
+
(m) => getMutationStatusColor({
|
|
12504
|
+
isPaused: m.state.isPaused,
|
|
12505
|
+
status: m.state.status
|
|
12506
|
+
}) === "red"
|
|
12507
|
+
).length
|
|
12508
|
+
);
|
|
12509
|
+
const theme = useTheme();
|
|
12510
|
+
const styles = createMemo(() => {
|
|
12511
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12512
|
+
});
|
|
12513
|
+
return <div
|
|
12514
|
+
class={clsx(styles().queryStatusContainer, "tsqd-query-status-container")}
|
|
12515
|
+
>
|
|
12516
|
+
<QueryStatus label="Paused" color="purple" count={paused()} />
|
|
12517
|
+
<QueryStatus label="Pending" color="yellow" count={pending()} />
|
|
12518
|
+
<QueryStatus label="Success" color="green" count={success()} />
|
|
12519
|
+
<QueryStatus label="Error" color="red" count={error()} />
|
|
12520
|
+
</div>;
|
|
12521
|
+
};
|
|
11718
12522
|
var QueryStatus = (props) => {
|
|
11719
12523
|
const theme = useTheme();
|
|
11720
12524
|
const styles = createMemo(() => {
|
|
@@ -12123,21 +12927,145 @@ var QueryDetails = () => {
|
|
|
12123
12927
|
/></div>
|
|
12124
12928
|
</div></Show>;
|
|
12125
12929
|
};
|
|
12126
|
-
var
|
|
12930
|
+
var MutationDetails = () => {
|
|
12931
|
+
const theme = useTheme();
|
|
12932
|
+
const styles = createMemo(() => {
|
|
12933
|
+
return theme() === "dark" ? darkStyles2 : lightStyles2;
|
|
12934
|
+
});
|
|
12935
|
+
const { colors } = tokens;
|
|
12936
|
+
const t2 = (light, dark) => theme() === "dark" ? dark : light;
|
|
12937
|
+
const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12938
|
+
const mutations = mutationCache().getAll();
|
|
12939
|
+
const mutation = mutations.find(
|
|
12940
|
+
(m) => m.mutationId === selectedMutationId()
|
|
12941
|
+
);
|
|
12942
|
+
if (!mutation)
|
|
12943
|
+
return false;
|
|
12944
|
+
return mutation.state.isPaused;
|
|
12945
|
+
});
|
|
12946
|
+
const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
|
|
12947
|
+
const mutations = mutationCache().getAll();
|
|
12948
|
+
const mutation = mutations.find(
|
|
12949
|
+
(m) => m.mutationId === selectedMutationId()
|
|
12950
|
+
);
|
|
12951
|
+
if (!mutation)
|
|
12952
|
+
return "idle";
|
|
12953
|
+
return mutation.state.status;
|
|
12954
|
+
});
|
|
12955
|
+
const color = createMemo(
|
|
12956
|
+
() => getMutationStatusColor({
|
|
12957
|
+
isPaused: isPaused(),
|
|
12958
|
+
status: status()
|
|
12959
|
+
})
|
|
12960
|
+
);
|
|
12961
|
+
const activeMutation = createSubscribeToMutationCacheBatcher(
|
|
12962
|
+
(mutationCache) => mutationCache().getAll().find((mutation) => mutation.mutationId === selectedMutationId()),
|
|
12963
|
+
false
|
|
12964
|
+
);
|
|
12965
|
+
const getQueryStatusColors = () => {
|
|
12966
|
+
if (color() === "gray") {
|
|
12967
|
+
return u`
|
|
12968
|
+
background-color: ${t2(colors[color()][200], colors[color()][700])};
|
|
12969
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12970
|
+
border-color: ${t2(colors[color()][400], colors[color()][600])};
|
|
12971
|
+
`;
|
|
12972
|
+
}
|
|
12973
|
+
return u`
|
|
12974
|
+
background-color: ${t2(colors[color()][100], colors[color()][900])};
|
|
12975
|
+
color: ${t2(colors[color()][700], colors[color()][300])};
|
|
12976
|
+
border-color: ${t2(colors[color()][400], colors[color()][600])};
|
|
12977
|
+
`;
|
|
12978
|
+
};
|
|
12979
|
+
return <Show when={activeMutation()}><div
|
|
12980
|
+
class={clsx(styles().detailsContainer, "tsqd-query-details-container")}
|
|
12981
|
+
>
|
|
12982
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutation Details</div>
|
|
12983
|
+
<div
|
|
12984
|
+
class={clsx(
|
|
12985
|
+
styles().detailsBody,
|
|
12986
|
+
"tsqd-query-details-summary-container"
|
|
12987
|
+
)}
|
|
12988
|
+
>
|
|
12989
|
+
<div class="tsqd-query-details-summary">
|
|
12990
|
+
<pre><code><Show
|
|
12991
|
+
when={activeMutation().options.mutationKey}
|
|
12992
|
+
fallback="No mutationKey found"
|
|
12993
|
+
>{displayValue(activeMutation().options.mutationKey, true)}</Show></code></pre>
|
|
12994
|
+
<span
|
|
12995
|
+
class={clsx(styles().queryDetailsStatus, getQueryStatusColors())}
|
|
12996
|
+
>
|
|
12997
|
+
<Show when={color() === "purple"}>pending</Show>
|
|
12998
|
+
<Show when={color() !== "purple"}>{status()}</Show>
|
|
12999
|
+
</span>
|
|
13000
|
+
</div>
|
|
13001
|
+
<div class="tsqd-query-details-last-updated">
|
|
13002
|
+
<span>Submitted At:</span>
|
|
13003
|
+
<span>{new Date(
|
|
13004
|
+
activeMutation().state.submittedAt
|
|
13005
|
+
).toLocaleTimeString()}</span>
|
|
13006
|
+
</div>
|
|
13007
|
+
</div>
|
|
13008
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Variables Details</div>
|
|
13009
|
+
<div
|
|
13010
|
+
style={{
|
|
13011
|
+
padding: "0.5rem"
|
|
13012
|
+
}}
|
|
13013
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13014
|
+
><Explorer
|
|
13015
|
+
label="Variables"
|
|
13016
|
+
defaultExpanded={["Variables"]}
|
|
13017
|
+
value={activeMutation().state.variables}
|
|
13018
|
+
/></div>
|
|
13019
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Context Details</div>
|
|
13020
|
+
<div
|
|
13021
|
+
style={{
|
|
13022
|
+
padding: "0.5rem"
|
|
13023
|
+
}}
|
|
13024
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13025
|
+
><Explorer
|
|
13026
|
+
label="Context"
|
|
13027
|
+
defaultExpanded={["Context"]}
|
|
13028
|
+
value={activeMutation().state.context}
|
|
13029
|
+
/></div>
|
|
13030
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
|
|
13031
|
+
<div
|
|
13032
|
+
style={{
|
|
13033
|
+
padding: "0.5rem"
|
|
13034
|
+
}}
|
|
13035
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13036
|
+
><Explorer
|
|
13037
|
+
label="Data"
|
|
13038
|
+
defaultExpanded={["Data"]}
|
|
13039
|
+
value={activeMutation().state.data}
|
|
13040
|
+
/></div>
|
|
13041
|
+
<div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutations Explorer</div>
|
|
13042
|
+
<div
|
|
13043
|
+
style={{
|
|
13044
|
+
padding: "0.5rem"
|
|
13045
|
+
}}
|
|
13046
|
+
class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
|
|
13047
|
+
><Explorer
|
|
13048
|
+
label="Mutation"
|
|
13049
|
+
defaultExpanded={["Mutation"]}
|
|
13050
|
+
value={activeMutation()}
|
|
13051
|
+
/></div>
|
|
13052
|
+
</div></Show>;
|
|
13053
|
+
};
|
|
13054
|
+
var queryCacheMap = /* @__PURE__ */ new Map();
|
|
12127
13055
|
var setupQueryCacheSubscription = () => {
|
|
12128
13056
|
const queryCache = createMemo(() => {
|
|
12129
13057
|
const client = useQueryDevtoolsContext().client;
|
|
12130
13058
|
return client.getQueryCache();
|
|
12131
13059
|
});
|
|
12132
13060
|
const unsub = queryCache().subscribe(() => {
|
|
12133
|
-
for (const [callback, setter] of
|
|
13061
|
+
for (const [callback, setter] of queryCacheMap.entries()) {
|
|
12134
13062
|
queueMicrotask(() => {
|
|
12135
13063
|
setter(callback(queryCache));
|
|
12136
13064
|
});
|
|
12137
13065
|
}
|
|
12138
13066
|
});
|
|
12139
13067
|
onCleanup(() => {
|
|
12140
|
-
|
|
13068
|
+
queryCacheMap.clear();
|
|
12141
13069
|
unsub();
|
|
12142
13070
|
});
|
|
12143
13071
|
return unsub;
|
|
@@ -12154,9 +13082,46 @@ var createSubscribeToQueryCacheBatcher = (callback, equalityCheck = true) => {
|
|
|
12154
13082
|
createEffect(() => {
|
|
12155
13083
|
setValue(callback(queryCache));
|
|
12156
13084
|
});
|
|
12157
|
-
|
|
13085
|
+
queryCacheMap.set(callback, setValue);
|
|
12158
13086
|
onCleanup(() => {
|
|
12159
|
-
|
|
13087
|
+
queryCacheMap.delete(callback);
|
|
13088
|
+
});
|
|
13089
|
+
return value;
|
|
13090
|
+
};
|
|
13091
|
+
var mutationCacheMap = /* @__PURE__ */ new Map();
|
|
13092
|
+
var setupMutationCacheSubscription = () => {
|
|
13093
|
+
const mutationCache = createMemo(() => {
|
|
13094
|
+
const client = useQueryDevtoolsContext().client;
|
|
13095
|
+
return client.getMutationCache();
|
|
13096
|
+
});
|
|
13097
|
+
const unsub = mutationCache().subscribe(() => {
|
|
13098
|
+
for (const [callback, setter] of mutationCacheMap.entries()) {
|
|
13099
|
+
queueMicrotask(() => {
|
|
13100
|
+
setter(callback(mutationCache));
|
|
13101
|
+
});
|
|
13102
|
+
}
|
|
13103
|
+
});
|
|
13104
|
+
onCleanup(() => {
|
|
13105
|
+
mutationCacheMap.clear();
|
|
13106
|
+
unsub();
|
|
13107
|
+
});
|
|
13108
|
+
return unsub;
|
|
13109
|
+
};
|
|
13110
|
+
var createSubscribeToMutationCacheBatcher = (callback, equalityCheck = true) => {
|
|
13111
|
+
const mutationCache = createMemo(() => {
|
|
13112
|
+
const client = useQueryDevtoolsContext().client;
|
|
13113
|
+
return client.getMutationCache();
|
|
13114
|
+
});
|
|
13115
|
+
const [value, setValue] = createSignal(
|
|
13116
|
+
callback(mutationCache),
|
|
13117
|
+
!equalityCheck ? { equals: false } : void 0
|
|
13118
|
+
);
|
|
13119
|
+
createEffect(() => {
|
|
13120
|
+
setValue(callback(mutationCache));
|
|
13121
|
+
});
|
|
13122
|
+
mutationCacheMap.set(callback, setValue);
|
|
13123
|
+
onCleanup(() => {
|
|
13124
|
+
mutationCacheMap.delete(callback);
|
|
12160
13125
|
});
|
|
12161
13126
|
return value;
|
|
12162
13127
|
};
|
|
@@ -12431,7 +13396,7 @@ var stylesFactory2 = (theme) => {
|
|
|
12431
13396
|
justify-content: space-between;
|
|
12432
13397
|
align-items: center;
|
|
12433
13398
|
padding: ${tokens.size[2]} ${tokens.size[2.5]};
|
|
12434
|
-
gap: ${tokens.size[
|
|
13399
|
+
gap: ${tokens.size[2.5]};
|
|
12435
13400
|
border-bottom: ${t2(colors.gray[300], colors.darkGray[500])} 1px solid;
|
|
12436
13401
|
align-items: center;
|
|
12437
13402
|
& > button {
|
|
@@ -12443,8 +13408,19 @@ var stylesFactory2 = (theme) => {
|
|
|
12443
13408
|
flex-direction: column;
|
|
12444
13409
|
}
|
|
12445
13410
|
`,
|
|
13411
|
+
logoAndToggleContainer: u`
|
|
13412
|
+
display: flex;
|
|
13413
|
+
gap: ${tokens.size[3]};
|
|
13414
|
+
align-items: center;
|
|
13415
|
+
`,
|
|
12446
13416
|
logo: u`
|
|
12447
13417
|
cursor: pointer;
|
|
13418
|
+
display: flex;
|
|
13419
|
+
flex-direction: column;
|
|
13420
|
+
background-color: transparent;
|
|
13421
|
+
border: none;
|
|
13422
|
+
gap: ${tokens.size[0.5]};
|
|
13423
|
+
padding: 0px;
|
|
12448
13424
|
&:hover {
|
|
12449
13425
|
opacity: 0.7;
|
|
12450
13426
|
}
|
|
@@ -12816,6 +13792,8 @@ var stylesFactory2 = (theme) => {
|
|
|
12816
13792
|
|
|
12817
13793
|
& pre {
|
|
12818
13794
|
margin: 0;
|
|
13795
|
+
display: flex;
|
|
13796
|
+
align-items: center;
|
|
12819
13797
|
}
|
|
12820
13798
|
`,
|
|
12821
13799
|
queryDetailsStatus: u`
|
|
@@ -12995,6 +13973,56 @@ var stylesFactory2 = (theme) => {
|
|
|
12995
13973
|
&:hover {
|
|
12996
13974
|
background-color: ${t2(colors.purple[100], colors.purple[900])};
|
|
12997
13975
|
}
|
|
13976
|
+
`,
|
|
13977
|
+
viewToggle: u`
|
|
13978
|
+
border-radius: ${tokens.border.radius.sm};
|
|
13979
|
+
background-color: ${t2(colors.gray[200], colors.darkGray[600])};
|
|
13980
|
+
border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
|
|
13981
|
+
display: flex;
|
|
13982
|
+
padding: 0;
|
|
13983
|
+
font-size: ${font.size.xs};
|
|
13984
|
+
color: ${t2(colors.gray[700], colors.gray[300])};
|
|
13985
|
+
overflow: hidden;
|
|
13986
|
+
|
|
13987
|
+
&:has(:focus-visible) {
|
|
13988
|
+
outline: 2px solid ${colors.blue[800]};
|
|
13989
|
+
}
|
|
13990
|
+
|
|
13991
|
+
& .tsqd-radio-toggle {
|
|
13992
|
+
opacity: 0.5;
|
|
13993
|
+
display: flex;
|
|
13994
|
+
& label {
|
|
13995
|
+
display: flex;
|
|
13996
|
+
align-items: center;
|
|
13997
|
+
cursor: pointer;
|
|
13998
|
+
line-height: ${font.lineHeight.md};
|
|
13999
|
+
}
|
|
14000
|
+
|
|
14001
|
+
& label:hover {
|
|
14002
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[500])};
|
|
14003
|
+
}
|
|
14004
|
+
}
|
|
14005
|
+
|
|
14006
|
+
& > [data-checked] {
|
|
14007
|
+
opacity: 1;
|
|
14008
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[400])};
|
|
14009
|
+
& label:hover {
|
|
14010
|
+
background-color: ${t2(colors.gray[100], colors.darkGray[400])};
|
|
14011
|
+
}
|
|
14012
|
+
}
|
|
14013
|
+
|
|
14014
|
+
& .tsqd-radio-toggle:first-child {
|
|
14015
|
+
& label {
|
|
14016
|
+
padding: 0 ${tokens.size[1.5]} 0 ${tokens.size[2]};
|
|
14017
|
+
}
|
|
14018
|
+
border-right: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
|
|
14019
|
+
}
|
|
14020
|
+
|
|
14021
|
+
& .tsqd-radio-toggle:nth-child(2) {
|
|
14022
|
+
& label {
|
|
14023
|
+
padding: 0 ${tokens.size[2]} 0 ${tokens.size[1.5]};
|
|
14024
|
+
}
|
|
14025
|
+
}
|
|
12998
14026
|
`
|
|
12999
14027
|
};
|
|
13000
14028
|
};
|
|
@@ -13004,6 +14032,8 @@ export {
|
|
|
13004
14032
|
Devtools,
|
|
13005
14033
|
DevtoolsComponent,
|
|
13006
14034
|
DevtoolsPanel,
|
|
14035
|
+
MutationRow,
|
|
14036
|
+
MutationStatusCount,
|
|
13007
14037
|
QueryRow,
|
|
13008
14038
|
QueryStatus,
|
|
13009
14039
|
QueryStatusCount,
|
|
@@ -13215,8 +14245,6 @@ export {
|
|
|
13215
14245
|
* Credits to the zag team:
|
|
13216
14246
|
* https://github.com/chakra-ui/zag/blob/c1e6c7689b22bf58741ded7cf224dd9baec2a046/packages/utilities/form-utils/src/form.ts
|
|
13217
14247
|
*)
|
|
13218
|
-
|
|
13219
|
-
@kobalte/core/dist/esm/index.js:
|
|
13220
14248
|
(*!
|
|
13221
14249
|
* Portions of this file are based on code from react-spectrum.
|
|
13222
14250
|
* Apache License Version 2.0, Copyright 2020 Adobe.
|