@tanstack/query-devtools 5.23.0 → 5.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/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/XKKA3NOX.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/QUGYIDRL.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/AZNCIVVX.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/6EDF3GZQ.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.23.0",
3
+ "version": "5.27.0",
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.26.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,14 +12,14 @@ 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'
19
19
  import { createLocalStorage } from '@solid-primitives/storage'
20
20
  import { createResizeObserver } from '@solid-primitives/resize-observer'
21
21
  import { DropdownMenu, RadioGroup } from '@kobalte/core'
22
- import { Portal, delegateEvents } from 'solid-js/web'
22
+ import { Portal, clearDelegatedEvents, delegateEvents } from 'solid-js/web'
23
23
  import { tokens } from './theme'
24
24
  import {
25
25
  convertRemToPixels,
@@ -111,10 +111,14 @@ 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
120
+ localStore: StorageObject<string>
121
+ setLocalStore: StorageSetter<string, unknown>
118
122
  }
119
123
 
120
124
  type PiPContextType = {
@@ -147,17 +151,31 @@ const PiPProvider = (props: PiPProviderProps) => {
147
151
  return
148
152
  }
149
153
 
150
- const pip = window.open('', '', `width=${width},height=${height},popup`)
154
+ const pip = window.open(
155
+ '',
156
+ 'TSQD-Devtools-Panel',
157
+ `width=${width},height=${height},popup`,
158
+ )
159
+
151
160
  if (!pip) {
152
161
  throw new Error(
153
162
  'Failed to open popup. Please allow popups for this site to view the devtools in picture-in-picture mode.',
154
163
  )
155
164
  }
165
+
166
+ // Remove existing styles
167
+ pip.document.head.innerHTML = ''
168
+ // Remove existing body
169
+ pip.document.body.innerHTML = ''
170
+ // Clear Delegated Events
171
+ clearDelegatedEvents(pip.document)
172
+
156
173
  pip.document.title = 'TanStack Query Devtools'
157
174
  pip.document.body.style.margin = '0'
158
175
 
159
176
  // Detect when window is closed by user
160
177
  pip.addEventListener('pagehide', () => {
178
+ props.setLocalStore('pip_open', 'false')
161
179
  setPipWindow(null)
162
180
  })
163
181
 
@@ -208,29 +226,31 @@ const PiPProvider = (props: PiPProviderProps) => {
208
226
  ],
209
227
  pip.document,
210
228
  )
229
+ props.setLocalStore('pip_open', 'true')
211
230
  setPipWindow(pip)
212
231
  }
213
232
 
214
233
  createEffect(() => {
215
- // Close pipWindow when the main window is closed
216
- const closePipWindowOnUnload = () => {
217
- closePipWindow()
234
+ const pip_open = (props.localStore.pip_open ?? 'false') as 'true' | 'false'
235
+ if (pip_open === 'true') {
236
+ requestPipWindow(
237
+ Number(window.innerWidth),
238
+ Number(props.localStore.height || DEFAULT_HEIGHT),
239
+ )
218
240
  }
219
-
220
- window.addEventListener('beforeunload', closePipWindowOnUnload)
221
-
222
- onCleanup(() => {
223
- window.removeEventListener('beforeunload', closePipWindowOnUnload)
224
- })
225
241
  })
226
242
 
227
243
  createEffect(() => {
228
244
  // Setup mutation observer for goober styles with id `_goober
229
- const gooberStyles = document.getElementById('_goober')
245
+ const gooberStyles = (
246
+ useQueryDevtoolsContext().shadowDOMTarget || document
247
+ ).querySelector('#_goober')
230
248
  const w = pipWindow()
231
249
  if (gooberStyles && w) {
232
250
  const observer = new MutationObserver(() => {
233
- const pip_style = w.document.getElementById('_goober')
251
+ const pip_style = (
252
+ useQueryDevtoolsContext().shadowDOMTarget || w.document
253
+ ).querySelector('#_goober')
234
254
  if (pip_style) {
235
255
  pip_style.textContent = gooberStyles.textContent
236
256
  }
@@ -286,7 +306,7 @@ const DevtoolsComponent: DevtoolsComponentType = (props) => {
286
306
 
287
307
  return (
288
308
  <QueryDevtoolsContext.Provider value={props}>
289
- <PiPProvider>
309
+ <PiPProvider localStore={localStore} setLocalStore={setLocalStore}>
290
310
  <ThemeContext.Provider value={theme}>
291
311
  <Devtools localStore={localStore} setLocalStore={setLocalStore} />
292
312
  </ThemeContext.Provider>
@@ -299,8 +319,11 @@ export default DevtoolsComponent
299
319
 
300
320
  const Devtools: Component<DevtoolsPanelProps> = (props) => {
301
321
  const theme = useTheme()
322
+ const css = useQueryDevtoolsContext().shadowDOMTarget
323
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
324
+ : goober.css
302
325
  const styles = createMemo(() => {
303
- return theme() === 'dark' ? darkStyles : lightStyles
326
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
304
327
  })
305
328
 
306
329
  const pip = usePiPWindow()
@@ -358,9 +381,13 @@ const Devtools: Component<DevtoolsPanelProps> = (props) => {
358
381
  })
359
382
  })
360
383
 
384
+ const pip_open = createMemo(
385
+ () => (props.localStore.pip_open ?? 'false') as 'true' | 'false',
386
+ )
387
+
361
388
  return (
362
389
  <>
363
- <Show when={pip().pipWindow}>
390
+ <Show when={pip().pipWindow && pip_open() == 'true'}>
364
391
  <Portal mount={pip().pipWindow?.document.body}>
365
392
  <PiPPanel>
366
393
  <ContentView
@@ -413,7 +440,7 @@ const Devtools: Component<DevtoolsPanelProps> = (props) => {
413
440
  ref={transitionsContainerRef}
414
441
  >
415
442
  <TransitionGroup name="tsqd-panel-transition">
416
- <Show when={isOpen() && !pip().pipWindow}>
443
+ <Show when={isOpen() && !pip().pipWindow && pip_open() == 'false'}>
417
444
  <DevtoolsPanel
418
445
  localStore={props.localStore}
419
446
  setLocalStore={props.setLocalStore}
@@ -452,8 +479,11 @@ const PiPPanel: Component<{
452
479
  }> = (props) => {
453
480
  const pip = usePiPWindow()
454
481
  const theme = useTheme()
482
+ const css = useQueryDevtoolsContext().shadowDOMTarget
483
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
484
+ : goober.css
455
485
  const styles = createMemo(() => {
456
- return theme() === 'dark' ? darkStyles : lightStyles
486
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
457
487
  })
458
488
 
459
489
  const getPanelDynamicStyles = () => {
@@ -480,6 +510,7 @@ const PiPPanel: Component<{
480
510
  }
481
511
  if (win) {
482
512
  win.addEventListener('resize', resizeCB)
513
+ resizeCB()
483
514
  }
484
515
 
485
516
  onCleanup(() => {
@@ -515,8 +546,11 @@ const PiPPanel: Component<{
515
546
 
516
547
  const DevtoolsPanel: Component<DevtoolsPanelProps> = (props) => {
517
548
  const theme = useTheme()
549
+ const css = useQueryDevtoolsContext().shadowDOMTarget
550
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
551
+ : goober.css
518
552
  const styles = createMemo(() => {
519
- return theme() === 'dark' ? darkStyles : lightStyles
553
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
520
554
  })
521
555
 
522
556
  const [isResizing, setIsResizing] = createSignal(false)
@@ -717,8 +751,11 @@ const ContentView: Component<DevtoolsPanelProps> = (props) => {
717
751
 
718
752
  let containerRef!: HTMLDivElement
719
753
  const theme = useTheme()
754
+ const css = useQueryDevtoolsContext().shadowDOMTarget
755
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
756
+ : goober.css
720
757
  const styles = createMemo(() => {
721
- return theme() === 'dark' ? darkStyles : lightStyles
758
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
722
759
  })
723
760
 
724
761
  const pip = usePiPWindow()
@@ -1336,8 +1373,11 @@ const ContentView: Component<DevtoolsPanelProps> = (props) => {
1336
1373
 
1337
1374
  const QueryRow: Component<{ query: Query }> = (props) => {
1338
1375
  const theme = useTheme()
1376
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1377
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1378
+ : goober.css
1339
1379
  const styles = createMemo(() => {
1340
- return theme() === 'dark' ? darkStyles : lightStyles
1380
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1341
1381
  })
1342
1382
 
1343
1383
  const { colors, alpha } = tokens
@@ -1444,8 +1484,11 @@ const QueryRow: Component<{ query: Query }> = (props) => {
1444
1484
 
1445
1485
  const MutationRow: Component<{ mutation: Mutation }> = (props) => {
1446
1486
  const theme = useTheme()
1487
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1488
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1489
+ : goober.css
1447
1490
  const styles = createMemo(() => {
1448
- return theme() === 'dark' ? darkStyles : lightStyles
1491
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1449
1492
  })
1450
1493
 
1451
1494
  const { colors, alpha } = tokens
@@ -1587,8 +1630,11 @@ const QueryStatusCount: Component = () => {
1587
1630
  )
1588
1631
 
1589
1632
  const theme = useTheme()
1633
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1634
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1635
+ : goober.css
1590
1636
  const styles = createMemo(() => {
1591
- return theme() === 'dark' ? darkStyles : lightStyles
1637
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1592
1638
  })
1593
1639
 
1594
1640
  return (
@@ -1658,8 +1704,11 @@ const MutationStatusCount: Component = () => {
1658
1704
  )
1659
1705
 
1660
1706
  const theme = useTheme()
1707
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1708
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1709
+ : goober.css
1661
1710
  const styles = createMemo(() => {
1662
- return theme() === 'dark' ? darkStyles : lightStyles
1711
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1663
1712
  })
1664
1713
 
1665
1714
  return (
@@ -1676,8 +1725,11 @@ const MutationStatusCount: Component = () => {
1676
1725
 
1677
1726
  const QueryStatus: Component<QueryStatusProps> = (props) => {
1678
1727
  const theme = useTheme()
1728
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1729
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1730
+ : goober.css
1679
1731
  const styles = createMemo(() => {
1680
- return theme() === 'dark' ? darkStyles : lightStyles
1732
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1681
1733
  })
1682
1734
 
1683
1735
  const { colors, alpha } = tokens
@@ -1783,8 +1835,11 @@ const QueryStatus: Component<QueryStatusProps> = (props) => {
1783
1835
 
1784
1836
  const QueryDetails = () => {
1785
1837
  const theme = useTheme()
1838
+ const css = useQueryDevtoolsContext().shadowDOMTarget
1839
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
1840
+ : goober.css
1786
1841
  const styles = createMemo(() => {
1787
- return theme() === 'dark' ? darkStyles : lightStyles
1842
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
1788
1843
  })
1789
1844
 
1790
1845
  const { colors } = tokens
@@ -2174,8 +2229,11 @@ const QueryDetails = () => {
2174
2229
 
2175
2230
  const MutationDetails = () => {
2176
2231
  const theme = useTheme()
2232
+ const css = useQueryDevtoolsContext().shadowDOMTarget
2233
+ ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
2234
+ : goober.css
2177
2235
  const styles = createMemo(() => {
2178
- return theme() === 'dark' ? darkStyles : lightStyles
2236
+ return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
2179
2237
  })
2180
2238
 
2181
2239
  const { colors } = tokens
@@ -2451,7 +2509,10 @@ const createSubscribeToMutationCacheBatcher = <T,>(
2451
2509
  return value
2452
2510
  }
2453
2511
 
2454
- const stylesFactory = (theme: 'light' | 'dark') => {
2512
+ const stylesFactory = (
2513
+ theme: 'light' | 'dark',
2514
+ css: (typeof goober)['css'],
2515
+ ) => {
2455
2516
  const { colors, font, size, alpha, shadow, border } = tokens
2456
2517
 
2457
2518
  const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
@@ -3378,5 +3439,5 @@ const stylesFactory = (theme: 'light' | 'dark') => {
3378
3439
  }
3379
3440
  }
3380
3441
 
3381
- const lightStyles = stylesFactory('light')
3382
- 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
  }