@mouseless/baked 1.8.5 → 1.8.7

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.5",
4
+ "version": "1.8.7",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
@@ -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,6 +1,7 @@
1
1
  import { useRuntimeConfig } from "#app";
2
2
  import { createError, useMutex } from "#imports";
3
3
  import { bfetch } from "../utils/bfetch.js";
4
+ import { Buffer } from "buffer";
4
5
 
5
6
  export default function() {
6
7
  const mutex = useMutex();
@@ -69,7 +70,7 @@ export default function() {
69
70
  function decode(value) {
70
71
  const { access } = JSON.parse(value);
71
72
 
72
- return JSON.parse(atob(access.split(".")[1]));
73
+ return JSON.parse(decodeBase64(access.split(".")[1]));
73
74
  }
74
75
 
75
76
  return {
@@ -94,7 +95,8 @@ function Token(tokenString) {
94
95
 
95
96
  function isExpired(token) {
96
97
  try {
97
- const claims = JSON.parse(atob(token.split(".")[1]));
98
+ const decoded = decodeBase64(token.split(".")[1]);
99
+ const claims = JSON.parse(decoded);
98
100
 
99
101
  return parseInt(claims.exp) * 1000 < Date.now();
100
102
  } catch {
@@ -110,3 +112,7 @@ function Token(tokenString) {
110
112
  refreshIsExpired
111
113
  };
112
114
  }
115
+
116
+ function decodeBase64(value) {
117
+ return Buffer.from(value, "base64").toString("utf8");
118
+ }
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.5",
3
+ "version": "1.8.7",
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",
@@ -48,6 +48,7 @@
48
48
  "@primeuix/themes": "2.0.3",
49
49
  "@tailwindcss/vite": "4.3.3",
50
50
  "async-mutex": "0.5.0",
51
+ "buffer": "6.0.3",
51
52
  "playwright": "1.61.1",
52
53
  "primeicons": "7.0.0",
53
54
  "primevue": "4.5.5",
@@ -61,7 +62,7 @@
61
62
  "@types/node": "26.1.1",
62
63
  "changelogen": "0.6.2",
63
64
  "nuxt": "4.5.2",
64
- "vitest": "4.1.10",
65
+ "vitest": "4.1.11",
65
66
  "vue-tsc": "3.3.7"
66
67
  },
67
68
  "optionalDependencies": {
@@ -71,5 +72,13 @@
71
72
  "@oxc-parser/binding-linux-x64-gnu": "0.141.0",
72
73
  "@oxc-parser/binding-linux-x64-musl": "0.141.0",
73
74
  "@oxc-parser/binding-win32-x64-msvc": "0.141.0"
75
+ },
76
+ "allowScripts": {
77
+ "esbuild@0.25.12": true,
78
+ "esbuild@0.28.2": true,
79
+ "unrs-resolver@1.12.2": true
80
+ },
81
+ "overrides": {
82
+ "vue-sfc-transformer": "0.2.5"
74
83
  }
75
- }
84
+ }