@tanstack/solid-query-devtools 6.0.0-rc.5 → 6.0.0-rc.6

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.
Files changed (56) hide show
  1. package/build/clientOnly-CEXX5Ps8.jsx +26 -0
  2. package/build/clientOnly-Cmw5kOEH.cjs +1 -0
  3. package/build/clientOnly-lrJ-FwVZ.js +2 -0
  4. package/build/clientOnly-lrJ-FwVZ.js.map +1 -0
  5. package/build/dev.cjs +29 -314
  6. package/build/dev.js +27 -23
  7. package/build/dev.jsx +27 -43
  8. package/build/devtools-BMem5cUa.jsx +62 -0
  9. package/build/devtools-DMwvwc4L.js +67 -0
  10. package/build/devtools-DPfipH2Y.js +2 -0
  11. package/build/devtools-DPfipH2Y.js.map +1 -0
  12. package/build/devtools-TPMm0sW8.cjs +1 -0
  13. package/build/devtools-m6r1o8lz.cjs +67 -0
  14. package/build/devtoolsPanel-BIXzHW6Y.cjs +1 -0
  15. package/build/devtoolsPanel-BbBQ7vKt.cjs +68 -0
  16. package/build/devtoolsPanel-CU_iFbJ3.jsx +62 -0
  17. package/build/devtoolsPanel-D71UlGwy.js +68 -0
  18. package/build/devtoolsPanel-DLEdindg.d.ts +106 -0
  19. package/build/devtoolsPanel-DLEdindg.d.ts.map +1 -0
  20. package/build/devtoolsPanel-Q67Cz4BM.d.cts +106 -0
  21. package/build/devtoolsPanel-Q67Cz4BM.d.cts.map +1 -0
  22. package/build/devtoolsPanel-hmH3gOTU.js +2 -0
  23. package/build/devtoolsPanel-hmH3gOTU.js.map +1 -0
  24. package/build/index.cjs +1 -288
  25. package/build/index.d.cts +5 -3
  26. package/build/index.d.cts.map +1 -0
  27. package/build/index.d.ts +5 -3
  28. package/build/index.d.ts.map +1 -0
  29. package/build/index.js +2 -29
  30. package/build/index.js.map +1 -0
  31. package/build/index.jsx +7 -46
  32. package/build/production.cjs +1 -0
  33. package/build/production.d.cts +5 -0
  34. package/build/production.d.cts.map +1 -0
  35. package/build/production.d.ts +5 -0
  36. package/build/production.d.ts.map +1 -0
  37. package/build/production.js +2 -0
  38. package/build/production.js.map +1 -0
  39. package/build/production.jsx +5 -0
  40. package/package.json +51 -40
  41. package/src/clientOnly.tsx +6 -5
  42. package/src/devtools.tsx +14 -6
  43. package/src/devtoolsPanel.tsx +20 -5
  44. package/src/production.tsx +12 -0
  45. package/build/_tsup-dts-rollup.d.cts +0 -109
  46. package/build/_tsup-dts-rollup.d.ts +0 -109
  47. package/build/chunk/L2WCKKHK.js +0 -94
  48. package/build/chunk/OQETK3NG.js +0 -123
  49. package/build/dev.d.cts +0 -3
  50. package/build/dev.d.ts +0 -3
  51. package/build/devtools/7WZM3IT7.jsx +0 -82
  52. package/build/devtools/V6WOBMVN.js +0 -68
  53. package/build/devtools/WQPACNKE.js +0 -68
  54. package/build/devtoolsPanel/6IZHMMFI.js +0 -71
  55. package/build/devtoolsPanel/FQC5JHFZ.jsx +0 -73
  56. package/build/devtoolsPanel/HZIEZL6U.js +0 -71
package/src/devtools.tsx CHANGED
@@ -17,13 +17,13 @@ interface DevtoolsOptions {
17
17
  /**
18
18
  * The position of the TanStack logo to open and close the devtools panel.
19
19
  * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
20
- * Defaults to 'bottom-right'.
20
+ * @defaultValue bottom-right
21
21
  */
22
22
  buttonPosition?: DevtoolsButtonPosition
23
23
  /**
24
24
  * The position of the Solid Query devtools panel.
25
25
  * 'top' | 'bottom' | 'left' | 'right'
26
- * Defaults to 'bottom'.
26
+ * @defaultValue bottom
27
27
  */
28
28
  position?: DevtoolsPosition
29
29
  /**
@@ -39,7 +39,8 @@ interface DevtoolsOptions {
39
39
  */
40
40
  styleNonce?: string
41
41
  /**
42
- * Use this so you can attach the devtool's styles to specific element in the DOM.
42
+ * Use this to pass a shadow DOM target to the devtools so that the styles will be applied
43
+ * within the shadow DOM instead of within the head tag in the light DOM.
43
44
  */
44
45
  shadowDOMTarget?: ShadowRoot
45
46
  /**
@@ -48,11 +49,18 @@ interface DevtoolsOptions {
48
49
  hideDisabledQueries?: boolean
49
50
  /**
50
51
  * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
51
- * Defaults to 'system'.
52
+ * This overrides the theme selected in the devtools Settings menu. When omitted, the
53
+ * selected theme is used, or `'system'` if none is selected.
52
54
  */
53
55
  theme?: Theme
54
56
  }
55
57
 
58
+ /**
59
+ * Renders the TanStack Query devtools, with a toggle button that opens them, for the given or
60
+ * nearest `QueryClient`.
61
+ * @param props - The devtools options.
62
+ * @returns The element the devtools are mounted in.
63
+ */
56
64
  export default function SolidQueryDevtools(props: DevtoolsOptions) {
57
65
  const queryClient = useQueryClient(props.client)
58
66
  const client = createMemo(() => queryClient)
@@ -114,7 +122,7 @@ export default function SolidQueryDevtools(props: DevtoolsOptions) {
114
122
  createEffect(
115
123
  () => props.theme,
116
124
  (theme) => {
117
- devtools.setTheme(theme || 'system')
125
+ devtools.setTheme(theme)
118
126
  },
119
127
  )
120
128
 
@@ -138,5 +146,5 @@ export default function SolidQueryDevtools(props: DevtoolsOptions) {
138
146
  }
139
147
  })
140
148
 
141
- return <div class="tsqd-parent-container" ref={ref}></div>
149
+ return <div class="tsqd-parent-container" ref={ref} />
142
150
  }
@@ -5,6 +5,9 @@ import type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'
5
5
  import type { QueryClient } from '@tanstack/solid-query'
6
6
  import type { JSX } from '@solidjs/web'
7
7
 
8
+ /**
9
+ * The props of `SolidQueryDevtoolsPanel`, which renders the devtools panel inline.
10
+ */
8
11
  export interface DevtoolsPanelOptions {
9
12
  /**
10
13
  * Custom instance of QueryClient
@@ -19,13 +22,14 @@ export interface DevtoolsPanelOptions {
19
22
  */
20
23
  styleNonce?: string
21
24
  /**
22
- * Use this so you can attach the devtool's styles to specific element in the DOM.
25
+ * Use this to pass a shadow DOM target to the devtools so that the styles will be applied
26
+ * within the shadow DOM instead of within the head tag in the light DOM.
23
27
  */
24
28
  shadowDOMTarget?: ShadowRoot
25
29
 
26
30
  /**
27
31
  * Custom styles for the devtools panel
28
- * @default { height: '500px' }
32
+ * @default { height: '100%', display: 'flex', 'flex-direction': 'column' }
29
33
  * @example { height: '100%' }
30
34
  * @example { height: '100%', width: '100%' }
31
35
  */
@@ -41,11 +45,17 @@ export interface DevtoolsPanelOptions {
41
45
  hideDisabledQueries?: boolean
42
46
  /**
43
47
  * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
44
- * Defaults to 'system'.
48
+ * This overrides the theme selected in the devtools Settings menu. When omitted, the
49
+ * selected theme is used, or `'system'` if none is selected.
45
50
  */
46
51
  theme?: Theme
47
52
  }
48
53
 
54
+ /**
55
+ * Renders the TanStack Query devtools panel inline, for the given or nearest `QueryClient`.
56
+ * @param props - The devtools panel options.
57
+ * @returns The element the devtools panel is mounted in.
58
+ */
49
59
  export default function SolidQueryDevtoolsPanel(props: DevtoolsPanelOptions) {
50
60
  const queryClient = useQueryClient(props.client)
51
61
  const client = createMemo(() => queryClient)
@@ -89,7 +99,7 @@ export default function SolidQueryDevtoolsPanel(props: DevtoolsPanelOptions) {
89
99
  createEffect(
90
100
  () => props.theme,
91
101
  (theme) => {
92
- devtools.setTheme(theme || 'system')
102
+ devtools.setTheme(theme)
93
103
  },
94
104
  )
95
105
 
@@ -115,7 +125,12 @@ export default function SolidQueryDevtoolsPanel(props: DevtoolsPanelOptions) {
115
125
 
116
126
  return (
117
127
  <div
118
- style={{ height: '500px', ...props.style }}
128
+ style={{
129
+ height: '100%',
130
+ display: 'flex',
131
+ 'flex-direction': 'column',
132
+ ...props.style,
133
+ }}
119
134
  class="tsqd-parent-container"
120
135
  ref={ref}
121
136
  />
@@ -0,0 +1,12 @@
1
+ import clientOnly from './clientOnly'
2
+ import type SolidQueryDevtoolsComp from './devtools'
3
+ import type SolidQueryDevtoolsCompPanel from './devtoolsPanel'
4
+
5
+ export const SolidQueryDevtools: typeof SolidQueryDevtoolsComp = clientOnly(
6
+ () => import('./devtools'),
7
+ )
8
+
9
+ export const SolidQueryDevtoolsPanel: typeof SolidQueryDevtoolsCompPanel =
10
+ clientOnly(() => import('./devtoolsPanel'))
11
+
12
+ export type { DevtoolsPanelOptions } from './devtoolsPanel'
@@ -1,109 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- import type { ComponentProps } from 'solid-js';
3
- import type { DevtoolsButtonPosition } from '@tanstack/query-devtools';
4
- import type { DevtoolsErrorType } from '@tanstack/query-devtools';
5
- import type { DevtoolsPosition } from '@tanstack/query-devtools';
6
- import { JSX } from '@solidjs/web';
7
- import type { QueryClient } from '@tanstack/solid-query';
8
- import type { Theme } from '@tanstack/query-devtools';
9
-
10
- export declare function default_alias<T extends Component<any>>(fn: () => Promise<{
11
- default: T;
12
- }>): (props: ComponentProps<T> & {
13
- fallback?: JSX.Element;
14
- }) => any;
15
-
16
- export declare function default_alias_1(props: DevtoolsOptions): JSX;
17
-
18
- export declare function default_alias_2(props: DevtoolsPanelOptions): JSX.Element;
19
-
20
- declare interface DevtoolsOptions {
21
- /**
22
- * Set this true if you want the dev tools to default to being open
23
- */
24
- initialIsOpen?: boolean;
25
- /**
26
- * The position of the TanStack logo to open and close the devtools panel.
27
- * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
28
- * Defaults to 'bottom-right'.
29
- */
30
- buttonPosition?: DevtoolsButtonPosition;
31
- /**
32
- * The position of the Solid Query devtools panel.
33
- * 'top' | 'bottom' | 'left' | 'right'
34
- * Defaults to 'bottom'.
35
- */
36
- position?: DevtoolsPosition;
37
- /**
38
- * Custom instance of QueryClient
39
- */
40
- client?: QueryClient;
41
- /**
42
- * Use this so you can define custom errors that can be shown in the devtools.
43
- */
44
- errorTypes?: Array<DevtoolsErrorType>;
45
- /**
46
- * 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.
47
- */
48
- styleNonce?: string;
49
- /**
50
- * Use this so you can attach the devtool's styles to specific element in the DOM.
51
- */
52
- shadowDOMTarget?: ShadowRoot;
53
- /**
54
- * Set this to true to hide disabled queries from the devtools panel.
55
- */
56
- hideDisabledQueries?: boolean;
57
- /**
58
- * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
59
- * Defaults to 'system'.
60
- */
61
- theme?: Theme;
62
- }
63
-
64
- declare interface DevtoolsPanelOptions {
65
- /**
66
- * Custom instance of QueryClient
67
- */
68
- client?: QueryClient;
69
- /**
70
- * Use this so you can define custom errors that can be shown in the devtools.
71
- */
72
- errorTypes?: Array<DevtoolsErrorType>;
73
- /**
74
- * 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.
75
- */
76
- styleNonce?: string;
77
- /**
78
- * Use this so you can attach the devtool's styles to specific element in the DOM.
79
- */
80
- shadowDOMTarget?: ShadowRoot;
81
- /**
82
- * Custom styles for the devtools panel
83
- * @default { height: '500px' }
84
- * @example { height: '100%' }
85
- * @example { height: '100%', width: '100%' }
86
- */
87
- style?: JSX.CSSProperties;
88
- /**
89
- * Callback function that is called when the devtools panel is closed
90
- */
91
- onClose?: () => void;
92
- /**
93
- * Set this to true to hide disabled queries from the devtools panel.
94
- */
95
- hideDisabledQueries?: boolean;
96
- /**
97
- * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
98
- * Defaults to 'system'.
99
- */
100
- theme?: Theme;
101
- }
102
- export { DevtoolsPanelOptions }
103
- export { DevtoolsPanelOptions as DevtoolsPanelOptions_alias_1 }
104
-
105
- export declare const SolidQueryDevtools: typeof default_alias_1;
106
-
107
- export declare const SolidQueryDevtoolsPanel: typeof default_alias_2;
108
-
109
- export { }
@@ -1,109 +0,0 @@
1
- import type { Component } from 'solid-js';
2
- import type { ComponentProps } from 'solid-js';
3
- import type { DevtoolsButtonPosition } from '@tanstack/query-devtools';
4
- import type { DevtoolsErrorType } from '@tanstack/query-devtools';
5
- import type { DevtoolsPosition } from '@tanstack/query-devtools';
6
- import { JSX } from '@solidjs/web';
7
- import type { QueryClient } from '@tanstack/solid-query';
8
- import type { Theme } from '@tanstack/query-devtools';
9
-
10
- export declare function default_alias<T extends Component<any>>(fn: () => Promise<{
11
- default: T;
12
- }>): (props: ComponentProps<T> & {
13
- fallback?: JSX.Element;
14
- }) => any;
15
-
16
- export declare function default_alias_1(props: DevtoolsOptions): JSX;
17
-
18
- export declare function default_alias_2(props: DevtoolsPanelOptions): JSX.Element;
19
-
20
- declare interface DevtoolsOptions {
21
- /**
22
- * Set this true if you want the dev tools to default to being open
23
- */
24
- initialIsOpen?: boolean;
25
- /**
26
- * The position of the TanStack logo to open and close the devtools panel.
27
- * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
28
- * Defaults to 'bottom-right'.
29
- */
30
- buttonPosition?: DevtoolsButtonPosition;
31
- /**
32
- * The position of the Solid Query devtools panel.
33
- * 'top' | 'bottom' | 'left' | 'right'
34
- * Defaults to 'bottom'.
35
- */
36
- position?: DevtoolsPosition;
37
- /**
38
- * Custom instance of QueryClient
39
- */
40
- client?: QueryClient;
41
- /**
42
- * Use this so you can define custom errors that can be shown in the devtools.
43
- */
44
- errorTypes?: Array<DevtoolsErrorType>;
45
- /**
46
- * 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.
47
- */
48
- styleNonce?: string;
49
- /**
50
- * Use this so you can attach the devtool's styles to specific element in the DOM.
51
- */
52
- shadowDOMTarget?: ShadowRoot;
53
- /**
54
- * Set this to true to hide disabled queries from the devtools panel.
55
- */
56
- hideDisabledQueries?: boolean;
57
- /**
58
- * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
59
- * Defaults to 'system'.
60
- */
61
- theme?: Theme;
62
- }
63
-
64
- declare interface DevtoolsPanelOptions {
65
- /**
66
- * Custom instance of QueryClient
67
- */
68
- client?: QueryClient;
69
- /**
70
- * Use this so you can define custom errors that can be shown in the devtools.
71
- */
72
- errorTypes?: Array<DevtoolsErrorType>;
73
- /**
74
- * 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.
75
- */
76
- styleNonce?: string;
77
- /**
78
- * Use this so you can attach the devtool's styles to specific element in the DOM.
79
- */
80
- shadowDOMTarget?: ShadowRoot;
81
- /**
82
- * Custom styles for the devtools panel
83
- * @default { height: '500px' }
84
- * @example { height: '100%' }
85
- * @example { height: '100%', width: '100%' }
86
- */
87
- style?: JSX.CSSProperties;
88
- /**
89
- * Callback function that is called when the devtools panel is closed
90
- */
91
- onClose?: () => void;
92
- /**
93
- * Set this to true to hide disabled queries from the devtools panel.
94
- */
95
- hideDisabledQueries?: boolean;
96
- /**
97
- * Set this to 'light', 'dark', or 'system' to change the theme of the devtools panel.
98
- * Defaults to 'system'.
99
- */
100
- theme?: Theme;
101
- }
102
- export { DevtoolsPanelOptions }
103
- export { DevtoolsPanelOptions as DevtoolsPanelOptions_alias_1 }
104
-
105
- export declare const SolidQueryDevtools: typeof default_alias_1;
106
-
107
- export declare const SolidQueryDevtoolsPanel: typeof default_alias_2;
108
-
109
- export { }
@@ -1,94 +0,0 @@
1
- import { createRenderEffect, untrack, runWithOwner } from 'solid-js';
2
- import { sharedConfig } from 'solid-js/internal';
3
-
4
- // ../../node_modules/.pnpm/@solidjs+web@2.0.0-rc.13_solid-js@2.0.0-rc.13/node_modules/@solidjs/web/dist/web.js
5
- var transparentOptions = {
6
- transparent: true,
7
- sync: true
8
- };
9
- function effect(fn, effectFn, options) {
10
- const nodeOptions = options ? {
11
- sync: true,
12
- ...options,
13
- transparent: !options.scope
14
- } : transparentOptions;
15
- createRenderEffect(fn, effectFn, nodeOptions);
16
- }
17
- var hasOwn = Object.prototype.hasOwnProperty;
18
- function create(html, bypassGuard, flag) {
19
- const t = document.createElement("template");
20
- t.innerHTML = html;
21
- return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
22
- }
23
- function template(html, flag) {
24
- let node;
25
- const fn = flag === 1 ? (bypassGuard) => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : (bypassGuard) => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
26
- return fn;
27
- }
28
- function setAttribute(node, name, value) {
29
- if (isHydrating(node)) return;
30
- node.removeAttribute(name);
31
- }
32
- function style(node, value, prev) {
33
- if (isHydrating(node)) return;
34
- if (!value) {
35
- if (prev || node._$styles) {
36
- setAttribute(node, "style");
37
- node._$styles = void 0;
38
- }
39
- return;
40
- }
41
- const nodeStyle = node.style;
42
- if (typeof value === "string") {
43
- node._$styles = void 0;
44
- return nodeStyle.cssText = value;
45
- }
46
- if (typeof prev === "string") {
47
- nodeStyle.cssText = "";
48
- prev = void 0;
49
- }
50
- let applied = node._$styles;
51
- if (!applied) {
52
- applied = node._$styles = prev ? {
53
- ...prev
54
- } : {};
55
- }
56
- let v, s;
57
- for (s in applied) {
58
- if (!hasOwn.call(value, s) || value[s] == null) {
59
- nodeStyle.removeProperty(s);
60
- delete applied[s];
61
- }
62
- }
63
- for (s in value) {
64
- if (!hasOwn.call(value, s)) continue;
65
- v = value[s];
66
- if (v != null && v !== applied[s]) {
67
- nodeStyle.setProperty(s, v);
68
- applied[s] = v;
69
- }
70
- }
71
- }
72
- function applyRef(r, element) {
73
- Array.isArray(r) ? r.flat(Infinity).forEach((f) => f && f(element)) : r(element);
74
- }
75
- function ref(fn, element) {
76
- const resolved = untrack(fn);
77
- runWithOwner(null, () => applyRef(resolved, element));
78
- }
79
- function isHydrating(node) {
80
- if (!sharedConfig.hydrating) return false;
81
- if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
82
- if (!node || node.isConnected) return true;
83
- const roots = sharedConfig.claimRoots;
84
- if (roots) {
85
- for (let i = 0; i < roots.length; i++) {
86
- if (roots[i].contains(node)) return true;
87
- }
88
- }
89
- return false;
90
- }
91
- var isServer = false;
92
- var isDev = false;
93
-
94
- export { effect, isDev, isServer, ref, style, template };
@@ -1,123 +0,0 @@
1
- import { createRenderEffect, getOwner, untrack, runWithOwner } from 'solid-js';
2
- import { sharedConfig } from 'solid-js/internal';
3
-
4
- // ../../node_modules/.pnpm/@solidjs+web@2.0.0-rc.13_solid-js@2.0.0-rc.13/node_modules/@solidjs/web/dist/web.dev.js
5
- var transparentOptions = {
6
- transparent: true,
7
- sync: true
8
- };
9
- var spreadName;
10
- var bindingEffect = null;
11
- function tagElement(node) {
12
- if (bindingEffect !== null && bindingEffect._devElement === void 0) bindingEffect._devElement = node;
13
- }
14
- function effect(fn, effectFn, options) {
15
- if (spreadName !== void 0 && (options === void 0 || options.name === void 0)) options = {
16
- ...options,
17
- name: spreadName + ".spread"
18
- };
19
- const nodeOptions = options ? {
20
- sync: true,
21
- ...options,
22
- transparent: !options.scope
23
- } : transparentOptions;
24
- {
25
- let node = null;
26
- createRenderEffect((prev) => {
27
- node = getOwner();
28
- return fn(prev);
29
- }, (value, prev) => {
30
- const outer = bindingEffect;
31
- bindingEffect = node;
32
- try {
33
- return effectFn(value, prev);
34
- } finally {
35
- bindingEffect = outer;
36
- }
37
- }, nodeOptions);
38
- return;
39
- }
40
- }
41
- var hasOwn = Object.prototype.hasOwnProperty;
42
- function create(html, bypassGuard, flag) {
43
- if (isHydrating() && !bypassGuard) throw new Error("Failed attempt to create new DOM elements during hydration. Check that the libraries you are using support hydration.");
44
- if (/^<(html|head|body)[\s>]/i.test(html)) throw new Error("Document shell templates (<html>, <head>, <body>) cannot be client-created: a <template> parse strips those tags. Render this component through hydrate(), where the document shell already exists.");
45
- const t = document.createElement("template");
46
- t.innerHTML = html;
47
- return flag === 2 ? t.content.firstChild.firstChild : t.content.firstChild;
48
- }
49
- function template(html, flag) {
50
- let node;
51
- const fn = flag === 1 ? (bypassGuard) => document.importNode(node || (node = create(html, bypassGuard, flag)), true) : (bypassGuard) => (node || (node = create(html, bypassGuard, flag))).cloneNode(true);
52
- fn._html = flag === 2 ? html.replace(/^<[^>]+>/, "") : html;
53
- return fn;
54
- }
55
- function setAttribute(node, name, value) {
56
- tagElement(node);
57
- if (isHydrating(node)) return;
58
- node.removeAttribute(name);
59
- }
60
- function style(node, value, prev) {
61
- tagElement(node);
62
- if (isHydrating(node)) return;
63
- if (!value) {
64
- if (prev || node._$styles) {
65
- setAttribute(node, "style");
66
- node._$styles = void 0;
67
- }
68
- return;
69
- }
70
- const nodeStyle = node.style;
71
- if (typeof value === "string") {
72
- node._$styles = void 0;
73
- return nodeStyle.cssText = value;
74
- }
75
- if (typeof prev === "string") {
76
- nodeStyle.cssText = "";
77
- prev = void 0;
78
- }
79
- let applied = node._$styles;
80
- if (!applied) {
81
- applied = node._$styles = prev ? {
82
- ...prev
83
- } : {};
84
- }
85
- let v, s;
86
- for (s in applied) {
87
- if (!hasOwn.call(value, s) || value[s] == null) {
88
- nodeStyle.removeProperty(s);
89
- delete applied[s];
90
- }
91
- }
92
- for (s in value) {
93
- if (!hasOwn.call(value, s)) continue;
94
- v = value[s];
95
- if (v != null && v !== applied[s]) {
96
- nodeStyle.setProperty(s, v);
97
- applied[s] = v;
98
- }
99
- }
100
- }
101
- function applyRef(r, element) {
102
- Array.isArray(r) ? r.flat(Infinity).forEach((f) => f && f(element)) : r(element);
103
- }
104
- function ref(fn, element) {
105
- const resolved = untrack(fn);
106
- runWithOwner(null, () => applyRef(resolved, element));
107
- }
108
- function isHydrating(node) {
109
- if (!sharedConfig.hydrating) return false;
110
- if (sharedConfig.isClaiming && !sharedConfig.isClaiming()) return false;
111
- if (!node || node.isConnected) return true;
112
- const roots = sharedConfig.claimRoots;
113
- if (roots) {
114
- for (let i = 0; i < roots.length; i++) {
115
- if (roots[i].contains(node)) return true;
116
- }
117
- }
118
- return false;
119
- }
120
- var isServer = false;
121
- var isDev = true;
122
-
123
- export { effect, isDev, isServer, ref, style, template };
package/build/dev.d.cts DELETED
@@ -1,3 +0,0 @@
1
- export { SolidQueryDevtools } from './_tsup-dts-rollup.cjs';
2
- export { SolidQueryDevtoolsPanel } from './_tsup-dts-rollup.cjs';
3
- export { DevtoolsPanelOptions_alias_1 as DevtoolsPanelOptions } from './_tsup-dts-rollup.cjs';
package/build/dev.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { SolidQueryDevtools } from './_tsup-dts-rollup.js';
2
- export { SolidQueryDevtoolsPanel } from './_tsup-dts-rollup.js';
3
- export { DevtoolsPanelOptions_alias_1 as DevtoolsPanelOptions } from './_tsup-dts-rollup.js';
@@ -1,82 +0,0 @@
1
- // src/devtools.tsx
2
- import { createEffect, createMemo, onSettled, runWithOwner } from "solid-js";
3
- import { onlineManager, useQueryClient } from "@tanstack/solid-query";
4
- import { TanstackQueryDevtools } from "@tanstack/query-devtools";
5
- function SolidQueryDevtools(props) {
6
- const queryClient = useQueryClient(props.client);
7
- const client = createMemo(() => queryClient);
8
- let ref;
9
- const devtools = new TanstackQueryDevtools({
10
- client: client(),
11
- queryFlavor: "Solid Query",
12
- version: "5",
13
- onlineManager,
14
- buttonPosition: props.buttonPosition,
15
- position: props.position,
16
- initialIsOpen: props.initialIsOpen,
17
- errorTypes: props.errorTypes,
18
- styleNonce: props.styleNonce,
19
- shadowDOMTarget: props.shadowDOMTarget,
20
- hideDisabledQueries: props.hideDisabledQueries,
21
- theme: props.theme
22
- });
23
- createEffect(
24
- () => client(),
25
- (c) => {
26
- devtools.setClient(c);
27
- }
28
- );
29
- createEffect(
30
- () => props.buttonPosition,
31
- (buttonPos) => {
32
- if (buttonPos) {
33
- devtools.setButtonPosition(buttonPos);
34
- }
35
- }
36
- );
37
- createEffect(
38
- () => props.position,
39
- (pos) => {
40
- if (pos) {
41
- devtools.setPosition(pos);
42
- }
43
- }
44
- );
45
- createEffect(
46
- () => props.initialIsOpen,
47
- (initialIsOpen) => {
48
- devtools.setInitialIsOpen(initialIsOpen || false);
49
- }
50
- );
51
- createEffect(
52
- () => props.errorTypes,
53
- (errorTypes) => {
54
- devtools.setErrorTypes(errorTypes || []);
55
- }
56
- );
57
- createEffect(
58
- () => props.theme,
59
- (theme) => {
60
- devtools.setTheme(theme || "system");
61
- }
62
- );
63
- let mounted = false;
64
- let disposed = false;
65
- onSettled(() => {
66
- queueMicrotask(() => {
67
- if (disposed) return;
68
- runWithOwner(null, () => devtools.mount(ref));
69
- mounted = true;
70
- });
71
- return () => {
72
- disposed = true;
73
- if (mounted) {
74
- devtools.unmount();
75
- }
76
- };
77
- });
78
- return <div class="tsqd-parent-container" ref={ref} />;
79
- }
80
- export {
81
- SolidQueryDevtools as default
82
- };