@tanstack/devtools-utils 0.2.4 → 0.3.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/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 +8 -2
|
@@ -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.0",
|
|
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,
|
|
@@ -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
|
}
|