@tanstack/preact-query-devtools 0.0.1 → 5.92.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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/build/legacy/PreactQueryDevtools-BKJv-YAr.d.cts +57 -0
  3. package/build/legacy/PreactQueryDevtools-BKJv-YAr.d.ts +57 -0
  4. package/build/legacy/PreactQueryDevtools.cjs +95 -0
  5. package/build/legacy/PreactQueryDevtools.cjs.map +1 -0
  6. package/build/legacy/PreactQueryDevtools.d.cts +4 -0
  7. package/build/legacy/PreactQueryDevtools.d.ts +4 -0
  8. package/build/legacy/PreactQueryDevtools.js +70 -0
  9. package/build/legacy/PreactQueryDevtools.js.map +1 -0
  10. package/build/legacy/PreactQueryDevtoolsPanel-tSWW-AUr.d.cts +51 -0
  11. package/build/legacy/PreactQueryDevtoolsPanel-tSWW-AUr.d.ts +51 -0
  12. package/build/legacy/PreactQueryDevtoolsPanel.cjs +91 -0
  13. package/build/legacy/PreactQueryDevtoolsPanel.cjs.map +1 -0
  14. package/build/legacy/PreactQueryDevtoolsPanel.d.cts +4 -0
  15. package/build/legacy/PreactQueryDevtoolsPanel.d.ts +4 -0
  16. package/build/legacy/PreactQueryDevtoolsPanel.js +66 -0
  17. package/build/legacy/PreactQueryDevtoolsPanel.js.map +1 -0
  18. package/build/legacy/index.cjs +50 -0
  19. package/build/legacy/index.cjs.map +1 -0
  20. package/build/legacy/index.d.cts +11 -0
  21. package/build/legacy/index.d.ts +11 -0
  22. package/build/legacy/index.js +14 -0
  23. package/build/legacy/index.js.map +1 -0
  24. package/build/legacy/production.cjs +46 -0
  25. package/build/legacy/production.cjs.map +1 -0
  26. package/build/legacy/production.d.cts +10 -0
  27. package/build/legacy/production.d.ts +10 -0
  28. package/build/legacy/production.js +10 -0
  29. package/build/legacy/production.js.map +1 -0
  30. package/build/modern/PreactQueryDevtools-BKJv-YAr.d.cts +57 -0
  31. package/build/modern/PreactQueryDevtools-BKJv-YAr.d.ts +57 -0
  32. package/build/modern/PreactQueryDevtools.cjs +95 -0
  33. package/build/modern/PreactQueryDevtools.cjs.map +1 -0
  34. package/build/modern/PreactQueryDevtools.d.cts +4 -0
  35. package/build/modern/PreactQueryDevtools.d.ts +4 -0
  36. package/build/modern/PreactQueryDevtools.js +70 -0
  37. package/build/modern/PreactQueryDevtools.js.map +1 -0
  38. package/build/modern/PreactQueryDevtoolsPanel-tSWW-AUr.d.cts +51 -0
  39. package/build/modern/PreactQueryDevtoolsPanel-tSWW-AUr.d.ts +51 -0
  40. package/build/modern/PreactQueryDevtoolsPanel.cjs +91 -0
  41. package/build/modern/PreactQueryDevtoolsPanel.cjs.map +1 -0
  42. package/build/modern/PreactQueryDevtoolsPanel.d.cts +4 -0
  43. package/build/modern/PreactQueryDevtoolsPanel.d.ts +4 -0
  44. package/build/modern/PreactQueryDevtoolsPanel.js +66 -0
  45. package/build/modern/PreactQueryDevtoolsPanel.js.map +1 -0
  46. package/build/modern/index.cjs +50 -0
  47. package/build/modern/index.cjs.map +1 -0
  48. package/build/modern/index.d.cts +11 -0
  49. package/build/modern/index.d.ts +11 -0
  50. package/build/modern/index.js +14 -0
  51. package/build/modern/index.js.map +1 -0
  52. package/build/modern/production.cjs +46 -0
  53. package/build/modern/production.cjs.map +1 -0
  54. package/build/modern/production.d.cts +10 -0
  55. package/build/modern/production.d.ts +10 -0
  56. package/build/modern/production.js +10 -0
  57. package/build/modern/production.js.map +1 -0
  58. package/package.json +93 -8
  59. package/src/PreactQueryDevtools.tsx +127 -0
  60. package/src/PreactQueryDevtoolsPanel.tsx +110 -0
  61. package/src/index.ts +18 -0
  62. package/src/production.ts +5 -0
  63. package/README.md +0 -45
@@ -0,0 +1,110 @@
1
+ import { useRef, useState, useEffect } from 'preact/hooks'
2
+ import { onlineManager, useQueryClient } from '@tanstack/preact-query'
3
+ import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
4
+ import type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'
5
+ import type { QueryClient } from '@tanstack/preact-query'
6
+ import type { JSX, VNode } from 'preact'
7
+
8
+ export interface DevtoolsPanelOptions {
9
+ /**
10
+ * Use this to provide a custom QueryClient. Otherwise, the one from the
11
+ * nearest QueryClientProvider will be used.
12
+ */
13
+ client?: QueryClient
14
+ /**
15
+ * Custom error types to be shown in the devtools.
16
+ */
17
+ errorTypes?: Array<DevtoolsErrorType>
18
+ /**
19
+ * Use this to pass a nonce to the style tag that is added to the document
20
+ * head. This is useful if you are using a Content Security Policy (CSP)
21
+ * nonce to allow inline styles.
22
+ */
23
+ styleNonce?: string
24
+ /**
25
+ * Use this to render the devtools inside a Shadow DOM.
26
+ */
27
+ shadowDOMTarget?: ShadowRoot
28
+ /**
29
+ * Custom styles for the devtools panel container.
30
+ */
31
+ style?: JSX.CSSProperties
32
+ /**
33
+ * Callback function when the devtools panel is closed.
34
+ */
35
+ onClose?: () => unknown
36
+ /**
37
+ * Use this to hide disabled queries from the devtools panel.
38
+ */
39
+ hideDisabledQueries?: boolean
40
+ /**
41
+ * Use this to set the theme of the devtools panel.
42
+ * Defaults to 'system'.
43
+ */
44
+ theme?: Theme
45
+ }
46
+
47
+ export function PreactQueryDevtoolsPanel(
48
+ props: DevtoolsPanelOptions,
49
+ ): VNode | null {
50
+ const queryClient = useQueryClient(props.client)
51
+ const ref = useRef<HTMLDivElement>(null)
52
+ const {
53
+ errorTypes,
54
+ styleNonce,
55
+ shadowDOMTarget,
56
+ hideDisabledQueries,
57
+ theme,
58
+ } = props
59
+ const [devtools] = useState(
60
+ () =>
61
+ new TanstackQueryDevtoolsPanel({
62
+ client: queryClient,
63
+ queryFlavor: 'Preact Query',
64
+ version: '5',
65
+ onlineManager,
66
+ buttonPosition: 'bottom-left',
67
+ position: 'bottom',
68
+ initialIsOpen: true,
69
+ errorTypes,
70
+ styleNonce,
71
+ shadowDOMTarget,
72
+ onClose: props.onClose,
73
+ hideDisabledQueries,
74
+ theme,
75
+ }),
76
+ )
77
+
78
+ useEffect(() => {
79
+ devtools.setClient(queryClient)
80
+ }, [queryClient, devtools])
81
+
82
+ useEffect(() => {
83
+ devtools.setOnClose(props.onClose ?? (() => {}))
84
+ }, [props.onClose, devtools])
85
+
86
+ useEffect(() => {
87
+ devtools.setErrorTypes(errorTypes || [])
88
+ }, [errorTypes, devtools])
89
+
90
+ useEffect(() => {
91
+ devtools.setTheme(theme)
92
+ }, [theme, devtools])
93
+
94
+ useEffect(() => {
95
+ if (ref.current) {
96
+ devtools.mount(ref.current)
97
+ }
98
+ return () => {
99
+ devtools.unmount()
100
+ }
101
+ }, [devtools])
102
+
103
+ return (
104
+ <div
105
+ style={{ height: '500px', ...props.style }}
106
+ className="tsqd-parent-container"
107
+ ref={ref}
108
+ />
109
+ )
110
+ }
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import * as Devtools from './PreactQueryDevtools'
2
+ import * as DevtoolsPanel from './PreactQueryDevtoolsPanel'
3
+
4
+ export const PreactQueryDevtools: (typeof Devtools)['PreactQueryDevtools'] =
5
+ process.env.NODE_ENV !== 'development'
6
+ ? function () {
7
+ return null
8
+ }
9
+ : Devtools.PreactQueryDevtools
10
+
11
+ export const PreactQueryDevtoolsPanel: (typeof DevtoolsPanel)['PreactQueryDevtoolsPanel'] =
12
+ process.env.NODE_ENV !== 'development'
13
+ ? function () {
14
+ return null
15
+ }
16
+ : DevtoolsPanel.PreactQueryDevtoolsPanel
17
+
18
+ export type DevtoolsPanelOptions = DevtoolsPanel.DevtoolsPanelOptions
@@ -0,0 +1,5 @@
1
+ import * as Devtools from './PreactQueryDevtools'
2
+ import * as DevtoolsPanel from './PreactQueryDevtoolsPanel'
3
+
4
+ export const PreactQueryDevtools = Devtools.PreactQueryDevtools
5
+ export const PreactQueryDevtoolsPanel = DevtoolsPanel.PreactQueryDevtoolsPanel
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @tanstack/preact-query-devtools
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@tanstack/preact-query-devtools`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**