@tanstack/svelte-query-devtools 6.1.6 → 6.1.8
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/dist/Devtools.svelte +108 -0
- package/dist/Devtools.svelte.d.ts +44 -0
- package/dist/Devtools.svelte.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte'
|
|
3
|
+
import { BROWSER, DEV } from 'esm-env'
|
|
4
|
+
import { onlineManager, useQueryClient } from '@tanstack/svelte-query'
|
|
5
|
+
import type { QueryClient } from '@tanstack/svelte-query'
|
|
6
|
+
import type {
|
|
7
|
+
DevtoolsButtonPosition,
|
|
8
|
+
DevtoolsErrorType,
|
|
9
|
+
DevtoolsPosition,
|
|
10
|
+
TanstackQueryDevtools,
|
|
11
|
+
} from '@tanstack/query-devtools'
|
|
12
|
+
|
|
13
|
+
interface DevtoolsOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Set this true if you want the dev tools to default to being open
|
|
16
|
+
*/
|
|
17
|
+
initialIsOpen?: boolean
|
|
18
|
+
/**
|
|
19
|
+
* The position of the TanStack Query logo to open and close the devtools panel.
|
|
20
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
21
|
+
* Defaults to 'bottom-right'.
|
|
22
|
+
*/
|
|
23
|
+
buttonPosition?: DevtoolsButtonPosition
|
|
24
|
+
/**
|
|
25
|
+
* The position of the TanStack Query devtools panel.
|
|
26
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
27
|
+
* Defaults to 'bottom'.
|
|
28
|
+
*/
|
|
29
|
+
position?: DevtoolsPosition
|
|
30
|
+
/**
|
|
31
|
+
* Custom instance of QueryClient
|
|
32
|
+
*/
|
|
33
|
+
client?: QueryClient
|
|
34
|
+
/**
|
|
35
|
+
* Use this so you can define custom errors that can be shown in the devtools.
|
|
36
|
+
*/
|
|
37
|
+
errorTypes?: Array<DevtoolsErrorType>
|
|
38
|
+
/**
|
|
39
|
+
* Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
|
|
40
|
+
*/
|
|
41
|
+
styleNonce?: string
|
|
42
|
+
/**
|
|
43
|
+
* Use this so you can attach the devtool's styles to specific element in the DOM.
|
|
44
|
+
*/
|
|
45
|
+
shadowDOMTarget?: ShadowRoot
|
|
46
|
+
/**
|
|
47
|
+
* Set this to true to hide disabled queries from the devtools panel.
|
|
48
|
+
*/
|
|
49
|
+
hideDisabledQueries?: boolean
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let {
|
|
53
|
+
initialIsOpen = false,
|
|
54
|
+
buttonPosition = 'bottom-right',
|
|
55
|
+
position = 'bottom',
|
|
56
|
+
client = useQueryClient(),
|
|
57
|
+
errorTypes = [],
|
|
58
|
+
styleNonce = undefined,
|
|
59
|
+
shadowDOMTarget = undefined,
|
|
60
|
+
hideDisabledQueries = false,
|
|
61
|
+
}: DevtoolsOptions = $props()
|
|
62
|
+
|
|
63
|
+
let ref: HTMLDivElement
|
|
64
|
+
let devtools: TanstackQueryDevtools | undefined
|
|
65
|
+
|
|
66
|
+
if (DEV && BROWSER) {
|
|
67
|
+
onMount(() => {
|
|
68
|
+
import('@tanstack/query-devtools').then((m) => {
|
|
69
|
+
const QueryDevtools = m.TanstackQueryDevtools
|
|
70
|
+
|
|
71
|
+
devtools = new QueryDevtools({
|
|
72
|
+
client,
|
|
73
|
+
queryFlavor: 'Svelte Query',
|
|
74
|
+
version: '5',
|
|
75
|
+
onlineManager,
|
|
76
|
+
buttonPosition,
|
|
77
|
+
position,
|
|
78
|
+
initialIsOpen,
|
|
79
|
+
errorTypes,
|
|
80
|
+
styleNonce,
|
|
81
|
+
shadowDOMTarget,
|
|
82
|
+
hideDisabledQueries,
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
devtools.mount(ref)
|
|
86
|
+
})
|
|
87
|
+
return () => devtools?.unmount()
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
$effect(() => {
|
|
91
|
+
devtools?.setButtonPosition(buttonPosition)
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
$effect(() => {
|
|
95
|
+
devtools?.setPosition(position)
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
$effect(() => {
|
|
99
|
+
devtools?.setInitialIsOpen(initialIsOpen)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
$effect(() => {
|
|
103
|
+
devtools?.setErrorTypes(errorTypes)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<div class="tsqd-parent-container" bind:this={ref}></div>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { QueryClient } from '@tanstack/svelte-query';
|
|
2
|
+
import type { DevtoolsButtonPosition, DevtoolsErrorType, DevtoolsPosition } from '@tanstack/query-devtools';
|
|
3
|
+
interface DevtoolsOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Set this true if you want the dev tools to default to being open
|
|
6
|
+
*/
|
|
7
|
+
initialIsOpen?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* The position of the TanStack Query logo to open and close the devtools panel.
|
|
10
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
11
|
+
* Defaults to 'bottom-right'.
|
|
12
|
+
*/
|
|
13
|
+
buttonPosition?: DevtoolsButtonPosition;
|
|
14
|
+
/**
|
|
15
|
+
* The position of the TanStack Query devtools panel.
|
|
16
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
17
|
+
* Defaults to 'bottom'.
|
|
18
|
+
*/
|
|
19
|
+
position?: DevtoolsPosition;
|
|
20
|
+
/**
|
|
21
|
+
* Custom instance of QueryClient
|
|
22
|
+
*/
|
|
23
|
+
client?: QueryClient;
|
|
24
|
+
/**
|
|
25
|
+
* Use this so you can define custom errors that can be shown in the devtools.
|
|
26
|
+
*/
|
|
27
|
+
errorTypes?: Array<DevtoolsErrorType>;
|
|
28
|
+
/**
|
|
29
|
+
* Use this to pass a nonce to the style tag that is added to the document head. This is useful if you are using a Content Security Policy (CSP) nonce to allow inline styles.
|
|
30
|
+
*/
|
|
31
|
+
styleNonce?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Use this so you can attach the devtool's styles to specific element in the DOM.
|
|
34
|
+
*/
|
|
35
|
+
shadowDOMTarget?: ShadowRoot;
|
|
36
|
+
/**
|
|
37
|
+
* Set this to true to hide disabled queries from the devtools panel.
|
|
38
|
+
*/
|
|
39
|
+
hideDisabledQueries?: boolean;
|
|
40
|
+
}
|
|
41
|
+
declare const Devtools: import("svelte").Component<DevtoolsOptions, {}, "">;
|
|
42
|
+
type Devtools = ReturnType<typeof Devtools>;
|
|
43
|
+
export default Devtools;
|
|
44
|
+
//# sourceMappingURL=Devtools.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Devtools.svelte.d.ts","sourceRoot":"","sources":["../src/Devtools.svelte.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EACR,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,0BAA0B,CAAC;AAGlC,UAAU,eAAe;IACvB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,sBAAsB,CAAA;IACvC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;IACrC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,eAAe,CAAC,EAAE,UAAU,CAAA;IAC5B;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAqEH,QAAA,MAAM,QAAQ,qDAAwC,CAAC;AACvD,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SvelteQueryDevtools } from './Devtools.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/svelte-query-devtools",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.8",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack/svelte-query cache",
|
|
5
5
|
"author": "Lachlan Collins",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"esm-env": "^1.2.1",
|
|
42
|
-
"@tanstack/query-devtools": "5.
|
|
42
|
+
"@tanstack/query-devtools": "5.95.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@sveltejs/package": "^2.4.0",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"svelte": "^5.39.3",
|
|
50
50
|
"svelte-check": "^4.4.5",
|
|
51
51
|
"typescript": "5.9.3",
|
|
52
|
-
"@tanstack/svelte-query": "6.1.
|
|
52
|
+
"@tanstack/svelte-query": "6.1.8"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"svelte": "^5.25.0",
|
|
56
|
-
"@tanstack/svelte-query": "^6.1.
|
|
56
|
+
"@tanstack/svelte-query": "^6.1.8"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"clean": "premove ./dist ./coverage ./.svelte-kit ./dist-ts",
|