@mouseless/baked 1.8.4 → 1.8.6

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.d.mts CHANGED
@@ -11,10 +11,20 @@ interface ModuleOptions {
11
11
  }
12
12
  interface Components {
13
13
  Page?: PageOptions;
14
+ NavLink?: NavLinkOptions;
14
15
  }
15
16
  interface PageOptions {
16
17
  title?: String;
17
18
  }
19
+ interface NavLinkOptions {
20
+ timeouts?: {
21
+ show?: {
22
+ initial?: number;
23
+ consequent?: number;
24
+ };
25
+ hide?: number;
26
+ };
27
+ }
18
28
  interface PrimeVueOptions {
19
29
  theme: any;
20
30
  locale?: any;
@@ -50,4 +60,4 @@ interface ScreenOptions {
50
60
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
51
61
 
52
62
  export { _default as default };
53
- export type { CacheOptions, Components, Composables, ModuleOptions, PageOptions, Plugins, PrimeVueOptions, RetryOptions, ScreenOptions, UseBreakpointsOptions, UseDataFetcherOptions, UseFormatOptions };
63
+ export type { CacheOptions, Components, Composables, ModuleOptions, NavLinkOptions, PageOptions, Plugins, PrimeVueOptions, RetryOptions, ScreenOptions, UseBreakpointsOptions, UseDataFetcherOptions, UseFormatOptions };
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
3
  "configKey": "baked",
4
- "version": "1.8.4",
4
+ "version": "1.8.6",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -3,7 +3,7 @@
3
3
  dark:bg-red-950/95 dark:text-red-500 dark:border-red-700/65}.b-component--Message.message-warn{@apply bg-yellow-50/95 text-yellow-600 border-yellow-200
4
4
  dark:bg-yellow-950/95 dark:text-yellow-500 dark:border-yellow-700/65}.b-component--Message.message-success{@apply bg-green-50/95 text-green-600 border-green-200
5
5
  dark:bg-green-950/95 dark:text-green-500 dark:border-green-700/65}.b-component--Message.message-secondary{@apply bg-transparent text-slate-500 border-slate-500
6
- dark:text-slate-400 dark:border-slate-400}.b-component--Message.message-contrast{@apply bg-transparent text-slate-950 border-slate-950
6
+ dark:text-zinc-400 dark:border-zinc-400}.b-component--Message.message-contrast{@apply bg-transparent text-slate-950 border-slate-950
7
7
  dark:text-white dark:border-white}.c--missing-component-dialog code:not(:has(pre)){@apply rounded p-1 text-xs bg-zinc-50 text-orange-700
8
8
  dark:bg-zinc-950 dark:text-orange-400}.c--missing-component-dialog pre{@apply block rounded-lg overflow-auto max-h-[20em]
9
9
  bg-zinc-950 p-4 text-xs text-sky-300}.c--missing-component-dialog pre .c--code-comment{@apply text-green-800}.c--missing-component-dialog pre .c--code-string{@apply text-orange-400}.c--missing-component-dialog pre .c--code-keyword{@apply text-purple-400}.c--missing-component-dialog pre .c--code-symbol{@apply text-gray-100}.c--missing-component-dialog pre .c--code-type{@apply text-blue-400}.c--missing-component-dialog pre .c--code-method{@apply text-yellow-100}.p-scrolltop{@apply right-6 bottom-6 max-md:bottom-24 py-icon-only-width}.b-component--Select .p-placeholder{@apply opacity-0}.b-component--Select .p-select-label{@apply text-[length:inherit]}.p-popover-content .b-component--Select{@apply max-md:w-full}.b-component--SelectButton .p-togglebutton-content{@apply whitespace-nowrap}.p-popover-content .b-component--SelectButton .p-selectbutton,.p-popover-content .b-component--SelectButton.p-selectbutton{@apply max-sm:flex max-sm:flex-col}.p-popover-content .b-component--SelectButton .p-selectbutton .p-togglebutton:first-child,.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:first-child{@apply max-sm:rounded-t-lg max-sm:rounded-es-none}.p-popover-content .b-component--SelectButton .p-selectbutton .p-togglebutton:last-child,.p-popover-content .b-component--SelectButton.p-selectbutton .p-togglebutton:last-child{@apply max-sm:rounded-b-lg max-sm:rounded-se-none}.b-component--SimpleForm.horizontal :has(.p-iftalabel) .p-button[data-p=large]{@apply mt-1}.b-component--SimpleForm.horizontal :has(.p-iftalabel) .p-button:not([data-p=large]){@apply mt-2}.b-component--PageSize .p-select-label{@apply text-[length:inherit]}.b-component--PageTitle .p-button{@apply self-stretch}.b-component--PageTitle .p-button .p-button-icon+.p-button-label{@apply max-sm:hidden}.p-popover-content>div{@apply max-sm:p-0}}
@@ -164,6 +164,9 @@ async function executeAction(newModel) {
164
164
  if (!descriptor.action) {
165
165
  return;
166
166
  }
167
+ if (descriptor.actionSkipsEmptyModel && isEmpty(newModel)) {
168
+ return;
169
+ }
167
170
  try {
168
171
  executing.value = true;
169
172
  await actionExecuter.execute({
@@ -180,4 +183,16 @@ async function executeAction(newModel) {
180
183
  executing.value = false;
181
184
  }
182
185
  }
186
+ function isEmpty(value) {
187
+ if (value === null || value === void 0) {
188
+ return true;
189
+ }
190
+ if (typeof value === "string" && value.trim() === "") {
191
+ return true;
192
+ }
193
+ if (Array.isArray(value) && value.length === 0) {
194
+ return true;
195
+ }
196
+ return false;
197
+ }
183
198
  </script>
@@ -2,12 +2,19 @@
2
2
  <div
3
3
  class="
4
4
  b-message
5
- grid grid-cols-[1fr_auto] gap-2
5
+ grid grid-cols-[1fr_auto]
6
6
  items-center
7
+ md:gap-2
8
+ max-md:flex max-md:flex-col max-md:space-between
7
9
  "
8
10
  :class="[`message-${severity}`, `message-${variant}`]"
9
11
  >
10
- <div class="min-h-0">
12
+ <div
13
+ class="
14
+ min-h-0
15
+ max-md:w-full
16
+ "
17
+ >
11
18
  <div
12
19
  :class="sizeClass"
13
20
  class="
@@ -31,10 +38,14 @@
31
38
  </div>
32
39
  <div
33
40
  v-if="action"
34
- class="b-message-action p-2"
41
+ class="
42
+ b-message-action p-2
43
+ max-md:w-full
44
+ "
35
45
  >
36
46
  <Bake
37
47
  name="action"
48
+ class="max-md:w-full"
38
49
  :descriptor="{ ...action, schema: { ...action.schema, severity } }"
39
50
  />
40
51
  </div>
@@ -1,35 +1,106 @@
1
1
  <template>
2
2
  <AwaitLoading :skeleton="{ height: '1.5rem' }">
3
- <Button
3
+ <div
4
4
  v-if="data"
5
- :icon
6
- :label
7
- :to
8
- as="router-link"
9
- link
10
- class="m-0 p-0"
11
- />
5
+ class="flex gap-2"
6
+ >
7
+ <Button
8
+ :icon
9
+ :label
10
+ :to
11
+ as="router-link"
12
+ link
13
+ class="m-0 p-0"
14
+ @mouseenter="openPopover"
15
+ @mouseleave="closePopover"
16
+ />
17
+ <span
18
+ v-if="summary"
19
+ class="md:hidden"
20
+ data-icon
21
+ @click="openPopover"
22
+ >
23
+ <i class="pi pi-eye" />
24
+ </span>
25
+ <PersistentPopover
26
+ v-if="summary"
27
+ ref="popover"
28
+ class="
29
+ mx-4 max-w-96
30
+ max-md:w-[calc(100%-2rem)]
31
+ "
32
+ >
33
+ <Bake
34
+ v-if="summaryShown"
35
+ name="summary"
36
+ :descriptor="summary"
37
+ @loaded="showPopover"
38
+ @mouseenter="cancelHidePopover"
39
+ @mouseleave="closePopover"
40
+ />
41
+ </PersistentPopover>
42
+ </div>
12
43
  <span v-else>-</span>
13
44
  </AwaitLoading>
14
45
  </template>
15
46
 
16
47
  <script setup>
17
- import { computed } from "vue";
48
+ import { computed, ref } from "vue";
49
+ import defu from "defu";
18
50
  import { Button } from "primevue";
19
- import { useDataMounter, usePathBuilder } from "#imports";
20
- import { AwaitLoading } from "#components";
51
+ import { useRuntimeConfig } from "#app";
52
+ import { useDataMounter, useFormat, usePathBuilder } from "#imports";
53
+ import { AwaitLoading, Bake, PersistentPopover } from "#components";
21
54
  const { mount: mountData } = useDataMounter({ defaultInlineError: true });
55
+ const { truncate } = useFormat();
22
56
  const pathBuilder = usePathBuilder();
57
+ const runtimeConfig = useRuntimeConfig();
23
58
  const { schema, data } = defineProps({
24
59
  schema: { type: null, required: true },
25
60
  data: { type: null, required: true }
26
61
  });
27
- const { icon, labelProp, path, query: queryData, params: paramsData } = schema;
62
+ const { icon, labelProp, path, query: queryData, params: paramsData, summary, maxLength } = schema;
63
+ const timeouts = defu(
64
+ runtimeConfig.public.components?.NavLink?.timeouts,
65
+ { show: { initial: 500, consequent: 250 }, hide: 250 }
66
+ );
67
+ const popover = ref();
68
+ let loadPopoverTask = null;
69
+ let hidePopoverTask = null;
70
+ let showPopover = null;
28
71
  const query = mountData(queryData);
29
72
  const params = mountData(paramsData);
30
- const label = computed(() => labelProp ? data?.[labelProp] : data);
73
+ const label = computed(() => truncate(labelProp ? data?.[labelProp] : data, maxLength));
74
+ const summaryShown = ref(false);
31
75
  const to = computed(() => ({
32
76
  path: params.value ? pathBuilder.build(path, params.value, { forRoute: true }) : path,
33
77
  query: query.value
34
78
  }));
79
+ function openPopover(event) {
80
+ if (!summary) {
81
+ return false;
82
+ }
83
+ clearTimeout(loadPopoverTask);
84
+ clearTimeout(hidePopoverTask);
85
+ const target = event.target || event;
86
+ const onIcon = event.target.dataset["icon"] !== void 0;
87
+ loadPopoverTask = setTimeout(
88
+ () => {
89
+ if (summaryShown.value) {
90
+ popover.value?.show(event, target);
91
+ } else {
92
+ summaryShown.value = true;
93
+ showPopover = () => popover.value?.show(event, target);
94
+ }
95
+ },
96
+ onIcon ? 0 : !summaryShown.value ? timeouts.show.initial : timeouts.show.consequent
97
+ );
98
+ }
99
+ function closePopover(event) {
100
+ clearTimeout(loadPopoverTask);
101
+ hidePopoverTask = setTimeout(() => popover.value?.hide(event.target), timeouts.hide);
102
+ }
103
+ function cancelHidePopover() {
104
+ clearTimeout(hidePopoverTask);
105
+ }
35
106
  </script>
@@ -27,11 +27,10 @@ const data = computed(() => {
27
27
  }
28
28
  return rawData;
29
29
  });
30
- const lengthIsExceeded = computed(() => maxLength && data.value.length > maxLength);
31
- const text = computed(() => lengthIsExceeded.value ? truncate(data.value, maxLength) : data.value);
30
+ const text = computed(() => truncate(data.value, maxLength));
32
31
  const tooltip = computed(() => ({
33
32
  value: `${data.value}`,
34
- disabled: !lengthIsExceeded.value,
33
+ disabled: text.value === data.value,
35
34
  pt: {
36
35
  root: {
37
36
  style: maxLength ? `min-width: ${maxLength / 2}rem;` : ""
@@ -1,5 +1,5 @@
1
1
  import { useRuntimeConfig } from "#app";
2
- import { useComposableResolver, useDataFetcher, usePathBuilder, useUnref } from "#imports";
2
+ import { useComposableResolver, useContext, useDataFetcher, usePathBuilder, useUnref, useValidation } from "#imports";
3
3
  import { bfetch } from "../utils/bfetch.js";
4
4
 
5
5
  export default function() {
@@ -36,9 +36,14 @@ function Composite({ actionExecuter }) {
36
36
  function Local() {
37
37
  const composableResolver = useComposableResolver();
38
38
  const dataFetcher = useDataFetcher();
39
+ const validation = useValidation();
40
+ const context = useContext();
41
+
42
+ const mutableValidation = validation.injectMutable();
43
+ const events = context.injectEvents();
39
44
 
40
45
  async function execute({ action, contextData }) {
41
- const composable = composableResolver.resolve(action.composable).default();
46
+ const composable = composableResolver.resolve(action.composable).default({ mutableValidation, events });
42
47
 
43
48
  if(composable.run) {
44
49
  const options = action.options ? await dataFetcher.fetch({ data: action.options, contextData }) : { };
@@ -106,4 +111,4 @@ function Remote({ actionExecuter }) {
106
111
  return {
107
112
  execute
108
113
  };
109
- }
114
+ }
@@ -11,7 +11,7 @@ export default function _default(): {
11
11
  handle?: boolean | undefined;
12
12
  }) => import("vue").Ref<{}, {}>;
13
13
  provideError: (error: any) => import("vue").Ref<boolean, boolean>;
14
- injectEvents: () => any;
14
+ injectEvents: () => null;
15
15
  provideEvents: (value: any) => void;
16
16
  injectExecuting: () => import("vue").Ref<boolean, boolean>;
17
17
  provideExecuting: (value: any) => void;
@@ -48,7 +48,7 @@ export default function() {
48
48
  }
49
49
 
50
50
  function injectEvents() {
51
- return inject("__bake_events");
51
+ return inject("__bake_events", null);
52
52
  }
53
53
 
54
54
  function provideEvents(value) {
@@ -20,7 +20,6 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
21
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  SOFTWARE.
23
-
24
23
  */
25
24
 
26
25
  import { isRef, unref } from "vue";
@@ -29,7 +28,7 @@ const isObject = val => val !== null && typeof val === "object";
29
28
  const isArray = Array.isArray;
30
29
 
31
30
  /**
32
- * Deeply unref a value, recursing into objects and arrays.
31
+ * Deeply unref a value, recursing into objects, plain object and arrays.
33
32
  *
34
33
  * @param {Mixed} val - The value to deeply unref.
35
34
  *
@@ -38,7 +37,7 @@ const isArray = Array.isArray;
38
37
  const deepUnref = val => {
39
38
  const checkedVal = isRef(val) ? unref(val) : val;
40
39
 
41
- if(! isObject(checkedVal)) {
40
+ if(!isObject(checkedVal)) {
42
41
  return checkedVal;
43
42
  }
44
43
 
@@ -46,9 +45,26 @@ const deepUnref = val => {
46
45
  return unrefArray(checkedVal);
47
46
  }
48
47
 
48
+ if(!isPlainObject(checkedVal)) {
49
+ return checkedVal;
50
+ }
51
+
49
52
  return unrefObject(checkedVal);
50
53
  };
51
54
 
55
+ /**
56
+ * Is this value a plain object?
57
+ *
58
+ * @param {Object} val - The object to check.
59
+ *
60
+ * @return {Boolean}
61
+ */
62
+ const isPlainObject = val => {
63
+ const proto = Object.getPrototypeOf(val);
64
+
65
+ return proto === Object.prototype || proto === null;
66
+ };
67
+
52
68
  /**
53
69
  * Unref a value, recursing into it if it's an object.
54
70
  *
@@ -58,7 +74,7 @@ const deepUnref = val => {
58
74
  */
59
75
  const smartUnref = val => {
60
76
  // Non-ref object? Go deeper!
61
- if(val !== null && ! isRef(val) && typeof val === "object") {
77
+ if(val !== null && !isRef(val) && typeof val === "object") {
62
78
  return deepUnref(val);
63
79
  }
64
80
 
package/dist/types.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { default } from './module.mjs'
2
2
 
3
- export { type CacheOptions, type Components, type Composables, type ModuleOptions, type PageOptions, type Plugins, type PrimeVueOptions, type RetryOptions, type ScreenOptions, type UseBreakpointsOptions, type UseDataFetcherOptions, type UseFormatOptions } from './module.mjs'
3
+ export { type CacheOptions, type Components, type Composables, type ModuleOptions, type NavLinkOptions, type PageOptions, type Plugins, type PrimeVueOptions, type RetryOptions, type ScreenOptions, type UseBreakpointsOptions, type UseDataFetcherOptions, type UseFormatOptions } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mouseless/baked",
3
- "version": "1.8.4",
3
+ "version": "1.8.6",
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",
@@ -71,5 +71,13 @@
71
71
  "@oxc-parser/binding-linux-x64-gnu": "0.141.0",
72
72
  "@oxc-parser/binding-linux-x64-musl": "0.141.0",
73
73
  "@oxc-parser/binding-win32-x64-msvc": "0.141.0"
74
+ },
75
+ "allowScripts": {
76
+ "esbuild@0.25.12": true,
77
+ "esbuild@0.28.2": true,
78
+ "unrs-resolver@1.12.2": true
79
+ },
80
+ "overrides": {
81
+ "vue-sfc-transformer": "0.2.5"
74
82
  }
75
83
  }