Skip to content

Commit

Permalink
build
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Ognichenko committed Aug 8, 2018
1 parent 0a276c4 commit 27caef1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
27 changes: 18 additions & 9 deletions dist/js/vue-popper.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
},

immediate: true
},

disabled: function disabled(value) {
if (!value) {
this.showPopper = false;
}
}
},

Expand All @@ -134,9 +140,13 @@
break;
case 'hover':
on(this.referenceElm, 'mouseover', this.onMouseOver);
on(this.referenceElm, 'focus', this.onMouseOver);
on(this.popper, 'mouseover', this.onMouseOver);
on(this.popper, 'focus', this.onMouseOver);
on(this.referenceElm, 'mouseout', this.onMouseOut);
on(this.referenceElm, 'blur', this.onMouseOut);
on(this.popper, 'mouseout', this.onMouseOut);
on(this.popper, 'blur', this.onMouseOut);
break;
}
},
Expand Down Expand Up @@ -275,6 +285,7 @@
}
};

/* script */
var __vue_script__ = script;

/* template */
Expand Down Expand Up @@ -302,11 +313,10 @@
var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;

var __vue_template__ = typeof __vue_render__ !== 'undefined' ? { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ } : {};
/* style */
var __vue_inject_styles__ = function (inject) {
var __vue_inject_styles__ = function __vue_inject_styles__(inject) {
if (!inject) return;
inject("data-v-337baefc_0", { source: "\n.popper {\n width: auto;\n background-color: #fafafa;\n color: #212121;\n text-align: center;\n padding: 2px;\n display: inline-block;\n border-radius: 3px;\n position: absolute;\n font-size: 14px;\n font-weight: normal;\n border: 1px #ebebeb solid;\n z-index: 200000;\n -moz-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n -webkit-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n}\n.popper .popper__arrow {\n width: 0;\n height: 0;\n border-style: solid;\n position: absolute;\n margin: 5px;\n}\n.popper[x-placement^=\"top\"] {\n margin-bottom: 5px;\n}\n.popper[x-placement^=\"top\"] .popper__arrow {\n border-width: 5px 5px 0 5px;\n border-color: #fafafa transparent transparent transparent;\n bottom: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n}\n.popper[x-placement^=\"bottom\"] {\n margin-top: 5px;\n}\n.popper[x-placement^=\"bottom\"] .popper__arrow {\n border-width: 0 5px 5px 5px;\n border-color: transparent transparent #fafafa transparent;\n top: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n}\n.popper[x-placement^=\"right\"] {\n margin-left: 5px;\n}\n.popper[x-placement^=\"right\"] .popper__arrow {\n border-width: 5px 5px 5px 0;\n border-color: transparent #fafafa transparent transparent;\n left: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n}\n.popper[x-placement^=\"left\"] {\n margin-right: 5px;\n}\n.popper[x-placement^=\"left\"] .popper__arrow {\n border-width: 5px 0 5px 5px;\n border-color: transparent transparent transparent #fafafa;\n right: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n}\n", map: undefined, media: undefined });
inject("data-v-4732e5aa_0", { source: "\n.popper {\n width: auto;\n background-color: #fafafa;\n color: #212121;\n text-align: center;\n padding: 2px;\n display: inline-block;\n border-radius: 3px;\n position: absolute;\n font-size: 14px;\n font-weight: normal;\n border: 1px #ebebeb solid;\n z-index: 200000;\n -moz-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n -webkit-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n}\n.popper .popper__arrow {\n width: 0;\n height: 0;\n border-style: solid;\n position: absolute;\n margin: 5px;\n}\n.popper[x-placement^=\"top\"] {\n margin-bottom: 5px;\n}\n.popper[x-placement^=\"top\"] .popper__arrow {\n border-width: 5px 5px 0 5px;\n border-color: #fafafa transparent transparent transparent;\n bottom: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n}\n.popper[x-placement^=\"bottom\"] {\n margin-top: 5px;\n}\n.popper[x-placement^=\"bottom\"] .popper__arrow {\n border-width: 0 5px 5px 5px;\n border-color: transparent transparent #fafafa transparent;\n top: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n}\n.popper[x-placement^=\"right\"] {\n margin-left: 5px;\n}\n.popper[x-placement^=\"right\"] .popper__arrow {\n border-width: 5px 5px 5px 0;\n border-color: transparent #fafafa transparent transparent;\n left: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n}\n.popper[x-placement^=\"left\"] {\n margin-right: 5px;\n}\n.popper[x-placement^=\"left\"] .popper__arrow {\n border-width: 5px 0 5px 5px;\n border-color: transparent transparent transparent #fafafa;\n right: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n}\n", map: { "version": 3, "sources": ["/Users/igor/projects/vue-popper/src/component/popper.js.vue"], "names": [], "mappings": ";AACA;EACA,YAAA;EACA,0BAAA;EACA,eAAA;EACA,mBAAA;EACA,aAAA;EACA,sBAAA;EACA,mBAAA;EACA,mBAAA;EACA,gBAAA;EACA,oBAAA;EACA,0BAAA;EACA,gBAAA;EACA,2CAAA;EACA,8CAAA;EACA,sCAAA;CACA;AAEA;EACA,SAAA;EACA,UAAA;EACA,oBAAA;EACA,mBAAA;EACA,YAAA;CACA;AAEA;EACA,mBAAA;CACA;AAEA;EACA,4BAAA;EACA,0DAAA;EACA,aAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;CACA;AAEA;EACA,gBAAA;CACA;AAEA;EACA,4BAAA;EACA,0DAAA;EACA,UAAA;EACA,sBAAA;EACA,cAAA;EACA,iBAAA;CACA;AAEA;EACA,iBAAA;CACA;AAEA;EACA,4BAAA;EACA,0DAAA;EACA,WAAA;EACA,qBAAA;EACA,eAAA;EACA,gBAAA;CACA;AAEA;EACA,kBAAA;CACA;AAEA;EACA,4BAAA;EACA,0DAAA;EACA,YAAA;EACA,qBAAA;EACA,eAAA;EACA,gBAAA;CACA", "file": "popper.js.vue", "sourcesContent": ["<style>\n .popper {\n width: auto;\n background-color: #fafafa;\n color: #212121;\n text-align: center;\n padding: 2px;\n display: inline-block;\n border-radius: 3px;\n position: absolute;\n font-size: 14px;\n font-weight: normal;\n border: 1px #ebebeb solid;\n z-index: 200000;\n -moz-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n -webkit-box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n box-shadow: rgb(58, 58, 58) 0 0 6px 0;\n }\n\n .popper .popper__arrow {\n width: 0;\n height: 0;\n border-style: solid;\n position: absolute;\n margin: 5px;\n }\n\n .popper[x-placement^=\"top\"] {\n margin-bottom: 5px;\n }\n\n .popper[x-placement^=\"top\"] .popper__arrow {\n border-width: 5px 5px 0 5px;\n border-color: #fafafa transparent transparent transparent;\n bottom: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n }\n\n .popper[x-placement^=\"bottom\"] {\n margin-top: 5px;\n }\n\n .popper[x-placement^=\"bottom\"] .popper__arrow {\n border-width: 0 5px 5px 5px;\n border-color: transparent transparent #fafafa transparent;\n top: -5px;\n left: calc(50% - 5px);\n margin-top: 0;\n margin-bottom: 0;\n }\n\n .popper[x-placement^=\"right\"] {\n margin-left: 5px;\n }\n\n .popper[x-placement^=\"right\"] .popper__arrow {\n border-width: 5px 5px 5px 0;\n border-color: transparent #fafafa transparent transparent;\n left: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n }\n\n .popper[x-placement^=\"left\"] {\n margin-right: 5px;\n }\n\n .popper[x-placement^=\"left\"] .popper__arrow {\n border-width: 5px 0 5px 5px;\n border-color: transparent transparent transparent #fafafa;\n right: -5px;\n top: calc(50% - 5px);\n margin-left: 0;\n margin-right: 0;\n }\n</style>\n\n<template>\n <span>\n <transition :name=\"transition\" :enter-active-class=\"enterActiveClass\" :leave-active-class=\"leaveActiveClass\" @after-leave=\"doDestroy\">\n <span\n ref=\"popper\"\n v-show=\"!disabled && showPopper\">\n <slot>{{ content }}</slot>\n </span>\n </transition>\n <slot name=\"reference\"></slot>\n </span>\n</template>\n\n<script>\n import Popper from 'popper.js';\n\n function on(element, event, handler) {\n if (element && event && handler) {\n document.addEventListener ? element.addEventListener(event, handler, false) : element.attachEvent('on' + event, handler);\n }\n }\n\n function off(element, event, handler) {\n if (element && event) {\n document.removeEventListener ? element.removeEventListener(event, handler, false) : element.detachEvent('on' + event, handler)\n }\n }\n\n export default {\n props: {\n trigger: {\n type: String,\n default: 'hover',\n validator: value => ['click', 'hover'].indexOf(value) > -1\n },\n delayOnMouseOver: {\n type: Number,\n default: 10,\n },\n delayOnMouseOut: {\n type: Number,\n default: 10,\n },\n disabled: {\n type: Boolean,\n default: false\n },\n content: String,\n enterActiveClass: String,\n leaveActiveClass: String,\n boundariesSelector: String,\n reference: {},\n forceShow: {\n type: Boolean,\n default: false\n },\n appendToBody: {\n type: Boolean,\n default: false\n },\n visibleArrow: {\n type: Boolean,\n default: true\n },\n transition: {\n type: String,\n default: ''\n },\n options: {\n type: Object,\n default() {\n return {};\n }\n }\n },\n\n data() {\n return {\n referenceElm: null,\n popperJS: null,\n showPopper: false,\n currentPlacement: '',\n popperOptions: {\n placement: 'bottom',\n gpuAcceleration: false\n }\n };\n },\n\n watch: {\n showPopper(value) {\n if (value) {\n this.$emit('show');\n this.updatePopper();\n } else {\n this.$emit('hide');\n }\n },\n\n forceShow: {\n handler(value) {\n this[value ? 'doShow' : 'doClose']();\n },\n immediate: true\n },\n\n disabled(value) {\n if (!value) {\n this.showPopper = false\n }\n }\n },\n\n created() {\n this.appendedArrow = false;\n this.appendedToBody = false;\n this.popperOptions = Object.assign(this.popperOptions, this.options);\n },\n\n mounted() {\n this.referenceElm = this.reference || this.$slots.reference[0].elm;\n this.popper = this.$slots.default[0].elm;\n\n switch (this.trigger) {\n case 'click':\n on(this.referenceElm, 'click', this.doToggle);\n on(document, 'click', this.handleDocumentClick);\n break;\n case 'hover':\n on(this.referenceElm, 'mouseover', this.onMouseOver);\n on(this.referenceElm, 'focus', this.onMouseOver);\n on(this.popper, 'mouseover', this.onMouseOver);\n on(this.popper, 'focus', this.onMouseOver);\n on(this.referenceElm, 'mouseout', this.onMouseOut);\n on(this.referenceElm, 'blur', this.onMouseOut);\n on(this.popper, 'mouseout', this.onMouseOut);\n on(this.popper, 'blur', this.onMouseOut);\n break;\n }\n },\n\n methods: {\n doToggle() {\n if (!this.forceShow) {\n this.showPopper = !this.showPopper;\n }\n },\n\n doShow() {\n this.showPopper = true;\n },\n\n doClose() {\n this.showPopper = false;\n },\n\n doDestroy() {\n if (this.showPopper) {\n return;\n }\n\n if (this.popperJS) {\n this.popperJS.destroy();\n this.popperJS = null;\n }\n\n if (this.appendedToBody) {\n this.appendedToBody = false;\n document.body.removeChild(this.popper.parentElement);\n }\n },\n\n createPopper() {\n this.$nextTick(() => {\n if (this.visibleArrow) {\n this.appendArrow(this.popper);\n }\n\n if (this.appendToBody && !this.appendedToBody) {\n this.appendedToBody = true;\n document.body.appendChild(this.popper.parentElement);\n }\n\n if (this.popperJS && this.popperJS.destroy) {\n this.popperJS.destroy();\n }\n\n if (this.boundariesSelector) {\n const boundariesElement = document.querySelector(this.boundariesSelector);\n\n if (boundariesElement) {\n this.popperOptions.modifiers = Object.assign({}, this.popperOptions.modifiers);\n this.popperOptions.modifiers.preventOverflow = Object.assign({}, this.popperOptions.modifiers.preventOverflow);\n this.popperOptions.modifiers.preventOverflow.boundariesElement = boundariesElement;\n }\n }\n\n this.popperOptions.onCreate = () => {\n this.$emit('created', this);\n this.$nextTick(this.updatePopper);\n };\n\n this.popperJS = new Popper(this.referenceElm, this.popper, this.popperOptions);\n });\n },\n\n destroyPopper() {\n off(this.referenceElm, 'click', this.doToggle);\n off(this.referenceElm, 'mouseup', this.doClose);\n off(this.referenceElm, 'mousedown', this.doShow);\n off(this.referenceElm, 'focus', this.doShow);\n off(this.referenceElm, 'blur', this.doClose);\n off(this.referenceElm, 'mouseout', this.onMouseOut);\n off(this.referenceElm, 'mouseover', this.onMouseOver);\n off(document, 'click', this.handleDocumentClick);\n\n this.showPopper = false;\n this.doDestroy();\n },\n\n appendArrow(element) {\n if (this.appendedArrow) {\n return;\n }\n\n this.appendedArrow = true;\n\n const arrow = document.createElement('div');\n arrow.setAttribute('x-arrow', '');\n arrow.className = 'popper__arrow';\n element.appendChild(arrow);\n },\n\n updatePopper() {\n this.popperJS ? this.popperJS.scheduleUpdate() : this.createPopper();\n },\n\n onMouseOver() {\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this.showPopper = true;\n }, this.delayOnMouseOver);\n },\n\n onMouseOut() {\n clearTimeout(this._timer);\n this._timer = setTimeout(() => {\n this.showPopper = false;\n }, this.delayOnMouseOut);\n },\n\n handleDocumentClick(e) {\n if (!this.$el || !this.referenceElm ||\n this.elementContains(this.$el, e.target) ||\n this.elementContains(this.referenceElm, e.target) ||\n !this.popper || this.elementContains(this.popper, e.target)\n ) {\n return;\n }\n\n this.$emit('documentClick');\n\n if (this.forceShow) {\n return;\n }\n\n this.showPopper = false;\n },\n\n elementContains(elm, otherElm) {\n if (typeof elm.contains === 'function') {\n return elm.contains(otherElm);\n }\n\n return false;\n }\n },\n\n destroyed() {\n this.destroyPopper();\n }\n }\n</script>\n"] }, media: undefined });
};
/* scoped */
var __vue_scope_id__ = undefined;
Expand All @@ -316,11 +326,10 @@
var __vue_is_functional_template__ = false;
/* component normalizer */
function __vue_normalize__(template, style, script$$1, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
var component = script$$1 || {};
var component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {};

{
component.__file = "/Users/igor/projects/vue-popper/src/component/popper.js.vue";
}
// For security concerns, we use only base name in production mode.
component.__file = "/Users/igor/projects/vue-popper/src/component/popper.js.vue";

if (!component.render) {
component.render = template.render;
Expand Down Expand Up @@ -361,7 +370,7 @@
/* style inject */
function __vue_create_injector__() {
var head = document.head || document.getElementsByTagName('head')[0];
var styles = {};
var styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {});
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());

return function addStyle(id, css) {
Expand Down Expand Up @@ -412,7 +421,7 @@
}
/* style inject SSR */

var VuePopper = __vue_normalize__(__vue_template__, __vue_inject_styles__, typeof __vue_script__ === 'undefined' ? {} : __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, typeof __vue_create_injector__ !== 'undefined' ? __vue_create_injector__ : function () {}, typeof __vue_create_injector_ssr__ !== 'undefined' ? __vue_create_injector_ssr__ : function () {});
var VuePopper = __vue_normalize__({ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, __vue_create_injector__, undefined);

return VuePopper;

Expand Down
Loading

0 comments on commit 27caef1

Please sign in to comment.