@formily-design/shared 1.0.0
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.
- package/LICENSE.md +20 -0
- package/README.md +1 -0
- package/dist/designable.shared.umd.production.js +1 -0
- package/dist/designable.shared.umd.production.min.js +2051 -0
- package/esm/animation.d.ts +2 -0
- package/esm/animation.js +33 -0
- package/esm/array.d.ts +37 -0
- package/esm/array.js +111 -0
- package/esm/clone.d.ts +4 -0
- package/esm/clone.js +97 -0
- package/esm/compose.d.ts +1 -0
- package/esm/compose.js +7 -0
- package/esm/coordinate.d.ts +106 -0
- package/esm/coordinate.js +475 -0
- package/esm/element.d.ts +6 -0
- package/esm/element.js +137 -0
- package/esm/event.d.ts +96 -0
- package/esm/event.js +213 -0
- package/esm/globalThisPolyfill.d.ts +1 -0
- package/esm/globalThisPolyfill.js +22 -0
- package/esm/index.d.ts +17 -0
- package/esm/index.js +17 -0
- package/esm/instanceof.d.ts +1 -0
- package/esm/instanceof.js +11 -0
- package/esm/keycode.d.ts +147 -0
- package/esm/keycode.js +150 -0
- package/esm/lru.d.ts +73 -0
- package/esm/lru.js +293 -0
- package/esm/observer.d.ts +9 -0
- package/esm/observer.js +29 -0
- package/esm/request-idle.d.ts +10 -0
- package/esm/request-idle.js +8 -0
- package/esm/scroller.d.ts +10 -0
- package/esm/scroller.js +82 -0
- package/esm/subscribable.d.ts +14 -0
- package/esm/subscribable.js +48 -0
- package/esm/types.d.ts +13 -0
- package/esm/types.js +21 -0
- package/esm/uid.d.ts +1 -0
- package/esm/uid.js +9 -0
- package/lib/animation.d.ts +2 -0
- package/lib/animation.js +38 -0
- package/lib/array.d.ts +37 -0
- package/lib/array.js +125 -0
- package/lib/clone.d.ts +4 -0
- package/lib/clone.js +102 -0
- package/lib/compose.d.ts +1 -0
- package/lib/compose.js +11 -0
- package/lib/coordinate.d.ts +106 -0
- package/lib/coordinate.js +504 -0
- package/lib/element.d.ts +6 -0
- package/lib/element.js +145 -0
- package/lib/event.d.ts +96 -0
- package/lib/event.js +218 -0
- package/lib/globalThisPolyfill.d.ts +1 -0
- package/lib/globalThisPolyfill.js +25 -0
- package/lib/index.d.ts +17 -0
- package/lib/index.js +33 -0
- package/lib/instanceof.d.ts +1 -0
- package/lib/instanceof.js +15 -0
- package/lib/keycode.d.ts +147 -0
- package/lib/keycode.js +154 -0
- package/lib/lru.d.ts +73 -0
- package/lib/lru.js +297 -0
- package/lib/observer.d.ts +9 -0
- package/lib/observer.js +33 -0
- package/lib/request-idle.d.ts +10 -0
- package/lib/request-idle.js +13 -0
- package/lib/scroller.d.ts +10 -0
- package/lib/scroller.js +88 -0
- package/lib/subscribable.d.ts +14 -0
- package/lib/subscribable.js +52 -0
- package/lib/types.d.ts +13 -0
- package/lib/types.js +29 -0
- package/lib/uid.d.ts +1 -0
- package/lib/uid.js +12 -0
- package/package.json +32 -0
- package/rollup.config.js +3 -0
- package/src/animation.ts +38 -0
- package/src/array.ts +301 -0
- package/src/clone.ts +96 -0
- package/src/compose.ts +7 -0
- package/src/coordinate.ts +633 -0
- package/src/element.ts +144 -0
- package/src/event.ts +379 -0
- package/src/globalThisPolyfill.ts +19 -0
- package/src/index.ts +17 -0
- package/src/instanceof.ts +10 -0
- package/src/keycode.ts +150 -0
- package/src/lru.ts +322 -0
- package/src/observer.ts +38 -0
- package/src/request-idle.ts +22 -0
- package/src/scroller.ts +113 -0
- package/src/subscribable.ts +60 -0
- package/src/types.ts +27 -0
- package/src/uid.ts +10 -0
- package/tsconfig.build.json +10 -0
- package/tsconfig.json +5 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-present, Alibaba Group Holding Limited. All rights reserved.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @formily-design/shared
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).Designable=t.Designable||{},t.Designable.Shared={}))}(this,function(t){"use strict";const e=t=>e=>null!=e&&(Array.isArray(t)?t:[t]).some(t=>n(e)===`[object ${t}]`),n=t=>Object.prototype.toString.call(t),i=e(["Function","AsyncFunction","GeneratorFunction"]),r=e("Window"),o=Array.isArray,s=e("Object"),a=e("String"),l=e("Boolean"),c=e("Number"),u=t=>"object"==typeof t,h=e("RegExp"),d=t=>!isNaN(t)&&c(t),f=Symbol("UNSUBSCRIBE_ID_SYMBOL");class y{constructor(){this.subscribers={index:0},this.unsubscribe=t=>{if(null!=t)i(t)?delete this.subscribers[t[f]]:delete this.subscribers[t];else for(const t in this.subscribers)this.unsubscribe(t)}}dispatch(t,e){let n=!1;for(const r in this.subscribers)i(this.subscribers[r])&&(t.context=e,!1===this.subscribers[r](t)&&(n=!0));return!n}subscribe(t){let e;i(t)&&(e=this.subscribers.index+1,this.subscribers[e]=t,this.subscribers.index++);const n=()=>{this.unsubscribe(e)};return n[f]=e,n}}const m=function(){try{if("undefined"!=typeof self)return self}catch(t){}try{if(void 0!==m)return m}catch(t){}try{if("undefined"!=typeof global)return global}catch(t){}return Function("return this")()}(),b=Symbol("ATTACHED_SYMBOL"),v=Symbol("__EVENTS_SYMBOL__"),g=Symbol("EVENTS_ONCE_SYMBOL"),p=Symbol("EVENTS_BATCH_SYMBOL"),w=Symbol("DRIVER_INSTANCES_SYMBOL"),x=t=>"onlyOne"===t||"onlyChild"===t||"onlyParent"===t;const E=(t=10,e)=>{let n=null,i=null;const r=()=>{n||(n=requestAnimationFrame(o=>{null===i&&(i=o);e((o-i)/1e3*t),n=null,r()}))};return r(),()=>{n&&(cancelAnimationFrame(n),n=null),i=null}},S=(t=0,e=1/0)=>e>=t?(e-t)/e:0,M=(t,e,n,o)=>{if(t)if(r(t))"x"===e?t.scrollBy({left:n,behavior:"smooth"}):t.scrollBy({top:n,behavior:"smooth"}),i(o)&&o(n);else if("x"===e){if(t.scrollLeft+n>t.scrollWidth)return;t.scrollLeft+=n,i(o)&&o(t.scrollLeft)}else{if(t.scrollTop+n>t.scrollHeight)return;t.scrollTop+=n,i(o)&&o(t.scrollTop)}};function O(t){return d(null==t?void 0:t.x)&&d(null==t?void 0:t.y)}function R(t){return O(null==t?void 0:t.start)&&O(null==t?void 0:t.end)}class T{constructor(t,e){this.x=t,this.y=e}}class A{constructor(t,e,n,i){this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=i}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}}class L{constructor(t,e){this.start={...t},this.end={...e}}}var k;function F(t,e,n=!0){const i=t=>{if(!n)return 0;const e=.1*t;return e>20?20:e<10?10:e};return t.x>=e.x+i(e.width)&&t.x<=e.x+e.width-i(e.width)&&t.y>=e.y+i(e.height)&&t.y<=e.y+e.height-i(e.height)}function I(t){return[new T(t.x,t.y),new T(t.x+t.width,t.y),new T(t.x+t.width,t.y+t.height),new T(t.x,t.y+t.height)]}function N(e,n){const i=F(e,n);return e.x<=n.x+n.width/2?e.y<=n.y+n.height/2?i?t.RectQuadrant.Inner1:t.RectQuadrant.Outer1:i?t.RectQuadrant.Inner4:t.RectQuadrant.Outer4:e.y<=n.y+n.height/2?i?t.RectQuadrant.Inner2:t.RectQuadrant.Outer2:i?t.RectQuadrant.Inner3:t.RectQuadrant.Outer3}function C(t,e){let n=Math.min(Math.abs(t.x-e.x),Math.abs(t.x-(e.x+e.width))),i=Math.min(Math.abs(t.y-e.y),Math.abs(t.y-(e.y+e.height)));return t.x>=e.x&&t.x<=e.x+e.width&&(n=0),t.y>=e.y&&t.y<=e.y+e.height&&(i=0),Math.sqrt(n**2+i**2)}t.RectQuadrant=void 0,(k=t.RectQuadrant||(t.RectQuadrant={})).Inner1="I1",k.Inner2="I2",k.Inner3="I3",k.Inner4="I4",k.Outer1="O1",k.Outer2="O2",k.Outer3="O3",k.Outer4="O4";let D=36,P="";for(;D--;)P+=D.toString(36);const B=(t,e)=>i(e)?t instanceof e:!!a(e)&&(!!m[e]&&t instanceof m[e]),_=[["Map",t=>new Map(t)],["WeakMap",t=>new WeakMap(t)],["WeakSet",t=>new WeakSet(t)],["Set",t=>new Set(t)],["Date",t=>new Date(t)],"FileList","File","URL","RegExp",["Promise",t=>new Promise((e,n)=>t.then(e,n))]],U=t=>{for(let e=0;e<_.length;e++){const n=_[e];if(Array.isArray(n)&&n[0]){if(B(t,n[0]))return n[1]?n[1]:n[0]}else if(B(t,n))return n}},z=(t,e)=>{let n;if(Array.isArray(t))return t.map(t=>z(t,e));if(U(t))return n=U(t),i(n)?n(t):t;if("object"==typeof t&&t){if("$$typeof"in t&&"_owner"in t)return t;if(t._isAMomentObject)return t;if(t._isJSONSchemaObject)return t;if(i(t.toJS))return t;if(i(t.toJSON))return t;if(Object.getOwnPropertySymbols(t||{}).length)return t;const n={};for(const r in t)Object.hasOwnProperty.call(t,r)&&(i(e)?e(t[r],r)?n[r]=z(t[r],e):n[r]=t[r]:n[r]=z(t[r],e));return n}return t},W=Symbol("newer"),j=Symbol("older");function q(t,e){this.key=t,this.value=e,this[W]=void 0,this[j]=void 0}class Q{constructor(t,e){"number"!=typeof t&&(e=t,t=0),this.size=0,this.limit=t,this.oldest=this.newest=void 0,this._keymap=new Map,e&&(this.assign(e),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[W]&&(t===this.oldest&&(this.oldest=t[W]),t[W][j]=t[j]),t[j]&&(t[j][W]=t[W]),t[W]=void 0,t[j]=this.newest,this.newest&&(this.newest[W]=t),this.newest=t)}assign(t){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const i=t[Symbol.iterator]();for(let t=i.next();!t.done;t=i.next()){const i=new q(t.value[0],t.value[1]);if(this._keymap.set(i.key,i),e?(e[W]=i,i[j]=e):this.oldest=i,e=i,0===n--)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}get(t){const e=this._keymap.get(t);if(e)return this._markEntryAsUsed(e),e.value}set(t,e){let n=this._keymap.get(t);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(t,n=new q(t,e)),this.newest?(this.newest[W]=n,n[j]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest[W]?(this.oldest=this.oldest[W],this.oldest[j]=void 0):(this.oldest=void 0,this.newest=void 0),t[W]=t[j]=void 0,this._keymap.delete(t.key),--this.size,[t.key,t.value]}find(t){const e=this._keymap.get(t);return e?e.value:void 0}has(t){return this._keymap.has(t)}delete(t){const e=this._keymap.get(t);if(e)return this._keymap.delete(e.key),e[W]&&e[j]?(e[j][W]=e[W],e[W][j]=e[j]):e[W]?(e[W][j]=void 0,this.oldest=e[W]):e[j]?(e[j][W]=void 0,this.newest=e[j]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new H(this.oldest)}values(){return new K(this.oldest)}entries(){}forEach(t,e){"object"!=typeof e&&(e=this);let n=this.oldest;for(;n;)t.call(e,n.value,n.key,this),n=n[W]}toJSON(){const t=new Array(this.size);let e=0,n=this.oldest;for(;n;)t[e++]={key:n.key,value:n.value},n=n[W];return t}toString(){let t="",e=this.oldest;for(;e;)t+=String(e.key)+":"+e.value,e=e[W],e&&(t+=" < ");return t}[Symbol.iterator](){return new V(this.oldest)}}class V{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[W],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}class H{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[W],{done:!1,value:t.key}):{done:!0,value:void 0}}}class K{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[W],{done:!1,value:t.value}):{done:!0,value:void 0}}}const Y=t=>o(t)?t:t?[t]:[];function G(t,e,n){if(o(t)||a(t)){if(n){for(let n=t.length-1;n>=0;n--)if(!1===e(t[n],n))return}else for(let n=0;n<t.length;n++)if(!1===e(t[n],n))return}else if(u(t)){let n;for(n in t)if(Object.hasOwnProperty.call(t,n)&&!1===e(t[n],n))return}}function J(t,e,n){let i=!1;return G(t,(t,n)=>{if(e(t,n))return i=!0,!1},n),i}const X=t=>Y(t).reduce((t,e)=>o(e)?t.concat(X(e)):t.concat(e),[]);var $;t.KeyCode=void 0,($=t.KeyCode||(t.KeyCode={})).Backspace="Backspace",$.Tab="Tab",$.Enter="Enter",$.Shift="Shift",$.Control="Control",$.Alt="Alt",$.CapsLock="CapsLock",$.Escape="Escape",$.Space=" ",$.PageUp="PageUp",$.PageDown="PageDown",$.End="End",$.Home="Home",$.ArrowLeft="ArrowLeft",$.ArrowUp="ArrowUp",$.ArrowRight="ArrowRight",$.ArrowDown="ArrowDown",$.Left="Left",$.Up="Up",$.Right="Right",$.Down="Down",$.Insert="Insert",$.Delete="Delete",$.Zero="0",$.ClosedParen=")",$.One="1",$.ExclamationMark="!",$.Two="2",$.AtSign="@",$.Three="3",$.PoundSign="£",$.Hash="#",$.Four="4",$.DollarSign="$",$.Five="5",$.PercentSign="%",$.Six="6",$.Caret="^",$.Hat="^",$.Seven="7",$.Ampersand="&",$.Eight="8",$.Star="*",$.Asterisk="*",$.Nine="9",$.OpenParen="(",$.a="a",$.b="b",$.c="c",$.d="d",$.e="e",$.f="f",$.g="g",$.h="h",$.i="i",$.j="j",$.k="k",$.l="l",$.m="m",$.n="n",$.o="o",$.p="p",$.q="q",$.r="r",$.s="s",$.t="t",$.u="u",$.v="v",$.w="w",$.x="x",$.y="y",$.z="z",$.A="A",$.B="B",$.C="C",$.D="D",$.E="E",$.F="F",$.G="G",$.H="H",$.I="I",$.J="J",$.K="K",$.L="L",$.M="M",$.N="N",$.O="O",$.P="P",$.Q="Q",$.R="R",$.S="S",$.T="T",$.U="U",$.V="V",$.W="W",$.X="X",$.Y="Y",$.Z="Z",$.Meta="Meta",$.LeftWindowKey="Meta",$.RightWindowKey="Meta",$.Numpad0="0",$.Numpad1="1",$.Numpad2="2",$.Numpad3="3",$.Numpad4="4",$.Numpad5="5",$.Numpad6="6",$.Numpad7="7",$.Numpad8="8",$.Numpad9="9",$.Multiply="*",$.Add="+",$.Subtract="-",$.DecimalPoint=".",$.MSDecimalPoint="Decimal",$.Divide="/",$.F1="F1",$.F2="F2",$.F3="F3",$.F4="F4",$.F5="F5",$.F6="F6",$.F7="F7",$.F8="F8",$.F9="F9",$.F10="F10",$.F11="F11",$.F12="F12",$.NumLock="NumLock",$.ScrollLock="ScrollLock",$.SemiColon=";",$.Equals="=",$.Comma=",",$.Dash="-",$.Period=".",$.UnderScore="_",$.PlusSign="+",$.ForwardSlash="/",$.Tilde="~",$.GraveAccent="`",$.OpenBracket="[",$.ClosedBracket="]",$.Quote="'";var Z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};!function(t){var e={exports:{}};t(e,e.exports)}(function(t){var e;e=function(){var t,e,n,i,r,o,s,a,l="undefined"!=typeof window?window:null!=typeof Z?Z:this||{},c=l.cancelRequestAnimationFrame&&l.requestAnimationFrame||setTimeout,u=l.cancelRequestAnimationFrame||clearTimeout,h=[],d=0,f=!1,y=7,m=35,b=125,v=0,g=0,p=0,w={get didTimeout(){return!1},timeRemaining:function(){var t=y-(Date.now()-g);return t<0?0:t}},x=(r=function(){y=22,b=66,m=0},a=function(){var t=Date.now()-s;t<99?o=setTimeout(a,99-t):(o=null,r())},function(){s=Date.now(),o||(o=setTimeout(a,99))});function E(){125!=b&&(y=7,b=125,m=35,f&&(f&&(i&&u(i),n&&clearTimeout(n),f=!1),O())),x()}function S(){i=null,n=setTimeout(R,0)}function M(){n=null,c(S)}function O(){f||(e=b-(Date.now()-g),t=Date.now(),f=!0,m&&e<m&&(e=m),e>9?n=setTimeout(M,e):(e=0,M()))}function R(){var i,r,o,s=y>9?9:1;if(g=Date.now(),f=!1,n=null,d>2||g-e-50<t)for(r=0,o=h.length;r<o&&w.timeRemaining()>s;r++)i=h.shift(),p++,i&&i(w);h.length?O():d=0}function T(t){return v++,h.push(t),O(),v}function A(t){var e=t-1-p;h[e]&&(h[e]=null)}if(l.requestIdleCallback&&l.cancelIdleCallback)try{l.requestIdleCallback(function(){},{timeout:0})}catch(t){!function(t){var e,n;if(l.requestIdleCallback=function(e,n){return n&&"number"==typeof n.timeout?t(e,n.timeout):t(e)},l.IdleCallbackDeadline&&(e=IdleCallbackDeadline.prototype)){if(!(n=Object.getOwnPropertyDescriptor(e,"timeRemaining"))||!n.configurable||!n.get)return;Object.defineProperty(e,"timeRemaining",{value:function(){return n.get.call(this)},enumerable:!0,configurable:!0})}}(l.requestIdleCallback)}else l.requestIdleCallback=T,l.cancelIdleCallback=A,l.document&&document.addEventListener&&(l.addEventListener("scroll",E,!0),l.addEventListener("resize",E),document.addEventListener("focus",E,!0),document.addEventListener("mouseover",E,!0),["click","keypress","touchstart","mousedown"].forEach(function(t){document.addEventListener(t,E,{capture:!0,passive:!0})}),l.MutationObserver&&new MutationObserver(E).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}));return{request:T,cancel:A}},t.exports?t.exports=e():window.idleCallbackShim=e()});const tt=new Set(["A","ABBR","ACRONYM","AUDIO","B","BDI","BDO","BIG","BR","BUTTON","CANVAS","CITE","CODE","DATA","DATALIST","DEL","DFN","EM","EMBED","I","IFRAME","IMG","INS","KBD","LABEL","MAP","MARK","METER","NOSCRIPT","OBJECT","OUTPUT","PICTURE","PROGRESS","Q","RUBY","S","SAMP","SELECT","SLOT","SMALL","STRONG","SUB","SUP","SVG","TEMPLATE","TEXTAREA","TIME","U","TT","VAR","VIDEO","WBR","INPUT","SPAN"]),et=(t,e)=>t+parseFloat(e.marginLeft)+parseFloat(e.marginRight)+parseFloat(e.paddingLeft)+parseFloat(e.paddingRight)+parseFloat(e.borderLeftWidth)+parseFloat(e.borderRightWidth);t.Event=class extends y{constructor(t){super(),this.drivers=[],this.containers=[],o(null==t?void 0:t.effects)&&t.effects.forEach(t=>{t(this)}),o(null==t?void 0:t.drivers)&&(this.drivers=t.drivers)}subscribeTo(t,e){return this.subscribe(n=>{if(t&&n instanceof t)return e(n)})}subscribeWith(t,e){return this.subscribe(n=>{if(o(t)){if(t.includes(null==n?void 0:n.type))return e(n)}else if(t&&(null==n?void 0:n.type)===t)return e(n)})}attachEvents(t,e=m,n){if(t)return r(t)?this.attachEvents(t.document,t,n):void(t[b]||(t[b]=this.drivers.map(i=>{const r=new i(this,n);return r.contentWindow=e,r.container=t,r.attach(t),r}),this.containers.includes(t)||this.containers.push(t)))}detachEvents(t){if(t)return r(t)?this.detachEvents(t.document):void(t[b]&&(t[b].forEach(e=>{e.detach(t)}),this[w]=this[w]||[],this[w]=this[w].reduce((e,n)=>n.container===t?(n.detach(t),e):e.concat(n),[]),this.containers=this.containers.filter(e=>e!==t),delete t[b],delete t[v],delete t[g],delete t[p]));this.containers.forEach(t=>{this.detachEvents(t)})}},t.EventDriver=class{constructor(t,e){this.container=document,this.contentWindow=m,this.engine=t,this.context=e}dispatch(t){return this.engine.dispatch(t,this.context)}subscribe(t){return this.engine.subscribe(t)}subscribeTo(t,e){return this.engine.subscribeTo(t,e)}subscribeWith(t,e){return this.engine.subscribeWith(t,e)}attach(t){console.error("attach must implement.")}detach(t){console.error("attach must implement.")}eventTarget(t){var e;return"resize"!==t&&"scroll"!==t||this.container!==(null===(e=this.contentWindow)||void 0===e?void 0:e.document)?this.container:this.contentWindow}addEventListener(t,e,n){var i,r,o,s;const a=this.eventTarget(t);if(x(null==n?void 0:n.mode)){a[g]=a[g]||{};const i=this.constructor;i[g]=i[g]||{};const r=a[g][t],o=i[g][t];if(!r){if(o)if("onlyChild"===n.mode)o.contains(a)&&(o.removeEventListener(t,o[g][t],n),delete o[g][t]);else if("onlyParent"===n.mode&&o.contains(a))return;a.addEventListener(t,e,n),a[g][t]=e,i[g][t]=a}}else a[v]=a[v]||{},a[v][t]=a[v][t]||new Map,(null===(r=null===(i=a[v][t])||void 0===i?void 0:i.get)||void 0===r?void 0:r.call(i,e))||(a.addEventListener(t,e,n),null===(s=null===(o=a[v][t])||void 0===o?void 0:o.set)||void 0===s||s.call(o,e,!0))}removeEventListener(t,e,n){var i,r;const o=this.eventTarget(t);if(x(null==n?void 0:n.mode)){const i=this.constructor;i[g]=i[g]||{},o[g]=o[g]||{},delete i[g][t],delete o[g][t],o.removeEventListener(t,e,n)}else o[v]=o[v]||{},o[v][t]=o[v][t]||new Map,null===(r=null===(i=o[v][t])||void 0===i?void 0:i.delete)||void 0===r||r.call(i,e),o.removeEventListener(t,e,n)}batchAddEventListener(t,e,n){this.engine[w]=this.engine[w]||[],this.engine[w].includes(this)||this.engine[w].push(this),this.engine[w].forEach(i=>{const r=i.eventTarget(t);r[p]=r[p]||{},r[p][t]||(r.addEventListener(t,e,n),r[p][t]=e)})}batchRemoveEventListener(t,e,n){this.engine[w]=this.engine[w]||[],this.engine[w].forEach(i=>{const r=i.eventTarget(t);r[p]=r[p]||{},r.removeEventListener(t,e,n),delete r[p][t]})}},t.LRUMap=Q,t.LayoutObserver=class{constructor(t=()=>{}){this.connected=!1,this.observe=t=>{this.resizeObserver.observe(t),this.performanceObserver.observe({entryTypes:["paint","element","layout-shift","event"]}),this.mutationObserver.observe(t,{attributeFilter:["style"],attributes:!0}),this.connected=!0},this.disconnect=()=>{this.connected&&(this.resizeObserver.disconnect(),this.performanceObserver.disconnect(),this.mutationObserver.disconnect()),this.connected=!1},this.resizeObserver=new ResizeObserver(()=>t()),this.performanceObserver=new PerformanceObserver(()=>{t()}),this.mutationObserver=new MutationObserver(()=>t())}},t.LineSegment=L,t.Point=T,t.Rect=A,t.Subscribable=y,t.calcAutoScrollBasicInfo=(t,e,n,i=80)=>{const{left:r,right:o,top:s,bottom:a}=n,{x:l,y:c}=t;let u,h,d,f;"x"===e?(u=r,h=o,d=l):(u=s,h=a,d=c);const y=h-u,m=y>400?100:y/3;return h-d<m?{direction:"end",speedFactor:f,speed:i*S(h-d,m)}:d-u<m?{direction:"begin",speedFactor:f,speed:i*S(d-u,m)}:null},t.calcBoundingRect=function(t){if(!(null==t?void 0:t.length))return;if(1===(null==t?void 0:t.length)&&!t[0])return;let e=1/0,n=-1/0,i=1/0,r=-1/0;return t.forEach(t=>{const o=new A(t.x,t.y,t.width,t.height);o.top<=e&&(e=o.top),o.bottom>=n&&(n=o.bottom),o.left<=i&&(i=o.left),o.right>=r&&(r=o.right)}),new A(i,e,r-i,n-e)},t.calcClosestEdges=function(t,e){var n,i,r,o;let s,a=1/0;if((null===(n=null==t?void 0:t.start)||void 0===n?void 0:n.y)===(null===(i=null==t?void 0:t.end)||void 0===i?void 0:i.y))e.h.forEach(e=>{const n=Math.abs(e.start.y-t.start.y);n<a&&(a=n,s=e)});else{if((null===(r=null==t?void 0:t.start)||void 0===r?void 0:r.x)!==(null===(o=null==t?void 0:t.end)||void 0===o?void 0:o.x))throw new Error("can not calculate slash distance");e.v.forEach(e=>{const n=Math.abs(e.start.x-t.start.x);n<a&&(a=n,s=e)})}return[a,s]},t.calcCombineSnapLineSegment=function(t,e){return t.start.x===t.end.x?new L(new T(t.start.x,t.start.y>e.start.y?e.start.y:t.start.y),new T(t.start.x,t.end.y>e.end.y?t.end.y:e.end.y)):new L(new T(t.start.x>e.start.x?e.start.x:t.start.x,t.start.y),new T(t.end.x>e.end.x?t.end.x:e.end.x,t.end.y))},t.calcDistanceOfPointToRect=C,t.calcDistanceOfSnapLineToEdges=function(t,e){var n,i,r,o;let s=1/0;if((null===(n=null==t?void 0:t.start)||void 0===n?void 0:n.y)===(null===(i=null==t?void 0:t.end)||void 0===i?void 0:i.y))e.h.forEach(e=>{const n=Math.abs(e.start.y-t.start.y);n<s&&(s=n)});else{if((null===(r=null==t?void 0:t.start)||void 0===r?void 0:r.x)!==(null===(o=null==t?void 0:t.end)||void 0===o?void 0:o.x))throw new Error("can not calculate slash distance");e.v.forEach(e=>{const n=Math.abs(e.start.x-t.start.x);n<s&&(s=n)})}return s},t.calcDistancePointToEdge=function(t,e){const n=Math.abs(t.y-e.y),i=Math.abs(t.y-(e.y+e.height)),r=Math.abs(t.x-e.x),o=Math.abs(t.x-(e.x+e.width));return Math.min(n,i,r,o)},t.calcEdgeLinesOfRect=function(t){return{v:[new L(new T(t.x,t.y),new T(t.x,t.y+t.height)),new L(new T(t.x+t.width/2,t.y),new T(t.x+t.width/2,t.y+t.height)),new L(new T(t.x+t.width,t.y),new T(t.x+t.width,t.y+t.height))],h:[new L(new T(t.x,t.y),new T(t.x+t.width,t.y)),new L(new T(t.x,t.y+t.height/2),new T(t.x+t.width,t.y+t.height/2)),new L(new T(t.x,t.y+t.height),new T(t.x+t.width,t.y+t.height))]}},t.calcElementLayout=t=>{if(!t)return"vertical";const e=t.parentElement;if(!e)return"vertical";const n=t.tagName,i=e.tagName,r=getComputedStyle(t),o=getComputedStyle(e),s=()=>{const n=t.getBoundingClientRect().width,i=et(n,r),o=e.getBoundingClientRect().width;return i.toFixed(0)<o.toFixed(0)};return"TH"!==n&&"TD"!==n||"TR"!==i?"flex"===o.display&&"row"===o.flexDirection||"grid"===o.display&&s()?"horizontal":tt.has(n)?"block"===r.display&&("left"!==r.float&&"right"!==r.float||!s())?"vertical":"horizontal":void 0:"horizontal"},t.calcElementOuterWidth=et,t.calcElementRotate=t=>{var e,n,i;const r=null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.transform;return r?Number(null!==(i=null===(n=r.match(/rotate\(\s*([-\d.]+)/))||void 0===n?void 0:n[1])&&void 0!==i?i:0):0},t.calcElementScale=t=>{var e,n,i;const r=null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.transform;return r?Number(null!==(i=null===(n=r.match(/scale\(\s*([-\d.]+)/))||void 0===n?void 0:n[1])&&void 0!==i?i:0):0},t.calcElementTranslate=t=>{var e,n,i;const r=null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.transform;if(r){const[t,e]=null!==(i=null===(n=r.match(/translate(?:3d)?\(\s*([-\d.]+)[a-z]+?[\s,]+([-\d.]+)[a-z]+?(?:[\s,]+([-\d.]+))?[a-z]+?\s*\)/))||void 0===n?void 0:n.slice(1,3))&&void 0!==i?i:[0,0];return new T(Number(t),Number(e))}return new T(Number(t.offsetLeft),Number(t.offsetTop))},t.calcExtendsLineSegmentOfRect=function(t,e){if(e.right<t.right&&t.left<=e.right){if(e.bottom<t.top)return{start:{x:e.right,y:e.bottom},end:{x:t.right,y:e.bottom}};if(e.top>t.bottom)return{start:{x:e.right,y:e.top},end:{x:t.right,y:e.top}}}else if(e.left>t.left&&t.right>=e.left){if(e.bottom<t.top)return{start:{x:t.left,y:e.bottom},end:{x:e.left,y:e.bottom}};if(e.top>t.bottom)return{start:{x:t.left,y:e.top},end:{x:e.left,y:e.top}}}if(e.top<t.top&&t.bottom>=e.top){if(e.right<t.left)return{start:{x:e.right,y:e.bottom},end:{x:e.right,y:t.bottom}};if(e.left>t.right)return{start:{x:e.left,y:e.bottom},end:{x:e.left,y:t.bottom}}}else if(e.bottom>t.bottom&&e.top<=t.bottom){if(e.right<t.left)return{start:{x:e.right,y:t.top},end:{x:e.right,y:e.top}};if(e.left>t.right)return{start:{x:e.left,y:t.top},end:{x:e.left,y:e.top}}}},t.calcOffsetOfSnapLineSegmentToEdge=function(t,e){const n={x:[(i=e).x,i.x+i.width/2,i.x+i.width],y:[i.y,i.y+i.height/2,i.y+i.height]};var i;if(t.start.x===t.end.x)return{x:r(n.x,t.start.x)-e.x,y:0};function r(t,e){let n=1/0,i=-1;for(let r=0;r<t.length;r++){const o=Math.abs(t[r]-e);n>o&&(n=o,i=r)}return t[i]}return{x:0,y:r(n.y,t.start.y)-e.y}},t.calcQuadrantOfPointToRect=N,t.calcRectByStartEndPoint=function(t,e,n=0,i=0){let r=0,o=0;return e.x+n>=t.x&&e.y+i>=t.y?(r=t.x,o=t.y,new A(r-n,o-i,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+i))):e.x+n<t.x&&e.y+i<t.y?(r=e.x,o=e.y,new A(r,o,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+i))):e.x+n<t.x&&e.y+i>=t.y?(r=e.x,o=t.y,new A(r-n,o-i,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+i))):(r=t.x,o=e.y,new A(r,o,Math.abs(e.x-t.x+n),Math.abs(e.y-t.y+i)))},t.calcRectOfAxisLineSegment=function(t){if(!R(t))return;const e=t.start.x===t.end.x;return new A(t.start.x,t.start.y,e?0:t.end.x-t.start.x,e?t.end.y-t.start.y:0)},t.calcRelativeOfPointToRect=function(t,e){const n=C(t,e);return{quadrant:N(t,e),distance:n}},t.calcSpaceBlockOfRect=function(t,e,n){const i=new A(t.x,t.y,t.width,t.height),r=new A(e.x,e.y,e.width,e.height);if(!(r.bottom<i.top&&r.left>i.right||r.top>i.bottom&&r.left>i.right||r.bottom<i.top&&r.right<i.left||r.top>i.bottom&&r.right<i.left)){if(r.bottom<i.top){const t=i.top-r.bottom,e=Math.min(r.left,i.left),o=Math.max(r.right,i.right);if(n&&"top"!==n)return;return{type:"top",distance:t,rect:new A(e,r.bottom,o-e,t)}}if(r.top>i.bottom){const t=r.top-i.bottom,e=Math.min(r.left,i.left),o=Math.max(r.right,i.right);if(n&&"bottom"!==n)return;return{type:"bottom",distance:t,rect:new A(e,i.bottom,o-e,t)}}if(r.right<i.left){const t=i.left-r.right,e=Math.min(r.top,i.top),o=Math.max(r.bottom,i.bottom);if(n&&"left"!==n)return;return{type:"left",distance:t,rect:new A(r.right,e,t,o-e)}}if(r.left>i.right){const t=r.left-i.right,e=Math.min(r.top,i.top),o=Math.max(r.bottom,i.bottom);if(n&&"right"!==n)return;return{type:"right",distance:t,rect:new A(i.right,e,t,o-e)}}}},t.calcSpeedFactor=S,t.cancelIdle=t=>{m.cancelIdleCallback(t)},t.clone=z,t.compose=(...t)=>e=>t.reduce((t,e)=>e(t),e),t.createUniformSpeedAnimation=E,t.each=G,t.every=function(t,e,n){let i=!0;return G(t,(t,n)=>{if(!e(t,n))return i=!1,!1},n),i},t.find=function(t,e,n){let i;return G(t,(t,n)=>{if(e(t,n))return i=t,!1},n),i},t.findIndex=function(t,e,n){let i=-1;return G(t,(t,n)=>{if(e(t,n))return i=n,!1},n),i},t.flat=X,t.getKeyCodeFromEvent=t=>t.key,t.getRectPoints=I,t.getType=n,t.globalThisPolyfill=m,t.includes=function(t,e,n){return a(t)?t.includes(e):J(t,t=>t===e,n)},t.includesWith=function(t,e){return!!o(t)&&t.some(t=>e(t))},t.instOf=B,t.isArr=o,t.isBool=l,t.isCrossRectInRect=function(t,e){const n=new T(t.x+t.width/2,t.y+t.height/2),i=new T(e.x+e.width/2,e.y+e.height/2);return Math.abs(n.x-i.x)<=t.width/2+e.width/2&&Math.abs(n.y-i.y)<=t.height/2+e.height/2},t.isEqualRect=function(t,e){return(null==t?void 0:t.x)===(null==e?void 0:e.x)&&t.y===e.y&&t.width===e.width&&t.height===e.height},t.isFn=i,t.isHTMLElement=t=>(null==t?void 0:t.nodeName)||(null==t?void 0:t.tagName),t.isLineSegment=R,t.isNearAfter=function(t,e,n=!1){return n?Math.abs(t.x-e.x)+Math.abs(t.y-e.y)>Math.abs(t.x-(e.x+e.width))+Math.abs(t.y-(e.y+e.height)):Math.abs(t.y-e.y)>Math.abs(t.y-(e.y+e.height))},t.isNum=c,t.isObj=u,t.isPlainObj=s,t.isPoint=O,t.isPointInRect=F,t.isRect=function(t){return(null==t?void 0:t.x)&&(null==t?void 0:t.y)&&(null==t?void 0:t.width)&&(null==t?void 0:t.height)},t.isRectInRect=function(t,e){const[n,i,r,o]=I(t);return F(n,e,!1)&&F(i,e,!1)&&F(r,e,!1)&&F(o,e,!1)},t.isRegExp=h,t.isStr=a,t.isValid=t=>null!=t,t.isValidNumber=d,t.isWindow=r,t.map=function(t,e,n){const i=o(t)||a(t)?[]:{};return G(t,(t,n)=>{const r=e(t,n);o(i)?i.push(r):i[n]=r},n),i},t.reduce=function(t,e,n,i){let r=n;return G(t,(t,n)=>{r=e(r,t,n)},i),r},t.requestIdle=(t,e)=>m.requestIdleCallback(t,e),t.scrollAnimate=(t,e,n,i,r)=>E(i,i=>{M(t,e,"begin"===n?0-i:i,r)}),t.shallowClone=t=>{let e;return Array.isArray(t)?t.slice(0):U(t)?(e=U(t),i(e)?e(t):t):"object"==typeof t&&t?{...t}:void 0},t.some=J,t.toArr=Y,t.uid=function(t){let e="",n=t||11;for(;n--;)e+=P[36*Math.random()|0];return e},t.updateScrollValue=M,Object.defineProperty(t,"__esModule",{value:!0})});
|