@quvel-kit/core 1.1.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 +670 -0
- package/dist/auth/boot/defineAuthGuard.d.ts +54 -0
- package/dist/auth/boot/defineAuthGuard.d.ts.map +1 -0
- package/dist/auth/boot/defineAuthGuard.js +72 -0
- package/dist/auth/enums/AuthStatusEnum.d.ts +13 -0
- package/dist/auth/enums/AuthStatusEnum.d.ts.map +1 -0
- package/dist/auth/enums/AuthStatusEnum.js +13 -0
- package/dist/auth/index.d.ts +13 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/services/AuthGuard.d.ts +58 -0
- package/dist/auth/services/AuthGuard.d.ts.map +1 -0
- package/dist/auth/services/AuthGuard.js +51 -0
- package/dist/auth/services/AuthService.d.ts +52 -0
- package/dist/auth/services/AuthService.d.ts.map +1 -0
- package/dist/auth/services/AuthService.js +67 -0
- package/dist/auth/services/PasswordResetService.d.ts +34 -0
- package/dist/auth/services/PasswordResetService.d.ts.map +1 -0
- package/dist/auth/services/PasswordResetService.js +45 -0
- package/dist/auth/services/TwoFactorChallengeService.d.ts +22 -0
- package/dist/auth/services/TwoFactorChallengeService.d.ts.map +1 -0
- package/dist/auth/services/TwoFactorChallengeService.js +29 -0
- package/dist/auth/services/TwoFactorService.d.ts +64 -0
- package/dist/auth/services/TwoFactorService.d.ts.map +1 -0
- package/dist/auth/services/TwoFactorService.js +68 -0
- package/dist/auth/services/index.d.ts +8 -0
- package/dist/auth/services/index.d.ts.map +1 -0
- package/dist/auth/services/index.js +5 -0
- package/dist/auth/types/auth-meta.d.ts +54 -0
- package/dist/auth/types/auth-meta.d.ts.map +1 -0
- package/dist/auth/types/auth-meta.js +6 -0
- package/dist/auth/types/index.d.ts +5 -0
- package/dist/auth/types/index.d.ts.map +1 -0
- package/dist/auth/types/index.js +4 -0
- package/dist/auth/utils/auth-meta.d.ts +75 -0
- package/dist/auth/utils/auth-meta.d.ts.map +1 -0
- package/dist/auth/utils/auth-meta.js +93 -0
- package/dist/boot/quvel.d.ts +26 -0
- package/dist/boot/quvel.d.ts.map +1 -0
- package/dist/boot/quvel.js +38 -0
- package/dist/build/index.d.ts +9 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +8 -0
- package/dist/build/loadEnv.d.ts +14 -0
- package/dist/build/loadEnv.d.ts.map +1 -0
- package/dist/build/loadEnv.js +33 -0
- package/dist/build/quasarConfig.d.ts +67 -0
- package/dist/build/quasarConfig.d.ts.map +1 -0
- package/dist/build/quasarConfig.js +126 -0
- package/dist/components/Common/TaskErrors.vue +47 -0
- package/dist/components/Inputs/BaseInput.vue +88 -0
- package/dist/components/Misc/ClientOnly.vue +22 -0
- package/dist/components/Transitions/FadeInOut.vue +9 -0
- package/dist/components/Transitions/SlowExpand.vue +13 -0
- package/dist/components/WebSocketChannelManager.vue +634 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +16 -0
- package/dist/composables/index.d.ts +19 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/index.js +16 -0
- package/dist/composables/useClient.d.ts +16 -0
- package/dist/composables/useClient.d.ts.map +1 -0
- package/dist/composables/useClient.js +28 -0
- package/dist/composables/useMetaConfig.d.ts +14 -0
- package/dist/composables/useMetaConfig.d.ts.map +1 -0
- package/dist/composables/useMetaConfig.js +77 -0
- package/dist/composables/useQueryMessageHandler.d.ts +44 -0
- package/dist/composables/useQueryMessageHandler.d.ts.map +1 -0
- package/dist/composables/useQueryMessageHandler.js +74 -0
- package/dist/composables/useQuvel.d.ts +15 -0
- package/dist/composables/useQuvel.d.ts.map +1 -0
- package/dist/composables/useQuvel.js +38 -0
- package/dist/composables/useRecaptcha.d.ts +35 -0
- package/dist/composables/useRecaptcha.d.ts.map +1 -0
- package/dist/composables/useRecaptcha.js +87 -0
- package/dist/composables/useScopedService.d.ts +18 -0
- package/dist/composables/useScopedService.d.ts.map +1 -0
- package/dist/composables/useScopedService.js +25 -0
- package/dist/composables/useScript.d.ts +25 -0
- package/dist/composables/useScript.d.ts.map +1 -0
- package/dist/composables/useScript.js +106 -0
- package/dist/composables/useUrlQueryHandler.d.ts +38 -0
- package/dist/composables/useUrlQueryHandler.d.ts.map +1 -0
- package/dist/composables/useUrlQueryHandler.js +76 -0
- package/dist/composables/useWebSockets.d.ts +18 -0
- package/dist/composables/useWebSockets.d.ts.map +1 -0
- package/dist/composables/useWebSockets.js +55 -0
- package/dist/composables/useWindowEvent.d.ts +16 -0
- package/dist/composables/useWindowEvent.d.ts.map +1 -0
- package/dist/composables/useWindowEvent.js +27 -0
- package/dist/composables/useXsrf.d.ts +29 -0
- package/dist/composables/useXsrf.d.ts.map +1 -0
- package/dist/composables/useXsrf.js +59 -0
- package/dist/config/QuasarConfigBuilder.d.ts +100 -0
- package/dist/config/QuasarConfigBuilder.d.ts.map +1 -0
- package/dist/config/QuasarConfigBuilder.js +98 -0
- package/dist/config/i18n.d.ts +23 -0
- package/dist/config/i18n.d.ts.map +1 -0
- package/dist/config/i18n.js +43 -0
- package/dist/config/index.d.ts +8 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +7 -0
- package/dist/config/moduleTransformer.d.ts +18 -0
- package/dist/config/moduleTransformer.d.ts.map +1 -0
- package/dist/config/moduleTransformer.js +76 -0
- package/dist/config/quvel.d.ts +40 -0
- package/dist/config/quvel.d.ts.map +1 -0
- package/dist/config/quvel.js +59 -0
- package/dist/config/quvel.types.d.ts +59 -0
- package/dist/config/quvel.types.d.ts.map +1 -0
- package/dist/config/quvel.types.js +6 -0
- package/dist/container/ServiceContainer.d.ts +107 -0
- package/dist/container/ServiceContainer.d.ts.map +1 -0
- package/dist/container/ServiceContainer.js +201 -0
- package/dist/container/types/vue.d.ts +9 -0
- package/dist/container/types.d.ts +81 -0
- package/dist/container/types.d.ts.map +1 -0
- package/dist/container/types.js +1 -0
- package/dist/i18n/en-US/common.d.ts +19 -0
- package/dist/i18n/en-US/common.d.ts.map +1 -0
- package/dist/i18n/en-US/common.js +17 -0
- package/dist/i18n/en-US/index.d.ts +21 -0
- package/dist/i18n/en-US/index.d.ts.map +1 -0
- package/dist/i18n/en-US/index.js +4 -0
- package/dist/i18n/es-MX/common.d.ts +19 -0
- package/dist/i18n/es-MX/common.d.ts.map +1 -0
- package/dist/i18n/es-MX/common.js +17 -0
- package/dist/i18n/es-MX/index.d.ts +21 -0
- package/dist/i18n/es-MX/index.d.ts.map +1 -0
- package/dist/i18n/es-MX/index.js +4 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +67 -0
- package/dist/models/User.d.ts +32 -0
- package/dist/models/User.d.ts.map +1 -0
- package/dist/models/User.js +48 -0
- package/dist/module.d.ts +21 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +45 -0
- package/dist/modules/helpers.d.ts +30 -0
- package/dist/modules/helpers.d.ts.map +1 -0
- package/dist/modules/helpers.js +45 -0
- package/dist/modules/index.d.ts +8 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +6 -0
- package/dist/modules/types.d.ts +141 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +7 -0
- package/dist/pages/ErrorNotFound.vue +300 -0
- package/dist/pages/index.d.ts +7 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +6 -0
- package/dist/services/ApiService.d.ts +90 -0
- package/dist/services/ApiService.d.ts.map +1 -0
- package/dist/services/ApiService.js +159 -0
- package/dist/services/I18nService.d.ts +67 -0
- package/dist/services/I18nService.d.ts.map +1 -0
- package/dist/services/I18nService.js +92 -0
- package/dist/services/LogService.d.ts +31 -0
- package/dist/services/LogService.d.ts.map +1 -0
- package/dist/services/LogService.js +49 -0
- package/dist/services/Service.d.ts +10 -0
- package/dist/services/Service.d.ts.map +1 -0
- package/dist/services/Service.js +8 -0
- package/dist/services/TaskService.d.ts +64 -0
- package/dist/services/TaskService.d.ts.map +1 -0
- package/dist/services/TaskService.js +188 -0
- package/dist/services/ThemeService.d.ts +28 -0
- package/dist/services/ThemeService.d.ts.map +1 -0
- package/dist/services/ThemeService.js +77 -0
- package/dist/services/ValidationService.d.ts +55 -0
- package/dist/services/ValidationService.d.ts.map +1 -0
- package/dist/services/ValidationService.js +81 -0
- package/dist/services/WebSocketService.d.ts +59 -0
- package/dist/services/WebSocketService.d.ts.map +1 -0
- package/dist/services/WebSocketService.js +148 -0
- package/dist/services/logger/BaseLogger.d.ts +35 -0
- package/dist/services/logger/BaseLogger.d.ts.map +1 -0
- package/dist/services/logger/BaseLogger.js +66 -0
- package/dist/services/logger/ConsoleLogger.d.ts +21 -0
- package/dist/services/logger/ConsoleLogger.d.ts.map +1 -0
- package/dist/services/logger/ConsoleLogger.js +60 -0
- package/dist/services/logger/NullLogger.d.ts +10 -0
- package/dist/services/logger/NullLogger.d.ts.map +1 -0
- package/dist/services/logger/NullLogger.js +10 -0
- package/dist/stores/plugins/serviceContainer.d.ts +10 -0
- package/dist/stores/plugins/serviceContainer.d.ts.map +1 -0
- package/dist/stores/plugins/serviceContainer.js +14 -0
- package/dist/stores/sessionStore.d.ts +71 -0
- package/dist/stores/sessionStore.d.ts.map +1 -0
- package/dist/stores/sessionStore.js +125 -0
- package/dist/types/app.types.d.ts +202 -0
- package/dist/types/app.types.d.ts.map +1 -0
- package/dist/types/app.types.js +6 -0
- package/dist/types/config.types.d.ts +2 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +1 -0
- package/dist/types/global.d.ts +33 -0
- package/dist/types/i18n.types.d.ts +21 -0
- package/dist/types/i18n.types.d.ts.map +1 -0
- package/dist/types/i18n.types.js +6 -0
- package/dist/types/laravel.types.d.ts +167 -0
- package/dist/types/laravel.types.d.ts.map +1 -0
- package/dist/types/laravel.types.js +6 -0
- package/dist/types/logging.types.d.ts +81 -0
- package/dist/types/logging.types.d.ts.map +1 -0
- package/dist/types/logging.types.js +22 -0
- package/dist/types/pinia.d.ts +24 -0
- package/dist/types/scripts.types.d.ts +31 -0
- package/dist/types/scripts.types.d.ts.map +1 -0
- package/dist/types/scripts.types.js +6 -0
- package/dist/types/ssr.d.ts +11 -0
- package/dist/types/task.types.d.ts +121 -0
- package/dist/types/task.types.d.ts.map +1 -0
- package/dist/types/task.types.js +7 -0
- package/dist/types/theme.types.d.ts +13 -0
- package/dist/types/theme.types.d.ts.map +1 -0
- package/dist/types/theme.types.js +17 -0
- package/dist/types/user.types.d.ts +24 -0
- package/dist/types/user.types.d.ts.map +1 -0
- package/dist/types/user.types.js +1 -0
- package/dist/types/vue-shim.d.ts +11 -0
- package/dist/types/websocket.types.d.ts +62 -0
- package/dist/types/websocket.types.d.ts.map +1 -0
- package/dist/types/websocket.types.js +6 -0
- package/dist/utils/apiInterceptors.d.ts +76 -0
- package/dist/utils/apiInterceptors.d.ts.map +1 -0
- package/dist/utils/apiInterceptors.js +149 -0
- package/dist/utils/assets.d.ts +40 -0
- package/dist/utils/assets.d.ts.map +1 -0
- package/dist/utils/assets.js +340 -0
- package/dist/utils/axios.d.ts +19 -0
- package/dist/utils/axios.d.ts.map +1 -0
- package/dist/utils/axios.js +113 -0
- package/dist/utils/config.d.ts +16 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +48 -0
- package/dist/utils/container.d.ts +12 -0
- package/dist/utils/container.d.ts.map +1 -0
- package/dist/utils/container.js +11 -0
- package/dist/utils/deepMerge.d.ts +28 -0
- package/dist/utils/deepMerge.d.ts.map +1 -0
- package/dist/utils/deepMerge.js +59 -0
- package/dist/utils/envConfig.d.ts +73 -0
- package/dist/utils/envConfig.d.ts.map +1 -0
- package/dist/utils/envConfig.js +161 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +67 -0
- package/dist/utils/headers.d.ts +36 -0
- package/dist/utils/headers.d.ts.map +1 -0
- package/dist/utils/headers.js +54 -0
- package/dist/utils/i18n.d.ts +26 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +56 -0
- package/dist/utils/index.d.ts +14 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/loading.d.ts +29 -0
- package/dist/utils/loading.d.ts.map +1 -0
- package/dist/utils/loading.js +46 -0
- package/dist/utils/logging.d.ts +20 -0
- package/dist/utils/logging.d.ts.map +1 -0
- package/dist/utils/logging.js +54 -0
- package/dist/utils/notify.d.ts +15 -0
- package/dist/utils/notify.d.ts.map +1 -0
- package/dist/utils/notify.js +30 -0
- package/dist/utils/object.d.ts +28 -0
- package/dist/utils/object.d.ts.map +1 -0
- package/dist/utils/object.js +48 -0
- package/dist/utils/pagination.d.ts +60 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +252 -0
- package/dist/utils/paths.d.ts +54 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +48 -0
- package/dist/utils/platform.d.ts +25 -0
- package/dist/utils/platform.d.ts.map +1 -0
- package/dist/utils/platform.js +64 -0
- package/dist/utils/scripts.d.ts +20 -0
- package/dist/utils/scripts.d.ts.map +1 -0
- package/dist/utils/scripts.js +39 -0
- package/global.d.ts +29 -0
- package/package.json +119 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for the URL query handler
|
|
3
|
+
*/
|
|
4
|
+
export interface UrlQueryHandlerOptions<T = Record<string, string>> {
|
|
5
|
+
/** Parameters to extract from the URL query */
|
|
6
|
+
params: string[];
|
|
7
|
+
/** Validation function to check if the extracted parameters meet certain criteria */
|
|
8
|
+
validate?: (params: T) => boolean;
|
|
9
|
+
/** Whether to clean up the URL by removing the extracted parameters (default: true) */
|
|
10
|
+
cleanupUrl?: boolean;
|
|
11
|
+
/** Whether to run the handler only once (default: true) */
|
|
12
|
+
runOnce?: boolean;
|
|
13
|
+
/** Callback function to execute when the parameters are found and validated */
|
|
14
|
+
onMatch?: (params: T) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A composable for handling URL query parameters
|
|
18
|
+
*
|
|
19
|
+
* Provides a generic way to extract, validate, and act on URL query parameters.
|
|
20
|
+
* Useful for handling authentication tokens, password resets, invitation links, etc.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* // Handle password reset token
|
|
25
|
+
* const { params } = useUrlQueryHandler({
|
|
26
|
+
* params: ['token', 'email'],
|
|
27
|
+
* validate: (p) => p.token.length > 10,
|
|
28
|
+
* onMatch: (p) => {
|
|
29
|
+
* console.log('Reset token:', p.token);
|
|
30
|
+
* }
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function useUrlQueryHandler<T = Record<string, string>>(options: UrlQueryHandlerOptions<T>): {
|
|
35
|
+
params: [T] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<T, import("vue").Ref<T, T>, T> : import("vue").Ref<import("vue").UnwrapRef<T>, T | import("vue").UnwrapRef<T>>;
|
|
36
|
+
checkUrlParams: () => boolean;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=useUrlQueryHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUrlQueryHandler.d.ts","sourceRoot":"","sources":["../../src/composables/useUrlQueryHandler.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAChE,+CAA+C;IAC/C,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,qFAAqF;IACrF,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,OAAO,CAAC;IAClC,uFAAuF;IACvF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC,CAAC;;0BASpE,OAAO;EA2DnC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { onMounted, ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* A composable for handling URL query parameters
|
|
4
|
+
*
|
|
5
|
+
* Provides a generic way to extract, validate, and act on URL query parameters.
|
|
6
|
+
* Useful for handling authentication tokens, password resets, invitation links, etc.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* // Handle password reset token
|
|
11
|
+
* const { params } = useUrlQueryHandler({
|
|
12
|
+
* params: ['token', 'email'],
|
|
13
|
+
* validate: (p) => p.token.length > 10,
|
|
14
|
+
* onMatch: (p) => {
|
|
15
|
+
* console.log('Reset token:', p.token);
|
|
16
|
+
* }
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function useUrlQueryHandler(options) {
|
|
21
|
+
const { params, validate = () => true, cleanupUrl = true, runOnce = true, onMatch } = options;
|
|
22
|
+
const hasRun = ref(false);
|
|
23
|
+
const extractedParams = ref({});
|
|
24
|
+
/**
|
|
25
|
+
* Extracts and processes query parameters from the URL
|
|
26
|
+
*/
|
|
27
|
+
function checkUrlParams() {
|
|
28
|
+
if (runOnce && hasRun.value) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
32
|
+
const extractedValues = {};
|
|
33
|
+
// Extract all requested parameters
|
|
34
|
+
let allParamsFound = true;
|
|
35
|
+
for (const param of params) {
|
|
36
|
+
const value = urlParams.get(param);
|
|
37
|
+
if (value) {
|
|
38
|
+
extractedValues[param] = value;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
allParamsFound = false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (!allParamsFound) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
// Validate the extracted parameters
|
|
48
|
+
if (!validate(extractedValues)) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// Store the extracted parameters
|
|
52
|
+
extractedParams.value = extractedValues;
|
|
53
|
+
// Clean up the URL if requested
|
|
54
|
+
if (cleanupUrl && window.history && window.history.replaceState) {
|
|
55
|
+
const newUrl = new URL(window.location.href);
|
|
56
|
+
params.forEach((param) => {
|
|
57
|
+
newUrl.searchParams.delete(param);
|
|
58
|
+
});
|
|
59
|
+
window.history.replaceState({}, document.title, newUrl.pathname + newUrl.search);
|
|
60
|
+
}
|
|
61
|
+
// Execute the callback if provided
|
|
62
|
+
if (onMatch) {
|
|
63
|
+
onMatch(extractedValues);
|
|
64
|
+
}
|
|
65
|
+
hasRun.value = true;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
// Check URL parameters on component mount
|
|
69
|
+
onMounted(() => {
|
|
70
|
+
checkUrlParams();
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
params: extractedParams,
|
|
74
|
+
checkUrlParams,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useWebSockets Composable
|
|
3
|
+
*
|
|
4
|
+
* Composable wrapper for WebSocket operations using the WebSocketService
|
|
5
|
+
*/
|
|
6
|
+
import type { SubscribeOptions, AnyChannel } from '../types/websocket.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Composable for WebSocket operations
|
|
9
|
+
*
|
|
10
|
+
* Provides convenient methods for subscribing to and managing WebSocket channels
|
|
11
|
+
*
|
|
12
|
+
* @returns Object with subscribe and unsubscribe methods
|
|
13
|
+
*/
|
|
14
|
+
export declare function useWebSockets(): {
|
|
15
|
+
subscribe: <T = unknown>(options: SubscribeOptions<T>) => Promise<AnyChannel>;
|
|
16
|
+
unsubscribe: (channel: AnyChannel) => void;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=useWebSockets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWebSockets.d.ts","sourceRoot":"","sources":["../../src/composables/useWebSockets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGhF;;;;;;GAMG;AACH,wBAAgB,aAAa;gBASF,CAAC,qBAAqB,gBAAgB,CAAC,CAAC,CAAC,KAAG,OAAO,CAAC,UAAU,CAAC;2BA2B1D,UAAU,KAAG,IAAI;EAUhD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useWebSockets Composable
|
|
3
|
+
*
|
|
4
|
+
* Composable wrapper for WebSocket operations using the WebSocketService
|
|
5
|
+
*/
|
|
6
|
+
import { useQuvel } from './useQuvel.js';
|
|
7
|
+
/**
|
|
8
|
+
* Composable for WebSocket operations
|
|
9
|
+
*
|
|
10
|
+
* Provides convenient methods for subscribing to and managing WebSocket channels
|
|
11
|
+
*
|
|
12
|
+
* @returns Object with subscribe and unsubscribe methods
|
|
13
|
+
*/
|
|
14
|
+
export function useWebSockets() {
|
|
15
|
+
const { ws } = useQuvel();
|
|
16
|
+
/**
|
|
17
|
+
* Subscribe to a WebSocket channel
|
|
18
|
+
*
|
|
19
|
+
* @param options - Channel subscription options
|
|
20
|
+
* @returns The channel object
|
|
21
|
+
*/
|
|
22
|
+
async function subscribe(options) {
|
|
23
|
+
let channel;
|
|
24
|
+
if (options.type === 'public' || options.type === 'publicNotification') {
|
|
25
|
+
channel = await ws.subscribe(options);
|
|
26
|
+
}
|
|
27
|
+
else if (options.type === 'private' || options.type === 'privateNotification') {
|
|
28
|
+
channel = await ws.subscribe(options);
|
|
29
|
+
}
|
|
30
|
+
else if (options.type === 'presence') {
|
|
31
|
+
channel = await ws.subscribe(options);
|
|
32
|
+
}
|
|
33
|
+
else if (options.type === 'encrypted') {
|
|
34
|
+
channel = await ws.subscribe(options);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
throw new Error(`Unsupported channel type: ${String(options.type)}`);
|
|
38
|
+
}
|
|
39
|
+
return channel;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Unsubscribe from a channel
|
|
43
|
+
*
|
|
44
|
+
* @param channel - The channel to unsubscribe from
|
|
45
|
+
*/
|
|
46
|
+
function unsubscribe(channel) {
|
|
47
|
+
if (channel) {
|
|
48
|
+
channel.unsubscribe();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
subscribe,
|
|
53
|
+
unsubscribe,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useWindowEvent Composable
|
|
3
|
+
*
|
|
4
|
+
* A Vue 3 composable for safely adding and removing window event listeners.
|
|
5
|
+
* Ensures that event listeners are only added on the client-side and are
|
|
6
|
+
* automatically cleaned up when the component is unmounted.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Safely adds a window event listener and cleans it up on unmount
|
|
10
|
+
*
|
|
11
|
+
* @param eventType - The type of event to listen for (e.g., 'scroll', 'resize')
|
|
12
|
+
* @param handler - The function to call when the event is triggered
|
|
13
|
+
* @param options - Optional event listener options
|
|
14
|
+
*/
|
|
15
|
+
export declare function useWindowEvent(eventType: string, handler: () => void, options?: boolean | AddEventListenerOptions): void;
|
|
16
|
+
//# sourceMappingURL=useWindowEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useWindowEvent.d.ts","sourceRoot":"","sources":["../../src/composables/useWindowEvent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,IAAI,EACnB,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAYN"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useWindowEvent Composable
|
|
3
|
+
*
|
|
4
|
+
* A Vue 3 composable for safely adding and removing window event listeners.
|
|
5
|
+
* Ensures that event listeners are only added on the client-side and are
|
|
6
|
+
* automatically cleaned up when the component is unmounted.
|
|
7
|
+
*/
|
|
8
|
+
import { onMounted, onUnmounted } from 'vue';
|
|
9
|
+
/**
|
|
10
|
+
* Safely adds a window event listener and cleans it up on unmount
|
|
11
|
+
*
|
|
12
|
+
* @param eventType - The type of event to listen for (e.g., 'scroll', 'resize')
|
|
13
|
+
* @param handler - The function to call when the event is triggered
|
|
14
|
+
* @param options - Optional event listener options
|
|
15
|
+
*/
|
|
16
|
+
export function useWindowEvent(eventType, handler, options) {
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
if (typeof window !== 'undefined') {
|
|
19
|
+
window.addEventListener(eventType, handler, options);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
onUnmounted(() => {
|
|
23
|
+
if (typeof window !== 'undefined') {
|
|
24
|
+
window.removeEventListener(eventType, handler, options);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for fetchXsrf function
|
|
3
|
+
*/
|
|
4
|
+
export interface FetchXsrfOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Force XSRF token fetch even without an existing session
|
|
7
|
+
*/
|
|
8
|
+
force?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composable that returns a function to fetch XSRF token on demand
|
|
12
|
+
*
|
|
13
|
+
* Use this in auth dialogs to fetch the XSRF token when the dialog opens,
|
|
14
|
+
* not when the component mounts.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // In AuthDialog.vue
|
|
19
|
+
* const { fetchXsrf } = useXsrf();
|
|
20
|
+
*
|
|
21
|
+
* function handleBeforeShow() {
|
|
22
|
+
* fetchXsrf({ force: true }); // Call when dialog opens
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useXsrf(): {
|
|
27
|
+
fetchXsrf: (options?: FetchXsrfOptions) => void;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=useXsrf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useXsrf.d.ts","sourceRoot":"","sources":["../../src/composables/useXsrf.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,IAAI;IAAE,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAAE,CA2C7E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useQuasar } from 'quasar';
|
|
2
|
+
import { useQuvel } from './useQuvel.js';
|
|
3
|
+
/**
|
|
4
|
+
* Default XSRF cookie name
|
|
5
|
+
*/
|
|
6
|
+
const XSRF_COOKIE_NAME = 'XSRF-TOKEN';
|
|
7
|
+
/**
|
|
8
|
+
* Composable that returns a function to fetch XSRF token on demand
|
|
9
|
+
*
|
|
10
|
+
* Use this in auth dialogs to fetch the XSRF token when the dialog opens,
|
|
11
|
+
* not when the component mounts.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* // In AuthDialog.vue
|
|
16
|
+
* const { fetchXsrf } = useXsrf();
|
|
17
|
+
*
|
|
18
|
+
* function handleBeforeShow() {
|
|
19
|
+
* fetchXsrf({ force: true }); // Call when dialog opens
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export function useXsrf() {
|
|
24
|
+
const $q = useQuasar();
|
|
25
|
+
const { config, api } = useQuvel();
|
|
26
|
+
/**
|
|
27
|
+
* Fetch XSRF token if not already set
|
|
28
|
+
*
|
|
29
|
+
* @param options - Configuration options
|
|
30
|
+
* @param options.force - Force token fetch even without session (for login/register flows)
|
|
31
|
+
*/
|
|
32
|
+
function fetchXsrf(options = {}) {
|
|
33
|
+
if (!options.force && !api.hasSession()) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const cookieName = config.session?.xsrf_cookie
|
|
37
|
+
|| (config.tenant?.id ? `tenant_${config.tenant.id}_xsrf` : XSRF_COOKIE_NAME);
|
|
38
|
+
let xsrf = $q.cookies.get(cookieName);
|
|
39
|
+
if (xsrf === null && typeof document !== 'undefined') {
|
|
40
|
+
const cookies = document.cookie.split(';');
|
|
41
|
+
const cookie = cookies.find(c => c.trim().startsWith(`${cookieName}=`));
|
|
42
|
+
if (cookie) {
|
|
43
|
+
xsrf = cookie.split('=')[1] ?? null;
|
|
44
|
+
}
|
|
45
|
+
if (xsrf !== null) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
void api.get('/sanctum/csrf-cookie');
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Silently fail on error
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
fetchXsrf,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quasar Configuration Builder
|
|
3
|
+
*
|
|
4
|
+
* Type-safe builder for constructing Quasar application configurations
|
|
5
|
+
* with support for different build modes (SPA, SSR, PWA, Capacitor, Electron)
|
|
6
|
+
*/
|
|
7
|
+
import type { ConfigureCallback } from '@quasar/app-vite';
|
|
8
|
+
export type QuasarContext = Parameters<ConfigureCallback>[0];
|
|
9
|
+
export type QuasarConfig = ReturnType<ConfigureCallback>;
|
|
10
|
+
/**
|
|
11
|
+
* Configuration callback function
|
|
12
|
+
*/
|
|
13
|
+
export type ConfigCallback = (ctx: QuasarContext) => QuasarConfig | Promise<QuasarConfig>;
|
|
14
|
+
/**
|
|
15
|
+
* Mode-specific configuration map
|
|
16
|
+
*/
|
|
17
|
+
export type ModeConfigMap = Partial<Record<QuasarMode, ConfigCallback>>;
|
|
18
|
+
/**
|
|
19
|
+
* Supported Quasar build modes
|
|
20
|
+
*/
|
|
21
|
+
export type QuasarMode = 'spa' | 'ssr' | 'pwa' | 'capacitor' | 'electron';
|
|
22
|
+
/**
|
|
23
|
+
* Configuration builder options
|
|
24
|
+
*/
|
|
25
|
+
export interface QuasarConfigBuilderOptions {
|
|
26
|
+
/** Common configuration applied to all modes */
|
|
27
|
+
common?: ConfigCallback;
|
|
28
|
+
/** Mode-specific configurations */
|
|
29
|
+
modes?: ModeConfigMap;
|
|
30
|
+
/** Additional config transformers to apply */
|
|
31
|
+
transformers?: ConfigTransformer[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Unwrapped Quasar config object
|
|
35
|
+
*/
|
|
36
|
+
export type QuasarConf = Awaited<QuasarConfig>;
|
|
37
|
+
/**
|
|
38
|
+
* Configuration transformer function
|
|
39
|
+
*/
|
|
40
|
+
export type ConfigTransformer = (config: QuasarConf, ctx: QuasarContext) => QuasarConf | Promise<QuasarConf>;
|
|
41
|
+
/**
|
|
42
|
+
* Quasar Configuration Builder
|
|
43
|
+
*
|
|
44
|
+
* Provides a fluent API for building Quasar configurations with
|
|
45
|
+
* common base config and mode-specific overrides.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const builder = new QuasarConfigBuilder()
|
|
50
|
+
* .setCommon((ctx) => ({
|
|
51
|
+
* boot: ['app'],
|
|
52
|
+
* css: ['app.scss']
|
|
53
|
+
* }))
|
|
54
|
+
* .setMode('ssr', (ctx) => ({
|
|
55
|
+
* ssr: {
|
|
56
|
+
* pwa: false
|
|
57
|
+
* }
|
|
58
|
+
* }))
|
|
59
|
+
* .addTransformer((config, ctx) => {
|
|
60
|
+
* // Custom transformation
|
|
61
|
+
* return config;
|
|
62
|
+
* });
|
|
63
|
+
*
|
|
64
|
+
* export default builder.build();
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare class QuasarConfigBuilder {
|
|
68
|
+
private commonConfig?;
|
|
69
|
+
private modeConfigs;
|
|
70
|
+
private transformers;
|
|
71
|
+
/**
|
|
72
|
+
* Set a common configuration applied to all modes
|
|
73
|
+
*/
|
|
74
|
+
setCommon(config: ConfigCallback): this;
|
|
75
|
+
/**
|
|
76
|
+
* Set mode-specific configuration
|
|
77
|
+
*/
|
|
78
|
+
setMode(mode: QuasarMode, config: ConfigCallback): this;
|
|
79
|
+
/**
|
|
80
|
+
* Set multiple mode configurations at once
|
|
81
|
+
*/
|
|
82
|
+
setModes(modes: ModeConfigMap): this;
|
|
83
|
+
/**
|
|
84
|
+
* Add a configuration transformer
|
|
85
|
+
*
|
|
86
|
+
* Transformers are applied after merging common and mode configs
|
|
87
|
+
*/
|
|
88
|
+
addTransformer(transformer: ConfigTransformer): this;
|
|
89
|
+
/**
|
|
90
|
+
* Add multiple transformers
|
|
91
|
+
*/
|
|
92
|
+
addTransformers(transformers: ConfigTransformer[]): this;
|
|
93
|
+
/**
|
|
94
|
+
* Build the final configuration function
|
|
95
|
+
*
|
|
96
|
+
* Returns a Quasar-compatible configuration function
|
|
97
|
+
*/
|
|
98
|
+
build(): ConfigureCallback;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=QuasarConfigBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuasarConfigBuilder.d.ts","sourceRoot":"","sources":["../../src/config/QuasarConfigBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE1F;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1E;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,gDAAgD;IAChD,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,mCAAmC;IACnC,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,iBAAiB,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAC9B,MAAM,EAAE,UAAU,EAClB,GAAG,EAAE,aAAa,KACf,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,YAAY,CAA2B;IAE/C;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAKvC;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI;IAKvD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAKpC;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,iBAAiB,GAAG,IAAI;IAKpD;;OAEG;IACH,eAAe,CAAC,YAAY,EAAE,iBAAiB,EAAE,GAAG,IAAI;IAKxD;;;;OAIG;IACH,KAAK,IAAI,iBAAiB;CAuB3B"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quasar Configuration Builder
|
|
3
|
+
*
|
|
4
|
+
* Type-safe builder for constructing Quasar application configurations
|
|
5
|
+
* with support for different build modes (SPA, SSR, PWA, Capacitor, Electron)
|
|
6
|
+
*/
|
|
7
|
+
import { deepMerge } from '../utils/deepMerge.js';
|
|
8
|
+
/**
|
|
9
|
+
* Quasar Configuration Builder
|
|
10
|
+
*
|
|
11
|
+
* Provides a fluent API for building Quasar configurations with
|
|
12
|
+
* common base config and mode-specific overrides.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const builder = new QuasarConfigBuilder()
|
|
17
|
+
* .setCommon((ctx) => ({
|
|
18
|
+
* boot: ['app'],
|
|
19
|
+
* css: ['app.scss']
|
|
20
|
+
* }))
|
|
21
|
+
* .setMode('ssr', (ctx) => ({
|
|
22
|
+
* ssr: {
|
|
23
|
+
* pwa: false
|
|
24
|
+
* }
|
|
25
|
+
* }))
|
|
26
|
+
* .addTransformer((config, ctx) => {
|
|
27
|
+
* // Custom transformation
|
|
28
|
+
* return config;
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* export default builder.build();
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class QuasarConfigBuilder {
|
|
35
|
+
commonConfig;
|
|
36
|
+
modeConfigs = {};
|
|
37
|
+
transformers = [];
|
|
38
|
+
/**
|
|
39
|
+
* Set a common configuration applied to all modes
|
|
40
|
+
*/
|
|
41
|
+
setCommon(config) {
|
|
42
|
+
this.commonConfig = config;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Set mode-specific configuration
|
|
47
|
+
*/
|
|
48
|
+
setMode(mode, config) {
|
|
49
|
+
this.modeConfigs[mode] = config;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Set multiple mode configurations at once
|
|
54
|
+
*/
|
|
55
|
+
setModes(modes) {
|
|
56
|
+
Object.assign(this.modeConfigs, modes);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Add a configuration transformer
|
|
61
|
+
*
|
|
62
|
+
* Transformers are applied after merging common and mode configs
|
|
63
|
+
*/
|
|
64
|
+
addTransformer(transformer) {
|
|
65
|
+
this.transformers.push(transformer);
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add multiple transformers
|
|
70
|
+
*/
|
|
71
|
+
addTransformers(transformers) {
|
|
72
|
+
this.transformers.push(...transformers);
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Build the final configuration function
|
|
77
|
+
*
|
|
78
|
+
* Returns a Quasar-compatible configuration function
|
|
79
|
+
*/
|
|
80
|
+
build() {
|
|
81
|
+
return async (ctx) => {
|
|
82
|
+
let config = {};
|
|
83
|
+
if (this.commonConfig) {
|
|
84
|
+
const commonResult = await this.commonConfig(ctx);
|
|
85
|
+
config = deepMerge(config, commonResult);
|
|
86
|
+
}
|
|
87
|
+
const modeConfig = this.modeConfigs[ctx.modeName];
|
|
88
|
+
if (modeConfig) {
|
|
89
|
+
const modeResult = await modeConfig(ctx);
|
|
90
|
+
config = deepMerge(config, modeResult);
|
|
91
|
+
}
|
|
92
|
+
for (const transformer of this.transformers) {
|
|
93
|
+
config = await transformer(config, ctx);
|
|
94
|
+
}
|
|
95
|
+
return config;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* I18n Configuration Helpers
|
|
3
|
+
*
|
|
4
|
+
* Centralized i18n configuration that reads from AppConfig
|
|
5
|
+
*/
|
|
6
|
+
import type { AppConfig } from '../types/app.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Get supported locales
|
|
9
|
+
*/
|
|
10
|
+
export declare function getSupportedLocales(_config?: AppConfig): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Get the default locale from config or use default
|
|
13
|
+
*/
|
|
14
|
+
export declare function getDefaultLocale(config?: AppConfig): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the locale cookie key
|
|
17
|
+
*/
|
|
18
|
+
export declare function getLocaleCookieKey(config?: AppConfig): string;
|
|
19
|
+
/**
|
|
20
|
+
* Validate if a locale is supported
|
|
21
|
+
*/
|
|
22
|
+
export declare function isValidLocale(locale: string, config?: AppConfig): boolean;
|
|
23
|
+
//# sourceMappingURL=i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/config/i18n.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,EAAE,CAWjE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAK3D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAK7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAGzE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* I18n Configuration Helpers
|
|
3
|
+
*
|
|
4
|
+
* Centralized i18n configuration that reads from AppConfig
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get supported locales
|
|
8
|
+
*/
|
|
9
|
+
export function getSupportedLocales(_config) {
|
|
10
|
+
const env = (typeof import.meta !== 'undefined' && import.meta.env)
|
|
11
|
+
? import.meta.env
|
|
12
|
+
: (typeof process !== 'undefined' ? process.env : {});
|
|
13
|
+
const locales = env.VITE_ALLOWED_LOCALES;
|
|
14
|
+
if (locales && typeof locales === 'string') {
|
|
15
|
+
return locales.split(',').map((l) => l.trim()).filter(Boolean);
|
|
16
|
+
}
|
|
17
|
+
return ['en-US', 'es-MX'];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the default locale from config or use default
|
|
21
|
+
*/
|
|
22
|
+
export function getDefaultLocale(config) {
|
|
23
|
+
const env = (typeof import.meta !== 'undefined' && import.meta.env)
|
|
24
|
+
? import.meta.env
|
|
25
|
+
: (typeof process !== 'undefined' ? process.env : {});
|
|
26
|
+
return config?.app?.locale || config?.app?.fallback_locale || env.VITE_LOCALE || 'en-US';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the locale cookie key
|
|
30
|
+
*/
|
|
31
|
+
export function getLocaleCookieKey(config) {
|
|
32
|
+
const env = (typeof import.meta !== 'undefined' && import.meta.env)
|
|
33
|
+
? import.meta.env
|
|
34
|
+
: (typeof process !== 'undefined' ? process.env : {});
|
|
35
|
+
return config?.i18nCookie || env.VITE_I18N_COOKIE || 'user-locale';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validate if a locale is supported
|
|
39
|
+
*/
|
|
40
|
+
export function isValidLocale(locale, config) {
|
|
41
|
+
const supported = getSupportedLocales(config);
|
|
42
|
+
return supported.includes(locale);
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Exports configuration builders and utilities for Quasar applications
|
|
5
|
+
*/
|
|
6
|
+
export { QuasarConfigBuilder, type ConfigCallback, type ModeConfigMap, type QuasarMode, type QuasarConfigBuilderOptions, type ConfigTransformer, type QuasarConfig, type QuasarConf, } from './QuasarConfigBuilder.js';
|
|
7
|
+
export { getSupportedLocales, getDefaultLocale, getLocaleCookieKey } from './i18n.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,0BAA0B,EAC/B,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,UAAU,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConfigTransformer } from './QuasarConfigBuilder.js';
|
|
2
|
+
import type { Module } from '../modules/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a config transformer that applies all module build configs
|
|
5
|
+
*
|
|
6
|
+
* This utility is for build-time only and should be imported in quasar.config.ts
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { createModuleTransformer } from '@quvel-kit/core/config/moduleTransformer';
|
|
11
|
+
*
|
|
12
|
+
* new QuasarConfigBuilder()
|
|
13
|
+
* .addTransformer(createModuleTransformer(modules))
|
|
14
|
+
* .build();
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function createModuleTransformer(modules: Module[]): ConfigTransformer;
|
|
18
|
+
//# sourceMappingURL=moduleTransformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleTransformer.d.ts","sourceRoot":"","sources":["../../src/config/moduleTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,0BAA0B,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAoC,MAAM,qBAAqB,CAAC;AA+CpF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,iBAAiB,CA+B5E"}
|