diff --git a/.babelrc b/.babelrc
deleted file mode 100644
index 75b86286..00000000
--- a/.babelrc
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "presets": [
- "es2015-loose",
- "stage-1"
- ],
- "plugins": [
- "transform-flow-comments"
- ]
-}
diff --git a/.browserslistrc b/.browserslistrc
new file mode 100644
index 00000000..9dee6464
--- /dev/null
+++ b/.browserslistrc
@@ -0,0 +1,3 @@
+> 1%
+last 2 versions
+not ie <= 8
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 00000000..1c6179f3
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,17 @@
+module.exports = {
+ root: true,
+ env: {
+ node: true
+ },
+ 'extends': [
+ 'plugin:vue/essential',
+ 'eslint:recommended'
+ ],
+ rules: {
+ 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
+ },
+ parserOptions: {
+ parser: 'babel-eslint'
+ }
+}
diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml
new file mode 100644
index 00000000..c2925fb8
--- /dev/null
+++ b/.github/FUNDING.yml
@@ -0,0 +1 @@
+github: jbaysolutions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 00000000..45af7344
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,35 @@
+---
+name: Bug report
+about: Create a report to help us improve
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+**Software version (please complete the following information):**
+ - Browser [e.g. chrome, safari]
+ - Vue Version [e.g. 2.5.7]
+ - vue-grid-layout Version: [e.g. 2.3.3]
+
+**Describe the bug**
+A clear and concise description of what the bug is.
+
+Please use the [CodeSandbox Template](https://codesandbox.io/s/5wy3rz5z1x?module=%2Fsrc%2FShowcaseLayout.js) to demonstrate your bug. It is much easier for us to help you if you do.
+
+
+**To Reproduce**
+Steps to reproduce the behavior:
+1. Go to '...'
+2. Click on '....'
+3. Scroll down to '....'
+4. See error
+
+**Expected behavior**
+A clear and concise description of what you expected to happen.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
+
+**Additional context**
+Add any other context about the problem here.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 00000000..2672375c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,22 @@
+---
+name: Feature request
+about: Suggest an idea for this project
+title: ''
+labels: ''
+assignees: ''
+
+---
+
+## If you have a feature request, please try to implement it before requesting it.
This is free software and the author is busy with other projects.
+
+**Is your feature request related to a problem? Please describe.**
+A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
+
+**Describe the solution you'd like**
+A clear and concise description of what you want to happen.
+
+**Describe alternatives you've considered**
+A clear and concise description of any alternative solutions or features you've considered.
+
+**Additional context**
+Add any other context or screenshots about the feature request here.
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
new file mode 100644
index 00000000..a6d9d440
--- /dev/null
+++ b/.github/workflows/build-test.yml
@@ -0,0 +1,32 @@
+name: Build and Test
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ matrix:
+ node-version: [10.x, 12.x, 14.x, 15.x]
+ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Use Node.js ${{ matrix.node-version }}
+ uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node-version }}
+ - name: Install dependency
+ run: yarn
+ - name: Lint check
+ run: yarn lint
+ - name: Build
+ run: yarn build
+ - name: Unit test
+ run: yarn test:unit
diff --git a/.github/workflows/vuepress-deploy.yml b/.github/workflows/vuepress-deploy.yml
new file mode 100644
index 00000000..a936b2b7
--- /dev/null
+++ b/.github/workflows/vuepress-deploy.yml
@@ -0,0 +1,24 @@
+name: Deploy vuepress website
+on:
+ push:
+ branches:
+ - master
+jobs:
+ build-and-deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@master
+
+ - uses: actions/setup-node@v2
+ with:
+ node-version: '16'
+
+ - name: vuepress-deploy
+ uses: jenkey2011/vuepress-deploy@master
+ env:
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
+ TARGET_REPO: jbaysolutions/vue-grid-layout
+ TARGET_BRANCH: gh-pages
+ BUILD_SCRIPT: cd website && yarn && yarn build
+ BUILD_DIR: public
diff --git a/.gitignore b/.gitignore
index fb39cb11..83dfe282 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,26 @@
.DS_Store
node_modules
-build
-npm-debug.log
-.idea
\ No newline at end of file
+#/dist
+dist/demo.html
+
+# local env files
+.env.local
+.env.*.local
+
+# Log files
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Editor directories and files
+.idea
+.vscode
+*.suo
+*.ntvs*
+*.njsproj
+*.sln
+*.sw*
+
+yarn-error.log
+
+website/docs/dist
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index 31cf303c..00000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,19 +0,0 @@
-# Changelog
-
-## 2.1.2 (Fev 16, 2017)
-
-* Implemented #12, buttons on GridItems would trigger drag on mobile
-* Implemented #24, listeners removal beforeDestroy (thanks [pbabey](https://github.com/pbabey))
-
-
-## 2.1.1 (Fev 9, 2017)
-
-* Implemented #13, dynamic row height update support
-* Implemented #23, dynamic enable/disable dragging and resizing support
-* Implemented #21, moved and resized events
-
-
-## 2.1.0 (Fev 6, 2017)
-
-* RTL support (thanks [easteregg](https://github.com/easteregg))
-* Move and resize events (thanks [ThePlastic](https://github.com/ThePlastic))
\ No newline at end of file
diff --git a/README-zh_CN.md b/README-zh_CN.md
new file mode 100644
index 00000000..e940b464
--- /dev/null
+++ b/README-zh_CN.md
@@ -0,0 +1,592 @@
+
, or missing
. Bailing hydration and performing ' + - 'full client-side render.' - ); - } - } - // either not server-rendered, or hydration failed. - // create an empty node and replace it - oldVnode = emptyNodeAt(oldVnode); - } - // replacing existing element - elm = oldVnode.elm; - parent = nodeOps.parentNode(elm); - createElm(vnode, insertedVnodeQueue, parent, nodeOps.nextSibling(elm)); - - if (vnode.parent) { - // component root element replaced. - // update parent placeholder node element, recursively - var ancestor = vnode.parent; - while (ancestor) { - ancestor.elm = vnode.elm; - ancestor = ancestor.parent; - } - if (isPatchable(vnode)) { - for (var i = 0; i < cbs.create.length; ++i) { - cbs.create[i](emptyNode, vnode.parent); - } - } - } - - if (parent !== null) { - removeVnodes(parent, [oldVnode], 0, 0); - } else if (isDef(oldVnode.tag)) { - invokeDestroyHook(oldVnode); - } - } - } - - invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch); - return vnode.elm - } -} - -/* */ - -var directives = { - create: updateDirectives, - update: updateDirectives, - destroy: function unbindDirectives (vnode) { - updateDirectives(vnode, emptyNode); - } -}; - -function updateDirectives (oldVnode, vnode) { - if (oldVnode.data.directives || vnode.data.directives) { - _update(oldVnode, vnode); - } -} - -function _update (oldVnode, vnode) { - var isCreate = oldVnode === emptyNode; - var isDestroy = vnode === emptyNode; - var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context); - var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context); - - var dirsWithInsert = []; - var dirsWithPostpatch = []; - - var key, oldDir, dir; - for (key in newDirs) { - oldDir = oldDirs[key]; - dir = newDirs[key]; - if (!oldDir) { - // new directive, bind - callHook$1(dir, 'bind', vnode, oldVnode); - if (dir.def && dir.def.inserted) { - dirsWithInsert.push(dir); - } - } else { - // existing directive, update - dir.oldValue = oldDir.value; - callHook$1(dir, 'update', vnode, oldVnode); - if (dir.def && dir.def.componentUpdated) { - dirsWithPostpatch.push(dir); - } - } - } - - if (dirsWithInsert.length) { - var callInsert = function () { - for (var i = 0; i < dirsWithInsert.length; i++) { - callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode); - } - }; - if (isCreate) { - mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert'); - } else { - callInsert(); - } - } - - if (dirsWithPostpatch.length) { - mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () { - for (var i = 0; i < dirsWithPostpatch.length; i++) { - callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode); - } - }, 'dir-postpatch'); - } - - if (!isCreate) { - for (key in oldDirs) { - if (!newDirs[key]) { - // no longer present, unbind - callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy); - } - } - } -} - -var emptyModifiers = Object.create(null); - -function normalizeDirectives$1 ( - dirs, - vm -) { - var res = Object.create(null); - if (!dirs) { - return res - } - var i, dir; - for (i = 0; i < dirs.length; i++) { - dir = dirs[i]; - if (!dir.modifiers) { - dir.modifiers = emptyModifiers; - } - res[getRawDirName(dir)] = dir; - dir.def = resolveAsset(vm.$options, 'directives', dir.name, true); - } - return res -} - -function getRawDirName (dir) { - return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.'))) -} - -function callHook$1 (dir, hook, vnode, oldVnode, isDestroy) { - var fn = dir.def && dir.def[hook]; - if (fn) { - fn(vnode.elm, dir, vnode, oldVnode, isDestroy); - } -} - -var baseModules = [ - ref, - directives -]; - -/* */ - -function updateAttrs (oldVnode, vnode) { - if (!oldVnode.data.attrs && !vnode.data.attrs) { - return - } - var key, cur, old; - var elm = vnode.elm; - var oldAttrs = oldVnode.data.attrs || {}; - var attrs = vnode.data.attrs || {}; - // clone observed objects, as the user probably wants to mutate it - if (attrs.__ob__) { - attrs = vnode.data.attrs = extend({}, attrs); - } - - for (key in attrs) { - cur = attrs[key]; - old = oldAttrs[key]; - if (old !== cur) { - setAttr(elm, key, cur); - } - } - // #4391: in IE9, setting type can reset value for input[type=radio] - /* istanbul ignore if */ - if (isIE9 && attrs.value !== oldAttrs.value) { - setAttr(elm, 'value', attrs.value); - } - for (key in oldAttrs) { - if (attrs[key] == null) { - if (isXlink(key)) { - elm.removeAttributeNS(xlinkNS, getXlinkProp(key)); - } else if (!isEnumeratedAttr(key)) { - elm.removeAttribute(key); - } - } - } -} - -function setAttr (el, key, value) { - if (isBooleanAttr(key)) { - // set attribute for blank value - // e.g. - if (isFalsyAttrValue(value)) { - el.removeAttribute(key); - } else { - el.setAttribute(key, key); - } - } else if (isEnumeratedAttr(key)) { - el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true'); - } else if (isXlink(key)) { - if (isFalsyAttrValue(value)) { - el.removeAttributeNS(xlinkNS, getXlinkProp(key)); - } else { - el.setAttributeNS(xlinkNS, key, value); - } - } else { - if (isFalsyAttrValue(value)) { - el.removeAttribute(key); - } else { - el.setAttribute(key, value); - } - } -} - -var attrs = { - create: updateAttrs, - update: updateAttrs -}; - -/* */ - -function updateClass (oldVnode, vnode) { - var el = vnode.elm; - var data = vnode.data; - var oldData = oldVnode.data; - if (!data.staticClass && !data.class && - (!oldData || (!oldData.staticClass && !oldData.class))) { - return - } - - var cls = genClassForVnode(vnode); - - // handle transition classes - var transitionClass = el._transitionClasses; - if (transitionClass) { - cls = concat(cls, stringifyClass(transitionClass)); - } - - // set the class - if (cls !== el._prevClass) { - el.setAttribute('class', cls); - el._prevClass = cls; - } -} - -var klass = { - create: updateClass, - update: updateClass -}; - -/* */ - -var target$1; - -function add$2 (event, handler, once, capture) { - if (once) { - var oldHandler = handler; - handler = function (ev) { - remove$3(event, handler, capture); - arguments.length === 1 - ? oldHandler(ev) - : oldHandler.apply(null, arguments); - }; - } - target$1.addEventListener(event, handler, capture); -} - -function remove$3 (event, handler, capture) { - target$1.removeEventListener(event, handler, capture); -} - -function updateDOMListeners (oldVnode, vnode) { - if (!oldVnode.data.on && !vnode.data.on) { - return - } - var on = vnode.data.on || {}; - var oldOn = oldVnode.data.on || {}; - target$1 = vnode.elm; - updateListeners(on, oldOn, add$2, remove$3, vnode.context); -} - -var events = { - create: updateDOMListeners, - update: updateDOMListeners -}; - -/* */ - -function updateDOMProps (oldVnode, vnode) { - if (!oldVnode.data.domProps && !vnode.data.domProps) { - return - } - var key, cur; - var elm = vnode.elm; - var oldProps = oldVnode.data.domProps || {}; - var props = vnode.data.domProps || {}; - // clone observed objects, as the user probably wants to mutate it - if (props.__ob__) { - props = vnode.data.domProps = extend({}, props); - } - - for (key in oldProps) { - if (props[key] == null) { - elm[key] = ''; - } - } - for (key in props) { - cur = props[key]; - // ignore children if the node has textContent or innerHTML, - // as these will throw away existing DOM nodes and cause removal errors - // on subsequent patches (#3360) - if (key === 'textContent' || key === 'innerHTML') { - if (vnode.children) { vnode.children.length = 0; } - if (cur === oldProps[key]) { continue } - } - // #4521: if a click event triggers update before the change event is - // dispatched on a checkbox/radio input, the input's checked state will - // be reset and fail to trigger another update. - /* istanbul ignore next */ - if (key === 'checked' && !isDirty(elm, cur)) { - continue - } - if (key === 'value') { - // store value as _value as well since - // non-string values will be stringified - elm._value = cur; - // avoid resetting cursor position when value is the same - var strCur = cur == null ? '' : String(cur); - if (shouldUpdateValue(elm, vnode, strCur)) { - elm.value = strCur; - } - } else { - elm[key] = cur; - } - } -} - -// check platforms/web/util/attrs.js acceptValue - - -function shouldUpdateValue ( - elm, - vnode, - checkVal -) { - if (!elm.composing && ( - vnode.tag === 'option' || - isDirty(elm, checkVal) || - isInputChanged(vnode, checkVal) - )) { - return true - } - return false -} - -function isDirty (elm, checkVal) { - return document.activeElement !== elm && elm.value !== checkVal -} - -function isInputChanged (vnode, newVal) { - var value = vnode.elm.value; - var modifiers = vnode.elm._vModifiers; // injected by v-model runtime - if ((modifiers && modifiers.number) || vnode.elm.type === 'number') { - return toNumber(value) !== toNumber(newVal) - } - if (modifiers && modifiers.trim) { - return value.trim() !== newVal.trim() - } - return value !== newVal -} - -var domProps = { - create: updateDOMProps, - update: updateDOMProps -}; - -/* */ - -var parseStyleText = cached(function (cssText) { - var res = {}; - var listDelimiter = /;(?![^(]*\))/g; - var propertyDelimiter = /:(.+)/; - cssText.split(listDelimiter).forEach(function (item) { - if (item) { - var tmp = item.split(propertyDelimiter); - tmp.length > 1 && (res[tmp[0].trim()] = tmp[1].trim()); - } - }); - return res -}); - -// merge static and dynamic style data on the same vnode -function normalizeStyleData (data) { - var style = normalizeStyleBinding(data.style); - // static style is pre-processed into an object during compilation - // and is always a fresh object, so it's safe to merge into it - return data.staticStyle - ? extend(data.staticStyle, style) - : style -} - -// normalize possible array / string values into Object -function normalizeStyleBinding (bindingStyle) { - if (Array.isArray(bindingStyle)) { - return toObject(bindingStyle) - } - if (typeof bindingStyle === 'string') { - return parseStyleText(bindingStyle) - } - return bindingStyle -} - -/** - * parent component style should be after child's - * so that parent component's style could override it - */ -function getStyle (vnode, checkChild) { - var res = {}; - var styleData; - - if (checkChild) { - var childNode = vnode; - while (childNode.child) { - childNode = childNode.child._vnode; - if (childNode.data && (styleData = normalizeStyleData(childNode.data))) { - extend(res, styleData); - } - } - } - - if ((styleData = normalizeStyleData(vnode.data))) { - extend(res, styleData); - } - - var parentNode = vnode; - while ((parentNode = parentNode.parent)) { - if (parentNode.data && (styleData = normalizeStyleData(parentNode.data))) { - extend(res, styleData); - } - } - return res -} - -/* */ - -var cssVarRE = /^--/; -var importantRE = /\s*!important$/; -var setProp = function (el, name, val) { - /* istanbul ignore if */ - if (cssVarRE.test(name)) { - el.style.setProperty(name, val); - } else if (importantRE.test(val)) { - el.style.setProperty(name, val.replace(importantRE, ''), 'important'); - } else { - el.style[normalize(name)] = val; - } -}; - -var prefixes = ['Webkit', 'Moz', 'ms']; - -var testEl; -var normalize = cached(function (prop) { - testEl = testEl || document.createElement('div'); - prop = camelize(prop); - if (prop !== 'filter' && (prop in testEl.style)) { - return prop - } - var upper = prop.charAt(0).toUpperCase() + prop.slice(1); - for (var i = 0; i < prefixes.length; i++) { - var prefixed = prefixes[i] + upper; - if (prefixed in testEl.style) { - return prefixed - } - } -}); - -function updateStyle (oldVnode, vnode) { - var data = vnode.data; - var oldData = oldVnode.data; - - if (!data.staticStyle && !data.style && - !oldData.staticStyle && !oldData.style) { - return - } - - var cur, name; - var el = vnode.elm; - var oldStaticStyle = oldVnode.data.staticStyle; - var oldStyleBinding = oldVnode.data.style || {}; - - // if static style exists, stylebinding already merged into it when doing normalizeStyleData - var oldStyle = oldStaticStyle || oldStyleBinding; - - var style = normalizeStyleBinding(vnode.data.style) || {}; - - vnode.data.style = style.__ob__ ? extend({}, style) : style; - - var newStyle = getStyle(vnode, true); - - for (name in oldStyle) { - if (newStyle[name] == null) { - setProp(el, name, ''); - } - } - for (name in newStyle) { - cur = newStyle[name]; - if (cur !== oldStyle[name]) { - // ie9 setting to null has no effect, must use empty string - setProp(el, name, cur == null ? '' : cur); - } - } -} - -var style = { - create: updateStyle, - update: updateStyle -}; - -/* */ - -/** - * Add class with compatibility for SVG since classList is not supported on - * SVG elements in IE - */ -function addClass (el, cls) { - /* istanbul ignore if */ - if (!cls || !cls.trim()) { - return - } - - /* istanbul ignore else */ - if (el.classList) { - if (cls.indexOf(' ') > -1) { - cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); }); - } else { - el.classList.add(cls); - } - } else { - var cur = ' ' + el.getAttribute('class') + ' '; - if (cur.indexOf(' ' + cls + ' ') < 0) { - el.setAttribute('class', (cur + cls).trim()); - } - } -} - -/** - * Remove class with compatibility for SVG since classList is not supported on - * SVG elements in IE - */ -function removeClass (el, cls) { - /* istanbul ignore if */ - if (!cls || !cls.trim()) { - return - } - - /* istanbul ignore else */ - if (el.classList) { - if (cls.indexOf(' ') > -1) { - cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); }); - } else { - el.classList.remove(cls); - } - } else { - var cur = ' ' + el.getAttribute('class') + ' '; - var tar = ' ' + cls + ' '; - while (cur.indexOf(tar) >= 0) { - cur = cur.replace(tar, ' '); - } - el.setAttribute('class', cur.trim()); - } -} - -/* */ - -var hasTransition = inBrowser && !isIE9; -var TRANSITION = 'transition'; -var ANIMATION = 'animation'; - -// Transition property/event sniffing -var transitionProp = 'transition'; -var transitionEndEvent = 'transitionend'; -var animationProp = 'animation'; -var animationEndEvent = 'animationend'; -if (hasTransition) { - /* istanbul ignore if */ - if (window.ontransitionend === undefined && - window.onwebkittransitionend !== undefined) { - transitionProp = 'WebkitTransition'; - transitionEndEvent = 'webkitTransitionEnd'; - } - if (window.onanimationend === undefined && - window.onwebkitanimationend !== undefined) { - animationProp = 'WebkitAnimation'; - animationEndEvent = 'webkitAnimationEnd'; - } -} - -var raf = (inBrowser && window.requestAnimationFrame) || setTimeout; -function nextFrame (fn) { - raf(function () { - raf(fn); - }); -} - -function addTransitionClass (el, cls) { - (el._transitionClasses || (el._transitionClasses = [])).push(cls); - addClass(el, cls); -} - -function removeTransitionClass (el, cls) { - if (el._transitionClasses) { - remove$1(el._transitionClasses, cls); - } - removeClass(el, cls); -} - -function whenTransitionEnds ( - el, - expectedType, - cb -) { - var ref = getTransitionInfo(el, expectedType); - var type = ref.type; - var timeout = ref.timeout; - var propCount = ref.propCount; - if (!type) { return cb() } - var event = type === TRANSITION ? transitionEndEvent : animationEndEvent; - var ended = 0; - var end = function () { - el.removeEventListener(event, onEnd); - cb(); - }; - var onEnd = function (e) { - if (e.target === el) { - if (++ended >= propCount) { - end(); - } - } - }; - setTimeout(function () { - if (ended < propCount) { - end(); - } - }, timeout + 1); - el.addEventListener(event, onEnd); -} - -var transformRE = /\b(transform|all)(,|$)/; - -function getTransitionInfo (el, expectedType) { - var styles = window.getComputedStyle(el); - var transitioneDelays = styles[transitionProp + 'Delay'].split(', '); - var transitionDurations = styles[transitionProp + 'Duration'].split(', '); - var transitionTimeout = getTimeout(transitioneDelays, transitionDurations); - var animationDelays = styles[animationProp + 'Delay'].split(', '); - var animationDurations = styles[animationProp + 'Duration'].split(', '); - var animationTimeout = getTimeout(animationDelays, animationDurations); - - var type; - var timeout = 0; - var propCount = 0; - /* istanbul ignore if */ - if (expectedType === TRANSITION) { - if (transitionTimeout > 0) { - type = TRANSITION; - timeout = transitionTimeout; - propCount = transitionDurations.length; - } - } else if (expectedType === ANIMATION) { - if (animationTimeout > 0) { - type = ANIMATION; - timeout = animationTimeout; - propCount = animationDurations.length; - } - } else { - timeout = Math.max(transitionTimeout, animationTimeout); - type = timeout > 0 - ? transitionTimeout > animationTimeout - ? TRANSITION - : ANIMATION - : null; - propCount = type - ? type === TRANSITION - ? transitionDurations.length - : animationDurations.length - : 0; - } - var hasTransform = - type === TRANSITION && - transformRE.test(styles[transitionProp + 'Property']); - return { - type: type, - timeout: timeout, - propCount: propCount, - hasTransform: hasTransform - } -} - -function getTimeout (delays, durations) { - /* istanbul ignore next */ - while (delays.length < durations.length) { - delays = delays.concat(delays); - } - - return Math.max.apply(null, durations.map(function (d, i) { - return toMs(d) + toMs(delays[i]) - })) -} - -function toMs (s) { - return Number(s.slice(0, -1)) * 1000 -} - -/* */ - -function enter (vnode, toggleDisplay) { - var el = vnode.elm; - - // call leave callback now - if (el._leaveCb) { - el._leaveCb.cancelled = true; - el._leaveCb(); - } - - var data = resolveTransition(vnode.data.transition); - if (!data) { - return - } - - /* istanbul ignore if */ - if (el._enterCb || el.nodeType !== 1) { - return - } - - var css = data.css; - var type = data.type; - var enterClass = data.enterClass; - var enterToClass = data.enterToClass; - var enterActiveClass = data.enterActiveClass; - var appearClass = data.appearClass; - var appearToClass = data.appearToClass; - var appearActiveClass = data.appearActiveClass; - var beforeEnter = data.beforeEnter; - var enter = data.enter; - var afterEnter = data.afterEnter; - var enterCancelled = data.enterCancelled; - var beforeAppear = data.beforeAppear; - var appear = data.appear; - var afterAppear = data.afterAppear; - var appearCancelled = data.appearCancelled; - - // activeInstance will always be the