@tanstack/query-devtools 5.108.1 → 5.108.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.
- package/build/{DevtoolsComponent-e0KiEsCw.js → DevtoolsComponent-BBTUIw3a.js} +2 -2
- package/build/DevtoolsComponent-CqaQIX_J.cjs +45 -0
- package/build/DevtoolsComponent-KaCCT4mO.js +3 -0
- package/build/{DevtoolsComponent-CJG_H2ix.js.map → DevtoolsComponent-KaCCT4mO.js.map} +1 -1
- package/build/DevtoolsComponent-NOj66Dgq.cjs +2 -0
- package/build/DevtoolsPanelComponent-1en47poS.js +3 -0
- package/build/{DevtoolsPanelComponent-By2KdGQW.js.map → DevtoolsPanelComponent-1en47poS.js.map} +1 -1
- package/build/DevtoolsPanelComponent-C6-KUZMt.cjs +2 -0
- package/build/{DevtoolsPanelComponent-D9e2k2ne.js → DevtoolsPanelComponent-DA61oPj3.js} +2 -2
- package/build/DevtoolsPanelComponent-DHv0HzmU.cjs +52 -0
- package/build/{DevtoolsSubscriptionsProvider-CtZ2t7t0.js → DevtoolsSubscriptionsProvider-Cl_PUkf2.js} +1636 -2295
- package/build/{DevtoolsSubscriptionsProvider-D9zXQvDq.cjs → DevtoolsSubscriptionsProvider-DC-V1gB8.cjs} +2520 -3173
- package/build/DevtoolsSubscriptionsProvider-DpHm90Dj.js +10 -0
- package/build/DevtoolsSubscriptionsProvider-DpHm90Dj.js.map +1 -0
- package/build/DevtoolsSubscriptionsProvider-gZwQB0lN.cjs +9 -0
- package/build/dev.cjs +30 -30
- package/build/dev.js +11 -11
- package/build/index.cjs +1 -1
- package/build/index.d.cts +26 -10
- package/build/index.d.cts.map +1 -1
- package/build/index.d.ts +26 -10
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/{utils-CzP8C7c0.cjs → web-BD1Jlb-z.cjs} +43 -1036
- package/build/web-BRnEZuZ3.cjs +2 -0
- package/build/{utils-D7iZi04l.js → web-BZdVkndN.js} +42 -939
- package/build/web-da-lPyZC.js +3 -0
- package/build/web-da-lPyZC.js.map +1 -0
- package/package.json +3 -5
- package/src/Devtools.tsx +127 -1712
- package/src/Explorer.tsx +78 -285
- package/src/TanstackQueryDevtools.tsx +19 -10
- package/src/TanstackQueryDevtoolsPanel.tsx +19 -10
- package/src/contexts/PiPContext.tsx +4 -31
- package/src/contexts/types.ts +2 -2
- package/src/global.d.ts +1 -0
- package/src/styles.css +2158 -0
- package/src/styles.ts +49 -0
- package/src/utils.tsx +0 -23
- package/build/DevtoolsComponent-CJG_H2ix.js +0 -3
- package/build/DevtoolsComponent-CJb6tQE-.cjs +0 -2
- package/build/DevtoolsComponent-KSaqMRUY.cjs +0 -45
- package/build/DevtoolsPanelComponent-BXsLpTv2.cjs +0 -2
- package/build/DevtoolsPanelComponent-By2KdGQW.js +0 -3
- package/build/DevtoolsPanelComponent-CpAkTR9C.cjs +0 -52
- package/build/DevtoolsSubscriptionsProvider-CBn1lU_l.cjs +0 -1291
- package/build/DevtoolsSubscriptionsProvider-DQhbYH9U.js +0 -1292
- package/build/DevtoolsSubscriptionsProvider-DQhbYH9U.js.map +0 -1
- package/build/utils-DC2pN79q.js +0 -3
- package/build/utils-DC2pN79q.js.map +0 -1
- package/build/utils-DJl-N7L2.cjs +0 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createSignal, lazy } from 'solid-js'
|
|
2
|
-
import { render } from 'solid-js/web'
|
|
3
|
-
import { setupStyleSheet } from './utils'
|
|
2
|
+
import { render, setTrustedTypesPolicy } from 'solid-js/web'
|
|
4
3
|
import type {
|
|
5
4
|
QueryClient,
|
|
6
5
|
onlineManager as TOnlineManager,
|
|
@@ -20,15 +19,21 @@ import type {
|
|
|
20
19
|
*/
|
|
21
20
|
export interface TanstackQueryDevtoolsPanelConfig extends QueryDevtoolsProps {
|
|
22
21
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* @deprecated The devtools no longer add a `<style>` element, so they need no nonce. This option
|
|
23
|
+
* does nothing.
|
|
25
24
|
*/
|
|
26
25
|
styleNonce?: string
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* The shadow root to add the devtools styles to. By default, the styles are added to the shadow
|
|
28
|
+
* root the devtools render in, or to the document when they do not render in a shadow root.
|
|
30
29
|
*/
|
|
31
30
|
shadowDOMTarget?: ShadowRoot
|
|
31
|
+
/**
|
|
32
|
+
* The Trusted Types policy the devtools use to create their HTML templates.
|
|
33
|
+
* Pass one when your page enforces `require-trusted-types-for 'script'`.
|
|
34
|
+
* The devtools only pass it their own markup.
|
|
35
|
+
*/
|
|
36
|
+
trustedTypesPolicy?: { createHTML: (html: string) => unknown }
|
|
32
37
|
/**
|
|
33
38
|
* Callback function that is called when the devtools panel is closed.
|
|
34
39
|
*/
|
|
@@ -41,8 +46,8 @@ class TanstackQueryDevtoolsPanel {
|
|
|
41
46
|
#queryFlavor: string
|
|
42
47
|
#version: string
|
|
43
48
|
#isMounted = false
|
|
44
|
-
#styleNonce?: string
|
|
45
49
|
#shadowDOMTarget?: ShadowRoot
|
|
50
|
+
#trustedTypesPolicy?: { createHTML: (html: string) => unknown }
|
|
46
51
|
#buttonPosition: Signal<DevtoolsButtonPosition | undefined>
|
|
47
52
|
#position: Signal<DevtoolsPosition | undefined>
|
|
48
53
|
#initialIsOpen: Signal<boolean | undefined>
|
|
@@ -63,8 +68,8 @@ class TanstackQueryDevtoolsPanel {
|
|
|
63
68
|
position,
|
|
64
69
|
initialIsOpen,
|
|
65
70
|
errorTypes,
|
|
66
|
-
styleNonce,
|
|
67
71
|
shadowDOMTarget,
|
|
72
|
+
trustedTypesPolicy,
|
|
68
73
|
onClose,
|
|
69
74
|
hideDisabledQueries,
|
|
70
75
|
theme,
|
|
@@ -73,8 +78,8 @@ class TanstackQueryDevtoolsPanel {
|
|
|
73
78
|
this.#queryFlavor = queryFlavor
|
|
74
79
|
this.#version = version
|
|
75
80
|
this.#onlineManager = onlineManager
|
|
76
|
-
this.#styleNonce = styleNonce
|
|
77
81
|
this.#shadowDOMTarget = shadowDOMTarget
|
|
82
|
+
this.#trustedTypesPolicy = trustedTypesPolicy
|
|
78
83
|
this.#buttonPosition = createSignal(buttonPosition)
|
|
79
84
|
this.#position = createSignal(position)
|
|
80
85
|
this.#initialIsOpen = createSignal(initialIsOpen)
|
|
@@ -116,6 +121,11 @@ class TanstackQueryDevtoolsPanel {
|
|
|
116
121
|
if (this.#isMounted) {
|
|
117
122
|
throw new Error('Devtools is already mounted')
|
|
118
123
|
}
|
|
124
|
+
// Solid creates each template once, so set the policy before rendering.
|
|
125
|
+
// It is shared by every devtools instance, so never reset it.
|
|
126
|
+
if (this.#trustedTypesPolicy) {
|
|
127
|
+
setTrustedTypesPolicy(this.#trustedTypesPolicy)
|
|
128
|
+
}
|
|
119
129
|
const dispose = render(() => {
|
|
120
130
|
const [btnPosition] = this.#buttonPosition
|
|
121
131
|
const [pos] = this.#position
|
|
@@ -134,7 +144,6 @@ class TanstackQueryDevtoolsPanel {
|
|
|
134
144
|
this.#Component = Devtools
|
|
135
145
|
}
|
|
136
146
|
|
|
137
|
-
setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget)
|
|
138
147
|
return (
|
|
139
148
|
<Devtools
|
|
140
149
|
queryFlavor={this.#queryFlavor}
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
createEffect,
|
|
4
4
|
createMemo,
|
|
5
5
|
createSignal,
|
|
6
|
-
onCleanup,
|
|
7
6
|
useContext,
|
|
8
7
|
} from 'solid-js'
|
|
9
8
|
import { clearDelegatedEvents, delegateEvents } from 'solid-js/web'
|
|
@@ -73,10 +72,10 @@ export const PiPProvider = (props: PiPProviderProps) => {
|
|
|
73
72
|
)
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
// Remove existing styles
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
pip.document.body.
|
|
75
|
+
// Remove existing styles and body. `replaceChildren` instead of
|
|
76
|
+
// `innerHTML = ''`, which Trusted Types block.
|
|
77
|
+
pip.document.head.replaceChildren()
|
|
78
|
+
pip.document.body.replaceChildren()
|
|
80
79
|
// Clear Delegated Events
|
|
81
80
|
clearDelegatedEvents(pip.document)
|
|
82
81
|
|
|
@@ -162,32 +161,6 @@ export const PiPProvider = (props: PiPProviderProps) => {
|
|
|
162
161
|
}
|
|
163
162
|
})
|
|
164
163
|
|
|
165
|
-
createEffect(() => {
|
|
166
|
-
// Setup mutation observer for goober styles with id `_goober
|
|
167
|
-
const gooberStyles = (
|
|
168
|
-
useQueryDevtoolsContext().shadowDOMTarget || document
|
|
169
|
-
).querySelector('#_goober')
|
|
170
|
-
const w = pipWindow()
|
|
171
|
-
if (gooberStyles && w) {
|
|
172
|
-
const observer = new MutationObserver(() => {
|
|
173
|
-
const pip_style = (
|
|
174
|
-
useQueryDevtoolsContext().shadowDOMTarget || w.document
|
|
175
|
-
).querySelector('#_goober')
|
|
176
|
-
if (pip_style) {
|
|
177
|
-
pip_style.textContent = gooberStyles.textContent
|
|
178
|
-
}
|
|
179
|
-
})
|
|
180
|
-
observer.observe(gooberStyles, {
|
|
181
|
-
childList: true, // observe direct children
|
|
182
|
-
subtree: true, // and lower descendants too
|
|
183
|
-
characterDataOldValue: true, // pass old data to callback
|
|
184
|
-
})
|
|
185
|
-
onCleanup(() => {
|
|
186
|
-
observer.disconnect()
|
|
187
|
-
})
|
|
188
|
-
}
|
|
189
|
-
})
|
|
190
|
-
|
|
191
164
|
const value = createMemo(() => ({
|
|
192
165
|
pipWindow: pipWindow(),
|
|
193
166
|
requestPipWindow,
|
package/src/contexts/types.ts
CHANGED
|
@@ -81,8 +81,8 @@ export interface QueryDevtoolsProps {
|
|
|
81
81
|
*/
|
|
82
82
|
errorTypes?: Array<DevtoolsErrorType>
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
85
|
-
*
|
|
84
|
+
* The shadow root to add the devtools styles to. By default, the styles are added to the shadow
|
|
85
|
+
* root the devtools render in, or to the document when they do not render in a shadow root.
|
|
86
86
|
*/
|
|
87
87
|
shadowDOMTarget?: ShadowRoot
|
|
88
88
|
/**
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|