@mcwv/base
Advanced tools
Comparing version 0.1.0 to 0.1.2
@@ -1,2 +0,2 @@ | ||
let supportsPassive_ | ||
let supportsPassive_; | ||
@@ -11,17 +11,18 @@ /** | ||
if (supportsPassive_ === undefined || forceRefresh) { | ||
let isSupported = false | ||
let isSupported = false; | ||
try { | ||
globalObj.document.addEventListener('test', null, { | ||
get passive() { | ||
isSupported = { passive: true } | ||
} | ||
}) | ||
isSupported = { passive: true }; | ||
return isSupported; | ||
}, | ||
}); | ||
} catch (e) { | ||
//empty | ||
// empty | ||
} | ||
supportsPassive_ = isSupported | ||
supportsPassive_ = isSupported; | ||
} | ||
return supportsPassive_ | ||
return supportsPassive_; | ||
} |
export function autoInit(plugin) { | ||
// Auto-install | ||
let _Vue = null | ||
let _Vue = null; | ||
if (typeof window !== 'undefined') { | ||
_Vue = window.Vue | ||
_Vue = window.Vue; | ||
} else if (typeof global !== 'undefined') { | ||
/*global global*/ | ||
_Vue = global.Vue | ||
/* global global */ | ||
_Vue = global.Vue; | ||
} | ||
if (_Vue) { | ||
_Vue.use(plugin) | ||
_Vue.use(plugin); | ||
} | ||
} |
@@ -6,8 +6,8 @@ export function BasePlugin(components) { | ||
for (let key in components) { | ||
let component = components[key] | ||
vm.component(component.name, component) | ||
let component = components[key]; | ||
vm.component(component.name, component); | ||
} | ||
}, | ||
components | ||
} | ||
components, | ||
}; | ||
} |
@@ -5,28 +5,31 @@ export const CustomButton = { | ||
props: { | ||
link: Object | ||
link: Object, | ||
}, | ||
render(h, context) { | ||
let element | ||
let data = Object.assign({}, context.data) | ||
let element; | ||
let data = Object.assign({}, context.data); | ||
if (context.props.link && context.parent.$router) { | ||
// router-link case | ||
element = context.parent.$root.$options.components['RouterLink'] | ||
data.props = Object.assign({ tag: context.props.tag }, context.props.link) | ||
data.attrs.role = 'button' | ||
element = context.parent.$root.$options.components['RouterLink']; | ||
data.props = Object.assign( | ||
{ tag: context.props.tag }, | ||
context.props.link, | ||
); | ||
data.attrs.role = 'button'; | ||
if (data.on.click) { | ||
data.nativeOn = { click: data.on.click } | ||
data.nativeOn = { click: data.on.click }; | ||
} | ||
} else if (data.attrs && data.attrs.href) { | ||
// href case | ||
element = 'a' | ||
data.attrs.role = 'button' | ||
element = 'a'; | ||
data.attrs.role = 'button'; | ||
} else { | ||
// button fallback | ||
element = 'button' | ||
element = 'button'; | ||
} | ||
return h(element, data, context.children) | ||
} | ||
} | ||
return h(element, data, context.children); | ||
}, | ||
}; | ||
@@ -42,3 +45,3 @@ export const CustomButtonMixin = { | ||
activeClass: String, | ||
exactActiveClass: String | ||
exactActiveClass: String, | ||
}, | ||
@@ -54,10 +57,10 @@ computed: { | ||
activeClass: this.activeClass, | ||
exactActiveClass: this.exactActiveClass | ||
exactActiveClass: this.exactActiveClass, | ||
} | ||
) | ||
} | ||
); | ||
}, | ||
}, | ||
components: { | ||
CustomButton | ||
} | ||
} | ||
CustomButton, | ||
}, | ||
}; |
@@ -7,11 +7,11 @@ export const CustomElement = { | ||
context.data, | ||
context.children | ||
) | ||
} | ||
} | ||
context.children, | ||
); | ||
}, | ||
}; | ||
export const CustomElementMixin = { | ||
components: { | ||
CustomElement | ||
} | ||
} | ||
CustomElement, | ||
}, | ||
}; |
/* global CustomEvent */ | ||
export function emitCustomEvent(el, evtType, evtData, shouldBubble = false) { | ||
let evt | ||
let evt; | ||
if (typeof CustomEvent === 'function') { | ||
evt = new CustomEvent(evtType, { | ||
detail: evtData, | ||
bubbles: shouldBubble | ||
}) | ||
bubbles: shouldBubble, | ||
}); | ||
} else { | ||
evt = document.createEvent('CustomEvent') | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData) | ||
evt = document.createEvent('CustomEvent'); | ||
evt.initCustomEvent(evtType, shouldBubble, false, evtData); | ||
} | ||
el.dispatchEvent(evt) | ||
el.dispatchEvent(evt); | ||
} |
@@ -5,4 +5,4 @@ export function extractIconProp(iconProp) { | ||
classes: { 'material-icons': true }, | ||
content: iconProp | ||
} | ||
content: iconProp, | ||
}; | ||
} else if (iconProp instanceof Array) { | ||
@@ -12,5 +12,5 @@ return { | ||
(result, value) => Object.assign(result, { [value]: true }), | ||
{} | ||
) | ||
} | ||
{}, | ||
), | ||
}; | ||
} else if (typeof iconProp === 'object') { | ||
@@ -22,7 +22,7 @@ return { | ||
(result, value) => Object.assign(result, { [value]: true }), | ||
{} | ||
{}, | ||
), | ||
content: iconProp.textContent | ||
} | ||
content: iconProp.textContent, | ||
}; | ||
} | ||
} |
@@ -6,23 +6,26 @@ export const CustomLink = { | ||
tag: { type: String, default: 'a' }, | ||
link: Object | ||
link: Object, | ||
}, | ||
render(h, context) { | ||
let element | ||
let data = Object.assign({}, context.data) | ||
let element; | ||
let data = Object.assign({}, context.data); | ||
if (context.props.link && context.parent.$router) { | ||
// router-link case | ||
element = context.parent.$root.$options.components['RouterLink'] | ||
data.props = Object.assign({ tag: context.props.tag }, context.props.link) | ||
element = context.parent.$root.$options.components['RouterLink']; | ||
data.props = Object.assign( | ||
{ tag: context.props.tag }, | ||
context.props.link, | ||
); | ||
if (data.on.click) { | ||
data.nativeOn = { click: data.on.click } | ||
data.nativeOn = { click: data.on.click }; | ||
} | ||
} else { | ||
// element fallback | ||
element = context.props.tag | ||
element = context.props.tag; | ||
} | ||
return h(element, data, context.children) | ||
} | ||
} | ||
return h(element, data, context.children); | ||
}, | ||
}; | ||
@@ -36,3 +39,3 @@ export const CustomLinkMixin = { | ||
activeClass: String, | ||
exactActiveClass: String | ||
exactActiveClass: String, | ||
}, | ||
@@ -48,10 +51,10 @@ computed: { | ||
activeClass: this.activeClass, | ||
exactActiveClass: this.exactActiveClass | ||
exactActiveClass: this.exactActiveClass, | ||
} | ||
) | ||
} | ||
); | ||
}, | ||
}, | ||
components: { | ||
CustomLink | ||
} | ||
} | ||
CustomLink, | ||
}, | ||
}; |
@@ -5,13 +5,13 @@ export const DispatchEventMixin = { | ||
'event-target': Object, | ||
'event-args': Array | ||
'event-args': Array, | ||
}, | ||
methods: { | ||
dispatchEvent(evt) { | ||
evt && this.$emit(evt.type, evt) | ||
evt && this.$emit(evt.type, evt); | ||
if (this.event) { | ||
let target = this.eventTarget || this.$root | ||
let args = this.eventArgs || [] | ||
target.$emit(this.event, ...args) | ||
let target = this.eventTarget || this.$root; | ||
let args = this.eventArgs || []; | ||
target.$emit(this.event, ...args); | ||
} | ||
} | ||
}, | ||
}, | ||
@@ -22,6 +22,6 @@ computed: { | ||
...this.$listeners, | ||
click: e => this.dispatchEvent(e) | ||
} | ||
} | ||
} | ||
} | ||
click: e => this.dispatchEvent(e), | ||
}; | ||
}, | ||
}, | ||
}; |
export const DispatchFocusMixin = { | ||
data() { | ||
return { hasFocus: false } | ||
return { hasFocus: false }; | ||
}, | ||
methods: { | ||
onMouseDown() { | ||
this._active = true | ||
this._active = true; | ||
}, | ||
onMouseUp() { | ||
this._active = false | ||
this._active = false; | ||
}, | ||
onFocusEvent() { | ||
// dispatch async to let time to other focus event to propagate | ||
setTimeout(() => this.dispatchFocusEvent(), 0) | ||
setTimeout(() => this.dispatchFocusEvent(), 0); | ||
}, | ||
@@ -19,3 +19,3 @@ onBlurEvent() { | ||
// also filtur blur if mousedown | ||
this._active || setTimeout(() => this.dispatchFocusEvent(), 0) | ||
this._active || setTimeout(() => this.dispatchFocusEvent(), 0); | ||
}, | ||
@@ -25,21 +25,21 @@ dispatchFocusEvent() { | ||
this.$el === document.activeElement || | ||
this.$el.contains(document.activeElement) | ||
this.$el.contains(document.activeElement); | ||
if (hasFocus != this.hasFocus) { | ||
this.$emit(hasFocus ? 'focus' : 'blur') | ||
this.hasFocus = hasFocus | ||
this.$emit(hasFocus ? 'focus' : 'blur'); | ||
this.hasFocus = hasFocus; | ||
} | ||
} | ||
}, | ||
}, | ||
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) | ||
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) | ||
} | ||
} | ||
this.$el.removeEventListener('focusin', this.onFocusEvent); | ||
this.$el.removeEventListener('focusout', this.onBlurEvent); | ||
this.$el.removeEventListener('mousedown', this.onMouseDown); | ||
this.$el.removeEventListener('mouseup', this.onMouseUp); | ||
}, | ||
}; |
@@ -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.wcmv=t.wcmv||{},t.wcmv.base=n())}(window,function(){return function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},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 r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},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=3)}([,,,function(t,n,e){"use strict";e.r(n);var r=e(17);e.d(n,"applyPassive",function(){return r.a});var o=e(24);e.d(n,"autoInit",function(){return o.a});var i=e(6);e.d(n,"BasePlugin",function(){return i.a});var u=e(8);e.d(n,"CustomElement",function(){return u.a}),e.d(n,"CustomElementMixin",function(){return u.b});var c=e(18);e.d(n,"CustomLink",function(){return c.a}),e.d(n,"CustomLinkMixin",function(){return c.b});var s=e(12);e.d(n,"emitCustomEvent",function(){return s.a});var a=e(19);e.d(n,"CustomButton",function(){return a.a}),e.d(n,"CustomButtonMixin",function(){return a.b});var f=e(21);e.d(n,"extractIconProp",function(){return f.a});var l=e(10);e.d(n,"DispatchEventMixin",function(){return l.a});var p=e(13);e.d(n,"DispatchFocusMixin",function(){return p.a});var v=e(11);e.d(n,"VMAUniqueIdMixin",function(){return v.a})},,,function(t,n,e){"use strict";function r(t){return{version:"__VERSION__",install:function(n){for(var e in t){var r=t[e];n.component(r.name,r)}},components:t}}e.d(n,"a",function(){return r})},,function(t,n,e){"use strict";e.d(n,"a",function(){return r}),e.d(n,"b",function(){return o});var r={functional:!0,render:function(t,n){return t(n.props.is||n.props.tag||"div",n.data,n.children)}},o={components:{CustomElement:r}}},,function(t,n,e){"use strict";function r(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function o(t){return function(t){if(Array.isArray(t)){for(var n=0,e=new Array(t.length);n<t.length;n++)e[n]=t[n];return e}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}e.d(n,"a",function(){return i});var i={props:{event:String,"event-target":Object,"event-args":Array},methods:{dispatchEvent:function(t){if(t&&this.$emit(t.type,t),this.event){var n=this.eventTarget||this.$root,e=this.eventArgs||[];n.$emit.apply(n,[this.event].concat(o(e)))}}},computed:{listeners:function(){var t=this;return function(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{},o=Object.keys(e);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(e).filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.forEach(function(n){r(t,n,e[n])})}return t}({},this.$listeners,{click:function(n){return t.dispatchEvent(n)}})}}}},function(t,n,e){"use strict";e.d(n,"a",function(){return o});var r=Math.floor(Math.random()*Math.floor(268435456)).toString()+"-",o={beforeCreate:function(){this.vma_uid_=r+this._uid}}},function(t,n,e){"use strict";function r(t,n,e){var r,o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];"function"==typeof CustomEvent?r=new CustomEvent(n,{detail:e,bubbles:o}):(r=document.createEvent("CustomEvent")).initCustomEvent(n,o,!1,e),t.dispatchEvent(r)}e.d(n,"a",function(){return r})},function(t,n,e){"use strict";e.d(n,"a",function(){return r});var r={data:function(){return{hasFocus:!1}},methods:{onMouseDown:function(){this._active=!0},onMouseUp:function(){this._active=!1},onFocusEvent:function(){var t=this;setTimeout(function(){return t.dispatchFocusEvent()},0)},onBlurEvent:function(){var t=this;this._active||setTimeout(function(){return t.dispatchFocusEvent()},0)},dispatchFocusEvent:function(){var t=this.$el===document.activeElement||this.$el.contains(document.activeElement);t!=this.hasFocus&&(this.$emit(t?"focus":"blur"),this.hasFocus=t)}},mounted:function(){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:function(){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";var r;function o(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===r||n){var e=!1;try{t.document.addEventListener("test",null,{get passive(){e={passive:!0}}})}catch(t){}r=e}return r}e.d(n,"a",function(){return o})},function(t,n,e){"use strict";function r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}e.d(n,"a",function(){return o}),e.d(n,"b",function(){return i});var o={name:"custom-link",functional:!0,props:{tag:{type:String,default:"a"},link:Object},render:function(t,n){var e,o=r({},n.data);return n.props.link&&n.parent.$router?(e=n.parent.$root.$options.components.RouterLink,o.props=r({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:function(){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 r(){return(r=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}e.d(n,"a",function(){return o}),e.d(n,"b",function(){return i});var o={name:"custom-button",functional:!0,props:{link:Object},render:function(t,n){var e,o=r({},n.data);return n.props.link&&n.parent.$router?(e=n.parent.$root.$options.components.RouterLink,o.props=r({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:function(){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";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function i(){return(i=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}function u(t){return"string"==typeof t?{classes:{"material-icons":!0},content:t}:t instanceof Array?{classes:t.reduce(function(t,n){return i(t,o({},n,!0))},{})}:"object"===r(t)?{classes:t.className.split(" ").reduce(function(t,n){return i(t,o({},n,!0))},{}),content:t.textContent}:void 0}e.d(n,"a",function(){return u})},,,function(t,n,e){"use strict";(function(t){function r(n){var e=null;"undefined"!=typeof window?e=window.Vue:void 0!==t&&(e=t.Vue),e&&e.use(n)}e.d(n,"a",function(){return r})}).call(this,e(26))},,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.wcmv=t.wcmv||{},t.wcmv.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=3)}([,,,function(t,e,n){"use strict";n.r(e);var o=n(17);n.d(e,"applyPassive",function(){return o.a});var i=n(24);n.d(e,"autoInit",function(){return i.a});var r=n(6);n.d(e,"BasePlugin",function(){return r.a});var s=n(8);n.d(e,"CustomElement",function(){return s.a}),n.d(e,"CustomElementMixin",function(){return s.b});var u=n(18);n.d(e,"CustomLink",function(){return u.a}),n.d(e,"CustomLinkMixin",function(){return u.b});var c=n(12);n.d(e,"emitCustomEvent",function(){return c.a});var a=n(19);n.d(e,"CustomButton",function(){return a.a}),n.d(e,"CustomButtonMixin",function(){return a.b});var l=n(21);n.d(e,"extractIconProp",function(){return l.a});var p=n(10);n.d(e,"DispatchEventMixin",function(){return p.a});var d=n(13);n.d(e,"DispatchFocusMixin",function(){return d.a});var f=n(11);n.d(e,"VMAUniqueIdMixin",function(){return f.a})},,,function(t,e,n){"use strict";function o(t){return{version:"__VERSION__",install:e=>{for(let n in t){let o=t[n];e.component(o.name,o)}},components:t}}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={functional:!0,render:(t,e)=>t(e.props.is||e.props.tag||"div",e.data,e.children)},i={components:{CustomElement: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){let 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});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(){let 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})},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,e){let n,o=Object.assign({},e.data);return e.props.link&&e.parent.$router?(n=e.parent.$root.$options.components.RouterLink,o.props=Object.assign({tag:e.props.tag},e.props.link),o.on.click&&(o.nativeOn={click:o.on.click})):n=e.props.tag,t(n,o,e.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,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,e){let n,o=Object.assign({},e.data);return e.props.link&&e.parent.$router?(n=e.parent.$root.$options.components.RouterLink,o.props=Object.assign({tag:e.props.tag},e.props.link),o.attrs.role="button",o.on.click&&(o.nativeOn={click:o.on.click})):o.attrs&&o.attrs.href?(n="a",o.attrs.role="button"):n="button",t(n,o,e.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,e,n){"use strict";function o(t){return"string"==typeof t?{classes:{"material-icons":!0},content:t}:t instanceof Array?{classes:t.reduce((t,e)=>Object.assign(t,{[e]:!0}),{})}:"object"==typeof t?{classes:t.className.split(" ").reduce((t,e)=>Object.assign(t,{[e]:!0}),{}),content:t.textContent}:void 0}n.d(e,"a",function(){return o})},,,function(t,e,n){"use strict";(function(t){function o(e){let n=null;"undefined"!=typeof window?n=window.Vue:void 0!==t&&(n=t.Vue),n&&n.use(e)}n.d(e,"a",function(){return o})}).call(this,n(26))},,function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n}])}); | ||
//# sourceMappingURL=mcwv.base.min.js.map |
22
index.js
@@ -1,11 +0,11 @@ | ||
export * from './apply-passive.js' | ||
export * from './auto-init.js' | ||
export * from './base-plugin.js' | ||
export * from './custom-element.js' | ||
export * from './custom-link.js' | ||
export * from './custom-event.js' | ||
export * from './custom-button.js' | ||
export * from './custom-icon.js' | ||
export * from './dispatch-event-mixin.js' | ||
export * from './dispatch-focus-mixin.js' | ||
export * from './uniqueid-mixin.js' | ||
export * from './apply-passive.js'; | ||
export * from './auto-init.js'; | ||
export * from './base-plugin.js'; | ||
export * from './custom-element.js'; | ||
export * from './custom-link.js'; | ||
export * from './custom-event.js'; | ||
export * from './custom-button.js'; | ||
export * from './custom-icon.js'; | ||
export * from './dispatch-event-mixin.js'; | ||
export * from './dispatch-focus-mixin.js'; | ||
export * from './uniqueid-mixin.js'; |
{ | ||
"name": "@mcwv/base", | ||
"description": "The set of base classes for Vue material componnents", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"license": "MIT", | ||
@@ -11,3 +11,3 @@ "repository": { | ||
"sideEffects": false, | ||
"gitHead": "04a7e19899423b2fc13608ad435b878ef5792faf" | ||
"gitHead": "ea9652c4b2e84843a94b7fdba14a7965651409e1" | ||
} |
const scope = | ||
Math.floor(Math.random() * Math.floor(0x10000000)).toString() + '-' | ||
Math.floor(Math.random() * Math.floor(0x10000000)).toString() + '-'; | ||
export const VMAUniqueIdMixin = { | ||
beforeCreate() { | ||
this.vma_uid_ = scope + this._uid | ||
} | ||
} | ||
this.vma_uid_ = scope + this._uid; | ||
}, | ||
}; |
Sorry, the diff of this file is not supported yet
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
37419
1
329