@volverjs/ui-vue 0.0.10-beta.4 → 0.0.10-beta.5

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/index.es.js CHANGED
@@ -21,25 +21,28 @@ function useDefaultProps(component, defaults, name) {
21
21
  return {
22
22
  ...component,
23
23
  name: componentName,
24
- props: Object.keys(props).reduce((acc, key) => {
25
- if (!(key in componentDefaults)) {
26
- acc[key] = props[key];
27
- return acc;
28
- }
29
- const customDefault = componentDefaults[key];
30
- if (typeof props[key] === "function" || Array.isArray(props[key])) {
24
+ props: Object.keys(props).reduce(
25
+ (acc, key) => {
26
+ if (!(key in componentDefaults)) {
27
+ acc[key] = props[key];
28
+ return acc;
29
+ }
30
+ const customDefault = componentDefaults[key];
31
+ if (typeof props[key] === "function" || Array.isArray(props[key])) {
32
+ acc[key] = {
33
+ type: props[key],
34
+ default: customDefault
35
+ };
36
+ return acc;
37
+ }
31
38
  acc[key] = {
32
- type: props[key],
39
+ ...props[key],
33
40
  default: customDefault
34
41
  };
35
42
  return acc;
36
- }
37
- acc[key] = {
38
- ...props[key],
39
- default: customDefault
40
- };
41
- return acc;
42
- }, {})
43
+ },
44
+ {}
45
+ )
43
46
  };
44
47
  }
45
48
  class Volver {
@@ -111,7 +114,7 @@ const VolverPlugin = {
111
114
  * @param {App} Vue
112
115
  * @param {Object} options
113
116
  */
114
- install(app, options) {
117
+ install(app, options = {}) {
115
118
  const volver = new Volver(options);
116
119
  app.config.globalProperties.$vv = volver;
117
120
  if (options.components) {
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@iconify/vue"),require("vue")):"function"==typeof define&&define.amd?define(["exports","@iconify/vue","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).volver={},e.vue$1,e.vue)}(this,(function(e,t,o){"use strict";var i=Object.defineProperty,n=(e,t,o)=>(((e,t,o)=>{t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o})(e,"symbol"!=typeof t?t+"":t,o),o);const r=Symbol.for("volver");function s(e,t,o){const i=o||e.name;if(!i)return e;const n=null==t?void 0:t[i],r=e.props;return n&&r?{...e,name:i,props:Object.keys(r).reduce(((e,t)=>{if(!(t in n))return e[t]=r[t],e;const o=n[t];return"function"==typeof r[t]||Array.isArray(r[t])?(e[t]={type:r[t],default:o},e):(e[t]={...r[t],default:o},e)}),{})}:{...e,name:i}}class c{constructor({fetchWithCredentials:e,fetchOptions:t,iconsProvider:i,nuxt:r,iconsCollections:s,defaults:c}={}){n(this,"_fetchOptions",{}),n(this,"_iconsCollections",[]),n(this,"_iconsProvider","vv"),n(this,"_nuxt",!1),n(this,"defaults",o.ref({})),t&&(this._fetchOptions=t),e&&(this._fetchOptions={...this._fetchOptions,credentials:"include"}),i&&(this._iconsProvider=i),r&&(this._nuxt=r),s&&Array.isArray(s)&&s.forEach((e=>{this.addCollection(e,this._iconsProvider)})),c&&(this.defaults.value=c)}get nuxt(){return this._nuxt}get iconsProvider(){return this._iconsProvider}get iconsCollections(){return this._iconsCollections}addCollection(e,o=this._iconsProvider){return this._iconsCollections.push(e),t.addCollection(e,o)}addIcon(e,o){return t.addIcon(e,o)}addIconsAPIProvider(e,o){return t.addAPIProvider(e,o)}fetchIcon(e,t={cache:"force-cache"}){return new Promise(((o,i)=>{fetch(e,{...this._fetchOptions,...t}).catch((e=>i(e))).then((e=>null==e?void 0:e.text())).then((e=>o(e)))}))}}const l={install(e,t){const o=new c(t);e.config.globalProperties.$vv=o,t.components&&Object.entries(t.components).forEach((([o,i])=>{e.component(o,s(i,t.defaults))})),t.aliases&&Object.entries(t.aliases).forEach((([o,i])=>{e.component(o,s(i,t.defaults,o))})),t.directives&&Object.entries(t.directives).forEach((([t,o])=>{e.directive(t,o)})),e.provide(r,o)}};e.VolverPlugin=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@iconify/vue"),require("vue")):"function"==typeof define&&define.amd?define(["exports","@iconify/vue","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).volver={},e.vue$1,e.vue)}(this,(function(e,t,o){"use strict";var i=Object.defineProperty,n=(e,t,o)=>(((e,t,o)=>{t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o})(e,"symbol"!=typeof t?t+"":t,o),o);const r=Symbol.for("volver");function s(e,t,o){const i=o||e.name;if(!i)return e;const n=null==t?void 0:t[i],r=e.props;return n&&r?{...e,name:i,props:Object.keys(r).reduce(((e,t)=>{if(!(t in n))return e[t]=r[t],e;const o=n[t];return"function"==typeof r[t]||Array.isArray(r[t])?(e[t]={type:r[t],default:o},e):(e[t]={...r[t],default:o},e)}),{})}:{...e,name:i}}class c{constructor({fetchWithCredentials:e,fetchOptions:t,iconsProvider:i,nuxt:r,iconsCollections:s,defaults:c}={}){n(this,"_fetchOptions",{}),n(this,"_iconsCollections",[]),n(this,"_iconsProvider","vv"),n(this,"_nuxt",!1),n(this,"defaults",o.ref({})),t&&(this._fetchOptions=t),e&&(this._fetchOptions={...this._fetchOptions,credentials:"include"}),i&&(this._iconsProvider=i),r&&(this._nuxt=r),s&&Array.isArray(s)&&s.forEach((e=>{this.addCollection(e,this._iconsProvider)})),c&&(this.defaults.value=c)}get nuxt(){return this._nuxt}get iconsProvider(){return this._iconsProvider}get iconsCollections(){return this._iconsCollections}addCollection(e,o=this._iconsProvider){return this._iconsCollections.push(e),t.addCollection(e,o)}addIcon(e,o){return t.addIcon(e,o)}addIconsAPIProvider(e,o){return t.addAPIProvider(e,o)}fetchIcon(e,t={cache:"force-cache"}){return new Promise(((o,i)=>{fetch(e,{...this._fetchOptions,...t}).catch((e=>i(e))).then((e=>null==e?void 0:e.text())).then((e=>o(e)))}))}}const l={install(e,t={}){const o=new c(t);e.config.globalProperties.$vv=o,t.components&&Object.entries(t.components).forEach((([o,i])=>{e.component(o,s(i,t.defaults))})),t.aliases&&Object.entries(t.aliases).forEach((([o,i])=>{e.component(o,s(i,t.defaults,o))})),t.directives&&Object.entries(t.directives).forEach((([t,o])=>{e.directive(t,o)})),e.provide(r,o)}};e.VolverPlugin=l,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "bugs": {
20
20
  "url": "https://github.com/volverjs/ui-vue/issues"
21
21
  },
22
- "version": "0.0.10-beta.4",
22
+ "version": "0.0.10-beta.5",
23
23
  "engines": {
24
24
  "node": ">= 16.x"
25
25
  },
package/src/Volver.ts CHANGED
@@ -36,25 +36,31 @@ export function useDefaultProps(
36
36
  return {
37
37
  ...component,
38
38
  name: componentName,
39
- props: Object.keys(props).reduce((acc, key) => {
40
- if (!(key in componentDefaults)) {
41
- acc[key] = props[key]
42
- return acc
43
- }
44
- const customDefault = componentDefaults[key]
45
- if (typeof props[key] === 'function' || Array.isArray(props[key])) {
39
+ props: Object.keys(props).reduce(
40
+ (acc, key) => {
41
+ if (!(key in componentDefaults)) {
42
+ acc[key] = props[key]
43
+ return acc
44
+ }
45
+ const customDefault = componentDefaults[key]
46
+ if (
47
+ typeof props[key] === 'function' ||
48
+ Array.isArray(props[key])
49
+ ) {
50
+ acc[key] = {
51
+ type: props[key],
52
+ default: customDefault,
53
+ }
54
+ return acc
55
+ }
46
56
  acc[key] = {
47
- type: props[key],
57
+ ...(props[key] as Record<string, unknown>),
48
58
  default: customDefault,
49
59
  }
50
60
  return acc
51
- }
52
- acc[key] = {
53
- ...(props[key] as Record<string, unknown>),
54
- default: customDefault,
55
- }
56
- return acc
57
- }, {} as Record<string, unknown>),
61
+ },
62
+ {} as Record<string, unknown>,
63
+ ),
58
64
  }
59
65
  }
60
66
 
@@ -248,7 +254,7 @@ const VolverPlugin: Plugin = {
248
254
  * @param {App} Vue
249
255
  * @param {Object} options
250
256
  */
251
- install(app: App, options: VolverOptions) {
257
+ install(app: App, options: VolverOptions = {}) {
252
258
  const volver = new Volver(options)
253
259
 
254
260
  // register global methods