@tanstack/devtools-utils 0.2.4 → 0.3.1
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/solid/esm/dev.js +3 -5
- package/dist/solid/esm/index.js +3 -5
- package/dist/solid/esm/server.js +3 -3
- package/dist/vue/esm/index.d.ts +2 -0
- package/dist/vue/esm/index.js +7 -0
- package/dist/vue/esm/index.js.map +1 -0
- package/dist/vue/esm/panel.d.ts +14 -0
- package/dist/vue/esm/panel.js +47 -0
- package/dist/vue/esm/panel.js.map +1 -0
- package/dist/vue/esm/plugin.d.ts +15 -0
- package/dist/vue/esm/plugin.js +22 -0
- package/dist/vue/esm/plugin.js.map +1 -0
- package/package.json +9 -3
package/dist/solid/esm/dev.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { createComponent, insert, use, template } from 'solid-js/web';
|
|
2
2
|
import { createSignal, onMount, onCleanup } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/solid/class.tsx
|
|
5
|
-
var _tmpl$ = /* @__PURE__ */ template(`<div
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div style=height:100%>`);
|
|
6
6
|
function constructCoreClass(Component) {
|
|
7
7
|
class DevtoolsCore {
|
|
8
8
|
#isMounted = false;
|
|
@@ -37,7 +37,6 @@ function constructCoreClass(Component) {
|
|
|
37
37
|
mount: mountTo,
|
|
38
38
|
get children() {
|
|
39
39
|
var _el$ = _tmpl$();
|
|
40
|
-
_el$.style.setProperty("height", "100%");
|
|
41
40
|
insert(_el$, createComponent(ThemeProvider, {
|
|
42
41
|
theme,
|
|
43
42
|
get children() {
|
|
@@ -82,7 +81,7 @@ function constructCoreClass(Component) {
|
|
|
82
81
|
}
|
|
83
82
|
return [DevtoolsCore, NoOpDevtoolsCore];
|
|
84
83
|
}
|
|
85
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<div
|
|
84
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div style=height:100%>`);
|
|
86
85
|
function createSolidPanel(CoreClass) {
|
|
87
86
|
function Panel(props) {
|
|
88
87
|
let devToolRef;
|
|
@@ -99,7 +98,6 @@ function createSolidPanel(CoreClass) {
|
|
|
99
98
|
var _el$ = _tmpl$2();
|
|
100
99
|
var _ref$ = devToolRef;
|
|
101
100
|
typeof _ref$ === "function" ? use(_ref$, _el$) : devToolRef = _el$;
|
|
102
|
-
_el$.style.setProperty("height", "100%");
|
|
103
101
|
return _el$;
|
|
104
102
|
})();
|
|
105
103
|
}
|
package/dist/solid/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { createComponent,
|
|
1
|
+
import { createComponent, insert, use, template } from 'solid-js/web';
|
|
2
2
|
import { createSignal, onMount, onCleanup } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/solid/class.tsx
|
|
5
|
-
var _tmpl$ = /* @__PURE__ */ template(`<div
|
|
5
|
+
var _tmpl$ = /* @__PURE__ */ template(`<div style=height:100%>`);
|
|
6
6
|
function constructCoreClass(Component) {
|
|
7
7
|
class DevtoolsCore {
|
|
8
8
|
#isMounted = false;
|
|
@@ -37,7 +37,6 @@ function constructCoreClass(Component) {
|
|
|
37
37
|
mount: mountTo,
|
|
38
38
|
get children() {
|
|
39
39
|
var _el$ = _tmpl$();
|
|
40
|
-
_el$.style.setProperty("height", "100%");
|
|
41
40
|
insert(_el$, createComponent(ThemeProvider, {
|
|
42
41
|
theme,
|
|
43
42
|
get children() {
|
|
@@ -82,7 +81,7 @@ function constructCoreClass(Component) {
|
|
|
82
81
|
}
|
|
83
82
|
return [DevtoolsCore, NoOpDevtoolsCore];
|
|
84
83
|
}
|
|
85
|
-
var _tmpl$2 = /* @__PURE__ */ template(`<div
|
|
84
|
+
var _tmpl$2 = /* @__PURE__ */ template(`<div style=height:100%>`);
|
|
86
85
|
function createSolidPanel(CoreClass) {
|
|
87
86
|
function Panel(props) {
|
|
88
87
|
let devToolRef;
|
|
@@ -99,7 +98,6 @@ function createSolidPanel(CoreClass) {
|
|
|
99
98
|
var _el$ = _tmpl$2();
|
|
100
99
|
var _ref$ = devToolRef;
|
|
101
100
|
typeof _ref$ === "function" ? use(_ref$, _el$) : devToolRef = _el$;
|
|
102
|
-
_el$.style.setProperty("height", "100%");
|
|
103
101
|
return _el$;
|
|
104
102
|
})();
|
|
105
103
|
}
|
package/dist/solid/esm/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent, ssr, escape } from 'solid-js/web';
|
|
1
|
+
import { createComponent, ssr, ssrStyleProperty, escape } from 'solid-js/web';
|
|
2
2
|
import { createSignal, onMount, onCleanup } from 'solid-js';
|
|
3
3
|
|
|
4
4
|
// src/solid/class.tsx
|
|
@@ -36,7 +36,7 @@ function constructCoreClass(Component) {
|
|
|
36
36
|
return createComponent(Portal, {
|
|
37
37
|
mount: mountTo,
|
|
38
38
|
get children() {
|
|
39
|
-
return ssr(_tmpl$, "height:100%", escape(createComponent(ThemeProvider, {
|
|
39
|
+
return ssr(_tmpl$, ssrStyleProperty("height:", "100%"), escape(createComponent(ThemeProvider, {
|
|
40
40
|
theme,
|
|
41
41
|
get children() {
|
|
42
42
|
return createComponent(Devtools, {});
|
|
@@ -88,7 +88,7 @@ function createSolidPanel(CoreClass) {
|
|
|
88
88
|
devtools().unmount();
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
|
-
return ssr(_tmpl$2, "height:100%");
|
|
91
|
+
return ssr(_tmpl$2, ssrStyleProperty("height:", "100%"));
|
|
92
92
|
}
|
|
93
93
|
function NoOpPanel(_props) {
|
|
94
94
|
return [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DefineComponent } from 'vue';
|
|
2
|
+
export interface DevtoolsPanelProps {
|
|
3
|
+
theme?: 'dark' | 'light' | 'system';
|
|
4
|
+
}
|
|
5
|
+
export declare function createVuePanel<TComponentProps extends DevtoolsPanelProps, TCoreDevtoolsClass extends {
|
|
6
|
+
mount: (el: HTMLElement, theme?: DevtoolsPanelProps['theme']) => void;
|
|
7
|
+
unmount: () => void;
|
|
8
|
+
}>(CoreClass: new (props: TComponentProps) => TCoreDevtoolsClass): [DefineComponent<{
|
|
9
|
+
theme?: DevtoolsPanelProps["theme"];
|
|
10
|
+
devtoolsProps: TComponentProps;
|
|
11
|
+
}>, DefineComponent<{
|
|
12
|
+
theme?: DevtoolsPanelProps["theme"];
|
|
13
|
+
devtoolsProps: TComponentProps;
|
|
14
|
+
}>];
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, onUnmounted, h } from "vue";
|
|
2
|
+
function createVuePanel(CoreClass) {
|
|
3
|
+
const props = {
|
|
4
|
+
theme: {
|
|
5
|
+
type: String
|
|
6
|
+
},
|
|
7
|
+
devtoolsProps: {
|
|
8
|
+
type: Object
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const Panel = defineComponent({
|
|
12
|
+
props,
|
|
13
|
+
setup(config) {
|
|
14
|
+
const devToolRef = ref(null);
|
|
15
|
+
const devtools = ref(null);
|
|
16
|
+
onMounted(() => {
|
|
17
|
+
const instance = new CoreClass(config.devtoolsProps);
|
|
18
|
+
devtools.value = instance;
|
|
19
|
+
if (devToolRef.value) {
|
|
20
|
+
instance.mount(devToolRef.value, config.theme);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
onUnmounted(() => {
|
|
24
|
+
if (devToolRef.value && devtools.value) {
|
|
25
|
+
devtools.value.unmount();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return () => {
|
|
29
|
+
return h("div", {
|
|
30
|
+
style: { height: "100%" },
|
|
31
|
+
ref: devToolRef
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const NoOpPanel = defineComponent({
|
|
37
|
+
props,
|
|
38
|
+
setup() {
|
|
39
|
+
return () => null;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return [Panel, NoOpPanel];
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
createVuePanel
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +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 {\n theme?: 'dark' | 'light' | 'system'\n}\n\nexport function createVuePanel<\n TComponentProps extends DevtoolsPanelProps,\n TCoreDevtoolsClass extends {\n mount: (el: HTMLElement, theme?: DevtoolsPanelProps['theme']) => void\n unmount: () => void\n },\n>(CoreClass: new (props: TComponentProps) => TCoreDevtoolsClass) {\n const props = {\n theme: {\n type: String as () => DevtoolsPanelProps['theme'],\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.theme)\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"],"names":[],"mappings":";AAOO,SAAS,eAMd,WAA+D;AAC/D,QAAM,QAAQ;AAAA,IACZ,OAAO;AAAA,MACL,MAAM;AAAA,IAAA;AAAA,IAER,eAAe;AAAA,MACb,MAAM;AAAA,IAAA;AAAA,EACR;AAGF,QAAM,QAAQ,gBAAgB;AAAA,IAC5B;AAAA,IACA,MAAM,QAAQ;AACZ,YAAM,aAAa,IAAwB,IAAI;AAC/C,YAAM,WAAW,IAA+B,IAAI;AAEpD,gBAAU,MAAM;AACd,cAAM,WAAW,IAAI,UAAU,OAAO,aAAgC;AACtE,iBAAS,QAAQ;AAEjB,YAAI,WAAW,OAAO;AACpB,mBAAS,MAAM,WAAW,OAAO,OAAO,KAAK;AAAA,QAC/C;AAAA,MACF,CAAC;AAED,kBAAY,MAAM;AAChB,YAAI,WAAW,SAAS,SAAS,OAAO;AACtC,mBAAS,MAAM,QAAA;AAAA,QACjB;AAAA,MACF,CAAC;AAED,aAAO,MAAM;AACX,eAAO,EAAE,OAAO;AAAA,UACd,OAAO,EAAE,QAAQ,OAAA;AAAA,UACjB,KAAK;AAAA,QAAA,CACN;AAAA,MACH;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,YAAY,gBAAgB;AAAA,IAChC;AAAA,IACA,QAAQ;AACN,aAAO,MAAM;AAAA,IACf;AAAA,EAAA,CACD;AAED,SAAO,CAAC,OAAO,SAAS;AAU1B;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DefineComponent } from 'vue';
|
|
2
|
+
export declare function createVuePlugin<TComponentProps extends Record<string, any>>(name: string, component: DefineComponent<TComponentProps, {}, unknown>): readonly [(props: TComponentProps) => {
|
|
3
|
+
name: string;
|
|
4
|
+
component: DefineComponent<TComponentProps, {}, unknown>;
|
|
5
|
+
props: TComponentProps;
|
|
6
|
+
}, (props: TComponentProps) => {
|
|
7
|
+
name: string;
|
|
8
|
+
component: {
|
|
9
|
+
new (): {
|
|
10
|
+
$props: import('vue').VNodeProps;
|
|
11
|
+
};
|
|
12
|
+
__isFragment: true;
|
|
13
|
+
};
|
|
14
|
+
props: TComponentProps;
|
|
15
|
+
}];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fragment } from "vue";
|
|
2
|
+
function createVuePlugin(name, component) {
|
|
3
|
+
function Plugin(props) {
|
|
4
|
+
return {
|
|
5
|
+
name,
|
|
6
|
+
component,
|
|
7
|
+
props
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function NoOpPlugin(props) {
|
|
11
|
+
return {
|
|
12
|
+
name,
|
|
13
|
+
component: Fragment,
|
|
14
|
+
props
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return [Plugin, NoOpPlugin];
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
createVuePlugin
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +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"],"names":[],"mappings":";AAGO,SAAS,gBACd,MACA,WACA;AACA,WAAS,OAAO,OAAwB;AACtC,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACA,WAAS,WAAW,OAAwB;AAC1C,WAAO;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MACX;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO,CAAC,QAAQ,UAAU;AAC5B;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/devtools-utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "TanStack Devtools utilities for creating your own devtools.",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,6 +47,12 @@
|
|
|
47
47
|
"types": "./dist/solid/esm/index.d.ts",
|
|
48
48
|
"import": "./dist/solid/esm/index.js"
|
|
49
49
|
},
|
|
50
|
+
"./vue": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/vue/esm/index.d.ts",
|
|
53
|
+
"default": "./dist/vue/esm/index.js"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
50
56
|
"./package.json": "./package.json"
|
|
51
57
|
},
|
|
52
58
|
"sideEffects": false,
|
|
@@ -54,7 +60,7 @@
|
|
|
54
60
|
"node": ">=18"
|
|
55
61
|
},
|
|
56
62
|
"dependencies": {
|
|
57
|
-
"@tanstack/devtools-ui": "^0.
|
|
63
|
+
"@tanstack/devtools-ui": "^0.5.0"
|
|
58
64
|
},
|
|
59
65
|
"peerDependencies": {
|
|
60
66
|
"@types/react": ">=17.0.0",
|
|
@@ -97,6 +103,6 @@
|
|
|
97
103
|
"test:lib:dev": "pnpm test:lib --watch",
|
|
98
104
|
"test:types": "tsc",
|
|
99
105
|
"test:build": "publint --strict",
|
|
100
|
-
"build": "vite build && vite build --config vite.config.preact.ts && tsup "
|
|
106
|
+
"build": "vite build && vite build --config vite.config.preact.ts && vite build --config vite.config.vue.ts && tsup "
|
|
101
107
|
}
|
|
102
108
|
}
|