@mouseless/baked 1.8.2 → 1.8.4
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/dist/module.json +3 -3
- package/dist/module.mjs +2 -0
- package/dist/runtime/components/Bake.vue +3 -0
- package/dist/runtime/components/Inputs.vue +1 -1
- package/dist/runtime/components/Labeler.vue +4 -0
- package/dist/runtime/components/Layout.vue +1 -0
- package/dist/runtime/components/Message.d.vue.ts +5 -3
- package/dist/runtime/components/Message.vue +1 -1
- package/dist/runtime/components/Message.vue.d.ts +5 -3
- package/dist/runtime/components/MissingComponent.vue +3 -0
- package/dist/runtime/components/SimpleForm.vue +0 -1
- package/dist/runtime/components/Text.d.vue.ts +5 -3
- package/dist/runtime/components/Text.vue +1 -1
- package/dist/runtime/components/Text.vue.d.ts +5 -3
- package/dist/runtime/components/Validation.vue +4 -0
- package/dist/runtime/composables/useActionExecuter.js +2 -1
- package/dist/runtime/composables/useDataFetcher.js +11 -10
- package/dist/runtime/composables/usePathBuilder.d.ts +5 -1
- package/dist/runtime/composables/usePathBuilder.js +24 -6
- package/dist/runtime/composables/useRedirect.d.ts +1 -1
- package/dist/runtime/composables/useRedirect.js +25 -3
- package/dist/runtime/composables/useToken.js +2 -1
- package/dist/runtime/plugins/baked.js +5 -0
- package/dist/runtime/plugins/fetch.js +1 -1
- package/dist/runtime/utils/bfetch.d.ts +1 -0
- package/dist/runtime/utils/bfetch.js +3 -0
- package/package.json +4 -4
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -64,9 +64,11 @@ const module$1 = defineNuxtModule({
|
|
|
64
64
|
_nuxt.options.devtools = { enabled: false };
|
|
65
65
|
_nuxt.options.experimental.payloadExtraction = false;
|
|
66
66
|
_nuxt.options.features.inlineStyles = false;
|
|
67
|
+
_nuxt.options.pages = true;
|
|
67
68
|
_nuxt.options.ssr = false;
|
|
68
69
|
addComponentsDir({ path: resolver.metaUrl.resolve("./runtime/components") });
|
|
69
70
|
addImportsDir(resolver.metaUrl.resolve("./runtime/composables"));
|
|
71
|
+
addImportsDir(resolver.metaUrl.resolve("./runtime/utils"));
|
|
70
72
|
for (const plugin of app?.plugins ?? []) {
|
|
71
73
|
_nuxt.options.runtimeConfig.public[plugin.name] = plugin;
|
|
72
74
|
addPlugin(resolver[camelize(plugin.resolver ?? "MetaUrl")].resolve(join(plugin.basePath, plugin.name)));
|
|
@@ -49,6 +49,9 @@ const context = useContext();
|
|
|
49
49
|
const dataFetcher = useDataFetcher();
|
|
50
50
|
const { asClasses } = useFormat();
|
|
51
51
|
const reactionHandler = useReactionHandler();
|
|
52
|
+
defineOptions({
|
|
53
|
+
inheritAttrs: false
|
|
54
|
+
});
|
|
52
55
|
const { name, descriptor } = defineProps({
|
|
53
56
|
name: { type: String, required: true },
|
|
54
57
|
descriptor: { type: null, required: true }
|
|
@@ -31,7 +31,7 @@ const values = computed(
|
|
|
31
31
|
);
|
|
32
32
|
context.providePath(`${parentPath}/inputs`);
|
|
33
33
|
watch(values, (newValues) => {
|
|
34
|
-
if (!formMode && inputs.filter((i) => i.default || i.defaultSelfManaged).some((i) => !checkValue(newValues[i.name]))) {
|
|
34
|
+
if (!formMode && inputs.filter((i) => i.required && (i.default || i.defaultSelfManaged)).some((i) => !checkValue(newValues[i.name]))) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
emitChanged();
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
:pt
|
|
10
10
|
:variant
|
|
11
11
|
:required
|
|
12
|
+
v-bind="$attrs"
|
|
12
13
|
>
|
|
13
14
|
<template #default>
|
|
14
15
|
<slot />
|
|
@@ -26,6 +27,9 @@ import { useContext, useLocalization } from "#imports";
|
|
|
26
27
|
const context = useContext();
|
|
27
28
|
const { localize: l } = useLocalization({});
|
|
28
29
|
const { localize: lc } = useLocalization({ group: "Labeler" });
|
|
30
|
+
defineOptions({
|
|
31
|
+
inheritAttrs: false
|
|
32
|
+
});
|
|
29
33
|
const { label } = defineProps({
|
|
30
34
|
label: { type: Object, default: null },
|
|
31
35
|
path: { type: String, required: true },
|
|
@@ -11,7 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
11
11
|
};
|
|
12
12
|
data: {
|
|
13
13
|
type: null;
|
|
14
|
-
|
|
14
|
+
default: null;
|
|
15
15
|
};
|
|
16
16
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
17
|
schema: {
|
|
@@ -20,9 +20,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
20
20
|
};
|
|
21
21
|
data: {
|
|
22
22
|
type: null;
|
|
23
|
-
|
|
23
|
+
default: null;
|
|
24
24
|
};
|
|
25
|
-
}>> & Readonly<{}>, {
|
|
25
|
+
}>> & Readonly<{}>, {
|
|
26
|
+
data: any;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
28
|
type __VLS_Slots = {
|
|
27
29
|
content?: ((props: {}) => any) | undefined;
|
|
28
30
|
};
|
|
@@ -47,7 +47,7 @@ import { AwaitLoading, Bake } from "#components";
|
|
|
47
47
|
const { localize: l } = useLocalization();
|
|
48
48
|
const { schema, data } = defineProps({
|
|
49
49
|
schema: { type: null, required: true },
|
|
50
|
-
data: { type: null,
|
|
50
|
+
data: { type: null, default: null }
|
|
51
51
|
});
|
|
52
52
|
const { action, icon, localizeMessage, severity = "info", size, variant = "outlined" } = schema;
|
|
53
53
|
const sizeClass = computed(() => {
|
|
@@ -11,7 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
11
11
|
};
|
|
12
12
|
data: {
|
|
13
13
|
type: null;
|
|
14
|
-
|
|
14
|
+
default: null;
|
|
15
15
|
};
|
|
16
16
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
17
17
|
schema: {
|
|
@@ -20,9 +20,11 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
20
20
|
};
|
|
21
21
|
data: {
|
|
22
22
|
type: null;
|
|
23
|
-
|
|
23
|
+
default: null;
|
|
24
24
|
};
|
|
25
|
-
}>> & Readonly<{}>, {
|
|
25
|
+
}>> & Readonly<{}>, {
|
|
26
|
+
data: any;
|
|
27
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
28
|
type __VLS_Slots = {
|
|
27
29
|
content?: ((props: {}) => any) | undefined;
|
|
28
30
|
};
|
|
@@ -77,6 +77,9 @@
|
|
|
77
77
|
import { computed, ref } from "vue";
|
|
78
78
|
import { Button, Dialog, Panel, Divider } from "primevue";
|
|
79
79
|
import { AwaitLoading } from "#components";
|
|
80
|
+
defineOptions({
|
|
81
|
+
inheritAttrs: false
|
|
82
|
+
});
|
|
80
83
|
const { schema, data } = defineProps({
|
|
81
84
|
schema: { type: null, required: true },
|
|
82
85
|
data: { type: null, required: true }
|
|
@@ -7,7 +7,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
7
7
|
};
|
|
8
8
|
data: {
|
|
9
9
|
type: null;
|
|
10
|
-
|
|
10
|
+
default: null;
|
|
11
11
|
};
|
|
12
12
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
13
|
schema: {
|
|
@@ -16,6 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
16
16
|
};
|
|
17
17
|
data: {
|
|
18
18
|
type: null;
|
|
19
|
-
|
|
19
|
+
default: null;
|
|
20
20
|
};
|
|
21
|
-
}>> & Readonly<{}>, {
|
|
21
|
+
}>> & Readonly<{}>, {
|
|
22
|
+
data: any;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -15,7 +15,7 @@ import { AwaitLoading } from "#components";
|
|
|
15
15
|
const { truncate } = useFormat();
|
|
16
16
|
const { schema, data: rawData } = defineProps({
|
|
17
17
|
schema: { type: null, required: true },
|
|
18
|
-
data: { type: null,
|
|
18
|
+
data: { type: null, default: null }
|
|
19
19
|
});
|
|
20
20
|
const { maxLength, prop } = schema;
|
|
21
21
|
const data = computed(() => {
|
|
@@ -7,7 +7,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
7
7
|
};
|
|
8
8
|
data: {
|
|
9
9
|
type: null;
|
|
10
|
-
|
|
10
|
+
default: null;
|
|
11
11
|
};
|
|
12
12
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
13
|
schema: {
|
|
@@ -16,6 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
16
16
|
};
|
|
17
17
|
data: {
|
|
18
18
|
type: null;
|
|
19
|
-
|
|
19
|
+
default: null;
|
|
20
20
|
};
|
|
21
|
-
}>> & Readonly<{}>, {
|
|
21
|
+
}>> & Readonly<{}>, {
|
|
22
|
+
data: any;
|
|
23
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
</template>
|
|
5
5
|
<div
|
|
6
6
|
v-else
|
|
7
|
+
v-bind="$attrs"
|
|
7
8
|
class="b-Validation flex flex-col gap-2"
|
|
8
9
|
>
|
|
9
10
|
<slot />
|
|
@@ -40,6 +41,9 @@
|
|
|
40
41
|
import { computed } from "vue";
|
|
41
42
|
import { useContext } from "#imports";
|
|
42
43
|
const context = useContext();
|
|
44
|
+
defineOptions({
|
|
45
|
+
inheritAttrs: false
|
|
46
|
+
});
|
|
43
47
|
const validationHandled = context.injectValidationHandled();
|
|
44
48
|
const validation = context.injectValidation();
|
|
45
49
|
const mutableValidation = context.injectMutableValidation();
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#app";
|
|
2
2
|
import { useComposableResolver, useDataFetcher, usePathBuilder, useUnref } from "#imports";
|
|
3
|
+
import { bfetch } from "../utils/bfetch.js";
|
|
3
4
|
|
|
4
5
|
export default function() {
|
|
5
6
|
const actions = {
|
|
@@ -87,7 +88,7 @@ function Remote({ actionExecuter }) {
|
|
|
87
88
|
? null
|
|
88
89
|
: (action.body ? unref.deepUnref(await dataFetcher.fetch({ data: action.body, contextData })) : { });
|
|
89
90
|
|
|
90
|
-
const response = await
|
|
91
|
+
const response = await bfetch(pathBuilder.build(action.path, params), {
|
|
91
92
|
baseURL: apiBaseURL,
|
|
92
93
|
method: action.method,
|
|
93
94
|
headers: headers,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#app";
|
|
2
2
|
import { useComposableResolver, usePathBuilder, useUnref } from "#imports";
|
|
3
|
+
import { bfetch } from "../utils/bfetch.js";
|
|
3
4
|
|
|
4
5
|
export default function() {
|
|
5
6
|
const datas = {
|
|
@@ -136,16 +137,16 @@ function Context() {
|
|
|
136
137
|
const unref = useUnref();
|
|
137
138
|
|
|
138
139
|
function get({ data, contextData }) {
|
|
139
|
-
let result =
|
|
140
|
+
let result = null;
|
|
140
141
|
|
|
141
|
-
if(
|
|
142
|
+
if(data.key in contextData) {
|
|
143
|
+
result = unref.deepUnref(contextData[data.key]);
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
result = result?.[prop];
|
|
145
|
+
if(data.prop) {
|
|
146
|
+
const path = data.prop.split(".");
|
|
147
|
+
for(const prop of path) {
|
|
148
|
+
result = result?.[prop];
|
|
149
|
+
}
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -195,7 +196,7 @@ function Remote({ parentFetch }) {
|
|
|
195
196
|
return await fetchWithRetry(path, options, retry);
|
|
196
197
|
}
|
|
197
198
|
|
|
198
|
-
return await
|
|
199
|
+
return await bfetch(path, { ...options, retry: false });
|
|
199
200
|
}
|
|
200
201
|
|
|
201
202
|
async function fetchHeaders({ data, contextData }) {
|
|
@@ -226,7 +227,7 @@ function Remote({ parentFetch }) {
|
|
|
226
227
|
let lastError = null;
|
|
227
228
|
for(let i = -1; i < maxRetry; i++) { // i starts at -1 to allow for the first attempt
|
|
228
229
|
try {
|
|
229
|
-
return await
|
|
230
|
+
return await bfetch(url, { ...options, retry: false });
|
|
230
231
|
} catch (error) {
|
|
231
232
|
lastError = error;
|
|
232
233
|
|
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
export default function() {
|
|
2
|
-
function build(path, params,
|
|
2
|
+
function build(path, params, options) {
|
|
3
|
+
return buildDetailed(path, params, options).path;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
function buildDetailed(path, params, { forRoute } = {}) {
|
|
7
|
+
const usedKeys = [];
|
|
8
|
+
|
|
3
9
|
Object.entries(params).forEach(([key, value]) => {
|
|
4
10
|
// AI-GEN
|
|
5
11
|
// match key ex: either {id} or {id:guid}
|
|
6
12
|
// or
|
|
7
13
|
// match key ex: [id]
|
|
8
|
-
const regex = forRoute
|
|
9
|
-
|
|
14
|
+
const regex = forRoute
|
|
15
|
+
? new RegExp(`\\[${key}(?::[^\\]]*)?\\]`, "g")
|
|
16
|
+
: new RegExp(`\\{${key}(?::[^}]*)?\\}`, "g");
|
|
17
|
+
|
|
18
|
+
const replaced = path.replace(regex, value);
|
|
19
|
+
if(replaced !== path) {
|
|
20
|
+
usedKeys.push(key);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
path = replaced;
|
|
10
24
|
});
|
|
11
25
|
|
|
12
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
path,
|
|
28
|
+
usedKeys
|
|
29
|
+
};
|
|
13
30
|
}
|
|
14
31
|
|
|
15
32
|
return {
|
|
16
|
-
build
|
|
33
|
+
build,
|
|
34
|
+
buildDetailed
|
|
17
35
|
};
|
|
18
|
-
}
|
|
36
|
+
}
|
|
@@ -3,13 +3,29 @@ import { usePathBuilder } from "#imports";
|
|
|
3
3
|
|
|
4
4
|
export default function() {
|
|
5
5
|
const router = useRouter();
|
|
6
|
-
const {
|
|
6
|
+
const { buildDetailed } = usePathBuilder();
|
|
7
7
|
|
|
8
|
-
async function run({ route, back, expected, actual, ...params } = {}) {
|
|
8
|
+
async function run({ route, back, expected, actual, query, includeQuery, excludeQuery, ...params } = {}) {
|
|
9
9
|
if(expected && actual !== expected) { return; }
|
|
10
10
|
|
|
11
11
|
if(route && Object.keys(params).length > 0) {
|
|
12
|
-
|
|
12
|
+
const { path, usedKeys } = buildDetailed(route, params, { forRoute: true });
|
|
13
|
+
route = path;
|
|
14
|
+
|
|
15
|
+
if(query) {
|
|
16
|
+
const queryParams = Object.fromEntries(
|
|
17
|
+
Object.entries(params).filter(([key, value]) =>
|
|
18
|
+
shouldInclude(key, {
|
|
19
|
+
include: includeQuery,
|
|
20
|
+
exclude: [...(excludeQuery ?? []), ...usedKeys]
|
|
21
|
+
}) && value !== undefined && value !== null
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
if(Object.keys(queryParams).length > 0) {
|
|
26
|
+
route += `?${new URLSearchParams(queryParams)}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
13
29
|
}
|
|
14
30
|
|
|
15
31
|
if(back) {
|
|
@@ -19,6 +35,12 @@ export default function() {
|
|
|
19
35
|
}
|
|
20
36
|
}
|
|
21
37
|
|
|
38
|
+
function shouldInclude(key, { include, exclude } = {}) {
|
|
39
|
+
if(include?.length) return include.includes(key);
|
|
40
|
+
|
|
41
|
+
return !exclude?.includes(key);
|
|
42
|
+
}
|
|
43
|
+
|
|
22
44
|
return {
|
|
23
45
|
run
|
|
24
46
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "#app";
|
|
2
2
|
import { createError, useMutex } from "#imports";
|
|
3
|
+
import { bfetch } from "../utils/bfetch.js";
|
|
3
4
|
|
|
4
5
|
export default function() {
|
|
5
6
|
const mutex = useMutex();
|
|
@@ -31,7 +32,7 @@ export default function() {
|
|
|
31
32
|
const token = await current(false);
|
|
32
33
|
if(!token?.accessIsExpired()) { return; }
|
|
33
34
|
|
|
34
|
-
const result = await
|
|
35
|
+
const result = await bfetch(auth.refreshApiRoute,
|
|
35
36
|
{
|
|
36
37
|
baseURL: apiBaseURL,
|
|
37
38
|
method: "POST",
|
|
@@ -33,6 +33,11 @@ export default defineNuxtPlugin({
|
|
|
33
33
|
component: () => import("../components/Page.vue")
|
|
34
34
|
});
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
// Routes added via addRoute() are not recognized by Vue Router during the
|
|
38
|
+
// initial navigation. Replacing the current route forces Vue Router to
|
|
39
|
+
// re evaluate the path against the newly registered routes
|
|
40
|
+
app.$nuxt.$router.replace(app.$nuxt.$router.currentRoute.value.fullPath);
|
|
36
41
|
}
|
|
37
42
|
}
|
|
38
43
|
});
|
|
@@ -15,7 +15,7 @@ export default defineNuxtPlugin({
|
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
// wrap $fetch using interceptors to allow around interception
|
|
18
|
-
globalThis
|
|
18
|
+
globalThis.bfetch = async(request, options) => {
|
|
19
19
|
// not all requests have headers, query, attributes objects. this might
|
|
20
20
|
// cause interceptors to fail. create fresh empty objects for each request.
|
|
21
21
|
return await interceptors.execute({ request, options: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function bfetch(request: any, options: any): any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mouseless/baked",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.4",
|
|
4
4
|
"description": "Baked is an opinionated framework for .NET and Vue. This is the UI package of Baked project.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"baked",
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
38
|
"prepack": "nuxt-module-build build",
|
|
39
|
-
"postinstall": "nuxt prepare
|
|
39
|
+
"postinstall": "nuxt prepare",
|
|
40
40
|
"build": "npm run lint && nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
41
|
+
"dev:prepare": "nuxi prepare playground",
|
|
41
42
|
"dev": "npm run lint && nuxi dev playground --dotenv .env.development --host",
|
|
42
43
|
"test": "npm run lint && playwright test",
|
|
43
44
|
"lint": "eslint ."
|
|
@@ -54,13 +55,12 @@
|
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|
|
56
57
|
"@nuxt/eslint": "1.16.0",
|
|
57
|
-
"@nuxt/module-builder": "1.0.
|
|
58
|
+
"@nuxt/module-builder": "1.0.3",
|
|
58
59
|
"@nuxt/test-utils": "4.0.3",
|
|
59
60
|
"@playwright/test": "1.61.1",
|
|
60
61
|
"@types/node": "26.1.1",
|
|
61
62
|
"changelogen": "0.6.2",
|
|
62
63
|
"nuxt": "4.5.2",
|
|
63
|
-
"typescript": "6.0.3",
|
|
64
64
|
"vitest": "4.1.10",
|
|
65
65
|
"vue-tsc": "3.3.7"
|
|
66
66
|
},
|