@nookuio/vue 1.0.9 → 1.1.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Component, Ref, MaybeRefOrGetter } from 'vue';
|
|
2
|
+
export declare function attachStateInspectorToInstance(instance: any): (() => void | undefined) | undefined;
|
|
2
3
|
export declare function useVueComponent(path: Ref<string>, name?: MaybeRefOrGetter<string>): {
|
|
3
4
|
component: import("vue").ShallowRef<Component | null | undefined, Component | null | undefined>;
|
|
4
5
|
error: import("vue").ShallowRef<Error | null | undefined, Error | null | undefined>;
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.attachStateInspectorToInstance = attachStateInspectorToInstance;
|
|
6
7
|
exports.useVueComponent = useVueComponent;
|
|
7
8
|
var _vue = require("vue");
|
|
8
9
|
var _utils = require("../utils");
|
|
9
10
|
var _helpers = require("../utils/helpers");
|
|
10
|
-
function
|
|
11
|
+
function attachStateInspectorToInstance(e) {
|
|
11
12
|
if (import.meta.server || !e) return;
|
|
12
13
|
const r = (0, _helpers.debounce)(() => {
|
|
13
14
|
const n = (0, _helpers.getInstanceState)(e);
|
|
@@ -55,7 +56,7 @@ function useVueComponent(e, r) {
|
|
|
55
56
|
const d = (0, _vue.shallowRef)(null);
|
|
56
57
|
let p;
|
|
57
58
|
return (0, _vue.watch)(d, l => {
|
|
58
|
-
p?.(), l && (p =
|
|
59
|
+
p?.(), l && (p = attachStateInspectorToInstance(l.$ || l));
|
|
59
60
|
}), () => (0, _vue.h)(i, {
|
|
60
61
|
ref: d,
|
|
61
62
|
...v,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { watch as u, shallowRef as a, toValue as w, defineComponent as _, h } from "vue";
|
|
2
|
-
import { trySafe as
|
|
3
|
-
import { debounce as
|
|
4
|
-
function
|
|
2
|
+
import { trySafe as S, importVueComponentFromPath as C } from "../utils/index.mjs";
|
|
3
|
+
import { debounce as R, getInstanceState as m } from "../utils/helpers.mjs";
|
|
4
|
+
export function attachStateInspectorToInstance(e) {
|
|
5
5
|
if (import.meta.server || !e) return;
|
|
6
|
-
const r =
|
|
6
|
+
const r = R(() => {
|
|
7
7
|
const n = m(e);
|
|
8
8
|
window.__nooku__.emit("instance-data-update", n);
|
|
9
9
|
}, 500);
|
|
@@ -29,7 +29,7 @@ export function useVueComponent(e, r) {
|
|
|
29
29
|
n.value = new Error("Invalid component path"), t.value = null, o.value = !1;
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const [i, f] = await
|
|
32
|
+
const [i, f] = await S(() => C(e.value, w(r)), 5e3);
|
|
33
33
|
if (f) {
|
|
34
34
|
n.value = f, t.value = null, o.value = !1;
|
|
35
35
|
return;
|
|
@@ -44,7 +44,7 @@ export function useVueComponent(e, r) {
|
|
|
44
44
|
const d = a(null);
|
|
45
45
|
let p;
|
|
46
46
|
return u(d, (l) => {
|
|
47
|
-
p?.(), l && (p =
|
|
47
|
+
p?.(), l && (p = attachStateInspectorToInstance(l.$ || l));
|
|
48
48
|
}), () => h(i, { ref: d, ...v, ...c }, y);
|
|
49
49
|
}
|
|
50
50
|
}), o.value = !1;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { isInsideEditor, importVueComponentFromPath, initializeClient } from './runtime/utils';
|
|
2
|
-
export { useVueComponent } from './runtime/composables/useComponent';
|
|
2
|
+
export { useVueComponent, attachStateInspectorToInstance } from './runtime/composables/useComponent';
|
package/dist/utils.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "attachStateInspectorToInstance", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _useComponent.attachStateInspectorToInstance;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "importVueComponentFromPath", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function () {
|
package/dist/utils.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { isInsideEditor, importVueComponentFromPath, initializeClient } from "./runtime/utils/index.mjs";
|
|
2
|
-
export { useVueComponent } from "./runtime/composables/useComponent.mjs";
|
|
2
|
+
export { useVueComponent, attachStateInspectorToInstance } from "./runtime/composables/useComponent.mjs";
|