@mouseless/baked 0.19.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 +11 -0
- package/dist/module.d.mts +45 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +110 -0
- package/dist/runtime/assets/overrides.css +1 -0
- package/dist/runtime/assets/tailwind.css +1 -0
- package/dist/runtime/components/AuthorizedContent.d.vue.ts +10 -0
- package/dist/runtime/components/AuthorizedContent.vue +14 -0
- package/dist/runtime/components/AuthorizedContent.vue.d.ts +10 -0
- package/dist/runtime/components/Bake.d.vue.ts +20 -0
- package/dist/runtime/components/Bake.vue +50 -0
- package/dist/runtime/components/Bake.vue.d.ts +20 -0
- package/dist/runtime/components/BasePersistentPopover.d.vue.ts +178 -0
- package/dist/runtime/components/BasePersistentPopover.vue +41 -0
- package/dist/runtime/components/BasePersistentPopover.vue.d.ts +178 -0
- package/dist/runtime/components/CardLink.d.vue.ts +11 -0
- package/dist/runtime/components/CardLink.vue +57 -0
- package/dist/runtime/components/CardLink.vue.d.ts +11 -0
- package/dist/runtime/components/DataPanel.d.vue.ts +20 -0
- package/dist/runtime/components/DataPanel.vue +138 -0
- package/dist/runtime/components/DataPanel.vue.d.ts +20 -0
- package/dist/runtime/components/DataTable.d.vue.ts +11 -0
- package/dist/runtime/components/DataTable.vue +213 -0
- package/dist/runtime/components/DataTable.vue.d.ts +11 -0
- package/dist/runtime/components/DefaultLayout.d.vue.ts +18 -0
- package/dist/runtime/components/DefaultLayout.vue +44 -0
- package/dist/runtime/components/DefaultLayout.vue.d.ts +18 -0
- package/dist/runtime/components/DeferredTabContent.d.vue.ts +16 -0
- package/dist/runtime/components/DeferredTabContent.vue +23 -0
- package/dist/runtime/components/DeferredTabContent.vue.d.ts +16 -0
- package/dist/runtime/components/Error.d.vue.ts +3 -0
- package/dist/runtime/components/Error.vue +13 -0
- package/dist/runtime/components/Error.vue.d.ts +3 -0
- package/dist/runtime/components/ErrorPage.d.vue.ts +11 -0
- package/dist/runtime/components/ErrorPage.vue +65 -0
- package/dist/runtime/components/ErrorPage.vue.d.ts +11 -0
- package/dist/runtime/components/Filter.d.vue.ts +11 -0
- package/dist/runtime/components/Filter.vue +23 -0
- package/dist/runtime/components/Filter.vue.d.ts +11 -0
- package/dist/runtime/components/Header.d.vue.ts +11 -0
- package/dist/runtime/components/Header.vue +78 -0
- package/dist/runtime/components/Header.vue.d.ts +11 -0
- package/dist/runtime/components/Icon.d.vue.ts +11 -0
- package/dist/runtime/components/Icon.vue +14 -0
- package/dist/runtime/components/Icon.vue.d.ts +11 -0
- package/dist/runtime/components/LanguageSwitcher.d.vue.ts +11 -0
- package/dist/runtime/components/LanguageSwitcher.vue +57 -0
- package/dist/runtime/components/LanguageSwitcher.vue.d.ts +11 -0
- package/dist/runtime/components/Layout.d.vue.ts +10 -0
- package/dist/runtime/components/Layout.vue +38 -0
- package/dist/runtime/components/Layout.vue.d.ts +10 -0
- package/dist/runtime/components/Logo.d.vue.ts +9 -0
- package/dist/runtime/components/Logo.vue +18 -0
- package/dist/runtime/components/Logo.vue.d.ts +9 -0
- package/dist/runtime/components/MenuPage.d.vue.ts +11 -0
- package/dist/runtime/components/MenuPage.vue +93 -0
- package/dist/runtime/components/MenuPage.vue.d.ts +11 -0
- package/dist/runtime/components/Message.d.vue.ts +11 -0
- package/dist/runtime/components/Message.vue +33 -0
- package/dist/runtime/components/Message.vue.d.ts +11 -0
- package/dist/runtime/components/ModalLayout.d.vue.ts +18 -0
- package/dist/runtime/components/ModalLayout.vue +14 -0
- package/dist/runtime/components/ModalLayout.vue.d.ts +18 -0
- package/dist/runtime/components/Money.d.vue.ts +11 -0
- package/dist/runtime/components/Money.vue +27 -0
- package/dist/runtime/components/Money.vue.d.ts +11 -0
- package/dist/runtime/components/NavLink.d.vue.ts +11 -0
- package/dist/runtime/components/NavLink.vue +30 -0
- package/dist/runtime/components/NavLink.vue.d.ts +11 -0
- package/dist/runtime/components/None.d.vue.ts +11 -0
- package/dist/runtime/components/None.vue +25 -0
- package/dist/runtime/components/None.vue.d.ts +11 -0
- package/dist/runtime/components/Number.d.vue.ts +11 -0
- package/dist/runtime/components/Number.vue +27 -0
- package/dist/runtime/components/Number.vue.d.ts +11 -0
- package/dist/runtime/components/Page.d.vue.ts +3 -0
- package/dist/runtime/components/Page.vue +24 -0
- package/dist/runtime/components/Page.vue.d.ts +3 -0
- package/dist/runtime/components/PageTitle.d.vue.ts +22 -0
- package/dist/runtime/components/PageTitle.vue +171 -0
- package/dist/runtime/components/PageTitle.vue.d.ts +22 -0
- package/dist/runtime/components/Parameters.d.vue.ts +11 -0
- package/dist/runtime/components/Parameters.vue +60 -0
- package/dist/runtime/components/Parameters.vue.d.ts +11 -0
- package/dist/runtime/components/PersistentPopover.d.vue.ts +46 -0
- package/dist/runtime/components/PersistentPopover.vue +335 -0
- package/dist/runtime/components/PersistentPopover.vue.d.ts +46 -0
- package/dist/runtime/components/QueryParameters.d.vue.ts +11 -0
- package/dist/runtime/components/QueryParameters.vue +103 -0
- package/dist/runtime/components/QueryParameters.vue.d.ts +11 -0
- package/dist/runtime/components/Rate.d.vue.ts +11 -0
- package/dist/runtime/components/Rate.vue +22 -0
- package/dist/runtime/components/Rate.vue.d.ts +11 -0
- package/dist/runtime/components/ReportPage.d.vue.ts +11 -0
- package/dist/runtime/components/ReportPage.vue +147 -0
- package/dist/runtime/components/ReportPage.vue.d.ts +11 -0
- package/dist/runtime/components/Select.d.vue.ts +11 -0
- package/dist/runtime/components/Select.vue +120 -0
- package/dist/runtime/components/Select.vue.d.ts +11 -0
- package/dist/runtime/components/SelectButton.d.vue.ts +11 -0
- package/dist/runtime/components/SelectButton.vue +94 -0
- package/dist/runtime/components/SelectButton.vue.d.ts +11 -0
- package/dist/runtime/components/SideMenu.d.vue.ts +20 -0
- package/dist/runtime/components/SideMenu.vue +121 -0
- package/dist/runtime/components/SideMenu.vue.d.ts +20 -0
- package/dist/runtime/components/SideMenuItem.d.vue.ts +11 -0
- package/dist/runtime/components/SideMenuItem.vue +33 -0
- package/dist/runtime/components/SideMenuItem.vue.d.ts +11 -0
- package/dist/runtime/components/Text.d.vue.ts +11 -0
- package/dist/runtime/components/Text.vue +36 -0
- package/dist/runtime/components/Text.vue.d.ts +11 -0
- package/dist/runtime/composables/useBreakpoints.d.ts +1 -0
- package/dist/runtime/composables/useBreakpoints.js +48 -0
- package/dist/runtime/composables/useCache.d.ts +13 -0
- package/dist/runtime/composables/useCache.js +60 -0
- package/dist/runtime/composables/useComponentResolver.d.ts +3 -0
- package/dist/runtime/composables/useComponentResolver.js +13 -0
- package/dist/runtime/composables/useComposableResolver.d.ts +3 -0
- package/dist/runtime/composables/useComposableResolver.js +15 -0
- package/dist/runtime/composables/useConditional.d.ts +3 -0
- package/dist/runtime/composables/useConditional.js +15 -0
- package/dist/runtime/composables/useContext.d.ts +15 -0
- package/dist/runtime/composables/useContext.js +60 -0
- package/dist/runtime/composables/useDataFetcher.d.ts +15 -0
- package/dist/runtime/composables/useDataFetcher.js +203 -0
- package/dist/runtime/composables/useFormat.d.ts +16 -0
- package/dist/runtime/composables/useFormat.js +116 -0
- package/dist/runtime/composables/useLayouts.d.ts +3 -0
- package/dist/runtime/composables/useLayouts.js +21 -0
- package/dist/runtime/composables/useLocalization.d.ts +6 -0
- package/dist/runtime/composables/useLocalization.js +34 -0
- package/dist/runtime/composables/useLoginRedirect.d.ts +3 -0
- package/dist/runtime/composables/useLoginRedirect.js +15 -0
- package/dist/runtime/composables/useMutex.d.ts +3 -0
- package/dist/runtime/composables/useMutex.js +26 -0
- package/dist/runtime/composables/useNuxtError.d.ts +3 -0
- package/dist/runtime/composables/useNuxtError.js +13 -0
- package/dist/runtime/composables/useNuxtRoute.d.ts +3 -0
- package/dist/runtime/composables/useNuxtRoute.js +13 -0
- package/dist/runtime/composables/usePages.d.ts +5 -0
- package/dist/runtime/composables/usePages.js +27 -0
- package/dist/runtime/composables/useQuery.d.ts +3 -0
- package/dist/runtime/composables/useQuery.js +13 -0
- package/dist/runtime/composables/useToast.d.ts +1 -0
- package/dist/runtime/composables/useToast.js +5 -0
- package/dist/runtime/composables/useToken.d.ts +11 -0
- package/dist/runtime/composables/useToken.js +99 -0
- package/dist/runtime/composables/useUiStates.d.ts +9 -0
- package/dist/runtime/composables/useUiStates.js +9 -0
- package/dist/runtime/composables/useUnref.d.ts +3 -0
- package/dist/runtime/composables/useUnref.js +109 -0
- package/dist/runtime/plugins/auth.d.ts +2 -0
- package/dist/runtime/plugins/auth.js +81 -0
- package/dist/runtime/plugins/baked.d.ts +10 -0
- package/dist/runtime/plugins/baked.js +50 -0
- package/dist/runtime/plugins/cacheApplication.d.ts +2 -0
- package/dist/runtime/plugins/cacheApplication.js +27 -0
- package/dist/runtime/plugins/cacheUser.d.ts +2 -0
- package/dist/runtime/plugins/cacheUser.js +37 -0
- package/dist/runtime/plugins/errorHandling.d.ts +14 -0
- package/dist/runtime/plugins/errorHandling.js +96 -0
- package/dist/runtime/plugins/fetch.d.ts +2 -0
- package/dist/runtime/plugins/fetch.js +80 -0
- package/dist/runtime/plugins/localization.d.ts +2 -0
- package/dist/runtime/plugins/localization.js +18 -0
- package/dist/runtime/plugins/mutex.d.ts +7 -0
- package/dist/runtime/plugins/mutex.js +15 -0
- package/dist/runtime/plugins/primeVue.d.ts +2 -0
- package/dist/runtime/plugins/primeVue.js +75 -0
- package/dist/runtime/plugins/toast.d.ts +6 -0
- package/dist/runtime/plugins/toast.js +18 -0
- package/dist/runtime/plugins/trailingSlash.d.ts +2 -0
- package/dist/runtime/plugins/trailingSlash.js +18 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/types.d.mts +3 -0
- package/package.json +74 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import { useCache, useToken } from "#imports";
|
|
3
|
+
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "cache-user",
|
|
6
|
+
enforce: "pre",
|
|
7
|
+
setup(nuxtApp) {
|
|
8
|
+
const { public: { cacheUser } } = useRuntimeConfig();
|
|
9
|
+
const { expirationInMinutes } = cacheUser;
|
|
10
|
+
const cache = useCache("cache:user", { expirationInMinutes });
|
|
11
|
+
const { $fetchInterceptors } = nuxtApp;
|
|
12
|
+
|
|
13
|
+
$fetchInterceptors.register(
|
|
14
|
+
"cache-user",
|
|
15
|
+
async({ request, options }, next) => {
|
|
16
|
+
if(options.attributes["client-cache"] !== "user") {
|
|
17
|
+
return await next();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const key = cache.buildKey({ path: request, query: options.query });
|
|
21
|
+
return await cache.getOrCreate({ key, create: next });
|
|
22
|
+
},
|
|
23
|
+
// should run before other interceptors
|
|
24
|
+
-10
|
|
25
|
+
);
|
|
26
|
+
},
|
|
27
|
+
hooks: {
|
|
28
|
+
"app:mounted"() {
|
|
29
|
+
const cache = useCache("cache:user");
|
|
30
|
+
const token = useToken();
|
|
31
|
+
|
|
32
|
+
token.onChanged(() => {
|
|
33
|
+
cache.clear();
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const _default: import("#app").Plugin<{
|
|
2
|
+
errorHandlers: any;
|
|
3
|
+
defaultAlert: {
|
|
4
|
+
title: any;
|
|
5
|
+
message: any;
|
|
6
|
+
};
|
|
7
|
+
}> & import("#app").ObjectPlugin<{
|
|
8
|
+
errorHandlers: any;
|
|
9
|
+
defaultAlert: {
|
|
10
|
+
title: any;
|
|
11
|
+
message: any;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { defineNuxtPlugin, clearError, showError, useNuxtApp, useRuntimeConfig } from "#app";
|
|
2
|
+
import { useDataFetcher, useLocalization, useToast } from "#imports";
|
|
3
|
+
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "errorHandling",
|
|
6
|
+
enforce: "pre",
|
|
7
|
+
async setup() {
|
|
8
|
+
const { public: { errorHandling } } = useRuntimeConfig();
|
|
9
|
+
|
|
10
|
+
const errorHandlers = errorHandling.handlers;
|
|
11
|
+
errorHandlers.sort((a,b) => a.order - b.order);
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
provide: {
|
|
15
|
+
errorHandlers,
|
|
16
|
+
defaultAlert: {
|
|
17
|
+
title: errorHandling.defaultAlertTitle,
|
|
18
|
+
message: errorHandling.defaultAlertMessage
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
hooks: {
|
|
24
|
+
"vue:error": async error => {
|
|
25
|
+
const dataFetcher = useDataFetcher();
|
|
26
|
+
const { $errorHandlers, $router } = useNuxtApp();
|
|
27
|
+
const toast = useToast();
|
|
28
|
+
|
|
29
|
+
const handler = getHandler($errorHandlers, $router.currentRoute.value.fullPath, error);
|
|
30
|
+
if(!handler) {
|
|
31
|
+
showError(error);
|
|
32
|
+
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
switch (handler.behavior) {
|
|
37
|
+
case "Alert":
|
|
38
|
+
await clearError(error);
|
|
39
|
+
toast.add(getMessage(error));
|
|
40
|
+
break;
|
|
41
|
+
|
|
42
|
+
case "Redirect":
|
|
43
|
+
await clearError(error);
|
|
44
|
+
toast.add(getMessage(error));
|
|
45
|
+
const redirectPath = await dataFetcher.fetch({ data: handler.behaviorArgument });
|
|
46
|
+
$router.replace(redirectPath);
|
|
47
|
+
break;
|
|
48
|
+
|
|
49
|
+
default:
|
|
50
|
+
if(error.name === "TypeError") {
|
|
51
|
+
error.statusCode = 999;
|
|
52
|
+
}
|
|
53
|
+
showError(error);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// handlers
|
|
60
|
+
function getHandler(handlers, route, error) {
|
|
61
|
+
if(!handlers) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for(const option of Object.values(handlers)) {
|
|
66
|
+
if(
|
|
67
|
+
(!option.statusCode || error.statusCode === option.statusCode) &&
|
|
68
|
+
(!option.routePattern || route.match(`/${option.routePattern}/`).length > 0)
|
|
69
|
+
) {
|
|
70
|
+
return option;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function getMessage(error) {
|
|
78
|
+
const { $defaultAlert } = useNuxtApp();
|
|
79
|
+
const { localize: l } = useLocalization();
|
|
80
|
+
|
|
81
|
+
if(error.name === "FetchError") {
|
|
82
|
+
return {
|
|
83
|
+
severity: "error",
|
|
84
|
+
summary: error.data?.title ?? error.statusCode ?? l($defaultAlert.title),
|
|
85
|
+
detail: error.data?.detail ?? error.message ?? error.cause ?? l($defaultAlert.message),
|
|
86
|
+
life: 3000
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
severity: "error",
|
|
92
|
+
summary: error.statusCode ?? error.status ?? l($defaultAlert.title),
|
|
93
|
+
detail: error.message ?? error.cause ?? l($defaultAlert.message),
|
|
94
|
+
life: 3000
|
|
95
|
+
};
|
|
96
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
|
+
import { ofetch } from "ofetch";
|
|
3
|
+
|
|
4
|
+
export default defineNuxtPlugin({
|
|
5
|
+
name: "fetch-manager",
|
|
6
|
+
enforce: "pre",
|
|
7
|
+
setup(nuxtApp) {
|
|
8
|
+
const fetch = ofetch.create();
|
|
9
|
+
const interceptors = Interceptors();
|
|
10
|
+
const optionsTemplate = { headers: { }, query: { }, attributes: { } };
|
|
11
|
+
|
|
12
|
+
// register the actual fetch at the end of the interceptor pipeline
|
|
13
|
+
interceptors.register("actual-fetch",
|
|
14
|
+
async({ request, options }) => await fetch(request, options),
|
|
15
|
+
Number.MAX_SAFE_INTEGER
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// wrap $fetch using interceptors to allow around interception
|
|
19
|
+
globalThis.$fetch = async(request, options) => {
|
|
20
|
+
// not all requests have headers, query, attributes objects. this might
|
|
21
|
+
// cause interceptors to fail. options template makes sure every
|
|
22
|
+
// request has those objects to be set to an empty object.
|
|
23
|
+
return await interceptors.execute({ request, options: { ...optionsTemplate, ...options } });
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// Add to nuxtApp for access from plugins
|
|
27
|
+
nuxtApp.provide("fetchInterceptors", interceptors);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function Interceptors() {
|
|
32
|
+
const { public: { composables } } = useRuntimeConfig();
|
|
33
|
+
const interceptorMap = new Map();
|
|
34
|
+
|
|
35
|
+
let interceptors = null;
|
|
36
|
+
let sorted = false;
|
|
37
|
+
|
|
38
|
+
function register(name, execute,
|
|
39
|
+
priority = 0
|
|
40
|
+
) {
|
|
41
|
+
interceptorMap.set(name, { execute, priority });
|
|
42
|
+
sorted = false;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function ensureSorted() {
|
|
46
|
+
if(sorted && interceptors) { return; }
|
|
47
|
+
|
|
48
|
+
interceptors = Array.from(interceptorMap.entries())
|
|
49
|
+
.sort(([, a], [, b]) => a.priority - b.priority)
|
|
50
|
+
.map(([, interceptor]) => interceptor);
|
|
51
|
+
sorted = true;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function execute(context) {
|
|
55
|
+
ensureSorted();
|
|
56
|
+
|
|
57
|
+
// doesn't intercept `/_nuxt` calls and any other non api calls
|
|
58
|
+
if(context.options.baseURL !== composables.useDataFetcher.baseURL) {
|
|
59
|
+
// directly executes last interceptor which is the actual fetch
|
|
60
|
+
return await executeInner(context, interceptors.length - 1);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return await executeInner(context, 0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function executeInner(context, index) {
|
|
67
|
+
if(index >= interceptors.length) { return; }
|
|
68
|
+
|
|
69
|
+
const interceptor = interceptors[index];
|
|
70
|
+
|
|
71
|
+
return await interceptor.execute(context, async() => {
|
|
72
|
+
return await executeInner(context, index + 1);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
register,
|
|
78
|
+
execute
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "#app";
|
|
2
|
+
|
|
3
|
+
export default defineNuxtPlugin({
|
|
4
|
+
name: "localization",
|
|
5
|
+
enforce: "pre",
|
|
6
|
+
setup(nuxtApp) {
|
|
7
|
+
const { $fetchInterceptors } = nuxtApp;
|
|
8
|
+
|
|
9
|
+
$fetchInterceptors.register(
|
|
10
|
+
"localization",
|
|
11
|
+
async({ options }, next) => {
|
|
12
|
+
options.headers["Accept-Language"] = nuxtApp.$i18n.locale.value;
|
|
13
|
+
|
|
14
|
+
return await next();
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import PrimeVue, { usePrimeVue } from "primevue/config";
|
|
2
|
+
import FocusTrap from "primevue/focustrap";
|
|
3
|
+
import Tooltip from "primevue/tooltip";
|
|
4
|
+
import { defineNuxtPlugin, useNuxtApp, useRouter, useRuntimeConfig } from "#app";
|
|
5
|
+
import { ref } from "vue";
|
|
6
|
+
|
|
7
|
+
export default defineNuxtPlugin({
|
|
8
|
+
name: "primeVue",
|
|
9
|
+
setup(nuxtApp) {
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
const { public: { primevue: { theme, locale } } } = useRuntimeConfig();
|
|
12
|
+
const shouldLoadLocale = ref(true);
|
|
13
|
+
|
|
14
|
+
const options = {
|
|
15
|
+
theme: {
|
|
16
|
+
preset: theme,
|
|
17
|
+
options: {
|
|
18
|
+
cssLayer: {
|
|
19
|
+
name: "primevue",
|
|
20
|
+
order: "tailwind-base, primevue, tailwind-utilities"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if(locale) { options.locale = locale; }
|
|
27
|
+
|
|
28
|
+
nuxtApp.vueApp.use(PrimeVue, options);
|
|
29
|
+
nuxtApp.vueApp.directive("focustrap", FocusTrap);
|
|
30
|
+
nuxtApp.vueApp.directive("tooltip", Tooltip);
|
|
31
|
+
|
|
32
|
+
router.beforeEach(() => {
|
|
33
|
+
if(!shouldLoadLocale.value) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if(!nuxtApp.$i18n) {
|
|
38
|
+
shouldLoadLocale.value = false;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
loadPrimeVueMessages();
|
|
43
|
+
shouldLoadLocale.value = false;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function loadPrimeVueMessages() {
|
|
49
|
+
const { $i18n } = useNuxtApp();
|
|
50
|
+
const primevue = usePrimeVue();
|
|
51
|
+
|
|
52
|
+
const raw = $i18n.tm("primevue");
|
|
53
|
+
const primevueMessages = {};
|
|
54
|
+
|
|
55
|
+
for(const key in raw) {
|
|
56
|
+
primevueMessages[key] = extractText(raw[key]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
primevue.config.locale = { ...primevue.config.locale, ...primevueMessages };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function extractText(val) {
|
|
63
|
+
if(typeof val === "string") { return val; }
|
|
64
|
+
|
|
65
|
+
if(Array.isArray(val)) {
|
|
66
|
+
return [...val.map(extractText)];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if(typeof val === "object") {
|
|
70
|
+
// 'val.b?.s' is for playwright
|
|
71
|
+
return val.loc?.source || val.b?.s || val.value || extractText(val.body || "") || "";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "#app";
|
|
2
|
+
import { useToast } from "primevue/usetoast";
|
|
3
|
+
import ToastService from "primevue/toastservice";
|
|
4
|
+
|
|
5
|
+
export default defineNuxtPlugin({
|
|
6
|
+
name: "toast",
|
|
7
|
+
enforce: "pre",
|
|
8
|
+
setup(_nuxtApp) {
|
|
9
|
+
_nuxtApp.vueApp.use(ToastService);
|
|
10
|
+
const toast = useToast();
|
|
11
|
+
|
|
12
|
+
return {
|
|
13
|
+
provide: {
|
|
14
|
+
toast
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "#app";
|
|
2
|
+
|
|
3
|
+
export default defineNuxtPlugin({
|
|
4
|
+
name: "trailingSlash",
|
|
5
|
+
enforce: "pre",
|
|
6
|
+
setup(nuxtApp) {
|
|
7
|
+
const router = nuxtApp.$router;
|
|
8
|
+
|
|
9
|
+
router.beforeEach(async to => {
|
|
10
|
+
if(to.path !== "/" && to.path.endsWith("/")) {
|
|
11
|
+
await router.replace({
|
|
12
|
+
path: to.path.slice(0, -1),
|
|
13
|
+
query: to.query
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
package/dist/types.d.mts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { default } from './module.mjs'
|
|
2
|
+
|
|
3
|
+
export { type Components, type Composables, type ModuleOptions, type PageOptions, type PrimeVueOptions, type RetryOptions, type ScreenOptions, type UseBreakpointsOptions, type UseDataFetcherOptions, type UseFormatOptions } from './module.mjs'
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mouseless/baked",
|
|
3
|
+
"version": "0.19.0",
|
|
4
|
+
"description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"baked",
|
|
7
|
+
"ui"
|
|
8
|
+
],
|
|
9
|
+
"homepage": "https://baked.mouseless.codes",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://matrix.to/#/#baked:mouseless.org"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/mouseless/baked.git"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "mouseless",
|
|
19
|
+
"type": "module",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/types.d.mts",
|
|
23
|
+
"import": "./dist/module.mjs"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"main": "./dist/module.mjs",
|
|
27
|
+
"typesVersions": {
|
|
28
|
+
"*": {
|
|
29
|
+
".": [
|
|
30
|
+
"./dist/types.d.mts"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"dist"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepack": "nuxt-module-build build",
|
|
39
|
+
"postinstall": "nuxt prepare",
|
|
40
|
+
"build": "npm run lint && nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
41
|
+
"dev": "npm run lint && nuxi dev playground --dotenv .env.development --host",
|
|
42
|
+
"test": "playwright test",
|
|
43
|
+
"lint": "eslint ."
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@nuxtjs/i18n": "10.1.1",
|
|
47
|
+
"@nuxtjs/tailwindcss": "6.14.0",
|
|
48
|
+
"@primeuix/themes": "1.2.5",
|
|
49
|
+
"async-mutex": "0.5.0",
|
|
50
|
+
"primeicons": "7.0.0",
|
|
51
|
+
"primevue": "4.4.1"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@nuxt/eslint": "1.9.0",
|
|
55
|
+
"@nuxt/module-builder": "1.0.2",
|
|
56
|
+
"@nuxt/test-utils": "3.19.2",
|
|
57
|
+
"@playwright/test": "1.56.1",
|
|
58
|
+
"@types/node": "24.8.1",
|
|
59
|
+
"changelogen": "0.6.2",
|
|
60
|
+
"nuxt": "4.1.3",
|
|
61
|
+
"sass": "1.93.2",
|
|
62
|
+
"typescript": "5.9.3",
|
|
63
|
+
"vitest": "3.2.4",
|
|
64
|
+
"vue-tsc": "3.1.1"
|
|
65
|
+
},
|
|
66
|
+
"optionalDependencies": {
|
|
67
|
+
"@oxc-parser/binding-darwin-arm64": "0.95.0",
|
|
68
|
+
"@oxc-parser/binding-linux-arm64-gnu": "0.95.0",
|
|
69
|
+
"@oxc-parser/binding-linux-arm64-musl": "0.95.0",
|
|
70
|
+
"@oxc-parser/binding-linux-x64-gnu": "0.95.0",
|
|
71
|
+
"@oxc-parser/binding-linux-x64-musl": "0.95.0",
|
|
72
|
+
"@oxc-parser/binding-win32-x64-msvc": "0.95.0"
|
|
73
|
+
}
|
|
74
|
+
}
|