@tanstack/devtools-utils 0.2.0 → 0.2.2
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 +16 -1
- package/dist/solid/esm/index.d.ts +4 -0
- package/dist/solid/esm/index.js +16 -1
- package/dist/solid/esm/server.js +16 -1
- package/package.json +1 -1
- package/src/solid/class.tsx +16 -1
package/dist/solid/esm/dev.js
CHANGED
|
@@ -6,12 +6,15 @@ var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
|
6
6
|
function constructCoreClass(Component) {
|
|
7
7
|
class DevtoolsCore {
|
|
8
8
|
#isMounted = false;
|
|
9
|
+
#isMounting = false;
|
|
10
|
+
#mountCb = null;
|
|
9
11
|
#dispose;
|
|
10
12
|
#Component;
|
|
11
13
|
#ThemeProvider;
|
|
12
14
|
constructor() {
|
|
13
15
|
}
|
|
14
16
|
async mount(el, theme) {
|
|
17
|
+
this.#isMounting = true;
|
|
15
18
|
const {
|
|
16
19
|
lazy
|
|
17
20
|
} = await import('solid-js');
|
|
@@ -46,12 +49,24 @@ function constructCoreClass(Component) {
|
|
|
46
49
|
});
|
|
47
50
|
}, mountTo);
|
|
48
51
|
this.#isMounted = true;
|
|
52
|
+
this.#isMounting = false;
|
|
49
53
|
this.#dispose = dispose;
|
|
54
|
+
if (this.#mountCb) {
|
|
55
|
+
this.#mountCb();
|
|
56
|
+
this.#mountCb = null;
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
unmount() {
|
|
52
|
-
if (!this.#isMounted) {
|
|
60
|
+
if (!this.#isMounted && !this.#isMounting) {
|
|
53
61
|
throw new Error("Devtools is not mounted");
|
|
54
62
|
}
|
|
63
|
+
if (this.#isMounting) {
|
|
64
|
+
this.#mountCb = () => {
|
|
65
|
+
this.#dispose?.();
|
|
66
|
+
this.#isMounted = false;
|
|
67
|
+
};
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
55
70
|
this.#dispose?.();
|
|
56
71
|
this.#isMounted = false;
|
|
57
72
|
}
|
|
@@ -15,6 +15,8 @@ import { JSX } from 'solid-js';
|
|
|
15
15
|
declare function constructCoreClass(Component: () => JSX.Element): readonly [{
|
|
16
16
|
new (): {
|
|
17
17
|
"__#private@#isMounted": boolean;
|
|
18
|
+
"__#private@#isMounting": boolean;
|
|
19
|
+
"__#private@#mountCb": (() => void) | null;
|
|
18
20
|
"__#private@#dispose"?: () => void;
|
|
19
21
|
"__#private@#Component": any;
|
|
20
22
|
"__#private@#ThemeProvider": any;
|
|
@@ -26,6 +28,8 @@ declare function constructCoreClass(Component: () => JSX.Element): readonly [{
|
|
|
26
28
|
mount<T extends HTMLElement>(_el: T, _theme: "light" | "dark"): Promise<void>;
|
|
27
29
|
unmount(): void;
|
|
28
30
|
"__#private@#isMounted": boolean;
|
|
31
|
+
"__#private@#isMounting": boolean;
|
|
32
|
+
"__#private@#mountCb": (() => void) | null;
|
|
29
33
|
"__#private@#dispose"?: () => void;
|
|
30
34
|
"__#private@#Component": any;
|
|
31
35
|
"__#private@#ThemeProvider": any;
|
package/dist/solid/esm/index.js
CHANGED
|
@@ -6,12 +6,15 @@ var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
|
6
6
|
function constructCoreClass(Component) {
|
|
7
7
|
class DevtoolsCore {
|
|
8
8
|
#isMounted = false;
|
|
9
|
+
#isMounting = false;
|
|
10
|
+
#mountCb = null;
|
|
9
11
|
#dispose;
|
|
10
12
|
#Component;
|
|
11
13
|
#ThemeProvider;
|
|
12
14
|
constructor() {
|
|
13
15
|
}
|
|
14
16
|
async mount(el, theme) {
|
|
17
|
+
this.#isMounting = true;
|
|
15
18
|
const {
|
|
16
19
|
lazy
|
|
17
20
|
} = await import('solid-js');
|
|
@@ -46,12 +49,24 @@ function constructCoreClass(Component) {
|
|
|
46
49
|
});
|
|
47
50
|
}, mountTo);
|
|
48
51
|
this.#isMounted = true;
|
|
52
|
+
this.#isMounting = false;
|
|
49
53
|
this.#dispose = dispose;
|
|
54
|
+
if (this.#mountCb) {
|
|
55
|
+
this.#mountCb();
|
|
56
|
+
this.#mountCb = null;
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
unmount() {
|
|
52
|
-
if (!this.#isMounted) {
|
|
60
|
+
if (!this.#isMounted && !this.#isMounting) {
|
|
53
61
|
throw new Error("Devtools is not mounted");
|
|
54
62
|
}
|
|
63
|
+
if (this.#isMounting) {
|
|
64
|
+
this.#mountCb = () => {
|
|
65
|
+
this.#dispose?.();
|
|
66
|
+
this.#isMounted = false;
|
|
67
|
+
};
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
55
70
|
this.#dispose?.();
|
|
56
71
|
this.#isMounted = false;
|
|
57
72
|
}
|
package/dist/solid/esm/server.js
CHANGED
|
@@ -6,12 +6,15 @@ var _tmpl$ = ['<div style="', '">', "</div>"];
|
|
|
6
6
|
function constructCoreClass(Component) {
|
|
7
7
|
class DevtoolsCore {
|
|
8
8
|
#isMounted = false;
|
|
9
|
+
#isMounting = false;
|
|
10
|
+
#mountCb = null;
|
|
9
11
|
#dispose;
|
|
10
12
|
#Component;
|
|
11
13
|
#ThemeProvider;
|
|
12
14
|
constructor() {
|
|
13
15
|
}
|
|
14
16
|
async mount(el, theme) {
|
|
17
|
+
this.#isMounting = true;
|
|
15
18
|
const {
|
|
16
19
|
lazy
|
|
17
20
|
} = await import('solid-js');
|
|
@@ -43,12 +46,24 @@ function constructCoreClass(Component) {
|
|
|
43
46
|
});
|
|
44
47
|
}, mountTo);
|
|
45
48
|
this.#isMounted = true;
|
|
49
|
+
this.#isMounting = false;
|
|
46
50
|
this.#dispose = dispose;
|
|
51
|
+
if (this.#mountCb) {
|
|
52
|
+
this.#mountCb();
|
|
53
|
+
this.#mountCb = null;
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
56
|
unmount() {
|
|
49
|
-
if (!this.#isMounted) {
|
|
57
|
+
if (!this.#isMounted && !this.#isMounting) {
|
|
50
58
|
throw new Error("Devtools is not mounted");
|
|
51
59
|
}
|
|
60
|
+
if (this.#isMounting) {
|
|
61
|
+
this.#mountCb = () => {
|
|
62
|
+
this.#dispose?.();
|
|
63
|
+
this.#isMounted = false;
|
|
64
|
+
};
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
52
67
|
this.#dispose?.();
|
|
53
68
|
this.#isMounted = false;
|
|
54
69
|
}
|
package/package.json
CHANGED
package/src/solid/class.tsx
CHANGED
|
@@ -14,6 +14,8 @@ import type { JSX } from 'solid-js'
|
|
|
14
14
|
export function constructCoreClass(Component: () => JSX.Element) {
|
|
15
15
|
class DevtoolsCore {
|
|
16
16
|
#isMounted = false
|
|
17
|
+
#isMounting = false
|
|
18
|
+
#mountCb: (() => void) | null = null
|
|
17
19
|
#dispose?: () => void
|
|
18
20
|
#Component: any
|
|
19
21
|
#ThemeProvider: any
|
|
@@ -21,6 +23,7 @@ export function constructCoreClass(Component: () => JSX.Element) {
|
|
|
21
23
|
constructor() {}
|
|
22
24
|
|
|
23
25
|
async mount<T extends HTMLElement>(el: T, theme: 'light' | 'dark') {
|
|
26
|
+
this.#isMounting = true
|
|
24
27
|
const { lazy } = await import('solid-js')
|
|
25
28
|
const { render, Portal } = await import('solid-js/web')
|
|
26
29
|
if (this.#isMounted) {
|
|
@@ -49,13 +52,25 @@ export function constructCoreClass(Component: () => JSX.Element) {
|
|
|
49
52
|
)
|
|
50
53
|
}, mountTo)
|
|
51
54
|
this.#isMounted = true
|
|
55
|
+
this.#isMounting = false
|
|
52
56
|
this.#dispose = dispose
|
|
57
|
+
if (this.#mountCb) {
|
|
58
|
+
this.#mountCb()
|
|
59
|
+
this.#mountCb = null
|
|
60
|
+
}
|
|
53
61
|
}
|
|
54
62
|
|
|
55
63
|
unmount() {
|
|
56
|
-
if (!this.#isMounted) {
|
|
64
|
+
if (!this.#isMounted && !this.#isMounting) {
|
|
57
65
|
throw new Error('Devtools is not mounted')
|
|
58
66
|
}
|
|
67
|
+
if (this.#isMounting) {
|
|
68
|
+
this.#mountCb = () => {
|
|
69
|
+
this.#dispose?.()
|
|
70
|
+
this.#isMounted = false
|
|
71
|
+
}
|
|
72
|
+
return
|
|
73
|
+
}
|
|
59
74
|
this.#dispose?.()
|
|
60
75
|
this.#isMounted = false
|
|
61
76
|
}
|