@tanstack/svelte-query-devtools 5.90.2 → 6.0.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.
@@ -10,14 +10,55 @@
10
10
  TanstackQueryDevtools,
11
11
  } from '@tanstack/query-devtools'
12
12
 
13
- export let initialIsOpen = false
14
- export let buttonPosition: DevtoolsButtonPosition = 'bottom-right'
15
- export let position: DevtoolsPosition = 'bottom'
16
- export let client: QueryClient = useQueryClient()
17
- export let errorTypes: Array<DevtoolsErrorType> = []
18
- export let styleNonce: string | undefined = undefined
19
- export let shadowDOMTarget: ShadowRoot | undefined = undefined
20
- export let hideDisabledQueries: boolean = false
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()
21
62
 
22
63
  let ref: HTMLDivElement
23
64
  let devtools: TanstackQueryDevtools | undefined
@@ -43,20 +84,24 @@
43
84
 
44
85
  devtools.mount(ref)
45
86
  })
87
+ return () => devtools?.unmount()
88
+ })
46
89
 
47
- return () => {
48
- devtools?.unmount()
49
- }
90
+ $effect(() => {
91
+ devtools?.setButtonPosition(buttonPosition)
50
92
  })
51
- }
52
93
 
53
- $: {
54
- if (devtools) {
55
- devtools.setButtonPosition(buttonPosition)
56
- devtools.setPosition(position)
57
- devtools.setInitialIsOpen(initialIsOpen)
58
- devtools.setErrorTypes(errorTypes)
59
- }
94
+ $effect(() => {
95
+ devtools?.setPosition(position)
96
+ })
97
+
98
+ $effect(() => {
99
+ devtools?.setInitialIsOpen(initialIsOpen)
100
+ })
101
+
102
+ $effect(() => {
103
+ devtools?.setErrorTypes(errorTypes)
104
+ })
60
105
  }
61
106
  </script>
62
107
 
@@ -1,26 +1,44 @@
1
- import { SvelteComponentTyped } from "svelte";
2
1
  import type { QueryClient } from '@tanstack/svelte-query';
3
2
  import type { DevtoolsButtonPosition, DevtoolsErrorType, DevtoolsPosition } from '@tanstack/query-devtools';
4
- declare const __propDef: {
5
- props: {
6
- initialIsOpen?: boolean;
7
- buttonPosition?: DevtoolsButtonPosition;
8
- position?: DevtoolsPosition;
9
- client?: QueryClient;
10
- errorTypes?: Array<DevtoolsErrorType>;
11
- styleNonce?: string | undefined;
12
- shadowDOMTarget?: ShadowRoot | undefined;
13
- hideDisabledQueries?: boolean;
14
- };
15
- events: {
16
- [evt: string]: CustomEvent<any>;
17
- };
18
- slots: {};
19
- };
20
- export type DevtoolsProps = typeof __propDef.props;
21
- export type DevtoolsEvents = typeof __propDef.events;
22
- export type DevtoolsSlots = typeof __propDef.slots;
23
- export default class Devtools extends SvelteComponentTyped<DevtoolsProps, DevtoolsEvents, DevtoolsSlots> {
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;
24
40
  }
25
- export {};
41
+ declare const Devtools: import("svelte").Component<DevtoolsOptions, {}, "">;
42
+ type Devtools = ReturnType<typeof Devtools>;
43
+ export default Devtools;
26
44
  //# sourceMappingURL=Devtools.svelte.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Devtools.svelte.d.ts","sourceRoot":"","sources":["../src/Devtools.svelte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAE5C;AAID,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,KAAK,EACR,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,0BAA0B,C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OAAO,QAAQ,CAAC,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/svelte-query-devtools",
3
- "version": "5.90.2",
3
+ "version": "6.0.0",
4
4
  "description": "Developer tools to interact with and visualize the TanStack/svelte-query cache",
5
5
  "author": "Lachlan Collins",
6
6
  "license": "MIT",
@@ -14,6 +14,11 @@
14
14
  "type": "github",
15
15
  "url": "https://github.com/sponsors/tannerlinsley"
16
16
  },
17
+ "keywords": [
18
+ "tanstack",
19
+ "query",
20
+ "svelte"
21
+ ],
17
22
  "type": "module",
18
23
  "types": "dist/index.d.ts",
19
24
  "module": "dist/index.js",
@@ -39,14 +44,15 @@
39
44
  "devDependencies": {
40
45
  "@sveltejs/package": "^2.4.0",
41
46
  "@sveltejs/vite-plugin-svelte": "^5.1.1",
47
+ "@typescript-eslint/parser": "^8.44.1",
42
48
  "eslint-plugin-svelte": "^3.11.0",
43
49
  "svelte": "^5.39.3",
44
50
  "svelte-check": "^4.3.1",
45
- "@tanstack/svelte-query": "5.90.2"
51
+ "@tanstack/svelte-query": "6.0.0"
46
52
  },
47
53
  "peerDependencies": {
48
- "svelte": "^3.54.0 || ^4.0.0 || ^5.0.0",
49
- "@tanstack/svelte-query": "^5.90.2"
54
+ "svelte": "^5.25.0",
55
+ "@tanstack/svelte-query": "^6.0.0"
50
56
  },
51
57
  "scripts": {
52
58
  "clean": "premove ./dist ./coverage ./.svelte-kit ./dist-ts",
@@ -10,14 +10,55 @@
10
10
  TanstackQueryDevtools,
11
11
  } from '@tanstack/query-devtools'
12
12
 
13
- export let initialIsOpen = false
14
- export let buttonPosition: DevtoolsButtonPosition = 'bottom-right'
15
- export let position: DevtoolsPosition = 'bottom'
16
- export let client: QueryClient = useQueryClient()
17
- export let errorTypes: Array<DevtoolsErrorType> = []
18
- export let styleNonce: string | undefined = undefined
19
- export let shadowDOMTarget: ShadowRoot | undefined = undefined
20
- export let hideDisabledQueries: boolean = false
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()
21
62
 
22
63
  let ref: HTMLDivElement
23
64
  let devtools: TanstackQueryDevtools | undefined
@@ -43,20 +84,24 @@
43
84
 
44
85
  devtools.mount(ref)
45
86
  })
87
+ return () => devtools?.unmount()
88
+ })
46
89
 
47
- return () => {
48
- devtools?.unmount()
49
- }
90
+ $effect(() => {
91
+ devtools?.setButtonPosition(buttonPosition)
50
92
  })
51
- }
52
93
 
53
- $: {
54
- if (devtools) {
55
- devtools.setButtonPosition(buttonPosition)
56
- devtools.setPosition(position)
57
- devtools.setInitialIsOpen(initialIsOpen)
58
- devtools.setErrorTypes(errorTypes)
59
- }
94
+ $effect(() => {
95
+ devtools?.setPosition(position)
96
+ })
97
+
98
+ $effect(() => {
99
+ devtools?.setInitialIsOpen(initialIsOpen)
100
+ })
101
+
102
+ $effect(() => {
103
+ devtools?.setErrorTypes(errorTypes)
104
+ })
60
105
  }
61
106
  </script>
62
107