@hostlink/nuxt-light 1.73.1 → 1.74.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.
Files changed (56) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/module.mjs +3 -1
  3. package/dist/runtime/components/L/App.vue +0 -19
  4. package/dist/runtime/components/L/AppMain.d.vue.ts +3 -3
  5. package/dist/runtime/components/L/AppMain.vue +43 -10
  6. package/dist/runtime/components/L/AppMain.vue.d.ts +3 -3
  7. package/dist/runtime/components/L/FacebookButton.d.vue.ts +19 -3
  8. package/dist/runtime/components/L/FacebookButton.vue +73 -12
  9. package/dist/runtime/components/L/FacebookButton.vue.d.ts +19 -3
  10. package/dist/runtime/components/L/FavMenu.d.vue.ts +2 -0
  11. package/dist/runtime/components/L/FavMenu.vue +10 -2
  12. package/dist/runtime/components/L/FavMenu.vue.d.ts +2 -0
  13. package/dist/runtime/components/L/FileUpload.vue +19 -8
  14. package/dist/runtime/components/L/Form.d.vue.ts +29 -56
  15. package/dist/runtime/components/L/Form.vue +70 -80
  16. package/dist/runtime/components/L/Form.vue.d.ts +29 -56
  17. package/dist/runtime/components/L/FormLayout.d.vue.ts +36 -0
  18. package/dist/runtime/components/L/FormLayout.vue +36 -0
  19. package/dist/runtime/components/L/FormLayout.vue.d.ts +36 -0
  20. package/dist/runtime/components/L/GroupSelect.vue +1 -1
  21. package/dist/runtime/components/L/Login.vue +1 -1
  22. package/dist/runtime/components/L/Menu.d.vue.ts +2 -0
  23. package/dist/runtime/components/L/Menu.vue +4 -4
  24. package/dist/runtime/components/L/Menu.vue.d.ts +2 -0
  25. package/dist/runtime/components/L/System/Setting/security.d.vue.ts +2 -0
  26. package/dist/runtime/components/L/System/Setting/security.vue +7 -1
  27. package/dist/runtime/components/L/System/Setting/security.vue.d.ts +2 -0
  28. package/dist/runtime/composables/useLight.d.ts +0 -4
  29. package/dist/runtime/formkit/Form.d.vue.ts +2 -2
  30. package/dist/runtime/formkit/Form.vue +15 -18
  31. package/dist/runtime/formkit/Form.vue.d.ts +2 -2
  32. package/dist/runtime/formkit/index.js +2 -0
  33. package/dist/runtime/locales/en.json +8 -2
  34. package/dist/runtime/locales/zh-hk.json +8 -2
  35. package/dist/runtime/pages/Role/[name]/update-child.vue +4 -1
  36. package/dist/runtime/pages/System/fs.vue +116 -15
  37. package/dist/runtime/pages/User/setting/index.vue +29 -12
  38. package/dist/runtime/pages/User/setting/information.vue +4 -28
  39. package/dist/runtime/pages/User/setting/open_id.vue +132 -91
  40. package/dist/runtime/pages/User/setting/two-factor-auth.vue +388 -143
  41. package/dist/runtime/pages/User/setting.vue +3 -4
  42. package/dist/runtime/types/form.d.ts +2 -0
  43. package/dist/runtime/types/form.js +0 -0
  44. package/dist/runtime/utils/filterMenuItems.d.ts +10 -0
  45. package/dist/runtime/utils/filterMenuItems.js +34 -0
  46. package/dist/runtime/utils/formLayout.d.ts +2 -0
  47. package/dist/runtime/utils/formLayout.js +7 -0
  48. package/dist/runtime/utils/socialSdk.d.ts +2 -0
  49. package/dist/runtime/utils/socialSdk.js +127 -0
  50. package/package.json +14 -14
  51. package/dist/runtime/pages/Role/add2.d.vue.ts +0 -3
  52. package/dist/runtime/pages/Role/add2.vue +0 -57
  53. package/dist/runtime/pages/Role/add2.vue.d.ts +0 -3
  54. package/dist/runtime/pages/System/test.d.vue.ts +0 -3
  55. package/dist/runtime/pages/System/test.vue +0 -13
  56. package/dist/runtime/pages/System/test.vue.d.ts +0 -3
@@ -0,0 +1,34 @@
1
+ const normalize = (value) => String(value ?? "").trim().toLocaleLowerCase();
2
+ export function filterMenuItems(items, query, translateLabel = (label) => label) {
3
+ if (!items) {
4
+ return [];
5
+ }
6
+ const normalizedQuery = normalize(query);
7
+ if (!normalizedQuery) {
8
+ return [...items];
9
+ }
10
+ return items.flatMap((item) => {
11
+ const label = String(item.label ?? "");
12
+ const matchesSelf = [
13
+ label,
14
+ translateLabel(label),
15
+ item.to,
16
+ item.path
17
+ ].some((value) => normalize(value).includes(normalizedQuery));
18
+ if (matchesSelf) {
19
+ return [item];
20
+ }
21
+ const filteredChildren = filterMenuItems(
22
+ item.children,
23
+ normalizedQuery,
24
+ translateLabel
25
+ );
26
+ if (filteredChildren.length === 0) {
27
+ return [];
28
+ }
29
+ return [{
30
+ ...item,
31
+ children: filteredChildren
32
+ }];
33
+ });
34
+ }
@@ -0,0 +1,2 @@
1
+ import type { LFormGutter, LFormLayout } from "../types/form.js";
2
+ export declare const getFormLayoutClasses: (layout: LFormLayout, gutter: LFormGutter) => string[];
@@ -0,0 +1,7 @@
1
+ export const getFormLayoutClasses = (layout, gutter) => {
2
+ const classes = [layout === "stack" ? "column" : "row"];
3
+ if (gutter !== "none") {
4
+ classes.push(layout === "stack" ? `q-gutter-${gutter}` : `q-col-gutter-${gutter}`);
5
+ }
6
+ return classes;
7
+ };
@@ -0,0 +1,2 @@
1
+ export function loadGoogleIdentityServices(): Promise<any>;
2
+ export function loadFacebookSdk(appId: any): Promise<any>;
@@ -0,0 +1,127 @@
1
+ const GOOGLE_SDK_URL = "https://accounts.google.com/gsi/client"
2
+ const FACEBOOK_SDK_URL = "https://connect.facebook.net/en_US/sdk.js"
3
+ const SDK_TIMEOUT = 15000
4
+
5
+ let googleSdkPromise
6
+ let facebookSdkPromise
7
+ let initializedFacebookAppId
8
+
9
+ const ensureBrowser = () => {
10
+ if (typeof window === "undefined" || typeof document === "undefined") {
11
+ throw new Error("Social login SDKs are only available in the browser")
12
+ }
13
+ }
14
+
15
+ const ensureScript = (id, src) => {
16
+ const existing = document.getElementById(id)
17
+ || Array.from(document.scripts).find(script => script.src === src)
18
+
19
+ if (existing) {
20
+ return existing
21
+ }
22
+
23
+ const script = document.createElement("script")
24
+ script.id = id
25
+ script.src = src
26
+ script.async = true
27
+ script.defer = true
28
+ document.head.appendChild(script)
29
+ return script
30
+ }
31
+
32
+ const waitForSdk = (script, getSdk, name) => new Promise((resolve, reject) => {
33
+ const sdk = getSdk()
34
+ if (sdk) {
35
+ resolve(sdk)
36
+ return
37
+ }
38
+
39
+ let settled = false
40
+ const startedAt = Date.now()
41
+
42
+ const finish = (callback, value) => {
43
+ if (settled) {
44
+ return
45
+ }
46
+ settled = true
47
+ clearInterval(interval)
48
+ script.removeEventListener("error", onError)
49
+ callback(value)
50
+ }
51
+
52
+ const onError = () => {
53
+ finish(reject, new Error(`${name} SDK failed to load`))
54
+ }
55
+
56
+ const interval = window.setInterval(() => {
57
+ const loadedSdk = getSdk()
58
+ if (loadedSdk) {
59
+ finish(resolve, loadedSdk)
60
+ } else if (Date.now() - startedAt >= SDK_TIMEOUT) {
61
+ finish(reject, new Error(`${name} SDK timed out while loading`))
62
+ }
63
+ }, 50)
64
+
65
+ script.addEventListener("error", onError, { once: true })
66
+ })
67
+
68
+ export const loadGoogleIdentityServices = async () => {
69
+ ensureBrowser()
70
+
71
+ if (window.google?.accounts?.id) {
72
+ return window.google
73
+ }
74
+
75
+ if (!googleSdkPromise) {
76
+ const script = ensureScript("google-identity-services", GOOGLE_SDK_URL)
77
+ googleSdkPromise = waitForSdk(
78
+ script,
79
+ () => window.google?.accounts?.id ? window.google : null,
80
+ "Google"
81
+ ).catch((error) => {
82
+ googleSdkPromise = undefined
83
+ throw error
84
+ })
85
+ }
86
+
87
+ return googleSdkPromise
88
+ }
89
+
90
+ export const loadFacebookSdk = async (appId) => {
91
+ ensureBrowser()
92
+
93
+ if (!appId) {
94
+ throw new Error("Facebook App ID is not configured")
95
+ }
96
+
97
+ if (!document.getElementById("fb-root")) {
98
+ const root = document.createElement("div")
99
+ root.id = "fb-root"
100
+ document.body.prepend(root)
101
+ }
102
+
103
+ if (!facebookSdkPromise) {
104
+ const script = ensureScript("facebook-jssdk", FACEBOOK_SDK_URL)
105
+ facebookSdkPromise = waitForSdk(
106
+ script,
107
+ () => window.FB || null,
108
+ "Facebook"
109
+ ).catch((error) => {
110
+ facebookSdkPromise = undefined
111
+ throw error
112
+ })
113
+ }
114
+
115
+ const facebook = await facebookSdkPromise
116
+ if (initializedFacebookAppId !== appId) {
117
+ facebook.init({
118
+ appId,
119
+ cookie: true,
120
+ xfbml: false,
121
+ version: "v21.0"
122
+ })
123
+ initializedFacebookAppId = appId
124
+ }
125
+
126
+ return facebook
127
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hostlink/nuxt-light",
3
- "version": "1.73.1",
3
+ "version": "1.74.0",
4
4
  "description": "HostLink Nuxt Light Framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,37 +32,37 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@azure/msal-browser": "^4.26.2",
35
- "@formkit/core": "^1.7.2",
36
- "@formkit/drag-and-drop": "^0.5.3",
37
- "@formkit/i18n": "^1.7.2",
38
- "@formkit/inputs": "^1.7.2",
39
- "@formkit/validation": "^1.7.2",
40
- "@formkit/vue": "^1.7.2",
35
+ "@formkit/core": "^2.1.2",
36
+ "@formkit/drag-and-drop": "^0.6.1",
37
+ "@formkit/i18n": "^2.1.2",
38
+ "@formkit/inputs": "^2.1.2",
39
+ "@formkit/validation": "^2.1.2",
40
+ "@formkit/vue": "^2.1.2",
41
41
  "@hostlink/light": "^3.2.7",
42
42
  "@nuxt/module-builder": "^1.0.1",
43
- "@quasar/extras": "^1.17.0",
44
- "@quasar/quasar-ui-qmarkdown": "^3.0.0-rc.1",
43
+ "@quasar/extras": "^2.0.2",
44
+ "@quasar/quasar-ui-qmarkdown": "^3.0.1",
45
45
  "@vueuse/core": "^14.0.0",
46
- "axios": "^1.12.2",
46
+ "axios": "^1.19.0",
47
47
  "defu": "^6.1.4",
48
48
  "diff2html": "^3.4.47",
49
49
  "dompurify": "^3.3.1",
50
50
  "json-to-graphql-query": "^2.3.0",
51
- "nuxt-quasar-ui": "^3.0.0",
52
- "quasar": "^2.18.5",
51
+ "nuxt-quasar-ui": "^3.1.0",
52
+ "quasar": "^2.23.3",
53
53
  "vue-i18n": "^11.1.12",
54
54
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@nuxt/devtools": "latest",
58
- "@nuxt/eslint-config": "^1.10.0",
58
+ "@nuxt/eslint-config": "^1.16.0",
59
59
  "@nuxt/kit": "^4.3.0",
60
60
  "@nuxt/schema": "^4.3.0",
61
61
  "@nuxt/test-utils": "^3.17.2",
62
62
  "@types/google.accounts": "^0.0.18",
63
63
  "@types/node": "^24.10.1",
64
64
  "changelogen": "^0.6.2",
65
- "eslint": "^9.39.1",
65
+ "eslint": "^10.8.0",
66
66
  "nuxt": "^4.3.0",
67
67
  "typescript": "^5.9.2",
68
68
  "vitest": "^3.2.6",
@@ -1,3 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,57 +0,0 @@
1
- <script setup>
2
- import { m, q } from "#imports";
3
- import { collect } from "collect.js";
4
- const { app } = await q({
5
- app: {
6
- permissions: true
7
- }
8
- });
9
- app.permissions = app.permissions.filter((permission) => permission != "*");
10
- const g = collect(app.permissions).groupBy((permission) => permission.split(".")[0]).all();
11
- const x = Object.keys(g).map((module) => {
12
- return {
13
- module,
14
- permissions: collect(g[module]).map((permission) => {
15
- return {
16
- label: permission,
17
- value: permission
18
- };
19
- }).all()
20
- };
21
- });
22
- const onSubmit = () => {
23
- };
24
- </script>
25
-
26
- <template>
27
- <l-page>
28
-
29
- <form-kit type="l-form" @submit="onSubmit" :value="{
30
- permissions: []
31
- }" #default="{ value }">
32
- <form-kit type="l-input" name="name" label="Name" validation="required" />
33
- <q-separator />
34
-
35
- <l-row>
36
- <l-col md="3" v-for="module in x" :key="module.module">
37
-
38
- <q-list>
39
- <q-item dense>
40
- <q-item-section>
41
- <q-item-label>
42
- {{ module.module }}
43
- </q-item-label>
44
- </q-item-section>
45
- </q-item>
46
- <q-separator />
47
- <q-option-group dense :options="module.permissions" type="checkbox"
48
- v-model="value.permissions" />
49
- </q-list>
50
-
51
- </l-col>
52
- </l-row>
53
-
54
- </form-kit>
55
-
56
- </l-page>
57
- </template>
@@ -1,3 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,3 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -1,13 +0,0 @@
1
- <script setup>
2
-
3
- </script>
4
- <template>
5
- <l-page>
6
-
7
- <l-card title="Test">
8
- <q-card-section>
9
- </q-card-section>
10
- </l-card>
11
-
12
- </l-page>
13
- </template>
@@ -1,3 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;