@tanstack/query-devtools 5.0.5 → 5.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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/AHAJNSNO.jsx";
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
- 25: "#FFFBFA",
8180
- 50: "#FEF3F2",
8181
- 100: "#FEE4E2",
8182
- 200: "#FECDCA",
8183
- 300: "#FDA29B",
8184
- 400: "#F97066",
8185
- 500: "#F04438",
8186
- 600: "#D92D20",
8187
- 700: "#B42318",
8188
- 800: "#912018",
8189
- 900: "#7A271A"
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",
@@ -8269,35 +8737,35 @@ var tokens = {
8269
8737
  },
8270
8738
  font: {
8271
8739
  size: {
8272
- "2xs": "0.625rem",
8273
- xs: "0.75rem",
8274
- sm: "0.875rem",
8275
- md: "1rem",
8276
- lg: "1.125rem",
8277
- xl: "1.25rem",
8278
- "2xl": "1.5rem",
8279
- "3xl": "1.875rem",
8280
- "4xl": "2.25rem",
8281
- "5xl": "3rem",
8282
- "6xl": "3.75rem",
8283
- "7xl": "4.5rem",
8284
- "8xl": "6rem",
8285
- "9xl": "8rem"
8740
+ "2xs": "calc(var(--tsqd-font-size) * 0.625)",
8741
+ xs: "calc(var(--tsqd-font-size) * 0.75)",
8742
+ sm: "calc(var(--tsqd-font-size) * 0.875)",
8743
+ md: "var(--tsqd-font-size)",
8744
+ lg: "calc(var(--tsqd-font-size) * 1.125)",
8745
+ xl: "calc(var(--tsqd-font-size) * 1.25)",
8746
+ "2xl": "calc(var(--tsqd-font-size) * 1.5)",
8747
+ "3xl": "calc(var(--tsqd-font-size) * 1.875)",
8748
+ "4xl": "calc(var(--tsqd-font-size) * 2.25)",
8749
+ "5xl": "calc(var(--tsqd-font-size) * 3)",
8750
+ "6xl": "calc(var(--tsqd-font-size) * 3.75)",
8751
+ "7xl": "calc(var(--tsqd-font-size) * 4.5)",
8752
+ "8xl": "calc(var(--tsqd-font-size) * 6)",
8753
+ "9xl": "calc(var(--tsqd-font-size) * 8)"
8286
8754
  },
8287
8755
  lineHeight: {
8288
- xs: "1rem",
8289
- sm: "1.25rem",
8290
- md: "1.5rem",
8291
- lg: "1.75rem",
8292
- xl: "1.75rem",
8293
- "2xl": "2rem",
8294
- "3xl": "2.25rem",
8295
- "4xl": "2.5rem",
8296
- "5xl": "1",
8297
- "6xl": "1",
8298
- "7xl": "1",
8299
- "8xl": "1",
8300
- "9xl": "1"
8756
+ xs: "calc(var(--tsqd-font-size) * 1)",
8757
+ sm: "calc(var(--tsqd-font-size) * 1.25)",
8758
+ md: "calc(var(--tsqd-font-size) * 1.5)",
8759
+ lg: "calc(var(--tsqd-font-size) * 1.75)",
8760
+ xl: "calc(var(--tsqd-font-size) * 2)",
8761
+ "2xl": "calc(var(--tsqd-font-size) * 2.25)",
8762
+ "3xl": "calc(var(--tsqd-font-size) * 2.5)",
8763
+ "4xl": "calc(var(--tsqd-font-size) * 2.75)",
8764
+ "5xl": "calc(var(--tsqd-font-size) * 3)",
8765
+ "6xl": "calc(var(--tsqd-font-size) * 3.25)",
8766
+ "7xl": "calc(var(--tsqd-font-size) * 3.5)",
8767
+ "8xl": "calc(var(--tsqd-font-size) * 3.75)",
8768
+ "9xl": "calc(var(--tsqd-font-size) * 4)"
8301
8769
  },
8302
8770
  weight: {
8303
8771
  thin: "100",
@@ -8322,55 +8790,55 @@ var tokens = {
8322
8790
  border: {
8323
8791
  radius: {
8324
8792
  none: "0px",
8325
- xs: "0.125rem",
8326
- sm: "0.25rem",
8327
- md: "0.375rem",
8328
- lg: "0.5rem",
8329
- xl: "0.75rem",
8330
- "2xl": "1rem",
8331
- "3xl": "1.5rem",
8793
+ xs: "calc(var(--tsqd-font-size) * 0.125)",
8794
+ sm: "calc(var(--tsqd-font-size) * 0.25)",
8795
+ md: "calc(var(--tsqd-font-size) * 0.375)",
8796
+ lg: "calc(var(--tsqd-font-size) * 0.5)",
8797
+ xl: "calc(var(--tsqd-font-size) * 0.75)",
8798
+ "2xl": "calc(var(--tsqd-font-size) * 1)",
8799
+ "3xl": "calc(var(--tsqd-font-size) * 1.5)",
8332
8800
  full: "9999px"
8333
8801
  }
8334
8802
  },
8335
8803
  size: {
8336
8804
  0: "0px",
8337
- 0.25: "0.0625rem",
8338
- 0.5: "0.125rem",
8339
- 1: "0.25rem",
8340
- 1.5: "0.375rem",
8341
- 2: "0.5rem",
8342
- 2.5: "0.625rem",
8343
- 3: "0.75rem",
8344
- 3.5: "0.875rem",
8345
- 4: "1rem",
8346
- 4.5: "1.125rem",
8347
- 5: "1.25rem",
8348
- 5.5: "1.375rem",
8349
- 6: "1.5rem",
8350
- 6.5: "1.625rem",
8351
- 7: "1.75rem",
8352
- 8: "2rem",
8353
- 9: "2.25rem",
8354
- 10: "2.5rem",
8355
- 11: "2.75rem",
8356
- 12: "3rem",
8357
- 14: "3.5rem",
8358
- 16: "4rem",
8359
- 20: "5rem",
8360
- 24: "6rem",
8361
- 28: "7rem",
8362
- 32: "8rem",
8363
- 36: "9rem",
8364
- 40: "10rem",
8365
- 44: "11rem",
8366
- 48: "12rem",
8367
- 52: "13rem",
8368
- 56: "14rem",
8369
- 60: "15rem",
8370
- 64: "16rem",
8371
- 72: "18rem",
8372
- 80: "20rem",
8373
- 96: "24rem"
8805
+ 0.25: "calc(var(--tsqd-font-size) * 0.0625)",
8806
+ 0.5: "calc(var(--tsqd-font-size) * 0.125)",
8807
+ 1: "calc(var(--tsqd-font-size) * 0.25)",
8808
+ 1.5: "calc(var(--tsqd-font-size) * 0.375)",
8809
+ 2: "calc(var(--tsqd-font-size) * 0.5)",
8810
+ 2.5: "calc(var(--tsqd-font-size) * 0.625)",
8811
+ 3: "calc(var(--tsqd-font-size) * 0.75)",
8812
+ 3.5: "calc(var(--tsqd-font-size) * 0.875)",
8813
+ 4: "calc(var(--tsqd-font-size) * 1)",
8814
+ 4.5: "calc(var(--tsqd-font-size) * 1.125)",
8815
+ 5: "calc(var(--tsqd-font-size) * 1.25)",
8816
+ 5.5: "calc(var(--tsqd-font-size) * 1.375)",
8817
+ 6: "calc(var(--tsqd-font-size) * 1.5)",
8818
+ 6.5: "calc(var(--tsqd-font-size) * 1.625)",
8819
+ 7: "calc(var(--tsqd-font-size) * 1.75)",
8820
+ 8: "calc(var(--tsqd-font-size) * 2)",
8821
+ 9: "calc(var(--tsqd-font-size) * 2.25)",
8822
+ 10: "calc(var(--tsqd-font-size) * 2.5)",
8823
+ 11: "calc(var(--tsqd-font-size) * 2.75)",
8824
+ 12: "calc(var(--tsqd-font-size) * 3)",
8825
+ 14: "calc(var(--tsqd-font-size) * 3.5)",
8826
+ 16: "calc(var(--tsqd-font-size) * 4)",
8827
+ 20: "calc(var(--tsqd-font-size) * 5)",
8828
+ 24: "calc(var(--tsqd-font-size) * 6)",
8829
+ 28: "calc(var(--tsqd-font-size) * 7)",
8830
+ 32: "calc(var(--tsqd-font-size) * 8)",
8831
+ 36: "calc(var(--tsqd-font-size) * 9)",
8832
+ 40: "calc(var(--tsqd-font-size) * 10)",
8833
+ 44: "calc(var(--tsqd-font-size) * 11)",
8834
+ 48: "calc(var(--tsqd-font-size) * 12)",
8835
+ 52: "calc(var(--tsqd-font-size) * 13)",
8836
+ 56: "calc(var(--tsqd-font-size) * 14)",
8837
+ 60: "calc(var(--tsqd-font-size) * 15)",
8838
+ 64: "calc(var(--tsqd-font-size) * 16)",
8839
+ 72: "calc(var(--tsqd-font-size) * 18)",
8840
+ 80: "calc(var(--tsqd-font-size) * 20)",
8841
+ 96: "calc(var(--tsqd-font-size) * 24)"
8374
8842
  },
8375
8843
  shadow: Shadow,
8376
8844
  zIndices: {
@@ -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 TanstackLogo() {
9870
- const id = createUniqueId();
9871
- return <svg version="1.0" viewBox="0 0 633 633">
9872
- <linearGradient
9873
- id={`a-${id}`}
9874
- x1="-666.45"
9875
- x2="-666.45"
9876
- y1="163.28"
9877
- y2="163.99"
9878
- gradientTransform="matrix(633 0 0 633 422177 -103358)"
9879
- gradientUnits="userSpaceOnUse"
9880
- >
9881
- <stop stop-color="#6BDAFF" offset="0" />
9882
- <stop stop-color="#F9FFB5" offset=".32" />
9883
- <stop stop-color="#FFA770" offset=".71" />
9884
- <stop stop-color="#FF7373" offset="1" />
9885
- </linearGradient>
9886
- <circle cx="316.5" cy="316.5" r="316.5" fill={`url(#a-${id})`} />
9887
- <defs><filter
9888
- id={`am-${id}`}
9889
- x="-137.5"
9890
- y="412"
9891
- width="454"
9892
- height="396.9"
9893
- filterUnits="userSpaceOnUse"
9894
- ><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" /></filter></defs>
9895
- <mask
9896
- id={`b-${id}`}
9897
- x="-137.5"
9898
- y="412"
9899
- width="454"
9900
- height="396.9"
9901
- maskUnits="userSpaceOnUse"
9902
- ><g filter={`url(#am-${id})`}><circle cx="316.5" cy="316.5" r="316.5" fill="#fff" /></g></mask>
9903
- <g mask={`url(#b-${id})`}><ellipse
9904
- cx="89.5"
9905
- cy="610.5"
9906
- rx="214.5"
9907
- ry="186"
9908
- fill="#015064"
9909
- stroke="#00CFE2"
9910
- stroke-width="25"
9911
- /></g>
9912
- <defs><filter
9913
- id={`ah-${id}`}
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"
@@ -10948,8 +11505,8 @@ var stylesFactory = (theme) => {
10948
11505
  expanderButtonContainer: u`
10949
11506
  display: flex;
10950
11507
  align-items: center;
10951
- line-height: 1.125rem;
10952
- min-height: 1.125rem;
11508
+ line-height: ${size2[4]};
11509
+ min-height: ${size2[4]};
10953
11510
  gap: ${size2[2]};
10954
11511
  `,
10955
11512
  expanderButton: u`
@@ -10957,7 +11514,7 @@ var stylesFactory = (theme) => {
10957
11514
  color: inherit;
10958
11515
  font: inherit;
10959
11516
  outline: inherit;
10960
- height: 1rem;
11517
+ height: ${size2[5]};
10961
11518
  background: transparent;
10962
11519
  border: none;
10963
11520
  padding: 0;
@@ -10999,8 +11556,8 @@ var stylesFactory = (theme) => {
10999
11556
  display: inline-flex;
11000
11557
  gap: ${size2[2]};
11001
11558
  width: 100%;
11002
- margin-bottom: ${size2[0.5]};
11003
- line-height: 1.125rem;
11559
+ margin: ${size2[0.25]} 0px;
11560
+ line-height: ${size2[4.5]};
11004
11561
  align-items: center;
11005
11562
  `,
11006
11563
  editableInput: u`
@@ -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({
@@ -11096,8 +11657,9 @@ var Devtools = (props) => {
11096
11657
  const position = createMemo(() => {
11097
11658
  return props.localStore.position || useQueryDevtoolsContext().position || POSITION;
11098
11659
  });
11660
+ let transitionsContainerRef;
11099
11661
  createEffect(() => {
11100
- const root = document.querySelector(".tsqd-parent-container");
11662
+ const root = transitionsContainerRef.parentElement;
11101
11663
  const height = props.localStore.height || DEFAULT_HEIGHT;
11102
11664
  const width = props.localStore.width || DEFAULT_WIDTH;
11103
11665
  const panelPosition = position();
@@ -11110,6 +11672,18 @@ var Devtools = (props) => {
11110
11672
  `${panelPosition === "left" ? "-" : ""}${width}px`
11111
11673
  );
11112
11674
  });
11675
+ onMount(() => {
11676
+ const onFocus = () => {
11677
+ const root = transitionsContainerRef.parentElement;
11678
+ const fontSize = getComputedStyle(root).fontSize;
11679
+ root.style.setProperty("--tsqd-font-size", fontSize);
11680
+ };
11681
+ onFocus();
11682
+ window.addEventListener("focus", onFocus);
11683
+ onCleanup(() => {
11684
+ window.removeEventListener("focus", onFocus);
11685
+ });
11686
+ });
11113
11687
  return <div
11114
11688
  class={clsx(
11115
11689
  u`
@@ -11135,6 +11709,7 @@ var Devtools = (props) => {
11135
11709
  `,
11136
11710
  "tsqd-transitions-container"
11137
11711
  )}
11712
+ ref={transitionsContainerRef}
11138
11713
  >
11139
11714
  <TransitionGroup name="tsqd-panel-transition"><Show when={isOpen()}><DevtoolsPanel
11140
11715
  localStore={props.localStore}
@@ -11160,37 +11735,9 @@ var DevtoolsPanel = (props) => {
11160
11735
  return theme() === "dark" ? darkStyles2 : lightStyles2;
11161
11736
  });
11162
11737
  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
11738
  const position = createMemo(
11169
11739
  () => props.localStore.position || useQueryDevtoolsContext().position || POSITION
11170
11740
  );
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
11741
  const handleDragStart = (event) => {
11195
11742
  const panelElement = event.currentTarget.parentElement;
11196
11743
  if (!panelElement)
@@ -11235,8 +11782,6 @@ var DevtoolsPanel = (props) => {
11235
11782
  document.addEventListener("mousemove", runDrag, false);
11236
11783
  document.addEventListener("mouseup", unsub, false);
11237
11784
  };
11238
- setupQueryCacheSubscription();
11239
- let queriesContainerRef;
11240
11785
  let panelRef;
11241
11786
  onMount(() => {
11242
11787
  createResizeObserver(panelRef, ({ width }, el) => {
@@ -11245,9 +11790,6 @@ var DevtoolsPanel = (props) => {
11245
11790
  }
11246
11791
  });
11247
11792
  });
11248
- const setDevtoolsPosition = (pos) => {
11249
- props.setLocalStore("position", pos);
11250
- };
11251
11793
  createEffect(() => {
11252
11794
  const rootContainer = panelRef.parentElement?.parentElement?.parentElement;
11253
11795
  if (!rootContainer)
@@ -11325,46 +11867,156 @@ var DevtoolsPanel = (props) => {
11325
11867
  )}
11326
11868
  onClick={() => props.setLocalStore("open", "false")}
11327
11869
  ><ChevronDown /></button>
11870
+ <ContentView
11871
+ localStore={props.localStore}
11872
+ setLocalStore={props.setLocalStore}
11873
+ />
11874
+ </aside>;
11875
+ };
11876
+ var ContentView = (props) => {
11877
+ setupQueryCacheSubscription();
11878
+ setupMutationCacheSubscription();
11879
+ let containerRef;
11880
+ const theme = useTheme();
11881
+ const styles = createMemo(() => {
11882
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
11883
+ });
11884
+ const [selectedView, setSelectedView] = createSignal(
11885
+ "queries"
11886
+ );
11887
+ const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
11888
+ const sortOrder = createMemo(
11889
+ () => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
11890
+ );
11891
+ const mutationSort = createMemo(
11892
+ () => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME
11893
+ );
11894
+ const mutationSortOrder = createMemo(
11895
+ () => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER
11896
+ );
11897
+ const [offline, setOffline] = createSignal(false);
11898
+ const sortFn = createMemo(() => sortFns[sort()]);
11899
+ const mutationSortFn = createMemo(
11900
+ () => mutationSortFns[mutationSort()]
11901
+ );
11902
+ const onlineManager = createMemo(
11903
+ () => useQueryDevtoolsContext().onlineManager
11904
+ );
11905
+ const query_cache = createMemo(() => {
11906
+ return useQueryDevtoolsContext().client.getQueryCache();
11907
+ });
11908
+ const mutation_cache = createMemo(() => {
11909
+ return useQueryDevtoolsContext().client.getMutationCache();
11910
+ });
11911
+ const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
11912
+ return queryCache().getAll().length;
11913
+ }, false);
11914
+ const queries = createMemo(
11915
+ on(
11916
+ () => [queryCount(), props.localStore.filter, sort(), sortOrder()],
11917
+ () => {
11918
+ const curr = query_cache().getAll();
11919
+ const filtered = props.localStore.filter ? curr.filter(
11920
+ (item) => rankItem(item.queryHash, props.localStore.filter || "").passed
11921
+ ) : [...curr];
11922
+ const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
11923
+ return sorted;
11924
+ }
11925
+ )
11926
+ );
11927
+ const mutationCount = createSubscribeToMutationCacheBatcher(
11928
+ (mutationCache) => {
11929
+ return mutationCache().getAll().length;
11930
+ },
11931
+ false
11932
+ );
11933
+ const mutations = createMemo(
11934
+ on(
11935
+ () => [
11936
+ mutationCount(),
11937
+ props.localStore.mutationFilter,
11938
+ mutationSort(),
11939
+ mutationSortOrder()
11940
+ ],
11941
+ () => {
11942
+ const curr = mutation_cache().getAll();
11943
+ const filtered = props.localStore.mutationFilter ? curr.filter((item) => {
11944
+ const value = `${item.options.mutationKey ? JSON.stringify(item.options.mutationKey) + " - " : ""}${new Date(item.state.submittedAt).toLocaleString()}`;
11945
+ return rankItem(value, props.localStore.mutationFilter || "").passed;
11946
+ }) : [...curr];
11947
+ const sorted = mutationSortFn() ? filtered.sort(
11948
+ (a2, b2) => mutationSortFn()(a2, b2) * mutationSortOrder()
11949
+ ) : filtered;
11950
+ return sorted;
11951
+ }
11952
+ )
11953
+ );
11954
+ const setDevtoolsPosition = (pos) => {
11955
+ props.setLocalStore("position", pos);
11956
+ };
11957
+ const setComputedVariables = (el) => {
11958
+ const computedStyle = getComputedStyle(containerRef);
11959
+ const variable = computedStyle.getPropertyValue("--tsqd-font-size");
11960
+ el.style.setProperty("--tsqd-font-size", variable);
11961
+ };
11962
+ return <>
11328
11963
  <div
11329
- ref={queriesContainerRef}
11330
11964
  class={clsx(
11331
11965
  styles().queriesContainer,
11332
- panelWidth() < secondBreakpoint && selectedQueryHash() && u`
11966
+ panelWidth() < secondBreakpoint && (selectedQueryHash() || selectedMutationId()) && u`
11333
11967
  height: 50%;
11334
11968
  max-height: 50%;
11335
11969
  `,
11336
11970
  "tsqd-queries-container"
11337
11971
  )}
11972
+ ref={containerRef}
11338
11973
  >
11339
11974
  <div class={clsx(styles().row, "tsqd-header")}>
11340
- <button
11341
- class={clsx(styles().logo, "tsqd-text-logo-container")}
11342
- onClick={() => props.setLocalStore("open", "false")}
11343
- aria-label="Close Tanstack query devtools"
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
- )}
11975
+ <div class={styles().logoAndToggleContainer}>
11976
+ <button
11977
+ class={clsx(styles().logo, "tsqd-text-logo-container")}
11978
+ onClick={() => props.setLocalStore("open", "false")}
11979
+ aria-label="Close Tanstack query devtools"
11351
11980
  >
11352
- {useQueryDevtoolsContext().queryFlavor}
11353
- {" v"}
11354
- {useQueryDevtoolsContext().version}
11355
- </span>
11356
- </button>
11357
- <QueryStatusCount />
11981
+ <span
11982
+ class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}
11983
+ >TANSTACK</span>
11984
+ <span
11985
+ class={clsx(
11986
+ styles().queryFlavorLogo,
11987
+ "tsqd-text-logo-query-flavor"
11988
+ )}
11989
+ >
11990
+ {useQueryDevtoolsContext().queryFlavor}
11991
+ {" v"}
11992
+ {useQueryDevtoolsContext().version}
11993
+ </span>
11994
+ </button>
11995
+ <index$7.Root
11996
+ class={clsx(styles().viewToggle)}
11997
+ value={selectedView()}
11998
+ onChange={(value) => {
11999
+ setSelectedView(value);
12000
+ setSelectedQueryHash(null);
12001
+ setSelectedMutationId(null);
12002
+ }}
12003
+ >
12004
+ <index$7.Item value="queries" class="tsqd-radio-toggle">
12005
+ <index$7.ItemInput />
12006
+ <index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
12007
+ <index$7.ItemLabel title="Toggle Queries View">Queries</index$7.ItemLabel>
12008
+ </index$7.Item>
12009
+ <index$7.Item value="mutations" class="tsqd-radio-toggle">
12010
+ <index$7.ItemInput />
12011
+ <index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
12012
+ <index$7.ItemLabel title="Toggle Mutations View">Mutations</index$7.ItemLabel>
12013
+ </index$7.Item>
12014
+ </index$7.Root>
12015
+ </div>
12016
+ <Show when={selectedView() === "queries"}><QueryStatusCount /></Show>
12017
+ <Show when={selectedView() === "mutations"}><MutationStatusCount /></Show>
11358
12018
  </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
- >
12019
+ <div class={clsx(styles().row, "tsqd-filters-actions-container")}>
11368
12020
  <div class={clsx(styles().filtersContainer, "tsqd-filters-container")}>
11369
12021
  <div
11370
12022
  class={clsx(
@@ -11377,9 +12029,15 @@ var DevtoolsPanel = (props) => {
11377
12029
  aria-label="Filter queries by query key"
11378
12030
  type="text"
11379
12031
  placeholder="Filter"
11380
- onInput={(e2) => props.setLocalStore("filter", e2.currentTarget.value)}
12032
+ onInput={(e2) => {
12033
+ if (selectedView() === "queries") {
12034
+ props.setLocalStore("filter", e2.currentTarget.value);
12035
+ } else {
12036
+ props.setLocalStore("mutationFilter", e2.currentTarget.value);
12037
+ }
12038
+ }}
11381
12039
  class="tsqd-query-filter-textfield"
11382
- value={props.localStore.filter || ""}
12040
+ value={selectedView() === "queries" ? props.localStore.filter || "" : props.localStore.mutationFilter || ""}
11383
12041
  />
11384
12042
  </div>
11385
12043
  <div
@@ -11388,28 +12046,50 @@ var DevtoolsPanel = (props) => {
11388
12046
  "tsqd-query-filter-sort-container"
11389
12047
  )}
11390
12048
  >
11391
- <select
12049
+ <Show when={selectedView() === "queries"}><select
11392
12050
  value={sort()}
11393
- onChange={(e2) => props.setLocalStore("sort", e2.currentTarget.value)}
12051
+ onChange={(e2) => {
12052
+ props.setLocalStore("sort", e2.currentTarget.value);
12053
+ }}
11394
12054
  >{Object.keys(sortFns).map((key) => <option value={key}>
11395
12055
  {"Sort by "}
11396
12056
  {key}
11397
- </option>)}</select>
12057
+ </option>)}</select></Show>
12058
+ <Show when={selectedView() === "mutations"}><select
12059
+ value={mutationSort()}
12060
+ onChange={(e2) => {
12061
+ props.setLocalStore("mutationSort", e2.currentTarget.value);
12062
+ }}
12063
+ >{Object.keys(mutationSortFns).map((key) => <option value={key}>
12064
+ {"Sort by "}
12065
+ {key}
12066
+ </option>)}</select></Show>
11398
12067
  <ChevronDown />
11399
12068
  </div>
11400
12069
  <button
11401
12070
  onClick={() => {
11402
- props.setLocalStore("sortOrder", String(sortOrder() * -1));
12071
+ if (selectedView() === "queries") {
12072
+ props.setLocalStore("sortOrder", String(sortOrder() * -1));
12073
+ } else {
12074
+ props.setLocalStore(
12075
+ "mutationSortOrder",
12076
+ String(mutationSortOrder() * -1)
12077
+ );
12078
+ }
11403
12079
  }}
11404
- aria-label={`Sort order ${sortOrder() === -1 ? "descending" : "ascending"}`}
11405
- aria-pressed={sortOrder() === -1}
12080
+ aria-label={`Sort order ${(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1 ? "descending" : "ascending"}`}
12081
+ aria-pressed={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
11406
12082
  class="tsqd-query-filter-sort-order-btn"
11407
12083
  >
11408
- <Show when={sortOrder() === 1}>
12084
+ <Show
12085
+ when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === 1}
12086
+ >
11409
12087
  <span>Asc</span>
11410
12088
  <ArrowUp />
11411
12089
  </Show>
11412
- <Show when={sortOrder() === -1}>
12090
+ <Show
12091
+ when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
12092
+ >
11413
12093
  <span>Desc</span>
11414
12094
  <ArrowDown />
11415
12095
  </Show>
@@ -11418,7 +12098,11 @@ var DevtoolsPanel = (props) => {
11418
12098
  <div class={clsx(styles().actionsContainer, "tsqd-actions-container")}>
11419
12099
  <button
11420
12100
  onClick={() => {
11421
- cache().clear();
12101
+ if (selectedView() === "queries") {
12102
+ query_cache().clear();
12103
+ } else {
12104
+ mutation_cache().clear();
12105
+ }
11422
12106
  }}
11423
12107
  class={clsx(
11424
12108
  styles().actionsBtn,
@@ -11426,7 +12110,7 @@ var DevtoolsPanel = (props) => {
11426
12110
  "tsqd-action-clear-cache"
11427
12111
  )}
11428
12112
  aria-label="Clear query cache"
11429
- title="Clear query cache"
12113
+ title={`Clear ${selectedView()} cache`}
11430
12114
  ><Trash /></button>
11431
12115
  <button
11432
12116
  onClick={() => {
@@ -11456,7 +12140,9 @@ var DevtoolsPanel = (props) => {
11456
12140
  "tsqd-action-settings"
11457
12141
  )}
11458
12142
  ><Settings /></index$d.Trigger>
11459
- <index$d.Portal><index$d.Content
12143
+ <index$d.Portal
12144
+ ref={(el) => setComputedVariables(el)}
12145
+ ><index$d.Content
11460
12146
  class={clsx(styles().settingsMenu, "tsqd-settings-menu")}
11461
12147
  >
11462
12148
  <div
@@ -11476,7 +12162,9 @@ var DevtoolsPanel = (props) => {
11476
12162
  <span>Position</span>
11477
12163
  <ChevronDown />
11478
12164
  </index$d.SubTrigger>
11479
- <index$d.Portal><index$d.SubContent
12165
+ <index$d.Portal
12166
+ ref={(el) => setComputedVariables(el)}
12167
+ ><index$d.SubContent
11480
12168
  class={clsx(
11481
12169
  styles().settingsMenu,
11482
12170
  "tsqd-settings-submenu"
@@ -11551,7 +12239,9 @@ var DevtoolsPanel = (props) => {
11551
12239
  <span>Theme</span>
11552
12240
  <ChevronDown />
11553
12241
  </index$d.SubTrigger>
11554
- <index$d.Portal><index$d.SubContent
12242
+ <index$d.Portal
12243
+ ref={(el) => setComputedVariables(el)}
12244
+ ><index$d.SubContent
11555
12245
  class={clsx(
11556
12246
  styles().settingsMenu,
11557
12247
  "tsqd-settings-submenu"
@@ -11608,15 +12298,22 @@ var DevtoolsPanel = (props) => {
11608
12298
  </index$d.Root>
11609
12299
  </div>
11610
12300
  </div>
11611
- <div
12301
+ <Show when={selectedView() === "queries"}><div
11612
12302
  class={clsx(
11613
12303
  styles().overflowQueryContainer,
11614
12304
  "tsqd-queries-overflow-container"
11615
12305
  )}
11616
- ><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div>
12306
+ ><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div></Show>
12307
+ <Show when={selectedView() === "mutations"}><div
12308
+ class={clsx(
12309
+ styles().overflowQueryContainer,
12310
+ "tsqd-mutations-overflow-container"
12311
+ )}
12312
+ ><div class="tsqd-mutations-container"><Key by={(m) => m.mutationId} each={mutations()}>{(mutation) => <MutationRow mutation={mutation()} />}</Key></div></div></Show>
11617
12313
  </div>
11618
- <Show when={selectedQueryHash()}><QueryDetails /></Show>
11619
- </aside>;
12314
+ <Show when={selectedView() === "queries" && selectedQueryHash()}><QueryDetails /></Show>
12315
+ <Show when={selectedView() === "mutations" && selectedMutationId()}><MutationDetails /></Show>
12316
+ </>;
11620
12317
  };
11621
12318
  var QueryRow = (props) => {
11622
12319
  const theme = useTheme();
@@ -11685,6 +12382,94 @@ var QueryRow = (props) => {
11685
12382
  <Show when={isDisabled()}><div class="tsqd-query-disabled-indicator">disabled</div></Show>
11686
12383
  </button></Show>;
11687
12384
  };
12385
+ var MutationRow = (props) => {
12386
+ const theme = useTheme();
12387
+ const styles = createMemo(() => {
12388
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12389
+ });
12390
+ const { colors, alpha } = tokens;
12391
+ const t2 = (light, dark) => theme() === "dark" ? dark : light;
12392
+ const mutationState = createSubscribeToMutationCacheBatcher(
12393
+ (mutationCache) => {
12394
+ const mutations = mutationCache().getAll();
12395
+ const mutation = mutations.find(
12396
+ (m) => m.mutationId === props.mutation.mutationId
12397
+ );
12398
+ return mutation?.state;
12399
+ }
12400
+ );
12401
+ const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
12402
+ const mutations = mutationCache().getAll();
12403
+ const mutation = mutations.find(
12404
+ (m) => m.mutationId === props.mutation.mutationId
12405
+ );
12406
+ if (!mutation)
12407
+ return false;
12408
+ return mutation.state.isPaused;
12409
+ });
12410
+ const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
12411
+ const mutations = mutationCache().getAll();
12412
+ const mutation = mutations.find(
12413
+ (m) => m.mutationId === props.mutation.mutationId
12414
+ );
12415
+ if (!mutation)
12416
+ return "idle";
12417
+ return mutation.state.status;
12418
+ });
12419
+ const color = createMemo(
12420
+ () => getMutationStatusColor({
12421
+ isPaused: isPaused(),
12422
+ status: status()
12423
+ })
12424
+ );
12425
+ const getObserverCountColorStyles = () => {
12426
+ if (color() === "gray") {
12427
+ return u`
12428
+ background-color: ${t2(colors[color()][200], colors[color()][700])};
12429
+ color: ${t2(colors[color()][700], colors[color()][300])};
12430
+ `;
12431
+ }
12432
+ return u`
12433
+ background-color: ${t2(
12434
+ colors[color()][200] + alpha[80],
12435
+ colors[color()][900]
12436
+ )};
12437
+ color: ${t2(colors[color()][800], colors[color()][300])};
12438
+ `;
12439
+ };
12440
+ return <Show when={mutationState()}><button
12441
+ onClick={() => {
12442
+ setSelectedMutationId(
12443
+ props.mutation.mutationId === selectedMutationId() ? null : props.mutation.mutationId
12444
+ );
12445
+ }}
12446
+ class={clsx(
12447
+ styles().queryRow,
12448
+ selectedMutationId() === props.mutation.mutationId && styles().selectedQueryRow,
12449
+ "tsqd-query-row"
12450
+ )}
12451
+ aria-label={`Mutation submitted at ${new Date(
12452
+ props.mutation.state.submittedAt
12453
+ ).toLocaleString()}`}
12454
+ >
12455
+ <div
12456
+ class={clsx(getObserverCountColorStyles(), "tsqd-query-observer-count")}
12457
+ >
12458
+ <Show when={color() === "purple"}><PauseCircle /></Show>
12459
+ <Show when={color() === "green"}><CheckCircle /></Show>
12460
+ <Show when={color() === "red"}><XCircle /></Show>
12461
+ <Show when={color() === "yellow"}><LoadingCircle /></Show>
12462
+ </div>
12463
+ <code class="tsqd-query-hash">
12464
+ <Show when={props.mutation.options.mutationKey}>
12465
+ {JSON.stringify(props.mutation.options.mutationKey)}
12466
+ {" -"}
12467
+ {" "}
12468
+ </Show>
12469
+ {new Date(props.mutation.state.submittedAt).toLocaleString()}
12470
+ </code>
12471
+ </button></Show>;
12472
+ };
11688
12473
  var QueryStatusCount = () => {
11689
12474
  const stale = createSubscribeToQueryCacheBatcher(
11690
12475
  (queryCache) => queryCache().getAll().filter((q) => getQueryStatusLabel(q) === "stale").length
@@ -11715,6 +12500,52 @@ var QueryStatusCount = () => {
11715
12500
  <QueryStatus label="Inactive" color="gray" count={inactive()} />
11716
12501
  </div>;
11717
12502
  };
12503
+ var MutationStatusCount = () => {
12504
+ const success = createSubscribeToMutationCacheBatcher(
12505
+ (mutationCache) => mutationCache().getAll().filter(
12506
+ (m) => getMutationStatusColor({
12507
+ isPaused: m.state.isPaused,
12508
+ status: m.state.status
12509
+ }) === "green"
12510
+ ).length
12511
+ );
12512
+ const pending = createSubscribeToMutationCacheBatcher(
12513
+ (mutationCache) => mutationCache().getAll().filter(
12514
+ (m) => getMutationStatusColor({
12515
+ isPaused: m.state.isPaused,
12516
+ status: m.state.status
12517
+ }) === "yellow"
12518
+ ).length
12519
+ );
12520
+ const paused = createSubscribeToMutationCacheBatcher(
12521
+ (mutationCache) => mutationCache().getAll().filter(
12522
+ (m) => getMutationStatusColor({
12523
+ isPaused: m.state.isPaused,
12524
+ status: m.state.status
12525
+ }) === "purple"
12526
+ ).length
12527
+ );
12528
+ const error = createSubscribeToMutationCacheBatcher(
12529
+ (mutationCache) => mutationCache().getAll().filter(
12530
+ (m) => getMutationStatusColor({
12531
+ isPaused: m.state.isPaused,
12532
+ status: m.state.status
12533
+ }) === "red"
12534
+ ).length
12535
+ );
12536
+ const theme = useTheme();
12537
+ const styles = createMemo(() => {
12538
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12539
+ });
12540
+ return <div
12541
+ class={clsx(styles().queryStatusContainer, "tsqd-query-status-container")}
12542
+ >
12543
+ <QueryStatus label="Paused" color="purple" count={paused()} />
12544
+ <QueryStatus label="Pending" color="yellow" count={pending()} />
12545
+ <QueryStatus label="Success" color="green" count={success()} />
12546
+ <QueryStatus label="Error" color="red" count={error()} />
12547
+ </div>;
12548
+ };
11718
12549
  var QueryStatus = (props) => {
11719
12550
  const theme = useTheme();
11720
12551
  const styles = createMemo(() => {
@@ -12100,7 +12931,7 @@ var QueryDetails = () => {
12100
12931
  <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
12101
12932
  <div
12102
12933
  style={{
12103
- padding: "0.5rem"
12934
+ padding: tokens.size[2]
12104
12935
  }}
12105
12936
  class="tsqd-query-details-explorer-container tsqd-query-details-data-explorer"
12106
12937
  ><Explorer
@@ -12113,7 +12944,7 @@ var QueryDetails = () => {
12113
12944
  <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Query Explorer</div>
12114
12945
  <div
12115
12946
  style={{
12116
- padding: "0.5rem"
12947
+ padding: tokens.size[2]
12117
12948
  }}
12118
12949
  class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
12119
12950
  ><Explorer
@@ -12123,21 +12954,145 @@ var QueryDetails = () => {
12123
12954
  /></div>
12124
12955
  </div></Show>;
12125
12956
  };
12126
- var signalsMap = /* @__PURE__ */ new Map();
12957
+ var MutationDetails = () => {
12958
+ const theme = useTheme();
12959
+ const styles = createMemo(() => {
12960
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12961
+ });
12962
+ const { colors } = tokens;
12963
+ const t2 = (light, dark) => theme() === "dark" ? dark : light;
12964
+ const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
12965
+ const mutations = mutationCache().getAll();
12966
+ const mutation = mutations.find(
12967
+ (m) => m.mutationId === selectedMutationId()
12968
+ );
12969
+ if (!mutation)
12970
+ return false;
12971
+ return mutation.state.isPaused;
12972
+ });
12973
+ const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
12974
+ const mutations = mutationCache().getAll();
12975
+ const mutation = mutations.find(
12976
+ (m) => m.mutationId === selectedMutationId()
12977
+ );
12978
+ if (!mutation)
12979
+ return "idle";
12980
+ return mutation.state.status;
12981
+ });
12982
+ const color = createMemo(
12983
+ () => getMutationStatusColor({
12984
+ isPaused: isPaused(),
12985
+ status: status()
12986
+ })
12987
+ );
12988
+ const activeMutation = createSubscribeToMutationCacheBatcher(
12989
+ (mutationCache) => mutationCache().getAll().find((mutation) => mutation.mutationId === selectedMutationId()),
12990
+ false
12991
+ );
12992
+ const getQueryStatusColors = () => {
12993
+ if (color() === "gray") {
12994
+ return u`
12995
+ background-color: ${t2(colors[color()][200], colors[color()][700])};
12996
+ color: ${t2(colors[color()][700], colors[color()][300])};
12997
+ border-color: ${t2(colors[color()][400], colors[color()][600])};
12998
+ `;
12999
+ }
13000
+ return u`
13001
+ background-color: ${t2(colors[color()][100], colors[color()][900])};
13002
+ color: ${t2(colors[color()][700], colors[color()][300])};
13003
+ border-color: ${t2(colors[color()][400], colors[color()][600])};
13004
+ `;
13005
+ };
13006
+ return <Show when={activeMutation()}><div
13007
+ class={clsx(styles().detailsContainer, "tsqd-query-details-container")}
13008
+ >
13009
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutation Details</div>
13010
+ <div
13011
+ class={clsx(
13012
+ styles().detailsBody,
13013
+ "tsqd-query-details-summary-container"
13014
+ )}
13015
+ >
13016
+ <div class="tsqd-query-details-summary">
13017
+ <pre><code><Show
13018
+ when={activeMutation().options.mutationKey}
13019
+ fallback="No mutationKey found"
13020
+ >{displayValue(activeMutation().options.mutationKey, true)}</Show></code></pre>
13021
+ <span
13022
+ class={clsx(styles().queryDetailsStatus, getQueryStatusColors())}
13023
+ >
13024
+ <Show when={color() === "purple"}>pending</Show>
13025
+ <Show when={color() !== "purple"}>{status()}</Show>
13026
+ </span>
13027
+ </div>
13028
+ <div class="tsqd-query-details-last-updated">
13029
+ <span>Submitted At:</span>
13030
+ <span>{new Date(
13031
+ activeMutation().state.submittedAt
13032
+ ).toLocaleTimeString()}</span>
13033
+ </div>
13034
+ </div>
13035
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Variables Details</div>
13036
+ <div
13037
+ style={{
13038
+ padding: tokens.size[2]
13039
+ }}
13040
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13041
+ ><Explorer
13042
+ label="Variables"
13043
+ defaultExpanded={["Variables"]}
13044
+ value={activeMutation().state.variables}
13045
+ /></div>
13046
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Context Details</div>
13047
+ <div
13048
+ style={{
13049
+ padding: tokens.size[2]
13050
+ }}
13051
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13052
+ ><Explorer
13053
+ label="Context"
13054
+ defaultExpanded={["Context"]}
13055
+ value={activeMutation().state.context}
13056
+ /></div>
13057
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
13058
+ <div
13059
+ style={{
13060
+ padding: tokens.size[2]
13061
+ }}
13062
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13063
+ ><Explorer
13064
+ label="Data"
13065
+ defaultExpanded={["Data"]}
13066
+ value={activeMutation().state.data}
13067
+ /></div>
13068
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutations Explorer</div>
13069
+ <div
13070
+ style={{
13071
+ padding: tokens.size[2]
13072
+ }}
13073
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13074
+ ><Explorer
13075
+ label="Mutation"
13076
+ defaultExpanded={["Mutation"]}
13077
+ value={activeMutation()}
13078
+ /></div>
13079
+ </div></Show>;
13080
+ };
13081
+ var queryCacheMap = /* @__PURE__ */ new Map();
12127
13082
  var setupQueryCacheSubscription = () => {
12128
13083
  const queryCache = createMemo(() => {
12129
13084
  const client = useQueryDevtoolsContext().client;
12130
13085
  return client.getQueryCache();
12131
13086
  });
12132
13087
  const unsub = queryCache().subscribe(() => {
12133
- for (const [callback, setter] of signalsMap.entries()) {
13088
+ for (const [callback, setter] of queryCacheMap.entries()) {
12134
13089
  queueMicrotask(() => {
12135
13090
  setter(callback(queryCache));
12136
13091
  });
12137
13092
  }
12138
13093
  });
12139
13094
  onCleanup(() => {
12140
- signalsMap.clear();
13095
+ queryCacheMap.clear();
12141
13096
  unsub();
12142
13097
  });
12143
13098
  return unsub;
@@ -12154,9 +13109,46 @@ var createSubscribeToQueryCacheBatcher = (callback, equalityCheck = true) => {
12154
13109
  createEffect(() => {
12155
13110
  setValue(callback(queryCache));
12156
13111
  });
12157
- signalsMap.set(callback, setValue);
13112
+ queryCacheMap.set(callback, setValue);
13113
+ onCleanup(() => {
13114
+ queryCacheMap.delete(callback);
13115
+ });
13116
+ return value;
13117
+ };
13118
+ var mutationCacheMap = /* @__PURE__ */ new Map();
13119
+ var setupMutationCacheSubscription = () => {
13120
+ const mutationCache = createMemo(() => {
13121
+ const client = useQueryDevtoolsContext().client;
13122
+ return client.getMutationCache();
13123
+ });
13124
+ const unsub = mutationCache().subscribe(() => {
13125
+ for (const [callback, setter] of mutationCacheMap.entries()) {
13126
+ queueMicrotask(() => {
13127
+ setter(callback(mutationCache));
13128
+ });
13129
+ }
13130
+ });
13131
+ onCleanup(() => {
13132
+ mutationCacheMap.clear();
13133
+ unsub();
13134
+ });
13135
+ return unsub;
13136
+ };
13137
+ var createSubscribeToMutationCacheBatcher = (callback, equalityCheck = true) => {
13138
+ const mutationCache = createMemo(() => {
13139
+ const client = useQueryDevtoolsContext().client;
13140
+ return client.getMutationCache();
13141
+ });
13142
+ const [value, setValue] = createSignal(
13143
+ callback(mutationCache),
13144
+ !equalityCheck ? { equals: false } : void 0
13145
+ );
13146
+ createEffect(() => {
13147
+ setValue(callback(mutationCache));
13148
+ });
13149
+ mutationCacheMap.set(callback, setValue);
12158
13150
  onCleanup(() => {
12159
- signalsMap.delete(callback);
13151
+ mutationCacheMap.delete(callback);
12160
13152
  });
12161
13153
  return value;
12162
13154
  };
@@ -12249,7 +13241,7 @@ var stylesFactory2 = (theme) => {
12249
13241
  right: 0;
12250
13242
  left: 0;
12251
13243
  max-height: 90%;
12252
- min-height: 3.5rem;
13244
+ min-height: ${size2[14]};
12253
13245
  border-bottom: ${t2(colors.gray[400], colors.darkGray[300])} 1px solid;
12254
13246
  `,
12255
13247
  "panel-position-bottom": u`
@@ -12257,7 +13249,7 @@ var stylesFactory2 = (theme) => {
12257
13249
  right: 0;
12258
13250
  left: 0;
12259
13251
  max-height: 90%;
12260
- min-height: 3.5rem;
13252
+ min-height: ${size2[14]};
12261
13253
  border-top: ${t2(colors.gray[400], colors.darkGray[300])} 1px solid;
12262
13254
  `,
12263
13255
  "panel-position-right": u`
@@ -12431,7 +13423,7 @@ var stylesFactory2 = (theme) => {
12431
13423
  justify-content: space-between;
12432
13424
  align-items: center;
12433
13425
  padding: ${tokens.size[2]} ${tokens.size[2.5]};
12434
- gap: ${tokens.size[3]};
13426
+ gap: ${tokens.size[2.5]};
12435
13427
  border-bottom: ${t2(colors.gray[300], colors.darkGray[500])} 1px solid;
12436
13428
  align-items: center;
12437
13429
  & > button {
@@ -12443,8 +13435,19 @@ var stylesFactory2 = (theme) => {
12443
13435
  flex-direction: column;
12444
13436
  }
12445
13437
  `,
13438
+ logoAndToggleContainer: u`
13439
+ display: flex;
13440
+ gap: ${tokens.size[3]};
13441
+ align-items: center;
13442
+ `,
12446
13443
  logo: u`
12447
13444
  cursor: pointer;
13445
+ display: flex;
13446
+ flex-direction: column;
13447
+ background-color: transparent;
13448
+ border: none;
13449
+ gap: ${tokens.size[0.5]};
13450
+ padding: 0px;
12448
13451
  &:hover {
12449
13452
  opacity: 0.7;
12450
13453
  }
@@ -12578,6 +13581,8 @@ var stylesFactory2 = (theme) => {
12578
13581
  outline: 2px solid ${colors.blue[800]};
12579
13582
  }
12580
13583
  & svg {
13584
+ width: ${tokens.size[3]};
13585
+ height: ${tokens.size[3]};
12581
13586
  color: ${t2(colors.gray[500], colors.gray[400])};
12582
13587
  }
12583
13588
  }
@@ -12663,8 +13668,8 @@ var stylesFactory2 = (theme) => {
12663
13668
  border-radius: ${tokens.border.radius.sm};
12664
13669
  background-color: ${t2(colors.gray[100], colors.darkGray[400])};
12665
13670
  border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
12666
- width: 1.625rem;
12667
- height: 1.625rem;
13671
+ width: ${tokens.size[6.5]};
13672
+ height: ${tokens.size[6.5]};
12668
13673
  justify-content: center;
12669
13674
  display: flex;
12670
13675
  align-items: center;
@@ -12816,6 +13821,8 @@ var stylesFactory2 = (theme) => {
12816
13821
 
12817
13822
  & pre {
12818
13823
  margin: 0;
13824
+ display: flex;
13825
+ align-items: center;
12819
13826
  }
12820
13827
  `,
12821
13828
  queryDetailsStatus: u`
@@ -12995,6 +14002,56 @@ var stylesFactory2 = (theme) => {
12995
14002
  &:hover {
12996
14003
  background-color: ${t2(colors.purple[100], colors.purple[900])};
12997
14004
  }
14005
+ `,
14006
+ viewToggle: u`
14007
+ border-radius: ${tokens.border.radius.sm};
14008
+ background-color: ${t2(colors.gray[200], colors.darkGray[600])};
14009
+ border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
14010
+ display: flex;
14011
+ padding: 0;
14012
+ font-size: ${font.size.xs};
14013
+ color: ${t2(colors.gray[700], colors.gray[300])};
14014
+ overflow: hidden;
14015
+
14016
+ &:has(:focus-visible) {
14017
+ outline: 2px solid ${colors.blue[800]};
14018
+ }
14019
+
14020
+ & .tsqd-radio-toggle {
14021
+ opacity: 0.5;
14022
+ display: flex;
14023
+ & label {
14024
+ display: flex;
14025
+ align-items: center;
14026
+ cursor: pointer;
14027
+ line-height: ${font.lineHeight.md};
14028
+ }
14029
+
14030
+ & label:hover {
14031
+ background-color: ${t2(colors.gray[100], colors.darkGray[500])};
14032
+ }
14033
+ }
14034
+
14035
+ & > [data-checked] {
14036
+ opacity: 1;
14037
+ background-color: ${t2(colors.gray[100], colors.darkGray[400])};
14038
+ & label:hover {
14039
+ background-color: ${t2(colors.gray[100], colors.darkGray[400])};
14040
+ }
14041
+ }
14042
+
14043
+ & .tsqd-radio-toggle:first-child {
14044
+ & label {
14045
+ padding: 0 ${tokens.size[1.5]} 0 ${tokens.size[2]};
14046
+ }
14047
+ border-right: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
14048
+ }
14049
+
14050
+ & .tsqd-radio-toggle:nth-child(2) {
14051
+ & label {
14052
+ padding: 0 ${tokens.size[2]} 0 ${tokens.size[1.5]};
14053
+ }
14054
+ }
12998
14055
  `
12999
14056
  };
13000
14057
  };
@@ -13004,6 +14061,8 @@ export {
13004
14061
  Devtools,
13005
14062
  DevtoolsComponent,
13006
14063
  DevtoolsPanel,
14064
+ MutationRow,
14065
+ MutationStatusCount,
13007
14066
  QueryRow,
13008
14067
  QueryStatus,
13009
14068
  QueryStatusCount,
@@ -13215,8 +14274,6 @@ export {
13215
14274
  * Credits to the zag team:
13216
14275
  * https://github.com/chakra-ui/zag/blob/c1e6c7689b22bf58741ded7cf224dd9baec2a046/packages/utilities/form-utils/src/form.ts
13217
14276
  *)
13218
-
13219
- @kobalte/core/dist/esm/index.js:
13220
14277
  (*!
13221
14278
  * Portions of this file are based on code from react-spectrum.
13222
14279
  * Apache License Version 2.0, Copyright 2020 Adobe.