├── .gitignore ├── package.json ├── LICENSE ├── README_CN.md ├── README.md ├── README_EN.md ├── src └── index.js ├── dist ├── vue-edge-check.es.js ├── vue-edge-check.js └── vue-edge-check.umd.js └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # nyc test coverage 18 | .nyc_output 19 | 20 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 21 | .grunt 22 | 23 | # node-waf configuration 24 | .lock-wscript 25 | 26 | # Compiled binary addons (http://nodejs.org/api/addons.html) 27 | build/Release 28 | 29 | # Dependency directories 30 | node_modules 31 | jspm_packages 32 | 33 | # Optional npm cache directory 34 | .npm 35 | 36 | # Optional REPL history 37 | .node_repl_history 38 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-edge-check", 3 | "version": "1.0.3", 4 | "description": "Check Browser Edge Reactively", 5 | "main": "dist/vue-edge-check.common.js", 6 | "module": "dist/vue-edge-check.es.js", 7 | "jsnext:main": "dist/vue-edge-check.es.js", 8 | "scripts": { 9 | "build": "rollup --config build/rollup.config.js", 10 | "minify": "rollup --config build/rollup.config.js --environment minify" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/gu-fan/vue-edge-check.git" 15 | }, 16 | "keywords": [ 17 | "vue", 18 | "edge", 19 | "ios" 20 | ], 21 | "author": "gu.fan@qq.com", 22 | "license": "MIT", 23 | "bugs": { 24 | "url": "https://github.com/gu-fan/vue-edge-check/issues" 25 | }, 26 | "homepage": "https://github.com/gu-fan/vue-edge-check#readme", 27 | "devDependencies": { 28 | "rollup": "^0.54.0", 29 | "rollup-plugin-buble": "^0.18.0", 30 | "rollup-plugin-commonjs": "^8.2.6", 31 | "rollup-plugin-node-resolve": "^3.0.2", 32 | "rollup-plugin-uglify": "^2.0.1" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Tabbies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README_CN.md: -------------------------------------------------------------------------------- 1 | # vue-edge-check 2 | 3 | [English](https://github.com/gu-fan/vue-edge-check/blob/master/README_EN.md#vue-edge-check) / [中文](https://github.com/gu-fan/vue-edge-check/blob/master/README_CN.md#vue-edge-check) 4 | 5 | 检查浏览器的边缘是否被触碰。 6 | 防止边缘滑动时,`vue-router`中transition的效果重复触发:sparkles: 7 | 8 | **Before** 9 | 10 | ![Odd Effect](https://user-images.githubusercontent.com/579129/34886679-be522206-f7fe-11e7-8ba9-79c7b486a4cc.gif) 11 | 12 | **After** 13 | 14 | ![Good Effect](https://user-images.githubusercontent.com/579129/34886822-58fa617e-f7ff-11e7-98a6-f287992ea749.gif) 15 | 16 | ## 为啥 17 | 18 | iOS的Safari/WKWebview/微信中,可以边缘滑动到上一个和下一个页面。 19 | 在滑动完毕后,页面才会触发`history.back()/history.forward()`。 20 | 然后router的transition动画还会再次触发,效果就多余了。 21 | 22 | 因此我们可以检测返回/前进的时候是否触碰到边缘,从而忽略本次效果:sparkles: 23 | 24 | ![Page](https://user-images.githubusercontent.com/579129/34906362-108e5794-f8a7-11e7-897f-a80d5398323c.png) 25 | 26 | ## 安装 27 | 28 | `npm install vue-edge-check` 29 | 30 | 或 31 | 32 | `yarn add vue-edge-check` 33 | 34 | 35 | ## 使用 36 | 37 | 引入后,有两个属性 `$isEdgeLeft` 和 `$isEdgeRight`, 38 | 代表触碰到页面左侧以及页面右侧。 39 | 40 | 可以用在组件中定义需要的class 41 | 42 | 引入组件 43 | ````javascript 44 | import EdgeCheck from 'vue-edge-check' 45 | Vue.use(EdgeCheck) 46 | ```` 47 | 48 | 定义class 49 | ````vue 50 | 59 | ```` 60 | 61 | 62 | 定义/屏蔽transition效果 63 | ````css 64 | 65 | // ORIGIN: set slide transition effect time 66 | .slide-enter-active, .slide-leave-active { 67 | transition: all 0.3s; 68 | } 69 | 70 | // ORIGIN: add slide transition effect 71 | .slide-enter, 72 | .slide-leave-to 73 | { 74 | transform: translate3d(100%, 0, 0); 75 | } 76 | 77 | // EXTRA: this component should have no transition with edge forward/back 78 | .is-edge-forward.slide-enter-active, 79 | .is-edge-back.slide-leave-active 80 | { 81 | transition: all 0s; 82 | } 83 | 84 | // EXTRA: this component should not display at slide-leave start 85 | // or else it will blink 86 | .is-edge-back.slide-leave, 87 | { 88 | transform: translate3d(100%, 0, 0); 89 | } 90 | 91 | // EXTRA: this component should display and not move at slide-enter start 92 | // or else it will jump 93 | .is-edge-forward.slide-enter, 94 | { 95 | transform: translate3d(0, 0, 0); 96 | } 97 | 98 | ```` 99 | 100 | ## 选项 101 | 102 | **edge_width**: 默认值: 48 103 | 104 | 边缘检测的宽度 105 | 106 | **edge_duration**: 默认值: 500 107 | 108 | 属性 `$isEdgeLeft/$isEdgeRight`的持续时间,需要略大于效果的时间 109 | 110 | ````javascript 111 | 112 | // in case if you have a longer transition effect 113 | Vue.use(EdgeCheck, {edge_duration:1000}) 114 | 115 | ```` 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-edge-check 2 | 3 | [English](https://github.com/gu-fan/vue-edge-check/blob/master/README_EN.md#vue-edge-check) / [中文](https://github.com/gu-fan/vue-edge-check/blob/master/README_CN.md#vue-edge-check) 4 | 5 | Check Browser Edge Reactively.To prevent transition effect triggered oddly when swipe edge with `vue-router`:sparkles: 6 | 7 | **Before** 8 | 9 | ![Odd Effect](https://user-images.githubusercontent.com/579129/34886679-be522206-f7fe-11e7-8ba9-79c7b486a4cc.gif) 10 | 11 | **After** 12 | 13 | ![Good Effect](https://user-images.githubusercontent.com/579129/34886822-58fa617e-f7ff-11e7-98a6-f287992ea749.gif) 14 | 15 | 16 | ## Why & How ? 17 | 18 | You can swipe with edge gesture in iOS Safari/WKWebview/Wechat. 19 | The page will trigger `history.back()/history.forward()` after the 20 | page is sliding finished. 21 | then the transition animation of router will still triggering, 22 | that's redundant. 23 | 24 | So we can check if we touch the edge when move back/forward, then 25 | block current transition effect :sparkles: 26 | 27 | ![Page](https://user-images.githubusercontent.com/579129/34906362-108e5794-f8a7-11e7-897f-a80d5398323c.png) 28 | 29 | ## Install 30 | 31 | `npm install vue-edge-check` 32 | 33 | OR 34 | 35 | `yarn add vue-edge-check` 36 | 37 | ## Useage 38 | 39 | Two Propery `$isEdgeLeft` 和 `$isEdgeRight`, 40 | Means touching left edge or right edge of page 41 | 42 | can be used to define class in components 43 | 44 | import and use 45 | ````javascript 46 | import EdgeCheck from 'vue-edge-check' 47 | Vue.use(EdgeCheck) 48 | ```` 49 | 50 | define class 51 | ````vue 52 | 61 | ```` 62 | 63 | 64 | define / block transition effect 65 | ````css 66 | 67 | // ORIGIN: set slide transition effect time 68 | .slide-enter-active, .slide-leave-active { 69 | transition: all 0.3s; 70 | } 71 | 72 | // ORIGIN: add slide transition effect 73 | .slide-enter, 74 | .slide-leave-to 75 | { 76 | transform: translate3d(100%, 0, 0); 77 | } 78 | 79 | // EXTRA: this component should have no transition with edge forward/back 80 | .is-edge-forward.slide-enter-active, 81 | .is-edge-back.slide-leave-active 82 | { 83 | transition: all 0s; 84 | } 85 | 86 | // EXTRA: this component should not display at slide-leave start 87 | // or else it will blink 88 | .is-edge-back.slide-leave, 89 | { 90 | transform: translate3d(100%, 0, 0); 91 | } 92 | 93 | // EXTRA: this component should display and not move at slide-enter start 94 | // or else it will jump 95 | .is-edge-forward.slide-enter, 96 | { 97 | transform: translate3d(0, 0, 0); 98 | } 99 | 100 | ```` 101 | 102 | ## Options 103 | 104 | **edge_width**: default: 48 105 | 106 | the width of edge check 107 | 108 | **edge_duration**: default: 500 109 | 110 | the `$isEdgeLeft/$isEdgeRight` property lasting time, need a bit more than transition effect time 111 | 112 | ````javascript 113 | 114 | // in case if you have a longer transition effect 115 | Vue.use(EdgeCheck, {edge_duration:1000}) 116 | 117 | ```` 118 | -------------------------------------------------------------------------------- /README_EN.md: -------------------------------------------------------------------------------- 1 | # vue-edge-check 2 | 3 | [English](https://github.com/gu-fan/vue-edge-check/blob/master/README_EN.md#vue-edge-check) / [中文](https://github.com/gu-fan/vue-edge-check/blob/master/README_CN.md#vue-edge-check) 4 | 5 | Check Browser Edge Reactively.To prevent transition effect triggered oddly when swipe edge with `vue-router`:sparkles: 6 | 7 | **Before** 8 | 9 | ![Odd Effect](https://user-images.githubusercontent.com/579129/34886679-be522206-f7fe-11e7-8ba9-79c7b486a4cc.gif) 10 | 11 | **After** 12 | 13 | ![Good Effect](https://user-images.githubusercontent.com/579129/34886822-58fa617e-f7ff-11e7-98a6-f287992ea749.gif) 14 | 15 | 16 | ## Why & How ? 17 | 18 | You can swipe with edge gesture in iOS Safari/WKWebview/Wechat. 19 | The page will trigger `history.back()/history.forward()` after the 20 | page is sliding finished. 21 | then the transition animation of router will still triggering, 22 | that's redundant. 23 | 24 | So we can check if we touch the edge when move back/forward, then 25 | block current transition effect :sparkles: 26 | 27 | ![Page](https://user-images.githubusercontent.com/579129/34906362-108e5794-f8a7-11e7-897f-a80d5398323c.png) 28 | 29 | ## Install 30 | 31 | `npm install vue-edge-check` 32 | 33 | OR 34 | 35 | `yarn add vue-edge-check` 36 | 37 | ## Useage 38 | 39 | Two Propery `$isEdgeLeft` 和 `$isEdgeRight`, 40 | Means touching left edge or right edge of page 41 | 42 | can be used to define class in components 43 | 44 | import and use 45 | ````javascript 46 | import EdgeCheck from 'vue-edge-check' 47 | Vue.use(EdgeCheck) 48 | ```` 49 | 50 | define class 51 | ````vue 52 | 61 | ```` 62 | 63 | 64 | define / block transition effect 65 | ````css 66 | 67 | // ORIGIN: set slide transition effect time 68 | .slide-enter-active, .slide-leave-active { 69 | transition: all 0.3s; 70 | } 71 | 72 | // ORIGIN: add slide transition effect 73 | .slide-enter, 74 | .slide-leave-to 75 | { 76 | transform: translate3d(100%, 0, 0); 77 | } 78 | 79 | // EXTRA: this component should have no transition with edge forward/back 80 | .is-edge-forward.slide-enter-active, 81 | .is-edge-back.slide-leave-active 82 | { 83 | transition: all 0s; 84 | } 85 | 86 | // EXTRA: this component should not display at slide-leave start 87 | // or else it will blink 88 | .is-edge-back.slide-leave, 89 | { 90 | transform: translate3d(100%, 0, 0); 91 | } 92 | 93 | // EXTRA: this component should display and not move at slide-enter start 94 | // or else it will jump 95 | .is-edge-forward.slide-enter, 96 | { 97 | transform: translate3d(0, 0, 0); 98 | } 99 | 100 | ```` 101 | 102 | ## Options 103 | 104 | **edge_width**: default: 48 105 | 106 | the width of edge check 107 | 108 | **edge_duration**: default: 500 109 | 110 | the `$isEdgeLeft/$isEdgeRight` property lasting time, need a bit more than transition effect time 111 | 112 | ````javascript 113 | 114 | // in case if you have a longer transition effect 115 | Vue.use(EdgeCheck, {edge_duration:1000}) 116 | 117 | ```` 118 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const plugin = { 2 | timerL: null, 3 | timerR: null, 4 | screen: {x: -1, y: -1}, 5 | touch: {x: -1, y: -1}, 6 | options: { 7 | EDGE_WIDTH: 48, 8 | EDGE_DURATION: 500 9 | }, 10 | actions: { 11 | touchstart (e) { 12 | 13 | if (e.touches.length != 1) return 14 | 15 | const EDGE_WIDTH = plugin.options.EDGE_WIDTH 16 | const EDGE_DURATION = plugin.options.EDGE_DURATION 17 | 18 | plugin.screen.x = window.screen.width 19 | plugin.screen.y = window.screen.height 20 | plugin.touch.x = e.touches[0].clientX 21 | plugin.touch.y = e.touches[0].clientY 22 | 23 | if (plugin.touch.x >= 0 && plugin.touch.x < EDGE_WIDTH) { 24 | plugin.vm.isLeft = true 25 | return 26 | } else { 27 | plugin.vm.isLeft = false 28 | } 29 | 30 | if (plugin.screen.x - plugin.touch.x < EDGE_WIDTH) { 31 | plugin.vm.isRight = true 32 | 33 | // Reset Right in 800 + 500 ms, 34 | // as there is no touchend event on forwarding page. 35 | if (plugin.timerR) clearTimeout(plugin.timerR) 36 | plugin.timerR = setTimeout(() => { 37 | plugin.vm.isRight = false 38 | }, 800 + EDGE_DURATION) 39 | 40 | } else { 41 | 42 | plugin.vm.isRight = false 43 | 44 | } 45 | }, 46 | touchend (e) { 47 | 48 | // no need to reset 49 | if (!plugin.vm.isLeft) return 50 | 51 | // Reset Left after touchend + 500ms 52 | if (plugin.timerL) clearTimeout(plugin.timerL) 53 | plugin.timerL = setTimeout(() => { 54 | plugin.vm.isLeft = false 55 | }, plugin.options.EDGE_DURATION) 56 | } 57 | }, 58 | bindEvents () { 59 | if (window && window.document) { 60 | window.document.addEventListener('touchstart', plugin.actions.touchstart, false) 61 | window.document.addEventListener('touchend', plugin.actions.touchend, false) 62 | return true 63 | } else { 64 | return false 65 | } 66 | }, 67 | setupVM () { 68 | plugin.vm = new plugin.Vue({data: {isLeft: false, isRight: false}}) 69 | }, 70 | setupProperty () { 71 | Object.defineProperties(plugin.Vue.prototype, { 72 | '$isEdgeLeft': { 73 | 'get': function () { 74 | return plugin.vm.isLeft 75 | }, 76 | 'set': function (value) { 77 | plugin.vm.isLeft = value 78 | } 79 | } 80 | }) 81 | 82 | Object.defineProperties(plugin.Vue.prototype, { 83 | '$isEdgeRight': { 84 | 'get': function () { 85 | return plugin.vm.isRight 86 | }, 87 | 'set': function (value) { 88 | plugin.vm.isRight = value 89 | } 90 | } 91 | }) 92 | }, 93 | install (Vue, options) { 94 | 95 | if (plugin.installed) return 96 | 97 | if (!plugin.bindEvents()) { 98 | throw new Error('[vue-edge-back] Can only be used in browser.') 99 | } 100 | 101 | if (options) { 102 | if (options.edge_width) plugin.options.EDGE_WIDTH = options.edge_width 103 | if (options.edge_duration) plugin.options.EDGE_DURATION = options.edge_duration 104 | } 105 | 106 | plugin.Vue = Vue 107 | plugin.setupVM() 108 | plugin.setupProperty() 109 | plugin.installed = true 110 | 111 | } 112 | } 113 | 114 | export default plugin 115 | -------------------------------------------------------------------------------- /dist/vue-edge-check.es.js: -------------------------------------------------------------------------------- 1 | var plugin = { 2 | timerL: null, 3 | timerR: null, 4 | screen: {x: -1, y: -1}, 5 | touch: {x: -1, y: -1}, 6 | options: { 7 | EDGE_WIDTH: 48, 8 | EDGE_DURATION: 500 9 | }, 10 | actions: { 11 | touchstart: function touchstart (e) { 12 | 13 | if (e.touches.length != 1) { return } 14 | 15 | var EDGE_WIDTH = plugin.options.EDGE_WIDTH; 16 | var EDGE_DURATION = plugin.options.EDGE_DURATION; 17 | 18 | plugin.screen.x = window.screen.width; 19 | plugin.screen.y = window.screen.height; 20 | plugin.touch.x = e.touches[0].clientX; 21 | plugin.touch.y = e.touches[0].clientY; 22 | 23 | if (plugin.touch.x >= 0 && plugin.touch.x < EDGE_WIDTH) { 24 | plugin.vm.isLeft = true; 25 | return 26 | } else { 27 | plugin.vm.isLeft = false; 28 | } 29 | 30 | if (plugin.screen.x - plugin.touch.x < EDGE_WIDTH) { 31 | plugin.vm.isRight = true; 32 | 33 | // Reset Right in 800 + 500 ms, 34 | // as there is no touchend event on forwarding page. 35 | if (plugin.timerR) { clearTimeout(plugin.timerR); } 36 | plugin.timerR = setTimeout(function () { 37 | plugin.vm.isRight = false; 38 | }, 800 + EDGE_DURATION); 39 | 40 | } else { 41 | 42 | plugin.vm.isRight = false; 43 | 44 | } 45 | }, 46 | touchend: function touchend (e) { 47 | 48 | // no need to reset 49 | if (!plugin.vm.isLeft) { return } 50 | 51 | // Reset Left after touchend + 500ms 52 | if (plugin.timerL) { clearTimeout(plugin.timerL); } 53 | plugin.timerL = setTimeout(function () { 54 | plugin.vm.isLeft = false; 55 | }, plugin.options.EDGE_DURATION); 56 | } 57 | }, 58 | bindEvents: function bindEvents () { 59 | if (window && window.document) { 60 | window.document.addEventListener('touchstart', plugin.actions.touchstart, false); 61 | window.document.addEventListener('touchend', plugin.actions.touchend, false); 62 | return true 63 | } else { 64 | return false 65 | } 66 | }, 67 | setupVM: function setupVM () { 68 | plugin.vm = new plugin.Vue({data: {isLeft: false, isRight: false}}); 69 | }, 70 | setupProperty: function setupProperty () { 71 | Object.defineProperties(plugin.Vue.prototype, { 72 | '$isEdgeLeft': { 73 | 'get': function () { 74 | return plugin.vm.isLeft 75 | }, 76 | 'set': function (value) { 77 | plugin.vm.isLeft = value; 78 | } 79 | } 80 | }); 81 | 82 | Object.defineProperties(plugin.Vue.prototype, { 83 | '$isEdgeRight': { 84 | 'get': function () { 85 | return plugin.vm.isRight 86 | }, 87 | 'set': function (value) { 88 | plugin.vm.isRight = value; 89 | } 90 | } 91 | }); 92 | }, 93 | install: function install (Vue, options) { 94 | 95 | if (plugin.installed) { return } 96 | 97 | if (!plugin.bindEvents()) { 98 | throw new Error('[vue-edge-back] Can only be used in browser.') 99 | } 100 | 101 | if (options) { 102 | if (options.edge_width) { plugin.options.EDGE_WIDTH = options.edge_width; } 103 | if (options.edge_duration) { plugin.options.EDGE_DURATION = options.edge_duration; } 104 | } 105 | 106 | plugin.Vue = Vue; 107 | plugin.setupVM(); 108 | plugin.setupProperty(); 109 | plugin.installed = true; 110 | 111 | } 112 | }; 113 | 114 | export default plugin; 115 | -------------------------------------------------------------------------------- /dist/vue-edge-check.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var plugin = { 4 | timerL: null, 5 | timerR: null, 6 | screen: {x: -1, y: -1}, 7 | touch: {x: -1, y: -1}, 8 | options: { 9 | EDGE_WIDTH: 48, 10 | EDGE_DURATION: 500 11 | }, 12 | actions: { 13 | touchstart: function touchstart (e) { 14 | 15 | if (e.touches.length != 1) { return } 16 | 17 | var EDGE_WIDTH = plugin.options.EDGE_WIDTH; 18 | var EDGE_DURATION = plugin.options.EDGE_DURATION; 19 | 20 | plugin.screen.x = window.screen.width; 21 | plugin.screen.y = window.screen.height; 22 | plugin.touch.x = e.touches[0].clientX; 23 | plugin.touch.y = e.touches[0].clientY; 24 | 25 | if (plugin.touch.x >= 0 && plugin.touch.x < EDGE_WIDTH) { 26 | plugin.vm.isLeft = true; 27 | return 28 | } else { 29 | plugin.vm.isLeft = false; 30 | } 31 | 32 | if (plugin.screen.x - plugin.touch.x < EDGE_WIDTH) { 33 | plugin.vm.isRight = true; 34 | 35 | // Reset Right in 800 + 500 ms, 36 | // as there is no touchend event on forwarding page. 37 | if (plugin.timerR) { clearTimeout(plugin.timerR); } 38 | plugin.timerR = setTimeout(function () { 39 | plugin.vm.isRight = false; 40 | }, 800 + EDGE_DURATION); 41 | 42 | } else { 43 | 44 | plugin.vm.isRight = false; 45 | 46 | } 47 | }, 48 | touchend: function touchend (e) { 49 | 50 | // no need to reset 51 | if (!plugin.vm.isLeft) { return } 52 | 53 | // Reset Left after touchend + 500ms 54 | if (plugin.timerL) { clearTimeout(plugin.timerL); } 55 | plugin.timerL = setTimeout(function () { 56 | plugin.vm.isLeft = false; 57 | }, plugin.options.EDGE_DURATION); 58 | } 59 | }, 60 | bindEvents: function bindEvents () { 61 | if (window && window.document) { 62 | window.document.addEventListener('touchstart', plugin.actions.touchstart, false); 63 | window.document.addEventListener('touchend', plugin.actions.touchend, false); 64 | return true 65 | } else { 66 | return false 67 | } 68 | }, 69 | setupVM: function setupVM () { 70 | plugin.vm = new plugin.Vue({data: {isLeft: false, isRight: false}}); 71 | }, 72 | setupProperty: function setupProperty () { 73 | Object.defineProperties(plugin.Vue.prototype, { 74 | '$isEdgeLeft': { 75 | 'get': function () { 76 | return plugin.vm.isLeft 77 | }, 78 | 'set': function (value) { 79 | plugin.vm.isLeft = value; 80 | } 81 | } 82 | }); 83 | 84 | Object.defineProperties(plugin.Vue.prototype, { 85 | '$isEdgeRight': { 86 | 'get': function () { 87 | return plugin.vm.isRight 88 | }, 89 | 'set': function (value) { 90 | plugin.vm.isRight = value; 91 | } 92 | } 93 | }); 94 | }, 95 | install: function install (Vue, options) { 96 | 97 | if (plugin.installed) { return } 98 | 99 | if (!plugin.bindEvents()) { 100 | throw new Error('[vue-edge-back] Can only be used in browser.') 101 | } 102 | 103 | if (options) { 104 | if (options.edge_width) { plugin.options.EDGE_WIDTH = options.edge_width; } 105 | if (options.edge_duration) { plugin.options.EDGE_DURATION = options.edge_duration; } 106 | } 107 | 108 | plugin.Vue = Vue; 109 | plugin.setupVM(); 110 | plugin.setupProperty(); 111 | plugin.installed = true; 112 | 113 | } 114 | }; 115 | 116 | module.exports = plugin; 117 | -------------------------------------------------------------------------------- /dist/vue-edge-check.umd.js: -------------------------------------------------------------------------------- 1 | (function (global, factory) { 2 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 3 | typeof define === 'function' && define.amd ? define(factory) : 4 | (global.VueEdgeCheck = factory()); 5 | }(this, (function () { 'use strict'; 6 | 7 | var plugin = { 8 | timerL: null, 9 | timerR: null, 10 | screen: {x: -1, y: -1}, 11 | touch: {x: -1, y: -1}, 12 | options: { 13 | EDGE_WIDTH: 48, 14 | EDGE_DURATION: 500 15 | }, 16 | actions: { 17 | touchstart: function touchstart (e) { 18 | 19 | if (e.touches.length != 1) { return } 20 | 21 | var EDGE_WIDTH = plugin.options.EDGE_WIDTH; 22 | var EDGE_DURATION = plugin.options.EDGE_DURATION; 23 | 24 | plugin.screen.x = window.screen.width; 25 | plugin.screen.y = window.screen.height; 26 | plugin.touch.x = e.touches[0].clientX; 27 | plugin.touch.y = e.touches[0].clientY; 28 | 29 | if (plugin.touch.x >= 0 && plugin.touch.x < EDGE_WIDTH) { 30 | plugin.vm.isLeft = true; 31 | return 32 | } else { 33 | plugin.vm.isLeft = false; 34 | } 35 | 36 | if (plugin.screen.x - plugin.touch.x < EDGE_WIDTH) { 37 | plugin.vm.isRight = true; 38 | 39 | // Reset Right in 800 + 500 ms, 40 | // as there is no touchend event on forwarding page. 41 | if (plugin.timerR) { clearTimeout(plugin.timerR); } 42 | plugin.timerR = setTimeout(function () { 43 | plugin.vm.isRight = false; 44 | }, 800 + EDGE_DURATION); 45 | 46 | } else { 47 | 48 | plugin.vm.isRight = false; 49 | 50 | } 51 | }, 52 | touchend: function touchend (e) { 53 | 54 | // no need to reset 55 | if (!plugin.vm.isLeft) { return } 56 | 57 | // Reset Left after touchend + 500ms 58 | if (plugin.timerL) { clearTimeout(plugin.timerL); } 59 | plugin.timerL = setTimeout(function () { 60 | plugin.vm.isLeft = false; 61 | }, plugin.options.EDGE_DURATION); 62 | } 63 | }, 64 | bindEvents: function bindEvents () { 65 | if (window && window.document) { 66 | window.document.addEventListener('touchstart', plugin.actions.touchstart, false); 67 | window.document.addEventListener('touchend', plugin.actions.touchend, false); 68 | return true 69 | } else { 70 | return false 71 | } 72 | }, 73 | setupVM: function setupVM () { 74 | plugin.vm = new plugin.Vue({data: {isLeft: false, isRight: false}}); 75 | }, 76 | setupProperty: function setupProperty () { 77 | Object.defineProperties(plugin.Vue.prototype, { 78 | '$isEdgeLeft': { 79 | 'get': function () { 80 | return plugin.vm.isLeft 81 | }, 82 | 'set': function (value) { 83 | plugin.vm.isLeft = value; 84 | } 85 | } 86 | }); 87 | 88 | Object.defineProperties(plugin.Vue.prototype, { 89 | '$isEdgeRight': { 90 | 'get': function () { 91 | return plugin.vm.isRight 92 | }, 93 | 'set': function (value) { 94 | plugin.vm.isRight = value; 95 | } 96 | } 97 | }); 98 | }, 99 | install: function install (Vue, options) { 100 | 101 | if (plugin.installed) { return } 102 | 103 | if (!plugin.bindEvents()) { 104 | throw new Error('[vue-edge-back] Can only be used in browser.') 105 | } 106 | 107 | if (options) { 108 | if (options.edge_width) { plugin.options.EDGE_WIDTH = options.edge_width; } 109 | if (options.edge_duration) { plugin.options.EDGE_DURATION = options.edge_duration; } 110 | } 111 | 112 | plugin.Vue = Vue; 113 | plugin.setupVM(); 114 | plugin.setupProperty(); 115 | plugin.installed = true; 116 | 117 | } 118 | }; 119 | 120 | return plugin; 121 | 122 | }))); 123 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | acorn-jsx@^3.0.1: 6 | version "3.0.1" 7 | resolved "http://registry.npm.taobao.org/acorn-jsx/download/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b" 8 | dependencies: 9 | acorn "^3.0.4" 10 | 11 | acorn5-object-spread@^4.0.0: 12 | version "4.0.0" 13 | resolved "http://registry.npm.taobao.org/acorn5-object-spread/download/acorn5-object-spread-4.0.0.tgz#d5758081eed97121ab0be47e31caaef2aa399697" 14 | dependencies: 15 | acorn "^5.1.2" 16 | 17 | acorn@^3.0.4: 18 | version "3.3.0" 19 | resolved "http://registry.npm.taobao.org/acorn/download/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" 20 | 21 | acorn@^5.1.2, acorn@^5.2.1: 22 | version "5.3.0" 23 | resolved "http://registry.npm.taobao.org/acorn/download/acorn-5.3.0.tgz#7446d39459c54fb49a80e6ee6478149b940ec822" 24 | 25 | ansi-styles@^3.1.0: 26 | version "3.2.0" 27 | resolved "http://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" 28 | dependencies: 29 | color-convert "^1.9.0" 30 | 31 | arr-diff@^2.0.0: 32 | version "2.0.0" 33 | resolved "http://registry.npm.taobao.org/arr-diff/download/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" 34 | dependencies: 35 | arr-flatten "^1.0.1" 36 | 37 | arr-flatten@^1.0.1: 38 | version "1.1.0" 39 | resolved "http://registry.npm.taobao.org/arr-flatten/download/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" 40 | 41 | array-unique@^0.2.1: 42 | version "0.2.1" 43 | resolved "http://registry.npm.taobao.org/array-unique/download/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" 44 | 45 | braces@^1.8.2: 46 | version "1.8.5" 47 | resolved "http://registry.npm.taobao.org/braces/download/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" 48 | dependencies: 49 | expand-range "^1.8.1" 50 | preserve "^0.2.0" 51 | repeat-element "^1.1.2" 52 | 53 | buble@^0.18.0: 54 | version "0.18.0" 55 | resolved "http://registry.npm.taobao.org/buble/download/buble-0.18.0.tgz#63b338b8248c474b46fd3e3546560ae08d8abe91" 56 | dependencies: 57 | acorn "^5.1.2" 58 | acorn-jsx "^3.0.1" 59 | acorn5-object-spread "^4.0.0" 60 | chalk "^2.1.0" 61 | magic-string "^0.22.4" 62 | minimist "^1.2.0" 63 | os-homedir "^1.0.1" 64 | vlq "^0.2.2" 65 | 66 | builtin-modules@^1.1.0: 67 | version "1.1.1" 68 | resolved "http://registry.npm.taobao.org/builtin-modules/download/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" 69 | 70 | chalk@^2.1.0: 71 | version "2.3.0" 72 | resolved "http://registry.npm.taobao.org/chalk/download/chalk-2.3.0.tgz#b5ea48efc9c1793dccc9b4767c93914d3f2d52ba" 73 | dependencies: 74 | ansi-styles "^3.1.0" 75 | escape-string-regexp "^1.0.5" 76 | supports-color "^4.0.0" 77 | 78 | color-convert@^1.9.0: 79 | version "1.9.1" 80 | resolved "http://registry.npm.taobao.org/color-convert/download/color-convert-1.9.1.tgz#c1261107aeb2f294ebffec9ed9ecad529a6097ed" 81 | dependencies: 82 | color-name "^1.1.1" 83 | 84 | color-name@^1.1.1: 85 | version "1.1.3" 86 | resolved "http://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" 87 | 88 | commander@~2.12.1: 89 | version "2.12.2" 90 | resolved "http://registry.npm.taobao.org/commander/download/commander-2.12.2.tgz#0f5946c427ed9ec0d91a46bb9def53e54650e555" 91 | 92 | escape-string-regexp@^1.0.5: 93 | version "1.0.5" 94 | resolved "http://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" 95 | 96 | estree-walker@^0.3.0: 97 | version "0.3.1" 98 | resolved "http://registry.npm.taobao.org/estree-walker/download/estree-walker-0.3.1.tgz#e6b1a51cf7292524e7237c312e5fe6660c1ce1aa" 99 | 100 | estree-walker@^0.5.0: 101 | version "0.5.1" 102 | resolved "http://registry.npm.taobao.org/estree-walker/download/estree-walker-0.5.1.tgz#64fc375053abc6f57d73e9bd2f004644ad3c5854" 103 | 104 | expand-brackets@^0.1.4: 105 | version "0.1.5" 106 | resolved "http://registry.npm.taobao.org/expand-brackets/download/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" 107 | dependencies: 108 | is-posix-bracket "^0.1.0" 109 | 110 | expand-range@^1.8.1: 111 | version "1.8.2" 112 | resolved "http://registry.npm.taobao.org/expand-range/download/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" 113 | dependencies: 114 | fill-range "^2.1.0" 115 | 116 | extglob@^0.3.1: 117 | version "0.3.2" 118 | resolved "http://registry.npm.taobao.org/extglob/download/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" 119 | dependencies: 120 | is-extglob "^1.0.0" 121 | 122 | filename-regex@^2.0.0: 123 | version "2.0.1" 124 | resolved "http://registry.npm.taobao.org/filename-regex/download/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" 125 | 126 | fill-range@^2.1.0: 127 | version "2.2.3" 128 | resolved "http://registry.npm.taobao.org/fill-range/download/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" 129 | dependencies: 130 | is-number "^2.1.0" 131 | isobject "^2.0.0" 132 | randomatic "^1.1.3" 133 | repeat-element "^1.1.2" 134 | repeat-string "^1.5.2" 135 | 136 | for-in@^1.0.1: 137 | version "1.0.2" 138 | resolved "http://registry.npm.taobao.org/for-in/download/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" 139 | 140 | for-own@^0.1.4: 141 | version "0.1.5" 142 | resolved "http://registry.npm.taobao.org/for-own/download/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" 143 | dependencies: 144 | for-in "^1.0.1" 145 | 146 | glob-base@^0.3.0: 147 | version "0.3.0" 148 | resolved "http://registry.npm.taobao.org/glob-base/download/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" 149 | dependencies: 150 | glob-parent "^2.0.0" 151 | is-glob "^2.0.0" 152 | 153 | glob-parent@^2.0.0: 154 | version "2.0.0" 155 | resolved "http://registry.npm.taobao.org/glob-parent/download/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" 156 | dependencies: 157 | is-glob "^2.0.0" 158 | 159 | has-flag@^2.0.0: 160 | version "2.0.0" 161 | resolved "http://registry.npm.taobao.org/has-flag/download/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" 162 | 163 | is-buffer@^1.1.5: 164 | version "1.1.6" 165 | resolved "http://registry.npm.taobao.org/is-buffer/download/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" 166 | 167 | is-dotfile@^1.0.0: 168 | version "1.0.3" 169 | resolved "http://registry.npm.taobao.org/is-dotfile/download/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" 170 | 171 | is-equal-shallow@^0.1.3: 172 | version "0.1.3" 173 | resolved "http://registry.npm.taobao.org/is-equal-shallow/download/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" 174 | dependencies: 175 | is-primitive "^2.0.0" 176 | 177 | is-extendable@^0.1.1: 178 | version "0.1.1" 179 | resolved "http://registry.npm.taobao.org/is-extendable/download/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" 180 | 181 | is-extglob@^1.0.0: 182 | version "1.0.0" 183 | resolved "http://registry.npm.taobao.org/is-extglob/download/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" 184 | 185 | is-glob@^2.0.0, is-glob@^2.0.1: 186 | version "2.0.1" 187 | resolved "http://registry.npm.taobao.org/is-glob/download/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" 188 | dependencies: 189 | is-extglob "^1.0.0" 190 | 191 | is-module@^1.0.0: 192 | version "1.0.0" 193 | resolved "http://registry.npm.taobao.org/is-module/download/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" 194 | 195 | is-number@^2.1.0: 196 | version "2.1.0" 197 | resolved "http://registry.npm.taobao.org/is-number/download/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" 198 | dependencies: 199 | kind-of "^3.0.2" 200 | 201 | is-number@^3.0.0: 202 | version "3.0.0" 203 | resolved "http://registry.npm.taobao.org/is-number/download/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" 204 | dependencies: 205 | kind-of "^3.0.2" 206 | 207 | is-posix-bracket@^0.1.0: 208 | version "0.1.1" 209 | resolved "http://registry.npm.taobao.org/is-posix-bracket/download/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" 210 | 211 | is-primitive@^2.0.0: 212 | version "2.0.0" 213 | resolved "http://registry.npm.taobao.org/is-primitive/download/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" 214 | 215 | isarray@1.0.0: 216 | version "1.0.0" 217 | resolved "http://registry.npm.taobao.org/isarray/download/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" 218 | 219 | isobject@^2.0.0: 220 | version "2.1.0" 221 | resolved "http://registry.npm.taobao.org/isobject/download/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" 222 | dependencies: 223 | isarray "1.0.0" 224 | 225 | kind-of@^3.0.2: 226 | version "3.2.2" 227 | resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" 228 | dependencies: 229 | is-buffer "^1.1.5" 230 | 231 | kind-of@^4.0.0: 232 | version "4.0.0" 233 | resolved "http://registry.npm.taobao.org/kind-of/download/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" 234 | dependencies: 235 | is-buffer "^1.1.5" 236 | 237 | magic-string@^0.22.4: 238 | version "0.22.4" 239 | resolved "http://registry.npm.taobao.org/magic-string/download/magic-string-0.22.4.tgz#31039b4e40366395618c1d6cf8193c53917475ff" 240 | dependencies: 241 | vlq "^0.2.1" 242 | 243 | micromatch@^2.3.11: 244 | version "2.3.11" 245 | resolved "http://registry.npm.taobao.org/micromatch/download/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" 246 | dependencies: 247 | arr-diff "^2.0.0" 248 | array-unique "^0.2.1" 249 | braces "^1.8.2" 250 | expand-brackets "^0.1.4" 251 | extglob "^0.3.1" 252 | filename-regex "^2.0.0" 253 | is-extglob "^1.0.0" 254 | is-glob "^2.0.1" 255 | kind-of "^3.0.2" 256 | normalize-path "^2.0.1" 257 | object.omit "^2.0.0" 258 | parse-glob "^3.0.4" 259 | regex-cache "^0.4.2" 260 | 261 | minimist@^1.2.0: 262 | version "1.2.0" 263 | resolved "http://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" 264 | 265 | normalize-path@^2.0.1: 266 | version "2.1.1" 267 | resolved "http://registry.npm.taobao.org/normalize-path/download/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" 268 | dependencies: 269 | remove-trailing-separator "^1.0.1" 270 | 271 | object.omit@^2.0.0: 272 | version "2.0.1" 273 | resolved "http://registry.npm.taobao.org/object.omit/download/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" 274 | dependencies: 275 | for-own "^0.1.4" 276 | is-extendable "^0.1.1" 277 | 278 | os-homedir@^1.0.1: 279 | version "1.0.2" 280 | resolved "http://registry.npm.taobao.org/os-homedir/download/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" 281 | 282 | parse-glob@^3.0.4: 283 | version "3.0.4" 284 | resolved "http://registry.npm.taobao.org/parse-glob/download/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" 285 | dependencies: 286 | glob-base "^0.3.0" 287 | is-dotfile "^1.0.0" 288 | is-extglob "^1.0.0" 289 | is-glob "^2.0.0" 290 | 291 | path-parse@^1.0.5: 292 | version "1.0.5" 293 | resolved "http://registry.npm.taobao.org/path-parse/download/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" 294 | 295 | preserve@^0.2.0: 296 | version "0.2.0" 297 | resolved "http://registry.npm.taobao.org/preserve/download/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" 298 | 299 | randomatic@^1.1.3: 300 | version "1.1.7" 301 | resolved "http://registry.npm.taobao.org/randomatic/download/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c" 302 | dependencies: 303 | is-number "^3.0.0" 304 | kind-of "^4.0.0" 305 | 306 | regex-cache@^0.4.2: 307 | version "0.4.4" 308 | resolved "http://registry.npm.taobao.org/regex-cache/download/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" 309 | dependencies: 310 | is-equal-shallow "^0.1.3" 311 | 312 | remove-trailing-separator@^1.0.1: 313 | version "1.1.0" 314 | resolved "http://registry.npm.taobao.org/remove-trailing-separator/download/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" 315 | 316 | repeat-element@^1.1.2: 317 | version "1.1.2" 318 | resolved "http://registry.npm.taobao.org/repeat-element/download/repeat-element-1.1.2.tgz#ef089a178d1483baae4d93eb98b4f9e4e11d990a" 319 | 320 | repeat-string@^1.5.2: 321 | version "1.6.1" 322 | resolved "http://registry.npm.taobao.org/repeat-string/download/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" 323 | 324 | resolve@^1.1.6, resolve@^1.4.0: 325 | version "1.5.0" 326 | resolved "http://registry.npm.taobao.org/resolve/download/resolve-1.5.0.tgz#1f09acce796c9a762579f31b2c1cc4c3cddf9f36" 327 | dependencies: 328 | path-parse "^1.0.5" 329 | 330 | rollup-plugin-buble@^0.18.0: 331 | version "0.18.0" 332 | resolved "http://registry.npm.taobao.org/rollup-plugin-buble/download/rollup-plugin-buble-0.18.0.tgz#6e20d1b2840c59eb496b9f954f75243e51786ac1" 333 | dependencies: 334 | buble "^0.18.0" 335 | rollup-pluginutils "^2.0.1" 336 | 337 | rollup-plugin-commonjs@^8.2.6: 338 | version "8.2.6" 339 | resolved "http://registry.npm.taobao.org/rollup-plugin-commonjs/download/rollup-plugin-commonjs-8.2.6.tgz#27e5b9069ff94005bb01e01bb46a1e4873784677" 340 | dependencies: 341 | acorn "^5.2.1" 342 | estree-walker "^0.5.0" 343 | magic-string "^0.22.4" 344 | resolve "^1.4.0" 345 | rollup-pluginutils "^2.0.1" 346 | 347 | rollup-plugin-node-resolve@^3.0.2: 348 | version "3.0.2" 349 | resolved "http://registry.npm.taobao.org/rollup-plugin-node-resolve/download/rollup-plugin-node-resolve-3.0.2.tgz#38babc12fd404cc2ba1ff68648fe43fa3ffee6b0" 350 | dependencies: 351 | builtin-modules "^1.1.0" 352 | is-module "^1.0.0" 353 | resolve "^1.1.6" 354 | 355 | rollup-plugin-uglify@^2.0.1: 356 | version "2.0.1" 357 | resolved "http://registry.npm.taobao.org/rollup-plugin-uglify/download/rollup-plugin-uglify-2.0.1.tgz#67b37ad1efdafbd83af4c36b40c189ee4866c969" 358 | dependencies: 359 | uglify-js "^3.0.9" 360 | 361 | rollup-pluginutils@^2.0.1: 362 | version "2.0.1" 363 | resolved "http://registry.npm.taobao.org/rollup-pluginutils/download/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0" 364 | dependencies: 365 | estree-walker "^0.3.0" 366 | micromatch "^2.3.11" 367 | 368 | rollup@^0.54.0: 369 | version "0.54.0" 370 | resolved "http://registry.npm.taobao.org/rollup/download/rollup-0.54.0.tgz#0641b8154ba02706464285d2ead924c486b48ba9" 371 | 372 | source-map@~0.6.1: 373 | version "0.6.1" 374 | resolved "http://registry.npm.taobao.org/source-map/download/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" 375 | 376 | supports-color@^4.0.0: 377 | version "4.5.0" 378 | resolved "http://registry.npm.taobao.org/supports-color/download/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b" 379 | dependencies: 380 | has-flag "^2.0.0" 381 | 382 | uglify-js@^3.0.9: 383 | version "3.3.5" 384 | resolved "http://registry.npm.taobao.org/uglify-js/download/uglify-js-3.3.5.tgz#4c4143dfe08e8825746675cc49a6874a933b543e" 385 | dependencies: 386 | commander "~2.12.1" 387 | source-map "~0.6.1" 388 | 389 | vlq@^0.2.1, vlq@^0.2.2: 390 | version "0.2.3" 391 | resolved "http://registry.npm.taobao.org/vlq/download/vlq-0.2.3.tgz#8f3e4328cf63b1540c0d67e1b2778386f8975b26" 392 | --------------------------------------------------------------------------------