@mouseless/baked 1.8.2 → 1.8.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/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
3
  "configKey": "baked",
4
- "version": "1.8.2",
4
+ "version": "1.8.3",
5
5
  "builder": {
6
- "@nuxt/module-builder": "1.0.2",
7
- "unbuild": "unknown"
6
+ "@nuxt/module-builder": "1.0.3",
7
+ "unbuild": "3.6.1"
8
8
  }
9
9
  }
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,6 +11,7 @@
11
11
  :key="descriptor.type"
12
12
  name="root"
13
13
  :descriptor="descriptor"
14
+ v-bind="$attrs"
14
15
  >
15
16
  <slot />
16
17
  </Bake>
@@ -11,7 +11,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
11
11
  };
12
12
  data: {
13
13
  type: null;
14
- required: true;
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
- required: true;
23
+ default: null;
24
24
  };
25
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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, required: true }
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
- required: true;
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
- required: true;
23
+ default: null;
24
24
  };
25
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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 }
@@ -11,7 +11,6 @@
11
11
  :header="l(title)"
12
12
  :style="{ width: 'min(700px, 90vw)' }"
13
13
  :pt="{
14
- header: !dialogOptions.message && inputs.length > 0 ? 'pb-0' : '',
15
14
  content: 'flex flex-col gap-8'
16
15
  }"
17
16
  closable
@@ -7,7 +7,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  };
8
8
  data: {
9
9
  type: null;
10
- required: true;
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
- required: true;
19
+ default: null;
20
20
  };
21
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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, required: true }
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
- required: true;
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
- required: true;
19
+ default: null;
20
20
  };
21
- }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
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, 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 = contextData[data.key];
140
+ let result = null;
140
141
 
141
- if(!result) { return null; }
142
+ if(data.key in contextData) {
143
+ result = unref.deepUnref(contextData[data.key]);
142
144
 
143
- result = unref.deepUnref(result);
144
-
145
- if(data.prop) {
146
- const path = data.prop.split(".");
147
- for(const prop of path) {
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 $fetch(path, { ...options, retry: false });
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 $fetch(url, { ...options, retry: false });
230
+ return await bfetch(url, { ...options, retry: false });
230
231
  } catch (error) {
231
232
  lastError = error;
232
233
 
@@ -1,3 +1,7 @@
1
1
  export default function _default(): {
2
- build: (path: any, params: any, { forRoute }?: {}) => any;
2
+ build: (path: any, params: any, options: any) => any;
3
+ buildDetailed: (path: any, params: any, { forRoute }?: {}) => {
4
+ path: any;
5
+ usedKeys: any[];
6
+ };
3
7
  };
@@ -1,18 +1,36 @@
1
1
  export default function() {
2
- function build(path, params, { forRoute } = {}) {
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 ? new RegExp(`\\[${key}(?::[^\\]]*)?\\]`, "g") : new RegExp(`\\{${key}(?::[^}]*)?\\}`, "g");
9
- path = path.replace(regex, value);
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 path;
26
+ return {
27
+ path,
28
+ usedKeys
29
+ };
13
30
  }
14
31
 
15
32
  return {
16
- build
33
+ build,
34
+ buildDetailed
17
35
  };
18
- }
36
+ }
@@ -1,3 +1,3 @@
1
1
  export default function _default(): {
2
- run: ({ route, back, expected, actual, ...params }?: {}) => Promise<void>;
2
+ run: ({ route, back, expected, actual, query, includeQuery, excludeQuery, ...params }?: {}) => Promise<void>;
3
3
  };
@@ -3,13 +3,29 @@ import { usePathBuilder } from "#imports";
3
3
 
4
4
  export default function() {
5
5
  const router = useRouter();
6
- const { build } = usePathBuilder();
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
- route = build(route, params, { forRoute: true });
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
  };
@@ -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.$fetch = async(request, options) => {
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;
@@ -0,0 +1,3 @@
1
+ export function bfetch(request, options) {
2
+ return globalThis.bfetch(request, options);
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
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 && nuxi prepare playground",
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.2",
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
  },