Comparing version 0.1.3 to 0.1.4
833
lib/index.js
@@ -1,833 +0,2 @@ | ||
/******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
/******/ | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = "/lib/"; | ||
/******/ | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
module.exports = __webpack_require__(1); | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _vue = __webpack_require__(8); | ||
var _vue2 = _interopRequireDefault(_vue); | ||
var _util = __webpack_require__(3); | ||
var _popupManager = __webpack_require__(2); | ||
var _popupManager2 = _interopRequireDefault(_popupManager); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
__webpack_require__(7); | ||
var idSeed = 1; | ||
var transitions = []; | ||
var hookTransition = function hookTransition(transition) { | ||
if (transitions.indexOf(transition) !== -1) return; | ||
var getVueInstance = function getVueInstance(element) { | ||
var instance = element.__vue__; | ||
if (!instance) { | ||
var textNode = element.previousSibling; | ||
if (textNode.__vue__) { | ||
instance = textNode.__vue__; | ||
} | ||
} | ||
return instance; | ||
}; | ||
_vue2.default.transition(transition, { | ||
afterEnter: function afterEnter(el) { | ||
var instance = getVueInstance(el); | ||
if (instance) { | ||
instance.doAfterOpen && instance.doAfterOpen(); | ||
} | ||
}, | ||
afterLeave: function afterLeave(el) { | ||
var instance = getVueInstance(el); | ||
if (instance) { | ||
instance.doAfterClose && instance.doAfterClose(); | ||
} | ||
} | ||
}); | ||
}; | ||
var getDOM = function getDOM(dom) { | ||
if (dom.nodeType === 3) { | ||
return dom.nextElementSibling; | ||
} | ||
return dom; | ||
}; | ||
exports.default = { | ||
props: { | ||
visible: { | ||
type: Boolean, | ||
twoWay: true, | ||
default: false | ||
}, | ||
transition: { | ||
type: String, | ||
default: '' | ||
}, | ||
openDelay: {}, | ||
closeDelay: {}, | ||
zIndex: {}, | ||
modal: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
modalClass: {}, | ||
closeOnPressEscape: { | ||
type: Boolean, | ||
default: false | ||
}, | ||
closeOnClickModal: { | ||
type: Boolean, | ||
default: false | ||
} | ||
}, | ||
created: function created() { | ||
if (this.transition) { | ||
hookTransition(this.transition); | ||
} | ||
}, | ||
compiled: function compiled() { | ||
this._popupId = 'popup-' + idSeed++; | ||
_popupManager2.default.register(this._popupId, this); | ||
}, | ||
beforeDestroy: function beforeDestroy() { | ||
_popupManager2.default.deregister(this._popupId); | ||
_popupManager2.default.closeModal(this._popupId); | ||
}, | ||
data: function data() { | ||
return { | ||
rendered: false | ||
}; | ||
}, | ||
watch: { | ||
visible: function visible(val) { | ||
var _this = this; | ||
if (val) { | ||
if (this._opening) return; | ||
if (!this.rendered) { | ||
this.rendered = true; | ||
_vue2.default.nextTick(function () { | ||
_this.open(); | ||
}); | ||
} else { | ||
this.open(); | ||
} | ||
} else { | ||
this.close(); | ||
} | ||
} | ||
}, | ||
methods: { | ||
open: function open(options) { | ||
var _this2 = this; | ||
if (!this.rendered) { | ||
this.rendered = true; | ||
this.visible = true; | ||
return; | ||
} | ||
var props = (0, _util.merge)({}, this, options); | ||
if (this._closeTimer) { | ||
clearTimeout(this._closeTimer); | ||
this._closeTimer = null; | ||
} | ||
clearTimeout(this._openTimer); | ||
var openDelay = Number(props.openDelay); | ||
if (openDelay > 0) { | ||
this._openTimer = setTimeout(function () { | ||
_this2._openTimer = null; | ||
_this2.doOpen(props); | ||
}, openDelay); | ||
} else { | ||
this.doOpen(props); | ||
} | ||
}, | ||
doOpen: function doOpen(props) { | ||
if (this.willOpen && !this.willOpen()) return; | ||
this._opening = true; | ||
this.visible = true; | ||
var dom = getDOM(this.$el); | ||
var modal = props.modal; | ||
if (modal) { | ||
if (this._closing) { | ||
_popupManager2.default.closeModal(this._popupId); | ||
this._closing = false; | ||
} | ||
_popupManager2.default.openModal(this._popupId, _popupManager2.default.nextZIndex(), dom, props.modalClass); | ||
} | ||
if (getComputedStyle(dom).position === 'static') { | ||
dom.style.position = 'absolute'; | ||
} | ||
var zIndex = props.zIndex; | ||
if (modal) { | ||
dom.style.zIndex = _popupManager2.default.nextZIndex(); | ||
} else if (zIndex) { | ||
dom.style.zIndex = zIndex; | ||
} | ||
this.onOpen && this.onOpen(); | ||
if (!this.transition) { | ||
this.doAfterOpen(); | ||
} | ||
}, | ||
doAfterOpen: function doAfterOpen() { | ||
this._opening = false; | ||
}, | ||
close: function close() { | ||
var _this3 = this; | ||
if (this.willClose && !this.willClose()) return; | ||
if (this._openTimer !== null) { | ||
clearTimeout(this._openTimer); | ||
this._openTimer = null; | ||
} | ||
clearTimeout(this._closeTimer); | ||
var closeDelay = Number(this.closeDelay); | ||
if (closeDelay > 0) { | ||
this._closeTimer = setTimeout(function () { | ||
_this3._closeTimer = null; | ||
_this3.doClose(); | ||
}, closeDelay); | ||
} else { | ||
this.doClose(); | ||
} | ||
}, | ||
doClose: function doClose() { | ||
this.visible = false; | ||
this._closing = true; | ||
this.onClose && this.onClose(); | ||
if (!this.transition) { | ||
this.doAfterClose(); | ||
} | ||
}, | ||
doAfterClose: function doAfterClose() { | ||
_popupManager2.default.closeModal(this._popupId); | ||
this._closing = false; | ||
} | ||
} | ||
}; | ||
/***/ }, | ||
/* 2 */ | ||
/***/ function(module, exports) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var getModal = function getModal() { | ||
var modalDom = PopupManager.modalDom; | ||
if (!modalDom) { | ||
modalDom = document.createElement('div'); | ||
PopupManager.modalDom = modalDom; | ||
modalDom.addEventListener('touchmove', function (event) { | ||
event.preventDefault(); | ||
event.stopPropagation(); | ||
}); | ||
modalDom.addEventListener('click', function () { | ||
PopupManager.doOnModalClick && PopupManager.doOnModalClick(); | ||
}); | ||
} | ||
return modalDom; | ||
}; | ||
var instances = {}; | ||
var PopupManager = { | ||
zIndex: 1000, | ||
getInstance: function getInstance(id) { | ||
return instances[id]; | ||
}, | ||
register: function register(id, instance) { | ||
if (id && instance) { | ||
instances[id] = instance; | ||
} | ||
}, | ||
deregister: function deregister(id) { | ||
if (id) { | ||
instances[id] = null; | ||
delete instances[id]; | ||
} | ||
}, | ||
nextZIndex: function nextZIndex() { | ||
return PopupManager.zIndex++; | ||
}, | ||
modalStack: [], | ||
doOnModalClick: function doOnModalClick() { | ||
var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1]; | ||
if (!topItem) return; | ||
var instance = PopupManager.getInstance(topItem.id); | ||
if (instance && instance.closeOnClickModal) { | ||
instance.close(); | ||
} | ||
}, | ||
openModal: function openModal(id, zIndex, dom, modalClass) { | ||
if (!id || zIndex === undefined) return; | ||
var modalStack = this.modalStack; | ||
for (var i = 0, j = modalStack.length; i < j; i++) { | ||
var item = modalStack[i]; | ||
if (item.id === id) { | ||
return; | ||
} | ||
} | ||
var modalDom = getModal(); | ||
modalDom.classList.add('v-modal'); | ||
modalDom.classList.add('modal-enter'); | ||
if (modalClass) { | ||
var classArr = modalClass.trim().split(/\s+/); | ||
classArr.forEach(function (item) { | ||
return modalDom.classList.add(item); | ||
}); | ||
} | ||
setTimeout(function () { | ||
modalDom.classList.remove('modal-enter'); | ||
}, 200); | ||
if (dom && dom.parentNode && dom.parentNode.nodeType !== 11) { | ||
dom.parentNode.appendChild(modalDom); | ||
} else { | ||
document.body.appendChild(modalDom); | ||
} | ||
if (zIndex) { | ||
modalDom.style.zIndex = zIndex; | ||
} | ||
modalDom.style.display = ''; | ||
this.modalStack.push({ id: id, zIndex: zIndex, modalClass: modalClass }); | ||
}, | ||
closeModal: function closeModal(id) { | ||
var modalStack = this.modalStack; | ||
var modalDom = getModal(); | ||
if (modalStack.length > 0) { | ||
var topItem = modalStack[modalStack.length - 1]; | ||
if (topItem.id === id) { | ||
if (topItem.modalClass) { | ||
var classArr = topItem.modalClass.trim().split(/\s+/); | ||
classArr.forEach(function (item) { | ||
return modalDom.classList.remove(item); | ||
}); | ||
} | ||
modalStack.pop(); | ||
if (modalStack.length > 0) { | ||
modalDom.style.zIndex = modalStack[modalStack.length - 1].zIndex; | ||
} | ||
} else { | ||
for (var i = modalStack.length - 1; i >= 0; i--) { | ||
if (modalStack[i].id === id) { | ||
modalStack.splice(i, 1); | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
if (modalStack.length === 0) { | ||
modalDom.classList.add('modal-leave'); | ||
setTimeout(function () { | ||
if (modalStack.length === 0) { | ||
if (modalDom.parentNode) modalDom.parentNode.removeChild(modalDom); | ||
modalDom.style.display = 'none'; | ||
} | ||
modalDom.classList.remove('modal-leave'); | ||
}, 200); | ||
} | ||
} | ||
}; | ||
window.addEventListener('keydown', function (event) { | ||
if (event.keyCode === 27) { | ||
if (PopupManager.modalStack.length > 0) { | ||
var topItem = PopupManager.modalStack[PopupManager.modalStack.length - 1]; | ||
if (!topItem) return; | ||
var instance = PopupManager.getInstance(topItem.id); | ||
if (instance.closeOnPressEscape) { | ||
instance.close(); | ||
} | ||
} | ||
} | ||
}); | ||
exports.default = PopupManager; | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.merge = merge; | ||
function merge(target) { | ||
for (var i = 1, j = arguments.length; i < j; i++) { | ||
var source = arguments[i]; | ||
for (var prop in source) { | ||
if (source.hasOwnProperty(prop)) { | ||
var value = source[prop]; | ||
if (value !== undefined) { | ||
target[prop] = value; | ||
} | ||
} | ||
} | ||
} | ||
return target; | ||
} | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
exports = module.exports = __webpack_require__(5)(); | ||
// imports | ||
// module | ||
exports.push([module.id, ".modal-enter {\n animation: modal-in .2s ease;\n}\n\n.modal-leave {\n animation: modal-out .2s ease;\n}\n\n@keyframes modal-in {\n 0% {\n opacity: 0;\n }\n 100% {\n }\n}\n\n@keyframes modal-out {\n 0% {\n }\n 100% {\n opacity: 0;\n }\n}\n\n.v-modal {\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n opacity: 0.5;\n background: #000;\n}", ""]); | ||
// exports | ||
/***/ }, | ||
/* 5 */ | ||
/***/ function(module, exports) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
// css base code, injected by the css-loader | ||
module.exports = function() { | ||
var list = []; | ||
// return the list of modules as css string | ||
list.toString = function toString() { | ||
var result = []; | ||
for(var i = 0; i < this.length; i++) { | ||
var item = this[i]; | ||
if(item[2]) { | ||
result.push("@media " + item[2] + "{" + item[1] + "}"); | ||
} else { | ||
result.push(item[1]); | ||
} | ||
} | ||
return result.join(""); | ||
}; | ||
// import a list of modules into the list | ||
list.i = function(modules, mediaQuery) { | ||
if(typeof modules === "string") | ||
modules = [[null, modules, ""]]; | ||
var alreadyImportedModules = {}; | ||
for(var i = 0; i < this.length; i++) { | ||
var id = this[i][0]; | ||
if(typeof id === "number") | ||
alreadyImportedModules[id] = true; | ||
} | ||
for(i = 0; i < modules.length; i++) { | ||
var item = modules[i]; | ||
// skip already imported module | ||
// this implementation is not 100% perfect for weird media query combinations | ||
// when a module is imported multiple times with different media queries. | ||
// I hope this will never occur (Hey this way we have smaller bundles) | ||
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { | ||
if(mediaQuery && !item[2]) { | ||
item[2] = mediaQuery; | ||
} else if(mediaQuery) { | ||
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; | ||
} | ||
list.push(item); | ||
} | ||
} | ||
}; | ||
return list; | ||
}; | ||
/***/ }, | ||
/* 6 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
var stylesInDom = {}, | ||
memoize = function(fn) { | ||
var memo; | ||
return function () { | ||
if (typeof memo === "undefined") memo = fn.apply(this, arguments); | ||
return memo; | ||
}; | ||
}, | ||
isOldIE = memoize(function() { | ||
return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase()); | ||
}), | ||
getHeadElement = memoize(function () { | ||
return document.head || document.getElementsByTagName("head")[0]; | ||
}), | ||
singletonElement = null, | ||
singletonCounter = 0, | ||
styleElementsInsertedAtTop = []; | ||
module.exports = function(list, options) { | ||
if(false) { | ||
if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment"); | ||
} | ||
options = options || {}; | ||
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style> | ||
// tags it will allow on a page | ||
if (typeof options.singleton === "undefined") options.singleton = isOldIE(); | ||
// By default, add <style> tags to the bottom of <head>. | ||
if (typeof options.insertAt === "undefined") options.insertAt = "bottom"; | ||
var styles = listToStyles(list); | ||
addStylesToDom(styles, options); | ||
return function update(newList) { | ||
var mayRemove = []; | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
domStyle.refs--; | ||
mayRemove.push(domStyle); | ||
} | ||
if(newList) { | ||
var newStyles = listToStyles(newList); | ||
addStylesToDom(newStyles, options); | ||
} | ||
for(var i = 0; i < mayRemove.length; i++) { | ||
var domStyle = mayRemove[i]; | ||
if(domStyle.refs === 0) { | ||
for(var j = 0; j < domStyle.parts.length; j++) | ||
domStyle.parts[j](); | ||
delete stylesInDom[domStyle.id]; | ||
} | ||
} | ||
}; | ||
} | ||
function addStylesToDom(styles, options) { | ||
for(var i = 0; i < styles.length; i++) { | ||
var item = styles[i]; | ||
var domStyle = stylesInDom[item.id]; | ||
if(domStyle) { | ||
domStyle.refs++; | ||
for(var j = 0; j < domStyle.parts.length; j++) { | ||
domStyle.parts[j](item.parts[j]); | ||
} | ||
for(; j < item.parts.length; j++) { | ||
domStyle.parts.push(addStyle(item.parts[j], options)); | ||
} | ||
} else { | ||
var parts = []; | ||
for(var j = 0; j < item.parts.length; j++) { | ||
parts.push(addStyle(item.parts[j], options)); | ||
} | ||
stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts}; | ||
} | ||
} | ||
} | ||
function listToStyles(list) { | ||
var styles = []; | ||
var newStyles = {}; | ||
for(var i = 0; i < list.length; i++) { | ||
var item = list[i]; | ||
var id = item[0]; | ||
var css = item[1]; | ||
var media = item[2]; | ||
var sourceMap = item[3]; | ||
var part = {css: css, media: media, sourceMap: sourceMap}; | ||
if(!newStyles[id]) | ||
styles.push(newStyles[id] = {id: id, parts: [part]}); | ||
else | ||
newStyles[id].parts.push(part); | ||
} | ||
return styles; | ||
} | ||
function insertStyleElement(options, styleElement) { | ||
var head = getHeadElement(); | ||
var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1]; | ||
if (options.insertAt === "top") { | ||
if(!lastStyleElementInsertedAtTop) { | ||
head.insertBefore(styleElement, head.firstChild); | ||
} else if(lastStyleElementInsertedAtTop.nextSibling) { | ||
head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling); | ||
} else { | ||
head.appendChild(styleElement); | ||
} | ||
styleElementsInsertedAtTop.push(styleElement); | ||
} else if (options.insertAt === "bottom") { | ||
head.appendChild(styleElement); | ||
} else { | ||
throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'."); | ||
} | ||
} | ||
function removeStyleElement(styleElement) { | ||
styleElement.parentNode.removeChild(styleElement); | ||
var idx = styleElementsInsertedAtTop.indexOf(styleElement); | ||
if(idx >= 0) { | ||
styleElementsInsertedAtTop.splice(idx, 1); | ||
} | ||
} | ||
function createStyleElement(options) { | ||
var styleElement = document.createElement("style"); | ||
styleElement.type = "text/css"; | ||
insertStyleElement(options, styleElement); | ||
return styleElement; | ||
} | ||
function createLinkElement(options) { | ||
var linkElement = document.createElement("link"); | ||
linkElement.rel = "stylesheet"; | ||
insertStyleElement(options, linkElement); | ||
return linkElement; | ||
} | ||
function addStyle(obj, options) { | ||
var styleElement, update, remove; | ||
if (options.singleton) { | ||
var styleIndex = singletonCounter++; | ||
styleElement = singletonElement || (singletonElement = createStyleElement(options)); | ||
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false); | ||
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true); | ||
} else if(obj.sourceMap && | ||
typeof URL === "function" && | ||
typeof URL.createObjectURL === "function" && | ||
typeof URL.revokeObjectURL === "function" && | ||
typeof Blob === "function" && | ||
typeof btoa === "function") { | ||
styleElement = createLinkElement(options); | ||
update = updateLink.bind(null, styleElement); | ||
remove = function() { | ||
removeStyleElement(styleElement); | ||
if(styleElement.href) | ||
URL.revokeObjectURL(styleElement.href); | ||
}; | ||
} else { | ||
styleElement = createStyleElement(options); | ||
update = applyToTag.bind(null, styleElement); | ||
remove = function() { | ||
removeStyleElement(styleElement); | ||
}; | ||
} | ||
update(obj); | ||
return function updateStyle(newObj) { | ||
if(newObj) { | ||
if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap) | ||
return; | ||
update(obj = newObj); | ||
} else { | ||
remove(); | ||
} | ||
}; | ||
} | ||
var replaceText = (function () { | ||
var textStore = []; | ||
return function (index, replacement) { | ||
textStore[index] = replacement; | ||
return textStore.filter(Boolean).join('\n'); | ||
}; | ||
})(); | ||
function applyToSingletonTag(styleElement, index, remove, obj) { | ||
var css = remove ? "" : obj.css; | ||
if (styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = replaceText(index, css); | ||
} else { | ||
var cssNode = document.createTextNode(css); | ||
var childNodes = styleElement.childNodes; | ||
if (childNodes[index]) styleElement.removeChild(childNodes[index]); | ||
if (childNodes.length) { | ||
styleElement.insertBefore(cssNode, childNodes[index]); | ||
} else { | ||
styleElement.appendChild(cssNode); | ||
} | ||
} | ||
} | ||
function applyToTag(styleElement, obj) { | ||
var css = obj.css; | ||
var media = obj.media; | ||
if(media) { | ||
styleElement.setAttribute("media", media) | ||
} | ||
if(styleElement.styleSheet) { | ||
styleElement.styleSheet.cssText = css; | ||
} else { | ||
while(styleElement.firstChild) { | ||
styleElement.removeChild(styleElement.firstChild); | ||
} | ||
styleElement.appendChild(document.createTextNode(css)); | ||
} | ||
} | ||
function updateLink(linkElement, obj) { | ||
var css = obj.css; | ||
var sourceMap = obj.sourceMap; | ||
if(sourceMap) { | ||
// http://stackoverflow.com/a/26603875 | ||
css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */"; | ||
} | ||
var blob = new Blob([css], { type: "text/css" }); | ||
var oldSrc = linkElement.href; | ||
linkElement.href = URL.createObjectURL(blob); | ||
if(oldSrc) | ||
URL.revokeObjectURL(oldSrc); | ||
} | ||
/***/ }, | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
// style-loader: Adds some css to the DOM by adding a <style> tag | ||
// load the styles | ||
var content = __webpack_require__(4); | ||
if(typeof content === 'string') content = [[module.id, content, '']]; | ||
// add the styles to the DOM | ||
var update = __webpack_require__(6)(content, {}); | ||
if(content.locals) module.exports = content.locals; | ||
// Hot Module Replacement | ||
if(false) { | ||
// When the styles change, update the <style> tags | ||
if(!content.locals) { | ||
module.hot.accept("!!./../../../../usr/local/lib/node_modules/cooking/node_modules/css-loader/index.js!./popup.css", function() { | ||
var newContent = require("!!./../../../../usr/local/lib/node_modules/cooking/node_modules/css-loader/index.js!./popup.css"); | ||
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']]; | ||
update(newContent); | ||
}); | ||
} | ||
// When the module is disposed, remove the <style> tags | ||
module.hot.dispose(function() { update(); }); | ||
} | ||
/***/ }, | ||
/* 8 */ | ||
/***/ function(module, exports) { | ||
module.exports = vue; | ||
/***/ } | ||
/******/ ]); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define("VuePopup",["vue"],t):"object"==typeof exports?exports.VuePopup=t(require("vue")):e.VuePopup=t(e.vue)}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="/lib/",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=o(4),s=n(i),l=o(2),r=o(1),a=n(r);o(3);var d=1,u=[],c=function(e){if(-1===u.indexOf(e)){var t=function(e){var t=e.__vue__;if(!t){var o=e.previousSibling;o.__vue__&&(t=o.__vue__)}return t};s["default"].transition(e,{afterEnter:function(e){var o=t(e);o&&o.doAfterOpen&&o.doAfterOpen()},afterLeave:function(e){var o=t(e);o&&o.doAfterClose&&o.doAfterClose()}})}},f=function(e){return 3===e.nodeType?e.nextElementSibling:e};t["default"]={props:{visible:{type:Boolean,twoWay:!0,"default":!1},transition:{type:String,"default":""},openDelay:{},closeDelay:{},zIndex:{},modal:{type:Boolean,"default":!1},modalClass:{},closeOnPressEscape:{type:Boolean,"default":!1},closeOnClickModal:{type:Boolean,"default":!1}},created:function(){this.transition&&c(this.transition)},compiled:function(){this._popupId="popup-"+d++,a["default"].register(this._popupId,this)},beforeDestroy:function(){a["default"].deregister(this._popupId),a["default"].closeModal(this._popupId)},data:function(){return{rendered:!1}},watch:{visible:function(e){var t=this;if(e){if(this._opening)return;this.rendered?this.open():(this.rendered=!0,s["default"].nextTick(function(){t.open()}))}else this.close()}},methods:{open:function(e){var t=this;if(!this.rendered)return this.rendered=!0,void(this.visible=!0);var o=(0,l.merge)({},this,e);this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),clearTimeout(this._openTimer);var n=Number(o.openDelay);n>0?this._openTimer=setTimeout(function(){t._openTimer=null,t.doOpen(o)},n):this.doOpen(o)},doOpen:function(e){if(!this.willOpen||this.willOpen()){this._opening=!0,this.visible=!0;var t=f(this.$el),o=e.modal;o&&(this._closing&&(a["default"].closeModal(this._popupId),this._closing=!1),a["default"].openModal(this._popupId,a["default"].nextZIndex(),t,e.modalClass)),"static"===getComputedStyle(t).position&&(t.style.position="absolute");var n=e.zIndex;o?t.style.zIndex=a["default"].nextZIndex():n&&(t.style.zIndex=n),this.onOpen&&this.onOpen(),this.transition||this.doAfterOpen()}},doAfterOpen:function(){this._opening=!1},close:function(){var e=this;if(!this.willClose||this.willClose()){null!==this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=null),clearTimeout(this._closeTimer);var t=Number(this.closeDelay);t>0?this._closeTimer=setTimeout(function(){e._closeTimer=null,e.doClose()},t):this.doClose()}},doClose:function(){this.visible=!1,this._closing=!0,this.onClose&&this.onClose(),this.transition||this.doAfterClose()},doAfterClose:function(){a["default"].closeModal(this._popupId),this._closing=!1}}}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e=i.modalDom;return e||(e=document.createElement("div"),i.modalDom=e,e.addEventListener("touchmove",function(e){e.preventDefault(),e.stopPropagation()}),e.addEventListener("click",function(){i.doOnModalClick&&i.doOnModalClick()})),e},n={},i={zIndex:1e3,getInstance:function(e){return n[e]},register:function(e,t){e&&t&&(n[e]=t)},deregister:function(e){e&&(n[e]=null,delete n[e])},nextZIndex:function(){return i.zIndex++},modalStack:[],doOnModalClick:function(){var e=i.modalStack[i.modalStack.length-1];if(e){var t=i.getInstance(e.id);t&&t.closeOnClickModal&&t.close()}},openModal:function(e,t,n,i){if(e&&void 0!==t){for(var s=this.modalStack,l=0,r=s.length;r>l;l++){var a=s[l];if(a.id===e)return}var d=o();if(d.classList.add("v-modal"),d.classList.add("modal-enter"),i){var u=i.trim().split(/\s+/);u.forEach(function(e){return d.classList.add(e)})}setTimeout(function(){d.classList.remove("modal-enter")},200),n&&n.parentNode&&11!==n.parentNode.nodeType?n.parentNode.appendChild(d):document.body.appendChild(d),t&&(d.style.zIndex=t),d.style.display="",this.modalStack.push({id:e,zIndex:t,modalClass:i})}},closeModal:function(e){var t=this.modalStack,n=o();if(t.length>0){var i=t[t.length-1];if(i.id===e){if(i.modalClass){var s=i.modalClass.trim().split(/\s+/);s.forEach(function(e){return n.classList.remove(e)})}t.pop(),t.length>0&&(n.style.zIndex=t[t.length-1].zIndex)}else for(var l=t.length-1;l>=0;l--)if(t[l].id===e){t.splice(l,1);break}}0===t.length&&(n.classList.add("modal-leave"),setTimeout(function(){0===t.length&&(n.parentNode&&n.parentNode.removeChild(n),n.style.display="none"),n.classList.remove("modal-leave")},200))}};window.addEventListener("keydown",function(e){if(27===e.keyCode&&i.modalStack.length>0){var t=i.modalStack[i.modalStack.length-1];if(!t)return;var o=i.getInstance(t.id);o.closeOnPressEscape&&o.close()}}),t["default"]=i},function(e,t){"use strict";function o(e){for(var t=1,o=arguments.length;o>t;t++){var n=arguments[t];for(var i in n)if(n.hasOwnProperty(i)){var s=n[i];void 0!==s&&(e[i]=s)}}return e}Object.defineProperty(t,"__esModule",{value:!0}),t.merge=o},function(e,t){},function(t,o){t.exports=e}])}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "vue-popup", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "A popup mixin for vue.js", | ||
@@ -11,2 +11,3 @@ "private": false, | ||
"dist": "cooking build -p", | ||
"prepublish": "cooking build --no-color", | ||
"deploy": "cooking build --no-color" | ||
@@ -13,0 +14,0 @@ }, |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13
43598
52
2