From 23ec2d442ac13e697ac60a09ee1d21dc6fec8c17 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 18 Feb 2022 21:48:22 +0300 Subject: [PATCH] ci: remove dist/ --- dist/swipe-to-delete.css | 10 ---------- dist/swipe-to-delete.min.js | 9 --------- 2 files changed, 19 deletions(-) delete mode 100644 dist/swipe-to-delete.css delete mode 100644 dist/swipe-to-delete.min.js diff --git a/dist/swipe-to-delete.css b/dist/swipe-to-delete.css deleted file mode 100644 index 771cbc2..0000000 --- a/dist/swipe-to-delete.css +++ /dev/null @@ -1,10 +0,0 @@ -/*! - * React-swipe-to-delete-component v1.0.0 - * A simple React component implement 'swipe to delete' UI-pattern. - * https://github.com/gaer87/react-swipe-to-delete-component - - * Copyright 2022, Fedotov Alexander - * Released under the MIT license. - */ -.swipe-to-delete{position:relative !important;padding:0 !important;overflow:hidden !important}.swipe-to-delete .js-delete{position:absolute !important;top:0 !important;right:0 !important;bottom:0 !important;left:0 !important;z-index:1 !important}.swipe-to-delete .js-content{position:relative !important;z-index:2 !important;-webkit-user-select:none !important;-moz-user-select:none !important;-ms-user-select:none !important}.swipe-to-delete .js-content :first-child{position:relative !important}.swipe-to-delete .js-transition-delete-right,.swipe-to-delete .js-transition-delete-left,.swipe-to-delete .js-transition-cancel{transition-property:left !important;transition-duration:.5s}.swipe-to-delete .js-transition-delete-right{left:100% !important}.swipe-to-delete .js-transition-delete-left{left:-100% !important}.swipe-to-delete .js-transition-cancel{left:0 !important}.swipe-to-delete .js-delete{background:#ff5f58}.swipe-to-delete .js-delete svg{position:absolute;left:17px;top:50%;margin-top:-13px;width:25px;height:25px}.swipe-to-delete .js-delete svg:first-child{left:auto;right:17px}.swipe-to-delete .js-content :first-child{cursor:pointer}.swipe-to-delete .js-transition-delete-right,.swipe-to-delete .js-transition-delete-left,.swipe-to-delete .js-transition-cancel{transition-duration:.7s;transition-timing-function:ease-in-out} - diff --git a/dist/swipe-to-delete.min.js b/dist/swipe-to-delete.min.js deleted file mode 100644 index 8179d67..0000000 --- a/dist/swipe-to-delete.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * React-swipe-to-delete-component v1.0.0 - * A simple React component implement 'swipe to delete' UI-pattern. - * https://github.com/gaer87/react-swipe-to-delete-component - - * Copyright 2022, Fedotov Alexander - * Released under the MIT license. - */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.SwipeToDeleteComponent=t(require("react")):e.SwipeToDeleteComponent=t(e.React)}(this,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(t,n){t.exports=e},function(e,t,n){e.exports=n(12)()},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function n(e,t){for(var n=0;n=this.deleteSwipe}}]),e}(),b={Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},any:function(){return this.Android()||this.BlackBerry()||this.iOS()||this.Opera()||this.Windows()}};function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var o=p()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l()(this,n)}}var E=function(){function e(){o()(this,e)}return a()(e,null,[{key:"factory",value:function(e){return e?new I:new _}}]),e}(),I=function(e){c()(n,e);var t=x(n);function n(){return o()(this,n),t.apply(this,arguments)}return a()(n,[{key:"getPageX",value:function(e){return e.targetTouches[0].pageX}},{key:"getPageY",value:function(e){return e.targetTouches[0].pageY}},{key:"getStartEventName",value:function(){return"touchstart"}},{key:"getInteractEventName",value:function(){return"touchmove"}},{key:"getStopEventNames",value:function(){return["touchend"]}}]),n}(E),_=function(e){c()(n,e);var t=x(n);function n(){return o()(this,n),t.apply(this,arguments)}return a()(n,[{key:"getPageX",value:function(e){return e.pageX}},{key:"getPageY",value:function(e){return e.pageY}},{key:"getStartEventName",value:function(){return"mousedown"}},{key:"getInteractEventName",value:function(){return"mousemove"}},{key:"getStopEventNames",value:function(){return["mouseup","mouseleave"]}}]),n}(E);n(11);function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=p()(e);if(t){var o=p()(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return l()(this,n)}}var k=function(e){c()(n,e);var t=S(n);function n(e){var r;return o()(this,n),(r=t.call(this,e)).state={isDeleted:!1},r.model=new g({deleteSwipe:r.props.deleteSwipe}),r.bindHandlers(),r}return a()(n,[{key:"render",value:function(){var e=this;return this.state.isDeleted?null:h.a.createElement(this.props.tag,{className:"swipe-to-delete ".concat(this.props.classNameTag)},[h.a.createElement("div",{key:"delete",className:"js-delete"},this.props.background),h.a.createElement("div",{key:"content",className:"js-content",ref:function(t){return e.regionContent=t}},this.props.children)])}},{key:"componentDidMount",value:function(){this.device=E.factory(b.any()),this.addHandlers()}},{key:"componentWillUnmount",value:function(){this.regionContent&&this.removeHandlers()}},{key:"bindHandlers",value:function(){this.addHandlers=this.addHandlers.bind(this),this.isInteract=this.isInteract.bind(this),this.interact=this.interact.bind(this),this.onMove=this.onMove.bind(this),this.stopInteract=this.stopInteract.bind(this),this.offInteract=this.offInteract.bind(this),this.endInteract=this.endInteract.bind(this),this.onDelete=this.onDelete.bind(this),this.onCancel=this.onCancel.bind(this)}},{key:"addHandlers",value:function(){this.startInteract().then(this.isInteract).then(this.interact).then(this.stopInteract).then(this.endInteract).catch(this.addHandlers)}},{key:"removeHandlers",value:function(){var e=this.regionContent.firstChild;this.stopListenStartInteract(e),this.stopListenIsInteract(),this.offInteract(),this.stopListenStopInteract(e),this.stopListenEndInteract(e)}},{key:"startInteract",value:function(){var e=this;return new Promise((function(t){var n=e.regionContent.firstChild;e._onStartInteract=function(r){e.stopListenStartInteract(n),e.model.startX=e.device.getPageX(r),e.model.startY=e.device.getPageY(r),t()},n.addEventListener(e.device.getStartEventName(),e._onStartInteract,!1)}))}},{key:"stopListenStartInteract",value:function(e){e.removeEventListener(this.device.getStartEventName(),this._onStartInteract)}},{key:"isInteract",value:function(){var e=this;return new Promise((function(t,n){e._onIsInteract=function(r){e.stopListenIsInteract();var o=e.device.getPageX(r)-e.model.startX,i=e.device.getPageY(r)-e.model.startY;Math.abs(o)>Math.abs(i)?t():n()},document.addEventListener(e.device.getInteractEventName(),e._onIsInteract,!1)}))}},{key:"stopListenIsInteract",value:function(){document.removeEventListener(this.device.getInteractEventName(),this._onIsInteract)}},{key:"interact",value:function(){document.addEventListener(this.device.getInteractEventName(),this.onMove,!1)}},{key:"offInteract",value:function(){document.removeEventListener(this.device.getInteractEventName(),this.onMove,!1)}},{key:"onMove",value:function(e){this.moveAt(e),this.callMoveCB(e)}},{key:"moveAt",value:function(e){var t=this.regionContent.firstChild,n=this.device.getPageX(e)-this.model.startX;t.style.left="".concat(n,"px")}},{key:"callMoveCB",value:function(e){var t=this.device.getPageX(e),n=t-(this.model.prevX||this.model.startX);n&&(n>0?this.props.onRight(e):this.props.onLeft(e),this.model.prevX=t)}},{key:"stopInteract",value:function(){var e=this;return new Promise((function(t,n){var r=e.regionContent.firstChild;e._onStopInteract=function(o){e.stopListenStopInteract(r),e.onStopInteract(o,t,n)},e.device.getStopEventNames().forEach((function(t){return r.addEventListener(t,e._onStopInteract,!1)}))}))}},{key:"stopListenStopInteract",value:function(e){var t=this;this.device.getStopEventNames().forEach((function(n){return e.removeEventListener(n,t._onStopInteract)}))}},{key:"onStopInteract",value:function(e,t,n){this.offInteract(),this.model.erasePrevX(),e.currentTarget.offsetLeft?t():n()}},{key:"endInteract",value:function(){var e=this,t=this.regionContent.firstChild,n=this.getSwipePercent(),r=new Promise((function(r,o){e._onTransitionendDelete=function(n){e.stopListenEndInteract(t),r(n)},e._onTransitionendCancel=function(n){e.stopListenEndInteract(t),o(n)},e.model.isDelete(n)?(t.addEventListener("transitionend",e._onTransitionendDelete,!1),n<0?t.classList.add("js-transition-delete-left"):t.classList.add("js-transition-delete-right")):(t.addEventListener("transitionend",e._onTransitionendCancel,!1),t.classList.add("js-transition-cancel"))}));return r.then(this.onDelete,this.onCancel),r}},{key:"stopListenEndInteract",value:function(e){e.removeEventListener("transitionend",this._onTransitionendDelete),e.removeEventListener("transitionend",this._onTransitionendCancel)}},{key:"getSwipePercent",value:function(){var e=this.regionContent.firstChild.offsetLeft,t=this.regionContent.clientWidth;return this.model.calcSwipePercent({shift:e,width:t})}},{key:"onDelete",value:function(){var e=this;this.setState({isDeleted:!0},(function(){e.props.onDelete(e.customProps)}))}},{key:"onCancel",value:function(e){this.props.onCancel(this.customProps);var t=e.currentTarget;t.classList.remove("js-transition-cancel"),this.model.startX=this.model.startY=t.style.left=0}},{key:"customProps",get:function(){var e=this,t=Object.keys(n.propTypes);return Object.keys(this.props).filter((function(e){return!t.includes(e)})).reduce((function(t,n){return t[n]=e.props[n],t}),{})}}]),n}(h.a.Component);k.defaultProps={tag:"div",classNameTag:"",background:h.a.createElement(m,null),onDelete:function(){},onCancel:function(){},onLeft:function(){},onRight:function(){}},k.propTypes={children:y.a.element.isRequired,background:y.a.element,onDelete:y.a.func,onCancel:y.a.func,onLeft:y.a.func,onRight:y.a.func,tag:y.a.string,classNameTag:y.a.string,deleteSwipe:function(e,t,n){var r=e[t];if(r){if("number"!=typeof r)throw new Error('Invalid prop "deleteSwipe" in '.concat(n,": can be number only."));if(r<0||r>1)throw new Error('Invalid prop "deleteSwipe" in '.concat(n,": can be in range [0, 1]."))}}}}])})); \ No newline at end of file