@volverjs/ui-vue 0.0.14 → 0.0.15

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.
Files changed (97) hide show
  1. package/dist/Volver.d.ts +5 -5
  2. package/dist/components/VvAction/VvAction.es.js +26 -26
  3. package/dist/components/VvAction/VvAction.umd.js +1 -1
  4. package/dist/components/VvAction/index.d.ts +1 -44
  5. package/dist/components/VvAlert/VvAlert.es.js +43 -44
  6. package/dist/components/VvAlert/VvAlert.umd.js +1 -1
  7. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  8. package/dist/components/VvAlertGroup/VvAlertGroup.es.js +54 -55
  9. package/dist/components/VvAlertGroup/VvAlertGroup.umd.js +1 -1
  10. package/dist/components/VvBreadcrumb/VvBreadcrumb.es.js +34 -34
  11. package/dist/components/VvBreadcrumb/VvBreadcrumb.umd.js +1 -1
  12. package/dist/components/VvBreadcrumb/VvBreadcrumb.vue.d.ts +1 -1
  13. package/dist/components/VvButton/VvButton.es.js +186 -187
  14. package/dist/components/VvButton/VvButton.umd.js +1 -1
  15. package/dist/components/VvCheckbox/VvCheckbox.es.js +215 -217
  16. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  17. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +235 -237
  18. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  19. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +2 -2
  20. package/dist/components/VvCheckboxGroup/index.d.ts +1 -78
  21. package/dist/components/VvCombobox/VvCombobox.es.js +810 -813
  22. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  23. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +1 -1
  24. package/dist/components/VvCombobox/index.d.ts +2 -2
  25. package/dist/components/VvDropdown/VvDropdown.es.js +4 -4
  26. package/dist/components/VvDropdown/VvDropdown.umd.js +1 -1
  27. package/dist/components/VvDropdownAction/VvDropdownAction.es.js +50 -50
  28. package/dist/components/VvDropdownAction/VvDropdownAction.umd.js +1 -1
  29. package/dist/components/VvIcon/VvIcon.es.js +30 -31
  30. package/dist/components/VvIcon/VvIcon.umd.js +1 -1
  31. package/dist/components/VvInputFile/VvInputFile.es.js +415 -418
  32. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  33. package/dist/components/VvInputText/VvInputText.es.js +595 -588
  34. package/dist/components/VvInputText/VvInputText.umd.js +1 -1
  35. package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
  36. package/dist/components/VvInputText/index.d.ts +3 -3
  37. package/dist/components/VvNav/VvNav.es.js +63 -63
  38. package/dist/components/VvNav/VvNav.umd.js +1 -1
  39. package/dist/components/VvNavItem/VvNavItem.es.js +41 -41
  40. package/dist/components/VvNavItem/VvNavItem.umd.js +1 -1
  41. package/dist/components/VvRadio/VvRadio.es.js +222 -224
  42. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  43. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +234 -236
  44. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  45. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +2 -2
  46. package/dist/components/VvRadioGroup/index.d.ts +1 -78
  47. package/dist/components/VvSelect/VvSelect.es.js +200 -203
  48. package/dist/components/VvSelect/VvSelect.umd.js +1 -1
  49. package/dist/components/VvSelect/VvSelect.vue.d.ts +1 -1
  50. package/dist/components/VvSelect/index.d.ts +2 -2
  51. package/dist/components/VvTab/VvTab.es.js +35 -35
  52. package/dist/components/VvTab/VvTab.umd.js +1 -1
  53. package/dist/components/VvTextarea/VvTextarea.es.js +341 -344
  54. package/dist/components/VvTextarea/VvTextarea.umd.js +1 -1
  55. package/dist/components/index.es.js +1965 -1958
  56. package/dist/components/index.umd.js +1 -1
  57. package/dist/composables/index.es.js +34 -34
  58. package/dist/composables/index.umd.js +2 -2
  59. package/dist/composables/useModifiers.d.ts +1 -1
  60. package/dist/constants.d.ts +2 -2
  61. package/dist/directives/index.es.js +22 -22
  62. package/dist/directives/index.umd.js +1 -1
  63. package/dist/directives/v-contextmenu.es.js +13 -13
  64. package/dist/directives/v-contextmenu.umd.js +1 -1
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.es.js +19 -19
  67. package/dist/index.umd.js +1 -1
  68. package/dist/json-render/index.es.js +1877 -1870
  69. package/dist/json-render/index.umd.js +1 -1
  70. package/dist/props/index.d.ts +1 -1
  71. package/dist/resolvers/unplugin.es.js +28 -28
  72. package/dist/resolvers/unplugin.umd.js +1 -1
  73. package/dist/types/alert.d.ts +1 -1
  74. package/dist/types/nav.d.ts +1 -1
  75. package/dist/utils/ObjectUtilities.d.ts +0 -6
  76. package/package.json +1 -1
  77. package/src/Volver.ts +8 -6
  78. package/src/components/VvAction/index.ts +1 -3
  79. package/src/components/VvButton/VvButton.vue +1 -1
  80. package/src/components/VvCheckboxGroup/index.ts +1 -3
  81. package/src/components/VvCombobox/VvCombobox.vue +3 -3
  82. package/src/components/VvDropdown/VvDropdown.vue +8 -8
  83. package/src/components/VvIcon/VvIcon.vue +3 -6
  84. package/src/components/VvInputFile/VvInputFile.vue +6 -6
  85. package/src/components/VvInputText/VvInputText.vue +95 -78
  86. package/src/components/VvRadioGroup/index.ts +1 -3
  87. package/src/composables/useBlurhash.ts +1 -1
  88. package/src/composables/useDebouncedInput.ts +1 -1
  89. package/src/composables/useDefaults.ts +55 -44
  90. package/src/composables/useModifiers.ts +1 -1
  91. package/src/index.ts +2 -2
  92. package/src/resolvers/unplugin.ts +6 -6
  93. package/src/types/alert.ts +1 -1
  94. package/src/types/nav.ts +1 -1
  95. package/src/utils/DateUtilities.ts +3 -3
  96. package/src/utils/DomUtilities.ts +7 -1
  97. package/src/utils/ObjectUtilities.ts +60 -59
@@ -728,7 +728,7 @@ export declare const CheckboxRadioGroupProps: {
728
728
  * Input value
729
729
  */
730
730
  modelValue: {
731
- type: (SymbolConstructor | ArrayConstructor | NumberConstructor | BooleanConstructor | StringConstructor)[];
731
+ type: (SymbolConstructor | NumberConstructor | ArrayConstructor | BooleanConstructor | StringConstructor)[];
732
732
  default: undefined;
733
733
  };
734
734
  /**
@@ -1,27 +1,27 @@
1
1
  var E = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), h = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), L = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), w = /[^\p{L}\d]+/giu, u = "$1\0$2", f = "";
2
- function a(e) {
2
+ function d(e) {
3
3
  let r = e.trim();
4
4
  r = r.replace(E, u).replace(h, u), r = r.replace(w, "\0");
5
- let o = 0, t = r.length;
6
- for (; r.charAt(o) === "\0"; ) o++;
7
- if (o === t) return [];
8
- for (; r.charAt(t - 1) === "\0"; ) t--;
9
- return r.slice(o, t).split(/\0/g);
5
+ let t = 0, o = r.length;
6
+ for (; r.charAt(t) === "\0"; ) t++;
7
+ if (t === o) return [];
8
+ for (; r.charAt(o - 1) === "\0"; ) o--;
9
+ return r.slice(t, o).split(/\0/g);
10
10
  }
11
11
  function g(e) {
12
- const r = a(e);
13
- for (let o = 0; o < r.length; o++) {
14
- const t = r[o], s = L.exec(t);
12
+ const r = d(e);
13
+ for (let t = 0; t < r.length; t++) {
14
+ const o = r[t], s = L.exec(o);
15
15
  if (s) {
16
16
  const n = s.index + (s[1] ?? s[2]).length;
17
- r.splice(o, 1, t.slice(0, n), t.slice(n));
17
+ r.splice(t, 1, o.slice(0, n), o.slice(n));
18
18
  }
19
19
  }
20
20
  return r;
21
21
  }
22
22
  function x(e, r) {
23
- const [o, t, s] = _(e, r);
24
- return o + t.map(R(r?.locale)).join(r?.delimiter ?? " ") + s;
23
+ const [t, o, s] = _(e, r);
24
+ return t + o.map(R(r?.locale)).join(r?.delimiter ?? " ") + s;
25
25
  }
26
26
  function l(e, r) {
27
27
  return x(e, {
@@ -33,11 +33,11 @@ function R(e) {
33
33
  return e === !1 ? (r) => r.toLowerCase() : (r) => r.toLocaleLowerCase(e);
34
34
  }
35
35
  function _(e, r = {}) {
36
- const o = r.split ?? (r.separateNumbers ? g : a), t = r.prefixCharacters ?? f, s = r.suffixCharacters ?? f;
36
+ const t = r.split ?? (r.separateNumbers ? g : d), o = r.prefixCharacters ?? f, s = r.suffixCharacters ?? f;
37
37
  let n = 0, v = e.length;
38
38
  for (; n < e.length; ) {
39
39
  const c = e.charAt(n);
40
- if (!t.includes(c)) break;
40
+ if (!o.includes(c)) break;
41
41
  n++;
42
42
  }
43
43
  for (; v > n; ) {
@@ -47,13 +47,13 @@ function _(e, r = {}) {
47
47
  }
48
48
  return [
49
49
  e.slice(0, n),
50
- o(e.slice(n, v)),
50
+ t(e.slice(n, v)),
51
51
  e.slice(v)
52
52
  ];
53
53
  }
54
- var P = ["vv-icon", "vv-action"], d = "vv", C = ["v-tooltip", "v-contextmenu"];
54
+ var P = /* @__PURE__ */ new Set(["vv-icon", "vv-action"]), a = "vv", C = /* @__PURE__ */ new Set(["v-tooltip", "v-contextmenu"]);
55
55
  function A(e) {
56
- if (!P.includes(e))
56
+ if (!P.has(e))
57
57
  return e === "vv-dropdown" ? [
58
58
  "vv-dropdown",
59
59
  "vv-dropdown-option",
@@ -67,20 +67,20 @@ function A(e) {
67
67
  ] : e === "vv-button-group" ? ["vv-button", "vv-button-group"] : e === "vv-accordion-group" ? ["vv-accordion", "vv-accordion-group"] : e === "vv-checkbox-group" ? ["vv-checkbox", "vv-checkbox-group"] : e === "vv-radio-group" ? ["vv-radio", "vv-radio-group"] : e === "vv-alert-group" ? ["vv-alert", "vv-alert-group"] : e === "v-tooltip" ? ["vv-tooltip"] : [e];
68
68
  }
69
69
  function i(e, r) {
70
- const o = [];
71
- if (!r) return o;
72
- const t = A(e);
73
- return t && t.forEach((s) => {
74
- o.push(`@volverjs/style/${r === "scss" ? "scss/" : ""}components/${s}`);
75
- }), o;
70
+ const t = [];
71
+ if (!r) return t;
72
+ const o = A(e);
73
+ return o && o.forEach((s) => {
74
+ t.push(`@volverjs/style/${r === "scss" ? "scss/" : ""}components/${s}`);
75
+ }), t;
76
76
  }
77
- function I({ prefix: e = d, importStyle: r, directives: o, ignore: t, cherryPick: s } = {}) {
77
+ function I({ prefix: e = a, importStyle: r, directives: t, ignore: o, cherryPick: s } = {}) {
78
78
  return [{
79
79
  type: "component",
80
80
  resolve: (n) => {
81
81
  if (!e || !n.toLowerCase().startsWith(e.toLowerCase())) return;
82
- const v = l(n).replace(`${e}-`, `${d}-`);
83
- if (!(t && t.includes(v)))
82
+ const v = l(n).replace(`${e}-`, `${a}-`);
83
+ if (!o?.includes(v))
84
84
  return s ? {
85
85
  from: `@volverjs/ui-vue/${v}`,
86
86
  sideEffects: i(v, r)
@@ -93,9 +93,9 @@ function I({ prefix: e = d, importStyle: r, directives: o, ignore: t, cherryPick
93
93
  }, {
94
94
  type: "directive",
95
95
  resolve: (n) => {
96
- if (!o) return;
96
+ if (!t) return;
97
97
  const v = `v-${l(n)}`;
98
- if (C.includes(v) && !(t && t.includes(v)))
98
+ if (C.has(v) && !o?.includes(v))
99
99
  return s ? {
100
100
  from: `@volverjs/ui-vue/${v}`,
101
101
  sideEffects: i(v, r)
@@ -1 +1 @@
1
- (function(v,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(v=typeof globalThis<"u"?globalThis:v||self,c(v.components={}))})(this,function(v){Object.defineProperty(v,Symbol.toStringTag,{value:"Module"});var c=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),L=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),g=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),w=/[^\p{L}\d]+/giu,l="$1\0$2",d="";function a(r){let e=r.trim();e=e.replace(c,l).replace(L,l),e=e.replace(w,"\0");let o=0,t=e.length;for(;e.charAt(o)==="\0";)o++;if(o===t)return[];for(;e.charAt(t-1)==="\0";)t--;return e.slice(o,t).split(/\0/g)}function R(r){const e=a(r);for(let o=0;o<e.length;o++){const t=e[o],s=g.exec(t);if(s){const n=s.index+(s[1]??s[2]).length;e.splice(o,1,t.slice(0,n),t.slice(n))}}return e}function x(r,e){const[o,t,s]=P(r,e);return o+t.map(_(e?.locale)).join(e?.delimiter??" ")+s}function p(r,e){return x(r,{delimiter:"-",...e})}function _(r){return r===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(r)}function P(r,e={}){const o=e.split??(e.separateNumbers?R:a),t=e.prefixCharacters??d,s=e.suffixCharacters??d;let n=0,i=r.length;for(;n<r.length;){const f=r.charAt(n);if(!t.includes(f))break;n++}for(;i>n;){const f=i-1,A=r.charAt(f);if(!s.includes(A))break;i=f}return[r.slice(0,n),o(r.slice(n,i)),r.slice(i)]}var C=["vv-icon","vv-action"],E="vv",T=["v-tooltip","v-contextmenu"];function h(r){if(!C.includes(r))return r==="vv-dropdown"?["vv-dropdown","vv-dropdown-option","vv-dropdown-action"]:r==="vv-combobox"?["vv-select","vv-dropdown-option","vv-dropdown-optgroup","vv-dropdown","vv-dropdown-action"]:r==="vv-button-group"?["vv-button","vv-button-group"]:r==="vv-accordion-group"?["vv-accordion","vv-accordion-group"]:r==="vv-checkbox-group"?["vv-checkbox","vv-checkbox-group"]:r==="vv-radio-group"?["vv-radio","vv-radio-group"]:r==="vv-alert-group"?["vv-alert","vv-alert-group"]:r==="v-tooltip"?["vv-tooltip"]:[r]}function u(r,e){const o=[];if(!e)return o;const t=h(r);return t&&t.forEach(s=>{o.push(`@volverjs/style/${e==="scss"?"scss/":""}components/${s}`)}),o}function S({prefix:r=E,importStyle:e,directives:o,ignore:t,cherryPick:s}={}){return[{type:"component",resolve:n=>{if(!r||!n.toLowerCase().startsWith(r.toLowerCase()))return;const i=p(n).replace(`${r}-`,`${E}-`);if(!(t&&t.includes(i)))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/components",sideEffects:u(i,e),name:n}}},{type:"directive",resolve:n=>{if(!o)return;const i=`v-${p(n)}`;if(T.includes(i)&&!(t&&t.includes(i)))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/directives",sideEffects:u(i,e),name:`v${n}`}}}]}v.VolverResolver=S,v.getStyleNames=h});
1
+ (function(v,c){typeof exports=="object"&&typeof module<"u"?c(exports):typeof define=="function"&&define.amd?define(["exports"],c):(v=typeof globalThis<"u"?globalThis:v||self,c(v.components={}))})(this,function(v){Object.defineProperty(v,Symbol.toStringTag,{value:"Module"});var c=new RegExp("([\\p{Ll}\\d])(\\p{Lu})","gu"),L=new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])","gu"),g=new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d","u"),w=/[^\p{L}\d]+/giu,l="$1\0$2",d="";function a(r){let e=r.trim();e=e.replace(c,l).replace(L,l),e=e.replace(w,"\0");let t=0,o=e.length;for(;e.charAt(t)==="\0";)t++;if(t===o)return[];for(;e.charAt(o-1)==="\0";)o--;return e.slice(t,o).split(/\0/g)}function R(r){const e=a(r);for(let t=0;t<e.length;t++){const o=e[t],s=g.exec(o);if(s){const n=s.index+(s[1]??s[2]).length;e.splice(t,1,o.slice(0,n),o.slice(n))}}return e}function x(r,e){const[t,o,s]=P(r,e);return t+o.map(_(e?.locale)).join(e?.delimiter??" ")+s}function p(r,e){return x(r,{delimiter:"-",...e})}function _(r){return r===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(r)}function P(r,e={}){const t=e.split??(e.separateNumbers?R:a),o=e.prefixCharacters??d,s=e.suffixCharacters??d;let n=0,i=r.length;for(;n<r.length;){const f=r.charAt(n);if(!o.includes(f))break;n++}for(;i>n;){const f=i-1,A=r.charAt(f);if(!s.includes(A))break;i=f}return[r.slice(0,n),t(r.slice(n,i)),r.slice(i)]}var C=new Set(["vv-icon","vv-action"]),E="vv",S=new Set(["v-tooltip","v-contextmenu"]);function h(r){if(!C.has(r))return r==="vv-dropdown"?["vv-dropdown","vv-dropdown-option","vv-dropdown-action"]:r==="vv-combobox"?["vv-select","vv-dropdown-option","vv-dropdown-optgroup","vv-dropdown","vv-dropdown-action"]:r==="vv-button-group"?["vv-button","vv-button-group"]:r==="vv-accordion-group"?["vv-accordion","vv-accordion-group"]:r==="vv-checkbox-group"?["vv-checkbox","vv-checkbox-group"]:r==="vv-radio-group"?["vv-radio","vv-radio-group"]:r==="vv-alert-group"?["vv-alert","vv-alert-group"]:r==="v-tooltip"?["vv-tooltip"]:[r]}function u(r,e){const t=[];if(!e)return t;const o=h(r);return o&&o.forEach(s=>{t.push(`@volverjs/style/${e==="scss"?"scss/":""}components/${s}`)}),t}function T({prefix:r=E,importStyle:e,directives:t,ignore:o,cherryPick:s}={}){return[{type:"component",resolve:n=>{if(!r||!n.toLowerCase().startsWith(r.toLowerCase()))return;const i=p(n).replace(`${r}-`,`${E}-`);if(!o?.includes(i))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/components",sideEffects:u(i,e),name:n}}},{type:"directive",resolve:n=>{if(!t)return;const i=`v-${p(n)}`;if(S.has(i)&&!o?.includes(i))return s?{from:`@volverjs/ui-vue/${i}`,sideEffects:u(i,e)}:{from:"@volverjs/ui-vue/directives",sideEffects:u(i,e),name:`v${n}`}}}]}v.VolverResolver=T,v.getStyleNames=h});
@@ -1,6 +1,6 @@
1
1
  import type { VvIconProps } from '@/components/VvIcon';
2
2
  import type { AlertRole } from '@/constants';
3
- export type AlertModifier = 'success' | 'info' | 'warning' | 'danger' | 'brand' | 'accent' | string;
3
+ export type AlertModifier = 'success' | 'info' | 'warning' | 'danger' | 'brand' | 'accent' | (string & {});
4
4
  export type Alert = {
5
5
  id: string | number;
6
6
  title?: string;
@@ -9,7 +9,7 @@ export type NavItem = {
9
9
  disabled?: boolean;
10
10
  current?: boolean;
11
11
  class?: string | string[];
12
- on?: Record<'click' | string, () => void>;
12
+ on?: Record<'click' | (string & {}), () => void>;
13
13
  data?: Record<string, unknown>;
14
14
  };
15
15
  export type NavItemTab = NavItem & {
@@ -7,12 +7,6 @@ import type { Ref } from 'vue';
7
7
  * @returns {boolean}
8
8
  */
9
9
  export declare function equals(obj1: any, obj2: any, field?: string): boolean;
10
- /**
11
- * Compare objects, primitives, array, dates, regexp
12
- * @param {any} a first literal
13
- * @param {any} b second literal
14
- * @returns {boolean}
15
- */
16
10
  export declare function deepEquals(a: any, b: any): boolean;
17
11
  /**
18
12
  * Find and return field or nested field from object (also nested dotted field)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@volverjs/ui-vue",
3
3
  "type": "module",
4
- "version": "0.0.14",
4
+ "version": "0.0.15",
5
5
  "description": "@volverjs/ui-vue is a lightweight Vue 3 component library to accompany @volverjs/style.",
6
6
  "author": "8 wave S.r.l.",
7
7
  "license": "MIT",
package/src/Volver.ts CHANGED
@@ -9,6 +9,8 @@ import {
9
9
  import { kebabCase } from 'change-case'
10
10
  import { DEFAULT_ICONIFY_PROVIDER, INJECTION_KEY_VOLVER } from './constants'
11
11
 
12
+ const DEFAULT_FETCH_ICON_OPTIONS: RequestInit = { cache: 'force-cache' }
13
+
12
14
  export function useDefaultProps(
13
15
  component: Component,
14
16
  defaults?: Record<string, unknown>,
@@ -171,11 +173,11 @@ export interface VolverInterface {
171
173
  }
172
174
 
173
175
  export class Volver implements VolverInterface {
174
- private _fetchOptions: RequestInit = {}
175
- private _iconsCollections: IconifyJSON[] = []
176
- private _iconsProvider = DEFAULT_ICONIFY_PROVIDER
177
- private _nuxt = false
178
- private _experimentalFeatures: VolverExperimentalFeatures = {}
176
+ private readonly _fetchOptions: RequestInit = {}
177
+ private readonly _iconsCollections: IconifyJSON[] = []
178
+ private readonly _iconsProvider: string = DEFAULT_ICONIFY_PROVIDER
179
+ private readonly _nuxt: boolean = false
180
+ private readonly _experimentalFeatures: VolverExperimentalFeatures = {}
179
181
 
180
182
  defaults: Ref<DefaultOptions> = ref({})
181
183
 
@@ -260,7 +262,7 @@ export class Volver implements VolverInterface {
260
262
 
261
263
  async fetchIcon(
262
264
  src: string,
263
- options: RequestInit = { cache: 'force-cache' },
265
+ options: RequestInit = DEFAULT_FETCH_ICON_OPTIONS,
264
266
  ): Promise<string | undefined> {
265
267
  const response = await fetch(src, {
266
268
  ...this._fetchOptions,
@@ -1,5 +1,3 @@
1
- import { ActionProps } from '../../props'
2
-
3
1
  export const VvActionEvents = ['click', 'mouseover', 'mouseleave']
4
2
 
5
- export const VvActionProps = ActionProps
3
+ export { ActionProps as VvActionProps } from '../../props'
@@ -78,7 +78,7 @@ const { hasIcon } = useComponentIcon(icon)
78
78
  * @description Catch click event
79
79
  */
80
80
  const toggleValue = computed(() => {
81
- return props.value !== undefined ? props.value : name.value
81
+ return props.value === undefined ? name.value : props.value
82
82
  })
83
83
  const hasListeners = computed(() => {
84
84
  if (!toggle.value) {
@@ -1,5 +1,3 @@
1
- import { CheckboxRadioGroupProps } from '../../props'
2
-
3
- export const VvCheckboxGroupProps = CheckboxRadioGroupProps
1
+ export { CheckboxRadioGroupProps as VvCheckboxGroupProps } from '../../props'
4
2
 
5
3
  export const VvCheckboxGroupEvents = ['update:modelValue', 'change']
@@ -398,10 +398,10 @@ function onInput(option: string | Option) {
398
398
  return item !== optionValue
399
399
  })
400
400
  } else if (!isSelected && isSelectable.value) {
401
- if (!props.multiple) {
402
- localModelValue.value = [optionValue]
403
- } else {
401
+ if (props.multiple) {
404
402
  localModelValue.value = [...localModelValue.value, optionValue]
403
+ } else {
404
+ localModelValue.value = [optionValue]
405
405
  }
406
406
  }
407
407
  if (!props.multiple && !props.keepOpen) {
@@ -69,14 +69,14 @@ onMounted(() => {
69
69
  floatingEl.value,
70
70
  () => {
71
71
  hasCustomPosition.value
72
- = window
72
+ = globalThis
73
73
  .getComputedStyle(floatingEl.value)
74
74
  .getPropertyValue('--dropdown-custom-position')
75
75
  ?.trim() === 'true'
76
76
  },
77
77
  {
78
78
  attributeFilter: ['style'],
79
- window,
79
+ window: globalThis.window,
80
80
  },
81
81
  )
82
82
  })
@@ -216,13 +216,13 @@ const arrowPlacement = computed(() => {
216
216
  }[side.value]
217
217
  return {
218
218
  left:
219
- middlewareData.value.arrow?.x !== undefined
220
- ? `${middlewareData.value.arrow?.x}px`
221
- : undefined,
219
+ middlewareData.value.arrow?.x === undefined
220
+ ? undefined
221
+ : `${middlewareData.value.arrow?.x}px`,
222
222
  top:
223
- middlewareData.value.arrow?.y !== undefined
224
- ? `${middlewareData.value.arrow?.y}px`
225
- : undefined,
223
+ middlewareData.value.arrow?.y === undefined
224
+ ? undefined
225
+ : `${middlewareData.value.arrow?.y}px`,
226
226
  [staticSide]: `${-(arrowEl.value?.offsetWidth ?? 0) / 2}px`,
227
227
  }
228
228
  })
@@ -59,15 +59,12 @@ const icon = computed(() => {
59
59
  * @return {SVGSVGElement | null} https://developer.mozilla.org/en-US/docs/Web/API/SVGSVGElement
60
60
  */
61
61
  function getSvgContent(svg: string): SVGSVGElement | null {
62
- const domParser = typeof window !== 'undefined'
63
- ? new window.DOMParser()
64
- : null
65
- if (!domParser) {
62
+ if (globalThis.window === undefined) {
66
63
  return null
67
64
  }
65
+ const domParser = new globalThis.DOMParser()
68
66
  const svgDomString = domParser.parseFromString(svg, 'text/html')
69
- const svgEl = svgDomString.querySelector('svg')
70
- return svgEl
67
+ return svgDomString.querySelector('svg')
71
68
  }
72
69
 
73
70
  /**
@@ -176,7 +176,7 @@ function onClickDropArea() {
176
176
  }
177
177
 
178
178
  function onRemoveIndex(index: number) {
179
- const toRemove = !Array.isArray(localModelValue.value) ? localModelValue.value : localModelValue.value[index]
179
+ const toRemove = Array.isArray(localModelValue.value) ? localModelValue.value[index] : localModelValue.value
180
180
  if (!toRemove) {
181
181
  return
182
182
  }
@@ -194,7 +194,7 @@ function onRemoveIndex(index: number) {
194
194
  }
195
195
 
196
196
  const selectedFileIndex = ref(0)
197
- const PREVIEW_MIME_TYPES = ['image/jpeg', 'image/png']
197
+ const PREVIEW_MIME_TYPES = new Set(['image/jpeg', 'image/png'])
198
198
  const previewSrc = computed(() => {
199
199
  if (props.hidePreview) {
200
200
  return undefined
@@ -207,7 +207,7 @@ const previewSrc = computed(() => {
207
207
  }
208
208
  if (files.value[selectedFileIndex.value] instanceof File) {
209
209
  const currentFile = files.value[selectedFileIndex.value] as File
210
- if (!PREVIEW_MIME_TYPES.includes(currentFile.type)) {
210
+ if (!PREVIEW_MIME_TYPES.has(currentFile.type)) {
211
211
  return undefined
212
212
  }
213
213
  return URL.createObjectURL(currentFile)
@@ -216,7 +216,7 @@ const previewSrc = computed(() => {
216
216
  if (currentFile.thumbnailUrl) {
217
217
  return currentFile.thumbnailUrl
218
218
  }
219
- if (!PREVIEW_MIME_TYPES.includes(currentFile.type)) {
219
+ if (!PREVIEW_MIME_TYPES.has(currentFile.type)) {
220
220
  return undefined
221
221
  }
222
222
  return currentFile.url
@@ -241,7 +241,7 @@ function formatBytes(bytes?: number, decimals?: number) {
241
241
  if (bytes === 0)
242
242
  return '0 Bytes'
243
243
  const k = 1024
244
- const dm = !decimals ? 2 : decimals <= 0 ? 0 : decimals
244
+ const dm = Math.max(0, decimals ?? 2)
245
245
  const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
246
246
  const i = Math.floor(Math.log(bytes) / Math.log(k))
247
247
  return `${Number.parseFloat((bytes / (k ** i)).toFixed(dm))} ${sizes[i]}`
@@ -258,7 +258,7 @@ function onDownloadFile(file: File | UploadedFile) {
258
258
  link.setAttribute('download', file.name)
259
259
  document.body.appendChild(link)
260
260
  link.click()
261
- document.body.removeChild(link)
261
+ link.remove()
262
262
  URL.revokeObjectURL(link.href)
263
263
  }
264
264
 
@@ -20,6 +20,8 @@ import {
20
20
  } from '../VvInputText'
21
21
  import VvInputTextActionsFactory from '../VvInputText/VvInputTextActions'
22
22
 
23
+ type SuggestionValue = string | number | Date
24
+
23
25
  // props, emit, slots and attrs
24
26
  const props = defineProps(VvInputTextProps)
25
27
 
@@ -117,80 +119,14 @@ const { el, mask, typed, masked, unmasked } = useIMask(
117
119
  }
118
120
  emit('update:masked', masked.value)
119
121
  if (type.value === INPUT_TYPES.NUMBER) {
120
- if (MASK_NUMBER_REGEX.test(unmasked.value)) {
121
- if (
122
- localModelValue.value === null
123
- || localModelValue.value === undefined
124
- ) {
125
- return
126
- }
127
- localModelValue.value = undefined
128
- return
129
- }
130
- if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
131
- localModelValue.value = 0
132
- return
133
- }
134
- if (typeof typed.value !== 'number') {
135
- localModelValue.value = Number(typed.value)
136
- return
137
- }
138
- localModelValue.value = typed.value
122
+ handleNumberAccept()
139
123
  return
140
124
  }
141
125
  if (type.value === INPUT_TYPES.DATETIME_LOCAL
142
126
  || type.value === INPUT_TYPES.DATE
143
127
  || type.value === INPUT_TYPES.TIME
144
128
  || type.value === INPUT_TYPES.MONTH) {
145
- if (!typed.value) {
146
- if (!localModelValue.value) {
147
- return
148
- }
149
- if (modelValueDate.value) {
150
- localModelValue.value = undefined
151
- return
152
- }
153
- localModelValue.value = ''
154
- return
155
- }
156
- if (!(typed.value instanceof Date) && !modelValueDate.value && !modelValueDateIsoString.value) {
157
- localModelValue.value = typed.value
158
- return
159
- }
160
-
161
- let date = typed.value
162
- if (!(date instanceof Date)) {
163
- date = getDateFromInputValue(typed.value, type.value)
164
- }
165
- if (modelValueDate.value || modelValueDateIsoString.value) {
166
- const toReturn = new Date(modelValueDate.value || modelValueDateIsoString.value as string)
167
- if (type.value === INPUT_TYPES.DATETIME_LOCAL
168
- || type.value === INPUT_TYPES.DATE
169
- || type.value === INPUT_TYPES.MONTH) {
170
- toReturn.setFullYear(date.getFullYear())
171
- toReturn.setMonth(date.getMonth())
172
- }
173
- if (type.value === INPUT_TYPES.DATETIME_LOCAL
174
- || type.value === INPUT_TYPES.DATE) {
175
- toReturn.setDate(date.getDate())
176
- }
177
- if (type.value === INPUT_TYPES.DATETIME_LOCAL
178
- || type.value === INPUT_TYPES.TIME) {
179
- toReturn.setHours(date.getHours())
180
- toReturn.setMinutes(date.getMinutes())
181
- toReturn.setSeconds(date.getSeconds())
182
- }
183
- if (modelValueDate.value instanceof Date) {
184
- if (localModelValue.value?.getTime() === toReturn.getTime()) {
185
- return
186
- }
187
- localModelValue.value = toReturn
188
- return
189
- }
190
- localModelValue.value = toReturn.toISOString()
191
- return
192
- }
193
- localModelValue.value = getInputValueFromDate(date, type.value, hasSeconds.value)
129
+ handleDateAccept()
194
130
  return
195
131
  }
196
132
  if (!localModelValue.value && !unmasked.value) {
@@ -200,7 +136,88 @@ const { el, mask, typed, masked, unmasked } = useIMask(
200
136
  },
201
137
  },
202
138
  )
203
- function updateMaskValue(newValue: string | number | Date | undefined | null) {
139
+
140
+ function handleNumberAccept() {
141
+ if (MASK_NUMBER_REGEX.test(unmasked.value)) {
142
+ if (
143
+ localModelValue.value === null
144
+ || localModelValue.value === undefined
145
+ ) {
146
+ return
147
+ }
148
+ localModelValue.value = undefined
149
+ return
150
+ }
151
+ if (NEGATIVE_ZERO_REGEX.test(unmasked.value)) {
152
+ localModelValue.value = 0
153
+ return
154
+ }
155
+ if (typeof typed.value !== 'number') {
156
+ localModelValue.value = Number(typed.value)
157
+ return
158
+ }
159
+ localModelValue.value = typed.value
160
+ }
161
+
162
+ function mergeDateIntoModelValue(date: Date) {
163
+ const toReturn = new Date(modelValueDate.value || modelValueDateIsoString.value as string)
164
+ if (type.value === INPUT_TYPES.DATETIME_LOCAL
165
+ || type.value === INPUT_TYPES.DATE
166
+ || type.value === INPUT_TYPES.MONTH) {
167
+ toReturn.setFullYear(date.getFullYear())
168
+ toReturn.setMonth(date.getMonth())
169
+ }
170
+ if (type.value === INPUT_TYPES.DATETIME_LOCAL
171
+ || type.value === INPUT_TYPES.DATE) {
172
+ toReturn.setDate(date.getDate())
173
+ }
174
+ if (type.value === INPUT_TYPES.DATETIME_LOCAL
175
+ || type.value === INPUT_TYPES.TIME) {
176
+ toReturn.setHours(date.getHours())
177
+ toReturn.setMinutes(date.getMinutes())
178
+ toReturn.setSeconds(date.getSeconds())
179
+ }
180
+ if (modelValueDate.value instanceof Date) {
181
+ if (localModelValue.value?.getTime() === toReturn.getTime()) {
182
+ return
183
+ }
184
+ localModelValue.value = toReturn
185
+ return
186
+ }
187
+ localModelValue.value = toReturn.toISOString()
188
+ }
189
+
190
+ function handleDateAccept() {
191
+ // onAccept only calls this for date-like input types
192
+ const dateType = type.value as 'date' | 'time' | 'month' | 'datetime-local'
193
+ if (!typed.value) {
194
+ if (!localModelValue.value) {
195
+ return
196
+ }
197
+ if (modelValueDate.value) {
198
+ localModelValue.value = undefined
199
+ return
200
+ }
201
+ localModelValue.value = ''
202
+ return
203
+ }
204
+ if (!(typed.value instanceof Date) && !modelValueDate.value && !modelValueDateIsoString.value) {
205
+ localModelValue.value = typed.value
206
+ return
207
+ }
208
+
209
+ let date = typed.value
210
+ if (!(date instanceof Date)) {
211
+ date = getDateFromInputValue(typed.value, dateType)
212
+ }
213
+ if (modelValueDate.value || modelValueDateIsoString.value) {
214
+ mergeDateIntoModelValue(date)
215
+ return
216
+ }
217
+ localModelValue.value = getInputValueFromDate(date, dateType, hasSeconds.value)
218
+ }
219
+
220
+ function updateMaskValue(newValue: SuggestionValue | undefined | null) {
204
221
  // Handle empty values
205
222
  if (newValue === undefined || newValue === null) {
206
223
  typed.value = ''
@@ -439,13 +456,13 @@ const isInvalid = computed(() => {
439
456
 
440
457
  // suggestions
441
458
  const storageKey = computed(() => props.storageKey ?? (volver?.experimentalFeatures.forceInputSuggestions ? props.name : undefined))
442
- const storageSuggestions = usePersistence<Set<string | number | Date>>(
459
+ const storageSuggestions = usePersistence<Set<SuggestionValue>>(
443
460
  storageKey,
444
461
  storageType,
445
462
  new Set(),
446
463
  )
447
464
  const allSuggestions = computed(() => {
448
- const merged = new Map<string | number | Date, { isFromStorage: boolean }>()
465
+ const merged = new Map<SuggestionValue, { isFromStorage: boolean }>()
449
466
 
450
467
  // Add storage suggestions
451
468
  if (storageSuggestions.value) {
@@ -483,12 +500,12 @@ const hasSuggestions = computed(
483
500
  () =>
484
501
  allSuggestions.value.size > 0,
485
502
  )
486
- function onSuggestionSelect(suggestion: string | number | Date) {
503
+ function onSuggestionSelect(suggestion: SuggestionValue) {
487
504
  localModelValue.value = suggestion
488
505
  suggestionsDropdownEl.value?.hide()
489
506
  emit('suggestion:selected', suggestion)
490
507
  }
491
- function onSuggestionRemove(suggestion: string | number | Date) {
508
+ function onSuggestionRemove(suggestion: SuggestionValue) {
492
509
  // Only remove from storage if it came from storage
493
510
  if (allSuggestions.value.get(suggestion)?.isFromStorage) {
494
511
  storageSuggestions.value?.delete(suggestion)
@@ -588,8 +605,8 @@ const hasAttrs = computed(() => {
588
605
  max = '9999-12-31'
589
606
  }
590
607
  toReturn.step = props.step
591
- toReturn.max = max !== undefined ? String(max) : undefined
592
- toReturn.min = props.min !== undefined ? String(props.min) : undefined
608
+ toReturn.max = max === undefined ? undefined : String(max)
609
+ toReturn.min = props.min === undefined ? undefined : String(props.min)
593
610
  }
594
611
 
595
612
  // Text-like types with placeholder
@@ -657,9 +674,9 @@ const hasStyle = computed(() => {
657
674
  return undefined
658
675
  }
659
676
  return {
660
- width: localModelValue.value !== undefined
661
- ? `${String(localModelValue.value).length + 1}ch`
662
- : undefined,
677
+ width: localModelValue.value === undefined
678
+ ? undefined
679
+ : `${String(localModelValue.value).length + 1}ch`,
663
680
  }
664
681
  })
665
682
 
@@ -1,5 +1,3 @@
1
- import { CheckboxRadioGroupProps } from '../../props'
2
-
3
- export const VvRadioGroupProps = CheckboxRadioGroupProps
1
+ export { CheckboxRadioGroupProps as VvRadioGroupProps } from '../../props'
4
2
 
5
3
  export const VvRadioGroupEvents = ['update:modelValue', 'change']
@@ -16,7 +16,7 @@ function loadImage(src: string): Promise<CanvasImageSource> {
16
16
  return new Promise((resolve, reject) => {
17
17
  const img = new Image()
18
18
  img.onload = () => resolve(img)
19
- img.onerror = (...args) => reject(args)
19
+ img.onerror = () => reject(new Error(`Failed to load image: ${src}`))
20
20
  img.src = src
21
21
  })
22
22
  }
@@ -26,7 +26,7 @@ export function useDebouncedInput(
26
26
  }
27
27
  timeout = setTimeout(() => {
28
28
  emit('update:modelValue', setter(value))
29
- }, ms as number)
29
+ }, ms)
30
30
  },
31
31
  })
32
32
  }