@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: {
@@ -9447,6 +9915,12 @@ function getQueryStatusColor({
9447
9915
  }) {
9448
9916
  return queryState.fetchStatus === "fetching" ? "blue" : !observerCount ? "gray" : queryState.fetchStatus === "paused" ? "purple" : isStale ? "yellow" : "green";
9449
9917
  }
9918
+ function getMutationStatusColor({
9919
+ status,
9920
+ isPaused
9921
+ }) {
9922
+ return isPaused ? "purple" : status === "error" ? "red" : status === "pending" ? "yellow" : status === "success" ? "green" : "gray";
9923
+ }
9450
9924
  function getQueryStatusColorByLabel(label) {
9451
9925
  return label === "fresh" ? "green" : label === "stale" ? "yellow" : label === "paused" ? "purple" : label === "inactive" ? "gray" : "blue";
9452
9926
  }
@@ -9468,6 +9942,18 @@ var sortFns = {
9468
9942
  "query hash": queryHashSort,
9469
9943
  "last updated": dateSort
9470
9944
  };
9945
+ var getMutationStatusRank = (m) => m.state.isPaused ? 0 : m.state.status === "error" ? 2 : m.state.status === "pending" ? 1 : 3;
9946
+ var mutationDateSort = (a2, b2) => a2.state.submittedAt < b2.state.submittedAt ? 1 : -1;
9947
+ var mutationStatusSort = (a2, b2) => {
9948
+ if (getMutationStatusRank(a2) === getMutationStatusRank(b2)) {
9949
+ return mutationDateSort(a2, b2);
9950
+ }
9951
+ return getMutationStatusRank(a2) > getMutationStatusRank(b2) ? 1 : -1;
9952
+ };
9953
+ var mutationSortFns = {
9954
+ status: mutationStatusSort,
9955
+ "last updated": mutationDateSort
9956
+ };
9471
9957
  var convertRemToPixels = (rem) => {
9472
9958
  return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);
9473
9959
  };
@@ -9867,51 +10353,122 @@ function Check(props) {
9867
10353
  /></svg></Show>
9868
10354
  </>;
9869
10355
  }
9870
- function TanstackLogo() {
9871
- const id = createUniqueId();
9872
- return <svg version="1.0" viewBox="0 0 633 633">
9873
- <linearGradient
9874
- id={`a-${id}`}
9875
- x1="-666.45"
9876
- x2="-666.45"
9877
- y1="163.28"
9878
- y2="163.99"
9879
- gradientTransform="matrix(633 0 0 633 422177 -103358)"
9880
- gradientUnits="userSpaceOnUse"
9881
- >
9882
- <stop stop-color="#6BDAFF" offset="0" />
9883
- <stop stop-color="#F9FFB5" offset=".32" />
9884
- <stop stop-color="#FFA770" offset=".71" />
9885
- <stop stop-color="#FF7373" offset="1" />
9886
- </linearGradient>
9887
- <circle cx="316.5" cy="316.5" r="316.5" fill={`url(#a-${id})`} />
9888
- <defs><filter
9889
- id={`am-${id}`}
9890
- x="-137.5"
9891
- y="412"
9892
- width="454"
9893
- height="396.9"
9894
- filterUnits="userSpaceOnUse"
9895
- ><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" /></filter></defs>
9896
- <mask
9897
- id={`b-${id}`}
9898
- x="-137.5"
9899
- y="412"
9900
- width="454"
9901
- height="396.9"
9902
- maskUnits="userSpaceOnUse"
9903
- ><g filter={`url(#am-${id})`}><circle cx="316.5" cy="316.5" r="316.5" fill="#fff" /></g></mask>
9904
- <g mask={`url(#b-${id})`}><ellipse
9905
- cx="89.5"
9906
- cy="610.5"
9907
- rx="214.5"
9908
- ry="186"
9909
- fill="#015064"
9910
- stroke="#00CFE2"
9911
- stroke-width="25"
9912
- /></g>
9913
- <defs><filter
9914
- id={`ah-${id}`}
10356
+ function CheckCircle() {
10357
+ return <svg
10358
+ width="14"
10359
+ height="14"
10360
+ viewBox="0 0 24 24"
10361
+ fill="none"
10362
+ xmlns="http://www.w3.org/2000/svg"
10363
+ ><path
10364
+ d="M7.5 12L10.5 15L16.5 9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
10365
+ stroke="currentColor"
10366
+ stroke-width="2"
10367
+ stroke-linecap="round"
10368
+ stroke-linejoin="round"
10369
+ /></svg>;
10370
+ }
10371
+ function LoadingCircle() {
10372
+ return <svg
10373
+ width="14"
10374
+ height="14"
10375
+ viewBox="0 0 24 24"
10376
+ fill="none"
10377
+ xmlns="http://www.w3.org/2000/svg"
10378
+ >
10379
+ <path
10380
+ d="M12 2V6M12 18V22M6 12H2M22 12H18M19.0784 19.0784L16.25 16.25M19.0784 4.99994L16.25 7.82837M4.92157 19.0784L7.75 16.25M4.92157 4.99994L7.75 7.82837"
10381
+ stroke="currentColor"
10382
+ stroke-width="2"
10383
+ stroke-linecap="round"
10384
+ stroke-linejoin="round"
10385
+ />
10386
+ <animateTransform
10387
+ attributeName="transform"
10388
+ attributeType="XML"
10389
+ type="rotate"
10390
+ from="0"
10391
+ to="360"
10392
+ dur="2s"
10393
+ repeatCount="indefinite"
10394
+ />
10395
+ </svg>;
10396
+ }
10397
+ function XCircle() {
10398
+ return <svg
10399
+ width="14"
10400
+ height="14"
10401
+ viewBox="0 0 24 24"
10402
+ fill="none"
10403
+ xmlns="http://www.w3.org/2000/svg"
10404
+ ><path
10405
+ d="M15 9L9 15M9 9L15 15M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
10406
+ stroke="currentColor"
10407
+ stroke-width="2"
10408
+ stroke-linecap="round"
10409
+ stroke-linejoin="round"
10410
+ /></svg>;
10411
+ }
10412
+ function PauseCircle() {
10413
+ return <svg
10414
+ width="14"
10415
+ height="14"
10416
+ viewBox="0 0 24 24"
10417
+ fill="none"
10418
+ xmlns="http://www.w3.org/2000/svg"
10419
+ ><path
10420
+ d="M9.5 15V9M14.5 15V9M22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12Z"
10421
+ stroke="currentColor"
10422
+ stroke-width="2"
10423
+ stroke-linecap="round"
10424
+ stroke-linejoin="round"
10425
+ /></svg>;
10426
+ }
10427
+ function TanstackLogo() {
10428
+ const id = createUniqueId();
10429
+ return <svg version="1.0" viewBox="0 0 633 633">
10430
+ <linearGradient
10431
+ id={`a-${id}`}
10432
+ x1="-666.45"
10433
+ x2="-666.45"
10434
+ y1="163.28"
10435
+ y2="163.99"
10436
+ gradientTransform="matrix(633 0 0 633 422177 -103358)"
10437
+ gradientUnits="userSpaceOnUse"
10438
+ >
10439
+ <stop stop-color="#6BDAFF" offset="0" />
10440
+ <stop stop-color="#F9FFB5" offset=".32" />
10441
+ <stop stop-color="#FFA770" offset=".71" />
10442
+ <stop stop-color="#FF7373" offset="1" />
10443
+ </linearGradient>
10444
+ <circle cx="316.5" cy="316.5" r="316.5" fill={`url(#a-${id})`} />
10445
+ <defs><filter
10446
+ id={`am-${id}`}
10447
+ x="-137.5"
10448
+ y="412"
10449
+ width="454"
10450
+ height="396.9"
10451
+ filterUnits="userSpaceOnUse"
10452
+ ><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0" /></filter></defs>
10453
+ <mask
10454
+ id={`b-${id}`}
10455
+ x="-137.5"
10456
+ y="412"
10457
+ width="454"
10458
+ height="396.9"
10459
+ maskUnits="userSpaceOnUse"
10460
+ ><g filter={`url(#am-${id})`}><circle cx="316.5" cy="316.5" r="316.5" fill="#fff" /></g></mask>
10461
+ <g mask={`url(#b-${id})`}><ellipse
10462
+ cx="89.5"
10463
+ cy="610.5"
10464
+ rx="214.5"
10465
+ ry="186"
10466
+ fill="#015064"
10467
+ stroke="#00CFE2"
10468
+ stroke-width="25"
10469
+ /></g>
10470
+ <defs><filter
10471
+ id={`ah-${id}`}
9915
10472
  x="316.5"
9916
10473
  y="412"
9917
10474
  width="454"
@@ -10950,8 +11507,8 @@ var stylesFactory = (theme) => {
10950
11507
  expanderButtonContainer: u`
10951
11508
  display: flex;
10952
11509
  align-items: center;
10953
- line-height: 1.125rem;
10954
- min-height: 1.125rem;
11510
+ line-height: ${size2[4]};
11511
+ min-height: ${size2[4]};
10955
11512
  gap: ${size2[2]};
10956
11513
  `,
10957
11514
  expanderButton: u`
@@ -10959,7 +11516,7 @@ var stylesFactory = (theme) => {
10959
11516
  color: inherit;
10960
11517
  font: inherit;
10961
11518
  outline: inherit;
10962
- height: 1rem;
11519
+ height: ${size2[5]};
10963
11520
  background: transparent;
10964
11521
  border: none;
10965
11522
  padding: 0;
@@ -11001,8 +11558,8 @@ var stylesFactory = (theme) => {
11001
11558
  display: inline-flex;
11002
11559
  gap: ${size2[2]};
11003
11560
  width: 100%;
11004
- margin-bottom: ${size2[0.5]};
11005
- line-height: 1.125rem;
11561
+ margin: ${size2[0.25]} 0px;
11562
+ line-height: ${size2[4.5]};
11006
11563
  align-items: center;
11007
11564
  `,
11008
11565
  editableInput: u`
@@ -11065,9 +11622,13 @@ var DEFAULT_HEIGHT = 500;
11065
11622
  var DEFAULT_WIDTH = 500;
11066
11623
  var DEFAULT_SORT_FN_NAME = Object.keys(sortFns)[0];
11067
11624
  var DEFAULT_SORT_ORDER = 1;
11625
+ var DEFAULT_MUTATION_SORT_FN_NAME = Object.keys(mutationSortFns)[0];
11068
11626
  var [selectedQueryHash, setSelectedQueryHash] = createSignal(
11069
11627
  null
11070
11628
  );
11629
+ var [selectedMutationId, setSelectedMutationId] = createSignal(
11630
+ null
11631
+ );
11071
11632
  var [panelWidth, setPanelWidth] = createSignal(0);
11072
11633
  var DevtoolsComponent = (props) => {
11073
11634
  const [localStore, setLocalStore] = createLocalStorage({
@@ -11098,8 +11659,9 @@ var Devtools = (props) => {
11098
11659
  const position = createMemo(() => {
11099
11660
  return props.localStore.position || useQueryDevtoolsContext().position || POSITION;
11100
11661
  });
11662
+ let transitionsContainerRef;
11101
11663
  createEffect(() => {
11102
- const root = document.querySelector(".tsqd-parent-container");
11664
+ const root = transitionsContainerRef.parentElement;
11103
11665
  const height = props.localStore.height || DEFAULT_HEIGHT;
11104
11666
  const width = props.localStore.width || DEFAULT_WIDTH;
11105
11667
  const panelPosition = position();
@@ -11112,6 +11674,18 @@ var Devtools = (props) => {
11112
11674
  `${panelPosition === "left" ? "-" : ""}${width}px`
11113
11675
  );
11114
11676
  });
11677
+ onMount(() => {
11678
+ const onFocus = () => {
11679
+ const root = transitionsContainerRef.parentElement;
11680
+ const fontSize = getComputedStyle(root).fontSize;
11681
+ root.style.setProperty("--tsqd-font-size", fontSize);
11682
+ };
11683
+ onFocus();
11684
+ window.addEventListener("focus", onFocus);
11685
+ onCleanup(() => {
11686
+ window.removeEventListener("focus", onFocus);
11687
+ });
11688
+ });
11115
11689
  return <div
11116
11690
  class={clsx(
11117
11691
  u`
@@ -11137,6 +11711,7 @@ var Devtools = (props) => {
11137
11711
  `,
11138
11712
  "tsqd-transitions-container"
11139
11713
  )}
11714
+ ref={transitionsContainerRef}
11140
11715
  >
11141
11716
  <TransitionGroup name="tsqd-panel-transition"><Show when={isOpen()}><DevtoolsPanel
11142
11717
  localStore={props.localStore}
@@ -11162,37 +11737,9 @@ var DevtoolsPanel = (props) => {
11162
11737
  return theme() === "dark" ? darkStyles2 : lightStyles2;
11163
11738
  });
11164
11739
  const [isResizing, setIsResizing] = createSignal(false);
11165
- const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
11166
- const sortOrder = createMemo(
11167
- () => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
11168
- );
11169
- const [offline, setOffline] = createSignal(false);
11170
11740
  const position = createMemo(
11171
11741
  () => props.localStore.position || useQueryDevtoolsContext().position || POSITION
11172
11742
  );
11173
- const sortFn = createMemo(() => sortFns[sort()]);
11174
- const onlineManager = createMemo(
11175
- () => useQueryDevtoolsContext().onlineManager
11176
- );
11177
- const cache = createMemo(() => {
11178
- return useQueryDevtoolsContext().client.getQueryCache();
11179
- });
11180
- const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
11181
- return queryCache().getAll().length;
11182
- }, false);
11183
- const queries = createMemo(
11184
- on(
11185
- () => [queryCount(), props.localStore.filter, sort(), sortOrder()],
11186
- () => {
11187
- const curr = cache().getAll();
11188
- const filtered = props.localStore.filter ? curr.filter(
11189
- (item) => rankItem(item.queryHash, props.localStore.filter || "").passed
11190
- ) : [...curr];
11191
- const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
11192
- return sorted;
11193
- }
11194
- )
11195
- );
11196
11743
  const handleDragStart = (event) => {
11197
11744
  const panelElement = event.currentTarget.parentElement;
11198
11745
  if (!panelElement)
@@ -11237,8 +11784,6 @@ var DevtoolsPanel = (props) => {
11237
11784
  document.addEventListener("mousemove", runDrag, false);
11238
11785
  document.addEventListener("mouseup", unsub, false);
11239
11786
  };
11240
- setupQueryCacheSubscription();
11241
- let queriesContainerRef;
11242
11787
  let panelRef;
11243
11788
  onMount(() => {
11244
11789
  createResizeObserver(panelRef, ({ width }, el) => {
@@ -11247,9 +11792,6 @@ var DevtoolsPanel = (props) => {
11247
11792
  }
11248
11793
  });
11249
11794
  });
11250
- const setDevtoolsPosition = (pos) => {
11251
- props.setLocalStore("position", pos);
11252
- };
11253
11795
  createEffect(() => {
11254
11796
  const rootContainer = panelRef.parentElement?.parentElement?.parentElement;
11255
11797
  if (!rootContainer)
@@ -11327,46 +11869,156 @@ var DevtoolsPanel = (props) => {
11327
11869
  )}
11328
11870
  onClick={() => props.setLocalStore("open", "false")}
11329
11871
  ><ChevronDown /></button>
11872
+ <ContentView
11873
+ localStore={props.localStore}
11874
+ setLocalStore={props.setLocalStore}
11875
+ />
11876
+ </aside>;
11877
+ };
11878
+ var ContentView = (props) => {
11879
+ setupQueryCacheSubscription();
11880
+ setupMutationCacheSubscription();
11881
+ let containerRef;
11882
+ const theme = useTheme();
11883
+ const styles = createMemo(() => {
11884
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
11885
+ });
11886
+ const [selectedView, setSelectedView] = createSignal(
11887
+ "queries"
11888
+ );
11889
+ const sort = createMemo(() => props.localStore.sort || DEFAULT_SORT_FN_NAME);
11890
+ const sortOrder = createMemo(
11891
+ () => Number(props.localStore.sortOrder) || DEFAULT_SORT_ORDER
11892
+ );
11893
+ const mutationSort = createMemo(
11894
+ () => props.localStore.mutationSort || DEFAULT_MUTATION_SORT_FN_NAME
11895
+ );
11896
+ const mutationSortOrder = createMemo(
11897
+ () => Number(props.localStore.mutationSortOrder) || DEFAULT_SORT_ORDER
11898
+ );
11899
+ const [offline, setOffline] = createSignal(false);
11900
+ const sortFn = createMemo(() => sortFns[sort()]);
11901
+ const mutationSortFn = createMemo(
11902
+ () => mutationSortFns[mutationSort()]
11903
+ );
11904
+ const onlineManager = createMemo(
11905
+ () => useQueryDevtoolsContext().onlineManager
11906
+ );
11907
+ const query_cache = createMemo(() => {
11908
+ return useQueryDevtoolsContext().client.getQueryCache();
11909
+ });
11910
+ const mutation_cache = createMemo(() => {
11911
+ return useQueryDevtoolsContext().client.getMutationCache();
11912
+ });
11913
+ const queryCount = createSubscribeToQueryCacheBatcher((queryCache) => {
11914
+ return queryCache().getAll().length;
11915
+ }, false);
11916
+ const queries = createMemo(
11917
+ on(
11918
+ () => [queryCount(), props.localStore.filter, sort(), sortOrder()],
11919
+ () => {
11920
+ const curr = query_cache().getAll();
11921
+ const filtered = props.localStore.filter ? curr.filter(
11922
+ (item) => rankItem(item.queryHash, props.localStore.filter || "").passed
11923
+ ) : [...curr];
11924
+ const sorted = sortFn() ? filtered.sort((a2, b2) => sortFn()(a2, b2) * sortOrder()) : filtered;
11925
+ return sorted;
11926
+ }
11927
+ )
11928
+ );
11929
+ const mutationCount = createSubscribeToMutationCacheBatcher(
11930
+ (mutationCache) => {
11931
+ return mutationCache().getAll().length;
11932
+ },
11933
+ false
11934
+ );
11935
+ const mutations = createMemo(
11936
+ on(
11937
+ () => [
11938
+ mutationCount(),
11939
+ props.localStore.mutationFilter,
11940
+ mutationSort(),
11941
+ mutationSortOrder()
11942
+ ],
11943
+ () => {
11944
+ const curr = mutation_cache().getAll();
11945
+ const filtered = props.localStore.mutationFilter ? curr.filter((item) => {
11946
+ const value = `${item.options.mutationKey ? JSON.stringify(item.options.mutationKey) + " - " : ""}${new Date(item.state.submittedAt).toLocaleString()}`;
11947
+ return rankItem(value, props.localStore.mutationFilter || "").passed;
11948
+ }) : [...curr];
11949
+ const sorted = mutationSortFn() ? filtered.sort(
11950
+ (a2, b2) => mutationSortFn()(a2, b2) * mutationSortOrder()
11951
+ ) : filtered;
11952
+ return sorted;
11953
+ }
11954
+ )
11955
+ );
11956
+ const setDevtoolsPosition = (pos) => {
11957
+ props.setLocalStore("position", pos);
11958
+ };
11959
+ const setComputedVariables = (el) => {
11960
+ const computedStyle = getComputedStyle(containerRef);
11961
+ const variable = computedStyle.getPropertyValue("--tsqd-font-size");
11962
+ el.style.setProperty("--tsqd-font-size", variable);
11963
+ };
11964
+ return <>
11330
11965
  <div
11331
- ref={queriesContainerRef}
11332
11966
  class={clsx(
11333
11967
  styles().queriesContainer,
11334
- panelWidth() < secondBreakpoint && selectedQueryHash() && u`
11968
+ panelWidth() < secondBreakpoint && (selectedQueryHash() || selectedMutationId()) && u`
11335
11969
  height: 50%;
11336
11970
  max-height: 50%;
11337
11971
  `,
11338
11972
  "tsqd-queries-container"
11339
11973
  )}
11974
+ ref={containerRef}
11340
11975
  >
11341
11976
  <div class={clsx(styles().row, "tsqd-header")}>
11342
- <button
11343
- class={clsx(styles().logo, "tsqd-text-logo-container")}
11344
- onClick={() => props.setLocalStore("open", "false")}
11345
- aria-label="Close Tanstack query devtools"
11346
- >
11347
- <span class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}>TANSTACK</span>
11348
- <span
11349
- class={clsx(
11350
- styles().queryFlavorLogo,
11351
- "tsqd-text-logo-query-flavor"
11352
- )}
11977
+ <div class={styles().logoAndToggleContainer}>
11978
+ <button
11979
+ class={clsx(styles().logo, "tsqd-text-logo-container")}
11980
+ onClick={() => props.setLocalStore("open", "false")}
11981
+ aria-label="Close Tanstack query devtools"
11353
11982
  >
11354
- {useQueryDevtoolsContext().queryFlavor}
11355
- {" v"}
11356
- {useQueryDevtoolsContext().version}
11357
- </span>
11358
- </button>
11359
- <QueryStatusCount />
11983
+ <span
11984
+ class={clsx(styles().tanstackLogo, "tsqd-text-logo-tanstack")}
11985
+ >TANSTACK</span>
11986
+ <span
11987
+ class={clsx(
11988
+ styles().queryFlavorLogo,
11989
+ "tsqd-text-logo-query-flavor"
11990
+ )}
11991
+ >
11992
+ {useQueryDevtoolsContext().queryFlavor}
11993
+ {" v"}
11994
+ {useQueryDevtoolsContext().version}
11995
+ </span>
11996
+ </button>
11997
+ <index$7.Root
11998
+ class={clsx(styles().viewToggle)}
11999
+ value={selectedView()}
12000
+ onChange={(value) => {
12001
+ setSelectedView(value);
12002
+ setSelectedQueryHash(null);
12003
+ setSelectedMutationId(null);
12004
+ }}
12005
+ >
12006
+ <index$7.Item value="queries" class="tsqd-radio-toggle">
12007
+ <index$7.ItemInput />
12008
+ <index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
12009
+ <index$7.ItemLabel title="Toggle Queries View">Queries</index$7.ItemLabel>
12010
+ </index$7.Item>
12011
+ <index$7.Item value="mutations" class="tsqd-radio-toggle">
12012
+ <index$7.ItemInput />
12013
+ <index$7.ItemControl><index$7.ItemIndicator /></index$7.ItemControl>
12014
+ <index$7.ItemLabel title="Toggle Mutations View">Mutations</index$7.ItemLabel>
12015
+ </index$7.Item>
12016
+ </index$7.Root>
12017
+ </div>
12018
+ <Show when={selectedView() === "queries"}><QueryStatusCount /></Show>
12019
+ <Show when={selectedView() === "mutations"}><MutationStatusCount /></Show>
11360
12020
  </div>
11361
- <div
11362
- class={clsx(
11363
- styles().row,
11364
- u`
11365
- gap: ${tokens.size[2.5]};
11366
- `,
11367
- "tsqd-filters-actions-container"
11368
- )}
11369
- >
12021
+ <div class={clsx(styles().row, "tsqd-filters-actions-container")}>
11370
12022
  <div class={clsx(styles().filtersContainer, "tsqd-filters-container")}>
11371
12023
  <div
11372
12024
  class={clsx(
@@ -11379,9 +12031,15 @@ var DevtoolsPanel = (props) => {
11379
12031
  aria-label="Filter queries by query key"
11380
12032
  type="text"
11381
12033
  placeholder="Filter"
11382
- onInput={(e2) => props.setLocalStore("filter", e2.currentTarget.value)}
12034
+ onInput={(e2) => {
12035
+ if (selectedView() === "queries") {
12036
+ props.setLocalStore("filter", e2.currentTarget.value);
12037
+ } else {
12038
+ props.setLocalStore("mutationFilter", e2.currentTarget.value);
12039
+ }
12040
+ }}
11383
12041
  class="tsqd-query-filter-textfield"
11384
- value={props.localStore.filter || ""}
12042
+ value={selectedView() === "queries" ? props.localStore.filter || "" : props.localStore.mutationFilter || ""}
11385
12043
  />
11386
12044
  </div>
11387
12045
  <div
@@ -11390,28 +12048,50 @@ var DevtoolsPanel = (props) => {
11390
12048
  "tsqd-query-filter-sort-container"
11391
12049
  )}
11392
12050
  >
11393
- <select
12051
+ <Show when={selectedView() === "queries"}><select
11394
12052
  value={sort()}
11395
- onChange={(e2) => props.setLocalStore("sort", e2.currentTarget.value)}
12053
+ onChange={(e2) => {
12054
+ props.setLocalStore("sort", e2.currentTarget.value);
12055
+ }}
11396
12056
  >{Object.keys(sortFns).map((key) => <option value={key}>
11397
12057
  {"Sort by "}
11398
12058
  {key}
11399
- </option>)}</select>
12059
+ </option>)}</select></Show>
12060
+ <Show when={selectedView() === "mutations"}><select
12061
+ value={mutationSort()}
12062
+ onChange={(e2) => {
12063
+ props.setLocalStore("mutationSort", e2.currentTarget.value);
12064
+ }}
12065
+ >{Object.keys(mutationSortFns).map((key) => <option value={key}>
12066
+ {"Sort by "}
12067
+ {key}
12068
+ </option>)}</select></Show>
11400
12069
  <ChevronDown />
11401
12070
  </div>
11402
12071
  <button
11403
12072
  onClick={() => {
11404
- props.setLocalStore("sortOrder", String(sortOrder() * -1));
12073
+ if (selectedView() === "queries") {
12074
+ props.setLocalStore("sortOrder", String(sortOrder() * -1));
12075
+ } else {
12076
+ props.setLocalStore(
12077
+ "mutationSortOrder",
12078
+ String(mutationSortOrder() * -1)
12079
+ );
12080
+ }
11405
12081
  }}
11406
- aria-label={`Sort order ${sortOrder() === -1 ? "descending" : "ascending"}`}
11407
- aria-pressed={sortOrder() === -1}
12082
+ aria-label={`Sort order ${(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1 ? "descending" : "ascending"}`}
12083
+ aria-pressed={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
11408
12084
  class="tsqd-query-filter-sort-order-btn"
11409
12085
  >
11410
- <Show when={sortOrder() === 1}>
12086
+ <Show
12087
+ when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === 1}
12088
+ >
11411
12089
  <span>Asc</span>
11412
12090
  <ArrowUp />
11413
12091
  </Show>
11414
- <Show when={sortOrder() === -1}>
12092
+ <Show
12093
+ when={(selectedView() === "queries" ? sortOrder() : mutationSortOrder()) === -1}
12094
+ >
11415
12095
  <span>Desc</span>
11416
12096
  <ArrowDown />
11417
12097
  </Show>
@@ -11420,7 +12100,11 @@ var DevtoolsPanel = (props) => {
11420
12100
  <div class={clsx(styles().actionsContainer, "tsqd-actions-container")}>
11421
12101
  <button
11422
12102
  onClick={() => {
11423
- cache().clear();
12103
+ if (selectedView() === "queries") {
12104
+ query_cache().clear();
12105
+ } else {
12106
+ mutation_cache().clear();
12107
+ }
11424
12108
  }}
11425
12109
  class={clsx(
11426
12110
  styles().actionsBtn,
@@ -11428,7 +12112,7 @@ var DevtoolsPanel = (props) => {
11428
12112
  "tsqd-action-clear-cache"
11429
12113
  )}
11430
12114
  aria-label="Clear query cache"
11431
- title="Clear query cache"
12115
+ title={`Clear ${selectedView()} cache`}
11432
12116
  ><Trash /></button>
11433
12117
  <button
11434
12118
  onClick={() => {
@@ -11458,7 +12142,9 @@ var DevtoolsPanel = (props) => {
11458
12142
  "tsqd-action-settings"
11459
12143
  )}
11460
12144
  ><Settings /></index$d.Trigger>
11461
- <index$d.Portal><index$d.Content
12145
+ <index$d.Portal
12146
+ ref={(el) => setComputedVariables(el)}
12147
+ ><index$d.Content
11462
12148
  class={clsx(styles().settingsMenu, "tsqd-settings-menu")}
11463
12149
  >
11464
12150
  <div
@@ -11478,7 +12164,9 @@ var DevtoolsPanel = (props) => {
11478
12164
  <span>Position</span>
11479
12165
  <ChevronDown />
11480
12166
  </index$d.SubTrigger>
11481
- <index$d.Portal><index$d.SubContent
12167
+ <index$d.Portal
12168
+ ref={(el) => setComputedVariables(el)}
12169
+ ><index$d.SubContent
11482
12170
  class={clsx(
11483
12171
  styles().settingsMenu,
11484
12172
  "tsqd-settings-submenu"
@@ -11553,7 +12241,9 @@ var DevtoolsPanel = (props) => {
11553
12241
  <span>Theme</span>
11554
12242
  <ChevronDown />
11555
12243
  </index$d.SubTrigger>
11556
- <index$d.Portal><index$d.SubContent
12244
+ <index$d.Portal
12245
+ ref={(el) => setComputedVariables(el)}
12246
+ ><index$d.SubContent
11557
12247
  class={clsx(
11558
12248
  styles().settingsMenu,
11559
12249
  "tsqd-settings-submenu"
@@ -11610,15 +12300,22 @@ var DevtoolsPanel = (props) => {
11610
12300
  </index$d.Root>
11611
12301
  </div>
11612
12302
  </div>
11613
- <div
12303
+ <Show when={selectedView() === "queries"}><div
11614
12304
  class={clsx(
11615
12305
  styles().overflowQueryContainer,
11616
12306
  "tsqd-queries-overflow-container"
11617
12307
  )}
11618
- ><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div>
12308
+ ><div class="tsqd-queries-container"><Key by={(q) => q.queryHash} each={queries()}>{(query) => <QueryRow query={query()} />}</Key></div></div></Show>
12309
+ <Show when={selectedView() === "mutations"}><div
12310
+ class={clsx(
12311
+ styles().overflowQueryContainer,
12312
+ "tsqd-mutations-overflow-container"
12313
+ )}
12314
+ ><div class="tsqd-mutations-container"><Key by={(m) => m.mutationId} each={mutations()}>{(mutation) => <MutationRow mutation={mutation()} />}</Key></div></div></Show>
11619
12315
  </div>
11620
- <Show when={selectedQueryHash()}><QueryDetails /></Show>
11621
- </aside>;
12316
+ <Show when={selectedView() === "queries" && selectedQueryHash()}><QueryDetails /></Show>
12317
+ <Show when={selectedView() === "mutations" && selectedMutationId()}><MutationDetails /></Show>
12318
+ </>;
11622
12319
  };
11623
12320
  var QueryRow = (props) => {
11624
12321
  const theme = useTheme();
@@ -11687,6 +12384,94 @@ var QueryRow = (props) => {
11687
12384
  <Show when={isDisabled()}><div class="tsqd-query-disabled-indicator">disabled</div></Show>
11688
12385
  </button></Show>;
11689
12386
  };
12387
+ var MutationRow = (props) => {
12388
+ const theme = useTheme();
12389
+ const styles = createMemo(() => {
12390
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12391
+ });
12392
+ const { colors, alpha } = tokens;
12393
+ const t2 = (light, dark) => theme() === "dark" ? dark : light;
12394
+ const mutationState = createSubscribeToMutationCacheBatcher(
12395
+ (mutationCache) => {
12396
+ const mutations = mutationCache().getAll();
12397
+ const mutation = mutations.find(
12398
+ (m) => m.mutationId === props.mutation.mutationId
12399
+ );
12400
+ return mutation?.state;
12401
+ }
12402
+ );
12403
+ const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
12404
+ const mutations = mutationCache().getAll();
12405
+ const mutation = mutations.find(
12406
+ (m) => m.mutationId === props.mutation.mutationId
12407
+ );
12408
+ if (!mutation)
12409
+ return false;
12410
+ return mutation.state.isPaused;
12411
+ });
12412
+ const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
12413
+ const mutations = mutationCache().getAll();
12414
+ const mutation = mutations.find(
12415
+ (m) => m.mutationId === props.mutation.mutationId
12416
+ );
12417
+ if (!mutation)
12418
+ return "idle";
12419
+ return mutation.state.status;
12420
+ });
12421
+ const color = createMemo(
12422
+ () => getMutationStatusColor({
12423
+ isPaused: isPaused(),
12424
+ status: status()
12425
+ })
12426
+ );
12427
+ const getObserverCountColorStyles = () => {
12428
+ if (color() === "gray") {
12429
+ return u`
12430
+ background-color: ${t2(colors[color()][200], colors[color()][700])};
12431
+ color: ${t2(colors[color()][700], colors[color()][300])};
12432
+ `;
12433
+ }
12434
+ return u`
12435
+ background-color: ${t2(
12436
+ colors[color()][200] + alpha[80],
12437
+ colors[color()][900]
12438
+ )};
12439
+ color: ${t2(colors[color()][800], colors[color()][300])};
12440
+ `;
12441
+ };
12442
+ return <Show when={mutationState()}><button
12443
+ onClick={() => {
12444
+ setSelectedMutationId(
12445
+ props.mutation.mutationId === selectedMutationId() ? null : props.mutation.mutationId
12446
+ );
12447
+ }}
12448
+ class={clsx(
12449
+ styles().queryRow,
12450
+ selectedMutationId() === props.mutation.mutationId && styles().selectedQueryRow,
12451
+ "tsqd-query-row"
12452
+ )}
12453
+ aria-label={`Mutation submitted at ${new Date(
12454
+ props.mutation.state.submittedAt
12455
+ ).toLocaleString()}`}
12456
+ >
12457
+ <div
12458
+ class={clsx(getObserverCountColorStyles(), "tsqd-query-observer-count")}
12459
+ >
12460
+ <Show when={color() === "purple"}><PauseCircle /></Show>
12461
+ <Show when={color() === "green"}><CheckCircle /></Show>
12462
+ <Show when={color() === "red"}><XCircle /></Show>
12463
+ <Show when={color() === "yellow"}><LoadingCircle /></Show>
12464
+ </div>
12465
+ <code class="tsqd-query-hash">
12466
+ <Show when={props.mutation.options.mutationKey}>
12467
+ {JSON.stringify(props.mutation.options.mutationKey)}
12468
+ {" -"}
12469
+ {" "}
12470
+ </Show>
12471
+ {new Date(props.mutation.state.submittedAt).toLocaleString()}
12472
+ </code>
12473
+ </button></Show>;
12474
+ };
11690
12475
  var QueryStatusCount = () => {
11691
12476
  const stale = createSubscribeToQueryCacheBatcher(
11692
12477
  (queryCache) => queryCache().getAll().filter((q) => getQueryStatusLabel(q) === "stale").length
@@ -11717,6 +12502,52 @@ var QueryStatusCount = () => {
11717
12502
  <QueryStatus label="Inactive" color="gray" count={inactive()} />
11718
12503
  </div>;
11719
12504
  };
12505
+ var MutationStatusCount = () => {
12506
+ const success = createSubscribeToMutationCacheBatcher(
12507
+ (mutationCache) => mutationCache().getAll().filter(
12508
+ (m) => getMutationStatusColor({
12509
+ isPaused: m.state.isPaused,
12510
+ status: m.state.status
12511
+ }) === "green"
12512
+ ).length
12513
+ );
12514
+ const pending = createSubscribeToMutationCacheBatcher(
12515
+ (mutationCache) => mutationCache().getAll().filter(
12516
+ (m) => getMutationStatusColor({
12517
+ isPaused: m.state.isPaused,
12518
+ status: m.state.status
12519
+ }) === "yellow"
12520
+ ).length
12521
+ );
12522
+ const paused = createSubscribeToMutationCacheBatcher(
12523
+ (mutationCache) => mutationCache().getAll().filter(
12524
+ (m) => getMutationStatusColor({
12525
+ isPaused: m.state.isPaused,
12526
+ status: m.state.status
12527
+ }) === "purple"
12528
+ ).length
12529
+ );
12530
+ const error = createSubscribeToMutationCacheBatcher(
12531
+ (mutationCache) => mutationCache().getAll().filter(
12532
+ (m) => getMutationStatusColor({
12533
+ isPaused: m.state.isPaused,
12534
+ status: m.state.status
12535
+ }) === "red"
12536
+ ).length
12537
+ );
12538
+ const theme = useTheme();
12539
+ const styles = createMemo(() => {
12540
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12541
+ });
12542
+ return <div
12543
+ class={clsx(styles().queryStatusContainer, "tsqd-query-status-container")}
12544
+ >
12545
+ <QueryStatus label="Paused" color="purple" count={paused()} />
12546
+ <QueryStatus label="Pending" color="yellow" count={pending()} />
12547
+ <QueryStatus label="Success" color="green" count={success()} />
12548
+ <QueryStatus label="Error" color="red" count={error()} />
12549
+ </div>;
12550
+ };
11720
12551
  var QueryStatus = (props) => {
11721
12552
  const theme = useTheme();
11722
12553
  const styles = createMemo(() => {
@@ -12102,7 +12933,7 @@ var QueryDetails = () => {
12102
12933
  <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
12103
12934
  <div
12104
12935
  style={{
12105
- padding: "0.5rem"
12936
+ padding: tokens.size[2]
12106
12937
  }}
12107
12938
  class="tsqd-query-details-explorer-container tsqd-query-details-data-explorer"
12108
12939
  ><Explorer
@@ -12115,7 +12946,7 @@ var QueryDetails = () => {
12115
12946
  <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Query Explorer</div>
12116
12947
  <div
12117
12948
  style={{
12118
- padding: "0.5rem"
12949
+ padding: tokens.size[2]
12119
12950
  }}
12120
12951
  class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
12121
12952
  ><Explorer
@@ -12125,21 +12956,145 @@ var QueryDetails = () => {
12125
12956
  /></div>
12126
12957
  </div></Show>;
12127
12958
  };
12128
- var signalsMap = /* @__PURE__ */ new Map();
12959
+ var MutationDetails = () => {
12960
+ const theme = useTheme();
12961
+ const styles = createMemo(() => {
12962
+ return theme() === "dark" ? darkStyles2 : lightStyles2;
12963
+ });
12964
+ const { colors } = tokens;
12965
+ const t2 = (light, dark) => theme() === "dark" ? dark : light;
12966
+ const isPaused = createSubscribeToMutationCacheBatcher((mutationCache) => {
12967
+ const mutations = mutationCache().getAll();
12968
+ const mutation = mutations.find(
12969
+ (m) => m.mutationId === selectedMutationId()
12970
+ );
12971
+ if (!mutation)
12972
+ return false;
12973
+ return mutation.state.isPaused;
12974
+ });
12975
+ const status = createSubscribeToMutationCacheBatcher((mutationCache) => {
12976
+ const mutations = mutationCache().getAll();
12977
+ const mutation = mutations.find(
12978
+ (m) => m.mutationId === selectedMutationId()
12979
+ );
12980
+ if (!mutation)
12981
+ return "idle";
12982
+ return mutation.state.status;
12983
+ });
12984
+ const color = createMemo(
12985
+ () => getMutationStatusColor({
12986
+ isPaused: isPaused(),
12987
+ status: status()
12988
+ })
12989
+ );
12990
+ const activeMutation = createSubscribeToMutationCacheBatcher(
12991
+ (mutationCache) => mutationCache().getAll().find((mutation) => mutation.mutationId === selectedMutationId()),
12992
+ false
12993
+ );
12994
+ const getQueryStatusColors = () => {
12995
+ if (color() === "gray") {
12996
+ return u`
12997
+ background-color: ${t2(colors[color()][200], colors[color()][700])};
12998
+ color: ${t2(colors[color()][700], colors[color()][300])};
12999
+ border-color: ${t2(colors[color()][400], colors[color()][600])};
13000
+ `;
13001
+ }
13002
+ return u`
13003
+ background-color: ${t2(colors[color()][100], colors[color()][900])};
13004
+ color: ${t2(colors[color()][700], colors[color()][300])};
13005
+ border-color: ${t2(colors[color()][400], colors[color()][600])};
13006
+ `;
13007
+ };
13008
+ return <Show when={activeMutation()}><div
13009
+ class={clsx(styles().detailsContainer, "tsqd-query-details-container")}
13010
+ >
13011
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutation Details</div>
13012
+ <div
13013
+ class={clsx(
13014
+ styles().detailsBody,
13015
+ "tsqd-query-details-summary-container"
13016
+ )}
13017
+ >
13018
+ <div class="tsqd-query-details-summary">
13019
+ <pre><code><Show
13020
+ when={activeMutation().options.mutationKey}
13021
+ fallback="No mutationKey found"
13022
+ >{displayValue(activeMutation().options.mutationKey, true)}</Show></code></pre>
13023
+ <span
13024
+ class={clsx(styles().queryDetailsStatus, getQueryStatusColors())}
13025
+ >
13026
+ <Show when={color() === "purple"}>pending</Show>
13027
+ <Show when={color() !== "purple"}>{status()}</Show>
13028
+ </span>
13029
+ </div>
13030
+ <div class="tsqd-query-details-last-updated">
13031
+ <span>Submitted At:</span>
13032
+ <span>{new Date(
13033
+ activeMutation().state.submittedAt
13034
+ ).toLocaleTimeString()}</span>
13035
+ </div>
13036
+ </div>
13037
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Variables Details</div>
13038
+ <div
13039
+ style={{
13040
+ padding: tokens.size[2]
13041
+ }}
13042
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13043
+ ><Explorer
13044
+ label="Variables"
13045
+ defaultExpanded={["Variables"]}
13046
+ value={activeMutation().state.variables}
13047
+ /></div>
13048
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Context Details</div>
13049
+ <div
13050
+ style={{
13051
+ padding: tokens.size[2]
13052
+ }}
13053
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13054
+ ><Explorer
13055
+ label="Context"
13056
+ defaultExpanded={["Context"]}
13057
+ value={activeMutation().state.context}
13058
+ /></div>
13059
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Data Explorer</div>
13060
+ <div
13061
+ style={{
13062
+ padding: tokens.size[2]
13063
+ }}
13064
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13065
+ ><Explorer
13066
+ label="Data"
13067
+ defaultExpanded={["Data"]}
13068
+ value={activeMutation().state.data}
13069
+ /></div>
13070
+ <div class={clsx(styles().detailsHeader, "tsqd-query-details-header")}>Mutations Explorer</div>
13071
+ <div
13072
+ style={{
13073
+ padding: tokens.size[2]
13074
+ }}
13075
+ class="tsqd-query-details-explorer-container tsqd-query-details-query-explorer"
13076
+ ><Explorer
13077
+ label="Mutation"
13078
+ defaultExpanded={["Mutation"]}
13079
+ value={activeMutation()}
13080
+ /></div>
13081
+ </div></Show>;
13082
+ };
13083
+ var queryCacheMap = /* @__PURE__ */ new Map();
12129
13084
  var setupQueryCacheSubscription = () => {
12130
13085
  const queryCache = createMemo(() => {
12131
13086
  const client = useQueryDevtoolsContext().client;
12132
13087
  return client.getQueryCache();
12133
13088
  });
12134
13089
  const unsub = queryCache().subscribe(() => {
12135
- for (const [callback, setter] of signalsMap.entries()) {
13090
+ for (const [callback, setter] of queryCacheMap.entries()) {
12136
13091
  queueMicrotask(() => {
12137
13092
  setter(callback(queryCache));
12138
13093
  });
12139
13094
  }
12140
13095
  });
12141
13096
  onCleanup(() => {
12142
- signalsMap.clear();
13097
+ queryCacheMap.clear();
12143
13098
  unsub();
12144
13099
  });
12145
13100
  return unsub;
@@ -12156,9 +13111,46 @@ var createSubscribeToQueryCacheBatcher = (callback, equalityCheck = true) => {
12156
13111
  createEffect(() => {
12157
13112
  setValue(callback(queryCache));
12158
13113
  });
12159
- signalsMap.set(callback, setValue);
13114
+ queryCacheMap.set(callback, setValue);
13115
+ onCleanup(() => {
13116
+ queryCacheMap.delete(callback);
13117
+ });
13118
+ return value;
13119
+ };
13120
+ var mutationCacheMap = /* @__PURE__ */ new Map();
13121
+ var setupMutationCacheSubscription = () => {
13122
+ const mutationCache = createMemo(() => {
13123
+ const client = useQueryDevtoolsContext().client;
13124
+ return client.getMutationCache();
13125
+ });
13126
+ const unsub = mutationCache().subscribe(() => {
13127
+ for (const [callback, setter] of mutationCacheMap.entries()) {
13128
+ queueMicrotask(() => {
13129
+ setter(callback(mutationCache));
13130
+ });
13131
+ }
13132
+ });
13133
+ onCleanup(() => {
13134
+ mutationCacheMap.clear();
13135
+ unsub();
13136
+ });
13137
+ return unsub;
13138
+ };
13139
+ var createSubscribeToMutationCacheBatcher = (callback, equalityCheck = true) => {
13140
+ const mutationCache = createMemo(() => {
13141
+ const client = useQueryDevtoolsContext().client;
13142
+ return client.getMutationCache();
13143
+ });
13144
+ const [value, setValue] = createSignal(
13145
+ callback(mutationCache),
13146
+ !equalityCheck ? { equals: false } : void 0
13147
+ );
13148
+ createEffect(() => {
13149
+ setValue(callback(mutationCache));
13150
+ });
13151
+ mutationCacheMap.set(callback, setValue);
12160
13152
  onCleanup(() => {
12161
- signalsMap.delete(callback);
13153
+ mutationCacheMap.delete(callback);
12162
13154
  });
12163
13155
  return value;
12164
13156
  };
@@ -12251,7 +13243,7 @@ var stylesFactory2 = (theme) => {
12251
13243
  right: 0;
12252
13244
  left: 0;
12253
13245
  max-height: 90%;
12254
- min-height: 3.5rem;
13246
+ min-height: ${size2[14]};
12255
13247
  border-bottom: ${t2(colors.gray[400], colors.darkGray[300])} 1px solid;
12256
13248
  `,
12257
13249
  "panel-position-bottom": u`
@@ -12259,7 +13251,7 @@ var stylesFactory2 = (theme) => {
12259
13251
  right: 0;
12260
13252
  left: 0;
12261
13253
  max-height: 90%;
12262
- min-height: 3.5rem;
13254
+ min-height: ${size2[14]};
12263
13255
  border-top: ${t2(colors.gray[400], colors.darkGray[300])} 1px solid;
12264
13256
  `,
12265
13257
  "panel-position-right": u`
@@ -12433,7 +13425,7 @@ var stylesFactory2 = (theme) => {
12433
13425
  justify-content: space-between;
12434
13426
  align-items: center;
12435
13427
  padding: ${tokens.size[2]} ${tokens.size[2.5]};
12436
- gap: ${tokens.size[3]};
13428
+ gap: ${tokens.size[2.5]};
12437
13429
  border-bottom: ${t2(colors.gray[300], colors.darkGray[500])} 1px solid;
12438
13430
  align-items: center;
12439
13431
  & > button {
@@ -12445,8 +13437,19 @@ var stylesFactory2 = (theme) => {
12445
13437
  flex-direction: column;
12446
13438
  }
12447
13439
  `,
13440
+ logoAndToggleContainer: u`
13441
+ display: flex;
13442
+ gap: ${tokens.size[3]};
13443
+ align-items: center;
13444
+ `,
12448
13445
  logo: u`
12449
13446
  cursor: pointer;
13447
+ display: flex;
13448
+ flex-direction: column;
13449
+ background-color: transparent;
13450
+ border: none;
13451
+ gap: ${tokens.size[0.5]};
13452
+ padding: 0px;
12450
13453
  &:hover {
12451
13454
  opacity: 0.7;
12452
13455
  }
@@ -12580,6 +13583,8 @@ var stylesFactory2 = (theme) => {
12580
13583
  outline: 2px solid ${colors.blue[800]};
12581
13584
  }
12582
13585
  & svg {
13586
+ width: ${tokens.size[3]};
13587
+ height: ${tokens.size[3]};
12583
13588
  color: ${t2(colors.gray[500], colors.gray[400])};
12584
13589
  }
12585
13590
  }
@@ -12665,8 +13670,8 @@ var stylesFactory2 = (theme) => {
12665
13670
  border-radius: ${tokens.border.radius.sm};
12666
13671
  background-color: ${t2(colors.gray[100], colors.darkGray[400])};
12667
13672
  border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
12668
- width: 1.625rem;
12669
- height: 1.625rem;
13673
+ width: ${tokens.size[6.5]};
13674
+ height: ${tokens.size[6.5]};
12670
13675
  justify-content: center;
12671
13676
  display: flex;
12672
13677
  align-items: center;
@@ -12818,6 +13823,8 @@ var stylesFactory2 = (theme) => {
12818
13823
 
12819
13824
  & pre {
12820
13825
  margin: 0;
13826
+ display: flex;
13827
+ align-items: center;
12821
13828
  }
12822
13829
  `,
12823
13830
  queryDetailsStatus: u`
@@ -12997,6 +14004,56 @@ var stylesFactory2 = (theme) => {
12997
14004
  &:hover {
12998
14005
  background-color: ${t2(colors.purple[100], colors.purple[900])};
12999
14006
  }
14007
+ `,
14008
+ viewToggle: u`
14009
+ border-radius: ${tokens.border.radius.sm};
14010
+ background-color: ${t2(colors.gray[200], colors.darkGray[600])};
14011
+ border: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
14012
+ display: flex;
14013
+ padding: 0;
14014
+ font-size: ${font.size.xs};
14015
+ color: ${t2(colors.gray[700], colors.gray[300])};
14016
+ overflow: hidden;
14017
+
14018
+ &:has(:focus-visible) {
14019
+ outline: 2px solid ${colors.blue[800]};
14020
+ }
14021
+
14022
+ & .tsqd-radio-toggle {
14023
+ opacity: 0.5;
14024
+ display: flex;
14025
+ & label {
14026
+ display: flex;
14027
+ align-items: center;
14028
+ cursor: pointer;
14029
+ line-height: ${font.lineHeight.md};
14030
+ }
14031
+
14032
+ & label:hover {
14033
+ background-color: ${t2(colors.gray[100], colors.darkGray[500])};
14034
+ }
14035
+ }
14036
+
14037
+ & > [data-checked] {
14038
+ opacity: 1;
14039
+ background-color: ${t2(colors.gray[100], colors.darkGray[400])};
14040
+ & label:hover {
14041
+ background-color: ${t2(colors.gray[100], colors.darkGray[400])};
14042
+ }
14043
+ }
14044
+
14045
+ & .tsqd-radio-toggle:first-child {
14046
+ & label {
14047
+ padding: 0 ${tokens.size[1.5]} 0 ${tokens.size[2]};
14048
+ }
14049
+ border-right: 1px solid ${t2(colors.gray[300], colors.darkGray[200])};
14050
+ }
14051
+
14052
+ & .tsqd-radio-toggle:nth-child(2) {
14053
+ & label {
14054
+ padding: 0 ${tokens.size[2]} 0 ${tokens.size[1.5]};
14055
+ }
14056
+ }
13000
14057
  `
13001
14058
  };
13002
14059
  };
@@ -13006,6 +14063,8 @@ export {
13006
14063
  Devtools,
13007
14064
  DevtoolsComponent,
13008
14065
  DevtoolsPanel,
14066
+ MutationRow,
14067
+ MutationStatusCount,
13009
14068
  QueryRow,
13010
14069
  QueryStatus,
13011
14070
  QueryStatusCount,
@@ -13217,8 +14276,6 @@ export {
13217
14276
  * Credits to the zag team:
13218
14277
  * https://github.com/chakra-ui/zag/blob/c1e6c7689b22bf58741ded7cf224dd9baec2a046/packages/utilities/form-utils/src/form.ts
13219
14278
  *)
13220
-
13221
- @kobalte/core/dist/esm/index.js:
13222
14279
  (*!
13223
14280
  * Portions of this file are based on code from react-spectrum.
13224
14281
  * Apache License Version 2.0, Copyright 2020 Adobe.