@nookuio/vue 1.0.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/README.md +57 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +42 -0
- package/dist/index.mjs +38 -0
- package/dist/runtime/components/NotFound.vue +48 -0
- package/dist/runtime/components/Renderer.vue +56 -0
- package/dist/runtime/composables/useQuery.d.ts +4 -0
- package/dist/runtime/composables/useQuery.js +22 -0
- package/dist/runtime/composables/useQuery.mjs +11 -0
- package/dist/runtime/utils/helpers.d.ts +4 -0
- package/dist/runtime/utils/helpers.js +38 -0
- package/dist/runtime/utils/helpers.mjs +30 -0
- package/dist/runtime/utils/index.d.ts +5 -0
- package/dist/runtime/utils/index.js +61 -0
- package/dist/runtime/utils/index.mjs +56 -0
- package/dist/runtime/utils/tailwind.d.ts +1 -0
- package/dist/runtime/utils/tailwind.js +13 -0
- package/dist/runtime/utils/tailwind.mjs +6 -0
- package/dist/runtime/utils/tryCatch.d.ts +13 -0
- package/dist/runtime/utils/tryCatch.js +31 -0
- package/dist/runtime/utils/tryCatch.mjs +18 -0
- package/dist/vite-plugin.d.ts +1 -0
- package/dist/vite-plugin.js +12 -0
- package/dist/vite-plugin.mjs +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# nooku Nuxt Module
|
|
2
|
+
|
|
3
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
4
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
+
[![License][license-src]][license-href]
|
|
6
|
+
|
|
7
|
+
[Nuxt](https://nuxt.com/) module for [nooku](https://nooku.io) ⚡️
|
|
8
|
+
|
|
9
|
+
This Nuxt module enables connection and interaction between your nuxt app and nooku.
|
|
10
|
+
|
|
11
|
+
- [ Learn more about nooku](https://nooku.io)
|
|
12
|
+
|
|
13
|
+
## Quick Setup
|
|
14
|
+
|
|
15
|
+
1. Install: Add `@nooku/nuxt` to your project
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Using npm
|
|
19
|
+
npm install -D @nooku/nuxt
|
|
20
|
+
|
|
21
|
+
# Using pnpm
|
|
22
|
+
pnpm add -D @nooku/nuxt
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Configure: Add `@nooku/nuxt` to your Nuxt Integrations array `nuxt.config.{js,ts}`
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
//nuxt.config.js (or) nuxt.config.ts
|
|
29
|
+
|
|
30
|
+
export default defineNuxtConfig({
|
|
31
|
+
modules: [
|
|
32
|
+
'@nooku/nuxt',
|
|
33
|
+
//...
|
|
34
|
+
],
|
|
35
|
+
nooku: {
|
|
36
|
+
enabled: true // default true
|
|
37
|
+
},
|
|
38
|
+
//...
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Now, open your Nuxt project in nooku. ✨
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
[MIT License](./LICENSE)
|
|
47
|
+
|
|
48
|
+
Copyright (c) nooku
|
|
49
|
+
|
|
50
|
+
<!-- Badges -->
|
|
51
|
+
|
|
52
|
+
[npm-version-src]: https://img.shields.io/npm/v/@nooku/nuxt/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
53
|
+
[npm-version-href]: https://npmjs.com/package/@nooku/nuxt
|
|
54
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@nooku/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
55
|
+
[npm-downloads-href]: https://npmjs.com/package/@nooku/nuxt
|
|
56
|
+
[license-src]: https://img.shields.io/npm/l/@nooku/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
57
|
+
[license-href]: https://npmjs.com/package/@nooku/nuxt
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _Renderer = _interopRequireDefault(require("./runtime/components/Renderer.vue"));
|
|
9
|
+
var _helpers = require("./runtime/utils/helpers");
|
|
10
|
+
var _utils = require("./runtime/utils");
|
|
11
|
+
var _tailwind = require("./runtime/utils/tailwind");
|
|
12
|
+
var _useQuery = require("./runtime/composables/useQuery");
|
|
13
|
+
var _iframe = require("@nookuio/iframe");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function w(n, i, e) {
|
|
16
|
+
const o = typeof n == "string" ? document.querySelector(n) : n;
|
|
17
|
+
if (!o) {
|
|
18
|
+
const u = typeof n == "string" ? `Failed to mount app: mount target selector "${n}" returned null.` : "Failed to mount app to the target element";
|
|
19
|
+
console.warn(u);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const t = (0, _vue.createVNode)(i, e || {});
|
|
23
|
+
return (0, _vue.render)(t, o), t.component;
|
|
24
|
+
}
|
|
25
|
+
const y = {
|
|
26
|
+
install(n, i) {
|
|
27
|
+
window === void 0 || !(0, _helpers.isInsideNookuEditor)() || window.location.pathname === _iframe.EDITOR_PAGE_PATH && (n.mount = function (e) {
|
|
28
|
+
n._component = {
|
|
29
|
+
render() {
|
|
30
|
+
return (0, _vue.h)(_vue.Suspense, {}, {
|
|
31
|
+
default: () => (0, _vue.h)(_Renderer.default),
|
|
32
|
+
fallback: () => (0, _vue.h)("div", "Loading...")
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const o = (0, _useQuery.getQuery)(),
|
|
37
|
+
t = o.injectTailwind === "true" && (o.tailwindVersion === "3" || o.tailwindVersion === "4") ? Number(o.tailwindVersion) : void 0;
|
|
38
|
+
return (0, _tailwind.injectTailwind)(t), (0, _utils.initializeClient)(n), w(e, n._component)?.proxy;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
module.exports = y;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createVNode as d, h as r, render as m, Suspense as s } from "vue";
|
|
2
|
+
import l from "./runtime/components/Renderer.vue";
|
|
3
|
+
import { isInsideNookuEditor as p } from "./runtime/utils/helpers.mjs";
|
|
4
|
+
import { initializeClient as a } from "./runtime/utils/index.mjs";
|
|
5
|
+
import { injectTailwind as c } from "./runtime/utils/tailwind.mjs";
|
|
6
|
+
import { getQuery as f } from "./runtime/composables/useQuery.mjs";
|
|
7
|
+
import { EDITOR_PAGE_PATH as g } from "@nookuio/iframe";
|
|
8
|
+
function w(n, i, e) {
|
|
9
|
+
const o = typeof n == "string" ? document.querySelector(n) : n;
|
|
10
|
+
if (!o) {
|
|
11
|
+
const u = typeof n == "string" ? `Failed to mount app: mount target selector "${n}" returned null.` : "Failed to mount app to the target element";
|
|
12
|
+
console.warn(u);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const t = d(i, e || {});
|
|
16
|
+
return m(t, o), t.component;
|
|
17
|
+
}
|
|
18
|
+
const y = {
|
|
19
|
+
install(n, i) {
|
|
20
|
+
window === void 0 || !p() || window.location.pathname === g && (n.mount = function(e) {
|
|
21
|
+
n._component = {
|
|
22
|
+
render() {
|
|
23
|
+
return r(
|
|
24
|
+
s,
|
|
25
|
+
{},
|
|
26
|
+
{
|
|
27
|
+
default: () => r(l),
|
|
28
|
+
fallback: () => r("div", "Loading...")
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const o = f(), t = o.injectTailwind === "true" && (o.tailwindVersion === "3" || o.tailwindVersion === "4") ? Number(o.tailwindVersion) : void 0;
|
|
34
|
+
return c(t), a(n), w(e, n._component)?.proxy;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export default y;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="not-found">
|
|
3
|
+
<div class="content">
|
|
4
|
+
<h1>Component Not Found</h1>
|
|
5
|
+
<p>The requested component could not be found.</p>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<style scoped>
|
|
11
|
+
.not-found {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
height: 100vh;
|
|
16
|
+
background-color: #f9f9f9;
|
|
17
|
+
color: #333;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.content {
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
h1 {
|
|
25
|
+
font-size: 2rem;
|
|
26
|
+
margin: 0;
|
|
27
|
+
color: #0f0f0f;
|
|
28
|
+
font-weight: bold;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
p {
|
|
32
|
+
font-size: 1.25rem;
|
|
33
|
+
margin-top: 0.5rem;
|
|
34
|
+
color: #666;
|
|
35
|
+
}
|
|
36
|
+
/* Responsive adjustments */
|
|
37
|
+
@media (max-width: 600px) {
|
|
38
|
+
h1 {
|
|
39
|
+
font-size: 1.5rem;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
p {
|
|
43
|
+
font-size: 1rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
</style>
|
|
48
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed as o, watch as s, shallowRef as i } from "vue";
|
|
3
|
+
import { useQuery as m } from "../composables/useQuery";
|
|
4
|
+
import "./NotFound.vue";
|
|
5
|
+
const { query: e } = m(), a = o(() => e.value.path || ""), p = i(await u(a.value)), d = o(() => {
|
|
6
|
+
if (!e.value.props) return {};
|
|
7
|
+
try {
|
|
8
|
+
return new Function(`return ${e.value.props}`)();
|
|
9
|
+
} catch {
|
|
10
|
+
return {};
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
async function u(n) {
|
|
14
|
+
if (!n) return;
|
|
15
|
+
const r = window?.__buildAssetsURL;
|
|
16
|
+
try {
|
|
17
|
+
return r ? await import(
|
|
18
|
+
/* @vite-ignore */
|
|
19
|
+
r(n)
|
|
20
|
+
).then(
|
|
21
|
+
(t) => e.value.name ? t?.[e.value.name] : t.default
|
|
22
|
+
) : await import(
|
|
23
|
+
/* @vite-ignore */
|
|
24
|
+
"/@fs/" + n
|
|
25
|
+
).then(
|
|
26
|
+
(t) => e.value.name ? t?.[e.value.name] : t.default
|
|
27
|
+
);
|
|
28
|
+
} catch {
|
|
29
|
+
try {
|
|
30
|
+
return await import(
|
|
31
|
+
/* @vite-ignore */
|
|
32
|
+
n
|
|
33
|
+
).then((t) => e.value.name ? t?.[e.value.name] : t.default);
|
|
34
|
+
} catch (t) {
|
|
35
|
+
console.log("Error importing component:", t);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
s(a, async (n) => p.value = await u(n));
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<component
|
|
45
|
+
v-if="componentToRender"
|
|
46
|
+
:is="componentToRender"
|
|
47
|
+
v-bind="componentProps"
|
|
48
|
+
/>
|
|
49
|
+
<ErrorComponent v-else />
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<style>
|
|
53
|
+
body {
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getQuery = getQuery;
|
|
7
|
+
exports.useQuery = useQuery;
|
|
8
|
+
var _vue = require("vue");
|
|
9
|
+
function getQuery() {
|
|
10
|
+
const n = new URLSearchParams(window.location.search),
|
|
11
|
+
e = {};
|
|
12
|
+
return n.forEach((o, t) => e[t] = o), e;
|
|
13
|
+
}
|
|
14
|
+
function useQuery() {
|
|
15
|
+
const n = (0, _vue.ref)(getQuery()),
|
|
16
|
+
e = () => {
|
|
17
|
+
n.value = getQuery();
|
|
18
|
+
};
|
|
19
|
+
return (0, _vue.onMounted)(() => window.addEventListener("popstate", e)), (0, _vue.onBeforeUnmount)(() => window.removeEventListener("popstate", e)), {
|
|
20
|
+
query: n
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ref as r, onMounted as s, onBeforeUnmount as a } from "vue";
|
|
2
|
+
export function getQuery() {
|
|
3
|
+
const n = new URLSearchParams(window.location.search), e = {};
|
|
4
|
+
return n.forEach((o, t) => e[t] = o), e;
|
|
5
|
+
}
|
|
6
|
+
export function useQuery() {
|
|
7
|
+
const n = r(getQuery()), e = () => {
|
|
8
|
+
n.value = getQuery();
|
|
9
|
+
};
|
|
10
|
+
return s(() => window.addEventListener("popstate", e)), a(() => window.removeEventListener("popstate", e)), { query: n };
|
|
11
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from 'vue';
|
|
2
|
+
export declare function isInsideNookuEditor(): boolean;
|
|
3
|
+
export declare function debounce(cb: Function, delay?: number): (...args: any[]) => void;
|
|
4
|
+
export declare function getInstanceState(instance: ComponentInternalInstance | undefined, onTemplate?: boolean): Record<string, any>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.debounce = debounce;
|
|
7
|
+
exports.getInstanceState = getInstanceState;
|
|
8
|
+
exports.isInsideNookuEditor = isInsideNookuEditor;
|
|
9
|
+
function isInsideNookuEditor() {
|
|
10
|
+
return window === void 0 ? !1 : !!(window.parent && window.location !== window.parent.location || window.top !== window.self);
|
|
11
|
+
}
|
|
12
|
+
function debounce(n, t = 500) {
|
|
13
|
+
let e;
|
|
14
|
+
return (...o) => {
|
|
15
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
16
|
+
n(...o);
|
|
17
|
+
}, t);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const i = "__v_isRef",
|
|
21
|
+
a = "__v_isReadonly";
|
|
22
|
+
function s(n, t) {
|
|
23
|
+
return n?.[i] ? t ? n.value : {
|
|
24
|
+
value: n.value,
|
|
25
|
+
[i]: "true",
|
|
26
|
+
[a]: !!n.__v_isReadonly
|
|
27
|
+
} : n;
|
|
28
|
+
}
|
|
29
|
+
function getInstanceState(n, t) {
|
|
30
|
+
if (!n) return {};
|
|
31
|
+
const e = {};
|
|
32
|
+
return Object.entries(n.props).forEach(([o, r]) => {
|
|
33
|
+
e[o] = r;
|
|
34
|
+
}), Object.entries(n.devtoolsRawSetupState ?? n.setupState).forEach(([o, r]) => {
|
|
35
|
+
const u = s(r, t);
|
|
36
|
+
e[o] = u;
|
|
37
|
+
}), e;
|
|
38
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function isInsideNookuEditor() {
|
|
2
|
+
return window === void 0 ? !1 : !!(window.parent && window.location !== window.parent.location || window.top !== window.self);
|
|
3
|
+
}
|
|
4
|
+
export function debounce(n, t = 500) {
|
|
5
|
+
let e;
|
|
6
|
+
return (...o) => {
|
|
7
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
8
|
+
n(...o);
|
|
9
|
+
}, t);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
const i = "__v_isRef", a = "__v_isReadonly";
|
|
13
|
+
function s(n, t) {
|
|
14
|
+
return n?.[i] ? t ? n.value : {
|
|
15
|
+
value: n.value,
|
|
16
|
+
[i]: "true",
|
|
17
|
+
// as string
|
|
18
|
+
[a]: !!n.__v_isReadonly
|
|
19
|
+
} : n;
|
|
20
|
+
}
|
|
21
|
+
export function getInstanceState(n, t) {
|
|
22
|
+
if (!n) return {};
|
|
23
|
+
const e = {};
|
|
24
|
+
return Object.entries(n.props).forEach(([o, r]) => {
|
|
25
|
+
e[o] = r;
|
|
26
|
+
}), Object.entries(n.devtoolsRawSetupState ?? n.setupState).forEach(([o, r]) => {
|
|
27
|
+
const u = s(r, t);
|
|
28
|
+
e[o] = u;
|
|
29
|
+
}), e;
|
|
30
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initializeClient = initializeClient;
|
|
7
|
+
var _vue = require("vue");
|
|
8
|
+
var _helpers = require("./helpers");
|
|
9
|
+
var _iframe = require("@nookuio/iframe/iframe");
|
|
10
|
+
var _useQuery = require("../composables/useQuery");
|
|
11
|
+
const d = new Map();
|
|
12
|
+
function initializeClient(t) {
|
|
13
|
+
const i = (0, _useQuery.getQuery)(),
|
|
14
|
+
o = (0, _vue.computed)(() => i.path || ""),
|
|
15
|
+
r = (0, _iframe.createVueIframeClient)({
|
|
16
|
+
getInstanceData(e) {
|
|
17
|
+
const n = d.get(e);
|
|
18
|
+
return n ? (0, _helpers.getInstanceState)(n) : {};
|
|
19
|
+
},
|
|
20
|
+
navigateTo(e) {
|
|
21
|
+
e && e && I(e);
|
|
22
|
+
},
|
|
23
|
+
updateCode(e, n) {}
|
|
24
|
+
}, {
|
|
25
|
+
disableDefaultConsole: !1
|
|
26
|
+
});
|
|
27
|
+
return t.config.errorHandler = e => {
|
|
28
|
+
r.emit("console", "error", [e?.stack]);
|
|
29
|
+
}, t.mixin({
|
|
30
|
+
created() {
|
|
31
|
+
const e = this.$options.__file?.replace(/\\/g, "/") || "";
|
|
32
|
+
if (!e || e.includes("node_modules")) return;
|
|
33
|
+
const n = (0, _vue.computed)(() => o.value === e),
|
|
34
|
+
s = this.$;
|
|
35
|
+
d.set(e, s);
|
|
36
|
+
let a;
|
|
37
|
+
async function f() {
|
|
38
|
+
const c = (0, _helpers.getInstanceState)(s);
|
|
39
|
+
r?.emit("instance-data-update", c);
|
|
40
|
+
}
|
|
41
|
+
const m = (0, _helpers.debounce)(() => f(), 500);
|
|
42
|
+
(0, _vue.watch)(n, c => {
|
|
43
|
+
c ? a = (0, _vue.watch)(() => s.devtoolsRawSetupState, m, {
|
|
44
|
+
deep: !0,
|
|
45
|
+
immediate: !0
|
|
46
|
+
}) : a && (a?.(), a = void 0);
|
|
47
|
+
}, {
|
|
48
|
+
immediate: !0
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
beforeUnmount() {
|
|
52
|
+
const e = this.$options.__file?.replace(/\\/g, "/") || "";
|
|
53
|
+
!e || e.includes("node_modules") || o.value !== e && d.delete(e);
|
|
54
|
+
}
|
|
55
|
+
}), r;
|
|
56
|
+
}
|
|
57
|
+
function I(t, i = {}) {
|
|
58
|
+
return new Promise(o => {
|
|
59
|
+
i.replace ? history.replaceState({}, "", t) : history.pushState({}, "", t), window.dispatchEvent(new Event("popstate")), o();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { computed as u, watch as l } from "vue";
|
|
2
|
+
import { debounce as h, getInstanceState as p } from "./helpers.mjs";
|
|
3
|
+
import { createVueIframeClient as g } from "@nookuio/iframe/iframe";
|
|
4
|
+
import { getQuery as v } from "../composables/useQuery.mjs";
|
|
5
|
+
const d = /* @__PURE__ */ new Map();
|
|
6
|
+
export function initializeClient(t) {
|
|
7
|
+
const i = v(), o = u(() => i.path || ""), r = g(
|
|
8
|
+
{
|
|
9
|
+
getInstanceData(e) {
|
|
10
|
+
const n = d.get(e);
|
|
11
|
+
return n ? p(n) : {};
|
|
12
|
+
},
|
|
13
|
+
navigateTo(e) {
|
|
14
|
+
e && e && I(e);
|
|
15
|
+
},
|
|
16
|
+
updateCode(e, n) {
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{ disableDefaultConsole: !1 }
|
|
20
|
+
);
|
|
21
|
+
return t.config.errorHandler = (e) => {
|
|
22
|
+
r.emit("console", "error", [e?.stack]);
|
|
23
|
+
}, t.mixin({
|
|
24
|
+
created() {
|
|
25
|
+
const e = this.$options.__file?.replace(/\\/g, "/") || "";
|
|
26
|
+
if (!e || e.includes("node_modules")) return;
|
|
27
|
+
const n = u(() => o.value === e), s = this.$;
|
|
28
|
+
d.set(e, s);
|
|
29
|
+
let a;
|
|
30
|
+
async function f() {
|
|
31
|
+
const c = p(s);
|
|
32
|
+
r?.emit("instance-data-update", c);
|
|
33
|
+
}
|
|
34
|
+
const m = h(() => f(), 500);
|
|
35
|
+
l(
|
|
36
|
+
n,
|
|
37
|
+
(c) => {
|
|
38
|
+
c ? a = l(() => s.devtoolsRawSetupState, m, {
|
|
39
|
+
deep: !0,
|
|
40
|
+
immediate: !0
|
|
41
|
+
}) : a && (a?.(), a = void 0);
|
|
42
|
+
},
|
|
43
|
+
{ immediate: !0 }
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
beforeUnmount() {
|
|
47
|
+
const e = this.$options.__file?.replace(/\\/g, "/") || "";
|
|
48
|
+
!e || e.includes("node_modules") || o.value !== e && d.delete(e);
|
|
49
|
+
}
|
|
50
|
+
}), r;
|
|
51
|
+
}
|
|
52
|
+
function I(t, i = {}) {
|
|
53
|
+
return new Promise((o) => {
|
|
54
|
+
i.replace ? history.replaceState({}, "", t) : history.pushState({}, "", t), window.dispatchEvent(new Event("popstate")), o();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function injectTailwind(tailwindVersion: 3 | 4 | undefined): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.injectTailwind = injectTailwind;
|
|
7
|
+
function injectTailwind(e) {
|
|
8
|
+
const n = document.querySelector("#nooku-injected-tailwind-css");
|
|
9
|
+
if (n && e === void 0 && document.removeChild(n), n || e === void 0) return;
|
|
10
|
+
const c = e === 3 ? "https://cdn.tailwindcss.com" : "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4",
|
|
11
|
+
t = document.createElement("script");
|
|
12
|
+
t.id = "nooku-injected-tailwind-css", t.src = c, document.head.appendChild(t);
|
|
13
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export function injectTailwind(e) {
|
|
2
|
+
const n = document.querySelector("#nooku-injected-tailwind-css");
|
|
3
|
+
if (n && e === void 0 && document.removeChild(n), n || e === void 0) return;
|
|
4
|
+
const c = e === 3 ? "https://cdn.tailwindcss.com" : "https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4", t = document.createElement("script");
|
|
5
|
+
t.id = "nooku-injected-tailwind-css", t.src = c, document.head.appendChild(t);
|
|
6
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2
|
+
type Success<T> = {
|
|
3
|
+
data: T;
|
|
4
|
+
error?: never;
|
|
5
|
+
};
|
|
6
|
+
type Failure<E> = {
|
|
7
|
+
data?: never;
|
|
8
|
+
error: E;
|
|
9
|
+
};
|
|
10
|
+
type Result<T, E = Error> = Success<T> | Failure<E>;
|
|
11
|
+
export declare function tryCatch<T, E = Error>(func: (() => MaybePromise<T>) | Promise<T>, handler?: ((error: E) => void) | 'throw'): Promise<Result<T, E>>;
|
|
12
|
+
export declare function tryCatchSync<T, E = Error>(func: () => T, handler?: ((error: E) => void) | 'throw'): Result<T, E>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.tryCatch = tryCatch;
|
|
7
|
+
exports.tryCatchSync = tryCatchSync;
|
|
8
|
+
async function tryCatch(t, e) {
|
|
9
|
+
try {
|
|
10
|
+
return {
|
|
11
|
+
data: await (t instanceof Promise ? t : Promise.resolve().then(t))
|
|
12
|
+
};
|
|
13
|
+
} catch (r) {
|
|
14
|
+
if (e === "throw") throw r;
|
|
15
|
+
return e && e(r), {
|
|
16
|
+
error: r
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function tryCatchSync(t, e) {
|
|
21
|
+
try {
|
|
22
|
+
return {
|
|
23
|
+
data: t()
|
|
24
|
+
};
|
|
25
|
+
} catch (r) {
|
|
26
|
+
if (e === "throw") throw r;
|
|
27
|
+
return e && e(r), {
|
|
28
|
+
error: r
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export async function tryCatch(t, e) {
|
|
2
|
+
try {
|
|
3
|
+
return { data: await (t instanceof Promise ? t : Promise.resolve().then(t)) };
|
|
4
|
+
} catch (r) {
|
|
5
|
+
if (e === "throw")
|
|
6
|
+
throw r;
|
|
7
|
+
return e && e(r), { error: r };
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function tryCatchSync(t, e) {
|
|
11
|
+
try {
|
|
12
|
+
return { data: t() };
|
|
13
|
+
} catch (r) {
|
|
14
|
+
if (e === "throw")
|
|
15
|
+
throw r;
|
|
16
|
+
return e && e(r), { error: r };
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { nookuViteInspectorPlugin } from '@nookuio/inspector-plugin';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "nookuViteInspectorPlugin", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _inspectorPlugin.nookuViteInspectorPlugin;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _inspectorPlugin = require("@nookuio/inspector-plugin");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { nookuViteInspectorPlugin } from "@nookuio/inspector-plugin";
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nookuio/vue",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"import": "./dist/index.mjs"
|
|
12
|
+
},
|
|
13
|
+
"./vite-plugin": {
|
|
14
|
+
"types": "./dist/vite-plugin.d.ts",
|
|
15
|
+
"require": "./dist/vite-plugin.js",
|
|
16
|
+
"import": "./dist/vite-plugin.mjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@nookuio/iframe": "latest",
|
|
24
|
+
"@nookuio/inspector-plugin": "latest"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"changelogen": "^0.6.2",
|
|
28
|
+
"eslint": "^9.32.0",
|
|
29
|
+
"unbuild": "^3.5.0",
|
|
30
|
+
"vitest": "^3.2.4",
|
|
31
|
+
"vue-sfc-transformer": "^0.1.17",
|
|
32
|
+
"vue-tsc": "^2.2.12"
|
|
33
|
+
},
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"vue": "^3.5.0"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"nooku",
|
|
39
|
+
"nooku vue module",
|
|
40
|
+
"nooku connector",
|
|
41
|
+
"nooku vue connector",
|
|
42
|
+
"@nookuio/vue"
|
|
43
|
+
],
|
|
44
|
+
"author": "",
|
|
45
|
+
"license": "ISC",
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "unbuild",
|
|
48
|
+
"release": "pnpm build && pnpm publish --no-git-checks --access public"
|
|
49
|
+
}
|
|
50
|
+
}
|