@nookuio/vue 1.0.1 → 1.0.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/README.md +56 -40
- package/dist/index.js +16 -14
- package/dist/index.mjs +21 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,57 +1,73 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nookuio/vue
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
|
-
[![License][license-src]][license-href]
|
|
3
|
+
Lightweight Vue plugin + Vite plugin to connect your Vue 3 application to the Nooku editor.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
This package provides:
|
|
6
|
+
- A Vue 3 plugin that wires up the client-side runtime pieces used by Nooku.
|
|
7
|
+
- A Vite plugin to enable the inspector integration during local development.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Prerequisites
|
|
10
|
+
- Vue 3 project (Vue 3.x)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
---
|
|
12
13
|
|
|
13
|
-
##
|
|
14
|
-
|
|
15
|
-
1. Install: Add `@nooku/nuxt` to your project
|
|
14
|
+
## 1) Install
|
|
16
15
|
|
|
16
|
+
Using npm:
|
|
17
17
|
```bash
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
npm install -D @nookuio/vue
|
|
19
|
+
```
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Using pnpm:
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add -D @nookuio/vue
|
|
23
24
|
```
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 2) Register the Vue plugin (runtime)
|
|
29
|
+
|
|
30
|
+
The package's default export is a Vue plugin. Register the plugin with `app.use(...)` in your app's entry file (e.g. `main.js` / `main.ts`).
|
|
31
|
+
|
|
32
|
+
Example main.ts:
|
|
33
|
+
|
|
34
|
+
```main.ts
|
|
35
|
+
import './assets/main.css';
|
|
36
|
+
|
|
37
|
+
import { createApp } from 'vue';
|
|
38
|
+
import App from './App.vue';
|
|
39
|
+
import router from './router';
|
|
40
|
+
import nookuPlugin from '@nookuio/vue';
|
|
41
|
+
|
|
42
|
+
const app = createApp(App);
|
|
43
|
+
|
|
44
|
+
app.use(router);
|
|
45
|
+
if (import.meta.env.DEV) app.use(nookuPlugin);
|
|
46
|
+
app.mount('#app');
|
|
40
47
|
```
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 3) Add the Vite plugin
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
This package also exposes a Vite plugin (exported from `@nookuio/vue/vite-plugin`). Add it to your `vite.config.ts` file.
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
Example `vite.config.ts`:
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
```vite.config.ts
|
|
58
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
import { defineConfig } from 'vite';
|
|
61
|
+
import vue from '@vitejs/plugin-vue';
|
|
62
|
+
import { nookuViteInspectorPlugin } from '@nookuio/vue/vite-plugin';
|
|
51
63
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
[
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
// https://vite.dev/config/
|
|
65
|
+
export default defineConfig({
|
|
66
|
+
plugins: [vue(), nookuViteInspectorPlugin(),],
|
|
67
|
+
resolve: {
|
|
68
|
+
alias: {
|
|
69
|
+
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
```
|
package/dist/index.js
CHANGED
|
@@ -12,20 +12,20 @@ var _tailwind = require("./runtime/utils/tailwind");
|
|
|
12
12
|
var _useQuery = require("./runtime/composables/useQuery");
|
|
13
13
|
var _iframe = require("@nookuio/iframe");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
function w(
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
console.warn(
|
|
15
|
+
function w(t, u, e) {
|
|
16
|
+
const n = typeof t == "string" ? document.querySelector(t) : t;
|
|
17
|
+
if (!n) {
|
|
18
|
+
const r = typeof t == "string" ? `Failed to mount app: mount target selector "${t}" returned null.` : "Failed to mount app to the target element";
|
|
19
|
+
console.warn(r);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
const
|
|
23
|
-
return (0, _vue.render)(
|
|
22
|
+
const o = (0, _vue.createVNode)(u, e || {});
|
|
23
|
+
return (0, _vue.render)(o, n), o.component;
|
|
24
24
|
}
|
|
25
25
|
const y = {
|
|
26
|
-
install(
|
|
27
|
-
window === void 0 || !(0, _helpers.isInsideNookuEditor)() || window.location.pathname === _iframe.EDITOR_PAGE_PATH && (
|
|
28
|
-
|
|
26
|
+
install(t, u) {
|
|
27
|
+
process.env.DEV && (window === void 0 || !(0, _helpers.isInsideNookuEditor)() || window.location.pathname === _iframe.EDITOR_PAGE_PATH && (t.mount = function (e) {
|
|
28
|
+
t._component = {
|
|
29
29
|
render() {
|
|
30
30
|
return (0, _vue.h)(_vue.Suspense, {}, {
|
|
31
31
|
default: () => (0, _vue.h)(_Renderer.default),
|
|
@@ -33,10 +33,12 @@ const y = {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const n = (0, _useQuery.getQuery)(),
|
|
37
|
+
o = n.injectTailwind === "true" && (n.tailwindVersion === "3" || n.tailwindVersion === "4") ? Number(n.tailwindVersion) : void 0;
|
|
38
|
+
(0, _tailwind.injectTailwind)(o);
|
|
39
|
+
const r = w(e, t._component);
|
|
40
|
+
return (0, _utils.initializeClient)(t), r?.proxy;
|
|
41
|
+
}));
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
module.exports = y;
|
package/dist/index.mjs
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
import { createVNode as
|
|
1
|
+
import { createVNode as m, h as i, render as d, Suspense as s } from "vue";
|
|
2
2
|
import l from "./runtime/components/Renderer.vue";
|
|
3
3
|
import { isInsideNookuEditor as p } from "./runtime/utils/helpers.mjs";
|
|
4
4
|
import { initializeClient as a } from "./runtime/utils/index.mjs";
|
|
5
|
-
import { injectTailwind as
|
|
6
|
-
import { getQuery as
|
|
5
|
+
import { injectTailwind as f } from "./runtime/utils/tailwind.mjs";
|
|
6
|
+
import { getQuery as c } from "./runtime/composables/useQuery.mjs";
|
|
7
7
|
import { EDITOR_PAGE_PATH as g } from "@nookuio/iframe";
|
|
8
|
-
function w(
|
|
9
|
-
const
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
console.warn(
|
|
8
|
+
function w(t, u, e) {
|
|
9
|
+
const n = typeof t == "string" ? document.querySelector(t) : t;
|
|
10
|
+
if (!n) {
|
|
11
|
+
const r = typeof t == "string" ? `Failed to mount app: mount target selector "${t}" returned null.` : "Failed to mount app to the target element";
|
|
12
|
+
console.warn(r);
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
return
|
|
15
|
+
const o = m(u, e || {});
|
|
16
|
+
return d(o, n), o.component;
|
|
17
17
|
}
|
|
18
18
|
const y = {
|
|
19
|
-
install(
|
|
20
|
-
window === void 0 || !p() || window.location.pathname === g && (
|
|
21
|
-
|
|
19
|
+
install(t, u) {
|
|
20
|
+
import.meta.env.DEV && (window === void 0 || !p() || window.location.pathname === g && (t.mount = function(e) {
|
|
21
|
+
t._component = {
|
|
22
22
|
render() {
|
|
23
|
-
return
|
|
23
|
+
return i(
|
|
24
24
|
s,
|
|
25
25
|
{},
|
|
26
26
|
{
|
|
27
|
-
default: () =>
|
|
28
|
-
fallback: () =>
|
|
27
|
+
default: () => i(l),
|
|
28
|
+
fallback: () => i("div", "Loading...")
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const n = c(), o = n.injectTailwind === "true" && (n.tailwindVersion === "3" || n.tailwindVersion === "4") ? Number(n.tailwindVersion) : void 0;
|
|
34
|
+
f(o);
|
|
35
|
+
const r = w(e, t._component);
|
|
36
|
+
return a(t), r?.proxy;
|
|
37
|
+
}));
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
40
|
export default y;
|