@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/solid/esm/index.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];
|
package/dist/solid/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { __mountComponent } from './chunk/
|
|
1
|
+
export { __mountComponent } from './chunk/WUD4VD3N.js';
|
|
2
2
|
import { ssr, ssrStyleProperty, createComponent } 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/5TF6RAHJ.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
|
}
|
|
@@ -78,17 +78,15 @@ function createSolidPlugin({
|
|
|
78
78
|
function Plugin() {
|
|
79
79
|
return {
|
|
80
80
|
...config,
|
|
81
|
-
render: (_el,
|
|
82
|
-
return createComponent(Component,
|
|
83
|
-
theme
|
|
84
|
-
});
|
|
81
|
+
render: (_el, props) => {
|
|
82
|
+
return createComponent(Component, props);
|
|
85
83
|
}
|
|
86
84
|
};
|
|
87
85
|
}
|
|
88
86
|
function NoOpPlugin() {
|
|
89
87
|
return {
|
|
90
88
|
...config,
|
|
91
|
-
render: (_el,
|
|
89
|
+
render: (_el, _props) => []
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
92
|
return [Plugin, NoOpPlugin];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
|
|
3
|
+
export declare function __mountComponent(el: HTMLElement, props: TanStackDevtoolsPluginProps, importFn: () => Promise<{
|
|
4
|
+
default: (props: TanStackDevtoolsPluginProps) => JSX.Element;
|
|
4
5
|
}>): () => void;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Portal, createComponent, insert, render, template } from "solid-js/web";
|
|
2
2
|
import { lazy } from "solid-js";
|
|
3
|
+
//#region src/solid/class-mount-impl.tsx
|
|
4
|
+
/** @jsxImportSource solid-js - we use Solid.js as JSX here */
|
|
3
5
|
var _tmpl$ = /* @__PURE__ */ template(`<div style=height:100%>`);
|
|
4
|
-
function __mountComponent(el,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
theme,
|
|
15
|
-
get children() {
|
|
16
|
-
return createComponent(Component, {});
|
|
17
|
-
}
|
|
18
|
-
}));
|
|
19
|
-
return _el$;
|
|
20
|
-
}
|
|
21
|
-
}), el);
|
|
6
|
+
function __mountComponent(el, props, importFn) {
|
|
7
|
+
const Component = lazy(importFn);
|
|
8
|
+
return render(() => createComponent(Portal, {
|
|
9
|
+
mount: el,
|
|
10
|
+
get children() {
|
|
11
|
+
var _el$ = _tmpl$();
|
|
12
|
+
insert(_el$, createComponent(Component, props));
|
|
13
|
+
return _el$;
|
|
14
|
+
}
|
|
15
|
+
}), el);
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=class-mount-impl.js.map
|
|
17
|
+
//#endregion
|
|
18
|
+
export { __mountComponent };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=class-mount-impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class-mount-impl.js","sources":["../../../src/solid/class-mount-impl.tsx"],"sourcesContent":["/** @jsxImportSource solid-js - we use Solid.js as JSX here */\n\nimport { lazy } from 'solid-js'\nimport { Portal, render } from 'solid-js/web'\nimport type { JSX } from 'solid-js'\n\nexport function __mountComponent(\n el: HTMLElement,\n
|
|
1
|
+
{"version":3,"file":"class-mount-impl.js","names":["lazy","Portal","render","JSX","TanStackDevtoolsPluginProps","__mountComponent","el","HTMLElement","props","importFn","Promise","default","Element","Component","_$createComponent","mount","children","_el$","_tmpl$","_$insert"],"sources":["../../../src/solid/class-mount-impl.tsx"],"sourcesContent":["/** @jsxImportSource solid-js - we use Solid.js as JSX here */\n\nimport { lazy } from 'solid-js'\nimport { Portal, render } from 'solid-js/web'\n\nimport type { JSX } from 'solid-js'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\n\nexport function __mountComponent(\n el: HTMLElement,\n props: TanStackDevtoolsPluginProps,\n importFn: () => Promise<{\n default: (props: TanStackDevtoolsPluginProps) => JSX.Element\n }>,\n): () => void {\n const Component = lazy(importFn)\n\n return render(\n () => (\n <Portal mount={el}>\n <div style={{ height: '100%' }}>\n <Component {...props} />\n </div>\n </Portal>\n ),\n el,\n )\n}\n"],"mappings":";;;;;AAQA,SAAgBK,iBACdC,IACAE,OACAC,UAGY;CACZ,MAAMI,YAAYb,KAAKS,SAAS;AAEhC,QAAOP,aACLY,gBACGb,QAAM;EAACc,OAAOT;EAAE,IAAAU,WAAA;GAAA,IAAAC,OAAAC,QAAA;AAAAC,UAAAF,MAAAH,gBAEZD,WAAcL,MAAK,CAAA;AAAA,UAAAS;;EAAA,CAGzB,EACDX,GACD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
|
|
1
2
|
import { JSX } from 'solid-js';
|
|
2
3
|
/**
|
|
3
4
|
* Constructs the core class for the Devtools.
|
|
@@ -9,19 +10,19 @@ import { JSX } from 'solid-js';
|
|
|
9
10
|
* @returns Tuple containing the DevtoolsCore class and a NoOpDevtoolsCore class
|
|
10
11
|
*/
|
|
11
12
|
export declare function constructCoreClass(importFn: () => Promise<{
|
|
12
|
-
default: () => JSX.Element;
|
|
13
|
+
default: (props: TanStackDevtoolsPluginProps) => JSX.Element;
|
|
13
14
|
}>): readonly [{
|
|
14
15
|
new (): {
|
|
15
16
|
"__#private@#isMounted": boolean;
|
|
16
17
|
"__#private@#isMounting": boolean;
|
|
17
18
|
"__#private@#abortMount": boolean;
|
|
18
19
|
"__#private@#dispose"?: () => void;
|
|
19
|
-
mount<T extends HTMLElement>(el: T,
|
|
20
|
+
mount<T extends HTMLElement>(el: T, props: TanStackDevtoolsPluginProps): Promise<void>;
|
|
20
21
|
unmount(): void;
|
|
21
22
|
};
|
|
22
23
|
}, {
|
|
23
24
|
new (): {
|
|
24
|
-
mount<T extends HTMLElement>(_el: T,
|
|
25
|
+
mount<T extends HTMLElement>(_el: T, _props: TanStackDevtoolsPluginProps): Promise<void>;
|
|
25
26
|
unmount(): void;
|
|
26
27
|
"__#private@#isMounted": boolean;
|
|
27
28
|
"__#private@#isMounting": boolean;
|
|
@@ -1,56 +1,59 @@
|
|
|
1
|
+
//#region src/solid/class.ts
|
|
2
|
+
/**
|
|
3
|
+
* Constructs the core class for the Devtools.
|
|
4
|
+
* This utility is used to construct a lazy loaded Solid component for the Devtools.
|
|
5
|
+
* It returns a tuple containing the main DevtoolsCore class and a NoOpDevtoolsCore class.
|
|
6
|
+
* The NoOpDevtoolsCore class is a no-op implementation that can be used for production if you want to explicitly exclude
|
|
7
|
+
* the Devtools from your application.
|
|
8
|
+
* @param importFn A function that returns a dynamic import of the Solid component
|
|
9
|
+
* @returns Tuple containing the DevtoolsCore class and a NoOpDevtoolsCore class
|
|
10
|
+
*/
|
|
1
11
|
function constructCoreClass(importFn) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
async mount(_el, _theme) {
|
|
47
|
-
}
|
|
48
|
-
unmount() {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return [DevtoolsCore, NoOpDevtoolsCore];
|
|
12
|
+
class DevtoolsCore {
|
|
13
|
+
#isMounted = false;
|
|
14
|
+
#isMounting = false;
|
|
15
|
+
#abortMount = false;
|
|
16
|
+
#dispose;
|
|
17
|
+
constructor() {}
|
|
18
|
+
async mount(el, props) {
|
|
19
|
+
if (this.#isMounted || this.#isMounting) throw new Error("Devtools is already mounted");
|
|
20
|
+
this.#isMounting = true;
|
|
21
|
+
this.#abortMount = false;
|
|
22
|
+
try {
|
|
23
|
+
const { __mountComponent } = await import("./class-mount-impl.js");
|
|
24
|
+
if (this.#abortMount) {
|
|
25
|
+
this.#isMounting = false;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.#dispose = __mountComponent(el, props, importFn);
|
|
29
|
+
this.#isMounted = true;
|
|
30
|
+
this.#isMounting = false;
|
|
31
|
+
} catch (err) {
|
|
32
|
+
this.#isMounting = false;
|
|
33
|
+
console.error("[TanStack Devtools] Failed to load:", err);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
unmount() {
|
|
37
|
+
if (!this.#isMounted && !this.#isMounting) throw new Error("Devtools is not mounted");
|
|
38
|
+
if (this.#isMounting) {
|
|
39
|
+
this.#abortMount = true;
|
|
40
|
+
this.#isMounting = false;
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.#dispose?.();
|
|
44
|
+
this.#isMounted = false;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
class NoOpDevtoolsCore extends DevtoolsCore {
|
|
48
|
+
constructor() {
|
|
49
|
+
super();
|
|
50
|
+
}
|
|
51
|
+
async mount(_el, _props) {}
|
|
52
|
+
unmount() {}
|
|
53
|
+
}
|
|
54
|
+
return [DevtoolsCore, NoOpDevtoolsCore];
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=class.js.map
|
|
56
|
+
//#endregion
|
|
57
|
+
export { constructCoreClass };
|
|
58
|
+
|
|
59
|
+
//# sourceMappingURL=class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"class.js","sources":["../../../src/solid/class.ts"],"sourcesContent":["import type { JSX } from 'solid-js'\n\n/**\n * Constructs the core class for the Devtools.\n * This utility is used to construct a lazy loaded Solid component for the Devtools.\n * It returns a tuple containing the main DevtoolsCore class and a NoOpDevtoolsCore class.\n * The NoOpDevtoolsCore class is a no-op implementation that can be used for production if you want to explicitly exclude\n * the Devtools from your application.\n * @param importFn A function that returns a dynamic import of the Solid component\n * @returns Tuple containing the DevtoolsCore class and a NoOpDevtoolsCore class\n */\nexport function constructCoreClass(\n importFn: () => Promise<{
|
|
1
|
+
{"version":3,"file":"class.js","names":["#isMounted","#isMounting","#abortMount","#dispose"],"sources":["../../../src/solid/class.ts"],"sourcesContent":["import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\nimport type { JSX } from 'solid-js'\n\n/**\n * Constructs the core class for the Devtools.\n * This utility is used to construct a lazy loaded Solid component for the Devtools.\n * It returns a tuple containing the main DevtoolsCore class and a NoOpDevtoolsCore class.\n * The NoOpDevtoolsCore class is a no-op implementation that can be used for production if you want to explicitly exclude\n * the Devtools from your application.\n * @param importFn A function that returns a dynamic import of the Solid component\n * @returns Tuple containing the DevtoolsCore class and a NoOpDevtoolsCore class\n */\nexport function constructCoreClass(\n importFn: () => Promise<{\n default: (props: TanStackDevtoolsPluginProps) => JSX.Element\n }>,\n) {\n class DevtoolsCore {\n #isMounted = false\n #isMounting = false\n #abortMount = false\n #dispose?: () => void\n\n constructor() {}\n\n async mount<T extends HTMLElement>(\n el: T,\n props: TanStackDevtoolsPluginProps,\n ) {\n if (this.#isMounted || this.#isMounting) {\n throw new Error('Devtools is already mounted')\n }\n this.#isMounting = true\n this.#abortMount = false\n\n try {\n const { __mountComponent } = await import('./class-mount-impl')\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- can be set by unmount() during await\n if (this.#abortMount) {\n this.#isMounting = false\n return\n }\n\n this.#dispose = __mountComponent(el, props, importFn)\n this.#isMounted = true\n this.#isMounting = false\n } catch (err) {\n this.#isMounting = false\n console.error('[TanStack Devtools] Failed to load:', err)\n }\n }\n\n unmount() {\n if (!this.#isMounted && !this.#isMounting) {\n throw new Error('Devtools is not mounted')\n }\n\n if (this.#isMounting) {\n this.#abortMount = true\n this.#isMounting = false\n return\n }\n\n this.#dispose?.()\n this.#isMounted = false\n }\n }\n\n class NoOpDevtoolsCore extends DevtoolsCore {\n constructor() {\n super()\n }\n async mount<T extends HTMLElement>(\n _el: T,\n _props: TanStackDevtoolsPluginProps,\n ) {}\n unmount() {}\n }\n\n return [DevtoolsCore, NoOpDevtoolsCore] as const\n}\n\nexport type ClassType = ReturnType<typeof constructCoreClass>[0]\n"],"mappings":";;;;;;;;;;AAYA,SAAgB,mBACd,UAGA;CACA,MAAM,aAAa;EACjB,aAAa;EACb,cAAc;EACd,cAAc;EACd;EAEA,cAAc;EAEd,MAAM,MACJ,IACA,OACA;AACA,OAAI,MAAA,aAAmB,MAAA,WACrB,OAAM,IAAI,MAAM,8BAA8B;AAEhD,SAAA,aAAmB;AACnB,SAAA,aAAmB;AAEnB,OAAI;IACF,MAAM,EAAE,qBAAqB,MAAM,OAAO;AAE1C,QAAI,MAAA,YAAkB;AACpB,WAAA,aAAmB;AACnB;;AAGF,UAAA,UAAgB,iBAAiB,IAAI,OAAO,SAAS;AACrD,UAAA,YAAkB;AAClB,UAAA,aAAmB;YACZ,KAAK;AACZ,UAAA,aAAmB;AACnB,YAAQ,MAAM,uCAAuC,IAAI;;;EAI7D,UAAU;AACR,OAAI,CAAC,MAAA,aAAmB,CAAC,MAAA,WACvB,OAAM,IAAI,MAAM,0BAA0B;AAG5C,OAAI,MAAA,YAAkB;AACpB,UAAA,aAAmB;AACnB,UAAA,aAAmB;AACnB;;AAGF,SAAA,WAAiB;AACjB,SAAA,YAAkB;;;CAItB,MAAM,yBAAyB,aAAa;EAC1C,cAAc;AACZ,UAAO;;EAET,MAAM,MACJ,KACA,QACA;EACF,UAAU;;AAGZ,QAAO,CAAC,cAAc,iBAAiB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassType } from './class.js';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
|
|
3
|
+
export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {
|
|
4
4
|
}
|
|
5
|
-
export declare function createSolidPanel<TComponentProps extends DevtoolsPanelProps
|
|
5
|
+
export declare function createSolidPanel<TComponentProps extends DevtoolsPanelProps>(CoreClass: ClassType): readonly [(props: TComponentProps) => import("solid-js").JSX.Element, (_props: TComponentProps) => import("solid-js").JSX.Element];
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { JSX } from 'solid-js';
|
|
2
2
|
import { DevtoolsPanelProps } from './panel.js';
|
|
3
|
+
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
|
|
3
4
|
export declare function createSolidPlugin({ 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;
|
package/dist/vue/esm/index.js
CHANGED
package/dist/vue/esm/panel.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { TanStackDevtoolsPluginProps } from '@tanstack/devtools';
|
|
1
2
|
import { DefineComponent } from 'vue';
|
|
2
|
-
export interface DevtoolsPanelProps {
|
|
3
|
-
theme?: 'dark' | 'light' | 'system';
|
|
3
|
+
export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {
|
|
4
4
|
}
|
|
5
5
|
export declare function createVuePanel<TComponentProps extends DevtoolsPanelProps, TCoreDevtoolsClass extends {
|
|
6
|
-
mount: (el: HTMLElement,
|
|
6
|
+
mount: (el: HTMLElement, props?: TanStackDevtoolsPluginProps) => void;
|
|
7
7
|
unmount: () => void;
|
|
8
8
|
}>(CoreClass: new (props: TComponentProps) => TCoreDevtoolsClass): [DefineComponent<{
|
|
9
9
|
theme?: DevtoolsPanelProps["theme"];
|
package/dist/vue/esm/panel.js
CHANGED
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
import { defineComponent,
|
|
1
|
+
import { defineComponent, h, onMounted, onUnmounted, ref } from "vue";
|
|
2
|
+
//#region src/vue/panel.ts
|
|
2
3
|
function createVuePanel(CoreClass) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const NoOpPanel = defineComponent({
|
|
37
|
-
props,
|
|
38
|
-
setup() {
|
|
39
|
-
return () => null;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
return [Panel, NoOpPanel];
|
|
4
|
+
const props = {
|
|
5
|
+
props: { type: Object },
|
|
6
|
+
devtoolsProps: { type: Object }
|
|
7
|
+
};
|
|
8
|
+
return [defineComponent({
|
|
9
|
+
props,
|
|
10
|
+
setup(config) {
|
|
11
|
+
const devToolRef = ref(null);
|
|
12
|
+
const devtools = ref(null);
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
const instance = new CoreClass(config.devtoolsProps);
|
|
15
|
+
devtools.value = instance;
|
|
16
|
+
if (devToolRef.value) instance.mount(devToolRef.value, config.props);
|
|
17
|
+
});
|
|
18
|
+
onUnmounted(() => {
|
|
19
|
+
if (devToolRef.value && devtools.value) devtools.value.unmount();
|
|
20
|
+
});
|
|
21
|
+
return () => {
|
|
22
|
+
return h("div", {
|
|
23
|
+
style: { height: "100%" },
|
|
24
|
+
ref: devToolRef
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}), defineComponent({
|
|
29
|
+
props,
|
|
30
|
+
setup() {
|
|
31
|
+
return () => null;
|
|
32
|
+
}
|
|
33
|
+
})];
|
|
43
34
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=panel.js.map
|
|
35
|
+
//#endregion
|
|
36
|
+
export { createVuePanel };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"panel.js","sources":["../../../src/vue/panel.ts"],"sourcesContent":["import { defineComponent, h, onMounted, onUnmounted, ref } from 'vue'\nimport type { DefineComponent } from 'vue'\n\nexport interface DevtoolsPanelProps
|
|
1
|
+
{"version":3,"file":"panel.js","names":[],"sources":["../../../src/vue/panel.ts"],"sourcesContent":["import { defineComponent, h, onMounted, onUnmounted, ref } from 'vue'\nimport type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'\nimport type { DefineComponent } from 'vue'\n\nexport interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {}\n\nexport function createVuePanel<\n TComponentProps extends DevtoolsPanelProps,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, props?: TanStackDevtoolsPluginProps) => void\n unmount: () => void\n },\n>(CoreClass: new (props: TComponentProps) => TCoreDevtoolsClass) {\n const props = {\n props: {\n type: Object as () => DevtoolsPanelProps,\n },\n devtoolsProps: {\n type: Object as () => TComponentProps,\n },\n }\n\n const Panel = defineComponent({\n props,\n setup(config) {\n const devToolRef = ref<HTMLElement | null>(null)\n const devtools = ref<TCoreDevtoolsClass | null>(null)\n\n onMounted(() => {\n const instance = new CoreClass(config.devtoolsProps as TComponentProps)\n devtools.value = instance\n\n if (devToolRef.value) {\n instance.mount(devToolRef.value, config.props)\n }\n })\n\n onUnmounted(() => {\n if (devToolRef.value && devtools.value) {\n devtools.value.unmount()\n }\n })\n\n return () => {\n return h('div', {\n style: { height: '100%' },\n ref: devToolRef,\n })\n }\n },\n })\n\n const NoOpPanel = defineComponent({\n props,\n setup() {\n return () => null\n },\n })\n\n return [Panel, NoOpPanel] as unknown as [\n DefineComponent<{\n theme?: DevtoolsPanelProps['theme']\n devtoolsProps: TComponentProps\n }>,\n DefineComponent<{\n theme?: DevtoolsPanelProps['theme']\n devtoolsProps: TComponentProps\n }>,\n ]\n}\n"],"mappings":";;AAMA,SAAgB,eAMd,WAA+D;CAC/D,MAAM,QAAQ;EACZ,OAAO,EACL,MAAM,QACP;EACD,eAAe,EACb,MAAM,QACP;EACF;AAuCD,QAAO,CArCO,gBAAgB;EAC5B;EACA,MAAM,QAAQ;GACZ,MAAM,aAAa,IAAwB,KAAK;GAChD,MAAM,WAAW,IAA+B,KAAK;AAErD,mBAAgB;IACd,MAAM,WAAW,IAAI,UAAU,OAAO,cAAiC;AACvE,aAAS,QAAQ;AAEjB,QAAI,WAAW,MACb,UAAS,MAAM,WAAW,OAAO,OAAO,MAAM;KAEhD;AAEF,qBAAkB;AAChB,QAAI,WAAW,SAAS,SAAS,MAC/B,UAAS,MAAM,SAAS;KAE1B;AAEF,gBAAa;AACX,WAAO,EAAE,OAAO;KACd,OAAO,EAAE,QAAQ,QAAQ;KACzB,KAAK;KACN,CAAC;;;EAGP,CAAC,EAEgB,gBAAgB;EAChC;EACA,QAAQ;AACN,gBAAa;;EAEhB,CAAC,CAEuB"}
|
package/dist/vue/esm/plugin.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { Fragment } from "vue";
|
|
2
|
+
//#region src/vue/plugin.ts
|
|
2
3
|
function createVuePlugin(name, component) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
function Plugin(props) {
|
|
5
|
+
return {
|
|
6
|
+
name,
|
|
7
|
+
component,
|
|
8
|
+
props
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function NoOpPlugin(props) {
|
|
12
|
+
return {
|
|
13
|
+
name,
|
|
14
|
+
component: Fragment,
|
|
15
|
+
props
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return [Plugin, NoOpPlugin];
|
|
18
19
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=plugin.js.map
|
|
20
|
+
//#endregion
|
|
21
|
+
export { createVuePlugin };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["../../../src/vue/plugin.ts"],"sourcesContent":["import { Fragment } from 'vue'\nimport type { DefineComponent } from 'vue'\n\nexport function createVuePlugin<TComponentProps extends Record<string, any>>(\n name: string,\n component: DefineComponent<TComponentProps, {}, unknown>,\n) {\n function Plugin(props: TComponentProps) {\n return {\n name,\n component,\n props,\n }\n }\n function NoOpPlugin(props: TComponentProps) {\n return {\n name,\n component: Fragment,\n props,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"
|
|
1
|
+
{"version":3,"file":"plugin.js","names":[],"sources":["../../../src/vue/plugin.ts"],"sourcesContent":["import { Fragment } from 'vue'\nimport type { DefineComponent } from 'vue'\n\nexport function createVuePlugin<TComponentProps extends Record<string, any>>(\n name: string,\n component: DefineComponent<TComponentProps, {}, unknown>,\n) {\n function Plugin(props: TComponentProps) {\n return {\n name,\n component,\n props,\n }\n }\n function NoOpPlugin(props: TComponentProps) {\n return {\n name,\n component: Fragment,\n props,\n }\n }\n return [Plugin, NoOpPlugin] as const\n}\n"],"mappings":";;AAGA,SAAgB,gBACd,MACA,WACA;CACA,SAAS,OAAO,OAAwB;AACtC,SAAO;GACL;GACA;GACA;GACD;;CAEH,SAAS,WAAW,OAAwB;AAC1C,SAAO;GACL;GACA,WAAW;GACX;GACD;;AAEH,QAAO,CAAC,QAAQ,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/devtools-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TanStack Devtools utilities for creating your own devtools.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -72,8 +72,11 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18"
|
|
74
74
|
},
|
|
75
|
-
"
|
|
76
|
-
"
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"tsup": "^8.5.0",
|
|
77
|
+
"tsup-preset-solid": "^2.2.0",
|
|
78
|
+
"vite-plugin-solid": "^2.11.11",
|
|
79
|
+
"@tanstack/devtools": "^0.11.0"
|
|
77
80
|
},
|
|
78
81
|
"peerDependencies": {
|
|
79
82
|
"@types/react": ">=17.0.0",
|
|
@@ -105,11 +108,6 @@
|
|
|
105
108
|
"skills",
|
|
106
109
|
"bin"
|
|
107
110
|
],
|
|
108
|
-
"devDependencies": {
|
|
109
|
-
"tsup": "^8.5.0",
|
|
110
|
-
"tsup-preset-solid": "^2.2.0",
|
|
111
|
-
"vite-plugin-solid": "^2.11.8"
|
|
112
|
-
},
|
|
113
111
|
"scripts": {
|
|
114
112
|
"clean": "premove ./build ./dist",
|
|
115
113
|
"lint:fix": "eslint ./src --fix",
|
package/src/preact/panel.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/** @jsxImportSource preact */
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef } from 'preact/hooks'
|
|
4
|
+
import type { TanStackDevtoolsPluginProps } from '@tanstack/devtools'
|
|
4
5
|
|
|
5
|
-
export interface DevtoolsPanelProps {
|
|
6
|
-
theme?: 'light' | 'dark'
|
|
7
|
-
}
|
|
6
|
+
export interface DevtoolsPanelProps extends TanStackDevtoolsPluginProps {}
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Creates a Preact component that dynamically imports and mounts a devtools panel. SSR friendly.
|
|
@@ -24,9 +23,9 @@ export interface DevtoolsPanelProps {
|
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
25
|
export function createPreactPanel<
|
|
27
|
-
TComponentProps extends DevtoolsPanelProps
|
|
26
|
+
TComponentProps extends DevtoolsPanelProps,
|
|
28
27
|
TCoreDevtoolsClass extends {
|
|
29
|
-
mount: (el: HTMLElement,
|
|
28
|
+
mount: (el: HTMLElement, props: TanStackDevtoolsPluginProps) => void
|
|
30
29
|
unmount: () => void
|
|
31
30
|
},
|
|
32
31
|
>(CoreClass: new () => TCoreDevtoolsClass) {
|
|
@@ -38,7 +37,7 @@ export function createPreactPanel<
|
|
|
38
37
|
devtools.current = new CoreClass()
|
|
39
38
|
|
|
40
39
|
if (devToolRef.current) {
|
|
41
|
-
devtools.current.mount(devToolRef.current, props
|
|
40
|
+
devtools.current.mount(devToolRef.current, props)
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
return () => {
|
|
@@ -47,7 +46,7 @@ export function createPreactPanel<
|
|
|
47
46
|
devtools.current = null
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
|
-
}, [props
|
|
49
|
+
}, [props])
|
|
51
50
|
|
|
52
51
|
return <div style={{ height: '100%' }} ref={devToolRef} />
|
|
53
52
|
}
|