diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1209036..bdff400 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,5 +18,13 @@ jobs: with: node-version: '9.x' - name: Install dependencies - run: yarn - - run: yarn run build --if-present \ No newline at end of file + run: npm i + - name: Build + run: npm run build --if-present + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + name: dist-without-markdown + path: | + dist + !dist/**/*.md \ No newline at end of file diff --git a/dist/vue-multipane.esm.js b/dist/vue-multipane.esm.js index 069716b..3dc9035 100644 --- a/dist/vue-multipane.esm.js +++ b/dist/vue-multipane.esm.js @@ -1 +1 @@ -var LAYOUT_HORIZONTAL="horizontal",LAYOUT_VERTICAL="vertical",__vue_module__={name:"multipane",props:{layout:{type:String,default:LAYOUT_VERTICAL}},data:function(){return{isResizing:!1}},computed:{classnames:function(){return["multipane","layout-"+this.layout.slice(0,1),this.isResizing?"is-resizing":""]},cursor:function(){return this.isResizing?this.layout==LAYOUT_VERTICAL?"col-resize":"row-resize":""},userSelect:function(){return this.isResizing?"none":""}},methods:{onMouseDown:function(e){var t=e.target,i=e.pageX,n=e.pageY;if(t.className&&t.className.match("multipane-resizer")){if(t.parentElement!==this.$el)return;var s=this,o=s.$el,a=s.layout,r=t.previousElementSibling,u=r.offsetWidth,l=r.offsetHeight,d=!!(r.style.width+"").match("%"),c=window.addEventListener,p=window.removeEventListener,m=function(e,t){if(void 0===t&&(t=0),a==LAYOUT_VERTICAL){var i=o.clientWidth,n=e+t;return r.style.width=d?n/i*100+"%":n+"px"}if(a==LAYOUT_HORIZONTAL){var s=o.clientHeight,u=e+t;return r.style.height=d?u/s*100+"%":u+"px"}};s.isResizing=!0;var _=m();s.$emit("paneResizeStart",r,t,_);var h=function(e){var o=e.pageX,d=e.pageY;_=a==LAYOUT_VERTICAL?m(u,o-i):m(l,d-n),s.$emit("paneResize",r,t,_)},f=function(){_=m(a==LAYOUT_VERTICAL?r.clientWidth:r.clientHeight),s.isResizing=!1,p("mousemove",h),p("mouseup",f),s.$emit("paneResizeStop",r,t,_)};c("mousemove",h),c("mouseup",f)}}}};!function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i=".multipane { display: flex; } .multipane.layout-h { flex-direction: column; } .multipane.layout-v { flex-direction: row; } .multipane > div { position: relative; z-index: 1; } .multipane-resizer { display: block; position: relative; z-index: 2; } .layout-h > .multipane-resizer { width: 100%; height: 10px; margin-top: -10px; top: 5px; cursor: row-resize; } .layout-v > .multipane-resizer { width: 10px; height: 100%; margin-left: -10px; left: 5px; cursor: col-resize; } ";t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}();var __$__vue_module__=Object.assign(__vue_module__,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{class:this.classnames,style:{cursor:this.cursor,userSelect:this.userSelect},on:{mousedown:this.onMouseDown}},[this._t("default")],2)},staticRenderFns:[]});__$__vue_module__.prototype=__vue_module__.prototype,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText="":t.appendChild(document.createTextNode("")),e.appendChild(t)}}();var MultipaneResizer={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"multipane-resizer"},[this._t("default")],2)},staticRenderFns:[]};"undefined"!=typeof window&&window.Vue&&(window.Vue.component("multipane",__$__vue_module__),window.Vue.component("multipane-resizer",MultipaneResizer));export{__$__vue_module__ as Multipane,MultipaneResizer}; +var LAYOUT_HORIZONTAL="horizontal",LAYOUT_VERTICAL="vertical",__vue_module__={name:"multipane",props:{layout:{type:String,default:LAYOUT_VERTICAL}},data:function(){return{isResizing:!1}},computed:{classnames:function(){return["multipane","layout-"+this.layout.slice(0,1),this.isResizing?"is-resizing":""]},cursor:function(){return this.isResizing?this.layout==LAYOUT_VERTICAL?"col-resize":"row-resize":""},userSelect:function(){return this.isResizing?"none":""}},methods:{onMouseDown:function(e){var t=e.target,i=e.pageX,n=e.pageY;if("string"==typeof t.className&&t.className.match("multipane-resizer")){if(t.parentElement!==this.$el)return;var s=this,o=s.$el,r=s.layout,a=t.previousElementSibling,u=a.offsetWidth,l=a.offsetHeight,d=!!(a.style.width+"").match("%"),c=window.addEventListener,p=window.removeEventListener,m=function(e,t){if(void 0===t&&(t=0),r==LAYOUT_VERTICAL){var i=o.clientWidth,n=e+t;return a.style.width=d?n/i*100+"%":n+"px"}if(r==LAYOUT_HORIZONTAL){var s=o.clientHeight,u=e+t;return a.style.height=d?u/s*100+"%":u+"px"}};s.isResizing=!0;var _=m();s.$emit("paneResizeStart",a,t,_);var h=function(e){var o=e.pageX,d=e.pageY;_=r==LAYOUT_VERTICAL?m(u,o-i):m(l,d-n),s.$emit("paneResize",a,t,_)},f=function(){_=m(r==LAYOUT_VERTICAL?a.clientWidth:a.clientHeight),s.isResizing=!1,p("mousemove",h),p("mouseup",f),s.$emit("paneResizeStop",a,t,_)};c("mousemove",h),c("mouseup",f)}}}};!function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i=".multipane { display: flex; } .multipane.layout-h { flex-direction: column; } .multipane.layout-v { flex-direction: row; } .multipane > div { position: relative; z-index: 1; } .multipane-resizer { display: block; position: relative; z-index: 2; } .layout-h > .multipane-resizer { width: 100%; height: 10px; margin-top: -10px; top: 5px; cursor: row-resize; } .layout-v > .multipane-resizer { width: 10px; height: 100%; margin-left: -10px; left: 5px; cursor: col-resize; } ";t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}();var __$__vue_module__=Object.assign(__vue_module__,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{class:this.classnames,style:{cursor:this.cursor,userSelect:this.userSelect},on:{mousedown:this.onMouseDown}},[this._t("default")],2)},staticRenderFns:[]});__$__vue_module__.prototype=__vue_module__.prototype,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText="":t.appendChild(document.createTextNode("")),e.appendChild(t)}}();var MultipaneResizer={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"multipane-resizer"},[this._t("default")],2)},staticRenderFns:[]};"undefined"!=typeof window&&window.Vue&&(window.Vue.component("multipane",__$__vue_module__),window.Vue.component("multipane-resizer",MultipaneResizer));export{__$__vue_module__ as Multipane,MultipaneResizer}; diff --git a/dist/vue-multipane.js b/dist/vue-multipane.js index 6a7b33f..a1e30e7 100644 --- a/dist/vue-multipane.js +++ b/dist/vue-multipane.js @@ -4,11 +4,11 @@ (factory((global.Multipane = {}))); }(this, (function (exports) { 'use strict'; -var LAYOUT_HORIZONTAL = 'horizontal'; -var LAYOUT_VERTICAL = 'vertical'; +var LAYOUT_HORIZONTAL = "horizontal"; +var LAYOUT_VERTICAL = "vertical"; var __vue_module__ = { - name: 'multipane', + name: "multipane", props: { layout: { @@ -26,17 +26,19 @@ var __vue_module__ = { computed: { classnames: function classnames() { return [ - 'multipane', - 'layout-' + this.layout.slice(0, 1), - this.isResizing ? 'is-resizing' : '' ]; + "multipane", + "layout-" + this.layout.slice(0, 1), + this.isResizing ? "is-resizing" : "" ]; }, cursor: function cursor() { return this.isResizing - ? this.layout == LAYOUT_VERTICAL ? 'col-resize' : 'row-resize' - : ''; + ? this.layout == LAYOUT_VERTICAL + ? "col-resize" + : "row-resize" + : ""; }, userSelect: function userSelect() { - return this.isResizing ? 'none' : ''; + return this.isResizing ? "none" : ""; }, }, @@ -46,13 +48,14 @@ var __vue_module__ = { var initialPageX = ref.pageX; var initialPageY = ref.pageY; - - if (resizer.className && resizer.className.match('multipane-resizer')) { - + if ( + typeof resizer.className === "string" && + resizer.className.match("multipane-resizer") + ) { // for stacked panes, make sure only the direct parent of the // resizer acts if (resizer.parentElement !== this.$el) { - return + return; } var self = this; @@ -63,7 +66,7 @@ var __vue_module__ = { var initialPaneWidth = pane.offsetWidth; var initialPaneHeight = pane.offsetHeight; - var usePercentage = !!(pane.style.width + '').match('%'); + var usePercentage = !!(pane.style.width + "").match("%"); var addEventListener = window.addEventListener; var removeEventListener = window.removeEventListener; @@ -76,8 +79,8 @@ var __vue_module__ = { var paneWidth = initialSize + offset; return (pane.style.width = usePercentage - ? paneWidth / containerWidth * 100 + '%' - : paneWidth + 'px'); + ? (paneWidth / containerWidth) * 100 + "%" + : paneWidth + "px"); } if (layout == LAYOUT_HORIZONTAL) { @@ -85,8 +88,8 @@ var __vue_module__ = { var paneHeight = initialSize + offset; return (pane.style.height = usePercentage - ? paneHeight / containerHeight * 100 + '%' - : paneHeight + 'px'); + ? (paneHeight / containerHeight) * 100 + "%" + : paneHeight + "px"); } }; @@ -97,9 +100,9 @@ var __vue_module__ = { var size = resize(); // Trigger paneResizeStart event - self.$emit('paneResizeStart', pane, resizer, size); + self.$emit("paneResizeStart", pane, resizer, size); - var onMouseMove = function(ref) { + var onMouseMove = function (ref) { var pageX = ref.pageX; var pageY = ref.pageY; @@ -108,10 +111,10 @@ var __vue_module__ = { ? resize(initialPaneWidth, pageX - initialPageX) : resize(initialPaneHeight, pageY - initialPageY); - self.$emit('paneResize', pane, resizer, size); + self.$emit("paneResize", pane, resizer, size); }; - var onMouseUp = function() { + var onMouseUp = function () { // Run resize one more time to set computed width/height. size = @@ -122,14 +125,14 @@ var __vue_module__ = { // This removes is-resizing class to container self.isResizing = false; - removeEventListener('mousemove', onMouseMove); - removeEventListener('mouseup', onMouseUp); + removeEventListener("mousemove", onMouseMove); + removeEventListener("mouseup", onMouseUp); - self.$emit('paneResizeStop', pane, resizer, size); + self.$emit("paneResizeStop", pane, resizer, size); }; - addEventListener('mousemove', onMouseMove); - addEventListener('mouseup', onMouseUp); + addEventListener("mousemove", onMouseMove); + addEventListener("mouseup", onMouseUp); } }, }, diff --git a/dist/vue-multipane.min.js b/dist/vue-multipane.min.js index 33eaede..c59ea51 100644 --- a/dist/vue-multipane.min.js +++ b/dist/vue-multipane.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Multipane={})}(this,function(e){"use strict";var t={name:"multipane",props:{layout:{type:String,default:"vertical"}},data:function(){return{isResizing:!1}},computed:{classnames:function(){return["multipane","layout-"+this.layout.slice(0,1),this.isResizing?"is-resizing":""]},cursor:function(){return this.isResizing?"vertical"==this.layout?"col-resize":"row-resize":""},userSelect:function(){return this.isResizing?"none":""}},methods:{onMouseDown:function(e){var t=e.target,i=e.pageX,n=e.pageY;if(t.className&&t.className.match("multipane-resizer")){if(t.parentElement!==this.$el)return;var s=this,o=s.$el,r=s.layout,a=t.previousElementSibling,u=a.offsetWidth,l=a.offsetHeight,c=!!(a.style.width+"").match("%"),d=window.addEventListener,p=window.removeEventListener,m=function(e,t){if(void 0===t&&(t=0),"vertical"==r){var i=o.clientWidth,n=e+t;return a.style.width=c?n/i*100+"%":n+"px"}if("horizontal"==r){var s=o.clientHeight,u=e+t;return a.style.height=c?u/s*100+"%":u+"px"}};s.isResizing=!0;var h=m();s.$emit("paneResizeStart",a,t,h);var f=function(e){var o=e.pageX,c=e.pageY;h="vertical"==r?m(u,o-i):m(l,c-n),s.$emit("paneResize",a,t,h)},y=function(){h=m("vertical"==r?a.clientWidth:a.clientHeight),s.isResizing=!1,p("mousemove",f),p("mouseup",y),s.$emit("paneResizeStop",a,t,h)};d("mousemove",f),d("mouseup",y)}}}};!function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i=".multipane { display: flex; } .multipane.layout-h { flex-direction: column; } .multipane.layout-v { flex-direction: row; } .multipane > div { position: relative; z-index: 1; } .multipane-resizer { display: block; position: relative; z-index: 2; } .layout-h > .multipane-resizer { width: 100%; height: 10px; margin-top: -10px; top: 5px; cursor: row-resize; } .layout-v > .multipane-resizer { width: 10px; height: 100%; margin-left: -10px; left: 5px; cursor: col-resize; } ";t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}();var i=Object.assign(t,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{class:this.classnames,style:{cursor:this.cursor,userSelect:this.userSelect},on:{mousedown:this.onMouseDown}},[this._t("default")],2)},staticRenderFns:[]});i.prototype=t.prototype,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText="":t.appendChild(document.createTextNode("")),e.appendChild(t)}}();var n={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"multipane-resizer"},[this._t("default")],2)},staticRenderFns:[]};"undefined"!=typeof window&&window.Vue&&(window.Vue.component("multipane",i),window.Vue.component("multipane-resizer",n)),e.Multipane=i,e.MultipaneResizer=n,Object.defineProperty(e,"__esModule",{value:!0})}); +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.Multipane={})}(this,function(e){"use strict";var t={name:"multipane",props:{layout:{type:String,default:"vertical"}},data:function(){return{isResizing:!1}},computed:{classnames:function(){return["multipane","layout-"+this.layout.slice(0,1),this.isResizing?"is-resizing":""]},cursor:function(){return this.isResizing?"vertical"==this.layout?"col-resize":"row-resize":""},userSelect:function(){return this.isResizing?"none":""}},methods:{onMouseDown:function(e){var t=e.target,i=e.pageX,n=e.pageY;if("string"==typeof t.className&&t.className.match("multipane-resizer")){if(t.parentElement!==this.$el)return;var s=this,o=s.$el,r=s.layout,a=t.previousElementSibling,u=a.offsetWidth,l=a.offsetHeight,c=!!(a.style.width+"").match("%"),d=window.addEventListener,p=window.removeEventListener,m=function(e,t){if(void 0===t&&(t=0),"vertical"==r){var i=o.clientWidth,n=e+t;return a.style.width=c?n/i*100+"%":n+"px"}if("horizontal"==r){var s=o.clientHeight,u=e+t;return a.style.height=c?u/s*100+"%":u+"px"}};s.isResizing=!0;var h=m();s.$emit("paneResizeStart",a,t,h);var f=function(e){var o=e.pageX,c=e.pageY;h="vertical"==r?m(u,o-i):m(l,c-n),s.$emit("paneResize",a,t,h)},y=function(){h=m("vertical"==r?a.clientWidth:a.clientHeight),s.isResizing=!1,p("mousemove",f),p("mouseup",y),s.$emit("paneResizeStop",a,t,h)};d("mousemove",f),d("mouseup",y)}}}};!function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style"),i=".multipane { display: flex; } .multipane.layout-h { flex-direction: column; } .multipane.layout-v { flex-direction: row; } .multipane > div { position: relative; z-index: 1; } .multipane-resizer { display: block; position: relative; z-index: 2; } .layout-h > .multipane-resizer { width: 100%; height: 10px; margin-top: -10px; top: 5px; cursor: row-resize; } .layout-v > .multipane-resizer { width: 10px; height: 100%; margin-left: -10px; left: 5px; cursor: col-resize; } ";t.type="text/css",t.styleSheet?t.styleSheet.cssText=i:t.appendChild(document.createTextNode(i)),e.appendChild(t)}}();var i=Object.assign(t,{render:function(){var e=this.$createElement;return(this._self._c||e)("div",{class:this.classnames,style:{cursor:this.cursor,userSelect:this.userSelect},on:{mousedown:this.onMouseDown}},[this._t("default")],2)},staticRenderFns:[]});i.prototype=t.prototype,function(){if("undefined"!=typeof document){var e=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText="":t.appendChild(document.createTextNode("")),e.appendChild(t)}}();var n={render:function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"multipane-resizer"},[this._t("default")],2)},staticRenderFns:[]};"undefined"!=typeof window&&window.Vue&&(window.Vue.component("multipane",i),window.Vue.component("multipane-resizer",n)),e.Multipane=i,e.MultipaneResizer=n,Object.defineProperty(e,"__esModule",{value:!0})}); diff --git a/package.json b/package.json index 53fecb5..f90d92c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "unpkg": "dist/vue-multipane.min.js", "module": "dist/vue-multipane.esm.js", "scripts": { - "build": "yarn run build:prod && yarn run build:dev && yarn run build:esm && yarn run build:demo", + "build": "npm run build:prod && npm run build:dev && npm run build:esm && npm run build:demo", "build:prod": "cross-env rollup -c rollup.config.prod.js", "build:dev": "cross-env rollup -c rollup.config.dev.js", "build:esm": "cross-env rollup -c rollup.config.esm.js",