@mcwv/base
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -5,7 +5,5 @@ export function BasePlugin(components) { | ||
install: vm => { | ||
// eslint-disable-next-line guard-for-in | ||
for (const key in components) { | ||
const component = components[key]; | ||
vm.component(component.name, component); | ||
} | ||
Object.values(components).forEach(component => | ||
vm.component(component.name, component), | ||
); | ||
}, | ||
@@ -12,0 +10,0 @@ components, |
@@ -7,13 +7,17 @@ export const CustomButton = { | ||
}, | ||
render(h, context) { | ||
render( | ||
createElement, | ||
{ | ||
children, | ||
data, | ||
props: { link, tag }, | ||
parent: { $router, $root }, | ||
}, | ||
) { | ||
let element; | ||
const data = Object.assign({}, context.data); | ||
if (context.props.link && context.parent.$router) { | ||
if (link && $router) { | ||
// router-link case | ||
element = context.parent.$root.$options.components['RouterLink']; | ||
data.props = Object.assign( | ||
{ tag: context.props.tag }, | ||
context.props.link, | ||
); | ||
element = $root.$options.components['RouterLink']; | ||
data.props = { tag, ...link }; | ||
data.attrs.role = 'button'; | ||
@@ -32,3 +36,3 @@ if (data.on.click) { | ||
return h(element, data, context.children); | ||
return createElement(element, data, children); | ||
}, | ||
@@ -35,0 +39,0 @@ }; |
@@ -8,13 +8,17 @@ export const CustomLink = { | ||
}, | ||
render(h, context) { | ||
render( | ||
createElement, | ||
{ | ||
data, | ||
children, | ||
props: { link, tag }, | ||
parent: { $router, $root }, | ||
}, | ||
) { | ||
let element; | ||
const data = Object.assign({}, context.data); | ||
if (context.props.link && context.parent.$router) { | ||
if (link && $router) { | ||
// router-link case | ||
element = context.parent.$root.$options.components['RouterLink']; | ||
data.props = Object.assign( | ||
{ tag: context.props.tag }, | ||
context.props.link, | ||
); | ||
element = $root.$options.components['RouterLink']; | ||
data.props = { tag, ...link }; | ||
if (data.on.click) { | ||
@@ -25,6 +29,6 @@ data.nativeOn = { click: data.on.click }; | ||
// element fallback | ||
element = context.props.tag; | ||
element = tag; | ||
} | ||
return h(element, data, context.children); | ||
return createElement(element, data, children); | ||
}, | ||
@@ -31,0 +35,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.base=n():(t.mcwv=t.mcwv||{},t.mcwv.base=n())}(window,function(){return function(t){var n={};function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(o,i,function(n){return t[n]}.bind(null,i));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=0)}([function(t,n,e){"use strict";e.r(n);var o=e(10);e.d(n,"applyPassive",function(){return o.a});var i=e(16);e.d(n,"autoInit",function(){return i.a});var s=e(2);e.d(n,"BasePlugin",function(){return s.a});var r=e(11);e.d(n,"CustomButton",function(){return r.a}),e.d(n,"CustomButtonMixin",function(){return r.b});var c=e(3);e.d(n,"CustomElement",function(){return c.a}),e.d(n,"CustomElementMixin",function(){return c.b});var u=e(7);e.d(n,"emitCustomEvent",function(){return u.a});var a=e(15);e.d(n,"extractIconProp",function(){return a.a});var l=e(12);e.d(n,"CustomLink",function(){return l.a}),e.d(n,"CustomLinkMixin",function(){return l.b});var p=e(5);e.d(n,"DispatchEventMixin",function(){return p.a});var d=e(8);e.d(n,"DispatchFocusMixin",function(){return d.a});var f=e(6);e.d(n,"VMAUniqueIdMixin",function(){return f.a})},,function(t,n,e){"use strict";function o(t){return{version:"__VERSION__",install:n=>{for(const e in t){const o=t[e];n.component(o.name,o)}},components:t}}e.d(n,"a",function(){return o})},function(t,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"b",function(){return i});const o={functional:!0,render:(t,n)=>t(n.props.is||n.props.tag||"div",n.data,n.children)},i={components:{CustomElement:o}}},,function(t,n,e){"use strict";e.d(n,"a",function(){return o});const o={props:{event:String,"event-target":Object,"event-args":Array},methods:{dispatchEvent(t){if(t&&this.$emit(t.type,t),this.event){const t=this.eventTarget||this.$root,n=this.eventArgs||[];t.$emit(this.event,...n)}}},computed:{listeners(){return{...this.$listeners,click:t=>this.dispatchEvent(t)}}}}},function(t,n,e){"use strict";e.d(n,"a",function(){return i});const o=Math.floor(Math.random()*Math.floor(268435456)).toString()+"-",i={beforeCreate(){this.vma_uid_=o+this._uid}}},function(t,n,e){"use strict";function o(t,n,e,o=!1){let i;"function"==typeof CustomEvent?i=new CustomEvent(n,{detail:e,bubbles:o}):(i=document.createEvent("CustomEvent")).initCustomEvent(n,o,!1,e),t.dispatchEvent(i)}e.d(n,"a",function(){return o})},function(t,n,e){"use strict";e.d(n,"a",function(){return o});const o={data:()=>({hasFocus:!1}),methods:{onMouseDown(){this._active=!0},onMouseUp(){this._active=!1},onFocusEvent(){setTimeout(()=>this.dispatchFocusEvent(),0)},onBlurEvent(){this._active||setTimeout(()=>this.dispatchFocusEvent(),0)},dispatchFocusEvent(){const t=this.$el===document.activeElement||this.$el.contains(document.activeElement);t!=this.hasFocus&&(this.$emit(t?"focus":"blur"),this.hasFocus=t)}},mounted(){this.$el.addEventListener("focusin",this.onFocusEvent),this.$el.addEventListener("focusout",this.onBlurEvent),this.$el.addEventListener("mousedown",this.onMouseDown),this.$el.addEventListener("mouseup",this.onMouseUp)},beforeDestroy(){this.$el.removeEventListener("focusin",this.onFocusEvent),this.$el.removeEventListener("focusout",this.onBlurEvent),this.$el.removeEventListener("mousedown",this.onMouseDown),this.$el.removeEventListener("mouseup",this.onMouseUp)}}},,function(t,n,e){"use strict";let o;function i(t=window,n=!1){if(void 0===o||n){let n=!1;try{t.document.addEventListener("test",null,{get passive(){return n={passive:!0}}})}catch(t){}o=n}return o}e.d(n,"a",function(){return i})},function(t,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"b",function(){return i});const o={name:"custom-button",functional:!0,props:{link:Object},render(t,n){let e;const o=Object.assign({},n.data);return n.props.link&&n.parent.$router?(e=n.parent.$root.$options.components.RouterLink,o.props=Object.assign({tag:n.props.tag},n.props.link),o.attrs.role="button",o.on.click&&(o.nativeOn={click:o.on.click})):o.attrs&&o.attrs.href?(e="a",o.attrs.role="button"):e="button",t(e,o,n.children)}},i={props:{href:String,disabled:Boolean,to:[String,Object],exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String},computed:{link(){return this.to&&{to:this.to,exact:this.exact,append:this.append,replace:this.replace,activeClass:this.activeClass,exactActiveClass:this.exactActiveClass}}},components:{CustomButton:o}}},function(t,n,e){"use strict";e.d(n,"a",function(){return o}),e.d(n,"b",function(){return i});const o={name:"custom-link",functional:!0,props:{tag:{type:String,default:"a"},link:Object},render(t,n){let e;const o=Object.assign({},n.data);return n.props.link&&n.parent.$router?(e=n.parent.$root.$options.components.RouterLink,o.props=Object.assign({tag:n.props.tag},n.props.link),o.on.click&&(o.nativeOn={click:o.on.click})):e=n.props.tag,t(e,o,n.children)}},i={props:{to:[String,Object],exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String},computed:{link(){return this.to&&{to:this.to,exact:this.exact,append:this.append,replace:this.replace,activeClass:this.activeClass,exactActiveClass:this.exactActiveClass}}},components:{CustomLink:o}}},,,function(t,n,e){"use strict";function o(t){return"string"==typeof t?{classes:{"material-icons":!0},content:t}:t instanceof Array?{classes:t.reduce((t,n)=>Object.assign(t,{[n]:!0}),{})}:"object"==typeof t?{classes:t.className.split(" ").reduce((t,n)=>Object.assign(t,{[n]:!0}),{}),content:t.textContent}:void 0}e.d(n,"a",function(){return o})},function(t,n,e){"use strict";(function(t){function o(n){let e=null;"undefined"!=typeof window?e=window.Vue:void 0!==t&&(e=t.Vue),e&&e.use(n)}e.d(n,"a",function(){return o})}).call(this,e(18))},,function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.base=e():(t.mcwv=t.mcwv||{},t.mcwv.base=e())}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var o=n(11);n.d(e,"applyPassive",function(){return o.a});var i=n(2);n.d(e,"BasePlugin",function(){return i.a});var s=n(7);n.d(e,"CustomButton",function(){return s.a}),n.d(e,"CustomButtonMixin",function(){return s.b});var r=n(6);n.d(e,"emitCustomEvent",function(){return r.a});var u=n(8);n.d(e,"CustomLink",function(){return u.a}),n.d(e,"CustomLinkMixin",function(){return u.b});var c=n(4);n.d(e,"DispatchEventMixin",function(){return c.a});var a=n(9);n.d(e,"DispatchFocusMixin",function(){return a.a});var l=n(5);n.d(e,"VMAUniqueIdMixin",function(){return l.a})},,function(t,e,n){"use strict";function o(t){return{version:"__VERSION__",install:e=>{Object.values(t).forEach(t=>e.component(t.name,t))},components:t}}n.d(e,"a",function(){return o})},,function(t,e,n){"use strict";n.d(e,"a",function(){return o});const o={props:{event:String,"event-target":Object,"event-args":Array},methods:{dispatchEvent(t){if(t&&this.$emit(t.type,t),this.event){const t=this.eventTarget||this.$root,e=this.eventArgs||[];t.$emit(this.event,...e)}}},computed:{listeners(){return{...this.$listeners,click:t=>this.dispatchEvent(t)}}}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});const o=Math.floor(Math.random()*Math.floor(268435456)).toString()+"-",i={beforeCreate(){this.vma_uid_=o+this._uid}}},function(t,e,n){"use strict";function o(t,e,n,o=!1){let i;"function"==typeof CustomEvent?i=new CustomEvent(e,{detail:n,bubbles:o}):(i=document.createEvent("CustomEvent")).initCustomEvent(e,o,!1,n),t.dispatchEvent(i)}n.d(e,"a",function(){return o})},function(t,e,n){"use strict";n.d(e,"a",function(){return o}),n.d(e,"b",function(){return i});const o={name:"custom-button",functional:!0,props:{link:Object},render(t,{children:e,data:n,props:{link:o,tag:i},parent:{$router:s,$root:r}}){let u;return o&&s?(u=r.$options.components.RouterLink,n.props={tag:i,...o},n.attrs.role="button",n.on.click&&(n.nativeOn={click:n.on.click})):n.attrs&&n.attrs.href?(u="a",n.attrs.role="button"):u="button",t(u,n,e)}},i={props:{href:String,disabled:Boolean,to:[String,Object],exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String},computed:{link(){return this.to&&{to:this.to,exact:this.exact,append:this.append,replace:this.replace,activeClass:this.activeClass,exactActiveClass:this.exactActiveClass}}},components:{CustomButton:o}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o}),n.d(e,"b",function(){return i});const o={name:"custom-link",functional:!0,props:{tag:{type:String,default:"a"},link:Object},render(t,{data:e,children:n,props:{link:o,tag:i},parent:{$router:s,$root:r}}){let u;return o&&s?(u=r.$options.components.RouterLink,e.props={tag:i,...o},e.on.click&&(e.nativeOn={click:e.on.click})):u=i,t(u,e,n)}},i={props:{to:[String,Object],exact:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String},computed:{link(){return this.to&&{to:this.to,exact:this.exact,append:this.append,replace:this.replace,activeClass:this.activeClass,exactActiveClass:this.exactActiveClass}}},components:{CustomLink:o}}},function(t,e,n){"use strict";n.d(e,"a",function(){return o});const o={data:()=>({hasFocus:!1}),methods:{onMouseDown(){this._active=!0},onMouseUp(){this._active=!1},onFocusEvent(){setTimeout(()=>this.dispatchFocusEvent(),0)},onBlurEvent(){this._active||setTimeout(()=>this.dispatchFocusEvent(),0)},dispatchFocusEvent(){const t=this.$el===document.activeElement||this.$el.contains(document.activeElement);t!=this.hasFocus&&(this.$emit(t?"focus":"blur"),this.hasFocus=t)}},mounted(){this.$el.addEventListener("focusin",this.onFocusEvent),this.$el.addEventListener("focusout",this.onBlurEvent),this.$el.addEventListener("mousedown",this.onMouseDown),this.$el.addEventListener("mouseup",this.onMouseUp)},beforeDestroy(){this.$el.removeEventListener("focusin",this.onFocusEvent),this.$el.removeEventListener("focusout",this.onBlurEvent),this.$el.removeEventListener("mousedown",this.onMouseDown),this.$el.removeEventListener("mouseup",this.onMouseUp)}}},,function(t,e,n){"use strict";let o;function i(t=window,e=!1){if(void 0===o||e){let e=!1;try{t.document.addEventListener("test",null,{get passive(){return e={passive:!0}}})}catch(t){}o=e}return o}n.d(e,"a",function(){return i})}])}); | ||
//# sourceMappingURL=mcwv.base.min.js.map |
19
index.js
@@ -1,11 +0,8 @@ | ||
export * from './apply-passive.js'; | ||
export * from './auto-init.js'; | ||
export * from './base-plugin.js'; | ||
export * from './custom-button.js'; | ||
export * from './custom-element.js'; | ||
export * from './custom-event.js'; | ||
export * from './custom-icon.js'; | ||
export * from './custom-link.js'; | ||
export * from './dispatch-event-mixin.js'; | ||
export * from './dispatch-focus-mixin.js'; | ||
export * from './uniqueid-mixin.js'; | ||
export { applyPassive } from './apply-passive.js'; | ||
export { BasePlugin } from './base-plugin.js'; | ||
export { CustomButton, CustomButtonMixin } from './custom-button.js'; | ||
export { emitCustomEvent } from './custom-event.js'; | ||
export { CustomLink, CustomLinkMixin } from './custom-link.js'; | ||
export { DispatchEventMixin } from './dispatch-event-mixin.js'; | ||
export { DispatchFocusMixin } from './dispatch-focus-mixin.js'; | ||
export { VMAUniqueIdMixin } from './uniqueid-mixin.js'; |
{ | ||
"name": "@mcwv/base", | ||
"description": "The set of base classes for Vue material componnents", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"license": "MIT", | ||
@@ -13,3 +13,3 @@ "main": "dist/mcwv.base.min.js", | ||
"sideEffects": false, | ||
"gitHead": "b312d0f443b4c86f527ab197d5a713c3a7f80ff0" | ||
"gitHead": "70feeb1072e6d916dc82825111b0e06e84a59b93" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31387
13
276