@simsustech/quasar-components 0.1.1 → 0.1.3
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/CHANGELOG.md +12 -0
- package/dist/QSubmitButton.vue_vue_type_script_setup_true_lang.1d0c06eb.js +93 -0
- package/dist/authentication.js +1651 -0
- package/dist/flags.js +217 -0
- package/dist/general.js +81 -0
- package/dist/icons.js +23 -0
- package/dist/nl.6b0aedb7.js +89 -0
- package/dist/nl.7787ff31.js +9 -0
- package/dist/nl.b1ad9de9.js +134 -0
- package/dist/style.css +4 -0
- package/dist/types/ui/authentication/ConsentList.vue.d.ts +85 -0
- package/dist/types/ui/authentication/EmailChangeForm.vue.d.ts +147 -0
- package/dist/types/ui/authentication/EmailChangeStepper.vue.d.ts +168 -0
- package/dist/types/ui/authentication/LoginButton.vue.d.ts +69 -0
- package/dist/types/ui/authentication/LoginForm.vue.d.ts +157 -0
- package/dist/types/ui/authentication/OtpInput.vue.d.ts +69 -0
- package/dist/types/ui/authentication/PasswordChangeForm.vue.d.ts +187 -0
- package/dist/types/ui/authentication/PasswordChangeStepper.vue.d.ts +168 -0
- package/dist/types/ui/authentication/RegisterForm.vue.d.ts +230 -0
- package/dist/types/ui/authentication/RequestOtpForm.vue.d.ts +132 -0
- package/dist/types/ui/authentication/UserMenuButton.vue.d.ts +82 -0
- package/dist/types/ui/authentication/VerificationSlider.vue.d.ts +77 -0
- package/dist/types/ui/authentication/index.d.ts +12 -0
- package/dist/types/ui/authentication/lang/en-US.d.ts +3 -0
- package/dist/types/ui/authentication/lang/index.d.ts +176 -0
- package/dist/types/ui/authentication/lang/nl.d.ts +3 -0
- package/dist/types/ui/flags/index.d.ts +3 -0
- package/dist/types/ui/flags/lang/en-US.d.ts +3 -0
- package/dist/types/ui/flags/lang/index.d.ts +266 -0
- package/dist/types/ui/flags/lang/nl.d.ts +3 -0
- package/dist/types/ui/general/QStyledCard.vue.d.ts +74 -0
- package/dist/types/ui/general/QStyledLayout.vue.d.ts +69 -0
- package/dist/types/ui/general/QSubmitButton.vue.d.ts +138 -0
- package/dist/types/ui/general/index.d.ts +2 -0
- package/dist/types/ui/general/lang/en-US.d.ts +3 -0
- package/dist/types/ui/general/lang/index.d.ts +16 -0
- package/dist/types/ui/general/lang/nl.d.ts +3 -0
- package/dist/types/ui/icons/icons.d.ts +6 -0
- package/dist/types/ui/icons/index.d.ts +2 -0
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/virtualModules.d.ts +2 -0
- package/dist/types/vite-plugin.d.ts +4 -0
- package/dist/virtualModules.d.ts +2 -0
- package/dist/virtualModules.js +2 -0
- package/dist/vite-plugin.d.ts +4 -0
- package/dist/vite-plugin.js +81 -0
- package/package.json +8 -5
- package/src/ui/authentication/EmailChangeForm.vue +9 -4
- package/src/ui/authentication/EmailChangeStepper.vue +4 -0
- package/src/ui/authentication/LoginForm.vue +7 -2
- package/src/ui/authentication/PasswordChangeForm.vue +7 -2
- package/src/ui/authentication/PasswordChangeStepper.vue +4 -0
- package/src/ui/authentication/RegisterForm.vue +7 -2
- package/src/ui/authentication/RequestOtpForm.vue +3 -3
- package/src/ui/general/QSubmitButton.vue +1 -1
- package/src/ui/index.ts +0 -1
- package/src/virtualModules.ts +70 -0
- package/src/vite-plugin.ts +40 -17
- package/tsconfig.build.plugin.json +1 -1
- package/tsconfig.node.json +1 -1
- package/vite.config.ts +63 -63
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { promises } from 'fs';
|
|
38
|
+
var readFile = promises.readFile;
|
|
39
|
+
export default function (_a) {
|
|
40
|
+
var _b = _a === void 0 ? {} : _a, buildFromSrc = _b.buildFromSrc;
|
|
41
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
+
var pkgJson, _c, _d, exports, name;
|
|
43
|
+
return __generator(this, function (_e) {
|
|
44
|
+
switch (_e.label) {
|
|
45
|
+
case 0:
|
|
46
|
+
_d = (_c = JSON).parse;
|
|
47
|
+
return [4 /*yield*/, readFile(new URL('../package.json', import.meta.url).pathname, 'utf-8')];
|
|
48
|
+
case 1:
|
|
49
|
+
pkgJson = _d.apply(_c, [_e.sent()]);
|
|
50
|
+
exports = pkgJson.exports;
|
|
51
|
+
name = pkgJson.name;
|
|
52
|
+
return [2 /*return*/, {
|
|
53
|
+
name: "".concat(name, "-plugin"),
|
|
54
|
+
config: function (config, _a) {
|
|
55
|
+
var mode = _a.mode;
|
|
56
|
+
if (mode === 'development' || buildFromSrc) {
|
|
57
|
+
var alias = Object.entries(exports)
|
|
58
|
+
.map(function (_a) {
|
|
59
|
+
var key = _a[0], val = _a[1];
|
|
60
|
+
return {
|
|
61
|
+
find: name + key.slice(1),
|
|
62
|
+
replacement: new URL('.' + val.src, import.meta.url).pathname
|
|
63
|
+
};
|
|
64
|
+
})
|
|
65
|
+
.sort(function (a, b) {
|
|
66
|
+
return (b.find.match(/\//g) || []).length -
|
|
67
|
+
(a.find.match(/\//g) || []).length;
|
|
68
|
+
});
|
|
69
|
+
return {
|
|
70
|
+
resolve: {
|
|
71
|
+
alias: alias
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
}];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simsustech/quasar-components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"author": "Stefan van Herwijnen",
|
|
5
5
|
"description": "High level components for Quasar Framework",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,21 +14,24 @@
|
|
|
14
14
|
},
|
|
15
15
|
"./authentication": {
|
|
16
16
|
"types": "./dist/types/ui/authentication/index.d.ts",
|
|
17
|
-
"import": "./dist/authentication.js"
|
|
17
|
+
"import": "./dist/authentication.js",
|
|
18
|
+
"src": "./src/ui/authentication/index.ts"
|
|
18
19
|
},
|
|
19
20
|
"./flags": {
|
|
20
21
|
"types": "./dist/types/ui/flags/index.d.ts",
|
|
21
|
-
"import": "./dist/flags.js"
|
|
22
|
+
"import": "./dist/flags.js",
|
|
23
|
+
"src": "./src/ui/flags/index.ts"
|
|
22
24
|
},
|
|
23
25
|
"./icons": {
|
|
24
26
|
"types": "./dist/types/ui/icons/index.d.ts",
|
|
25
|
-
"import": "./dist/icons.js"
|
|
27
|
+
"import": "./dist/icons.js",
|
|
28
|
+
"src": "./src/ui/icons/index.ts"
|
|
26
29
|
},
|
|
27
30
|
"./css": {
|
|
28
31
|
"import": "./dist/style.css"
|
|
29
32
|
},
|
|
30
33
|
"./vite-plugin": {
|
|
31
|
-
"types": "./dist/vite-plugin.d.ts",
|
|
34
|
+
"types": "./dist/types/vite-plugin.d.ts",
|
|
32
35
|
"import": "./dist/vite-plugin.js"
|
|
33
36
|
}
|
|
34
37
|
},
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-form
|
|
2
|
+
<q-form
|
|
3
|
+
ref="formRef"
|
|
4
|
+
class="q-gutter-md"
|
|
5
|
+
v-bind="form"
|
|
6
|
+
@submit="(e) => submit"
|
|
7
|
+
>
|
|
3
8
|
<otp-input v-bind="input" v-model="otp" />
|
|
4
9
|
<q-input
|
|
5
10
|
v-bind="input"
|
|
@@ -41,7 +46,7 @@ import OtpInput from './OtpInput.vue'
|
|
|
41
46
|
|
|
42
47
|
export interface Props {
|
|
43
48
|
email: string
|
|
44
|
-
form?: QFormProps & HTMLFormElement
|
|
49
|
+
form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
|
|
45
50
|
input?: Omit<
|
|
46
51
|
QInputProps,
|
|
47
52
|
| 'id'
|
|
@@ -106,8 +111,8 @@ const submit: InstanceType<typeof QSubmitButton>['$props']['onSubmit'] = (
|
|
|
106
111
|
formRef.value?.validate().then((success) => {
|
|
107
112
|
if (success) {
|
|
108
113
|
emit('submit', {
|
|
109
|
-
email: email.value,
|
|
110
|
-
newEmail: newEmail.value,
|
|
114
|
+
email: email.value.trim(),
|
|
115
|
+
newEmail: newEmail.value.trim(),
|
|
111
116
|
otp: otp.value,
|
|
112
117
|
done: evt.done
|
|
113
118
|
})
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<q-step name="requestOtp" :title="requestOtpHeader">
|
|
4
4
|
<request-otp-form
|
|
5
5
|
ref="requestOtpFormRef"
|
|
6
|
+
:form="{ id: 'requestOtpForm' }"
|
|
6
7
|
:input="input"
|
|
7
8
|
@submit="requestOtp"
|
|
8
9
|
></request-otp-form>
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
<q-step name="changeEmail" :title="emailChangeHeader">
|
|
12
13
|
<email-change-form
|
|
13
14
|
ref="emailChangeFormRef"
|
|
15
|
+
:form="{ id: 'emailChangeForm' }"
|
|
14
16
|
:email="email"
|
|
15
17
|
:input="input"
|
|
16
18
|
@submit="changeEmail"
|
|
@@ -22,10 +24,12 @@
|
|
|
22
24
|
<q-submit-button
|
|
23
25
|
v-if="step === 'requestOtp'"
|
|
24
26
|
is-next-button
|
|
27
|
+
form="requestOtpForm"
|
|
25
28
|
@submit="requestOtpFormRef?.functions.submit"
|
|
26
29
|
></q-submit-button>
|
|
27
30
|
<q-submit-button
|
|
28
31
|
v-if="step === 'changeEmail'"
|
|
32
|
+
form="emailChangeForm"
|
|
29
33
|
@submit="emailChangeFormRef?.functions.submit"
|
|
30
34
|
></q-submit-button>
|
|
31
35
|
</q-stepper-navigation>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-form
|
|
2
|
+
<q-form
|
|
3
|
+
ref="formRef"
|
|
4
|
+
class="q-gutter-md"
|
|
5
|
+
v-bind="form"
|
|
6
|
+
@submit="(e) => submit"
|
|
7
|
+
>
|
|
3
8
|
<q-input
|
|
4
9
|
v-if="!useUsername"
|
|
5
10
|
v-bind="input"
|
|
@@ -71,7 +76,7 @@ import QSubmitButton from '../general/QSubmitButton.vue'
|
|
|
71
76
|
export interface Props {
|
|
72
77
|
useUsername?: boolean
|
|
73
78
|
passwordForgotUrl?: string
|
|
74
|
-
form?: QFormProps & HTMLFormElement
|
|
79
|
+
form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
|
|
75
80
|
input?: Omit<
|
|
76
81
|
QInputProps,
|
|
77
82
|
| 'id'
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-form
|
|
2
|
+
<q-form
|
|
3
|
+
ref="formRef"
|
|
4
|
+
class="q-gutter-md"
|
|
5
|
+
v-bind="form"
|
|
6
|
+
@submit="(e) => submit"
|
|
7
|
+
>
|
|
3
8
|
<otp-input v-bind="input" v-model="otp" />
|
|
4
9
|
<q-input
|
|
5
10
|
v-bind="input"
|
|
@@ -61,7 +66,7 @@ import OtpInput from './OtpInput.vue'
|
|
|
61
66
|
export interface Props {
|
|
62
67
|
email: string
|
|
63
68
|
minimumPasswordLength?: number
|
|
64
|
-
form?: QFormProps & HTMLFormElement
|
|
69
|
+
form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
|
|
65
70
|
input?: Omit<
|
|
66
71
|
QInputProps,
|
|
67
72
|
| 'id'
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<q-step name="requestOtp" :title="requestOtpHeader">
|
|
4
4
|
<request-otp-form
|
|
5
5
|
ref="requestOtpFormRef"
|
|
6
|
+
:form="{ id: 'requestOtpForm' }"
|
|
6
7
|
:input="input"
|
|
7
8
|
@submit="requestOtp"
|
|
8
9
|
></request-otp-form>
|
|
@@ -11,6 +12,7 @@
|
|
|
11
12
|
<q-step name="changePassword" :title="passwordChangeHeader">
|
|
12
13
|
<password-change-form
|
|
13
14
|
ref="passwordChangeFormRef"
|
|
15
|
+
:form="{ id: 'passwordChangeForm' }"
|
|
14
16
|
:email="email"
|
|
15
17
|
:input="input"
|
|
16
18
|
@submit="changePassword"
|
|
@@ -22,10 +24,12 @@
|
|
|
22
24
|
<q-submit-button
|
|
23
25
|
v-if="step === 'requestOtp'"
|
|
24
26
|
is-next-button
|
|
27
|
+
form="requestOtpForm"
|
|
25
28
|
@submit="requestOtpFormRef?.functions.submit"
|
|
26
29
|
></q-submit-button>
|
|
27
30
|
<q-submit-button
|
|
28
31
|
v-if="step === 'changePassword'"
|
|
32
|
+
form="passwordChangeForm"
|
|
29
33
|
@submit="passwordChangeFormRef?.functions.submit"
|
|
30
34
|
></q-submit-button>
|
|
31
35
|
</q-stepper-navigation>
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-form
|
|
2
|
+
<q-form
|
|
3
|
+
ref="formRef"
|
|
4
|
+
class="q-gutter-md"
|
|
5
|
+
v-bind="form"
|
|
6
|
+
@submit="(e) => submit"
|
|
7
|
+
>
|
|
3
8
|
<q-input
|
|
4
9
|
v-if="!useUsername"
|
|
5
10
|
v-bind="input"
|
|
@@ -97,7 +102,7 @@ export interface Props {
|
|
|
97
102
|
rules?: ((val: string) => boolean)[]
|
|
98
103
|
}[]
|
|
99
104
|
minimumPasswordLength?: number
|
|
100
|
-
form?: QFormProps & HTMLFormElement
|
|
105
|
+
form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
|
|
101
106
|
input?: Omit<
|
|
102
107
|
QInputProps,
|
|
103
108
|
| 'id'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<q-form ref="formRef" v-bind="form">
|
|
2
|
+
<q-form ref="formRef" v-bind="form" @submit="(e) => submit">
|
|
3
3
|
<q-input
|
|
4
4
|
v-bind="input"
|
|
5
5
|
id="email"
|
|
@@ -29,7 +29,7 @@ import isEmail from 'validator/es/lib/isEmail.js'
|
|
|
29
29
|
import QSubmitButton from '../general/QSubmitButton.vue'
|
|
30
30
|
|
|
31
31
|
export interface Props {
|
|
32
|
-
form?: QFormProps & HTMLFormElement
|
|
32
|
+
form?: QFormProps & Partial<HTMLFormElement> & Partial<HTMLDivElement>
|
|
33
33
|
input?: Omit<
|
|
34
34
|
QInputProps,
|
|
35
35
|
| 'id'
|
|
@@ -83,7 +83,7 @@ const submit: InstanceType<typeof QSubmitButton>['$props']['onSubmit'] = ({
|
|
|
83
83
|
formRef.value?.validate().then((success) => {
|
|
84
84
|
if (success) {
|
|
85
85
|
emit('submit', {
|
|
86
|
-
email: email.value,
|
|
86
|
+
email: email.value.trim(),
|
|
87
87
|
done: done
|
|
88
88
|
})
|
|
89
89
|
} else done()
|
package/src/ui/index.ts
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export const FlagIcon = (locale: string) => `
|
|
2
|
+
import { computed, ref, watch, h } from 'vue'
|
|
3
|
+
import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
|
|
4
|
+
import { useLang, loadLang } from '${
|
|
5
|
+
new URL(`../src/ui/flags/lang`, import.meta.url).pathname
|
|
6
|
+
}'
|
|
7
|
+
import icon from '${
|
|
8
|
+
new URL(`../src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
|
|
9
|
+
}'
|
|
10
|
+
export default {
|
|
11
|
+
setup(props, context) {
|
|
12
|
+
const $q = useQuasar()
|
|
13
|
+
const lang = useLang()
|
|
14
|
+
if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
|
|
15
|
+
watch($q.lang, (val) => {
|
|
16
|
+
loadLang($q.lang.isoName)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const country = computed(
|
|
20
|
+
() => lang.value.countries['${locale}']
|
|
21
|
+
)
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const language = computed(() => lang.value.languages['${locale}'])
|
|
24
|
+
const variables = ref({
|
|
25
|
+
country,
|
|
26
|
+
language
|
|
27
|
+
// header: lang.value.some.nested.prop
|
|
28
|
+
})
|
|
29
|
+
const functions = ref({
|
|
30
|
+
// submit
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
context.expose({
|
|
34
|
+
variables,
|
|
35
|
+
functions
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// return the render function
|
|
39
|
+
return () => h(QIcon, { name: \`img:\${icon}\` })
|
|
40
|
+
}}
|
|
41
|
+
`
|
|
42
|
+
|
|
43
|
+
export const Icon = (icon: string) => `
|
|
44
|
+
import { computed, ref, watch, h } from 'vue'
|
|
45
|
+
import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
|
|
46
|
+
import icon from '${
|
|
47
|
+
new URL(`../src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
|
|
48
|
+
}'
|
|
49
|
+
import icons from '${
|
|
50
|
+
new URL(`../src/ui/icons/icons.ts`, import.meta.url).pathname
|
|
51
|
+
}'
|
|
52
|
+
export default {
|
|
53
|
+
setup(props, context) {
|
|
54
|
+
const $q = useQuasar()
|
|
55
|
+
|
|
56
|
+
const variables = ref(icons['${icon}'])
|
|
57
|
+
|
|
58
|
+
const functions = ref({
|
|
59
|
+
// submit
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
context.expose({
|
|
63
|
+
variables,
|
|
64
|
+
functions
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
// return the render function
|
|
68
|
+
return () => h(QIcon, { name: \`img:\${icon}\` })
|
|
69
|
+
}}
|
|
70
|
+
`
|
package/src/vite-plugin.ts
CHANGED
|
@@ -1,29 +1,52 @@
|
|
|
1
1
|
import type { Plugin } from 'vite'
|
|
2
|
+
import { promises } from 'fs'
|
|
3
|
+
const { readFile } = promises
|
|
4
|
+
|
|
5
|
+
export default async function ({
|
|
6
|
+
buildFromSrc
|
|
7
|
+
}: {
|
|
8
|
+
buildFromSrc?: boolean
|
|
9
|
+
} = {}): Promise<Plugin> {
|
|
10
|
+
const pkgJson = JSON.parse(
|
|
11
|
+
await readFile(
|
|
12
|
+
new URL('../package.json', import.meta.url).pathname,
|
|
13
|
+
'utf-8'
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
const exports = pkgJson.exports as Record<
|
|
17
|
+
string,
|
|
18
|
+
{
|
|
19
|
+
types: string
|
|
20
|
+
import: string
|
|
21
|
+
src: string
|
|
22
|
+
}
|
|
23
|
+
>[]
|
|
24
|
+
const name = pkgJson.name
|
|
2
25
|
|
|
3
|
-
export default async function (): Promise<Plugin> {
|
|
4
26
|
return {
|
|
5
|
-
name:
|
|
27
|
+
name: `${name}-plugin`,
|
|
6
28
|
config(config, { mode }) {
|
|
7
|
-
if (mode === 'development') {
|
|
29
|
+
if (mode === 'development' || buildFromSrc) {
|
|
30
|
+
const alias = Object.entries(exports)
|
|
31
|
+
.map(([key, val]) => {
|
|
32
|
+
return {
|
|
33
|
+
find: name + key.slice(1),
|
|
34
|
+
replacement: new URL('.' + val.src, import.meta.url).pathname
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.sort(
|
|
38
|
+
(a, b) =>
|
|
39
|
+
(b.find.match(/\//g) || []).length -
|
|
40
|
+
(a.find.match(/\//g) || []).length
|
|
41
|
+
)
|
|
42
|
+
|
|
8
43
|
return {
|
|
9
44
|
resolve: {
|
|
10
|
-
alias
|
|
11
|
-
{
|
|
12
|
-
find: '@simsustech/quasar-components/flags',
|
|
13
|
-
replacement: new URL(
|
|
14
|
-
'../src/ui/flags/index.ts',
|
|
15
|
-
import.meta.url
|
|
16
|
-
).pathname
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
find: '@simsustech/quasar-components',
|
|
20
|
-
replacement: new URL('../src/ui/index.ts', import.meta.url)
|
|
21
|
-
.pathname
|
|
22
|
-
}
|
|
23
|
-
]
|
|
45
|
+
alias
|
|
24
46
|
}
|
|
25
47
|
}
|
|
26
48
|
}
|
|
49
|
+
|
|
27
50
|
return {}
|
|
28
51
|
}
|
|
29
52
|
}
|
package/tsconfig.node.json
CHANGED
package/vite.config.ts
CHANGED
|
@@ -2,77 +2,77 @@ import { defineConfig } from 'vite'
|
|
|
2
2
|
import vue from '@vitejs/plugin-vue'
|
|
3
3
|
import Components from 'unplugin-vue-components/vite'
|
|
4
4
|
import { QuasarResolver } from 'unplugin-vue-components/resolvers'
|
|
5
|
+
import { FlagIcon, Icon } from './src/virtualModules.js'
|
|
6
|
+
// export const FlagIcon = (locale) => `
|
|
7
|
+
// import { computed, ref, watch, h } from 'vue'
|
|
8
|
+
// import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
|
|
9
|
+
// import { useLang, loadLang } from '${
|
|
10
|
+
// new URL(`./src/ui/flags/lang`, import.meta.url).pathname
|
|
11
|
+
// }'
|
|
12
|
+
// import icon from '${
|
|
13
|
+
// new URL(`./src/ui/flags/assets/${locale}.svg`, import.meta.url).pathname
|
|
14
|
+
// }'
|
|
15
|
+
// export default {
|
|
16
|
+
// setup(props, context) {
|
|
17
|
+
// const $q = useQuasar()
|
|
18
|
+
// const lang = useLang()
|
|
19
|
+
// if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
|
|
20
|
+
// watch($q.lang, (val) => {
|
|
21
|
+
// loadLang($q.lang.isoName)
|
|
22
|
+
// })
|
|
5
23
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (lang.value.isoName !== $q.lang.isoName) loadLang($q.lang.isoName)
|
|
20
|
-
watch($q.lang, (val) => {
|
|
21
|
-
loadLang($q.lang.isoName)
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
const country = computed(
|
|
25
|
-
() => lang.value.countries['${locale}']
|
|
26
|
-
)
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
const language = computed(() => lang.value.languages['${locale}'])
|
|
29
|
-
const variables = ref({
|
|
30
|
-
country,
|
|
31
|
-
language
|
|
32
|
-
// header: lang.value.some.nested.prop
|
|
33
|
-
})
|
|
34
|
-
const functions = ref({
|
|
35
|
-
// submit
|
|
36
|
-
})
|
|
24
|
+
// const country = computed(
|
|
25
|
+
// () => lang.value.countries['${locale}']
|
|
26
|
+
// )
|
|
27
|
+
// // @ts-ignore
|
|
28
|
+
// const language = computed(() => lang.value.languages['${locale}'])
|
|
29
|
+
// const variables = ref({
|
|
30
|
+
// country,
|
|
31
|
+
// language
|
|
32
|
+
// // header: lang.value.some.nested.prop
|
|
33
|
+
// })
|
|
34
|
+
// const functions = ref({
|
|
35
|
+
// // submit
|
|
36
|
+
// })
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
// context.expose({
|
|
39
|
+
// variables,
|
|
40
|
+
// functions
|
|
41
|
+
// })
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
`
|
|
43
|
+
// // return the render function
|
|
44
|
+
// return () => h(QIcon, { name: \`img:\${icon}\` })
|
|
45
|
+
// }}
|
|
46
|
+
// `
|
|
47
47
|
|
|
48
|
-
const Icon = (icon) => `
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
// export const Icon = (icon) => `
|
|
49
|
+
// import { computed, ref, watch, h } from 'vue'
|
|
50
|
+
// import { QuasarLanguageCodes, useQuasar, QIcon } from 'quasar'
|
|
51
|
+
// import icon from '${
|
|
52
|
+
// new URL(`./src/ui/icons/assets/${icon}.svg`, import.meta.url).pathname
|
|
53
|
+
// }'
|
|
54
|
+
// import icons from '${
|
|
55
|
+
// new URL(`./src/ui/icons/icons.ts`, import.meta.url).pathname
|
|
56
|
+
// }'
|
|
57
|
+
// export default {
|
|
58
|
+
// setup(props, context) {
|
|
59
|
+
// const $q = useQuasar()
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
// const variables = ref(icons['${icon}'])
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
// const functions = ref({
|
|
64
|
+
// // submit
|
|
65
|
+
// })
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
// context.expose({
|
|
68
|
+
// variables,
|
|
69
|
+
// functions
|
|
70
|
+
// })
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
`
|
|
72
|
+
// // return the render function
|
|
73
|
+
// return () => h(QIcon, { name: \`img:\${icon}\` })
|
|
74
|
+
// }}
|
|
75
|
+
// `
|
|
76
76
|
|
|
77
77
|
export default defineConfig(async ({ command, mode }) => ({
|
|
78
78
|
plugins: [
|