@hostlink/nuxt-light 0.0.54 → 0.0.56
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 +106 -106
- package/dist/module.json +1 -1
- package/dist/module.mjs +0 -1
- package/dist/runtime/components/l-app-main.vue +11 -6
- package/dist/runtime/components/l-app.vue +6 -0
- package/dist/runtime/components/l-file-manager.vue +1 -1
- package/dist/runtime/components/l-login.vue +4 -1
- package/dist/runtime/components/l-statistic.vue +1 -1
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.mjs +0 -1
- package/dist/runtime/lib/f.mjs +3 -5
- package/dist/runtime/lib/index.d.ts +1 -2
- package/dist/runtime/lib/index.mjs +0 -2
- package/dist/runtime/lib/m.mjs +0 -2
- package/dist/runtime/lib/q.mjs +2 -23
- package/dist/runtime/lib/toJson.d.ts +2 -0
- package/dist/runtime/lib/toJson.mjs +21 -0
- package/dist/runtime/pages/logout.vue +3 -2
- package/package.json +2 -1
- package/dist/runtime/lib/login.d.ts +0 -2
- package/dist/runtime/lib/login.mjs +0 -9
package/README.md
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
Get your module up and running quickly.
|
|
3
|
-
|
|
4
|
-
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
-
- Name:
|
|
6
|
-
- Package name:
|
|
7
|
-
- Description: My new Nuxt module
|
|
8
|
-
-->
|
|
9
|
-
|
|
10
|
-
#
|
|
11
|
-
|
|
12
|
-
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
-
[![License][license-src]][license-href]
|
|
15
|
-
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
-
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/
|
|
21
|
-
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
<!-- Highlight some of the features your module provide here -->
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
modules: [
|
|
50
|
-
'
|
|
51
|
-
]
|
|
52
|
-
})
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
That's it! You can now use
|
|
56
|
-
|
|
57
|
-
## Development
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
# Install dependencies
|
|
61
|
-
npm install
|
|
62
|
-
|
|
63
|
-
# Generate type stubs
|
|
64
|
-
npm run dev:prepare
|
|
65
|
-
|
|
66
|
-
# Develop with the playground
|
|
67
|
-
npm run dev
|
|
68
|
-
|
|
69
|
-
# Build the playground
|
|
70
|
-
npm run dev:build
|
|
71
|
-
|
|
72
|
-
# Run ESLint
|
|
73
|
-
npm run lint
|
|
74
|
-
|
|
75
|
-
# Run Vitest
|
|
76
|
-
npm run test
|
|
77
|
-
npm run test:watch
|
|
78
|
-
|
|
79
|
-
# Release new version
|
|
80
|
-
npm run release
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
<!-- Badges -->
|
|
84
|
-
[npm-version-src]: https://img.shields.io/npm/v/
|
|
85
|
-
[npm-version-href]: https://npmjs.com/package/
|
|
86
|
-
|
|
87
|
-
[npm-downloads-src]: https://img.shields.io/npm/dm/
|
|
88
|
-
[npm-downloads-href]: https://npmjs.com/package/
|
|
89
|
-
|
|
90
|
-
[license-src]: https://img.shields.io/npm/l/
|
|
91
|
-
[license-href]: https://npmjs.com/package/
|
|
92
|
-
|
|
93
|
-
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
94
|
-
[nuxt-href]: https://nuxt.com
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
### app.vue
|
|
99
|
-
```html
|
|
100
|
-
<template>
|
|
101
|
-
<l-app>
|
|
102
|
-
<NuxtLoadingIndicator />
|
|
103
|
-
<NuxtPage />
|
|
104
|
-
</l-app>
|
|
105
|
-
</template>
|
|
106
|
-
```
|
|
1
|
+
<!--
|
|
2
|
+
Get your module up and running quickly.
|
|
3
|
+
|
|
4
|
+
Find and replace all on all files (CMD+SHIFT+F):
|
|
5
|
+
- Name: nuxt-light
|
|
6
|
+
- Package name: nuxt-light
|
|
7
|
+
- Description: My new Nuxt module
|
|
8
|
+
-->
|
|
9
|
+
|
|
10
|
+
# nuxt-light
|
|
11
|
+
|
|
12
|
+
[![npm version][npm-version-src]][npm-version-href]
|
|
13
|
+
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
14
|
+
[![License][license-src]][license-href]
|
|
15
|
+
[![Nuxt][nuxt-src]][nuxt-href]
|
|
16
|
+
|
|
17
|
+
This is a Hostlink nuxt-light framework for Nuxt.
|
|
18
|
+
|
|
19
|
+
- [✨ Release Notes](/CHANGELOG.md)
|
|
20
|
+
<!-- - [🏀 Online playground](https://stackblitz.com/github/your-org/nuxt-light?file=playground%2Fapp.vue) -->
|
|
21
|
+
<!-- - [📖 Documentation](https://example.com) -->
|
|
22
|
+
|
|
23
|
+
## Features
|
|
24
|
+
|
|
25
|
+
<!-- Highlight some of the features your module provide here -->
|
|
26
|
+
- HostLink nuxt-light framework
|
|
27
|
+
|
|
28
|
+
## Quick Setup
|
|
29
|
+
|
|
30
|
+
1. Add `nuxt-light` dependency to your project
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Using npm
|
|
34
|
+
npm install --save-dev @hostlink/nuxt-light
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Add `@hostlink/nuxt-light` to the `modules` section of `nuxt.config.ts`
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import pkg from './package.json'
|
|
41
|
+
export default defineNuxtConfig({
|
|
42
|
+
runtimeConfig: {
|
|
43
|
+
public: {
|
|
44
|
+
//apiBase: 'your-api-base-url'
|
|
45
|
+
appVersion: pkg.version
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
ssr:false,
|
|
49
|
+
modules: [
|
|
50
|
+
'@hostlink/nuxt-light'
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
That's it! You can now use nuxt-light in your Nuxt app ✨
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Install dependencies
|
|
61
|
+
npm install
|
|
62
|
+
|
|
63
|
+
# Generate type stubs
|
|
64
|
+
npm run dev:prepare
|
|
65
|
+
|
|
66
|
+
# Develop with the playground
|
|
67
|
+
npm run dev
|
|
68
|
+
|
|
69
|
+
# Build the playground
|
|
70
|
+
npm run dev:build
|
|
71
|
+
|
|
72
|
+
# Run ESLint
|
|
73
|
+
npm run lint
|
|
74
|
+
|
|
75
|
+
# Run Vitest
|
|
76
|
+
npm run test
|
|
77
|
+
npm run test:watch
|
|
78
|
+
|
|
79
|
+
# Release new version
|
|
80
|
+
npm run release
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
<!-- Badges -->
|
|
84
|
+
[npm-version-src]: https://img.shields.io/npm/v/@hostlink/nuxt-light/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
85
|
+
[npm-version-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
86
|
+
|
|
87
|
+
[npm-downloads-src]: https://img.shields.io/npm/dm/@hostlink/nuxt-light.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
88
|
+
[npm-downloads-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
89
|
+
|
|
90
|
+
[license-src]: https://img.shields.io/npm/l/@hostlink/nuxt-light.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
91
|
+
[license-href]: https://npmjs.com/package/@hostlink/nuxt-light
|
|
92
|
+
|
|
93
|
+
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
94
|
+
[nuxt-href]: https://nuxt.com
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
### app.vue
|
|
99
|
+
```html
|
|
100
|
+
<template>
|
|
101
|
+
<l-app>
|
|
102
|
+
<NuxtLoadingIndicator />
|
|
103
|
+
<NuxtPage />
|
|
104
|
+
</l-app>
|
|
105
|
+
</template>
|
|
106
|
+
```
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,6 +3,13 @@ import { useQuasar } from 'quasar';
|
|
|
3
3
|
import { useI18n } from 'vue-i18n';
|
|
4
4
|
import { useLight, q, getCurrentUser, m, f } from '../';
|
|
5
5
|
import { ref, computed, reactive, provide, watch } from 'vue';
|
|
6
|
+
import { useRuntimeConfig } from 'nuxt/app';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
const config = useRuntimeConfig();
|
|
10
|
+
|
|
11
|
+
const appVersion = config.public.appVersion ?? '0.0.1';
|
|
12
|
+
|
|
6
13
|
|
|
7
14
|
const quasar = useQuasar();
|
|
8
15
|
quasar.dark.set(false);
|
|
@@ -19,7 +26,6 @@ const tt = await q({
|
|
|
19
26
|
my: ["styles", "language", f('granted_storage:granted', { right: "system.storage" }, [])],
|
|
20
27
|
})
|
|
21
28
|
|
|
22
|
-
const allTranslate = ref(await q("allTranslate", []))
|
|
23
29
|
|
|
24
30
|
let app = tt.app
|
|
25
31
|
let my = tt.my
|
|
@@ -35,15 +41,14 @@ const menus = ref(app.menus)
|
|
|
35
41
|
const i18n = useI18n();
|
|
36
42
|
i18n.locale = my.language || 'en';
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
let messages = i18n.messages.value[i18n.locale];
|
|
39
45
|
|
|
40
|
-
for (
|
|
41
|
-
messages[
|
|
46
|
+
for (let t of app.i18nMessages) {
|
|
47
|
+
messages[t.name] = t.value;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
i18n.setLocaleMessage(i18n.locale, messages);
|
|
45
51
|
|
|
46
|
-
|
|
47
52
|
const user = ref(await getCurrentUser());
|
|
48
53
|
|
|
49
54
|
const leftDrawerOpen = ref(false)
|
|
@@ -338,7 +343,7 @@ const storageUsagePercent = computed(() => {
|
|
|
338
343
|
<q-footer class="bg-white text-grey" bordered>
|
|
339
344
|
<q-item>
|
|
340
345
|
<q-item-section>
|
|
341
|
-
{{ company }} {{
|
|
346
|
+
{{ company }} {{ appVersion }} - Copyright 2023 HostLink(HK). Build {{ light.getVersion() }}
|
|
342
347
|
</q-item-section>
|
|
343
348
|
</q-item>
|
|
344
349
|
</q-footer>
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useRuntimeConfig } from 'nuxt/app';
|
|
3
|
+
import { setApiUrl } from '@hostlink/light'
|
|
2
4
|
import { q } from '../';
|
|
5
|
+
const config = useRuntimeConfig();
|
|
6
|
+
setApiUrl(config?.public?.apiBase ?? '/api/');
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
const { app } = await q({ app: ['company', 'companyLogo', 'logged', 'twoFactorAuthentication'] });
|
|
4
10
|
</script>
|
|
5
11
|
<template>
|
|
@@ -3,7 +3,7 @@ import { VariableType } from "json-to-graphql-query";
|
|
|
3
3
|
import { useI18n } from "vue-i18n";
|
|
4
4
|
import { ref, watch, computed } from 'vue';
|
|
5
5
|
import { useQuasar } from 'quasar';
|
|
6
|
-
import { q } from '../';
|
|
6
|
+
import { q, m } from '../';
|
|
7
7
|
|
|
8
8
|
const i18n = useI18n();
|
|
9
9
|
const quasar = useQuasar();
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import { ref, reactive } from 'vue'
|
|
3
3
|
import { useQuasar } from 'quasar';
|
|
4
4
|
import { useI18n } from 'vue-i18n';
|
|
5
|
-
import {
|
|
5
|
+
import { m, notify } from '../';
|
|
6
|
+
|
|
7
|
+
import { login } from '@hostlink/light';
|
|
8
|
+
|
|
6
9
|
|
|
7
10
|
defineProps({
|
|
8
11
|
company: String,
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ interface Light {
|
|
|
7
7
|
getVersion(): string;
|
|
8
8
|
}
|
|
9
9
|
export declare function useLight(): Light;
|
|
10
|
-
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData,
|
|
10
|
+
export { notify, addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, mutation, q, removeObject, t, updateObject, getID, deleteObject, listObject, getApiBase } from "./lib";
|
package/dist/runtime/index.mjs
CHANGED
package/dist/runtime/lib/f.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
2
|
+
import toJson from "./toJson.mjs";
|
|
2
3
|
export default function(operation, args, fields = []) {
|
|
3
4
|
if (arguments.length === 2) {
|
|
4
5
|
fields = args;
|
|
@@ -15,11 +16,8 @@ export default function(operation, args, fields = []) {
|
|
|
15
16
|
if (typeof field === "string") {
|
|
16
17
|
query[operation][field] = true;
|
|
17
18
|
} else if (typeof field === "object") {
|
|
18
|
-
Object.entries(field).forEach(([key, value]) => {
|
|
19
|
-
query[operation][key] =
|
|
20
|
-
value.forEach((subField) => {
|
|
21
|
-
query[operation][key][subField] = true;
|
|
22
|
-
});
|
|
19
|
+
Object.entries(toJson(field)).forEach(([key, value]) => {
|
|
20
|
+
query[operation][key] = value;
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
23
|
});
|
|
@@ -6,7 +6,6 @@ import getObject from "./getObject";
|
|
|
6
6
|
import id from "./id";
|
|
7
7
|
import list from "./list";
|
|
8
8
|
import listData from "./listData";
|
|
9
|
-
import login from "./login";
|
|
10
9
|
import m from "./m";
|
|
11
10
|
import mutation from "./mutation";
|
|
12
11
|
import q from "./q";
|
|
@@ -19,4 +18,4 @@ import isGranted from "./isGranted";
|
|
|
19
18
|
declare const notify: (message: string, color?: string) => void;
|
|
20
19
|
import getID from "./getID";
|
|
21
20
|
declare const getApiBase: () => {};
|
|
22
|
-
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData,
|
|
21
|
+
export { addObject, f, getApiUrl, getCurrentUser, getObject, id, list, listData, m, mutation, q, removeObject, t, updateObject, notify, getID, deleteObject, listObject, isGranted, getApiBase };
|
|
@@ -8,7 +8,6 @@ import getObject from "./getObject.mjs";
|
|
|
8
8
|
import id from "./id.mjs";
|
|
9
9
|
import list from "./list.mjs";
|
|
10
10
|
import listData from "./listData.mjs";
|
|
11
|
-
import login from "./login.mjs";
|
|
12
11
|
import m from "./m.mjs";
|
|
13
12
|
import mutation from "./mutation.mjs";
|
|
14
13
|
import q from "./q.mjs";
|
|
@@ -39,7 +38,6 @@ export {
|
|
|
39
38
|
id,
|
|
40
39
|
list,
|
|
41
40
|
listData,
|
|
42
|
-
login,
|
|
43
41
|
m,
|
|
44
42
|
mutation,
|
|
45
43
|
q,
|
package/dist/runtime/lib/m.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
3
|
-
import { useRuntimeConfig } from "nuxt/app";
|
|
4
3
|
import { getApiBase } from "./index.mjs";
|
|
5
4
|
export default async function(operation, args, fields = []) {
|
|
6
|
-
const config = useRuntimeConfig();
|
|
7
5
|
const mutation = {
|
|
8
6
|
mutation: {}
|
|
9
7
|
};
|
package/dist/runtime/lib/q.mjs
CHANGED
|
@@ -1,36 +1,15 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import f from "./f.mjs";
|
|
3
3
|
import { jsonToGraphQLQuery } from "json-to-graphql-query";
|
|
4
|
-
import { useRuntimeConfig } from "nuxt/app";
|
|
5
4
|
import { getApiBase } from "./index.mjs";
|
|
6
|
-
|
|
7
|
-
let q = {};
|
|
8
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
9
|
-
if (value instanceof Array) {
|
|
10
|
-
q[key] = {};
|
|
11
|
-
value.forEach((subField) => {
|
|
12
|
-
if (subField instanceof Object) {
|
|
13
|
-
Object.entries(mapping(subField)).forEach(([subKey, subValue]) => {
|
|
14
|
-
q[key][subKey] = subValue;
|
|
15
|
-
});
|
|
16
|
-
} else {
|
|
17
|
-
q[key][subField] = true;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
} else {
|
|
21
|
-
q[key] = mapping(value);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
return q;
|
|
25
|
-
};
|
|
5
|
+
import toJson from "./toJson.mjs";
|
|
26
6
|
export default async function(operation, args, fields = []) {
|
|
27
|
-
const config = useRuntimeConfig();
|
|
28
7
|
const service = axios.create({
|
|
29
8
|
withCredentials: true
|
|
30
9
|
});
|
|
31
10
|
let query;
|
|
32
11
|
if (operation instanceof Object) {
|
|
33
|
-
query = jsonToGraphQLQuery(
|
|
12
|
+
query = jsonToGraphQLQuery(toJson(operation));
|
|
34
13
|
} else {
|
|
35
14
|
if (arguments.length === 2) {
|
|
36
15
|
fields = args;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const mapping = function(obj) {
|
|
2
|
+
let q = {};
|
|
3
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
4
|
+
if (value instanceof Array) {
|
|
5
|
+
q[key] = {};
|
|
6
|
+
value.forEach((subField) => {
|
|
7
|
+
if (subField instanceof Object) {
|
|
8
|
+
Object.entries(mapping(subField)).forEach(([subKey, subValue]) => {
|
|
9
|
+
q[key][subKey] = subValue;
|
|
10
|
+
});
|
|
11
|
+
} else {
|
|
12
|
+
q[key][subField] = true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
q[key] = mapping(value);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return q;
|
|
20
|
+
};
|
|
21
|
+
export default mapping;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.56",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": "@hostlink/nuxt-light",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@formkit/inputs": "^1.1.0",
|
|
38
|
+
"@hostlink/light": "^0.0.6",
|
|
38
39
|
"@nuxt/kit": "^3.7.0",
|
|
39
40
|
"@quasar/extras": "^1.16.6",
|
|
40
41
|
"axios": "^1.5.0",
|