@tanstack/query-devtools 5.24.0 → 5.27.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.cts CHANGED
@@ -23,10 +23,12 @@ interface QueryDevtoolsProps {
23
23
  position?: DevtoolsPosition;
24
24
  initialIsOpen?: boolean;
25
25
  errorTypes?: Array<DevToolsErrorType>;
26
+ shadowDOMTarget?: ShadowRoot;
26
27
  }
27
28
 
28
29
  interface TanstackQueryDevtoolsConfig extends QueryDevtoolsProps {
29
30
  styleNonce?: string;
31
+ shadowDOMTarget?: ShadowRoot;
30
32
  }
31
33
  declare class TanstackQueryDevtools {
32
34
  #private;
package/build/index.d.ts CHANGED
@@ -23,10 +23,12 @@ interface QueryDevtoolsProps {
23
23
  position?: DevtoolsPosition;
24
24
  initialIsOpen?: boolean;
25
25
  errorTypes?: Array<DevToolsErrorType>;
26
+ shadowDOMTarget?: ShadowRoot;
26
27
  }
27
28
 
28
29
  interface TanstackQueryDevtoolsConfig extends QueryDevtoolsProps {
29
30
  styleNonce?: string;
31
+ shadowDOMTarget?: ShadowRoot;
30
32
  }
31
33
  declare class TanstackQueryDevtools {
32
34
  #private;
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createSignal, render, lazy, setupStyleSheet, createComponent, mergeProps } from './chunk/7LTSZCE6.js';
1
+ import { createSignal, render, lazy, setupStyleSheet, createComponent, mergeProps } from './chunk/BWUNFN7M.js';
2
2
 
3
3
  // src/index.tsx
4
4
  var TanstackQueryDevtools = class {
@@ -8,6 +8,7 @@ var TanstackQueryDevtools = class {
8
8
  #version;
9
9
  #isMounted = false;
10
10
  #styleNonce;
11
+ #shadowDOMTarget;
11
12
  #buttonPosition;
12
13
  #position;
13
14
  #initialIsOpen;
@@ -24,13 +25,15 @@ var TanstackQueryDevtools = class {
24
25
  position,
25
26
  initialIsOpen,
26
27
  errorTypes,
27
- styleNonce
28
+ styleNonce,
29
+ shadowDOMTarget
28
30
  } = config;
29
31
  this.#client = createSignal(client);
30
32
  this.#queryFlavor = queryFlavor;
31
33
  this.#version = version;
32
34
  this.#onlineManager = onlineManager;
33
35
  this.#styleNonce = styleNonce;
36
+ this.#shadowDOMTarget = shadowDOMTarget;
34
37
  this.#buttonPosition = createSignal(buttonPosition);
35
38
  this.#position = createSignal(position);
36
39
  this.#initialIsOpen = createSignal(initialIsOpen);
@@ -66,10 +69,10 @@ var TanstackQueryDevtools = class {
66
69
  if (this.#Component) {
67
70
  Devtools = this.#Component;
68
71
  } else {
69
- Devtools = lazy(() => import('./Devtools/335X72D7.js'));
72
+ Devtools = lazy(() => import('./Devtools/DBFR2OSQ.js'));
70
73
  this.#Component = Devtools;
71
74
  }
72
- setupStyleSheet(this.#styleNonce);
75
+ setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
73
76
  return createComponent(Devtools, mergeProps({
74
77
  get queryFlavor() {
75
78
  return _self$.#queryFlavor;
@@ -79,6 +82,9 @@ var TanstackQueryDevtools = class {
79
82
  },
80
83
  get onlineManager() {
81
84
  return _self$.#onlineManager;
85
+ },
86
+ get shadowDOMTarget() {
87
+ return _self$.#shadowDOMTarget;
82
88
  }
83
89
  }, {
84
90
  get client() {
package/build/index.jsx CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  lazy,
4
4
  render,
5
5
  setupStyleSheet
6
- } from "./chunk/LJVATCV2.jsx";
6
+ } from "./chunk/4MX274MJ.jsx";
7
7
 
8
8
  // src/index.tsx
9
9
  var TanstackQueryDevtools = class {
@@ -13,6 +13,7 @@ var TanstackQueryDevtools = class {
13
13
  #version;
14
14
  #isMounted = false;
15
15
  #styleNonce;
16
+ #shadowDOMTarget;
16
17
  #buttonPosition;
17
18
  #position;
18
19
  #initialIsOpen;
@@ -29,13 +30,15 @@ var TanstackQueryDevtools = class {
29
30
  position,
30
31
  initialIsOpen,
31
32
  errorTypes,
32
- styleNonce
33
+ styleNonce,
34
+ shadowDOMTarget
33
35
  } = config;
34
36
  this.#client = createSignal(client);
35
37
  this.#queryFlavor = queryFlavor;
36
38
  this.#version = version;
37
39
  this.#onlineManager = onlineManager;
38
40
  this.#styleNonce = styleNonce;
41
+ this.#shadowDOMTarget = shadowDOMTarget;
39
42
  this.#buttonPosition = createSignal(buttonPosition);
40
43
  this.#position = createSignal(position);
41
44
  this.#initialIsOpen = createSignal(initialIsOpen);
@@ -70,14 +73,15 @@ var TanstackQueryDevtools = class {
70
73
  if (this.#Component) {
71
74
  Devtools = this.#Component;
72
75
  } else {
73
- Devtools = lazy(() => import("./Devtools/36BZFNWK.jsx"));
76
+ Devtools = lazy(() => import("./Devtools/ZI3HPF3S.jsx"));
74
77
  this.#Component = Devtools;
75
78
  }
76
- setupStyleSheet(this.#styleNonce);
79
+ setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
77
80
  return <Devtools
78
81
  queryFlavor={this.#queryFlavor}
79
82
  version={this.#version}
80
83
  onlineManager={this.#onlineManager}
84
+ shadowDOMTarget={this.#shadowDOMTarget}
81
85
  {...{
82
86
  get client() {
83
87
  return queryClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/query-devtools",
3
- "version": "5.24.0",
3
+ "version": "5.27.3",
4
4
  "description": "Developer tools to interact with and visualize the TanStack Query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -50,7 +50,7 @@
50
50
  "superjson": "^1.13.3",
51
51
  "tsup-preset-solid": "^2.2.0",
52
52
  "vite-plugin-solid": "^2.9.1",
53
- "@tanstack/query-core": "5.22.2"
53
+ "@tanstack/query-core": "5.27.3"
54
54
  },
55
55
  "scripts": {
56
56
  "clean": "rimraf ./build && rimraf ./coverage",
package/src/Context.ts CHANGED
@@ -28,6 +28,7 @@ export interface QueryDevtoolsProps {
28
28
  position?: DevtoolsPosition
29
29
  initialIsOpen?: boolean
30
30
  errorTypes?: Array<DevToolsErrorType>
31
+ shadowDOMTarget?: ShadowRoot
31
32
  }
32
33
 
33
34
  export const QueryDevtoolsContext = createContext<QueryDevtoolsProps>({
@@ -35,6 +36,7 @@ export const QueryDevtoolsContext = createContext<QueryDevtoolsProps>({
35
36
  onlineManager: undefined as unknown as typeof onlineManager,
36
37
  queryFlavor: '',
37
38
  version: '',
39
+ shadowDOMTarget: undefined,
38
40
  })
39
41
 
40
42
  export function useQueryDevtoolsContext() {
package/src/Devtools.tsx CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  useContext,
13
13
  } from 'solid-js'
14
14
  import { rankItem } from '@tanstack/match-sorter-utils'
15
- import { css } from 'goober'
15
+ import * as goober from 'goober'
16
16
  import { clsx as cx } from 'clsx'
17
17
  import { TransitionGroup } from 'solid-transition-group'
18
18
  import { Key } from '@solid-primitives/keyed'
@@ -111,7 +111,9 @@ const [selectedMutationId, setSelectedMutationId] = createSignal<number | null>(
111
111
  )
112
112
  const [panelWidth, setPanelWidth] = createSignal(0)
113
113
 
114
- export type DevtoolsComponentType = Component<QueryDevtoolsProps>
114
+ export type DevtoolsComponentType = Component<QueryDevtoolsProps> & {
115
+ shadowDOMTarget?: ShadowRoot
116
+ }
115
117
 
116
118
  interface PiPProviderProps {
117
119
  children: JSX.Element
@@ -240,11 +242,15 @@ const PiPProvider = (props: PiPProviderProps) => {
240
242
 
241
243
  createEffect(() => {
242
244
  // Setup mutation observer for goober styles with id `_goober
243
- const gooberStyles = document.getElementById('_goober')
245
+ const gooberStyles = (
246
+ useQueryDevtoolsContext().shadowDOMTarget || document
247
+ ).querySelector('#_goober')
244
248
  const w = pipWindow()
245
249
  if (gooberStyles && w) {
246
250
  const observer = new MutationObserver(() => {
247
- const pip_style = w.document.getElementById('_goober')
251
+ const pip_style = (
252
+ useQueryDevtoolsContext().shadowDOMTarget || w.document
253
+ ).querySelector('#_goober')
248
254
  if (pip_style) {
249
255
  pip_style.textContent = gooberStyles.textContent
250
256
  }
@@ -313,8 +319,11 @@ export default DevtoolsComponent
313
319
 
314
320
  const Devtools: Component<DevtoolsPanelProps> = (props) => {
315
321
  const theme = useTheme()
322
+ const css = useQueryDevtoolsContext().shadowDOMTarget
323
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
324
+ : goober.css
316
325
  const styles = createMemo(() => {
317
- return theme() === 'dark' ? darkStyles : lightStyles
326
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
318
327
  })
319
328
 
320
329
  const pip = usePiPWindow()
@@ -470,8 +479,11 @@ const PiPPanel: Component<{
470
479
  }> = (props) => {
471
480
  const pip = usePiPWindow()
472
481
  const theme = useTheme()
482
+ const css = useQueryDevtoolsContext().shadowDOMTarget
483
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
484
+ : goober.css
473
485
  const styles = createMemo(() => {
474
- return theme() === 'dark' ? darkStyles : lightStyles
486
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
475
487
  })
476
488
 
477
489
  const getPanelDynamicStyles = () => {
@@ -534,8 +546,11 @@ const PiPPanel: Component<{
534
546
 
535
547
  const DevtoolsPanel: Component<DevtoolsPanelProps> = (props) => {
536
548
  const theme = useTheme()
549
+ const css = useQueryDevtoolsContext().shadowDOMTarget
550
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
551
+ : goober.css
537
552
  const styles = createMemo(() => {
538
- return theme() === 'dark' ? darkStyles : lightStyles
553
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
539
554
  })
540
555
 
541
556
  const [isResizing, setIsResizing] = createSignal(false)
@@ -736,8 +751,11 @@ const ContentView: Component<DevtoolsPanelProps> = (props) => {
736
751
 
737
752
  let containerRef!: HTMLDivElement
738
753
  const theme = useTheme()
754
+ const css = useQueryDevtoolsContext().shadowDOMTarget
755
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
756
+ : goober.css
739
757
  const styles = createMemo(() => {
740
- return theme() === 'dark' ? darkStyles : lightStyles
758
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
741
759
  })
742
760
 
743
761
  const pip = usePiPWindow()
@@ -1355,8 +1373,11 @@ const ContentView: Component<DevtoolsPanelProps> = (props) => {
1355
1373
 
1356
1374
  const QueryRow: Component<{ query: Query }> = (props) => {
1357
1375
  const theme = useTheme()
1376
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1377
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1378
+ : goober.css
1358
1379
  const styles = createMemo(() => {
1359
- return theme() === 'dark' ? darkStyles : lightStyles
1380
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1360
1381
  })
1361
1382
 
1362
1383
  const { colors, alpha } = tokens
@@ -1463,8 +1484,11 @@ const QueryRow: Component<{ query: Query }> = (props) => {
1463
1484
 
1464
1485
  const MutationRow: Component<{ mutation: Mutation }> = (props) => {
1465
1486
  const theme = useTheme()
1487
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1488
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1489
+ : goober.css
1466
1490
  const styles = createMemo(() => {
1467
- return theme() === 'dark' ? darkStyles : lightStyles
1491
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1468
1492
  })
1469
1493
 
1470
1494
  const { colors, alpha } = tokens
@@ -1606,8 +1630,11 @@ const QueryStatusCount: Component = () => {
1606
1630
  )
1607
1631
 
1608
1632
  const theme = useTheme()
1633
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1634
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1635
+ : goober.css
1609
1636
  const styles = createMemo(() => {
1610
- return theme() === 'dark' ? darkStyles : lightStyles
1637
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1611
1638
  })
1612
1639
 
1613
1640
  return (
@@ -1677,8 +1704,11 @@ const MutationStatusCount: Component = () => {
1677
1704
  )
1678
1705
 
1679
1706
  const theme = useTheme()
1707
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1708
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1709
+ : goober.css
1680
1710
  const styles = createMemo(() => {
1681
- return theme() === 'dark' ? darkStyles : lightStyles
1711
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1682
1712
  })
1683
1713
 
1684
1714
  return (
@@ -1695,8 +1725,11 @@ const MutationStatusCount: Component = () => {
1695
1725
 
1696
1726
  const QueryStatus: Component<QueryStatusProps> = (props) => {
1697
1727
  const theme = useTheme()
1728
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1729
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1730
+ : goober.css
1698
1731
  const styles = createMemo(() => {
1699
- return theme() === 'dark' ? darkStyles : lightStyles
1732
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1700
1733
  })
1701
1734
 
1702
1735
  const { colors, alpha } = tokens
@@ -1802,8 +1835,11 @@ const QueryStatus: Component<QueryStatusProps> = (props) => {
1802
1835
 
1803
1836
  const QueryDetails = () => {
1804
1837
  const theme = useTheme()
1838
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1839
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1840
+ : goober.css
1805
1841
  const styles = createMemo(() => {
1806
- return theme() === 'dark' ? darkStyles : lightStyles
1842
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1807
1843
  })
1808
1844
 
1809
1845
  const { colors } = tokens
@@ -2193,8 +2229,11 @@ const QueryDetails = () => {
2193
2229
 
2194
2230
  const MutationDetails = () => {
2195
2231
  const theme = useTheme()
2232
+ const css = useQueryDevtoolsContext().shadowDOMTarget
2233
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
2234
+ : goober.css
2196
2235
  const styles = createMemo(() => {
2197
- return theme() === 'dark' ? darkStyles : lightStyles
2236
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
2198
2237
  })
2199
2238
 
2200
2239
  const { colors } = tokens
@@ -2470,7 +2509,10 @@ const createSubscribeToMutationCacheBatcher = <T,>(
2470
2509
  return value
2471
2510
  }
2472
2511
 
2473
- const stylesFactory = (theme: 'light' | 'dark') => {
2512
+ const stylesFactory = (
2513
+ theme: 'light' | 'dark',
2514
+ css: (typeof goober)['css'],
2515
+ ) => {
2474
2516
  const { colors, font, size, alpha, shadow, border } = tokens
2475
2517
 
2476
2518
  const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
@@ -3397,5 +3439,5 @@ const stylesFactory = (theme: 'light' | 'dark') => {
3397
3439
  }
3398
3440
  }
3399
3441
 
3400
- const lightStyles = stylesFactory('light')
3401
- const darkStyles = stylesFactory('dark')
3442
+ const lightStyles = (css: (typeof goober)['css']) => stylesFactory('light', css)
3443
+ const darkStyles = (css: (typeof goober)['css']) => stylesFactory('dark', css)
package/src/index.tsx CHANGED
@@ -17,6 +17,7 @@ import type { Signal } from 'solid-js'
17
17
  export type { DevtoolsButtonPosition, DevtoolsPosition, DevToolsErrorType }
18
18
  export interface TanstackQueryDevtoolsConfig extends QueryDevtoolsProps {
19
19
  styleNonce?: string
20
+ shadowDOMTarget?: ShadowRoot
20
21
  }
21
22
 
22
23
  class TanstackQueryDevtools {
@@ -26,6 +27,7 @@ class TanstackQueryDevtools {
26
27
  #version: string
27
28
  #isMounted = false
28
29
  #styleNonce?: string
30
+ #shadowDOMTarget?: ShadowRoot
29
31
  #buttonPosition: Signal<DevtoolsButtonPosition | undefined>
30
32
  #position: Signal<DevtoolsPosition | undefined>
31
33
  #initialIsOpen: Signal<boolean | undefined>
@@ -44,12 +46,14 @@ class TanstackQueryDevtools {
44
46
  initialIsOpen,
45
47
  errorTypes,
46
48
  styleNonce,
49
+ shadowDOMTarget,
47
50
  } = config
48
51
  this.#client = createSignal(client)
49
52
  this.#queryFlavor = queryFlavor
50
53
  this.#version = version
51
54
  this.#onlineManager = onlineManager
52
55
  this.#styleNonce = styleNonce
56
+ this.#shadowDOMTarget = shadowDOMTarget
53
57
  this.#buttonPosition = createSignal(buttonPosition)
54
58
  this.#position = createSignal(position)
55
59
  this.#initialIsOpen = createSignal(initialIsOpen)
@@ -95,12 +99,13 @@ class TanstackQueryDevtools {
95
99
  this.#Component = Devtools
96
100
  }
97
101
 
98
- setupStyleSheet(this.#styleNonce)
102
+ setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget)
99
103
  return (
100
104
  <Devtools
101
105
  queryFlavor={this.#queryFlavor}
102
106
  version={this.#version}
103
107
  onlineManager={this.#onlineManager}
108
+ shadowDOMTarget={this.#shadowDOMTarget}
104
109
  {...{
105
110
  get client() {
106
111
  return queryClient()
package/src/utils.tsx CHANGED
@@ -304,14 +304,20 @@ export const deleteNestedDataByPath = (
304
304
 
305
305
  // Sets up the goober stylesheet
306
306
  // Adds a nonce to the style tag if needed
307
- export const setupStyleSheet = (nonce?: string) => {
307
+ export const setupStyleSheet = (nonce?: string, target?: ShadowRoot) => {
308
308
  if (!nonce) return
309
- const styleExists = document.querySelector('#_goober')
309
+ const styleExists =
310
+ document.querySelector('#_goober') || target?.querySelector('#_goober')
311
+
310
312
  if (styleExists) return
311
313
  const styleTag = document.createElement('style')
312
314
  const textNode = document.createTextNode('')
313
315
  styleTag.appendChild(textNode)
314
316
  styleTag.id = '_goober'
315
317
  styleTag.setAttribute('nonce', nonce)
316
- document.head.appendChild(styleTag)
318
+ if (target) {
319
+ target.appendChild(styleTag)
320
+ } else {
321
+ document.head.appendChild(styleTag)
322
+ }
317
323
  }