@mescius/wijmo.touch 5.20242.23-nightly.d20241016.t115522 → 5.20242.23-nightly.d20241022.t051638

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241016.t115522
3
+ * Wijmo Library 5.20242.23-nightly.d20241022.t051638
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/wijmo"),selfModule=__importStar(require("@mescius/wijmo.touch"));class DataTransfer{constructor(){this._dropEffect="move";this._effectAllowed="all";this._data={}}get dropEffect(){return this._dropEffect}set dropEffect(t){this._dropEffect=wijmo_1.asString(t)}get effectAllowed(){return this._effectAllowed}set effectAllowed(t){this._effectAllowed=wijmo_1.asString(t)}get types(){return Object.keys(this._data)}clearData(t){null!=t?delete this._data[t]:this._data=null}getData(t){return this._data[t]||""}setData(t,e){this._data[t]=e}setDragImage(t,e,i){let s=DragDropTouch._instance;s._imgCustom=t;s._imgOffset=new wijmo_1.Point(e,i)}}exports.DataTransfer=DataTransfer;class DragDropTouch{constructor(){this._lastClick=0;this._isDragging=!1;wijmo_1.assert(!DragDropTouch._instance,"DragDropTouch instance already created.");let t=!1;document.addEventListener("test",()=>{},{get passive(){t=!0;return!0}});let e=document,i=this._touchstart.bind(this),s=this._touchmove.bind(this),r=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",i,a);e.addEventListener("touchmove",s,a);e.addEventListener("touchend",r);e.addEventListener("touchcancel",r)}static getInstance(){return DragDropTouch._instance}_touchstart(t){if(this._shouldHandle(t)){let e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}}_touchmove(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;const e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){let e=wijmo_1.closest(t.target,"[draggable]");if(e&&e.draggable){this._dragSource=e;this._ptDown=this._getPoint(t)}}}let e=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",e)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",e)}}if(this._img){t.preventDefault();if(e!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",e);this._lastTarget=e}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",e)}}}_touchend(t){if(this._shouldHandle(t)){let e=t.target,i=this._lastTouch;if(this._isDragging&&this._dispatchEvent(i,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(i,"drop",this._lastTarget);this._dispatchEvent(i,"dragend",this._dragSource);this._reset()}}}_shouldHandle(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2}_reset(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1}_getPoint(t,e){t&&t.touches&&(t=t.touches[0]);wijmo_1.assert(t&&"clientX"in t,"invalid event?");return 1==e?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.clientX,t.clientY)}_getDelta(t){let e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)}_getTarget(t){let e=this._getPoint(t),i=document.elementFromPoint(e.x,e.y);for(;i&&"none"==getComputedStyle(i).pointerEvents;)i=i.parentElement;return i}_createImage(t){this._img&&this._destroyImage();let e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){let i=e.getBoundingClientRect(),s=this._getPoint(t);this._imgOffset=new wijmo_1.Point(s.x-i.left,s.y-i.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)}_destroyImage(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null}_moveImage(t){requestAnimationFrame(()=>{if(this._img){let e=this._getPoint(t,!0);wijmo_1.setCss(this._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(e.x-this._imgOffset.x),top:Math.round(e.y-this._imgOffset.y)})}})}_copyProps(t,e,i){for(let s in e)i.test(s)&&(t[s]=e[s])}_copyStyle(t,e){["id","class","style","draggable"].forEach(t=>{e.removeAttribute(t)});if(t instanceof HTMLCanvasElement){let i=t,s=e;s.width=i.width;s.height=i.height;s.getContext("2d").drawImage(i,0,0)}let i=getComputedStyle(t);for(let t=0;t<i.length;t++){let s=i[t];s.indexOf("transition")<0&&s.indexOf("transform")<0&&(e.style[s]=i[s])}e.style.pointerEvents="none";for(let i=0;i<t.children.length;i++)this._copyStyle(t.children[i],e.children[i])}_dispatchEvent(t,e,i){if(t&&i){let s=document.createEvent("Event"),r=t.touches?t.touches[0]:t;s.initEvent(e,!0,!0);s.button=0;s.which=s.buttons=1;this._copyProps(s,t,/Key$/);this._copyProps(s,r,/(X|Y)$/);s.dataTransfer=this._dataTransfer;i.dispatchEvent(s);return s.defaultPrevented}return!1}}DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;exports.DragDropTouch=DragDropTouch;wijmo_1._registerModule("wijmo.touch",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/wijmo"),selfModule=__importStar(require("@mescius/wijmo.touch"));class DataTransfer{constructor(){this._dropEffect="move";this._effectAllowed="all";this._data={}}get dropEffect(){return this._dropEffect}set dropEffect(t){this._dropEffect=wijmo_1.asString(t)}get effectAllowed(){return this._effectAllowed}set effectAllowed(t){this._effectAllowed=wijmo_1.asString(t)}get types(){return Object.keys(this._data)}clearData(t){null!=t?delete this._data[t]:this._data=null}getData(t){return this._data[t]||""}setData(t,e){this._data[t]=e}setDragImage(t,e,i){let s=DragDropTouch._instance;s._imgCustom=t;s._imgOffset=new wijmo_1.Point(e,i)}}exports.DataTransfer=DataTransfer;class DragDropTouch{constructor(){this._lastClick=0;this._isDragging=!1;wijmo_1.assert(!DragDropTouch._instance,"DragDropTouch instance already created.");let t=!1;document.addEventListener("test",()=>{},{get passive(){t=!0;return!0}});let e=document,i=this._touchstart.bind(this),s=this._touchmove.bind(this),r=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",i,a);e.addEventListener("touchmove",s,a);e.addEventListener("touchend",r);e.addEventListener("touchcancel",r)}static getInstance(){return DragDropTouch._instance}_touchstart(t){if(this._shouldHandle(t)){let e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}}_touchmove(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;const e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){let e=wijmo_1.closest(t.target,"[draggable]");if(e&&e.draggable){this._dragSource=e;this._ptDown=this._getPoint(t)}}}this._dragSource&&t.preventDefault();let e=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",e)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",e)}}if(this._img){t.preventDefault();if(e!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",e);this._lastTarget=e}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",e)}}}_touchend(t){if(this._shouldHandle(t)){let e=t.target,i=this._lastTouch;if(this._isDragging&&this._dispatchEvent(i,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(i,"drop",this._lastTarget);this._dispatchEvent(i,"dragend",this._dragSource);this._reset()}}}_shouldHandle(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2}_reset(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1}_getPoint(t,e){t&&t.touches&&(t=t.touches[0]);wijmo_1.assert(t&&"clientX"in t,"invalid event?");return 1==e?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.clientX,t.clientY)}_getDelta(t){let e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)}_getTarget(t){let e=this._getPoint(t),i=document.elementFromPoint(e.x,e.y);for(;i&&"none"==getComputedStyle(i).pointerEvents;)i=i.parentElement;return i}_createImage(t){this._img&&this._destroyImage();let e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){let i=e.getBoundingClientRect(),s=this._getPoint(t);this._imgOffset=new wijmo_1.Point(s.x-i.left,s.y-i.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)}_destroyImage(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null}_moveImage(t){requestAnimationFrame(()=>{if(this._img){let e=this._getPoint(t,!0);wijmo_1.setCss(this._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(e.x-this._imgOffset.x),top:Math.round(e.y-this._imgOffset.y)})}})}_copyProps(t,e,i){for(let s in e)i.test(s)&&(t[s]=e[s])}_copyStyle(t,e){["id","class","style","draggable"].forEach(t=>{e.removeAttribute(t)});if(t instanceof HTMLCanvasElement){let i=t,s=e;s.width=i.width;s.height=i.height;s.getContext("2d").drawImage(i,0,0)}let i=getComputedStyle(t);for(let t=0;t<i.length;t++){let s=i[t];s.indexOf("transition")<0&&s.indexOf("transform")<0&&(e.style[s]=i[s])}e.style.pointerEvents="none";for(let i=0;i<t.children.length;i++)this._copyStyle(t.children[i],e.children[i])}_dispatchEvent(t,e,i){if(t&&i){let s=document.createEvent("Event"),r=t.touches?t.touches[0]:t;s.initEvent(e,!0,!0);s.button=0;s.which=s.buttons=1;this._copyProps(s,t,/Key$/);this._copyProps(s,r,/(X|Y)$/);s.dataTransfer=this._dataTransfer;i.dispatchEvent(s);return s.defaultPrevented}return!1}}DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;exports.DragDropTouch=DragDropTouch;wijmo_1._registerModule("wijmo.touch",selfModule);
package/es2015-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241016.t115522
3
+ * Wijmo Library 5.20242.23-nightly.d20241022.t051638
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{Point,asString,assert,closest,setCss,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.touch";export class DataTransfer{constructor(){this._dropEffect="move";this._effectAllowed="all";this._data={}}get dropEffect(){return this._dropEffect}set dropEffect(t){this._dropEffect=asString(t)}get effectAllowed(){return this._effectAllowed}set effectAllowed(t){this._effectAllowed=asString(t)}get types(){return Object.keys(this._data)}clearData(t){null!=t?delete this._data[t]:this._data=null}getData(t){return this._data[t]||""}setData(t,e){this._data[t]=e}setDragImage(t,e,s){let i=DragDropTouch._instance;i._imgCustom=t;i._imgOffset=new Point(e,s)}}export class DragDropTouch{constructor(){this._lastClick=0;this._isDragging=!1;assert(!DragDropTouch._instance,"DragDropTouch instance already created.");let t=!1;document.addEventListener("test",()=>{},{get passive(){t=!0;return!0}});let e=document,s=this._touchstart.bind(this),i=this._touchmove.bind(this),a=this._touchend.bind(this),r=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",s,r);e.addEventListener("touchmove",i,r);e.addEventListener("touchend",a);e.addEventListener("touchcancel",a)}static getInstance(){return DragDropTouch._instance}_touchstart(t){if(this._shouldHandle(t)){let e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}}_touchmove(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;const e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){let e=closest(t.target,"[draggable]");if(e&&e.draggable){this._dragSource=e;this._ptDown=this._getPoint(t)}}}let e=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",e)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",e)}}if(this._img){t.preventDefault();if(e!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",e);this._lastTarget=e}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",e)}}}_touchend(t){if(this._shouldHandle(t)){let e=t.target,s=this._lastTouch;if(this._isDragging&&this._dispatchEvent(s,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(s,"drop",this._lastTarget);this._dispatchEvent(s,"dragend",this._dragSource);this._reset()}}}_shouldHandle(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2}_reset(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1}_getPoint(t,e){t&&t.touches&&(t=t.touches[0]);assert(t&&"clientX"in t,"invalid event?");return 1==e?new Point(t.pageX,t.pageY):new Point(t.clientX,t.clientY)}_getDelta(t){let e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)}_getTarget(t){let e=this._getPoint(t),s=document.elementFromPoint(e.x,e.y);for(;s&&"none"==getComputedStyle(s).pointerEvents;)s=s.parentElement;return s}_createImage(t){this._img&&this._destroyImage();let e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){let s=e.getBoundingClientRect(),i=this._getPoint(t);this._imgOffset=new Point(i.x-s.left,i.y-s.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)}_destroyImage(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null}_moveImage(t){requestAnimationFrame(()=>{if(this._img){let e=this._getPoint(t,!0);setCss(this._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(e.x-this._imgOffset.x),top:Math.round(e.y-this._imgOffset.y)})}})}_copyProps(t,e,s){for(let i in e)s.test(i)&&(t[i]=e[i])}_copyStyle(t,e){["id","class","style","draggable"].forEach(t=>{e.removeAttribute(t)});if(t instanceof HTMLCanvasElement){let s=t,i=e;i.width=s.width;i.height=s.height;i.getContext("2d").drawImage(s,0,0)}let s=getComputedStyle(t);for(let t=0;t<s.length;t++){let i=s[t];i.indexOf("transition")<0&&i.indexOf("transform")<0&&(e.style[i]=s[i])}e.style.pointerEvents="none";for(let s=0;s<t.children.length;s++)this._copyStyle(t.children[s],e.children[s])}_dispatchEvent(t,e,s){if(t&&s){let i=document.createEvent("Event"),a=t.touches?t.touches[0]:t;i.initEvent(e,!0,!0);i.button=0;i.which=i.buttons=1;this._copyProps(i,t,/Key$/);this._copyProps(i,a,/(X|Y)$/);i.dataTransfer=this._dataTransfer;s.dispatchEvent(i);return i.defaultPrevented}return!1}}DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;_registerModule("wijmo.touch",selfModule);
14
+ import{Point,asString,assert,closest,setCss,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.touch";export class DataTransfer{constructor(){this._dropEffect="move";this._effectAllowed="all";this._data={}}get dropEffect(){return this._dropEffect}set dropEffect(t){this._dropEffect=asString(t)}get effectAllowed(){return this._effectAllowed}set effectAllowed(t){this._effectAllowed=asString(t)}get types(){return Object.keys(this._data)}clearData(t){null!=t?delete this._data[t]:this._data=null}getData(t){return this._data[t]||""}setData(t,e){this._data[t]=e}setDragImage(t,e,s){let i=DragDropTouch._instance;i._imgCustom=t;i._imgOffset=new Point(e,s)}}export class DragDropTouch{constructor(){this._lastClick=0;this._isDragging=!1;assert(!DragDropTouch._instance,"DragDropTouch instance already created.");let t=!1;document.addEventListener("test",()=>{},{get passive(){t=!0;return!0}});let e=document,s=this._touchstart.bind(this),i=this._touchmove.bind(this),a=this._touchend.bind(this),r=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",s,r);e.addEventListener("touchmove",i,r);e.addEventListener("touchend",a);e.addEventListener("touchcancel",a)}static getInstance(){return DragDropTouch._instance}_touchstart(t){if(this._shouldHandle(t)){let e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}}_touchmove(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;const e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){let e=closest(t.target,"[draggable]");if(e&&e.draggable){this._dragSource=e;this._ptDown=this._getPoint(t)}}}this._dragSource&&t.preventDefault();let e=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",e)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",e)}}if(this._img){t.preventDefault();if(e!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",e);this._lastTarget=e}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",e)}}}_touchend(t){if(this._shouldHandle(t)){let e=t.target,s=this._lastTouch;if(this._isDragging&&this._dispatchEvent(s,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(s,"drop",this._lastTarget);this._dispatchEvent(s,"dragend",this._dragSource);this._reset()}}}_shouldHandle(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2}_reset(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1}_getPoint(t,e){t&&t.touches&&(t=t.touches[0]);assert(t&&"clientX"in t,"invalid event?");return 1==e?new Point(t.pageX,t.pageY):new Point(t.clientX,t.clientY)}_getDelta(t){let e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)}_getTarget(t){let e=this._getPoint(t),s=document.elementFromPoint(e.x,e.y);for(;s&&"none"==getComputedStyle(s).pointerEvents;)s=s.parentElement;return s}_createImage(t){this._img&&this._destroyImage();let e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){let s=e.getBoundingClientRect(),i=this._getPoint(t);this._imgOffset=new Point(i.x-s.left,i.y-s.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)}_destroyImage(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null}_moveImage(t){requestAnimationFrame(()=>{if(this._img){let e=this._getPoint(t,!0);setCss(this._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(e.x-this._imgOffset.x),top:Math.round(e.y-this._imgOffset.y)})}})}_copyProps(t,e,s){for(let i in e)s.test(i)&&(t[i]=e[i])}_copyStyle(t,e){["id","class","style","draggable"].forEach(t=>{e.removeAttribute(t)});if(t instanceof HTMLCanvasElement){let s=t,i=e;i.width=s.width;i.height=s.height;i.getContext("2d").drawImage(s,0,0)}let s=getComputedStyle(t);for(let t=0;t<s.length;t++){let i=s[t];i.indexOf("transition")<0&&i.indexOf("transform")<0&&(e.style[i]=s[i])}e.style.pointerEvents="none";for(let s=0;s<t.children.length;s++)this._copyStyle(t.children[s],e.children[s])}_dispatchEvent(t,e,s){if(t&&s){let i=document.createEvent("Event"),a=t.touches?t.touches[0]:t;i.initEvent(e,!0,!0);i.button=0;i.which=i.buttons=1;this._copyProps(i,t,/Key$/);this._copyProps(i,a,/(X|Y)$/);i.dataTransfer=this._dataTransfer;s.dispatchEvent(i);return i.defaultPrevented}return!1}}DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;_registerModule("wijmo.touch",selfModule);
package/es5-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241016.t115522
3
+ * Wijmo Library 5.20242.23-nightly.d20241022.t051638
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{Point,asString,assert,closest,setCss,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.touch";var DataTransfer=function(){function DataTransfer(){this._dropEffect="move";this._effectAllowed="all";this._data={}}Object.defineProperty(DataTransfer.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(t){this._dropEffect=asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(t){this._effectAllowed=asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0});DataTransfer.prototype.clearData=function(t){null!=t?delete this._data[t]:this._data=null};DataTransfer.prototype.getData=function(t){return this._data[t]||""};DataTransfer.prototype.setData=function(t,e){this._data[t]=e};DataTransfer.prototype.setDragImage=function(t,e,r){var o=DragDropTouch._instance;o._imgCustom=t;o._imgOffset=new Point(e,r)};return DataTransfer}();export{DataTransfer};var DragDropTouch=function(){function DragDropTouch(){this._lastClick=0;this._isDragging=!1;assert(!DragDropTouch._instance,"DragDropTouch instance already created.");var t=!1;document.addEventListener("test",(function(){}),{get passive(){t=!0;return!0}});var e=document,r=this._touchstart.bind(this),o=this._touchmove.bind(this),i=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",r,a);e.addEventListener("touchmove",o,a);e.addEventListener("touchend",i);e.addEventListener("touchcancel",i)}DragDropTouch.getInstance=function(){return DragDropTouch._instance};DragDropTouch.prototype._touchstart=function(t){if(this._shouldHandle(t)){var e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}};DragDropTouch.prototype._touchmove=function(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;var e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){var r=closest(t.target,"[draggable]");if(r&&r.draggable){this._dragSource=r;this._ptDown=this._getPoint(t)}}}var o=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",o)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",o)}}if(this._img){t.preventDefault();if(o!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",o);this._lastTarget=o}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",o)}}};DragDropTouch.prototype._touchend=function(t){if(this._shouldHandle(t)){var e=t.target,r=this._lastTouch;if(this._isDragging&&this._dispatchEvent(r,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(r,"drop",this._lastTarget);this._dispatchEvent(r,"dragend",this._dragSource);this._reset()}}};DragDropTouch.prototype._shouldHandle=function(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2};DragDropTouch.prototype._reset=function(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1};DragDropTouch.prototype._getPoint=function(t,e){t&&t.touches&&(t=t.touches[0]);assert(t&&"clientX"in t,"invalid event?");return 1==e?new Point(t.pageX,t.pageY):new Point(t.clientX,t.clientY)};DragDropTouch.prototype._getDelta=function(t){var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)};DragDropTouch.prototype._getTarget=function(t){for(var e=this._getPoint(t),r=document.elementFromPoint(e.x,e.y);r&&"none"==getComputedStyle(r).pointerEvents;)r=r.parentElement;return r};DragDropTouch.prototype._createImage=function(t){this._img&&this._destroyImage();var e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){var r=e.getBoundingClientRect(),o=this._getPoint(t);this._imgOffset=new Point(o.x-r.left,o.y-r.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)};DragDropTouch.prototype._destroyImage=function(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null};DragDropTouch.prototype._moveImage=function(t){var e=this;requestAnimationFrame((function(){if(e._img){var r=e._getPoint(t,!0);setCss(e._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(r.x-e._imgOffset.x),top:Math.round(r.y-e._imgOffset.y)})}}))};DragDropTouch.prototype._copyProps=function(t,e,r){for(var o in e)r.test(o)&&(t[o]=e[o])};DragDropTouch.prototype._copyStyle=function(t,e){["id","class","style","draggable"].forEach((function(t){e.removeAttribute(t)}));if(t instanceof HTMLCanvasElement){var r=t,o=e;o.width=r.width;o.height=r.height;o.getContext("2d").drawImage(r,0,0)}for(var i=getComputedStyle(t),a=0;a<i.length;a++){var n=i[a];n.indexOf("transition")<0&&n.indexOf("transform")<0&&(e.style[n]=i[n])}e.style.pointerEvents="none";for(a=0;a<t.children.length;a++)this._copyStyle(t.children[a],e.children[a])};DragDropTouch.prototype._dispatchEvent=function(t,e,r){if(t&&r){var o=document.createEvent("Event"),i=t.touches?t.touches[0]:t;o.initEvent(e,!0,!0);o.button=0;o.which=o.buttons=1;this._copyProps(o,t,/Key$/);this._copyProps(o,i,/(X|Y)$/);o.dataTransfer=this._dataTransfer;r.dispatchEvent(o);return o.defaultPrevented}return!1};DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;return DragDropTouch}();export{DragDropTouch};_registerModule("wijmo.touch",selfModule);
14
+ import{Point,asString,assert,closest,setCss,_registerModule}from"@mescius/wijmo";import*as selfModule from"@mescius/wijmo.touch";var DataTransfer=function(){function DataTransfer(){this._dropEffect="move";this._effectAllowed="all";this._data={}}Object.defineProperty(DataTransfer.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(t){this._dropEffect=asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(t){this._effectAllowed=asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0});DataTransfer.prototype.clearData=function(t){null!=t?delete this._data[t]:this._data=null};DataTransfer.prototype.getData=function(t){return this._data[t]||""};DataTransfer.prototype.setData=function(t,e){this._data[t]=e};DataTransfer.prototype.setDragImage=function(t,e,r){var o=DragDropTouch._instance;o._imgCustom=t;o._imgOffset=new Point(e,r)};return DataTransfer}();export{DataTransfer};var DragDropTouch=function(){function DragDropTouch(){this._lastClick=0;this._isDragging=!1;assert(!DragDropTouch._instance,"DragDropTouch instance already created.");var t=!1;document.addEventListener("test",(function(){}),{get passive(){t=!0;return!0}});var e=document,r=this._touchstart.bind(this),o=this._touchmove.bind(this),i=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",r,a);e.addEventListener("touchmove",o,a);e.addEventListener("touchend",i);e.addEventListener("touchcancel",i)}DragDropTouch.getInstance=function(){return DragDropTouch._instance};DragDropTouch.prototype._touchstart=function(t){if(this._shouldHandle(t)){var e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}};DragDropTouch.prototype._touchmove=function(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;var e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){var r=closest(t.target,"[draggable]");if(r&&r.draggable){this._dragSource=r;this._ptDown=this._getPoint(t)}}}this._dragSource&&t.preventDefault();var o=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",o)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",o)}}if(this._img){t.preventDefault();if(o!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",o);this._lastTarget=o}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",o)}}};DragDropTouch.prototype._touchend=function(t){if(this._shouldHandle(t)){var e=t.target,r=this._lastTouch;if(this._isDragging&&this._dispatchEvent(r,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(r,"drop",this._lastTarget);this._dispatchEvent(r,"dragend",this._dragSource);this._reset()}}};DragDropTouch.prototype._shouldHandle=function(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2};DragDropTouch.prototype._reset=function(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1};DragDropTouch.prototype._getPoint=function(t,e){t&&t.touches&&(t=t.touches[0]);assert(t&&"clientX"in t,"invalid event?");return 1==e?new Point(t.pageX,t.pageY):new Point(t.clientX,t.clientY)};DragDropTouch.prototype._getDelta=function(t){var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)};DragDropTouch.prototype._getTarget=function(t){for(var e=this._getPoint(t),r=document.elementFromPoint(e.x,e.y);r&&"none"==getComputedStyle(r).pointerEvents;)r=r.parentElement;return r};DragDropTouch.prototype._createImage=function(t){this._img&&this._destroyImage();var e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){var r=e.getBoundingClientRect(),o=this._getPoint(t);this._imgOffset=new Point(o.x-r.left,o.y-r.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)};DragDropTouch.prototype._destroyImage=function(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null};DragDropTouch.prototype._moveImage=function(t){var e=this;requestAnimationFrame((function(){if(e._img){var r=e._getPoint(t,!0);setCss(e._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(r.x-e._imgOffset.x),top:Math.round(r.y-e._imgOffset.y)})}}))};DragDropTouch.prototype._copyProps=function(t,e,r){for(var o in e)r.test(o)&&(t[o]=e[o])};DragDropTouch.prototype._copyStyle=function(t,e){["id","class","style","draggable"].forEach((function(t){e.removeAttribute(t)}));if(t instanceof HTMLCanvasElement){var r=t,o=e;o.width=r.width;o.height=r.height;o.getContext("2d").drawImage(r,0,0)}for(var i=getComputedStyle(t),a=0;a<i.length;a++){var n=i[a];n.indexOf("transition")<0&&n.indexOf("transform")<0&&(e.style[n]=i[n])}e.style.pointerEvents="none";for(a=0;a<t.children.length;a++)this._copyStyle(t.children[a],e.children[a])};DragDropTouch.prototype._dispatchEvent=function(t,e,r){if(t&&r){var o=document.createEvent("Event"),i=t.touches?t.touches[0]:t;o.initEvent(e,!0,!0);o.button=0;o.which=o.buttons=1;this._copyProps(o,t,/Key$/);this._copyProps(o,i,/(X|Y)$/);o.dataTransfer=this._dataTransfer;r.dispatchEvent(o);return o.defaultPrevented}return!1};DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;return DragDropTouch}();export{DragDropTouch};_registerModule("wijmo.touch",selfModule);
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241016.t115522
3
+ * Wijmo Library 5.20242.23-nightly.d20241022.t051638
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241016.t115522
3
+ * Wijmo Library 5.20242.23-nightly.d20241022.t051638
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@mescius/wijmo"),selfModule=__importStar(require("@mescius/wijmo.touch")),DataTransfer=function(){function DataTransfer(){this._dropEffect="move";this._effectAllowed="all";this._data={}}Object.defineProperty(DataTransfer.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(t){this._dropEffect=wijmo_1.asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(t){this._effectAllowed=wijmo_1.asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0});DataTransfer.prototype.clearData=function(t){null!=t?delete this._data[t]:this._data=null};DataTransfer.prototype.getData=function(t){return this._data[t]||""};DataTransfer.prototype.setData=function(t,e){this._data[t]=e};DataTransfer.prototype.setDragImage=function(t,e,r){var i=DragDropTouch._instance;i._imgCustom=t;i._imgOffset=new wijmo_1.Point(e,r)};return DataTransfer}();exports.DataTransfer=DataTransfer;var DragDropTouch=function(){function DragDropTouch(){this._lastClick=0;this._isDragging=!1;wijmo_1.assert(!DragDropTouch._instance,"DragDropTouch instance already created.");var t=!1;document.addEventListener("test",(function(){}),{get passive(){t=!0;return!0}});var e=document,r=this._touchstart.bind(this),i=this._touchmove.bind(this),o=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",r,a);e.addEventListener("touchmove",i,a);e.addEventListener("touchend",o);e.addEventListener("touchcancel",o)}DragDropTouch.getInstance=function(){return DragDropTouch._instance};DragDropTouch.prototype._touchstart=function(t){if(this._shouldHandle(t)){var e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}};DragDropTouch.prototype._touchmove=function(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;var e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){var r=wijmo_1.closest(t.target,"[draggable]");if(r&&r.draggable){this._dragSource=r;this._ptDown=this._getPoint(t)}}}var i=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",i)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",i)}}if(this._img){t.preventDefault();if(i!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",i);this._lastTarget=i}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",i)}}};DragDropTouch.prototype._touchend=function(t){if(this._shouldHandle(t)){var e=t.target,r=this._lastTouch;if(this._isDragging&&this._dispatchEvent(r,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(r,"drop",this._lastTarget);this._dispatchEvent(r,"dragend",this._dragSource);this._reset()}}};DragDropTouch.prototype._shouldHandle=function(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2};DragDropTouch.prototype._reset=function(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1};DragDropTouch.prototype._getPoint=function(t,e){t&&t.touches&&(t=t.touches[0]);wijmo_1.assert(t&&"clientX"in t,"invalid event?");return 1==e?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.clientX,t.clientY)};DragDropTouch.prototype._getDelta=function(t){var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)};DragDropTouch.prototype._getTarget=function(t){for(var e=this._getPoint(t),r=document.elementFromPoint(e.x,e.y);r&&"none"==getComputedStyle(r).pointerEvents;)r=r.parentElement;return r};DragDropTouch.prototype._createImage=function(t){this._img&&this._destroyImage();var e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){var r=e.getBoundingClientRect(),i=this._getPoint(t);this._imgOffset=new wijmo_1.Point(i.x-r.left,i.y-r.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)};DragDropTouch.prototype._destroyImage=function(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null};DragDropTouch.prototype._moveImage=function(t){var e=this;requestAnimationFrame((function(){if(e._img){var r=e._getPoint(t,!0);wijmo_1.setCss(e._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(r.x-e._imgOffset.x),top:Math.round(r.y-e._imgOffset.y)})}}))};DragDropTouch.prototype._copyProps=function(t,e,r){for(var i in e)r.test(i)&&(t[i]=e[i])};DragDropTouch.prototype._copyStyle=function(t,e){["id","class","style","draggable"].forEach((function(t){e.removeAttribute(t)}));if(t instanceof HTMLCanvasElement){var r=t,i=e;i.width=r.width;i.height=r.height;i.getContext("2d").drawImage(r,0,0)}for(var o=getComputedStyle(t),a=0;a<o.length;a++){var n=o[a];n.indexOf("transition")<0&&n.indexOf("transform")<0&&(e.style[n]=o[n])}e.style.pointerEvents="none";for(a=0;a<t.children.length;a++)this._copyStyle(t.children[a],e.children[a])};DragDropTouch.prototype._dispatchEvent=function(t,e,r){if(t&&r){var i=document.createEvent("Event"),o=t.touches?t.touches[0]:t;i.initEvent(e,!0,!0);i.button=0;i.which=i.buttons=1;this._copyProps(i,t,/Key$/);this._copyProps(i,o,/(X|Y)$/);i.dataTransfer=this._dataTransfer;r.dispatchEvent(i);return i.defaultPrevented}return!1};DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;return DragDropTouch}();exports.DragDropTouch=DragDropTouch;wijmo_1._registerModule("wijmo.touch",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@mescius/wijmo"),selfModule=__importStar(require("@mescius/wijmo.touch")),DataTransfer=function(){function DataTransfer(){this._dropEffect="move";this._effectAllowed="all";this._data={}}Object.defineProperty(DataTransfer.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(t){this._dropEffect=wijmo_1.asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(t){this._effectAllowed=wijmo_1.asString(t)},enumerable:!0,configurable:!0});Object.defineProperty(DataTransfer.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0});DataTransfer.prototype.clearData=function(t){null!=t?delete this._data[t]:this._data=null};DataTransfer.prototype.getData=function(t){return this._data[t]||""};DataTransfer.prototype.setData=function(t,e){this._data[t]=e};DataTransfer.prototype.setDragImage=function(t,e,r){var i=DragDropTouch._instance;i._imgCustom=t;i._imgOffset=new wijmo_1.Point(e,r)};return DataTransfer}();exports.DataTransfer=DataTransfer;var DragDropTouch=function(){function DragDropTouch(){this._lastClick=0;this._isDragging=!1;wijmo_1.assert(!DragDropTouch._instance,"DragDropTouch instance already created.");var t=!1;document.addEventListener("test",(function(){}),{get passive(){t=!0;return!0}});var e=document,r=this._touchstart.bind(this),i=this._touchmove.bind(this),o=this._touchend.bind(this),a=!!t&&{passive:!1,capture:!1};e.addEventListener("touchstart",r,a);e.addEventListener("touchmove",i,a);e.addEventListener("touchend",o);e.addEventListener("touchcancel",o)}DragDropTouch.getInstance=function(){return DragDropTouch._instance};DragDropTouch.prototype._touchstart=function(t){if(this._shouldHandle(t)){var e=t.target;if(Date.now()-this._lastClick<DragDropTouch._DBLCLICK&&this._dispatchEvent(t,"dblclick",e)){t.preventDefault();this._reset();return}this._reset();this._lastTouch=t}};DragDropTouch.prototype._touchmove=function(t){if(this._shouldHandle(t)){this._lastTouch=t;if(!this._isDragging){this._isDragging=!0;var e=t.target;if(!this._dispatchEvent(t,"mousemove",e)&&!this._dispatchEvent(t,"mousedown",e)){var r=wijmo_1.closest(t.target,"[draggable]");if(r&&r.draggable){this._dragSource=r;this._ptDown=this._getPoint(t)}}}this._dragSource&&t.preventDefault();var i=this._getTarget(t);if(this._dispatchEvent(t,"mousemove",i)){t.preventDefault();return}if(this._dragSource&&!this._img){if(this._getDelta(t)>DragDropTouch._THRESHOLD){this._dispatchEvent(t,"dragstart",this._dragSource);this._createImage(t);this._dispatchEvent(t,"dragenter",i)}}if(this._img){t.preventDefault();if(i!=this._lastTarget){this._dispatchEvent(t,"dragleave",this._lastTarget);this._dispatchEvent(t,"dragenter",i);this._lastTarget=i}this._moveImage(t);this._draggingIsValid=this._dispatchEvent(t,"dragover",i)}}};DragDropTouch.prototype._touchend=function(t){if(this._shouldHandle(t)){var e=t.target,r=this._lastTouch;if(this._isDragging&&this._dispatchEvent(r,"mouseup",e)){t.preventDefault();return}this._destroyImage();if(this._dragSource){this._draggingIsValid&&t.type.indexOf("cancel")<0&&this._dispatchEvent(r,"drop",this._lastTarget);this._dispatchEvent(r,"dragend",this._dragSource);this._reset()}}};DragDropTouch.prototype._shouldHandle=function(t){return t&&!t.defaultPrevented&&t.touches&&t.touches.length<2};DragDropTouch.prototype._reset=function(){this._destroyImage();this._dragSource=null;this._lastTouch=null;this._lastTarget=null;this._ptDown=null;this._dataTransfer=new DataTransfer;this._isDragging=!1};DragDropTouch.prototype._getPoint=function(t,e){t&&t.touches&&(t=t.touches[0]);wijmo_1.assert(t&&"clientX"in t,"invalid event?");return 1==e?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.clientX,t.clientY)};DragDropTouch.prototype._getDelta=function(t){var e=this._getPoint(t);return Math.abs(e.x-this._ptDown.x)+Math.abs(e.y-this._ptDown.y)};DragDropTouch.prototype._getTarget=function(t){for(var e=this._getPoint(t),r=document.elementFromPoint(e.x,e.y);r&&"none"==getComputedStyle(r).pointerEvents;)r=r.parentElement;return r};DragDropTouch.prototype._createImage=function(t){this._img&&this._destroyImage();var e=this._imgCustom||this._dragSource;this._img=e.cloneNode(!0);this._copyStyle(e,this._img);this._img.style.top=this._img.style.left="-9999px";if(!this._imgCustom){var r=e.getBoundingClientRect(),i=this._getPoint(t);this._imgOffset=new wijmo_1.Point(i.x-r.left,i.y-r.top);this._img.style.opacity=DragDropTouch._OPACITY.toString()}this._moveImage(t);document.body.appendChild(this._img)};DragDropTouch.prototype._destroyImage=function(){this._img&&this._img.parentElement&&this._img.parentElement.removeChild(this._img);this._img=null;this._imgCustom=null};DragDropTouch.prototype._moveImage=function(t){var e=this;requestAnimationFrame((function(){if(e._img){var r=e._getPoint(t,!0);wijmo_1.setCss(e._img,{position:"absolute",pointerEvents:"none",zIndex:999999,left:Math.round(r.x-e._imgOffset.x),top:Math.round(r.y-e._imgOffset.y)})}}))};DragDropTouch.prototype._copyProps=function(t,e,r){for(var i in e)r.test(i)&&(t[i]=e[i])};DragDropTouch.prototype._copyStyle=function(t,e){["id","class","style","draggable"].forEach((function(t){e.removeAttribute(t)}));if(t instanceof HTMLCanvasElement){var r=t,i=e;i.width=r.width;i.height=r.height;i.getContext("2d").drawImage(r,0,0)}for(var o=getComputedStyle(t),a=0;a<o.length;a++){var n=o[a];n.indexOf("transition")<0&&n.indexOf("transform")<0&&(e.style[n]=o[n])}e.style.pointerEvents="none";for(a=0;a<t.children.length;a++)this._copyStyle(t.children[a],e.children[a])};DragDropTouch.prototype._dispatchEvent=function(t,e,r){if(t&&r){var i=document.createEvent("Event"),o=t.touches?t.touches[0]:t;i.initEvent(e,!0,!0);i.button=0;i.which=i.buttons=1;this._copyProps(i,t,/Key$/);this._copyProps(i,o,/(X|Y)$/);i.dataTransfer=this._dataTransfer;r.dispatchEvent(i);return i.defaultPrevented}return!1};DragDropTouch._instance=new DragDropTouch;DragDropTouch._THRESHOLD=5;DragDropTouch._OPACITY=.5;DragDropTouch._DBLCLICK=500;DragDropTouch._CTXMENU=900;return DragDropTouch}();exports.DragDropTouch=DragDropTouch;wijmo_1._registerModule("wijmo.touch",selfModule);
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@mescius/wijmo.touch",
3
- "version": "5.20242.23-nightly.d20241016.t115522",
3
+ "version": "5.20242.23-nightly.d20241022.t051638",
4
4
  "description": "UI library for pure JS, Angular, React, Vue and more...",
5
5
  "author": "MESCIUS inc",
6
6
  "license": "Commercial",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "dependencies": {
10
- "@mescius/wijmo": "5.20242.23-nightly.d20241016.t115522"
10
+ "@mescius/wijmo": "5.20242.23-nightly.d20241022.t051638"
11
11
  },
12
12
  "homepage": "https://developer.mescius.com/wijmo",
13
13
  "bugs": {