@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.
- package/dist/preact/esm/index.js +1 -5
- package/dist/preact/esm/panel.d.ts +4 -5
- package/dist/preact/esm/panel.js +48 -28
- package/dist/preact/esm/panel.js.map +1 -1
- package/dist/preact/esm/plugin.d.ts +3 -2
- package/dist/preact/esm/plugin.js +20 -22
- package/dist/preact/esm/plugin.js.map +1 -1
- package/dist/react/esm/index.js +1 -5
- package/dist/react/esm/panel.d.ts +4 -4
- package/dist/react/esm/panel.js +47 -28
- package/dist/react/esm/panel.js.map +1 -1
- package/dist/react/esm/plugin.d.ts +3 -2
- package/dist/react/esm/plugin.js +20 -22
- package/dist/react/esm/plugin.js.map +1 -1
- package/dist/solid/esm/chunk/{ZXPCWXRH.js → 7TSS377A.js} +2 -10
- package/dist/solid/esm/chunk/{UX5ZZ4MG.js → WUD4VD3N.js} +2 -10
- package/dist/solid/esm/class-mount-impl/5TF6RAHJ.js +1 -0
- package/dist/solid/esm/class-mount-impl/VN5QTPB3.js +1 -0
- package/dist/solid/esm/dev.js +9 -11
- package/dist/solid/esm/index.d.ts +10 -10
- package/dist/solid/esm/index.js +9 -11
- package/dist/solid/esm/server.js +8 -10
- package/dist/solid-class/esm/class-mount-impl.d.ts +3 -2
- package/dist/solid-class/esm/class-mount-impl.js +17 -23
- package/dist/solid-class/esm/class-mount-impl.js.map +1 -1
- package/dist/solid-class/esm/class.d.ts +4 -3
- package/dist/solid-class/esm/class.js +57 -54
- package/dist/solid-class/esm/class.js.map +1 -1
- package/dist/solid-class/esm/panel.d.ts +3 -3
- package/dist/solid-class/esm/plugin.d.ts +3 -2
- package/dist/vue/esm/index.js +1 -5
- package/dist/vue/esm/panel.d.ts +3 -3
- package/dist/vue/esm/panel.js +36 -45
- package/dist/vue/esm/panel.js.map +1 -1
- package/dist/vue/esm/plugin.js +20 -19
- package/dist/vue/esm/plugin.js.map +1 -1
- package/package.json +6 -8
- package/src/preact/panel.tsx +6 -7
- package/src/preact/plugin.tsx +4 -3
- package/src/react/panel.tsx +6 -7
- package/src/react/plugin.tsx +4 -3
- package/src/solid/class-mount-impl.tsx +7 -10
- package/src/solid/class.test.tsx +43 -12
- package/src/solid/class.ts +15 -4
- package/src/solid/panel.tsx +6 -7
- package/src/solid/plugin.tsx +4 -3
- package/src/vue/panel.ts +6 -7
- package/dist/preact/esm/index.js.map +0 -1
- package/dist/react/esm/index.js.map +0 -1
- package/dist/solid/esm/class-mount-impl/LK7V47IP.js +0 -1
- package/dist/solid/esm/class-mount-impl/ZAIAXV4M.js +0 -1
- package/dist/vue/esm/index.js.map +0 -1
package/dist/preact/esm/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
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
|
|
23
|
-
mount: (el: HTMLElement,
|
|
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];
|
package/dist/preact/esm/panel.js
CHANGED
|
@@ -1,30 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
|
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,
|
|
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,
|
|
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 {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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,
|
|
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"}
|
package/dist/react/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
22
|
-
mount: (el: HTMLElement,
|
|
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];
|
package/dist/react/esm/panel.js
CHANGED
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
|
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,
|
|
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,
|
|
15
|
+
render: (_el: HTMLElement, _props: TanStackDevtoolsPluginProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
name: string;
|
|
16
17
|
id?: string;
|
|
17
18
|
defaultOpen?: boolean;
|
package/dist/react/esm/plugin.js
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
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,
|
|
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,
|
|
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(
|
|
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,
|
|
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(
|
|
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';
|
package/dist/solid/esm/dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { __mountComponent } from './chunk/
|
|
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,
|
|
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/
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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 };
|