@whitesev/pops 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/index.amd.js +250 -227
  2. package/dist/index.amd.js.map +1 -1
  3. package/dist/index.amd.min.js +1 -1
  4. package/dist/index.amd.min.js.map +1 -1
  5. package/dist/index.cjs.js +250 -227
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.cjs.min.js +1 -1
  8. package/dist/index.cjs.min.js.map +1 -1
  9. package/dist/index.esm.js +250 -227
  10. package/dist/index.esm.js.map +1 -1
  11. package/dist/index.esm.min.js +1 -1
  12. package/dist/index.esm.min.js.map +1 -1
  13. package/dist/index.iife.js +250 -227
  14. package/dist/index.iife.js.map +1 -1
  15. package/dist/index.iife.min.js +1 -1
  16. package/dist/index.iife.min.js.map +1 -1
  17. package/dist/index.system.js +250 -227
  18. package/dist/index.system.js.map +1 -1
  19. package/dist/index.system.min.js +1 -1
  20. package/dist/index.system.min.js.map +1 -1
  21. package/dist/index.umd.js +250 -227
  22. package/dist/index.umd.js.map +1 -1
  23. package/dist/index.umd.min.js +1 -1
  24. package/dist/index.umd.min.js.map +1 -1
  25. package/dist/types/src/Pops.d.ts +17 -16
  26. package/dist/types/src/types/PopsDOMUtilsEventType.d.ts +3 -3
  27. package/dist/types/src/types/mask.d.ts +6 -6
  28. package/dist/types/src/utils/PopsDOMUtils.d.ts +6 -18
  29. package/dist/types/src/utils/PopsInstanceUtils.d.ts +22 -0
  30. package/dist/types/src/utils/PopsUtils.d.ts +1 -1
  31. package/package.json +1 -1
  32. package/src/Pops.ts +9 -12
  33. package/src/components/panel/handlerComponents.ts +4 -4
  34. package/src/handler/PopsHandler.ts +9 -21
  35. package/src/handler/PopsInstHandler.ts +3 -2
  36. package/src/types/PopsDOMUtilsEventType.d.ts +3 -3
  37. package/src/types/mask.d.ts +6 -6
  38. package/src/utils/PopsDOMUtils.ts +105 -113
  39. package/src/utils/PopsInstanceUtils.ts +50 -0
  40. package/src/utils/PopsUtils.ts +2 -2
  41. package/dist/types/src/utils/PopsDOMUtilsEventsConfig.d.ts +0 -4
  42. package/src/utils/PopsDOMUtilsEventsConfig.ts +0 -4
@@ -3,7 +3,7 @@ System.register('pops', [], (function (exports) {
3
3
  return {
4
4
  execute: (function () {
5
5
 
6
- const version = "4.1.0";
6
+ const version = "4.2.1";
7
7
 
8
8
  const GlobalConfig = {
9
9
  config: {},
@@ -247,11 +247,6 @@ System.register('pops', [], (function (exports) {
247
247
  },
248
248
  };
249
249
 
250
- /**
251
- * 存储在元素属性上的事件名
252
- */
253
- const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
254
-
255
250
  const OriginPrototype = {
256
251
  Object: {
257
252
  defineProperty: Object.defineProperty,
@@ -301,31 +296,31 @@ System.register('pops', [], (function (exports) {
301
296
  },
302
297
  };
303
298
 
304
- let t$1 = class t{constructor(){this.__map={};}beforeEach(t){this.__interceptor=t;}on(t,i){const s=Array.isArray(t)?t:[t];for(const t of s){this.__map[t]=this.__map[t]||[];const s=this.__map[t];s&&s.push(i);}return this}emit(t,i,s){ void 0!==this.__interceptor?this.__interceptor(t,(()=>{this.__emit(t,i),s&&s();})):(this.__emit(t,i),s&&s());}__emit(t,i){const s=this.__map[t];if(Array.isArray(s)&&(null==s?void 0:s.length))for(const _ of s)_(i,t);this.event=i;}off(t,i){const s=this.__map[t];if(void 0!==s)if(void 0===i)delete this.__map[t];else {const t=s.findIndex((t=>t===i));s.splice(t,1);}}destroy(){this.__map={};}};
299
+ const n$1="clientX",e$2="clientY",t$1=16,c$3="start",o$1="move",s$1="cancel",u$3="end",a$2="left",i$3="right",r$4="up",d$1="down",m$2={4:"start",5:"move",1:"end",3:"cancel"};function v$1(n){return m$2[n]}function b(n,e,t){const c={1:{0:{move:4},4:{move:5,end:1,cancel:3},5:{move:5,end:1,cancel:3}},0:{4:{move:2,end:1,cancel:3},5:{start:2,move:2,end:1,cancel:3}}}[Number(n)][e];return void 0!==c&&c[t]||0}function g$1(n){[1,3,2].includes(n.state)&&(n.state=0);}function h$3(n){return [5,1,3].includes(n)}function j(n){if(n.disabled)return n.state=0,true}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:false})}function p$3(n){return Math.round(100*n)/100}
305
300
 
306
- const n$1="clientX",e$2="clientY",t=16,c$3="start",o$1="move",s$1="cancel",u$3="end",a$2="left",i$3="right",r$4="up",d$1="down",m$2={4:"start",5:"move",1:"end",3:"cancel"};function v$1(n){return m$2[n]}function b(n,e,t){const c={1:{0:{move:4},4:{move:5,end:1,cancel:3},5:{move:5,end:1,cancel:3}},0:{4:{move:2,end:1,cancel:3},5:{start:2,move:2,end:1,cancel:3}}}[Number(n)][e];return void 0!==c&&c[t]||0}function g$1(n){[1,3,2].includes(n.state)&&(n.state=0);}function h$3(n){return [5,1,3].includes(n)}function j(n){if(n.disabled)return n.state=0,true}function O(n,e){return Object.assign(Object.assign(Object.assign({},n),e),{state:0,disabled:false})}function p$3(n){return Math.round(100*n)/100}
301
+ var x=r=>Math.sqrt(r.x*r.x+r.y*r.y),y=(r,a)=>r.x*a.x+r.y*a.y,e$1=(r,a)=>{var t=x(r)*x(a);if(0===t)return 0;var h=y(r,a)/t;return h>1&&(h=1),Math.acos(h)},n=(r,a)=>r.x*a.y-a.x*r.y,o=r=>r/Math.PI*180,s=(r,a)=>{var t=e$1(r,a);return n(r,a)>0&&(t*=-1),o(t)},u$2=(x,y)=>{if(0!==x||0!==y)return Math.abs(x)>=Math.abs(y)?0<x?i$3:a$2:0<y?d$1:r$4};
307
302
 
308
- function r$3(){let t,o,i,r,a=0;return function(u){if(t=o,void 0!==u){a=Number.MAX_SAFE_INTEGER>a?++a:1;const h=function(t,o){const{phase:i,points:r,changedPoints:a,nativeEvent:u}=t,h=r.length,p=c$3===i,g=u$3===i&&0===h||s$1===i,l=Date.now(),{x:d,y:m}=c$2(r)||c$2(a),{currentTarget:v}=u;return Object.assign(t,{id:o,x:d,y:m,timestamp:l,isStart:p,isEnd:g,pointLength:h,currentTarget:v,getOffset(t=v){const e=t.getBoundingClientRect();return {x:d-Math.round(e.left),y:m-Math.round(e.top)}}})}(u,a);o=h;const{isStart:p,pointLength:g}=h;return p&&(i=h,t=void 0,r=1<g?h:void 0),Object.assign(Object.assign({},h),{prevInput:t,startMultiInput:r,startInput:i})}}}function c$2(t){const{length:e}=t;if(0<e){if(1===e){const{clientX:e,clientY:n}=t[0];return {x:Math.round(e),y:Math.round(n)}}const n=t.reduce(((t,e)=>(t.x+=e[n$1],t.y+=e[e$2],t)),{x:0,y:0});return {x:Math.round(n.x/e),y:Math.round(n.y/e)}}}function a$1(t,e,n,s){const o={};for(const t in n)["target","currentTarget","type"].includes(t)||(o[t]=n[t]);let i;return document.createEvent?(i=document.createEvent("HTMLEvents"),i.initEvent(t,null==s?void 0:s.bubbles,null==s?void 0:s.cancelable)):i=new Event(t,s),Object.assign(i,o,{match:()=>n.targets&&0<n.targets.length&&n.targets.every((t=>i.currentTarget.contains(t)))}),e.dispatchEvent(i)}function u$2(t,e){const{preventDefault:n}=e;return s=n,"[object Function]"===Object.prototype.toString.call(s)?n(t):!!n;var s;}const h$2=["touchstart","touchmove","touchend","touchcancel","mousedown"],p$2=["mousemove","mouseup"];const g={domEvents:{bubbles:true,cancelable:true},preventDefault:t=>{if(t.target&&"tagName"in t.target){const{tagName:e}=t.target;return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return false}};let l$1 = class l extends t$1{constructor(t,e){super(),this.v="2.1.3",this.__computeFunctionList=[],this.__computeFunctionCreatorList=[],this.__pluginContexts=[],this.__isIgnoreMouse=false,this.el=t,this.c={},this.__options=Object.assign(Object.assign({},g),e);const n=function(t){const e=r$3();return function(n){const s=[],o=[];Array.from(n.touches).forEach((({clientX:e,clientY:n,target:i})=>{(null==t?void 0:t.contains(i))&&(s.push(i),o.push({clientX:e,clientY:n,target:i}));}));const i=Array.from(n.changedTouches).map((({clientX:t,clientY:e,target:n})=>({clientX:t,clientY:e,target:n})));return e({phase:n.type.replace("touch",""),changedPoints:i,points:o,nativeEvent:n,target:n.target,targets:s})}}(this.el),s=function(){let t,e=false,n=null;const s=r$3();return function(o){const{clientX:i,clientY:r,type:c,button:a,target:u}=o;let h,p=[{clientX:i,clientY:r,target:u}];if("mousedown"===c&&0===a)n=u,e=true,h="start";else {if(!e)return;"mousemove"===c?h="move":"mouseup"===c&&(p=[],h="end",e=false);}const g=t||[{clientX:i,clientY:r,target:u}];if(t=[{clientX:i,clientY:r,target:u}],void 0!==h)return s({phase:h,changedPoints:g,points:p,target:n,targets:[n],nativeEvent:o})}}();if(this.__inputCreatorMap={touchstart:n,touchmove:n,touchend:n,touchcancel:n,mousedown:s,mousemove:s,mouseup:s},this.on("at:after",(t=>{const{target:e,__type:n}=t,{domEvents:s}=this.__options;s&&void 0!==this.el&&e&&(a$1(n,e,t,s),a$1("at:after",e,t,s));})),void 0!==t){t.style.webkitTapHighlightColor="rgba(0,0,0,0)";let e=false;try{const t={};Object.defineProperty(t,"passive",{get(){e=!0;}}),window.addEventListener("_",(()=>{}),t);}catch(t){}this.on("u",function(t,e,n){return h$2.forEach((s=>{t.addEventListener(s,e,n);})),p$2.forEach((t=>{window.addEventListener(t,e,n);})),()=>{h$2.forEach((n=>{t.removeEventListener(n,e);})),p$2.forEach((t=>{window.removeEventListener(t,e);}));}}(t,this.catchEvent.bind(this),false===this.__options.preventDefault&&e?{passive:true}:{passive:false}));}}use(t,e){this.__pluginContexts.push(t(this,e));}catchEvent(t){const e=this.__inputCreatorMap[t.type](t);if(void 0!==e){const n=()=>t.stopPropagation(),s=()=>t.stopImmediatePropagation(),o=()=>t.preventDefault();if(u$2(t,this.__options))o();else if("touchstart"===t.type?this.__isIgnoreMouse=true:"touchmove"===t.type&&(this.__isIgnoreMouse=false),this.__isIgnoreMouse&&t.type.startsWith("mouse"))return void("mouseup"===t.type&&(this.__isIgnoreMouse=false));this.emit("input",e),this.emit2(`at:${e.phase}`,e,{});const i={};this.__computeFunctionList.forEach((t=>{const n=t(e,i);if(void 0!==n)for(const t in n)i[t]=n[t];})),this.emit("computed",Object.assign(Object.assign(Object.assign({},e),i),{stopPropagation:n,stopImmediatePropagation:s,preventDefault:o}));}}compute(t,e){for(const e of t)this.__computeFunctionCreatorList.includes(e)||(this.__computeFunctionCreatorList.push(e),this.__computeFunctionList.push(e()));this.on("computed",e);}beforeEach(t){super.beforeEach(((e,n)=>{var s;(null===(s=this.c)||void 0===s?void 0:s.name)?t(e,n):n();}));}get(t){return this.__pluginContexts.find((e=>t===e.name))}set(t){this.__options=Object.assign(Object.assign({},this.__options),t);}emit2(t,e,n){this.c=n,this.emit(t,Object.assign(Object.assign({},e),{type:t}),(()=>{this.emit("at:after",Object.assign(Object.assign({},e),{name:t,__type:t}));}));}destroy(){this.emit("u"),super.destroy();}};
303
+ function p$2(){let n=0,e=0;return function(o,r){const{prevVecotr:i,startVecotr:a,activeVecotr:c}=r;return c&&(e=Math.round(s(c,i)),n=Math.round(s(c,a))),{angle:n,deltaAngle:e}}}function d(){return function(t){const{prevInput:e}=t;let o$1=0,r=0,i=0;if(void 0!==e&&(o$1=t.x-e.x,r=t.y-e.y,0!==o$1||0!==r)){const t=Math.sqrt(Math.pow(o$1,2)+Math.pow(r,2));i=Math.round(o(Math.acos(Math.abs(o$1)/t)));}return {deltaX:o$1,deltaY:r,deltaXYAngle:i}}}function h$2(){let t,n=0,u=0,s=0,p=0,d=0;return function(h){const{phase:l,startInput:f}=h;return c$3===l?(n=0,u=0,s=0,p=0,d=0):o$1===l&&(n=Math.round(h.points[0][n$1]-f.points[0][n$1]),u=Math.round(h.points[0][e$2]-f.points[0][e$2]),s=Math.abs(n),p=Math.abs(u),d=Math.round(x({x:s,y:p})),t=u$2(n,u)),{displacementX:n,displacementY:u,distanceX:s,distanceY:p,distance:d,overallDirection:t}}}function l$1(){let t=1;return function(n,o){let r=1;const{prevVecotr:i,startVecotr:a,activeVecotr:c}=o;return c&&(r=p$3(x(c)/x(i)),t=p$3(x(c)/x(a))),{scale:t,deltaScale:r}}}function f(){let t,n,e=0,r=0,i=0,a=0;return function(c){if(void 0!==c){n=n||c.startInput;const u=c.timestamp-n.timestamp;if(t$1<u){const s=c.x-n.x,p=c.y-n.y;i=Math.round(s/u*100)/100,a=Math.round(p/u*100)/100,e=Math.abs(i),r=Math.abs(a),t=u$2(s,p),n=c;}}return {velocityX:e,velocityY:r,speedX:i,speedY:a,direction:t}}}function M(){let t=0;return function(n){const{phase:e}=n;return c$3===e&&(t=n.pointLength),{maxPointLength:t}}}function v(t){return {x:t.points[1][n$1]-t.points[0][n$1],y:t.points[1][e$2]-t.points[0][e$2]}}function m$1(){let t,n,e;return function(o){const{prevInput:r,startMultiInput:i}=o;return void 0!==i&&void 0!==r&&o.id!==i.id&&1<r.pointLength&&1<o.pointLength?(t=v(i),n=v(r),e=v(o)):e=void 0,{startVecotr:t,prevVecotr:n,activeVecotr:e}}}
309
304
 
310
- var x=r=>Math.sqrt(r.x*r.x+r.y*r.y),y=(r,a)=>r.x*a.x+r.y*a.y,e$1=(r,a)=>{var t=x(r)*x(a);if(0===t)return 0;var h=y(r,a)/t;return h>1&&(h=1),Math.acos(h)},n=(r,a)=>r.x*a.y-a.x*r.y,o=r=>r/Math.PI*180,s=(r,a)=>{var t=e$1(r,a);return n(r,a)>0&&(t*=-1),o(t)},u$1=(x,y)=>{if(0!==x||0!==y)return Math.abs(x)>=Math.abs(y)?0<x?i$3:a$2:0<y?d$1:r$4};
305
+ const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r$3(r,s){const c=O(m,s);let p,u,x$1,T=0;function f(){T=0,p=void 0,u=void 0;}return r.compute([h$2,M],(t=>{if(j(c))return;const{phase:i,x:o,y:m}=t;u$3===i&&(c.state=0,!function(){const{startInput:e,pointLength:n,timestamp:a}=t,i=a-e.timestamp,{distance:o,maxPointLength:m}=t;return m===c.pointLength&&0===n&&c.maxDistance>=o&&c.maxPressTime>i}()?(f(),c.state=2):(clearTimeout(x$1),function(t,e){if(void 0!==p){const n=x({x:t.x-p.x,y:t.y-p.y});return p=t,e.maxDistanceFromPrevTap>=n}return p=t,true}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,true;{const n=e-u;return u=e,n<t}}(c.waitNextTapTime)?T++:T=1,0==T%c.tapTimes?(c.state=1,r.emit2(c.name,t,c),f()):x$1=setTimeout((()=>{c.state=2,f();}),c.waitNextTapTime)));})),c}
311
306
 
312
- function p$1(){let n=0,e=0;return function(o,r){const{prevVecotr:i,startVecotr:a,activeVecotr:c}=r;return c&&(e=Math.round(s(c,i)),n=Math.round(s(c,a))),{angle:n,deltaAngle:e}}}function d(){return function(t){const{prevInput:e}=t;let o$1=0,r=0,i=0;if(void 0!==e&&(o$1=t.x-e.x,r=t.y-e.y,0!==o$1||0!==r)){const t=Math.sqrt(Math.pow(o$1,2)+Math.pow(r,2));i=Math.round(o(Math.acos(Math.abs(o$1)/t)));}return {deltaX:o$1,deltaY:r,deltaXYAngle:i}}}function h$1(){let t,n=0,u=0,s=0,p=0,d=0;return function(h){const{phase:l,startInput:f}=h;return c$3===l?(n=0,u=0,s=0,p=0,d=0):o$1===l&&(n=Math.round(h.points[0][n$1]-f.points[0][n$1]),u=Math.round(h.points[0][e$2]-f.points[0][e$2]),s=Math.abs(n),p=Math.abs(u),d=Math.round(x({x:s,y:p})),t=u$1(n,u)),{displacementX:n,displacementY:u,distanceX:s,distanceY:p,distance:d,overallDirection:t}}}function l(){let t=1;return function(n,o){let r=1;const{prevVecotr:i,startVecotr:a,activeVecotr:c}=o;return c&&(r=p$3(x(c)/x(i)),t=p$3(x(c)/x(a))),{scale:t,deltaScale:r}}}function f(){let t$1,n,e=0,r=0,i=0,a=0;return function(c){if(void 0!==c){n=n||c.startInput;const u=c.timestamp-n.timestamp;if(t<u){const s=c.x-n.x,p=c.y-n.y;i=Math.round(s/u*100)/100,a=Math.round(p/u*100)/100,e=Math.abs(i),r=Math.abs(a),t$1=u$1(s,p),n=c;}}return {velocityX:e,velocityY:r,speedX:i,speedY:a,direction:t$1}}}function M(){let t=0;return function(n){const{phase:e}=n;return c$3===e&&(t=n.pointLength),{maxPointLength:t}}}function v(t){return {x:t.points[1][n$1]-t.points[0][n$1],y:t.points[1][e$2]-t.points[0][e$2]}}function m$1(){let t,n,e;return function(o){const{prevInput:r,startMultiInput:i}=o;return void 0!==i&&void 0!==r&&o.id!==i.id&&1<r.pointLength&&1<o.pointLength?(t=v(i),n=v(r),e=v(o)):e=void 0,{startVecotr:t,prevVecotr:n,activeVecotr:e}}}
307
+ function e(e){e.use(r$3,{name:"doubletap",tapTimes:2});const a=e.get("doubletap");let o;return e.beforeEach(((t,e)=>{"tap"===t?(clearTimeout(o),o=setTimeout((()=>{[0,2].includes(a.state)&&e();}),300)):e();})),a}
313
308
 
314
- const m={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function r$2(r,s){const c=O(m,s);let p,u,x$1,T=0;function f(){T=0,p=void 0,u=void 0;}return r.compute([h$1,M],(t=>{if(j(c))return;const{phase:i,x:o,y:m}=t;u$3===i&&(c.state=0,!function(){const{startInput:e,pointLength:n,timestamp:a}=t,i=a-e.timestamp,{distance:o,maxPointLength:m}=t;return m===c.pointLength&&0===n&&c.maxDistance>=o&&c.maxPressTime>i}()?(f(),c.state=2):(clearTimeout(x$1),function(t,e){if(void 0!==p){const n=x({x:t.x-p.x,y:t.y-p.y});return p=t,e.maxDistanceFromPrevTap>=n}return p=t,true}({x:o,y:m},c)&&function(t){const e=performance.now();if(void 0===u)return u=e,true;{const n=e-u;return u=e,n<t}}(c.waitNextTapTime)?T++:T=1,0==T%c.tapTimes?(c.state=1,r.emit2(c.name,t,c),f()):x$1=setTimeout((()=>{c.state=2,f();}),c.waitNextTapTime)));})),c}
309
+ class t{constructor(){this.__map={};}beforeEach(t){this.__interceptor=t;}on(t,i){const s=Array.isArray(t)?t:[t];for(const t of s){this.__map[t]=this.__map[t]||[];const s=this.__map[t];s&&s.push(i);}return this}emit(t,i,s){ void 0!==this.__interceptor?this.__interceptor(t,(()=>{this.__emit(t,i),s&&s();})):(this.__emit(t,i),s&&s());}__emit(t,i){const s=this.__map[t];if(Array.isArray(s)&&(null==s?void 0:s.length))for(const _ of s)_(i,t);this.event=i;}off(t,i){const s=this.__map[t];if(void 0!==s)if(void 0===i)delete this.__map[t];else {const t=s.findIndex((t=>t===i));s.splice(t,1);}}destroy(){this.__map={};}}
315
310
 
316
- const p={name:"pan",threshold:10,pointLength:1};function u(u,d$1){const f$1=O(p,d$1);return u.compute([f,h$1,d],(t=>{if(g$1(f$1),j(f$1))return;const c=function(){const{pointLength:e,distance:n}=t;return f$1.pointLength===e&&f$1.threshold<=n}();if(f$1.state=b(c,f$1.state,t.phase),c||h$3(f$1.state)){const{name:e}=f$1;u.emit2(e,t,f$1),u.emit2(e+v$1(f$1.state),t,f$1),![u$3,s$1].includes(t.phase)&&t.direction&&u.emit2(e+t.direction,t,f$1);}})),f$1}
311
+ function r$2(){let t,o,i,r,a=0;return function(u){if(t=o,void 0!==u){a=Number.MAX_SAFE_INTEGER>a?++a:1;const h=function(t,o){const{phase:i,points:r,changedPoints:a,nativeEvent:u}=t,h=r.length,p=c$3===i,g=u$3===i&&0===h||s$1===i,l=Date.now(),{x:d,y:m}=c$2(r)||c$2(a),{currentTarget:v}=u;return Object.assign(t,{id:o,x:d,y:m,timestamp:l,isStart:p,isEnd:g,pointLength:h,currentTarget:v,getOffset(t=v){const e=t.getBoundingClientRect();return {x:d-Math.round(e.left),y:m-Math.round(e.top)}}})}(u,a);o=h;const{isStart:p,pointLength:g}=h;return p&&(i=h,t=void 0,r=1<g?h:void 0),Object.assign(Object.assign({},h),{prevInput:t,startMultiInput:r,startInput:i})}}}function c$2(t){const{length:e}=t;if(0<e){if(1===e){const{clientX:e,clientY:n}=t[0];return {x:Math.round(e),y:Math.round(n)}}const n=t.reduce(((t,e)=>(t.x+=e[n$1],t.y+=e[e$2],t)),{x:0,y:0});return {x:Math.round(n.x/e),y:Math.round(n.y/e)}}}function a$1(t,e,n,s){const o={};for(const t in n)["target","currentTarget","type"].includes(t)||(o[t]=n[t]);let i;return document.createEvent?(i=document.createEvent("HTMLEvents"),i.initEvent(t,null==s?void 0:s.bubbles,null==s?void 0:s.cancelable)):i=new Event(t,s),Object.assign(i,o,{match:()=>n.targets&&0<n.targets.length&&n.targets.every((t=>i.currentTarget.contains(t)))}),e.dispatchEvent(i)}function u$1(t,e){const{preventDefault:n}=e;return s=n,"[object Function]"===Object.prototype.toString.call(s)?n(t):!!n;var s;}const h$1=["touchstart","touchmove","touchend","touchcancel","mousedown"],p$1=["mousemove","mouseup"];const g={domEvents:{bubbles:true,cancelable:true},preventDefault:t=>{if(t.target&&"tagName"in t.target){const{tagName:e}=t.target;return !/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return false}};class l extends t{constructor(t,e){super(),this.v="2.1.3",this.__computeFunctionList=[],this.__computeFunctionCreatorList=[],this.__pluginContexts=[],this.__isIgnoreMouse=false,this.el=t,this.c={},this.__options=Object.assign(Object.assign({},g),e);const n=function(t){const e=r$2();return function(n){const s=[],o=[];Array.from(n.touches).forEach((({clientX:e,clientY:n,target:i})=>{(null==t?void 0:t.contains(i))&&(s.push(i),o.push({clientX:e,clientY:n,target:i}));}));const i=Array.from(n.changedTouches).map((({clientX:t,clientY:e,target:n})=>({clientX:t,clientY:e,target:n})));return e({phase:n.type.replace("touch",""),changedPoints:i,points:o,nativeEvent:n,target:n.target,targets:s})}}(this.el),s=function(){let t,e=false,n=null;const s=r$2();return function(o){const{clientX:i,clientY:r,type:c,button:a,target:u}=o;let h,p=[{clientX:i,clientY:r,target:u}];if("mousedown"===c&&0===a)n=u,e=true,h="start";else {if(!e)return;"mousemove"===c?h="move":"mouseup"===c&&(p=[],h="end",e=false);}const g=t||[{clientX:i,clientY:r,target:u}];if(t=[{clientX:i,clientY:r,target:u}],void 0!==h)return s({phase:h,changedPoints:g,points:p,target:n,targets:[n],nativeEvent:o})}}();if(this.__inputCreatorMap={touchstart:n,touchmove:n,touchend:n,touchcancel:n,mousedown:s,mousemove:s,mouseup:s},this.on("at:after",(t=>{const{target:e,__type:n}=t,{domEvents:s}=this.__options;s&&void 0!==this.el&&e&&(a$1(n,e,t,s),a$1("at:after",e,t,s));})),void 0!==t){t.style.webkitTapHighlightColor="rgba(0,0,0,0)";let e=false;try{const t={};Object.defineProperty(t,"passive",{get(){e=!0;}}),window.addEventListener("_",(()=>{}),t);}catch(t){}this.on("u",function(t,e,n){return h$1.forEach((s=>{t.addEventListener(s,e,n);})),p$1.forEach((t=>{window.addEventListener(t,e,n);})),()=>{h$1.forEach((n=>{t.removeEventListener(n,e);})),p$1.forEach((t=>{window.removeEventListener(t,e);}));}}(t,this.catchEvent.bind(this),false===this.__options.preventDefault&&e?{passive:true}:{passive:false}));}}use(t,e){this.__pluginContexts.push(t(this,e));}catchEvent(t){const e=this.__inputCreatorMap[t.type](t);if(void 0!==e){const n=()=>t.stopPropagation(),s=()=>t.stopImmediatePropagation(),o=()=>t.preventDefault();if(u$1(t,this.__options))o();else if("touchstart"===t.type?this.__isIgnoreMouse=true:"touchmove"===t.type&&(this.__isIgnoreMouse=false),this.__isIgnoreMouse&&t.type.startsWith("mouse"))return void("mouseup"===t.type&&(this.__isIgnoreMouse=false));this.emit("input",e),this.emit2(`at:${e.phase}`,e,{});const i={};this.__computeFunctionList.forEach((t=>{const n=t(e,i);if(void 0!==n)for(const t in n)i[t]=n[t];})),this.emit("computed",Object.assign(Object.assign(Object.assign({},e),i),{stopPropagation:n,stopImmediatePropagation:s,preventDefault:o}));}}compute(t,e){for(const e of t)this.__computeFunctionCreatorList.includes(e)||(this.__computeFunctionCreatorList.push(e),this.__computeFunctionList.push(e()));this.on("computed",e);}beforeEach(t){super.beforeEach(((e,n)=>{var s;(null===(s=this.c)||void 0===s?void 0:s.name)?t(e,n):n();}));}get(t){return this.__pluginContexts.find((e=>t===e.name))}set(t){this.__options=Object.assign(Object.assign({},this.__options),t);}emit2(t,e,n){this.c=n,this.emit(t,Object.assign(Object.assign({},e),{type:t}),(()=>{this.emit("at:after",Object.assign(Object.assign({},e),{name:t,__type:t}));}));}destroy(){this.emit("u"),super.destroy();}}
317
312
 
318
- const c$1={name:"swipe",threshold:10,velocity:.3,pointLength:1};function a(a,r){const s=O(c$1,r);return a.compute([h$1,f,M],(t=>{if(s.state=0,!s.disabled&&function(){if(u$3!==t.phase)return false;const{velocityX:o,velocityY:n,distance:i,maxPointLength:c}=t;return c===s.pointLength&&0===t.points.length&&s.threshold<i&&s.velocity<Math.max(o,n)}()){const{name:e}=s;s.state=1,a.emit2(e,t,s),a.emit2(e+t.direction,t,s);}})),s}
313
+ const p={name:"pan",threshold:10,pointLength:1};function u(u,d$1){const f$1=O(p,d$1);return u.compute([f,h$2,d],(t=>{if(g$1(f$1),j(f$1))return;const c=function(){const{pointLength:e,distance:n}=t;return f$1.pointLength===e&&f$1.threshold<=n}();if(f$1.state=b(c,f$1.state,t.phase),c||h$3(f$1.state)){const{name:e}=f$1;u.emit2(e,t,f$1),u.emit2(e+v$1(f$1.state),t,f$1),![u$3,s$1].includes(t.phase)&&t.direction&&u.emit2(e+t.direction,t,f$1);}})),f$1}
319
314
 
320
- const r$1={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function c(c,u){const p=O(r$1,u);let f=0;return c.compute([h$1],(t=>{if(j(p))return;const{phase:o,startInput:r,pointLength:u}=t;if(c$3===o&&p.pointLength===u)g$1(p),clearTimeout(f),f=setTimeout((()=>{p.state=1,c.emit2(p.name,t,p);}),p.minPressTime);else if(u$3===o&&1===p.state)c.emit2(`${p.name}${r$4}`,t,p);else if(1!==p.state){const e=t.timestamp-r.timestamp;(!function(){const{distance:e}=t;return e&&p.maxDistance>e}()||p.minPressTime>e&&[u$3,s$1].includes(o))&&(clearTimeout(f),p.state=2);}})),p}
315
+ const c$1={name:"swipe",threshold:10,velocity:.3,pointLength:1};function a(a,r){const s=O(c$1,r);return a.compute([h$2,f,M],(t=>{if(s.state=0,!s.disabled&&function(){if(u$3!==t.phase)return false;const{velocityX:o,velocityY:n,distance:i,maxPointLength:c}=t;return c===s.pointLength&&0===t.points.length&&s.threshold<i&&s.velocity<Math.max(o,n)}()){const{name:e}=s;s.state=1,a.emit2(e,t,s),a.emit2(e+t.direction,t,s);}})),s}
321
316
 
322
- const i$2={name:"pinch",threshold:0,pointLength:2};function r(r,m){const p=O(i$2,m);return r.compute([m$1,l],(t=>{if(g$1(p),j(p))return;const c=function(){const{pointLength:e,scale:n,deltaScale:o,phase:a}=t;return p.pointLength===e&&p.threshold<Math.abs(n-1)}();p.state=b(c,p.state,t.phase);const{name:h}=p;if(c||h$3(p.state)){r.emit2(h,t,p);const{deltaScale:e}=t;1!==e&&r.emit2(h+(1<e?"in":"out"),t,p);}const i=v$1(p.state);i&&r.emit2(h+i,t,p);})),p}
317
+ const r$1={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function c(c,u){const p=O(r$1,u);let f=0;return c.compute([h$2],(t=>{if(j(p))return;const{phase:o,startInput:r,pointLength:u}=t;if(c$3===o&&p.pointLength===u)g$1(p),clearTimeout(f),f=setTimeout((()=>{p.state=1,c.emit2(p.name,t,p);}),p.minPressTime);else if(u$3===o&&1===p.state)c.emit2(`${p.name}${r$4}`,t,p);else if(1!==p.state){const e=t.timestamp-r.timestamp;(!function(){const{distance:e}=t;return e&&p.maxDistance>e}()||p.minPressTime>e&&[u$3,s$1].includes(o))&&(clearTimeout(f),p.state=2);}})),p}
323
318
 
324
- const h={name:"rotate",threshold:0,pointLength:2};function i$1(i,m){const u=O(h,m);return i.compute([m$1,p$1],(t=>{if(j(u))return;g$1(u);const r=function(){const{pointLength:e,angle:n}=t;return u.pointLength===e&&u.threshold<Math.abs(n)}();u.state=b(r,u.state,t.phase);const{name:c}=u;(r||h$3(u.state))&&i.emit2(c,t,u);const h=v$1(u.state);h&&i.emit2(c+h,t,u);})),u}
319
+ const i$2={name:"pinch",threshold:0,pointLength:2};function r(r,m){const p=O(i$2,m);return r.compute([m$1,l$1],(t=>{if(g$1(p),j(p))return;const c=function(){const{pointLength:e,scale:n,deltaScale:o,phase:a}=t;return p.pointLength===e&&p.threshold<Math.abs(n-1)}();p.state=b(c,p.state,t.phase);const{name:h}=p;if(c||h$3(p.state)){r.emit2(h,t,p);const{deltaScale:e}=t;1!==e&&r.emit2(h+(1<e?"in":"out"),t,p);}const i=v$1(p.state);i&&r.emit2(h+i,t,p);})),p}
325
320
 
326
- function e(e){e.use(r$2,{name:"doubletap",tapTimes:2});const a=e.get("doubletap");let o;return e.beforeEach(((t,e)=>{"tap"===t?(clearTimeout(o),o=setTimeout((()=>{[0,2].includes(a.state)&&e();}),300)):e();})),a}
321
+ const h={name:"rotate",threshold:0,pointLength:2};function i$1(i,m){const u=O(h,m);return i.compute([m$1,p$2],(t=>{if(j(u))return;g$1(u);const r=function(){const{pointLength:e,angle:n}=t;return u.pointLength===e&&u.threshold<Math.abs(n)}();u.state=b(r,u.state,t.phase);const{name:c}=u;(r||h$3(u.state))&&i.emit2(c,t,u);const h=v$1(u.state);h&&i.emit2(c+h,t,u);})),u}
327
322
 
328
- class i extends l$1{constructor(t,u$1){super(t,u$1),this.use(r$2),this.use(u),this.use(a),this.use(c),this.use(r),this.use(i$1);}}i.STATE_POSSIBLE=0,i.STATE_START=4,i.STATE_MOVE=5,i.STATE_END=1,i.STATE_CANCELLED=3,i.STATE_FAILED=2,i.STATE_RECOGNIZED=1,i.tap=r$2,i.pan=u,i.swipe=a,i.press=c,i.rotate=i$1,i.pinch=r,i.doubletap=e;
323
+ class i extends l{constructor(t,u$1){super(t,u$1),this.use(r$3),this.use(u),this.use(a),this.use(c),this.use(r),this.use(i$1);}}i.STATE_POSSIBLE=0,i.STATE_START=4,i.STATE_MOVE=5,i.STATE_END=1,i.STATE_CANCELLED=3,i.STATE_FAILED=2,i.STATE_RECOGNIZED=1,i.tap=r$3,i.pan=u,i.swipe=a,i.press=c,i.rotate=i$1,i.pinch=r,i.doubletap=e;
329
324
 
330
325
  class PopsUtils {
331
326
  /**
@@ -812,6 +807,10 @@ System.register('pops', [], (function (exports) {
812
807
  textIsDisabledImportant: "pops-text-is-disabled-important",
813
808
  };
814
809
 
810
+ /**
811
+ * 存储在元素属性上的事件名
812
+ */
813
+ const SymbolEvents = Symbol("events_" + (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1));
815
814
  class PopsDOMUtilsEvent {
816
815
  on(element, eventType, selector, callback, option) {
817
816
  /**
@@ -820,7 +819,7 @@ System.register('pops', [], (function (exports) {
820
819
  * @param startIndex
821
820
  * @param option
822
821
  */
823
- function getOption(args, startIndex, option) {
822
+ const getOption = function (args, startIndex, option) {
824
823
  const currentParam = args[startIndex];
825
824
  if (typeof currentParam === "boolean") {
826
825
  option.capture = currentParam;
@@ -842,7 +841,7 @@ System.register('pops', [], (function (exports) {
842
841
  option.isComposedPath = currentParam.isComposedPath;
843
842
  }
844
843
  return option;
845
- }
844
+ };
846
845
  const that = this;
847
846
  // eslint-disable-next-line prefer-rest-params
848
847
  const args = arguments;
@@ -857,8 +856,7 @@ System.register('pops', [], (function (exports) {
857
856
  }
858
857
  let $elList = [];
859
858
  if (element instanceof NodeList || Array.isArray(element)) {
860
- element = element;
861
- $elList = [...element];
859
+ $elList = $elList.concat(Array.from(element));
862
860
  }
863
861
  else {
864
862
  $elList.push(element);
@@ -866,15 +864,15 @@ System.register('pops', [], (function (exports) {
866
864
  // 事件名
867
865
  let eventTypeList = [];
868
866
  if (Array.isArray(eventType)) {
869
- eventTypeList = eventTypeList.concat(eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== ""));
867
+ eventTypeList = eventTypeList.concat(eventType.filter((it) => typeof it === "string" && it.toString() !== ""));
870
868
  }
871
869
  else if (typeof eventType === "string") {
872
- eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
870
+ eventTypeList = eventTypeList.concat(eventType.split(" ").filter((it) => it !== ""));
873
871
  }
874
872
  // 子元素选择器
875
873
  let selectorList = [];
876
874
  if (Array.isArray(selector)) {
877
- selectorList = selectorList.concat(selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== ""));
875
+ selectorList = selectorList.concat(selector.filter((it) => typeof it === "string" && it.toString() !== ""));
878
876
  }
879
877
  else if (typeof selector === "string") {
880
878
  selectorList.push(selector);
@@ -901,39 +899,52 @@ System.register('pops', [], (function (exports) {
901
899
  /**
902
900
  * 如果是once,那么删除该监听和元素上的事件和监听
903
901
  */
904
- function checkOptionOnceToRemoveEventListener() {
902
+ const checkOptionOnceToRemoveEventListener = ($el) => {
905
903
  if (listenerOption.once) {
906
- that.off(element, eventType, selector, callback, option);
904
+ this.off($el, eventTypeList, selector, callback, option);
907
905
  }
908
- }
909
- $elList.forEach((elementItem) => {
906
+ };
907
+ $elList.forEach(($elItem) => {
910
908
  /**
911
909
  * 事件回调
912
910
  * @param event
913
911
  */
914
- function domUtilsEventCallBack(event) {
912
+ const handlerCallBack = function (event) {
913
+ let call_this = void 0;
914
+ let call_event = void 0;
915
+ let call_$selector = void 0;
916
+ let execCallback = false;
915
917
  if (selectorList.length) {
916
918
  // 存在子元素选择器
917
919
  // 这时候的this和target都是子元素选择器的元素
918
- let eventTarget = listenerOption.isComposedPath
919
- ? event.composedPath()[0]
920
- : event.target;
921
- let totalParent = elementItem;
922
- if (popsUtils.isWin(totalParent)) {
923
- if (totalParent === PopsCore.document) {
924
- totalParent = PopsCore.document.documentElement;
920
+ let $target;
921
+ if (listenerOption.isComposedPath) {
922
+ // 可能为空
923
+ const composedPath = event.composedPath();
924
+ if (!composedPath.length && event.target) {
925
+ composedPath.push(event.target);
925
926
  }
927
+ $target = composedPath[0];
928
+ }
929
+ else {
930
+ $target = event.target;
931
+ }
932
+ let $parent = $elItem;
933
+ if (popsUtils.isWin($parent)) {
934
+ // window和document共用一个对象
935
+ // 这样就能处理子元素选择器无法匹配的问题
936
+ $parent = PopsCore.document.documentElement;
926
937
  }
927
- const findValue = selectorList.find((selectorItem) => {
938
+ const findValue = selectorList.find((selectors) => {
928
939
  // 判断目标元素是否匹配选择器
929
- if (that.matches(eventTarget, selectorItem)) {
940
+ if (that.matches($target, selectors)) {
930
941
  // 当前目标可以被selector所匹配到
931
942
  return true;
932
943
  }
933
944
  // 在上层与主元素之间寻找可以被selector所匹配到的
934
- const $closestMatches = that.closest(eventTarget, selectorItem);
935
- if ($closestMatches && totalParent?.contains($closestMatches)) {
936
- eventTarget = $closestMatches;
945
+ const $closestMatches = that.closest($target, selectors);
946
+ if ($closestMatches && $parent?.contains?.($closestMatches)) {
947
+ $target = $closestMatches;
937
948
  return true;
938
949
  }
939
950
  return false;
@@ -943,38 +954,47 @@ System.register('pops', [], (function (exports) {
943
954
  try {
944
955
  OriginPrototype.Object.defineProperty(event, "target", {
945
956
  get() {
946
- return eventTarget;
957
+ return $target;
947
958
  },
948
959
  });
960
+ // oxlint-disable-next-line no-empty
949
961
  }
950
- catch {
951
- // 忽略
952
- }
953
- listenerCallBack.call(eventTarget, event, eventTarget);
954
- checkOptionOnceToRemoveEventListener();
962
+ catch { }
963
+ execCallback = true;
964
+ call_this = $target;
965
+ call_event = event;
966
+ call_$selector = $target;
955
967
  }
956
968
  }
957
969
  else {
958
- // 这时候的this指向监听的元素
959
- listenerCallBack.call(elementItem, event);
960
- checkOptionOnceToRemoveEventListener();
970
+ execCallback = true;
971
+ call_this = $elItem;
972
+ call_event = event;
973
+ }
974
+ if (execCallback) {
975
+ const result = listenerCallBack.call(call_this, call_event, call_$selector);
976
+ checkOptionOnceToRemoveEventListener($elItem);
977
+ if (typeof result === "boolean" && !result) {
978
+ return false;
979
+ }
961
980
  }
962
- }
981
+ };
963
982
  // 遍历事件名设置元素事件
964
983
  eventTypeList.forEach((eventName) => {
965
- elementItem.addEventListener(eventName, domUtilsEventCallBack, listenerOption);
984
+ // add listener
985
+ $elItem.addEventListener(eventName, handlerCallBack, listenerOption);
966
986
  // 获取对象上的事件
967
- const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
987
+ const elementEvents = Reflect.get($elItem, SymbolEvents) || {};
968
988
  // 初始化对象上的xx事件
969
989
  elementEvents[eventName] = elementEvents[eventName] || [];
970
990
  elementEvents[eventName].push({
971
991
  selector: selectorList,
972
992
  option: listenerOption,
973
- callback: domUtilsEventCallBack,
974
- originCallBack: listenerCallBack,
993
+ handlerCallBack: handlerCallBack,
994
+ callback: listenerCallBack,
975
995
  });
976
996
  // 覆盖事件
977
- Reflect.set(elementItem, SymbolEvents, elementEvents);
997
+ Reflect.set($elItem, SymbolEvents, elementEvents);
978
998
  });
979
999
  });
980
1000
  return {
@@ -987,11 +1007,11 @@ System.register('pops', [], (function (exports) {
987
1007
  },
988
1008
  /**
989
1009
  * 主动触发事件
990
- * @param details 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
991
- * @param useDispatchToEmit 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了selectorTarget的没有值
1010
+ * @param extraDetails 赋予触发的Event的额外属性,如果是Event类型,那么将自动代替默认new的Event对象
1011
+ * @param useDispatchToTriggerEvent 是否使用dispatchEvent来触发事件,默认true,如果为false,则直接调用callback,但是这种会让使用了`$selector`的没有值
992
1012
  */
993
- emit: (details, useDispatchToEmit) => {
994
- that.emit($elList, eventTypeList, details, useDispatchToEmit);
1013
+ emit: (extraDetails, useDispatchToTriggerEvent) => {
1014
+ that.emit($elList, eventTypeList, extraDetails, useDispatchToTriggerEvent);
995
1015
  },
996
1016
  };
997
1017
  }
@@ -1002,7 +1022,7 @@ System.register('pops', [], (function (exports) {
1002
1022
  * @param startIndex
1003
1023
  * @param option
1004
1024
  */
1005
- function getOption(args1, startIndex, option) {
1025
+ const getOption = function (args1, startIndex, option) {
1006
1026
  const currentParam = args1[startIndex];
1007
1027
  if (typeof currentParam === "boolean") {
1008
1028
  option.capture = currentParam;
@@ -1011,12 +1031,12 @@ System.register('pops', [], (function (exports) {
1011
1031
  option.capture = currentParam.capture;
1012
1032
  }
1013
1033
  return option;
1014
- }
1015
- const DOMUtilsContext = this;
1034
+ };
1035
+ const that = this;
1016
1036
  // eslint-disable-next-line prefer-rest-params
1017
1037
  const args = arguments;
1018
1038
  if (typeof element === "string") {
1019
- element = DOMUtilsContext.selectorAll(element);
1039
+ element = that.selectorAll(element);
1020
1040
  }
1021
1041
  if (element == null) {
1022
1042
  return;
@@ -1024,22 +1044,22 @@ System.register('pops', [], (function (exports) {
1024
1044
  let $elList = [];
1025
1045
  if (element instanceof NodeList || Array.isArray(element)) {
1026
1046
  element = element;
1027
- $elList = $elList.concat(element);
1047
+ $elList = $elList.concat(Array.from(element));
1028
1048
  }
1029
1049
  else {
1030
1050
  $elList.push(element);
1031
1051
  }
1032
1052
  let eventTypeList = [];
1033
1053
  if (Array.isArray(eventType)) {
1034
- eventTypeList = eventTypeList.concat(eventType.filter((eventTypeItem) => typeof eventTypeItem === "string" && eventTypeItem.toString() !== ""));
1054
+ eventTypeList = eventTypeList.concat(eventType.filter((it) => typeof it === "string" && it.toString() !== ""));
1035
1055
  }
1036
1056
  else if (typeof eventType === "string") {
1037
- eventTypeList = eventTypeList.concat(eventType.split(" ").filter((eventTypeItem) => eventTypeItem !== ""));
1057
+ eventTypeList = eventTypeList.concat(eventType.split(" ").filter((it) => it !== ""));
1038
1058
  }
1039
1059
  // 子元素选择器
1040
1060
  let selectorList = [];
1041
1061
  if (Array.isArray(selector)) {
1042
- selectorList = selectorList.concat(selector.filter((selectorItem) => typeof selectorItem === "string" && selectorItem.toString() !== ""));
1062
+ selectorList = selectorList.concat(selector.filter((it) => typeof it === "string" && it.toString() !== ""));
1043
1063
  }
1044
1064
  else if (typeof selector === "string") {
1045
1065
  selectorList.push(selector);
@@ -1068,16 +1088,16 @@ System.register('pops', [], (function (exports) {
1068
1088
  // 目标函数、事件名、回调函数、事件配置、过滤函数
1069
1089
  filter = option;
1070
1090
  }
1071
- $elList.forEach((elementItem) => {
1091
+ $elList.forEach(($elItem) => {
1072
1092
  // 获取对象上的事件
1073
- const elementEvents = Reflect.get(elementItem, SymbolEvents) || {};
1093
+ const elementEvents = Reflect.get($elItem, SymbolEvents) || {};
1074
1094
  eventTypeList.forEach((eventName) => {
1075
1095
  const handlers = elementEvents[eventName] || [];
1076
1096
  const filterHandler = typeof filter === "function" ? handlers.filter(filter) : handlers;
1077
1097
  for (let index = 0; index < filterHandler.length; index++) {
1078
1098
  const handler = filterHandler[index];
1079
1099
  let flag = true;
1080
- if (flag && listenerCallBack && handler.originCallBack !== listenerCallBack) {
1100
+ if (flag && listenerCallBack && handler.callback !== listenerCallBack) {
1081
1101
  // callback不同
1082
1102
  flag = false;
1083
1103
  }
@@ -1094,7 +1114,7 @@ System.register('pops', [], (function (exports) {
1094
1114
  flag = false;
1095
1115
  }
1096
1116
  if (flag) {
1097
- elementItem.removeEventListener(eventName, handler.callback, handler.option);
1117
+ $elItem.removeEventListener(eventName, handler.handlerCallBack, handler.option);
1098
1118
  const findIndex = handlers.findIndex((item) => item === handler);
1099
1119
  if (findIndex !== -1) {
1100
1120
  handlers.splice(findIndex, 1);
@@ -1106,7 +1126,7 @@ System.register('pops', [], (function (exports) {
1106
1126
  popsUtils.delete(elementEvents, eventType);
1107
1127
  }
1108
1128
  });
1109
- Reflect.set(elementItem, SymbolEvents, elementEvents);
1129
+ Reflect.set($elItem, SymbolEvents, elementEvents);
1110
1130
  });
1111
1131
  }
1112
1132
  /**
@@ -1490,11 +1510,11 @@ System.register('pops', [], (function (exports) {
1490
1510
  * 阻止事件的默认行为发生,并阻止事件传播
1491
1511
  */
1492
1512
  const stopEvent = (event, onlyStopPropagation) => {
1513
+ // 停止事件的传播,阻止它继续向更上层的元素冒泡,事件将不会再传播给其他的元素
1514
+ event?.stopPropagation();
1515
+ // 阻止事件传播,并且还能阻止元素上的其他事件处理程序被触发
1516
+ event?.stopImmediatePropagation();
1493
1517
  if (typeof onlyStopPropagation === "boolean" && onlyStopPropagation) {
1494
- // 停止事件的传播,阻止它继续向更上层的元素冒泡,事件将不会再传播给其他的元素
1495
- event?.stopPropagation();
1496
- // 阻止事件传播,并且还能阻止元素上的其他事件处理程序被触发
1497
- event?.stopImmediatePropagation();
1498
1518
  return;
1499
1519
  }
1500
1520
  // 阻止事件的默认行为发生。例如,当点击一个链接时,浏览器会默认打开链接的URL,或者在输入框内输入文字
@@ -1710,35 +1730,6 @@ System.register('pops', [], (function (exports) {
1710
1730
  getTransitionEndNameList() {
1711
1731
  return ["webkitTransitionEnd", "mozTransitionEnd", "MSTransitionEnd", "otransitionend", "transitionend"];
1712
1732
  }
1713
- /**
1714
- * 是否是隐藏状态
1715
- *
1716
- * 检测以下项:
1717
- *
1718
- * + `display`: none
1719
- * + `visibility`: hidden
1720
- * + `opacity`: 0
1721
- * + `使用了pops的自定义的隐藏class类`
1722
- * @param $el 需要检测的元素
1723
- */
1724
- isHide($el) {
1725
- let flag = false;
1726
- if (this.containsClassName($el, PopsCommonCSSClassName.hide) ||
1727
- this.containsClassName($el, PopsCommonCSSClassName.hideImportant)) {
1728
- flag = true;
1729
- }
1730
- else {
1731
- if ($el instanceof HTMLElement) {
1732
- const style = $el.style;
1733
- flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1734
- }
1735
- if (!flag) {
1736
- const style = globalThis.getComputedStyle($el);
1737
- flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
1738
- }
1739
- }
1740
- return flag;
1741
- }
1742
1733
  /**
1743
1734
  * 实现jQuery中的$().offset();
1744
1735
  * @param element
@@ -3185,6 +3176,134 @@ System.register('pops', [], (function (exports) {
3185
3176
  tooltip: [],
3186
3177
  };
3187
3178
 
3179
+ const PopsInstanceUtils = {
3180
+ /**
3181
+ * 获取pops所有弹窗中的最大的z-index
3182
+ * @param deviation
3183
+ */
3184
+ getPopsMaxZIndex(deviation = 1) {
3185
+ deviation = Number.isNaN(deviation) ? 1 : deviation;
3186
+ // 最大值 2147483647
3187
+ // const browserMaxZIndex = Math.pow(2, 31) - 1;
3188
+ // 比较值 2000000000
3189
+ const maxZIndex = 2 * Math.pow(10, 9);
3190
+ // 当前页面最大的z-index
3191
+ let zIndex = 0;
3192
+ // 当前的最大z-index的元素,调试使用
3193
+ let maxZIndexNode = null;
3194
+ Object.keys(PopsInstData).forEach((instKeyName) => {
3195
+ const instData = PopsInstData[instKeyName];
3196
+ for (let index = 0; index < instData.length; index++) {
3197
+ const inst = instData[index];
3198
+ // 不对position为static和display为none的元素进行获取它们的z-index
3199
+ const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
3200
+ const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
3201
+ const maxNodeZIndexInfo = nodeZIndexInfoList[0];
3202
+ if (maxNodeZIndexInfo) {
3203
+ const nodeZIndex = maxNodeZIndexInfo.zIndex;
3204
+ if (nodeZIndex > zIndex) {
3205
+ zIndex = nodeZIndex;
3206
+ maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
3207
+ }
3208
+ }
3209
+ }
3210
+ });
3211
+ zIndex += deviation;
3212
+ const isOverMaxZIndex = zIndex >= maxZIndex;
3213
+ if (isOverMaxZIndex) {
3214
+ // 超出z-index最大值
3215
+ zIndex = maxZIndex;
3216
+ }
3217
+ return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
3218
+ },
3219
+ /**
3220
+ * 排序数组
3221
+ * @param getBeforeValueFun
3222
+ * @param getAfterValueFun
3223
+ * @param sortByDesc 排序是否降序,默认降序
3224
+ */
3225
+ sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
3226
+ if (typeof sortByDesc !== "boolean") {
3227
+ throw new TypeError("参数 sortByDesc 必须为boolean类型");
3228
+ }
3229
+ if (getBeforeValueFun == null || getAfterValueFun == null) {
3230
+ throw new Error("获取前面的值或后面的值的方法不能为空");
3231
+ }
3232
+ return function (after_obj, before_obj) {
3233
+ const beforeValue = getBeforeValueFun(before_obj); // 前
3234
+ const afterValue = getAfterValueFun(after_obj); // 后
3235
+ if (sortByDesc) {
3236
+ if (afterValue > beforeValue) {
3237
+ return -1;
3238
+ }
3239
+ else if (afterValue < beforeValue) {
3240
+ return 1;
3241
+ }
3242
+ else {
3243
+ return 0;
3244
+ }
3245
+ }
3246
+ else {
3247
+ if (afterValue < beforeValue) {
3248
+ return -1;
3249
+ }
3250
+ else if (afterValue > beforeValue) {
3251
+ return 1;
3252
+ }
3253
+ else {
3254
+ return 0;
3255
+ }
3256
+ }
3257
+ };
3258
+ },
3259
+ /**
3260
+ * 是否是隐藏状态
3261
+ *
3262
+ * 检测以下项:
3263
+ *
3264
+ * + `display`: none
3265
+ * + `visibility`: hidden
3266
+ * + `opacity`: 0
3267
+ * + `使用了pops的自定义的隐藏class类`
3268
+ * @param $el 需要检测的元素
3269
+ */
3270
+ isHide($el) {
3271
+ let flag = false;
3272
+ if ($el?.classList?.contains(PopsCommonCSSClassName.hide) ||
3273
+ $el?.classList?.contains(PopsCommonCSSClassName.hideImportant)) {
3274
+ flag = true;
3275
+ }
3276
+ else {
3277
+ if ($el instanceof HTMLElement) {
3278
+ const style = $el.style;
3279
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
3280
+ }
3281
+ if (!flag) {
3282
+ const style = globalThis.getComputedStyle($el);
3283
+ flag = style.display.includes("none") || style.visibility.includes("hidden") || style.opacity !== "0";
3284
+ }
3285
+ }
3286
+ return flag;
3287
+ },
3288
+ /**
3289
+ * 判断元素是否是在`.pops`内
3290
+ * @param $el 目标元素
3291
+ */
3292
+ isNodeInPopsNode($el) {
3293
+ return !!($el.closest(".pops") || $el.matches(".pops"));
3294
+ },
3295
+ /**
3296
+ * 判断是否是`.pops-anim`元素
3297
+ * @param $el 目标元素
3298
+ */
3299
+ isAnimNode($el) {
3300
+ return !!($el?.localName?.toLowerCase() === "div" &&
3301
+ $el.className &&
3302
+ $el.className === "pops-anim" &&
3303
+ $el.hasAttribute("anim"));
3304
+ },
3305
+ };
3306
+
3188
3307
  const PopsInstHandler = {
3189
3308
  /**
3190
3309
  * 删除配置中对应的对象
@@ -3265,7 +3384,7 @@ System.register('pops', [], (function (exports) {
3265
3384
  // 先设置好动画状态
3266
3385
  // 再显示,会自执行动画
3267
3386
  const checkVisible = () => {
3268
- if (!popsDOMUtils.isHide($anim)) {
3387
+ if (!PopsInstanceUtils.isHide($anim)) {
3269
3388
  return true;
3270
3389
  }
3271
3390
  else {
@@ -3355,7 +3474,7 @@ System.register('pops', [], (function (exports) {
3355
3474
  // 再隐藏
3356
3475
  // 存在实例
3357
3476
  const checkVisible = () => {
3358
- if (!popsDOMUtils.isHide($anim)) {
3477
+ if (!PopsInstanceUtils.isHide($anim)) {
3359
3478
  return true;
3360
3479
  }
3361
3480
  else {
@@ -3783,11 +3902,11 @@ System.register('pops', [], (function (exports) {
3783
3902
  * 点击其它区域的事件
3784
3903
  * @param event
3785
3904
  */
3786
- function clickEvent(event) {
3905
+ const clickEvent = (event) => {
3787
3906
  popsDOMUtils.preventEvent(event);
3788
3907
  // 获取该类型实例存储列表
3789
3908
  const targetInst = PopsInstData[config.type];
3790
- function originalRun() {
3909
+ const continueExec = () => {
3791
3910
  if (config.config.mask.clickEvent.toClose) {
3792
3911
  // 关闭
3793
3912
  return PopsInstHandler.close(config.config, config.type, targetInst, config.guid, config.animElement);
@@ -3796,37 +3915,26 @@ System.register('pops', [], (function (exports) {
3796
3915
  // 隐藏
3797
3916
  return PopsInstHandler.hide(config.config, config.type, targetInst, config.guid, config.animElement, result.maskElement);
3798
3917
  }
3799
- }
3918
+ };
3800
3919
  if (typeof config.config.mask.clickCallBack === "function") {
3801
- config.config.mask.clickCallBack(originalRun, config.config);
3920
+ config.config.mask.clickCallBack(continueExec, config.config);
3802
3921
  }
3803
3922
  else {
3804
- originalRun();
3923
+ continueExec();
3805
3924
  }
3806
3925
  return false;
3807
- }
3926
+ };
3808
3927
  // 判断是否启用了遮罩层点击动作
3809
3928
  if (config.config.mask.clickEvent.toClose || config.config.mask.clickEvent.toHide) {
3810
- /**
3811
- * 判断点击的元素是否是动画层的元素
3812
- * @param element
3813
- * @returns
3814
- */
3815
- function isAnimElement(element) {
3816
- return Boolean(element?.localName?.toLowerCase() === "div" &&
3817
- element.className &&
3818
- element.className === "pops-anim" &&
3819
- element.hasAttribute("anim"));
3820
- }
3821
3929
  // 判断按下的元素是否是pops-anim
3822
3930
  popsDOMUtils.on(config.animElement, "pointerup", (event) => {
3823
3931
  const $click = event.composedPath()[0];
3824
- isMaskClick = isAnimElement($click);
3932
+ isMaskClick = PopsInstanceUtils.isAnimNode($click);
3825
3933
  });
3826
3934
  // 如果有动画层,在动画层上监听点击事件
3827
3935
  popsDOMUtils.on(config.animElement, "click", (event) => {
3828
3936
  const $click = event.composedPath()[0];
3829
- if (isMaskClick && isAnimElement($click)) {
3937
+ if (isMaskClick && PopsInstanceUtils.isAnimNode($click)) {
3830
3938
  return clickEvent(event);
3831
3939
  }
3832
3940
  });
@@ -9732,12 +9840,12 @@ System.register('pops', [], (function (exports) {
9732
9840
  },
9733
9841
  mask: {
9734
9842
  enable: true,
9735
- clickCallBack(originalRun) {
9843
+ clickCallBack(continueExec) {
9736
9844
  const ret = dialogCloseCallback();
9737
9845
  if (typeof ret === "boolean" && !ret) {
9738
9846
  return;
9739
9847
  }
9740
- originalRun();
9848
+ continueExec();
9741
9849
  },
9742
9850
  clickEvent: {
9743
9851
  toClose: true,
@@ -10949,8 +11057,8 @@ System.register('pops', [], (function (exports) {
10949
11057
  },
10950
11058
  mask: {
10951
11059
  enable: true,
10952
- clickCallBack(originalRun) {
10953
- originalRun();
11060
+ clickCallBack(continueExec) {
11061
+ continueExec();
10954
11062
  dialogCloseCallback();
10955
11063
  },
10956
11064
  clickEvent: {
@@ -13595,93 +13703,12 @@ System.register('pops', [], (function (exports) {
13595
13703
  },
13596
13704
  };
13597
13705
 
13598
- const PopsInstanceUtils = {
13599
- /**
13600
- * 获取pops所有弹窗中的最大的z-index
13601
- * @param deviation
13602
- */
13603
- getPopsMaxZIndex(deviation = 1) {
13604
- deviation = Number.isNaN(deviation) ? 1 : deviation;
13605
- // 最大值 2147483647
13606
- // const browserMaxZIndex = Math.pow(2, 31) - 1;
13607
- // 比较值 2000000000
13608
- const maxZIndex = 2 * Math.pow(10, 9);
13609
- // 当前页面最大的z-index
13610
- let zIndex = 0;
13611
- // 当前的最大z-index的元素,调试使用
13612
- let maxZIndexNode = null;
13613
- Object.keys(PopsInstData).forEach((instKeyName) => {
13614
- const instData = PopsInstData[instKeyName];
13615
- for (let index = 0; index < instData.length; index++) {
13616
- const inst = instData[index];
13617
- // 不对position为static和display为none的元素进行获取它们的z-index
13618
- const $elList = [inst.$anim, inst.$pops, inst.$mask].filter((it) => it instanceof HTMLElement);
13619
- const nodeZIndexInfoList = popsUtils.getMaxZIndexNodeInfoFromPoint($elList);
13620
- const maxNodeZIndexInfo = nodeZIndexInfoList[0];
13621
- if (maxNodeZIndexInfo) {
13622
- const nodeZIndex = maxNodeZIndexInfo.zIndex;
13623
- if (nodeZIndex > zIndex) {
13624
- zIndex = nodeZIndex;
13625
- maxZIndexNode = maxNodeZIndexInfo.node || maxNodeZIndexInfo.positionNode;
13626
- }
13627
- }
13628
- }
13629
- });
13630
- zIndex += deviation;
13631
- const isOverMaxZIndex = zIndex >= maxZIndex;
13632
- if (isOverMaxZIndex) {
13633
- // 超出z-index最大值
13634
- zIndex = maxZIndex;
13635
- }
13636
- return { zIndex: zIndex, animElement: maxZIndexNode, isOverMaxZIndex };
13637
- },
13638
- /**
13639
- * 排序数组
13640
- * @param getBeforeValueFun
13641
- * @param getAfterValueFun
13642
- * @param sortByDesc 排序是否降序,默认降序
13643
- */
13644
- sortElementListByProperty(getBeforeValueFun, getAfterValueFun, sortByDesc = true) {
13645
- if (typeof sortByDesc !== "boolean") {
13646
- throw new TypeError("参数 sortByDesc 必须为boolean类型");
13647
- }
13648
- if (getBeforeValueFun == null || getAfterValueFun == null) {
13649
- throw new Error("获取前面的值或后面的值的方法不能为空");
13650
- }
13651
- return function (after_obj, before_obj) {
13652
- const beforeValue = getBeforeValueFun(before_obj); // 前
13653
- const afterValue = getAfterValueFun(after_obj); // 后
13654
- if (sortByDesc) {
13655
- if (afterValue > beforeValue) {
13656
- return -1;
13657
- }
13658
- else if (afterValue < beforeValue) {
13659
- return 1;
13660
- }
13661
- else {
13662
- return 0;
13663
- }
13664
- }
13665
- else {
13666
- if (afterValue < beforeValue) {
13667
- return -1;
13668
- }
13669
- else if (afterValue > beforeValue) {
13670
- return 1;
13671
- }
13672
- else {
13673
- return 0;
13674
- }
13675
- }
13676
- };
13677
- },
13678
- };
13679
-
13680
13706
  class Pops {
13681
13707
  /** 配置 */
13682
13708
  config = {
13683
13709
  /** 版本号 */
13684
13710
  version: version,
13711
+ /** 样式配置 */
13685
13712
  cssText: PopsCSS,
13686
13713
  /** icon图标的svg代码 */
13687
13714
  iconSVG: PopsIcon.$data,
@@ -13689,12 +13716,9 @@ System.register('pops', [], (function (exports) {
13689
13716
  animation: PopsAnimation.$data,
13690
13717
  /** 存储已创建的元素 */
13691
13718
  instData: PopsInstData,
13692
- /** 禁止滚动 */
13693
- forbiddenScroll: {
13694
- event(event) {
13695
- return popsDOMUtils.preventEvent(event);
13696
- },
13697
- },
13719
+ };
13720
+ /** 导出的函数 */
13721
+ fn = {
13698
13722
  /** pops使用的工具类 */
13699
13723
  Utils: popsUtils,
13700
13724
  /** pops使用的DOM工具类 */
@@ -13704,17 +13728,16 @@ System.register('pops', [], (function (exports) {
13704
13728
  /** pops处理float类型使用的工具类 */
13705
13729
  MathFloatUtils: PopsMathFloatUtils,
13706
13730
  /** 实例处理函数 */
13707
- PopsInstHandler,
13731
+ InstHandler: PopsInstHandler,
13708
13732
  /** pops.panel中用于处理各个类型的工具 */
13709
- PanelHandlerComponents,
13733
+ PanelHandlerComponents: PanelHandlerComponents,
13710
13734
  /** pops.panel中的动画 */
13711
- PopsAnimation,
13735
+ Animation: PopsAnimation,
13712
13736
  /** 事件类 */
13713
- EventEmiter,
13737
+ EventEmiter: EventEmiter,
13714
13738
  /** 通用的CSS类名 */
13715
- PopsCommonCSSClassName,
13739
+ CommonCSSClassName: PopsCommonCSSClassName,
13716
13740
  };
13717
- init() { }
13718
13741
  /**
13719
13742
  * 释放原有的pops控制权
13720
13743
  * @example