@tanstack/devtools-utils 0.3.4 → 0.4.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 (52) hide show
  1. package/dist/preact/esm/index.js +1 -5
  2. package/dist/preact/esm/panel.d.ts +4 -5
  3. package/dist/preact/esm/panel.js +48 -28
  4. package/dist/preact/esm/panel.js.map +1 -1
  5. package/dist/preact/esm/plugin.d.ts +3 -2
  6. package/dist/preact/esm/plugin.js +20 -22
  7. package/dist/preact/esm/plugin.js.map +1 -1
  8. package/dist/react/esm/index.js +1 -5
  9. package/dist/react/esm/panel.d.ts +4 -4
  10. package/dist/react/esm/panel.js +47 -28
  11. package/dist/react/esm/panel.js.map +1 -1
  12. package/dist/react/esm/plugin.d.ts +3 -2
  13. package/dist/react/esm/plugin.js +20 -22
  14. package/dist/react/esm/plugin.js.map +1 -1
  15. package/dist/solid/esm/chunk/{ZXPCWXRH.js → 7TSS377A.js} +2 -10
  16. package/dist/solid/esm/chunk/{UX5ZZ4MG.js → WUD4VD3N.js} +2 -10
  17. package/dist/solid/esm/class-mount-impl/5TF6RAHJ.js +1 -0
  18. package/dist/solid/esm/class-mount-impl/VN5QTPB3.js +1 -0
  19. package/dist/solid/esm/dev.js +9 -11
  20. package/dist/solid/esm/index.d.ts +10 -10
  21. package/dist/solid/esm/index.js +9 -11
  22. package/dist/solid/esm/server.js +8 -10
  23. package/dist/solid-class/esm/class-mount-impl.d.ts +3 -2
  24. package/dist/solid-class/esm/class-mount-impl.js +17 -23
  25. package/dist/solid-class/esm/class-mount-impl.js.map +1 -1
  26. package/dist/solid-class/esm/class.d.ts +4 -3
  27. package/dist/solid-class/esm/class.js +57 -54
  28. package/dist/solid-class/esm/class.js.map +1 -1
  29. package/dist/solid-class/esm/panel.d.ts +3 -3
  30. package/dist/solid-class/esm/plugin.d.ts +3 -2
  31. package/dist/vue/esm/index.js +1 -5
  32. package/dist/vue/esm/panel.d.ts +3 -3
  33. package/dist/vue/esm/panel.js +36 -45
  34. package/dist/vue/esm/panel.js.map +1 -1
  35. package/dist/vue/esm/plugin.js +20 -19
  36. package/dist/vue/esm/plugin.js.map +1 -1
  37. package/package.json +6 -8
  38. package/src/preact/panel.tsx +6 -7
  39. package/src/preact/plugin.tsx +4 -3
  40. package/src/react/panel.tsx +6 -7
  41. package/src/react/plugin.tsx +4 -3
  42. package/src/solid/class-mount-impl.tsx +7 -10
  43. package/src/solid/class.test.tsx +43 -12
  44. package/src/solid/class.ts +15 -4
  45. package/src/solid/panel.tsx +6 -7
  46. package/src/solid/plugin.tsx +4 -3
  47. package/src/vue/panel.ts +6 -7
  48. package/dist/preact/esm/index.js.map +0 -1
  49. package/dist/react/esm/index.js.map +0 -1
  50. package/dist/solid/esm/class-mount-impl/LK7V47IP.js +0 -1
  51. package/dist/solid/esm/class-mount-impl/ZAIAXV4M.js +0 -1
  52. package/dist/vue/esm/index.js.map +0 -1
@@ -1,7 +1,3 @@
1
1
  import { createPreactPanel } from "./panel.js";
2
2
  import { createPreactPlugin } from "./plugin.js";
3
- export {
4
- createPreactPanel,
5
- createPreactPlugin
6
- };
7
- //# sourceMappingURL=index.js.map
3
+ export { createPreactPanel, createPreactPlugin };
@@ -1,6 +1,5 @@
1
- /** @jsxImportSource preact */
2
- export interface DevtoolsPanelProps {
3
- theme?: 'light' | 'dark';
1
+ import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
2
+ export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {
4
3
  }
5
4
  /**
6
5
  * Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly.
@@ -19,7 +18,7 @@ export interface DevtoolsPanelProps {
19
18
  * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact', 'DevtoolsCore')
20
19
  * ```
21
20
  */
22
- export declare function createPreactPanel<TComponentProps extends DevtoolsPanelProps | undefined, TCoreDevtoolsClass extends {
23
- mount: (el: HTMLElement, theme: 'light' | 'dark') => void;
21
+ export declare function createPreactPanel<TComponentProps extends DevtoolsPanelProps, TCoreDevtoolsClass extends {
22
+ mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void;
24
23
  unmount: () => void;
25
24
  }>(CoreClass: new () => TCoreDevtoolsClass): readonly [(props: TComponentProps) => import("preact").JSX.Element, (_props: TComponentProps) => import("preact").JSX.Element];
@@ -1,30 +1,50 @@
1
- import { jsx, Fragment } from "preact/jsx-runtime";
2
- import { useRef, useEffect } from "preact/hooks";
1
+ import { useEffect, useRef } from "preact/hooks";
2
+ import { Fragment, jsx } from "preact/jsx-runtime";
3
+ //#region src/preact/panel.tsx
4
+ /** @jsxImportSource preact */
5
+ /**
6
+ * Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly.
7
+ * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-preact'
8
+ * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')
9
+ * @returns A Preact component that mounts the devtools
10
+ * @example
11
+ * ```tsx
12
+ * // if the export is default
13
+ * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact')
14
+ * ```
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * // if the export is named differently
19
+ * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact', 'DevtoolsCore')
20
+ * ```
21
+ */
3
22
  function createPreactPanel(CoreClass) {
4
- function Panel(props) {
5
- const devToolRef = useRef(null);
6
- const devtools = useRef(null);
7
- useEffect(() => {
8
- if (devtools.current) return;
9
- devtools.current = new CoreClass();
10
- if (devToolRef.current) {
11
- devtools.current.mount(devToolRef.current, props?.theme ?? "dark");
12
- }
13
- return () => {
14
- if (devToolRef.current) {
15
- devtools.current?.unmount();
16
- devtools.current = null;
17
- }
18
- };
19
- }, [props?.theme]);
20
- return /* @__PURE__ */ jsx("div", { style: { height: "100%" }, ref: devToolRef });
21
- }
22
- function NoOpPanel(_props) {
23
- return /* @__PURE__ */ jsx(Fragment, {});
24
- }
25
- return [Panel, NoOpPanel];
23
+ function Panel(props) {
24
+ const devToolRef = useRef(null);
25
+ const devtools = useRef(null);
26
+ useEffect(() => {
27
+ if (devtools.current) return;
28
+ devtools.current = new CoreClass();
29
+ if (devToolRef.current) devtools.current.mount(devToolRef.current, props);
30
+ return () => {
31
+ if (devToolRef.current) {
32
+ devtools.current?.unmount();
33
+ devtools.current = null;
34
+ }
35
+ };
36
+ }, [props]);
37
+ return /* @__PURE__ */ jsx("div", {
38
+ style: { height: "100%" },
39
+ ref: devToolRef
40
+ });
41
+ }
42
+ function NoOpPanel(_props) {
43
+ return /* @__PURE__ */ jsx(Fragment, {});
44
+ }
45
+ return [Panel, NoOpPanel];
26
46
  }
27
- export {
28
- createPreactPanel
29
- };
30
- //# sourceMappingURL=panel.js.map
47
+ //#endregion
48
+ export { createPreactPanel };
49
+
50
+ //# sourceMappingURL=panel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"panel.js","sources":["../../../src/preact/panel.tsx"],"sourcesContent":["/** @jsxImportSource preact */\n\nimport { useEffect, useRef } from 'preact/hooks'\n\nexport interface DevtoolsPanelProps {\n theme?: 'light' | 'dark'\n}\n\n/**\n * Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly.\n * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-preact'\n * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')\n * @returns A Preact component that mounts the devtools\n * @example\n * ```tsx\n * // if the export is default\n * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact')\n * ```\n *\n * @example\n * ```tsx\n * // if the export is named differently\n * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact', 'DevtoolsCore')\n * ```\n */\nexport function createPreactPanel<\n TComponentProps extends DevtoolsPanelProps | undefined,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, theme: 'light' | 'dark') => void\n unmount: () => void\n },\n>(CoreClass: new () => TCoreDevtoolsClass) {\n function Panel(props: TComponentProps) {\n const devToolRef = useRef<HTMLDivElement>(null)\n const devtools = useRef<TCoreDevtoolsClass | null>(null)\n useEffect(() => {\n if (devtools.current) return\n devtools.current = new CoreClass()\n\n if (devToolRef.current) {\n devtools.current.mount(devToolRef.current, props?.theme ?? 'dark')\n }\n\n return () => {\n if (devToolRef.current) {\n devtools.current?.unmount()\n devtools.current = null\n }\n }\n }, [props?.theme])\n\n return <div style={{ height: '100%' }} ref={devToolRef} />\n }\n\n function NoOpPanel(_props: TComponentProps) {\n return <></>\n }\n return [Panel, NoOpPanel] as const\n}\n"],"names":[],"mappings":";;AAyBO,SAAS,kBAMd,WAAyC;AACzC,WAAS,MAAM,OAAwB;AACrC,UAAM,aAAa,OAAuB,IAAI;AAC9C,UAAM,WAAW,OAAkC,IAAI;AACvD,cAAU,MAAM;AACd,UAAI,SAAS,QAAS;AACtB,eAAS,UAAU,IAAI,UAAA;AAEvB,UAAI,WAAW,SAAS;AACtB,iBAAS,QAAQ,MAAM,WAAW,SAAS,OAAO,SAAS,MAAM;AAAA,MACnE;AAEA,aAAO,MAAM;AACX,YAAI,WAAW,SAAS;AACtB,mBAAS,SAAS,QAAA;AAClB,mBAAS,UAAU;AAAA,QACrB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,WAAO,oBAAC,SAAI,OAAO,EAAE,QAAQ,OAAA,GAAU,KAAK,YAAY;AAAA,EAC1D;AAEA,WAAS,UAAU,QAAyB;AAC1C,WAAO,oBAAA,UAAA,EAAE;AAAA,EACX;AACA,SAAO,CAAC,OAAO,SAAS;AAC1B;"}
1
+ {"version":3,"file":"panel.js","names":[],"sources":["../../../src/preact/panel.tsx"],"sourcesContent":["/** @jsxImportSource preact */\n\nimport { useEffect, useRef } from 'preact/hooks'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\n\nexport interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {}\n\n/**\n * Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly.\n * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-preact'\n * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')\n * @returns A Preact component that mounts the devtools\n * @example\n * ```tsx\n * // if the export is default\n * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact')\n * ```\n *\n * @example\n * ```tsx\n * // if the export is named differently\n * const [PreactDevtoolsPanel, NoOpPreactDevtoolsPanel] = createPreactPanel('@tanstack/devtools-preact', 'DevtoolsCore')\n * ```\n */\nexport function createPreactPanel<\n TComponentProps extends DevtoolsPanelProps,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void\n unmount: () => void\n },\n>(CoreClass: new () => TCoreDevtoolsClass) {\n function Panel(props: TComponentProps) {\n const devToolRef = useRef<HTMLDivElement>(null)\n const devtools = useRef<TCoreDevtoolsClass | null>(null)\n useEffect(() => {\n if (devtools.current) return\n devtools.current = new CoreClass()\n\n if (devToolRef.current) {\n devtools.current.mount(devToolRef.current, props)\n }\n\n return () => {\n if (devToolRef.current) {\n devtools.current?.unmount()\n devtools.current = null\n }\n }\n }, [props])\n\n return <div style={{ height: '100%' }} ref={devToolRef} />\n }\n\n function NoOpPanel(_props: TComponentProps) {\n return <></>\n }\n return [Panel, NoOpPanel] as const\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,SAAgB,kBAMd,WAAyC;CACzC,SAAS,MAAM,OAAwB;EACrC,MAAM,aAAa,OAAuB,KAAK;EAC/C,MAAM,WAAW,OAAkC,KAAK;AACxD,kBAAgB;AACd,OAAI,SAAS,QAAS;AACtB,YAAS,UAAU,IAAI,WAAW;AAElC,OAAI,WAAW,QACb,UAAS,QAAQ,MAAM,WAAW,SAAS,MAAM;AAGnD,gBAAa;AACX,QAAI,WAAW,SAAS;AACtB,cAAS,SAAS,SAAS;AAC3B,cAAS,UAAU;;;KAGtB,CAAC,MAAM,CAAC;AAEX,SAAO,oBAAC,OAAD;GAAK,OAAO,EAAE,QAAQ,QAAQ;GAAE,KAAK;GAAc,CAAA;;CAG5D,SAAS,UAAU,QAAyB;AAC1C,SAAO,oBAAA,UAAA,EAAK,CAAA;;AAEd,QAAO,CAAC,OAAO,UAAU"}
@@ -1,17 +1,18 @@
1
1
  import { JSX } from 'preact';
2
2
  import { DevtoolsPanelProps } from './panel.js';
3
+ import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
3
4
  export declare function createPreactPlugin({ Component, ...config }: {
4
5
  name: string;
5
6
  id?: string;
6
7
  defaultOpen?: boolean;
7
8
  Component: (props: DevtoolsPanelProps) => JSX.Element;
8
9
  }): readonly [() => {
9
- render: (_el: HTMLElement, theme: "light" | "dark") => JSX.Element;
10
+ render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => JSX.Element;
10
11
  name: string;
11
12
  id?: string;
12
13
  defaultOpen?: boolean;
13
14
  }, () => {
14
- render: (_el: HTMLElement, _theme: "light" | "dark") => JSX.Element;
15
+ render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => JSX.Element;
15
16
  name: string;
16
17
  id?: string;
17
18
  defaultOpen?: boolean;
@@ -1,23 +1,21 @@
1
- import { jsx, Fragment } from "preact/jsx-runtime";
2
- function createPreactPlugin({
3
- Component,
4
- ...config
5
- }) {
6
- function Plugin() {
7
- return {
8
- ...config,
9
- render: (_el, theme) => /* @__PURE__ */ jsx(Component, { theme })
10
- };
11
- }
12
- function NoOpPlugin() {
13
- return {
14
- ...config,
15
- render: (_el, _theme) => /* @__PURE__ */ jsx(Fragment, {})
16
- };
17
- }
18
- return [Plugin, NoOpPlugin];
1
+ import { Fragment, jsx } from "preact/jsx-runtime";
2
+ //#region src/preact/plugin.tsx
3
+ function createPreactPlugin({ Component, ...config }) {
4
+ function Plugin() {
5
+ return {
6
+ ...config,
7
+ render: (_el, props) => /* @__PURE__ */ jsx(Component, { ...props })
8
+ };
9
+ }
10
+ function NoOpPlugin() {
11
+ return {
12
+ ...config,
13
+ render: (_el, _props) => /* @__PURE__ */ jsx(Fragment, {})
14
+ };
15
+ }
16
+ return [Plugin, NoOpPlugin];
19
17
  }
20
- export {
21
- createPreactPlugin
22
- };
23
- //# sourceMappingURL=plugin.js.map
18
+ //#endregion
19
+ export { createPreactPlugin };
20
+
21
+ //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../src/preact/plugin.tsx"],"sourcesContent":["/** @jsxImportSource preact */\n\nimport type { JSX } from 'preact'\nimport type { DevtoolsPanelProps } from './panel'\n\nexport function createPreactPlugin({\n Component,\n ...config\n}: {\n name: string\n id?: string\n defaultOpen?: boolean\n Component: (props: DevtoolsPanelProps) => JSX.Element\n}) {\n function Plugin() {\n return {\n ...config,\n render: (_el: HTMLElement, theme: 'light' | 'dark') => (\n <Component theme={theme} />\n ),\n }\n }\n function NoOpPlugin() {\n return {\n ...config,\n render: (_el: HTMLElement, _theme: 'light' | 'dark') => <></>,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"names":[],"mappings":";AAKO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA,GAAG;AACL,GAKG;AACD,WAAS,SAAS;AAChB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,CAAC,KAAkB,UACzB,oBAAC,aAAU,MAAA,CAAc;AAAA,IAAA;AAAA,EAG/B;AACA,WAAS,aAAa;AACpB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,CAAC,KAAkB,WAA6B,oBAAA,UAAA,CAAA,CAAE;AAAA,IAAA;AAAA,EAE9D;AACA,SAAO,CAAC,QAAQ,UAAU;AAC5B;"}
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../../src/preact/plugin.tsx"],"sourcesContent":["/** @jsxImportSource preact */\n\nimport type { JSX } from 'preact'\nimport type { DevtoolsPanelProps } from './panel'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\n\nexport function createPreactPlugin({\n Component,\n ...config\n}: {\n name: string\n id?: string\n defaultOpen?: boolean\n Component: (props: DevtoolsPanelProps) => JSX.Element\n}) {\n function Plugin() {\n return {\n ...config,\n render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => (\n <Component {...props} />\n ),\n }\n }\n function NoOpPlugin() {\n return {\n ...config,\n render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"mappings":";;AAMA,SAAgB,mBAAmB,EACjC,WACA,GAAG,UAMF;CACD,SAAS,SAAS;AAChB,SAAO;GACL,GAAG;GACH,SAAS,KAAkB,UACzB,oBAAC,WAAD,EAAW,GAAI,OAAS,CAAA;GAE3B;;CAEH,SAAS,aAAa;AACpB,SAAO;GACL,GAAG;GACH,SAAS,KAAkB,WAAwC,oBAAA,UAAA,EAAK,CAAA;GACzE;;AAEH,QAAO,CAAC,QAAQ,WAAW"}
@@ -1,7 +1,3 @@
1
1
  import { createReactPanel } from "./panel.js";
2
2
  import { createReactPlugin } from "./plugin.js";
3
- export {
4
- createReactPanel,
5
- createReactPlugin
6
- };
7
- //# sourceMappingURL=index.js.map
3
+ export { createReactPanel, createReactPlugin };
@@ -1,5 +1,5 @@
1
- export interface DevtoolsPanelProps {
2
- theme?: 'light' | 'dark';
1
+ import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
2
+ export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {
3
3
  }
4
4
  /**
5
5
  * Creates a React component that dynamically imports and mounts a devtools panel. SSR friendly.
@@ -18,7 +18,7 @@ export interface DevtoolsPanelProps {
18
18
  * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react', 'DevtoolsCore')
19
19
  * ```
20
20
  */
21
- export declare function createReactPanel<TComponentProps extends DevtoolsPanelProps | undefined, TCoreDevtoolsClass extends {
22
- mount: (el: HTMLElement, theme: 'light' | 'dark') => void;
21
+ export declare function createReactPanel<TComponentProps extends TanStackDevtoolsPluginProps, TCoreDevtoolsClass extends {
22
+ mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void;
23
23
  unmount: () => void;
24
24
  }>(CoreClass: new () => TCoreDevtoolsClass): readonly [(props: TComponentProps) => import("react/jsx-runtime").JSX.Element, (_props: TComponentProps) => import("react/jsx-runtime").JSX.Element];
@@ -1,30 +1,49 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
1
+ import { useEffect, useRef } from "react";
2
+ import { Fragment, jsx } from "react/jsx-runtime";
3
+ //#region src/react/panel.tsx
4
+ /**
5
+ * Creates a React component that dynamically imports and mounts a devtools panel. SSR friendly.
6
+ * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-react'
7
+ * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')
8
+ * @returns A React component that mounts the devtools
9
+ * @example
10
+ * ```tsx
11
+ * // if the export is default
12
+ * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react')
13
+ * ```
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * // if the export is named differently
18
+ * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react', 'DevtoolsCore')
19
+ * ```
20
+ */
3
21
  function createReactPanel(CoreClass) {
4
- function Panel(props) {
5
- const devToolRef = useRef(null);
6
- const devtools = useRef(null);
7
- useEffect(() => {
8
- if (devtools.current) return;
9
- devtools.current = new CoreClass();
10
- if (devToolRef.current) {
11
- devtools.current.mount(devToolRef.current, props?.theme ?? "dark");
12
- }
13
- return () => {
14
- if (devToolRef.current) {
15
- devtools.current?.unmount();
16
- devtools.current = null;
17
- }
18
- };
19
- }, [props?.theme]);
20
- return /* @__PURE__ */ jsx("div", { style: { height: "100%" }, ref: devToolRef });
21
- }
22
- function NoOpPanel(_props) {
23
- return /* @__PURE__ */ jsx(Fragment, {});
24
- }
25
- return [Panel, NoOpPanel];
22
+ function Panel(props) {
23
+ const devToolRef = useRef(null);
24
+ const devtools = useRef(null);
25
+ useEffect(() => {
26
+ if (devtools.current) return;
27
+ devtools.current = new CoreClass();
28
+ if (devToolRef.current) devtools.current.mount(devToolRef.current, props);
29
+ return () => {
30
+ if (devToolRef.current) {
31
+ devtools.current?.unmount();
32
+ devtools.current = null;
33
+ }
34
+ };
35
+ }, [props]);
36
+ return /* @__PURE__ */ jsx("div", {
37
+ style: { height: "100%" },
38
+ ref: devToolRef
39
+ });
40
+ }
41
+ function NoOpPanel(_props) {
42
+ return /* @__PURE__ */ jsx(Fragment, {});
43
+ }
44
+ return [Panel, NoOpPanel];
26
45
  }
27
- export {
28
- createReactPanel
29
- };
30
- //# sourceMappingURL=panel.js.map
46
+ //#endregion
47
+ export { createReactPanel };
48
+
49
+ //# sourceMappingURL=panel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"panel.js","sources":["../../../src/react/panel.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react'\n\nexport interface DevtoolsPanelProps {\n theme?: 'light' | 'dark'\n}\n\n/**\n * Creates a React component that dynamically imports and mounts a devtools panel. SSR friendly.\n * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-react'\n * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')\n * @returns A React component that mounts the devtools\n * @example\n * ```tsx\n * // if the export is default\n * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react')\n * ```\n *\n * @example\n * ```tsx\n * // if the export is named differently\n * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react', 'DevtoolsCore')\n * ```\n */\nexport function createReactPanel<\n TComponentProps extends DevtoolsPanelProps | undefined,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, theme: 'light' | 'dark') => void\n unmount: () => void\n },\n>(CoreClass: new () => TCoreDevtoolsClass) {\n function Panel(props: TComponentProps) {\n const devToolRef = useRef<HTMLDivElement>(null)\n const devtools = useRef<TCoreDevtoolsClass | null>(null)\n useEffect(() => {\n if (devtools.current) return\n devtools.current = new CoreClass()\n\n if (devToolRef.current) {\n devtools.current.mount(devToolRef.current, props?.theme ?? 'dark')\n }\n\n return () => {\n if (devToolRef.current) {\n devtools.current?.unmount()\n devtools.current = null\n }\n }\n }, [props?.theme])\n\n return <div style={{ height: '100%' }} ref={devToolRef} />\n }\n\n function NoOpPanel(_props: TComponentProps) {\n return <></>\n }\n return [Panel, NoOpPanel] as const\n}\n"],"names":[],"mappings":";;AAuBO,SAAS,iBAMd,WAAyC;AACzC,WAAS,MAAM,OAAwB;AACrC,UAAM,aAAa,OAAuB,IAAI;AAC9C,UAAM,WAAW,OAAkC,IAAI;AACvD,cAAU,MAAM;AACd,UAAI,SAAS,QAAS;AACtB,eAAS,UAAU,IAAI,UAAA;AAEvB,UAAI,WAAW,SAAS;AACtB,iBAAS,QAAQ,MAAM,WAAW,SAAS,OAAO,SAAS,MAAM;AAAA,MACnE;AAEA,aAAO,MAAM;AACX,YAAI,WAAW,SAAS;AACtB,mBAAS,SAAS,QAAA;AAClB,mBAAS,UAAU;AAAA,QACrB;AAAA,MACF;AAAA,IACF,GAAG,CAAC,OAAO,KAAK,CAAC;AAEjB,WAAO,oBAAC,SAAI,OAAO,EAAE,QAAQ,OAAA,GAAU,KAAK,YAAY;AAAA,EAC1D;AAEA,WAAS,UAAU,QAAyB;AAC1C,WAAO,oBAAA,UAAA,EAAE;AAAA,EACX;AACA,SAAO,CAAC,OAAO,SAAS;AAC1B;"}
1
+ {"version":3,"file":"panel.js","names":[],"sources":["../../../src/react/panel.tsx"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\n\nexport interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {}\n\n/**\n * Creates a React component that dynamically imports and mounts a devtools panel. SSR friendly.\n * @param devtoolsPackageName The name of the devtools package to be imported, e.g., '@tanstack/devtools-react'\n * @param importName The name of the export to be imported from the devtools package (e.g., 'default' or 'DevtoolsCore')\n * @returns A React component that mounts the devtools\n * @example\n * ```tsx\n * // if the export is default\n * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react')\n * ```\n *\n * @example\n * ```tsx\n * // if the export is named differently\n * const [ReactDevtoolsPanel, NoOpReactDevtoolsPanel] = createReactPanel('@tanstack/devtools-react', 'DevtoolsCore')\n * ```\n */\nexport function createReactPanel<\n TComponentProps extends TanStackDevtoolsPluginProps,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void\n unmount: () => void\n },\n>(CoreClass: new () => TCoreDevtoolsClass) {\n function Panel(props: TComponentProps) {\n const devToolRef = useRef<HTMLDivElement>(null)\n const devtools = useRef<TCoreDevtoolsClass | null>(null)\n useEffect(() => {\n if (devtools.current) return\n devtools.current = new CoreClass()\n\n if (devToolRef.current) {\n devtools.current.mount(devToolRef.current, props)\n }\n\n return () => {\n if (devToolRef.current) {\n devtools.current?.unmount()\n devtools.current = null\n }\n }\n }, [props])\n\n return <div style={{ height: '100%' }} ref={devToolRef} />\n }\n\n function NoOpPanel(_props: TComponentProps) {\n return <></>\n }\n return [Panel, NoOpPanel] as const\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,iBAMd,WAAyC;CACzC,SAAS,MAAM,OAAwB;EACrC,MAAM,aAAa,OAAuB,KAAK;EAC/C,MAAM,WAAW,OAAkC,KAAK;AACxD,kBAAgB;AACd,OAAI,SAAS,QAAS;AACtB,YAAS,UAAU,IAAI,WAAW;AAElC,OAAI,WAAW,QACb,UAAS,QAAQ,MAAM,WAAW,SAAS,MAAM;AAGnD,gBAAa;AACX,QAAI,WAAW,SAAS;AACtB,cAAS,SAAS,SAAS;AAC3B,cAAS,UAAU;;;KAGtB,CAAC,MAAM,CAAC;AAEX,SAAO,oBAAC,OAAD;GAAK,OAAO,EAAE,QAAQ,QAAQ;GAAE,KAAK;GAAc,CAAA;;CAG5D,SAAS,UAAU,QAAyB;AAC1C,SAAO,oBAAA,UAAA,EAAK,CAAA;;AAEd,QAAO,CAAC,OAAO,UAAU"}
@@ -1,17 +1,18 @@
1
1
  import { JSX } from 'react';
2
2
  import { DevtoolsPanelProps } from './panel.js';
3
+ import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
3
4
  export declare function createReactPlugin({ Component, ...config }: {
4
5
  name: string;
5
6
  id?: string;
6
7
  defaultOpen?: boolean;
7
8
  Component: (props: DevtoolsPanelProps) => JSX.Element;
8
9
  }): readonly [() => {
9
- render: (_el: HTMLElement, theme: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
10
+ render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
10
11
  name: string;
11
12
  id?: string;
12
13
  defaultOpen?: boolean;
13
14
  }, () => {
14
- render: (_el: HTMLElement, _theme: "light" | "dark") => import("react/jsx-runtime").JSX.Element;
15
+ render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
15
16
  name: string;
16
17
  id?: string;
17
18
  defaultOpen?: boolean;
@@ -1,23 +1,21 @@
1
- import { jsx, Fragment } from "react/jsx-runtime";
2
- function createReactPlugin({
3
- Component,
4
- ...config
5
- }) {
6
- function Plugin() {
7
- return {
8
- ...config,
9
- render: (_el, theme) => /* @__PURE__ */ jsx(Component, { theme })
10
- };
11
- }
12
- function NoOpPlugin() {
13
- return {
14
- ...config,
15
- render: (_el, _theme) => /* @__PURE__ */ jsx(Fragment, {})
16
- };
17
- }
18
- return [Plugin, NoOpPlugin];
1
+ import { Fragment, jsx } from "react/jsx-runtime";
2
+ //#region src/react/plugin.tsx
3
+ function createReactPlugin({ Component, ...config }) {
4
+ function Plugin() {
5
+ return {
6
+ ...config,
7
+ render: (_el, props) => /* @__PURE__ */ jsx(Component, { ...props })
8
+ };
9
+ }
10
+ function NoOpPlugin() {
11
+ return {
12
+ ...config,
13
+ render: (_el, _props) => /* @__PURE__ */ jsx(Fragment, {})
14
+ };
15
+ }
16
+ return [Plugin, NoOpPlugin];
19
17
  }
20
- export {
21
- createReactPlugin
22
- };
23
- //# sourceMappingURL=plugin.js.map
18
+ //#endregion
19
+ export { createReactPlugin };
20
+
21
+ //# sourceMappingURL=plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["../../../src/react/plugin.tsx"],"sourcesContent":["import type { JSX } from 'react'\nimport type { DevtoolsPanelProps } from './panel'\n\nexport function createReactPlugin({\n Component,\n ...config\n}: {\n name: string\n id?: string\n defaultOpen?: boolean\n Component: (props: DevtoolsPanelProps) => JSX.Element\n}) {\n function Plugin() {\n return {\n ...config,\n render: (_el: HTMLElement, theme: 'light' | 'dark') => (\n <Component theme={theme} />\n ),\n }\n }\n function NoOpPlugin() {\n return {\n ...config,\n render: (_el: HTMLElement, _theme: 'light' | 'dark') => <></>,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"names":[],"mappings":";AAGO,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,GAAG;AACL,GAKG;AACD,WAAS,SAAS;AAChB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,CAAC,KAAkB,UACzB,oBAAC,aAAU,MAAA,CAAc;AAAA,IAAA;AAAA,EAG/B;AACA,WAAS,aAAa;AACpB,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ,CAAC,KAAkB,WAA6B,oBAAA,UAAA,CAAA,CAAE;AAAA,IAAA;AAAA,EAE9D;AACA,SAAO,CAAC,QAAQ,UAAU;AAC5B;"}
1
+ {"version":3,"file":"plugin.js","names":[],"sources":["../../../src/react/plugin.tsx"],"sourcesContent":["import type { JSX } from 'react'\nimport type { DevtoolsPanelProps } from './panel'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\n\nexport function createReactPlugin({\n Component,\n ...config\n}: {\n name: string\n id?: string\n defaultOpen?: boolean\n Component: (props: DevtoolsPanelProps) => JSX.Element\n}) {\n function Plugin() {\n return {\n ...config,\n render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => (\n <Component {...props} />\n ),\n }\n }\n function NoOpPlugin() {\n return {\n ...config,\n render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => <></>,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"mappings":";;AAIA,SAAgB,kBAAkB,EAChC,WACA,GAAG,UAMF;CACD,SAAS,SAAS;AAChB,SAAO;GACL,GAAG;GACH,SAAS,KAAkB,UACzB,oBAAC,WAAD,EAAW,GAAI,OAAS,CAAA;GAE3B;;CAEH,SAAS,aAAa;AACpB,SAAO;GACL,GAAG;GACH,SAAS,KAAkB,WAAwC,oBAAA,UAAA,EAAK,CAAA;GACzE;;AAEH,QAAO,CAAC,QAAQ,WAAW"}
@@ -3,21 +3,13 @@ import { lazy } from 'solid-js';
3
3
 
4
4
  // src/solid/class-mount-impl.tsx
5
5
  var _tmpl$ = /* @__PURE__ */ template(`<div style=height:100%>`);
6
- function __mountComponent(el, theme, importFn) {
6
+ function __mountComponent(el, props, importFn) {
7
7
  const Component = lazy(importFn);
8
- const ThemeProvider = lazy(() => import('@tanstack/devtools-ui').then((m) => ({
9
- default: m.ThemeContextProvider
10
- })));
11
8
  return render(() => createComponent(Portal, {
12
9
  mount: el,
13
10
  get children() {
14
11
  var _el$ = _tmpl$();
15
- insert(_el$, createComponent(ThemeProvider, {
16
- theme,
17
- get children() {
18
- return createComponent(Component, {});
19
- }
20
- }));
12
+ insert(_el$, createComponent(Component, props));
21
13
  return _el$;
22
14
  }
23
15
  }), el);
@@ -3,20 +3,12 @@ import { lazy } from 'solid-js';
3
3
 
4
4
  // src/solid/class-mount-impl.tsx
5
5
  var _tmpl$ = ['<div style="', '">', "</div>"];
6
- function __mountComponent(el, theme, importFn) {
6
+ function __mountComponent(el, props, importFn) {
7
7
  const Component = lazy(importFn);
8
- const ThemeProvider = lazy(() => import('@tanstack/devtools-ui').then((m) => ({
9
- default: m.ThemeContextProvider
10
- })));
11
8
  return render(() => createComponent(Portal, {
12
9
  mount: el,
13
10
  get children() {
14
- return ssr(_tmpl$, ssrStyleProperty("height:", "100%"), escape(createComponent(ThemeProvider, {
15
- theme,
16
- get children() {
17
- return createComponent(Component, {});
18
- }
19
- })));
11
+ return ssr(_tmpl$, ssrStyleProperty("height:", "100%"), escape(createComponent(Component, props)));
20
12
  }
21
13
  }), el);
22
14
  }
@@ -0,0 +1 @@
1
+ export { __mountComponent } from '../chunk/WUD4VD3N.js';
@@ -0,0 +1 @@
1
+ export { __mountComponent } from '../chunk/7TSS377A.js';
@@ -1,4 +1,4 @@
1
- export { __mountComponent } from './chunk/ZXPCWXRH.js';
1
+ export { __mountComponent } from './chunk/7TSS377A.js';
2
2
  import { use, createComponent, template } from 'solid-js/web';
3
3
  import { createSignal, onMount, onCleanup } from 'solid-js';
4
4
 
@@ -11,19 +11,19 @@ function constructCoreClass(importFn) {
11
11
  #dispose;
12
12
  constructor() {
13
13
  }
14
- async mount(el, theme) {
14
+ async mount(el, props) {
15
15
  if (this.#isMounted || this.#isMounting) {
16
16
  throw new Error("Devtools is already mounted");
17
17
  }
18
18
  this.#isMounting = true;
19
19
  this.#abortMount = false;
20
20
  try {
21
- const { __mountComponent: __mountComponent2 } = await import('./class-mount-impl/ZAIAXV4M.js');
21
+ const { __mountComponent: __mountComponent2 } = await import('./class-mount-impl/VN5QTPB3.js');
22
22
  if (this.#abortMount) {
23
23
  this.#isMounting = false;
24
24
  return;
25
25
  }
26
- this.#dispose = __mountComponent2(el, theme, importFn);
26
+ this.#dispose = __mountComponent2(el, props, importFn);
27
27
  this.#isMounted = true;
28
28
  this.#isMounting = false;
29
29
  } catch (err) {
@@ -48,7 +48,7 @@ function constructCoreClass(importFn) {
48
48
  constructor() {
49
49
  super();
50
50
  }
51
- async mount(_el, _theme) {
51
+ async mount(_el, _props) {
52
52
  }
53
53
  unmount() {
54
54
  }
@@ -62,7 +62,7 @@ function createSolidPanel(CoreClass) {
62
62
  const [devtools] = createSignal(new CoreClass());
63
63
  onMount(() => {
64
64
  if (devToolRef) {
65
- devtools().mount(devToolRef, props?.theme ?? "dark");
65
+ devtools().mount(devToolRef, props);
66
66
  }
67
67
  onCleanup(() => {
68
68
  devtools().unmount();
@@ -87,17 +87,15 @@ function createSolidPlugin({
87
87
  function Plugin() {
88
88
  return {
89
89
  ...config,
90
- render: (_el, theme) => {
91
- return createComponent(Component, {
92
- theme
93
- });
90
+ render: (_el, props) => {
91
+ return createComponent(Component, props);
94
92
  }
95
93
  };
96
94
  }
97
95
  function NoOpPlugin() {
98
96
  return {
99
97
  ...config,
100
- render: (_el, _theme) => []
98
+ render: (_el, _props) => []
101
99
  };
102
100
  }
103
101
  return [Plugin, NoOpPlugin];
@@ -1,3 +1,4 @@
1
+ import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
1
2
  import * as solid_js from 'solid-js';
2
3
  import { JSX } from 'solid-js';
3
4
 
@@ -11,19 +12,19 @@ import { JSX } from 'solid-js';
11
12
  * @returns Tuple containing the DevtoolsCore class and a NoOpDevtoolsCore class
12
13
  */
13
14
  declare function constructCoreClass(importFn: () => Promise<{
14
- default: () => JSX.Element;
15
+ default: (props: TanStackDevtoolsPluginProps) => JSX.Element;
15
16
  }>): readonly [{
16
17
  new (): {
17
18
  "__#private@#isMounted": boolean;
18
19
  "__#private@#isMounting": boolean;
19
20
  "__#private@#abortMount": boolean;
20
21
  "__#private@#dispose"?: () => void;
21
- mount<T extends HTMLElement>(el: T, theme: "light" | "dark"): Promise<void>;
22
+ mount<T extends HTMLElement>(el: T, props: TanStackDevtoolsPluginProps): Promise<void>;
22
23
  unmount(): void;
23
24
  };
24
25
  }, {
25
26
  new (): {
26
- mount<T extends HTMLElement>(_el: T, _theme: "light" | "dark"): Promise<void>;
27
+ mount<T extends HTMLElement>(_el: T, _props: TanStackDevtoolsPluginProps): Promise<void>;
27
28
  unmount(): void;
28
29
  "__#private@#isMounted": boolean;
29
30
  "__#private@#isMounting": boolean;
@@ -33,10 +34,9 @@ declare function constructCoreClass(importFn: () => Promise<{
33
34
  }];
34
35
  type ClassType = ReturnType<typeof constructCoreClass>[0];
35
36
 
36
- interface DevtoolsPanelProps {
37
- theme?: 'light' | 'dark';
37
+ interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {
38
38
  }
39
- declare function createSolidPanel<TComponentProps extends DevtoolsPanelProps | undefined>(CoreClass: ClassType): readonly [(props: TComponentProps) => solid_js.JSX.Element, (_props: TComponentProps) => solid_js.JSX.Element];
39
+ declare function createSolidPanel<TComponentProps extends DevtoolsPanelProps>(CoreClass: ClassType): readonly [(props: TComponentProps) => solid_js.JSX.Element, (_props: TComponentProps) => solid_js.JSX.Element];
40
40
 
41
41
  /** @jsxImportSource solid-js - we use Solid.js as JSX here */
42
42
 
@@ -46,12 +46,12 @@ declare function createSolidPlugin({ Component, ...config }: {
46
46
  defaultOpen?: boolean;
47
47
  Component: (props: DevtoolsPanelProps) => JSX.Element;
48
48
  }): readonly [() => {
49
- render: (_el: HTMLElement, theme: "light" | "dark") => JSX.Element;
49
+ render: (_el: HTMLElement, props: TanStackDevtoolsPluginProps) => JSX.Element;
50
50
  name: string;
51
51
  id?: string;
52
52
  defaultOpen?: boolean;
53
53
  }, () => {
54
- render: (_el: HTMLElement, _theme: "light" | "dark") => JSX.Element;
54
+ render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => JSX.Element;
55
55
  name: string;
56
56
  id?: string;
57
57
  defaultOpen?: boolean;
@@ -59,8 +59,8 @@ declare function createSolidPlugin({ Component, ...config }: {
59
59
 
60
60
  /** @jsxImportSource solid-js - we use Solid.js as JSX here */
61
61
 
62
- declare function __mountComponent(el: HTMLElement, theme: 'light' | 'dark', importFn: () => Promise<{
63
- default: () => JSX.Element;
62
+ declare function __mountComponent(el: HTMLElement, props: TanStackDevtoolsPluginProps, importFn: () => Promise<{
63
+ default: (props: TanStackDevtoolsPluginProps) => JSX.Element;
64
64
  }>): () => void;
65
65
 
66
66
  export { type ClassType, type DevtoolsPanelProps, __mountComponent, constructCoreClass, createSolidPanel, createSolidPlugin };