Comparing version 0.1.0 to 0.2.0
@@ -106,7 +106,9 @@ import { Emitter, Events, EventListenerId, EventName } from 'eventti'; | ||
type PointerType = 'mouse' | 'pen' | 'touch'; | ||
interface Rect { | ||
type Dimensions = { | ||
width: number; | ||
height: number; | ||
}; | ||
interface Rect extends Dimensions { | ||
left: number; | ||
top: number; | ||
width: number; | ||
height: number; | ||
} | ||
@@ -117,2 +119,3 @@ interface RectExtended extends Rect { | ||
} | ||
type CSSProperties = Partial<Omit<CSSStyleDeclaration, 'getPropertyPriority' | 'getPropertyValue' | 'item' | 'removeProperty' | 'setProperty' | 'length' | 'parentRule'>>; | ||
@@ -186,3 +189,3 @@ declare const SOURCE_EVENTS: { | ||
events: E; | ||
readonly element: HTMLElement | Window; | ||
readonly element: Element | Window; | ||
readonly drag: PointerSensorDragData | null; | ||
@@ -195,3 +198,3 @@ readonly isDestroyed: boolean; | ||
protected _emitter: Emitter<Events>; | ||
constructor(element: HTMLElement | Window, options?: Partial<PointerSensorSettings>); | ||
constructor(element: Element | Window, options?: Partial<PointerSensorSettings>); | ||
protected _getTrackedPointerEventData(e: PointerSensorSourceEvent): PointerEvent | MouseEvent | Touch | null; | ||
@@ -212,8 +215,14 @@ protected _onStart(e: PointerSensorSourceEvent): void; | ||
type KeyboardSensorPredicate = (e: KeyboardEvent, sensor: KeyboardSensor, moveDistance: number) => { | ||
type KeyboardSensorPredicate = (e: KeyboardEvent, sensor: KeyboardSensor, moveDistance: { | ||
x: number; | ||
y: number; | ||
}) => { | ||
x: number; | ||
y: number; | ||
} | null | undefined; | ||
interface KeyboardSensorSettings { | ||
moveDistance: number; | ||
moveDistance: number | { | ||
x: number; | ||
y: number; | ||
}; | ||
startPredicate: KeyboardSensorPredicate; | ||
@@ -247,3 +256,6 @@ movePredicate: KeyboardSensorPredicate; | ||
events: E; | ||
protected _moveDistance: number; | ||
protected _moveDistance: { | ||
x: number; | ||
y: number; | ||
}; | ||
protected _startPredicate: KeyboardSensorPredicate; | ||
@@ -299,13 +311,14 @@ protected _movePredicate: KeyboardSensorPredicate; | ||
declare enum DraggableStartPredicateState { | ||
PENDING = 0, | ||
RESOLVED = 1, | ||
REJECTED = 2 | ||
} | ||
declare class DraggableDragItem { | ||
readonly element: HTMLElement; | ||
readonly rootParent: HTMLElement; | ||
readonly rootContainingBlock: HTMLElement | Document; | ||
readonly dragParent: HTMLElement; | ||
readonly dragContainingBlock: HTMLElement | Document; | ||
data: { | ||
[key: string]: any; | ||
}; | ||
readonly element: HTMLElement | SVGSVGElement; | ||
readonly elementContainer: HTMLElement; | ||
readonly elementOffsetContainer: HTMLElement | SVGSVGElement | Window | Document; | ||
readonly dragContainer: HTMLElement; | ||
readonly dragOffsetContainer: HTMLElement | SVGSVGElement | Window | Document; | ||
readonly initialTransform: string; | ||
readonly frozenProps: CSSProperties | null; | ||
readonly unfrozenProps: CSSProperties | null; | ||
readonly x: number; | ||
@@ -321,5 +334,5 @@ readonly y: number; | ||
readonly _containerDiffY: number; | ||
readonly _transform: string; | ||
constructor(element: HTMLElement, rootParent: HTMLElement, rootContainingBlock: HTMLElement | Document, dragParent: HTMLElement, dragContainingBlock: HTMLElement | Document); | ||
constructor(element: HTMLElement | SVGSVGElement, elementContainer: HTMLElement, elementOffsetContainer: HTMLElement | SVGSVGElement | Window | Document, dragContainer: HTMLElement, dragOffsetContainer: HTMLElement | SVGSVGElement | Window | Document); | ||
} | ||
declare class DraggableDrag<S extends Sensor[], E extends S[number]['events']> { | ||
@@ -336,2 +349,8 @@ readonly sensor: S[number] | null; | ||
} | ||
declare enum DraggableStartPredicateState { | ||
PENDING = 0, | ||
RESOLVED = 1, | ||
REJECTED = 2 | ||
} | ||
interface DraggableSettings<S extends Sensor[], E extends S[number]['events']> { | ||
@@ -348,8 +367,14 @@ container: HTMLElement | null; | ||
startEvent: E['start'] | E['move']; | ||
}) => HTMLElement[] | null; | ||
}) => (HTMLElement | SVGSVGElement)[] | null; | ||
releaseElements: (data: { | ||
draggable: Draggable<S, E>; | ||
sensor: S[number]; | ||
elements: HTMLElement[]; | ||
elements: (HTMLElement | SVGSVGElement)[]; | ||
}) => void; | ||
getFrozenProps: (data: { | ||
draggable: Draggable<S, E>; | ||
sensor: S[number]; | ||
item: DraggableDragItem; | ||
style: CSSStyleDeclaration; | ||
}) => CSSProperties | (keyof CSSProperties)[] | null; | ||
getStartPosition: (data: { | ||
@@ -359,2 +384,3 @@ draggable: Draggable<S, E>; | ||
item: DraggableDragItem; | ||
style: CSSStyleDeclaration; | ||
}) => { | ||
@@ -390,7 +416,6 @@ x: number; | ||
interface DraggableEventCallbacks<E extends SensorEvents> { | ||
beforestart(event: E['start'] | E['move']): void; | ||
preparestart(event: E['start'] | E['move']): void; | ||
start(event: E['start'] | E['move']): void; | ||
beforemove(event: E['move']): void; | ||
preparemove(event: E['move']): void; | ||
move(event: E['move']): void; | ||
beforeend(event: E['end'] | E['cancel'] | E['destroy'] | null): void; | ||
end(event: E['end'] | E['cancel'] | E['destroy'] | null): void; | ||
@@ -522,3 +547,3 @@ destroy(): void; | ||
interface AutoScrollItemTarget { | ||
element: Window | HTMLElement; | ||
element: Window | Element; | ||
axis?: 'x' | 'y' | 'xy'; | ||
@@ -530,5 +555,5 @@ priority?: number; | ||
} | ||
type AutoScrollItemEventCallback = (scrollElement: Window | HTMLElement, scrollDirection: ReturnType<typeof getDirectionAsString>) => void; | ||
type AutoScrollItemEventCallback = (scrollElement: Window | Element, scrollDirection: ReturnType<typeof getDirectionAsString>) => void; | ||
type AutoScrollItemEffectCallback = () => void; | ||
type AutoScrollItemSpeedCallback = (scrollElement: Window | HTMLElement, scrollData: AutoScrollSpeedData) => number; | ||
type AutoScrollItemSpeedCallback = (scrollElement: Window | Element, scrollData: AutoScrollSpeedData) => number; | ||
declare class AutoScrollItemData { | ||
@@ -543,3 +568,3 @@ positionX: number; | ||
declare class AutoScrollAction { | ||
element: HTMLElement | Window | null; | ||
element: Element | Window | null; | ||
requestX: AutoScrollRequest | null; | ||
@@ -558,3 +583,3 @@ requestY: AutoScrollRequest | null; | ||
item: AutoScrollItem | null; | ||
element: HTMLElement | Window | null; | ||
element: Element | Window | null; | ||
isActive: boolean; | ||
@@ -607,3 +632,3 @@ isEnding: boolean; | ||
protected _getItemClientRect(item: AutoScrollItem, result?: RectExtended): RectExtended; | ||
protected _requestItemScroll(item: AutoScrollItem, axis: AutoScrollAxis, element: Window | HTMLElement, direction: AutoScrollDirection, threshold: number, distance: number, maxValue: number): void; | ||
protected _requestItemScroll(item: AutoScrollItem, axis: AutoScrollAxis, element: Window | Element, direction: AutoScrollDirection, threshold: number, distance: number, maxValue: number): void; | ||
protected _cancelItemScroll(item: AutoScrollItem, axis: AutoScrollAxis): void; | ||
@@ -696,2 +721,2 @@ protected _checkItemOverlap(item: AutoScrollItem, checkX: boolean, checkY: boolean): void; | ||
export { AUTO_SCROLL_AXIS, AUTO_SCROLL_AXIS_DIRECTION, AUTO_SCROLL_DIRECTION, AutoScroll, AutoScrollEventCallbacks, AutoScrollItem, AutoScrollItemEffectCallback, AutoScrollItemEventCallback, AutoScrollItemSpeedCallback, AutoScrollItemTarget, AutoScrollOptions, AutoScrollSettings, BaseMotionSensor, BaseMotionSensorDragData, BaseMotionSensorEvents, BaseMotionSensorTickEvent, BaseSensor, BaseSensorDragData, Draggable, DraggableAutoScroll, DraggableAutoScrollOptions, DraggableAutoScrollSettings, DraggableEventCallbacks, DraggablePlugin, DraggablePluginMap, DraggableSettings, KeyboardMotionSensor, KeyboardMotionSensorEvents, KeyboardMotionSensorSettings, KeyboardSensor, KeyboardSensorCancelEvent, KeyboardSensorDestroyEvent, KeyboardSensorEndEvent, KeyboardSensorEvents, KeyboardSensorMoveEvent, KeyboardSensorPredicate, KeyboardSensorSettings, KeyboardSensorStartEvent, PointerSensor, PointerSensorCancelEvent, PointerSensorDestroyEvent, PointerSensorDragData, PointerSensorEndEvent, PointerSensorEvents, PointerSensorMoveEvent, PointerSensorSettings, PointerSensorStartEvent, Sensor, SensorCancelEvent, SensorDestroyEvent, SensorEndEvent, SensorEventType, SensorEvents, SensorMoveEvent, SensorStartEvent, autoScroll, autoScrollPlugin, autoScrollSmoothSpeed, createPointerSensorStartPredicate, setTicker, ticker, tickerReadPhase, tickerWritePhase }; | ||
export { AUTO_SCROLL_AXIS, AUTO_SCROLL_AXIS_DIRECTION, AUTO_SCROLL_DIRECTION, AutoScroll, type AutoScrollEventCallbacks, type AutoScrollItem, type AutoScrollItemEffectCallback, type AutoScrollItemEventCallback, type AutoScrollItemSpeedCallback, type AutoScrollItemTarget, type AutoScrollOptions, type AutoScrollSettings, BaseMotionSensor, type BaseMotionSensorDragData, type BaseMotionSensorEvents, type BaseMotionSensorTickEvent, BaseSensor, type BaseSensorDragData, Draggable, DraggableAutoScroll, type DraggableAutoScrollOptions, type DraggableAutoScrollSettings, type DraggableEventCallbacks, type DraggablePlugin, type DraggablePluginMap, type DraggableSettings, KeyboardMotionSensor, type KeyboardMotionSensorEvents, type KeyboardMotionSensorSettings, KeyboardSensor, type KeyboardSensorCancelEvent, type KeyboardSensorDestroyEvent, type KeyboardSensorEndEvent, type KeyboardSensorEvents, type KeyboardSensorMoveEvent, type KeyboardSensorPredicate, type KeyboardSensorSettings, type KeyboardSensorStartEvent, PointerSensor, type PointerSensorCancelEvent, type PointerSensorDestroyEvent, type PointerSensorDragData, type PointerSensorEndEvent, type PointerSensorEvents, type PointerSensorMoveEvent, type PointerSensorSettings, type PointerSensorStartEvent, type Sensor, type SensorCancelEvent, type SensorDestroyEvent, type SensorEndEvent, SensorEventType, type SensorEvents, type SensorMoveEvent, type SensorStartEvent, autoScroll, autoScrollPlugin, autoScrollSmoothSpeed, createPointerSensorStartPredicate, setTicker, ticker, tickerReadPhase, tickerWritePhase }; |
@@ -1,1 +0,1 @@ | ||
import{Emitter}from"eventti";import{Ticker}from"tikki";const SensorEventType={start:"start",move:"move",cancel:"cancel",end:"end",destroy:"destroy"};class BaseSensor{constructor(){this.drag=null,this.isDestroyed=!1,this._emitter=new Emitter}_createDragData(t){return{x:t.x,y:t.y}}_updateDragData(t){this.drag&&(this.drag.x=t.x,this.drag.y=t.y)}_resetDragData(){this.drag=null}_start(t){this.isDestroyed||this.drag||(this.drag=this._createDragData(t),this._emitter.emit(SensorEventType.start,t))}_move(t){this.drag&&(this._updateDragData(t),this._emitter.emit(SensorEventType.move,t))}_end(t){this.drag&&(this._updateDragData(t),this._emitter.emit(SensorEventType.end,t),this._resetDragData())}_cancel(t){this.drag&&(this._updateDragData(t),this._emitter.emit(SensorEventType.cancel,t),this._resetDragData())}on(t,e,i){return this._emitter.on(t,e,i)}off(t,e){this._emitter.off(t,e)}cancel(){this.drag&&(this._emitter.emit(SensorEventType.cancel,{type:SensorEventType.cancel,x:this.drag.x,y:this.drag.y}),this._resetDragData())}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.cancel(),this._emitter.emit(SensorEventType.destroy,{type:SensorEventType.destroy}),this._emitter.off())}}let tickerReadPhase=Symbol(),tickerWritePhase=Symbol(),ticker=new Ticker({phases:[tickerReadPhase,tickerWritePhase]});function setTicker(t,e,i){tickerReadPhase=e,tickerWritePhase=i,ticker=t}class BaseMotionSensor extends BaseSensor{constructor(){super(),this.drag=null,this._direction={x:0,y:0},this._speed=0,this._tick=this._tick.bind(this)}_createDragData(t){return Object.assign(Object.assign({},super._createDragData(t)),{time:0,deltaTime:0})}_start(t){this.isDestroyed||this.drag||(super._start(t),ticker.on(tickerReadPhase,this._tick))}_end(t){this.drag&&(ticker.off(tickerReadPhase,this._tick),super._end(t))}_cancel(t){this.drag&&(ticker.off(tickerReadPhase,this._tick),super._cancel(t))}_tick(t){if(this.drag)if(t&&this.drag.time){this.drag.deltaTime=t-this.drag.time,this.drag.time=t;const e={type:"tick",time:this.drag.time,deltaTime:this.drag.deltaTime};if(this._emitter.emit("tick",e),!this.drag)return;const i=this._speed*(this.drag.deltaTime/1e3),s=this._direction.x*i,n=this._direction.y*i;(s||n)&&this._move({type:"move",x:this.drag.x+s,y:this.drag.y+n})}else this.drag.time=t,this.drag.deltaTime=0}}function getPointerEventData(t,e){if("pointerId"in t)return t.pointerId===e?t:null;if("changedTouches"in t){let i=0;for(;i<t.changedTouches.length;i++)if(t.changedTouches[i].identifier===e)return t.changedTouches[i];return null}return t}function getPointerType(t){return"pointerType"in t?t.pointerType:"touches"in t?"touch":"mouse"}function getPointerId(t){return"pointerId"in t?t.pointerId:"changedTouches"in t?t.changedTouches[0]?t.changedTouches[0].identifier:null:-1}const IS_BROWSER="undefined"!=typeof window&&void 0!==window.document,HAS_PASSIVE_EVENTS=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch(t){}return t})(),HAS_TOUCH_EVENTS=IS_BROWSER&&"ontouchstart"in window,HAS_POINTER_EVENTS=IS_BROWSER&&!!window.PointerEvent,IS_SAFARI=!!(IS_BROWSER&&navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&-1==navigator.userAgent.indexOf("CriOS")&&-1==navigator.userAgent.indexOf("FxiOS"));function parseListenerOptions(t={}){const{capture:e=!0,passive:i=!0}=t;return HAS_PASSIVE_EVENTS?{capture:e,passive:i}:{capture:e}}function parseSourceEvents(t){return"auto"===t||void 0===t?HAS_POINTER_EVENTS?"pointer":HAS_TOUCH_EVENTS?"touch":"mouse":t}const POINTER_EVENTS={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},TOUCH_EVENTS={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},MOUSE_EVENTS={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},SOURCE_EVENTS={pointer:POINTER_EVENTS,touch:TOUCH_EVENTS,mouse:MOUSE_EVENTS};class PointerSensor{constructor(t,e={}){const{listenerOptions:i={},sourceEvents:s="auto",startPredicate:n=(t=>!("button"in t&&t.button>0))}=e;this.element=t,this.drag=null,this.isDestroyed=!1,this._areWindowListenersBound=!1,this._startPredicate=n,this._listenerOptions=parseListenerOptions(i),this._sourceEvents=parseSourceEvents(s),this._emitter=new Emitter,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),t.addEventListener(SOURCE_EVENTS[this._sourceEvents].start,this._onStart,this._listenerOptions)}_getTrackedPointerEventData(t){return this.drag?getPointerEventData(t,this.drag.pointerId):null}_onStart(t){if(this.isDestroyed||this.drag)return;if(!this._startPredicate(t))return;const e=getPointerId(t);if(null===e)return;const i=getPointerEventData(t,e);if(null===i)return;const s={pointerId:e,pointerType:getPointerType(t),x:i.clientX,y:i.clientY};this.drag=s;const n=Object.assign(Object.assign({},s),{type:SensorEventType.start,srcEvent:t,target:i.target});this._emitter.emit(n.type,n),this.drag&&this._bindWindowListeners()}_onMove(t){if(!this.drag)return;const e=this._getTrackedPointerEventData(t);if(!e)return;this.drag.x=e.clientX,this.drag.y=e.clientY;const i=Object.assign({type:SensorEventType.move,srcEvent:t,target:e.target},this.drag);this._emitter.emit(i.type,i)}_onCancel(t){if(!this.drag)return;const e=this._getTrackedPointerEventData(t);if(!e)return;this.drag.x=e.clientX,this.drag.y=e.clientY;const i=Object.assign({type:SensorEventType.cancel,srcEvent:t,target:e.target},this.drag);this._emitter.emit(i.type,i),this._resetDrag()}_onEnd(t){if(!this.drag)return;const e=this._getTrackedPointerEventData(t);if(!e)return;this.drag.x=e.clientX,this.drag.y=e.clientY;const i=Object.assign({type:SensorEventType.end,srcEvent:t,target:e.target},this.drag);this._emitter.emit(i.type,i),this._resetDrag()}_bindWindowListeners(){if(this._areWindowListenersBound)return;const{move:t,end:e,cancel:i}=SOURCE_EVENTS[this._sourceEvents];window.addEventListener(t,this._onMove,this._listenerOptions),window.addEventListener(e,this._onEnd,this._listenerOptions),i&&window.addEventListener(i,this._onCancel,this._listenerOptions),this._areWindowListenersBound=!0}_unbindWindowListeners(){if(this._areWindowListenersBound){const{move:t,end:e,cancel:i}=SOURCE_EVENTS[this._sourceEvents];window.removeEventListener(t,this._onMove,this._listenerOptions),window.removeEventListener(e,this._onEnd,this._listenerOptions),i&&window.removeEventListener(i,this._onCancel,this._listenerOptions),this._areWindowListenersBound=!1}}_resetDrag(){this.drag=null,this._unbindWindowListeners()}cancel(){if(!this.drag)return;const t=Object.assign({type:SensorEventType.cancel,srcEvent:null,target:null},this.drag);this._emitter.emit(t.type,t),this._resetDrag()}updateSettings(t){if(this.isDestroyed)return;const{listenerOptions:e,sourceEvents:i,startPredicate:s}=t,n=parseSourceEvents(i),o=parseListenerOptions(e);s&&this._startPredicate!==s&&(this._startPredicate=s),(e&&(this._listenerOptions.capture!==o.capture||this._listenerOptions.passive===o.passive)||i&&this._sourceEvents!==n)&&(this.element.removeEventListener(SOURCE_EVENTS[this._sourceEvents].start,this._onStart,this._listenerOptions),this._unbindWindowListeners(),this.cancel(),i&&(this._sourceEvents=n),e&&o&&(this._listenerOptions=o),this.element.addEventListener(SOURCE_EVENTS[this._sourceEvents].start,this._onStart,this._listenerOptions))}on(t,e,i){return this._emitter.on(t,e,i)}off(t,e){this._emitter.off(t,e)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.cancel(),this._emitter.emit(SensorEventType.destroy,{type:SensorEventType.destroy}),this._emitter.off(),this.element.removeEventListener(SOURCE_EVENTS[this._sourceEvents].start,this._onStart,this._listenerOptions))}}class KeyboardSensor extends BaseSensor{constructor(t={}){super();const{moveDistance:e=25,startPredicate:i=(t=>{if(("Enter"===t.key||"Space"===t.key||" "===t.key)&&document.activeElement&&document.activeElement!==document.body){const{left:t,top:e}=document.activeElement.getBoundingClientRect();return{x:t,y:e}}return null}),movePredicate:s=((t,e,i)=>{if(!e.drag)return null;switch(t.key){case"ArrowLeft":return{x:e.drag.x-i,y:e.drag.y};case"ArrowRight":return{x:e.drag.x+i,y:e.drag.y};case"ArrowUp":return{x:e.drag.x,y:e.drag.y-i};case"ArrowDown":return{x:e.drag.x,y:e.drag.y+i};default:return null}}),cancelPredicate:n=((t,e)=>e.drag&&"Escape"===t.key?{x:e.drag.x,y:e.drag.y}:null),endPredicate:o=((t,e)=>!e.drag||"Enter"!==t.key&&"Space"!==t.key&&" "!==t.key?null:{x:e.drag.x,y:e.drag.y})}=t;this._moveDistance=e,this._startPredicate=i,this._movePredicate=s,this._cancelPredicate=n,this._endPredicate=o,this.cancel=this.cancel.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("blur",this.cancel),window.addEventListener("visibilitychange",this.cancel)}_onKeyDown(t){if(!this.drag){const e=this._startPredicate(t,this,this._moveDistance);return void(e&&(t.preventDefault(),this._start({type:"start",x:e.x,y:e.y,srcEvent:t})))}const e=this._cancelPredicate(t,this,this._moveDistance);if(e)return t.preventDefault(),void this._cancel({type:"cancel",x:e.x,y:e.y,srcEvent:t});const i=this._endPredicate(t,this,this._moveDistance);if(i)return t.preventDefault(),void this._end({type:"end",x:i.x,y:i.y,srcEvent:t});const s=this._movePredicate(t,this,this._moveDistance);return s?(t.preventDefault(),void this._move({type:"move",x:s.x,y:s.y,srcEvent:t})):void 0}updateSettings(t={}){void 0!==t.moveDistance&&(this._moveDistance=t.moveDistance),void 0!==t.startPredicate&&(this._startPredicate=t.startPredicate),void 0!==t.movePredicate&&(this._movePredicate=t.movePredicate),void 0!==t.cancelPredicate&&(this._cancelPredicate=t.cancelPredicate),void 0!==t.endPredicate&&(this._endPredicate=t.endPredicate)}destroy(){this.isDestroyed||(super.destroy(),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("blur",this.cancel),window.removeEventListener("visibilitychange",this.cancel))}}const KEY_TYPES=["start","cancel","end","moveLeft","moveRight","moveUp","moveDown"];function getEarliestTimestamp(t,e){if(!t.size||!e.size)return 1/0;let i=1/0;for(const s of t){const t=e.get(s);void 0!==t&&t<i&&(i=t)}return i}class KeyboardMotionSensor extends BaseMotionSensor{constructor(t={}){super();const{startPredicate:e=(()=>{if(document.activeElement){const{left:t,top:e}=document.activeElement.getBoundingClientRect();return{x:t,y:e}}return null}),computeSpeed:i=(()=>500),startKeys:s=[" ","Space","Enter"],moveLeftKeys:n=["ArrowLeft"],moveRightKeys:o=["ArrowRight"],moveUpKeys:r=["ArrowUp"],moveDownKeys:a=["ArrowDown"],cancelKeys:c=["Escape"],endKeys:h=[" ","Space","Enter"]}=t;this._computeSpeed=i,this._startPredicate=e,this._startKeys=new Set(s),this._cancelKeys=new Set(c),this._endKeys=new Set(h),this._moveLeftKeys=new Set(n),this._moveRightKeys=new Set(o),this._moveUpKeys=new Set(r),this._moveDownKeys=new Set(a),this._moveKeys=new Set([...n,...o,...r,...a]),this._moveKeyTimestamps=new Map,this._onKeyDown=this._onKeyDown.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onTick=this._onTick.bind(this),this.on("tick",this._onTick),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keyup",this._onKeyUp),window.addEventListener("blur",this.cancel),window.addEventListener("visibilitychange",this.cancel)}_end(t){this.drag&&(this._moveKeyTimestamps.clear(),super._end(t))}_cancel(t){this.drag&&(this._moveKeyTimestamps.clear(),super._cancel(t))}_updateDirection(){const t=getEarliestTimestamp(this._moveLeftKeys,this._moveKeyTimestamps),e=getEarliestTimestamp(this._moveRightKeys,this._moveKeyTimestamps),i=getEarliestTimestamp(this._moveUpKeys,this._moveKeyTimestamps),s=getEarliestTimestamp(this._moveDownKeys,this._moveKeyTimestamps);let n=t===e?0:t<e?-1:1,o=i===s?0:i<s?-1:1;if(0!==n&&0!==o){const t=1/(Math.sqrt(n*n+o*o)||1);n*=t,o*=t}this._direction.x=n,this._direction.y=o}_onTick(){this._speed=this._computeSpeed(this)}_onKeyUp(t){this._moveKeyTimestamps.get(t.key)&&(this._moveKeyTimestamps.delete(t.key),this._updateDirection())}_onKeyDown(t){if(this.drag)return this._cancelKeys.has(t.key)?(t.preventDefault(),void this._cancel({type:"cancel",x:this.drag.x,y:this.drag.y})):this._endKeys.has(t.key)?(t.preventDefault(),void this._end({type:"end",x:this.drag.x,y:this.drag.y})):this._moveKeys.has(t.key)?(t.preventDefault(),void(this._moveKeyTimestamps.get(t.key)||(this._moveKeyTimestamps.set(t.key,Date.now()),this._updateDirection()))):void 0;if(this._startKeys.has(t.key)){const e=this._startPredicate(t,this);e&&(t.preventDefault(),this._start({type:"start",x:e.x,y:e.y}))}}updateSettings(t={}){let e=!1;if(void 0!==t.startPredicate&&(this._startPredicate=t.startPredicate),void 0!==t.computeSpeed&&(this._computeSpeed=t.computeSpeed),KEY_TYPES.forEach(((i,s)=>{const n=`${i}Keys`,o=t[n];void 0!==o&&(this[`_${n}`]=new Set(o),s>=3&&(e=!0))})),e){const t=[...this._moveLeftKeys,...this._moveRightKeys,...this._moveUpKeys,...this._moveDownKeys];[...this._moveKeys].every(((e,i)=>t[i]===e))||(this._moveKeys=new Set(t),this._moveKeyTimestamps.clear(),this._updateDirection())}}destroy(){this.isDestroyed||(super.destroy(),this.off("tick",this._onTick),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),window.removeEventListener("blur",this.cancel),window.removeEventListener("visibilitychange",this.cancel))}}const STYLES_CACHE=new WeakMap;function getStyle(t,e){if(!e)return"";let i=STYLES_CACHE.get(t);return i||(i=window.getComputedStyle(t,null),STYLES_CACHE.set(t,i)),i.getPropertyValue(e)}function isContainingBlock(t){if("static"!==getStyle(t,"position"))return!0;const e=getStyle(t,"display");if("inline"===e||"none"===e)return!1;const i=getStyle(t,"transform");if(i&&"none"!==i)return!0;const s=getStyle(t,"perspective");if(s&&"none"!==s)return!0;const n=getStyle(t,"content-visibility");if(n&&("auto"===n||"hidden"===n))return!0;const o=getStyle(t,"contain");if(o&&("strict"===o||"content"===o||o.indexOf("paint")>-1||o.indexOf("layout")>-1))return!0;if(!IS_SAFARI){const e=getStyle(t,"filter");if(e&&"none"!==e)return!0;const i=getStyle(t,"will-change");if(i&&(i.indexOf("transform")>-1||i.indexOf("perspective")>-1))return!0}return!1}function getContainingBlock(t){let e=t||document;for(;e&&e!==document&&!isContainingBlock(t);)e=e.parentElement||document;return e}function getStyleAsFloat(t,e){return parseFloat(getStyle(t,e))||0}function getOffset(t,e={left:0,top:0}){if(e.left=0,e.top=0,t===document)return e;if(e.left=window.pageXOffset||0,e.top=window.pageYOffset||0,"self"in t&&t.self===window.self)return e;const{left:i,top:s}=t.getBoundingClientRect();return e.left+=i,e.top+=s,e.left+=getStyleAsFloat(t,"border-left-width"),e.top+=getStyleAsFloat(t,"border-top-width"),e}const offsetA={left:0,top:0},offsetB={left:0,top:0};function getOffsetDiff(t,e,i={left:0,top:0}){return i.left=0,i.top=0,t===e||(getOffset(t,offsetA),getOffset(e,offsetB),i.left=offsetB.left-offsetA.left,i.top=offsetB.top-offsetA.top),i}const IDENTITY_MATRIX="matrix(1, 0, 0, 1, 0, 0)",IDENTITY_MATRIX_3D="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)",SCROLL_LISTENER_OPTIONS=!HAS_PASSIVE_EVENTS||{capture:!0,passive:!0},OFFSET_DIFF={left:0,top:0},POSITION_CHANGE={x:0,y:0};var DraggableStartPredicateState;!function(t){t[t.PENDING=0]="PENDING",t[t.RESOLVED=1]="RESOLVED",t[t.REJECTED=2]="REJECTED"}(DraggableStartPredicateState||(DraggableStartPredicateState={}));class DraggableDragItem{constructor(t,e,i,s,n){this.element=t,this.rootParent=e,this.rootContainingBlock=i,this.dragParent=s,this.dragContainingBlock=n,this.x=0,this.y=0,this.pX=0,this.pY=0,this._updateDiffX=0,this._updateDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0,this._transform=""}}class DraggableDrag{constructor(){this.sensor=null,this.isEnded=!1,this.isStarted=!1,this.startEvent=null,this.nextMoveEvent=null,this.prevMoveEvent=null,this.endEvent=null,this.items=[]}}function getDefaultSettings$1(){return{container:null,startPredicate:()=>!0,getElements:()=>null,releaseElements:()=>{},getStartPosition:({item:t})=>{const e=getStyle(t.element,"transform");return t._transform=e&&"none"!==e&&e!==IDENTITY_MATRIX&&e!==IDENTITY_MATRIX_3D?e:"",{x:0,y:0}},setPosition:({item:t,x:e,y:i})=>{t.element.style.transform=`translate(${e}px, ${i}px) ${t._transform}`},getPositionChange:({event:t,prevEvent:e})=>(POSITION_CHANGE.x=t.x-e.x,POSITION_CHANGE.y=t.y-e.y,POSITION_CHANGE)}}class Draggable{constructor(t,e={}){this.sensors=t,this.settings=this._parseSettings(e),this.plugins={},this.drag=null,this.isDestroyed=!1,this._sensorData=new Map,this._emitter=new Emitter,this._startId=Symbol(),this._moveId=Symbol(),this._updateId=Symbol(),this._onMove=this._onMove.bind(this),this._onScroll=this._onScroll.bind(this),this._onEnd=this._onEnd.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._preparePositionUpdate=this._preparePositionUpdate.bind(this),this._applyPositionUpdate=this._applyPositionUpdate.bind(this),this.sensors.forEach((t=>{this._sensorData.set(t,{predicateState:DraggableStartPredicateState.PENDING,predicateEvent:null,onMove:e=>this._onMove(e,t),onEnd:e=>this._onEnd(e,t)});const{onMove:e,onEnd:i}=this._sensorData.get(t);t.on("start",e),t.on("move",e),t.on("cancel",i),t.on("end",i),t.on("destroy",i)}))}_parseSettings(t,e=getDefaultSettings$1()){const{container:i=e.container,startPredicate:s=e.startPredicate,getElements:n=e.getElements,releaseElements:o=e.releaseElements,getStartPosition:r=e.getStartPosition,setPosition:a=e.setPosition,getPositionChange:c=e.getPositionChange}=t||{};return{container:i,startPredicate:s,getElements:n,releaseElements:o,getStartPosition:r,setPosition:a,getPositionChange:c}}_emit(t,...e){this._emitter.emit(t,...e)}_onMove(t,e){const i=this._sensorData.get(e);if(i)switch(i.predicateState){case DraggableStartPredicateState.PENDING:{i.predicateEvent=t;const s=this.settings.startPredicate({draggable:this,sensor:e,event:t});!0===s?this.resolveStartPredicate(e):!1===s&&this.rejectStartPredicate(e);break}case DraggableStartPredicateState.RESOLVED:this.drag&&(this.drag.nextMoveEvent=t,ticker.once(tickerReadPhase,this._prepareMove,this._moveId),ticker.once(tickerWritePhase,this._applyMove,this._moveId))}}_onScroll(){this.updatePosition()}_onEnd(t,e){const i=this._sensorData.get(e);i&&(this.drag?i.predicateState===DraggableStartPredicateState.RESOLVED&&(this.drag.endEvent=t,this._sensorData.forEach((t=>{t.predicateState=DraggableStartPredicateState.PENDING,t.predicateEvent=null})),this.stop()):(i.predicateState=DraggableStartPredicateState.PENDING,i.predicateEvent=null))}_prepareStart(){const{drag:t}=this;if(!t||!t.startEvent)return;const e=this.settings.getElements({draggable:this,sensor:t.sensor,startEvent:t.startEvent})||[];t.items=e.map((e=>{if(!e.isConnected)throw new Error("Element is not connected");const i=e.parentNode,s=getContainingBlock(i),n=this.settings.container||i,o=n===i?s:getContainingBlock(n),r=new DraggableDragItem(e,i,s,n,o),a=e.getBoundingClientRect();if(r.x=a.left,r.y=a.top,s!==o){const{left:t,top:e}=getOffsetDiff(o,s,OFFSET_DIFF);r._containerDiffX=t,r._containerDiffY=e}const{x:c,y:h}=this.settings.getStartPosition({draggable:this,sensor:t.sensor,item:r});return r.pX=c,r.pY=h,r}))}_applyStart(){const t=this.drag;if(!t||!t.startEvent)return;if(this._emit("beforestart",t.startEvent),this.drag!==t)return;const{container:e}=this.settings;if(e)for(const i of t.items)i.element&&(i.element.parentNode!==e&&(e.appendChild(i.element),i.pX+=i._containerDiffX,i.pY+=i._containerDiffY),this.settings.setPosition({phase:"start",draggable:this,sensor:t.sensor,item:i,x:i.pX,y:i.pY}));window.addEventListener("scroll",this._onScroll,SCROLL_LISTENER_OPTIONS),t.isStarted=!0,this._emit("start",t.startEvent)}_prepareMove(){const{drag:t}=this;if(!t||!t.startEvent)return;const e=t.nextMoveEvent,i=t.prevMoveEvent||t.startEvent;if(e&&e!==i){for(const s of t.items){if(!s.element)continue;const{x:n,y:o}=this.settings.getPositionChange({draggable:this,sensor:t.sensor,item:s,startEvent:t.startEvent,prevEvent:i,event:e});n&&(s.pX=s.pX-s._moveDiffX+n,s.x=s.x-s._moveDiffX+n,s._moveDiffX=n),o&&(s.pY=s.pY-s._moveDiffY+o,s.y=s.y-s._moveDiffY+o,s._moveDiffY=o)}t.prevMoveEvent=e}}_applyMove(){const{drag:t}=this;if(t&&t.nextMoveEvent){for(const e of t.items)e._moveDiffX=0,e._moveDiffY=0;if(this._emit("beforemove",t.nextMoveEvent),this.drag===t){for(const e of t.items)e.element&&this.settings.setPosition({phase:"move",draggable:this,sensor:t.sensor,item:e,x:e.pX,y:e.pY});this._emit("move",t.nextMoveEvent)}}}_preparePositionUpdate(){const{drag:t}=this;if(t)for(const e of t.items){if(!e.element)continue;if(e.rootContainingBlock!==e.dragContainingBlock){const{left:t,top:i}=getOffsetDiff(e.dragContainingBlock,e.rootContainingBlock,OFFSET_DIFF);e._containerDiffX=t,e._containerDiffY=i}const{left:t,top:i}=e.element.getBoundingClientRect(),s=e.x-e._moveDiffX-t;e.pX=e.pX-e._updateDiffX+s,e._updateDiffX=s;const n=e.y-e._moveDiffY-i;e.pY=e.pY-e._updateDiffY+n,e._updateDiffY=n}}_applyPositionUpdate(){const{drag:t}=this;if(t)for(const e of t.items)e.element&&(e._updateDiffX=0,e._updateDiffY=0,this.settings.setPosition({phase:"move",draggable:this,sensor:t.sensor,item:e,x:e.pX,y:e.pY}))}on(t,e,i){return this._emitter.on(t,e,i)}off(t,e){this._emitter.off(t,e)}resolveStartPredicate(t,e){const i=this._sensorData.get(t);if(!i)return;const s=e||i.predicateEvent;i.predicateState===DraggableStartPredicateState.PENDING&&s&&(i.predicateState=DraggableStartPredicateState.RESOLVED,i.predicateEvent=null,this.drag=new DraggableDrag,this.drag.sensor=t,this.drag.startEvent=s,this._sensorData.forEach(((e,i)=>{i!==t&&(e.predicateState=DraggableStartPredicateState.REJECTED,e.predicateEvent=null)})),ticker.once(tickerReadPhase,this._prepareStart,this._startId),ticker.once(tickerWritePhase,this._applyStart,this._startId))}rejectStartPredicate(t){const e=this._sensorData.get(t);(null==e?void 0:e.predicateState)===DraggableStartPredicateState.PENDING&&(e.predicateState=DraggableStartPredicateState.REJECTED,e.predicateEvent=null)}stop(){const{drag:t}=this;if(t&&!t.isEnded){if(t.isEnded=!0,this._emit("beforeend",t.endEvent),ticker.off(tickerReadPhase,this._startId),ticker.off(tickerWritePhase,this._startId),ticker.off(tickerReadPhase,this._moveId),ticker.off(tickerWritePhase,this._moveId),ticker.off(tickerReadPhase,this._updateId),ticker.off(tickerWritePhase,this._updateId),t.isStarted){window.removeEventListener("scroll",this._onScroll,SCROLL_LISTENER_OPTIONS);const e=[];for(const i of t.items)i.element&&(e.push(i.element),i.rootParent&&i.element.parentNode!==i.rootParent&&(i.pX-=i._containerDiffX,i.pY-=i._containerDiffY,i._containerDiffX=0,i._containerDiffY=0,i.rootParent.appendChild(i.element)),this.settings.setPosition({phase:"end",draggable:this,sensor:t.sensor,item:i,x:i.pX,y:i.pY}));e.length&&this.settings.releaseElements({draggable:this,sensor:t.sensor,elements:e})}this._emit("end",t.endEvent),this.drag=null}}updatePosition(t=!1){this.drag&&(t?(this._preparePositionUpdate(),this._applyPositionUpdate()):(ticker.once(tickerReadPhase,this._preparePositionUpdate,this._updateId),ticker.once(tickerWritePhase,this._applyPositionUpdate,this._updateId)))}updateSettings(t={}){this.settings=this._parseSettings(t,this.settings)}use(t){return t(this)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.stop(),this._sensorData.forEach((({onMove:t,onEnd:e},i)=>{i.off("start",t),i.off("move",t),i.off("cancel",e),i.off("end",e),i.off("destroy",e)})),this._sensorData.clear(),this._emit("destroy"),this._emitter.off())}}class Pool{constructor(t,e){this._data=[],this._createObject=t,this._onPut=e}pick(){return this._data.length?this._data.pop():this._createObject()}put(t){-1===this._data.indexOf(t)&&(this._onPut&&this._onPut(t),this._data.push(t))}reset(){this._data.length=0}}function isRectsOverlapping(t,e){return!(t.right<=e.left||e.right<=t.left||t.bottom<=e.top||e.bottom<=t.top)}function getIntersectionArea(t,e){if(!isRectsOverlapping(t,e))return 0;return(Math.min(t.right,e.right)-Math.max(t.left,e.left))*(Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top))}function getIntersectionScore(t,e){const i=getIntersectionArea(t,e);if(!i)return 0;return i/(Math.min(t.width,e.width)*Math.min(t.height,e.height))*100}function isWindow(t){return t===window}function getContentRect(t,e={width:0,height:0,left:0,right:0,top:0,bottom:0}){if(isWindow(t))e.width=document.documentElement.clientWidth,e.height=document.documentElement.clientHeight,e.left=0,e.right=e.width,e.top=0,e.bottom=e.height;else{const{left:i,top:s}=t.getBoundingClientRect(),n=t.clientLeft||getStyleAsFloat(t,"border-left-width"),o=t.clientTop||getStyleAsFloat(t,"border-top-width");e.width=t.clientWidth,e.height=t.clientHeight,e.left=i+n,e.right=e.left+e.width,e.top=s+o,e.bottom=e.top+e.height}return e}function distanceBetweenPoints(t,e,i,s){return Math.sqrt(Math.pow(i-t,2)+Math.pow(s-e,2))}function getDistanceBetweenRects(t,e){return isRectsOverlapping(t,e)?0:t.right<e.left?t.bottom<e.top?distanceBetweenPoints(t.right,t.bottom,e.left,e.top):t.top>e.bottom?distanceBetweenPoints(t.right,t.top,e.left,e.bottom):e.left-t.right:t.left>e.right?t.bottom<e.top?distanceBetweenPoints(t.left,t.bottom,e.right,e.top):t.top>e.bottom?distanceBetweenPoints(t.left,t.top,e.right,e.bottom):t.left-e.right:t.bottom<e.top?e.top-t.bottom:t.top-e.bottom}function getScrollElement(t){return isWindow(t)||t===document.documentElement||t===document.body?window:t}function getScrollLeft(t){return isWindow(t)?t.pageXOffset:t.scrollLeft}function getScrollLeftMax(t){return isWindow(t)&&(t=document.documentElement),t.scrollWidth-t.clientWidth}function getScrollTop(t){return isWindow(t)?t.pageYOffset:t.scrollTop}function getScrollTopMax(t){return isWindow(t)&&(t=document.documentElement),t.scrollHeight-t.clientHeight}const R1={width:0,height:0,left:0,right:0,top:0,bottom:0},R2=Object.assign({},R1),R3=Object.assign({},R1),DEFAULT_THRESHOLD=50,SPEED_DATA={direction:"none",threshold:0,distance:0,value:0,maxValue:0,duration:0,speed:0,deltaTime:0,isEnding:!1},AUTO_SCROLL_AXIS={x:1,y:2},AUTO_SCROLL_AXIS_DIRECTION={forward:4,reverse:8},AUTO_SCROLL_DIRECTION_X={none:0,left:AUTO_SCROLL_AXIS.x|AUTO_SCROLL_AXIS_DIRECTION.reverse,right:AUTO_SCROLL_AXIS.x|AUTO_SCROLL_AXIS_DIRECTION.forward},AUTO_SCROLL_DIRECTION_Y={none:0,up:AUTO_SCROLL_AXIS.y|AUTO_SCROLL_AXIS_DIRECTION.reverse,down:AUTO_SCROLL_AXIS.y|AUTO_SCROLL_AXIS_DIRECTION.forward},AUTO_SCROLL_DIRECTION=Object.assign(Object.assign({},AUTO_SCROLL_DIRECTION_X),AUTO_SCROLL_DIRECTION_Y);function getDirectionAsString(t){switch(t){case AUTO_SCROLL_DIRECTION_X.none:case AUTO_SCROLL_DIRECTION_Y.none:return"none";case AUTO_SCROLL_DIRECTION_X.left:return"left";case AUTO_SCROLL_DIRECTION_X.right:return"right";case AUTO_SCROLL_DIRECTION_Y.up:return"up";case AUTO_SCROLL_DIRECTION_Y.down:return"down";default:throw new Error(`Unknown direction value: ${t}`)}}function getPaddedRect(t,e,i){let{left:s=0,right:n=0,top:o=0,bottom:r=0}=e;return s=Math.max(0,s),n=Math.max(0,n),o=Math.max(0,o),r=Math.max(0,r),i.width=t.width+s+n,i.height=t.height+o+r,i.left=t.left-s,i.top=t.top-o,i.right=t.right+n,i.bottom=t.bottom+r,i}function isScrolledToMax(t,e){return Math.ceil(t)>=Math.floor(e)}function computeThreshold(t,e){return Math.min(e/2,t)}function computeEdgeOffset(t,e,i,s){return Math.max(0,i+2*t+s*e-s)/2}class AutoScrollItemData{constructor(){this.positionX=0,this.positionY=0,this.directionX=AUTO_SCROLL_DIRECTION.none,this.directionY=AUTO_SCROLL_DIRECTION.none,this.overlapCheckRequestTime=0}}class AutoScrollAction{constructor(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}reset(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}addRequest(t){AUTO_SCROLL_AXIS.x&t.direction?(this.requestX&&this.removeRequest(this.requestX),this.requestX=t):(this.requestY&&this.removeRequest(this.requestY),this.requestY=t),t.action=this}removeRequest(t){this.requestX===t?(this.requestX=null,t.action=null):this.requestY===t&&(this.requestY=null,t.action=null)}computeScrollValues(){this.element&&(this.scrollLeft=this.requestX?this.requestX.value:getScrollLeft(this.element),this.scrollTop=this.requestY?this.requestY.value:getScrollTop(this.element))}scroll(){this.element&&(this.element.scrollTo?this.element.scrollTo(this.scrollLeft,this.scrollTop):(this.element.scrollLeft=this.scrollLeft,this.element.scrollTop=this.scrollTop))}}class AutoScrollRequest{constructor(){this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=0,this.value=NaN,this.maxValue=0,this.threshold=0,this.distance=0,this.deltaTime=0,this.speed=0,this.duration=0,this.action=null}reset(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=0,this.value=NaN,this.maxValue=0,this.threshold=0,this.distance=0,this.deltaTime=0,this.speed=0,this.duration=0,this.action=null}hasReachedEnd(){return AUTO_SCROLL_AXIS_DIRECTION.forward&this.direction?isScrolledToMax(this.value,this.maxValue):this.value<=0}computeCurrentScrollValue(){return this.element?this.value!=this.value?AUTO_SCROLL_AXIS.x&this.direction?getScrollLeft(this.element):getScrollTop(this.element):Math.max(0,Math.min(this.value,this.maxValue)):0}computeNextScrollValue(){const t=this.speed*(this.deltaTime/1e3),e=AUTO_SCROLL_AXIS_DIRECTION.forward&this.direction?this.value+t:this.value-t;return Math.max(0,Math.min(e,this.maxValue))}computeSpeed(){if(!this.item||!this.element)return 0;const{speed:t}=this.item;return"function"==typeof t?(SPEED_DATA.direction=getDirectionAsString(this.direction),SPEED_DATA.threshold=this.threshold,SPEED_DATA.distance=this.distance,SPEED_DATA.value=this.value,SPEED_DATA.maxValue=this.maxValue,SPEED_DATA.duration=this.duration,SPEED_DATA.speed=this.speed,SPEED_DATA.deltaTime=this.deltaTime,SPEED_DATA.isEnding=this.isEnding,t(this.element,SPEED_DATA)):t}tick(t){return this.isActive||(this.isActive=!0,this.onStart()),this.deltaTime=t,this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(),this.value=this.computeNextScrollValue(),this.duration+=t,this.value}onStart(){if(!this.item||!this.element)return;const{onStart:t}=this.item;"function"==typeof t&&t(this.element,getDirectionAsString(this.direction))}onStop(){if(!this.item||!this.element)return;const{onStop:t}=this.item;"function"==typeof t&&t(this.element,getDirectionAsString(this.direction))}}function autoScrollSmoothSpeed(t=500,e=.5,i=.25){const s=t*(e>0?1/e:1/0),n=t*(i>0?1/i:1/0);return function(e,i){let o=0;if(!i.isEnding)if(i.threshold>0){const e=i.threshold-Math.max(0,i.distance);o=t/i.threshold*e}else o=t;const r=i.speed;if(r===o)return o;let a=o;return r<o?(a=r+s*(i.deltaTime/1e3),Math.min(o,a)):(a=r-n*(i.deltaTime/1e3),Math.max(o,a))}}class AutoScroll{constructor(t={}){const{overlapCheckInterval:e=150}=t;this.items=[],this.settings={overlapCheckInterval:e},this._actions=[],this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._requests={[AUTO_SCROLL_AXIS.x]:new Map,[AUTO_SCROLL_AXIS.y]:new Map},this._itemData=new Map,this._requestPool=new Pool((()=>new AutoScrollRequest),(t=>t.reset())),this._actionPool=new Pool((()=>new AutoScrollAction),(t=>t.reset())),this._emitter=new Emitter,this._frameRead=this._frameRead.bind(this),this._frameWrite=this._frameWrite.bind(this)}_frameRead(t){this._isDestroyed||(t&&this._tickTime?(this._tickDeltaTime=t-this._tickTime,this._tickTime=t,this._updateItems(),this._updateRequests(),this._updateActions()):(this._tickTime=t,this._tickDeltaTime=0))}_frameWrite(){this._isDestroyed||this._applyActions()}_startTicking(){this._isTicking||(this._isTicking=!0,ticker.on(tickerReadPhase,this._frameRead),ticker.on(tickerWritePhase,this._frameWrite))}_stopTicking(){this._isTicking&&(this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,ticker.off(tickerReadPhase,this._frameRead),ticker.off(tickerWritePhase,this._frameWrite))}_getItemClientRect(t,e={width:0,height:0,left:0,right:0,top:0,bottom:0}){const{clientRect:i}=t;return e.left=i.left,e.top=i.top,e.width=i.width,e.height=i.height,e.right=i.left+i.width,e.bottom=i.top+i.height,e}_requestItemScroll(t,e,i,s,n,o,r){const a=this._requests[e];let c=a.get(t);c?c.element===i&&c.direction===s||c.reset():(c=this._requestPool.pick(),a.set(t,c)),c.item=t,c.element=i,c.direction=s,c.threshold=n,c.distance=o,c.maxValue=r}_cancelItemScroll(t,e){const i=this._requests[e],s=i.get(t);s&&(s.action&&s.action.removeRequest(s),this._requestPool.put(s),i.delete(t))}_checkItemOverlap(t,e,i){const{inertAreaSize:s,targets:n}=t;if(!n.length)return e&&this._cancelItemScroll(t,AUTO_SCROLL_AXIS.x),void(i&&this._cancelItemScroll(t,AUTO_SCROLL_AXIS.y));const o=this._itemData.get(t),r=o.directionX,a=o.directionY;if(!r&&!a)return e&&this._cancelItemScroll(t,AUTO_SCROLL_AXIS.x),void(i&&this._cancelItemScroll(t,AUTO_SCROLL_AXIS.y));const c=this._getItemClientRect(t,R1);let h=null,l=-1/0,d=0,_=-1/0,u=AUTO_SCROLL_DIRECTION.none,g=0,p=0,m=null,S=-1/0,f=0,E=-1/0,v=AUTO_SCROLL_DIRECTION.none,T=0,O=0,y=0;for(;y<n.length;y++){const t=n[y],o="number"==typeof t.threshold?t.threshold:50,L=!(!e||!r||"y"===t.axis),R=!(!i||!a||"x"===t.axis),D=t.priority||0;if((!L||D<l)&&(!R||D<S))continue;const I=getScrollElement(t.element||t),A=L?getScrollLeftMax(I):-1,C=R?getScrollTopMax(I):-1;if(A<=0&&C<=0)continue;const P=getContentRect(I,R2);let w=getIntersectionScore(c,P)||-1/0;if(w===-1/0){if(!t.padding||!isRectsOverlapping(c,getPaddedRect(P,t.padding,R3)))continue;w=-getDistanceBetweenRects(c,P)}if(L&&D>=l&&A>0&&(D>l||w>_)){let t=0,e=AUTO_SCROLL_DIRECTION.none;const i=computeThreshold(o,P.width),n=computeEdgeOffset(i,s,c.width,P.width);r===AUTO_SCROLL_DIRECTION.right?(t=P.right+n-c.right,t<=i&&!isScrolledToMax(getScrollLeft(I),A)&&(e=AUTO_SCROLL_DIRECTION.right)):r===AUTO_SCROLL_DIRECTION.left&&(t=c.left-(P.left-n),t<=i&&getScrollLeft(I)>0&&(e=AUTO_SCROLL_DIRECTION.left)),e&&(h=I,l=D,d=i,_=w,u=e,g=t,p=A)}if(R&&D>=S&&C>0&&(D>S||w>E)){let t=0,e=AUTO_SCROLL_DIRECTION_Y.none;const i=computeThreshold(o,P.height),n=computeEdgeOffset(i,s,c.height,P.height);a===AUTO_SCROLL_DIRECTION.down?(t=P.bottom+n-c.bottom,t<=i&&!isScrolledToMax(getScrollTop(I),C)&&(e=AUTO_SCROLL_DIRECTION.down)):a===AUTO_SCROLL_DIRECTION.up&&(t=c.top-(P.top-n),t<=i&&getScrollTop(I)>0&&(e=AUTO_SCROLL_DIRECTION.up)),e&&(m=I,S=D,f=i,E=w,v=e,T=t,O=C)}}e&&(h&&u?this._requestItemScroll(t,AUTO_SCROLL_AXIS.x,h,u,d,g,p):this._cancelItemScroll(t,AUTO_SCROLL_AXIS.x)),i&&(m&&v?this._requestItemScroll(t,AUTO_SCROLL_AXIS.y,m,v,f,T,O):this._cancelItemScroll(t,AUTO_SCROLL_AXIS.y))}_updateScrollRequest(t){const e=t.item,{inertAreaSize:i,smoothStop:s,targets:n}=e,o=this._getItemClientRect(e,R1);let r=null,a=0;for(;a<n.length;a++){const e=n[a],s=getScrollElement(e.element||e);if(s!==t.element)continue;const c=!!(AUTO_SCROLL_AXIS.x&t.direction);if(c){if("y"===e.axis)continue}else if("x"===e.axis)continue;const h=c?getScrollLeftMax(s):getScrollTopMax(s);if(h<=0)break;const l=getContentRect(s,R2);if((getIntersectionScore(o,l)||-1/0)===-1/0){const t=e.scrollPadding||e.padding;if(!t||!isRectsOverlapping(o,getPaddedRect(l,t,R3)))break}const d=computeThreshold("number"==typeof e.threshold?e.threshold:50,c?l.width:l.height),_=computeEdgeOffset(d,i,c?o.width:o.height,c?l.width:l.height);let u=0;if(u=t.direction===AUTO_SCROLL_DIRECTION.left?o.left-(l.left-_):t.direction===AUTO_SCROLL_DIRECTION.right?l.right+_-o.right:t.direction===AUTO_SCROLL_DIRECTION.up?o.top-(l.top-_):l.bottom+_-o.bottom,u>d)break;const g=c?getScrollLeft(s):getScrollTop(s);if(r=AUTO_SCROLL_AXIS_DIRECTION.forward&t.direction?isScrolledToMax(g,h):g<=0,r)break;return t.maxValue=h,t.threshold=d,t.distance=u,t.isEnding=!1,!0}return!0===s&&t.speed>0?(null===r&&(r=t.hasReachedEnd()),t.isEnding=!r):t.isEnding=!1,t.isEnding}_updateItems(){for(let t=0;t<this.items.length;t++){const e=this.items[t],i=this._itemData.get(e),{x:s,y:n}=e.position,o=i.positionX,r=i.positionY;s===o&&n===r||(i.directionX=s>o?AUTO_SCROLL_DIRECTION.right:s<o?AUTO_SCROLL_DIRECTION.left:i.directionX,i.directionY=n>r?AUTO_SCROLL_DIRECTION.down:n<r?AUTO_SCROLL_DIRECTION.up:i.directionY,i.positionX=s,i.positionY=n,0===i.overlapCheckRequestTime&&(i.overlapCheckRequestTime=this._tickTime))}}_updateRequests(){const t=this.items,e=this._requests[AUTO_SCROLL_AXIS.x],i=this._requests[AUTO_SCROLL_AXIS.y];let s=0;for(;s<t.length;s++){const n=t[s],o=this._itemData.get(n),r=o.overlapCheckRequestTime;let a=r>0&&this._tickTime-r>this.settings.overlapCheckInterval,c=!0;const h=e.get(n);h&&h.isActive&&(c=!this._updateScrollRequest(h),c&&(a=!0,this._cancelItemScroll(n,AUTO_SCROLL_AXIS.x)));let l=!0;const d=i.get(n);d&&d.isActive&&(l=!this._updateScrollRequest(d),l&&(a=!0,this._cancelItemScroll(n,AUTO_SCROLL_AXIS.y))),a&&(o.overlapCheckRequestTime=0,this._checkItemOverlap(n,c,l))}}_requestAction(t,e){const i=e===AUTO_SCROLL_AXIS.x;let s=null,n=0;for(;n<this._actions.length;n++){if(s=this._actions[n],t.element===s.element){if(i?s.requestX:s.requestY)return void this._cancelItemScroll(t.item,e);break}s=null}s||(s=this._actionPool.pick()),s.element=t.element,s.addRequest(t),t.tick(this._tickDeltaTime),this._actions.push(s)}_updateActions(){let t=0;for(t=0;t<this.items.length;t++){const e=this.items[t],i=this._requests[AUTO_SCROLL_AXIS.x].get(e),s=this._requests[AUTO_SCROLL_AXIS.y].get(e);i&&this._requestAction(i,AUTO_SCROLL_AXIS.x),s&&this._requestAction(s,AUTO_SCROLL_AXIS.y)}for(t=0;t<this._actions.length;t++)this._actions[t].computeScrollValues()}_applyActions(){if(!this._actions.length)return;this._emitter.emit("beforescroll");let t,e=0;for(e=0;e<this._actions.length;e++)this._actions[e].scroll(),this._actionPool.put(this._actions[e]);for(this._actions.length=0,e=0;e<this.items.length;e++)t=this.items[e],t.onPrepareScrollEffect&&t.onPrepareScrollEffect();for(e=0;e<this.items.length;e++)t=this.items[e],t.onApplyScrollEffect&&t.onApplyScrollEffect();this._emitter.emit("afterscroll")}on(t,e){return this._emitter.on(t,e)}off(t,e){this._emitter.off(t,e)}addItem(t){if(this._isDestroyed||this._itemData.has(t))return;const{x:e,y:i}=t.position,s=new AutoScrollItemData;s.positionX=e,s.positionY=i,s.directionX=AUTO_SCROLL_DIRECTION.none,s.directionY=AUTO_SCROLL_DIRECTION.none,s.overlapCheckRequestTime=this._tickTime,this._itemData.set(t,s),this.items.push(t),this._isTicking||this._startTicking()}removeItem(t){if(this._isDestroyed)return;const e=this.items.indexOf(t);-1!==e&&(this._requests[AUTO_SCROLL_AXIS.x].get(t)&&(this._cancelItemScroll(t,AUTO_SCROLL_AXIS.x),this._requests[AUTO_SCROLL_AXIS.x].delete(t)),this._requests[AUTO_SCROLL_AXIS.y].get(t)&&(this._cancelItemScroll(t,AUTO_SCROLL_AXIS.y),this._requests[AUTO_SCROLL_AXIS.y].delete(t)),this._itemData.delete(t),this.items.splice(e,1),this._isTicking&&!this.items.length&&this._stopTicking())}isDestroyed(){return this._isDestroyed}isItemScrollingX(t){var e;return!!(null===(e=this._requests[AUTO_SCROLL_AXIS.x].get(t))||void 0===e?void 0:e.isActive)}isItemScrollingY(t){var e;return!!(null===(e=this._requests[AUTO_SCROLL_AXIS.y].get(t))||void 0===e?void 0:e.isActive)}isItemScrolling(t){return this.isItemScrollingX(t)||this.isItemScrollingY(t)}updateSettings(t={}){const{overlapCheckInterval:e=this.settings.overlapCheckInterval}=t;this.settings.overlapCheckInterval=e}destroy(){if(this._isDestroyed)return;const t=this.items.slice(0);let e=0;for(;e<t.length;e++)this.removeItem(t[e]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._emitter.off(),this._isDestroyed=!0}}const autoScroll=new AutoScroll,AUTOSCROLL_POSITION={x:0,y:0},AUTOSCROLL_CLIENT_RECT={left:0,top:0,width:0,height:0};function getDefaultSettings(){return{targets:[],inertAreaSize:.2,speed:autoScrollSmoothSpeed(),smoothStop:!1,getPosition:t=>{const{drag:e}=t,i=null==e?void 0:e.items[0];if(i)AUTOSCROLL_POSITION.x=i.pX,AUTOSCROLL_POSITION.y=i.pY;else{const t=e&&(e.nextMoveEvent||e.startEvent);AUTOSCROLL_POSITION.x=t?t.x:0,AUTOSCROLL_POSITION.y=t?t.y:0}return AUTOSCROLL_POSITION},getClientRect:t=>{const{drag:e}=t,i=null==e?void 0:e.items[0];if(i&&i.element){const{left:t,top:e,width:s,height:n}=i.element.getBoundingClientRect();AUTOSCROLL_CLIENT_RECT.left=t,AUTOSCROLL_CLIENT_RECT.top=e,AUTOSCROLL_CLIENT_RECT.width=s,AUTOSCROLL_CLIENT_RECT.height=n}else{const t=e&&(e.nextMoveEvent||e.startEvent);AUTOSCROLL_CLIENT_RECT.left=t?t.x-25:0,AUTOSCROLL_CLIENT_RECT.top=t?t.y-25:0,AUTOSCROLL_CLIENT_RECT.width=t?50:0,AUTOSCROLL_CLIENT_RECT.height=t?50:0}return AUTOSCROLL_CLIENT_RECT},onStart:null,onStop:null}}class DraggableAutoScrollProxy{constructor(t,e){this._draggableAutoScroll=t,this._draggable=e,this._position={x:0,y:0},this._clientRect={left:0,top:0,width:0,height:0}}_getSettings(){return this._draggableAutoScroll.settings}get targets(){let{targets:t}=this._getSettings();return"function"==typeof t&&(t=t(this._draggable)),t}get position(){let{getPosition:t}=this._getSettings();if("function"==typeof t){const e=t(this._draggable);this._position.x=e.x,this._position.y=e.y}else this._position.x=0,this._position.y=0;return this._position}get clientRect(){let{getClientRect:t}=this._getSettings();if("function"==typeof t){const{left:e,top:i,width:s,height:n}=t(this._draggable);this._clientRect.left=e,this._clientRect.top=i,this._clientRect.width=s,this._clientRect.height=n}else this._clientRect.left=0,this._clientRect.top=0,this._clientRect.width=0,this._clientRect.height=0;return this._clientRect}get inertAreaSize(){return this._getSettings().inertAreaSize}get smoothStop(){return this._getSettings().smoothStop}get speed(){return this._getSettings().speed}get onStart(){return this._getSettings().onStart}get onStop(){return this._getSettings().onStop}onPrepareScrollEffect(){const t=this._draggable._updateId;ticker.off(tickerReadPhase,t),ticker.off(tickerWritePhase,t),this._draggable._preparePositionUpdate()}onApplyScrollEffect(){this._draggable._applyPositionUpdate()}}class DraggableAutoScroll{constructor(t,e={}){this.name="autoscroll",this.version="0.0.2",this.settings=this._parseSettings(e),this._autoScrollProxy=null,t.on("start",(()=>{this._autoScrollProxy||(this._autoScrollProxy=new DraggableAutoScrollProxy(this,t),autoScroll.addItem(this._autoScrollProxy))})),t.on("beforeend",(()=>{this._autoScrollProxy&&(autoScroll.removeItem(this._autoScrollProxy),this._autoScrollProxy=null)}))}_parseSettings(t,e=getDefaultSettings()){const{targets:i=e.targets,inertAreaSize:s=e.inertAreaSize,speed:n=e.speed,smoothStop:o=e.smoothStop,getPosition:r=e.getPosition,getClientRect:a=e.getClientRect,onStart:c=e.onStart,onStop:h=e.onStop}=t||{};return{targets:i,inertAreaSize:s,speed:n,smoothStop:o,getPosition:r,getClientRect:a,onStart:c,onStop:h}}updateSettings(t={}){this.settings=this._parseSettings(t,this.settings)}}function autoScrollPlugin(t){return e=>{const i=new DraggableAutoScroll(e,t),s=e;return s.plugins[i.name]=i,s}}const SCROLLABLE_OVERFLOWS=new Set(["auto","scroll","overlay"]);function isScrollable(t){return!!(SCROLLABLE_OVERFLOWS.has(getStyle(t,"overflow"))||SCROLLABLE_OVERFLOWS.has(getStyle(t,"overflow-x"))||SCROLLABLE_OVERFLOWS.has(getStyle(t,"overflow-y")))}function getScrollableAncestors(t,e=[]){let i=null;for(;t&&(i=t.parentNode,i&&!(i instanceof Document));)isScrollable(t="host"in i?i.host:i)&&e.push(t);return e.push(window),e}function getScrollables(t){const e=[];return isScrollable(t)&&e.push(t),getScrollableAncestors(t,e),e}function createPointerSensorStartPredicate(t={}){let e,i,s=0,n=null;const{timeout:o=250,fallback:r=(()=>!0)}=t,a=t=>t.preventDefault(),c=t=>{s&&(e?t.cancelable&&t.preventDefault():void 0===e&&(t.cancelable&&t.timeStamp-s>o?(e=!0,t.preventDefault()):e=!1))};return t=>{if(!(t.sensor instanceof PointerSensor))return r(t);const{draggable:h,sensor:l,event:d}=t,_=d;if("touch"===_.pointerType){if("start"===_.type&&("pointerdown"===_.srcEvent.type||"touchstart"===_.srcEvent.type)){n=_.target;const t=n?getScrollables(n):[];t.forEach((t=>{t.addEventListener("touchmove",c,{passive:!1,capture:!0})}));const r=()=>{s&&(h.off("beforeend",r),h.sensors.forEach((t=>{t instanceof PointerSensor&&t.off("end",r)})),null==n||n.removeEventListener("contextmenu",a),t.forEach((t=>{t.removeEventListener("touchmove",c,{capture:!0})})),s=0,e=void 0,n=null,i=void window.clearTimeout(i))};e=void 0,s=_.srcEvent.timeStamp,null==n||n.addEventListener("contextmenu",a),h.on("beforeend",r),h.sensors.forEach((t=>{t instanceof PointerSensor&&t.off("end",r)})),o>0&&(i=window.setTimeout((()=>{h.resolveStartPredicate(l),e=!0,i=void 0}),o))}return e}return"start"===_.type&&!_.srcEvent.button}}export{AUTO_SCROLL_AXIS,AUTO_SCROLL_AXIS_DIRECTION,AUTO_SCROLL_DIRECTION,AutoScroll,BaseMotionSensor,BaseSensor,Draggable,DraggableAutoScroll,KeyboardMotionSensor,KeyboardSensor,PointerSensor,SensorEventType,autoScroll,autoScrollPlugin,autoScrollSmoothSpeed,createPointerSensorStartPredicate,setTicker,ticker,tickerReadPhase,tickerWritePhase}; | ||
var _={start:"start",move:"move",cancel:"cancel",end:"end",destroy:"destroy"};import{Emitter as tt}from"eventti";var W=class{constructor(){this.drag=null,this.isDestroyed=!1,this._emitter=new tt}_createDragData(e){return{x:e.x,y:e.y}}_updateDragData(e){this.drag&&(this.drag.x=e.x,this.drag.y=e.y)}_resetDragData(){this.drag=null}_start(e){this.isDestroyed||this.drag||(this.drag=this._createDragData(e),this._emitter.emit(_.start,e))}_move(e){this.drag&&(this._updateDragData(e),this._emitter.emit(_.move,e))}_end(e){this.drag&&(this._updateDragData(e),this._emitter.emit(_.end,e),this._resetDragData())}_cancel(e){this.drag&&(this._updateDragData(e),this._emitter.emit(_.cancel,e),this._resetDragData())}on(e,t,n){return this._emitter.on(e,t,n)}off(e,t){this._emitter.off(e,t)}cancel(){this.drag&&(this._emitter.emit(_.cancel,{type:_.cancel,x:this.drag.x,y:this.drag.y}),this._resetDragData())}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.cancel(),this._emitter.emit(_.destroy,{type:_.destroy}),this._emitter.off())}};import{Ticker as nt}from"tikki";var v=Symbol(),D=Symbol(),u=new nt({phases:[v,D]});function wt(i,e,t){v=e,D=t,u=i}var $=class extends W{constructor(){super();this.drag=null,this._direction={x:0,y:0},this._speed=0,this._tick=this._tick.bind(this)}_createDragData(t){return{...super._createDragData(t),time:0,deltaTime:0}}_start(t){this.isDestroyed||this.drag||(super._start(t),u.on(v,this._tick))}_end(t){this.drag&&(u.off(v,this._tick),super._end(t))}_cancel(t){this.drag&&(u.off(v,this._tick),super._cancel(t))}_tick(t){if(this.drag)if(t&&this.drag.time){this.drag.deltaTime=t-this.drag.time,this.drag.time=t;let n={type:"tick",time:this.drag.time,deltaTime:this.drag.deltaTime};if(this._emitter.emit("tick",n),!this.drag)return;let r=this._speed*(this.drag.deltaTime/1e3),s=this._direction.x*r,o=this._direction.y*r;(s||o)&&this._move({type:"move",x:this.drag.x+s,y:this.drag.y+o})}else this.drag.time=t,this.drag.deltaTime=0}};import{Emitter as rt}from"eventti";function de(i,e){if("pointerId"in i)return i.pointerId===e?i:null;if("changedTouches"in i){let t=0;for(;t<i.changedTouches.length;t++)if(i.changedTouches[t].identifier===e)return i.changedTouches[t];return null}return i}function Re(i){return"pointerType"in i?i.pointerType:"touches"in i?"touch":"mouse"}function Me(i){return"pointerId"in i?i.pointerId:"changedTouches"in i?i.changedTouches[0]?i.changedTouches[0].identifier:null:-1}var he=typeof window<"u"&&typeof window.document<"u",J=(()=>{let i=!1;try{let e=Object.defineProperty({},"passive",{get:function(){i=!0}});window.addEventListener("testPassive",null,e),window.removeEventListener("testPassive",null,e)}catch{}return i})(),Oe=he&&"ontouchstart"in window,We=he&&!!window.PointerEvent,Ot=!!(he&&navigator.vendor&&navigator.vendor.indexOf("Apple")>-1&&navigator.userAgent&&navigator.userAgent.indexOf("CriOS")==-1&&navigator.userAgent.indexOf("FxiOS")==-1);function me(i={}){let{capture:e=!0,passive:t=!0}=i;return J?{capture:e,passive:t}:{capture:e}}function ue(i){return i==="auto"||i===void 0?We?"pointer":Oe?"touch":"mouse":i}var it={start:"pointerdown",move:"pointermove",cancel:"pointercancel",end:"pointerup"},ot={start:"touchstart",move:"touchmove",cancel:"touchcancel",end:"touchend"},st={start:"mousedown",move:"mousemove",cancel:"",end:"mouseup"},X={pointer:it,touch:ot,mouse:st},Y=class{constructor(e,t={}){let{listenerOptions:n={},sourceEvents:r="auto",startPredicate:s=o=>!("button"in o&&o.button>0)}=t;this.element=e,this.drag=null,this.isDestroyed=!1,this._areWindowListenersBound=!1,this._startPredicate=s,this._listenerOptions=me(n),this._sourceEvents=ue(r),this._emitter=new rt,this._onStart=this._onStart.bind(this),this._onMove=this._onMove.bind(this),this._onCancel=this._onCancel.bind(this),this._onEnd=this._onEnd.bind(this),e.addEventListener(X[this._sourceEvents].start,this._onStart,this._listenerOptions)}_getTrackedPointerEventData(e){return this.drag?de(e,this.drag.pointerId):null}_onStart(e){if(this.isDestroyed||this.drag||!this._startPredicate(e))return;let t=Me(e);if(t===null)return;let n=de(e,t);if(n===null)return;let r={pointerId:t,pointerType:Re(e),x:n.clientX,y:n.clientY};this.drag=r;let s={...r,type:_.start,srcEvent:e,target:n.target};this._emitter.emit(s.type,s),this.drag&&this._bindWindowListeners()}_onMove(e){if(!this.drag)return;let t=this._getTrackedPointerEventData(e);if(!t)return;this.drag.x=t.clientX,this.drag.y=t.clientY;let n={type:_.move,srcEvent:e,target:t.target,...this.drag};this._emitter.emit(n.type,n)}_onCancel(e){if(!this.drag)return;let t=this._getTrackedPointerEventData(e);if(!t)return;this.drag.x=t.clientX,this.drag.y=t.clientY;let n={type:_.cancel,srcEvent:e,target:t.target,...this.drag};this._emitter.emit(n.type,n),this._resetDrag()}_onEnd(e){if(!this.drag)return;let t=this._getTrackedPointerEventData(e);if(!t)return;this.drag.x=t.clientX,this.drag.y=t.clientY;let n={type:_.end,srcEvent:e,target:t.target,...this.drag};this._emitter.emit(n.type,n),this._resetDrag()}_bindWindowListeners(){if(this._areWindowListenersBound)return;let{move:e,end:t,cancel:n}=X[this._sourceEvents];window.addEventListener(e,this._onMove,this._listenerOptions),window.addEventListener(t,this._onEnd,this._listenerOptions),n&&window.addEventListener(n,this._onCancel,this._listenerOptions),this._areWindowListenersBound=!0}_unbindWindowListeners(){if(this._areWindowListenersBound){let{move:e,end:t,cancel:n}=X[this._sourceEvents];window.removeEventListener(e,this._onMove,this._listenerOptions),window.removeEventListener(t,this._onEnd,this._listenerOptions),n&&window.removeEventListener(n,this._onCancel,this._listenerOptions),this._areWindowListenersBound=!1}}_resetDrag(){this.drag=null,this._unbindWindowListeners()}cancel(){if(!this.drag)return;let e={type:_.cancel,srcEvent:null,target:null,...this.drag};this._emitter.emit(e.type,e),this._resetDrag()}updateSettings(e){if(this.isDestroyed)return;let{listenerOptions:t,sourceEvents:n,startPredicate:r}=e,s=ue(n),o=me(t);r&&this._startPredicate!==r&&(this._startPredicate=r),(t&&(this._listenerOptions.capture!==o.capture||this._listenerOptions.passive===o.passive)||n&&this._sourceEvents!==s)&&(this.element.removeEventListener(X[this._sourceEvents].start,this._onStart,this._listenerOptions),this._unbindWindowListeners(),this.cancel(),n&&(this._sourceEvents=s),t&&o&&(this._listenerOptions=o),this.element.addEventListener(X[this._sourceEvents].start,this._onStart,this._listenerOptions))}on(e,t,n){return this._emitter.on(e,t,n)}off(e,t){this._emitter.off(e,t)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.cancel(),this._emitter.emit(_.destroy,{type:_.destroy}),this._emitter.off(),this.element.removeEventListener(X[this._sourceEvents].start,this._onStart,this._listenerOptions))}};var Xe=class extends W{constructor(t={}){super();let{moveDistance:n=25,startPredicate:r=l=>{if((l.key==="Enter"||l.key===" ")&&document.activeElement&&document.activeElement!==document.body){let{left:a,top:d}=document.activeElement.getBoundingClientRect();return{x:a,y:d}}return null},movePredicate:s=(l,a,d)=>{if(!a.drag)return null;switch(l.key){case"ArrowLeft":return{x:a.drag.x-d.x,y:a.drag.y};case"ArrowRight":return{x:a.drag.x+d.x,y:a.drag.y};case"ArrowUp":return{x:a.drag.x,y:a.drag.y-d.y};case"ArrowDown":return{x:a.drag.x,y:a.drag.y+d.y};default:return null}},cancelPredicate:o=(l,a)=>a.drag&&l.key==="Escape"?{x:a.drag.x,y:a.drag.y}:null,endPredicate:c=(l,a)=>a.drag&&(l.key==="Enter"||l.key===" ")?{x:a.drag.x,y:a.drag.y}:null}=t;this._moveDistance=typeof n=="number"?{x:n,y:n}:{...n},this._startPredicate=r,this._movePredicate=s,this._cancelPredicate=o,this._endPredicate=c,this.cancel=this.cancel.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("keydown",this._onKeyDown),window.addEventListener("blur",this.cancel),window.addEventListener("visibilitychange",this.cancel)}_onKeyDown(t){if(!this.drag){let o=this._startPredicate(t,this,this._moveDistance);o&&(t.preventDefault(),this._start({type:"start",x:o.x,y:o.y,srcEvent:t}));return}let n=this._cancelPredicate(t,this,this._moveDistance);if(n){t.preventDefault(),this._cancel({type:"cancel",x:n.x,y:n.y,srcEvent:t});return}let r=this._endPredicate(t,this,this._moveDistance);if(r){t.preventDefault(),this._end({type:"end",x:r.x,y:r.y,srcEvent:t});return}let s=this._movePredicate(t,this,this._moveDistance);if(s){t.preventDefault(),this._move({type:"move",x:s.x,y:s.y,srcEvent:t});return}}updateSettings(t={}){t.moveDistance!==void 0&&(typeof t.moveDistance=="number"?(this._moveDistance.x=t.moveDistance,this._moveDistance.y=t.moveDistance):(this._moveDistance.x=t.moveDistance.x,this._moveDistance.y=t.moveDistance.y)),t.startPredicate!==void 0&&(this._startPredicate=t.startPredicate),t.movePredicate!==void 0&&(this._movePredicate=t.movePredicate),t.cancelPredicate!==void 0&&(this._cancelPredicate=t.cancelPredicate),t.endPredicate!==void 0&&(this._endPredicate=t.endPredicate)}destroy(){this.isDestroyed||(super.destroy(),document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("blur",this.cancel),window.removeEventListener("visibilitychange",this.cancel))}};var at=["start","cancel","end","moveLeft","moveRight","moveUp","moveDown"];function Q(i,e){if(!i.size||!e.size)return 1/0;let t=1/0;for(let n of i){let r=e.get(n);r!==void 0&&r<t&&(t=r)}return t}var Ye=class extends ${constructor(t={}){super();let{startPredicate:n=()=>{if(document.activeElement){let{left:y,top:g}=document.activeElement.getBoundingClientRect();return{x:y,y:g}}return null},computeSpeed:r=()=>500,startKeys:s=[" ","Enter"],moveLeftKeys:o=["ArrowLeft"],moveRightKeys:c=["ArrowRight"],moveUpKeys:l=["ArrowUp"],moveDownKeys:a=["ArrowDown"],cancelKeys:d=["Escape"],endKeys:m=[" ","Enter"]}=t;this._computeSpeed=r,this._startPredicate=n,this._startKeys=new Set(s),this._cancelKeys=new Set(d),this._endKeys=new Set(m),this._moveLeftKeys=new Set(o),this._moveRightKeys=new Set(c),this._moveUpKeys=new Set(l),this._moveDownKeys=new Set(a),this._moveKeys=new Set([...o,...c,...l,...a]),this._moveKeyTimestamps=new Map,this._onKeyDown=this._onKeyDown.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onTick=this._onTick.bind(this),this.on("tick",this._onTick),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("keyup",this._onKeyUp),window.addEventListener("blur",this.cancel),window.addEventListener("visibilitychange",this.cancel)}_end(t){this.drag&&(this._moveKeyTimestamps.clear(),this._direction.x=0,this._direction.y=0,super._end(t))}_cancel(t){this.drag&&(this._moveKeyTimestamps.clear(),this._direction.x=0,this._direction.y=0,super._cancel(t))}_updateDirection(){let t=Q(this._moveLeftKeys,this._moveKeyTimestamps),n=Q(this._moveRightKeys,this._moveKeyTimestamps),r=Q(this._moveUpKeys,this._moveKeyTimestamps),s=Q(this._moveDownKeys,this._moveKeyTimestamps),o=t===n?0:t<n?-1:1,c=r===s?0:r<s?-1:1;if(!(o===0||c===0)){let l=1/(Math.sqrt(o*o+c*c)||1);o*=l,c*=l}this._direction.x=o,this._direction.y=c}_onTick(){this._speed=this._computeSpeed(this)}_onKeyUp(t){this._moveKeyTimestamps.get(t.key)&&(this._moveKeyTimestamps.delete(t.key),this._updateDirection())}_onKeyDown(t){if(!this.drag){if(this._startKeys.has(t.key)){let n=this._startPredicate(t,this);n&&(t.preventDefault(),this._start({type:"start",x:n.x,y:n.y}))}return}if(this._cancelKeys.has(t.key)){t.preventDefault(),this._cancel({type:"cancel",x:this.drag.x,y:this.drag.y});return}if(this._endKeys.has(t.key)){t.preventDefault(),this._end({type:"end",x:this.drag.x,y:this.drag.y});return}if(this._moveKeys.has(t.key)){t.preventDefault(),this._moveKeyTimestamps.get(t.key)||(this._moveKeyTimestamps.set(t.key,Date.now()),this._updateDirection());return}}updateSettings(t={}){let n=!1;if(t.startPredicate!==void 0&&(this._startPredicate=t.startPredicate),t.computeSpeed!==void 0&&(this._computeSpeed=t.computeSpeed),at.forEach((r,s)=>{let o=`${r}Keys`,c=t[o];c!==void 0&&(this[`_${o}`]=new Set(c),s>=3&&(n=!0))}),n){let r=[...this._moveLeftKeys,...this._moveRightKeys,...this._moveUpKeys,...this._moveDownKeys];[...this._moveKeys].every((o,c)=>r[c]===o)||(this._moveKeys=new Set(r),this._moveKeyTimestamps.clear(),this._updateDirection())}}destroy(){this.isDestroyed||(super.destroy(),this.off("tick",this._onTick),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),window.removeEventListener("blur",this.cancel),window.removeEventListener("visibilitychange",this.cancel))}};import{Emitter as lt}from"eventti";import{getOffsetContainer as Ve}from"mezr";var Z=class{constructor(){this.sensor=null,this.isEnded=!1,this.isStarted=!1,this.startEvent=null,this.nextMoveEvent=null,this.prevMoveEvent=null,this.endEvent=null,this.items=[]}};var ee=class{constructor(e,t,n,r,s){this.data={},this.element=e,this.elementContainer=t,this.elementOffsetContainer=n,this.dragContainer=r,this.dragOffsetContainer=s,this.initialTransform="",this.frozenProps=null,this.unfrozenProps=null,this.x=0,this.y=0,this.pX=0,this.pY=0,this._updateDiffX=0,this._updateDiffY=0,this._moveDiffX=0,this._moveDiffY=0,this._containerDiffX=0,this._containerDiffY=0}};import{getOffset as Ne}from"mezr";function pe(i,e,t={left:0,top:0}){if(t.left=0,t.top=0,i===e)return t;let n=Ne([i,"padding"]),r=Ne([e,"padding"]);return t.left=r.left-n.left,t.top=r.top-n.top,t}var qe=new WeakMap;function te(i){let e=qe.get(i)?.deref();return e||(e=window.getComputedStyle(i,null),qe.set(i,new WeakRef(e))),e}var ct="matrix(1, 0, 0, 1, 0, 0)",dt="matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)",Ue=J?{capture:!0,passive:!0}:!0,ze={left:0,top:0},fe={x:0,y:0};function ht(){return{container:null,startPredicate:()=>!0,getElements:()=>null,releaseElements:()=>null,getFrozenProps:()=>null,getStartPosition:()=>({x:0,y:0}),setPosition:({item:i,x:e,y:t})=>{i.element.style.transform=`translate(${e}px, ${t}px) ${i.initialTransform}`},getPositionChange:({event:i,prevEvent:e})=>(fe.x=i.x-e.x,fe.y=i.y-e.y,fe)}}var Be=class{constructor(e,t={}){this.sensors=e,this.settings=this._parseSettings(t),this.plugins={},this.drag=null,this.isDestroyed=!1,this._sensorData=new Map,this._emitter=new lt,this._startId=Symbol(),this._moveId=Symbol(),this._updateId=Symbol(),this._onMove=this._onMove.bind(this),this._onScroll=this._onScroll.bind(this),this._onEnd=this._onEnd.bind(this),this._prepareStart=this._prepareStart.bind(this),this._applyStart=this._applyStart.bind(this),this._prepareMove=this._prepareMove.bind(this),this._applyMove=this._applyMove.bind(this),this._preparePositionUpdate=this._preparePositionUpdate.bind(this),this._applyPositionUpdate=this._applyPositionUpdate.bind(this),this.sensors.forEach(n=>{this._sensorData.set(n,{predicateState:0,predicateEvent:null,onMove:o=>this._onMove(o,n),onEnd:o=>this._onEnd(o,n)});let{onMove:r,onEnd:s}=this._sensorData.get(n);n.on("start",r),n.on("move",r),n.on("cancel",s),n.on("end",s),n.on("destroy",s)})}_parseSettings(e,t=ht()){let{container:n=t.container,startPredicate:r=t.startPredicate,getElements:s=t.getElements,releaseElements:o=t.releaseElements,getFrozenProps:c=t.getFrozenProps,getStartPosition:l=t.getStartPosition,setPosition:a=t.setPosition,getPositionChange:d=t.getPositionChange}=e||{};return{container:n,startPredicate:r,getElements:s,releaseElements:o,getFrozenProps:c,getStartPosition:l,setPosition:a,getPositionChange:d}}_emit(e,...t){this._emitter.emit(e,...t)}_onMove(e,t){let n=this._sensorData.get(t);if(n)switch(n.predicateState){case 0:{n.predicateEvent=e;let r=this.settings.startPredicate({draggable:this,sensor:t,event:e});r===!0?this.resolveStartPredicate(t):r===!1&&this.rejectStartPredicate(t);break}case 1:{this.drag&&(this.drag.nextMoveEvent=e,u.once(v,this._prepareMove,this._moveId),u.once(D,this._applyMove,this._moveId));break}}}_onScroll(){this.updatePosition()}_onEnd(e,t){let n=this._sensorData.get(t);n&&(this.drag?n.predicateState===1&&(this.drag.endEvent=e,this._sensorData.forEach(r=>{r.predicateState=0,r.predicateEvent=null}),this.stop()):(n.predicateState=0,n.predicateEvent=null))}_prepareStart(){let{drag:e}=this;if(!e||!e.startEvent)return;let t=this.settings.getElements({draggable:this,sensor:e.sensor,startEvent:e.startEvent})||[];e.items=t.map(n=>{if(!n.isConnected)throw new Error("Element is not connected");let r=n.parentElement,s=Ve(n);if(!s)throw new Error("Offset container could not be computed for the element!");let o=this.settings.container||r,c=o===r?s:Ve(n,{container:o});if(!c)throw new Error("Drag offset container could not be computed for the element!");let l=new ee(n,r,s,o,c),a=n.getBoundingClientRect();if(l.x=a.left,l.y=a.top,s!==c){let{left:b,top:f}=pe(c,s,ze);l._containerDiffX=b,l._containerDiffY=f}let d=te(n),{transform:m}=d;m&&m!=="none"&&m!==ct&&m!==dt&&(l.initialTransform=m);let{x:y,y:g}=this.settings.getStartPosition({draggable:this,sensor:e.sensor,item:l,style:d});l.pX=y,l.pY=g;let S=this.settings.getFrozenProps({draggable:this,sensor:e.sensor,item:l,style:d});if(Array.isArray(S))if(S.length){let b={};for(let f of S)b[f]=d[f];l.frozenProps=b}else l.frozenProps=null;else l.frozenProps=S;if(l.frozenProps){let b={};for(let f in l.frozenProps)l.frozenProps.hasOwnProperty(f)&&(b[f]=n.style[f]);l.unfrozenProps=b}return l}),this._emit("preparestart",e.startEvent)}_applyStart(){let e=this.drag;if(!e||!e.startEvent)return;let{container:t}=this.settings;for(let n of e.items)t&&n.element.parentElement!==t&&(t.appendChild(n.element),n.pX+=n._containerDiffX,n.pY+=n._containerDiffY),n.frozenProps&&Object.assign(n.element.style,n.frozenProps),this.settings.setPosition({phase:"start",draggable:this,sensor:e.sensor,item:n,x:n.pX,y:n.pY});window.addEventListener("scroll",this._onScroll,Ue),e.isStarted=!0,this._emit("start",e.startEvent)}_prepareMove(){let{drag:e}=this;if(!e||!e.startEvent)return;let t=e.nextMoveEvent,n=e.prevMoveEvent||e.startEvent;if(!(!t||t===n)){for(let r of e.items){let{x:s,y:o}=this.settings.getPositionChange({draggable:this,sensor:e.sensor,item:r,startEvent:e.startEvent,prevEvent:n,event:t});s&&(r.pX=r.pX-r._moveDiffX+s,r.x=r.x-r._moveDiffX+s,r._moveDiffX=s),o&&(r.pY=r.pY-r._moveDiffY+o,r.y=r.y-r._moveDiffY+o,r._moveDiffY=o)}e.prevMoveEvent=t,this._emit("preparemove",t)}}_applyMove(){let{drag:e}=this;if(!(!e||!e.nextMoveEvent)){for(let t of e.items)t._moveDiffX=0,t._moveDiffY=0;for(let t of e.items)this.settings.setPosition({phase:"move",draggable:this,sensor:e.sensor,item:t,x:t.pX,y:t.pY});this._emit("move",e.nextMoveEvent)}}_preparePositionUpdate(){let{drag:e}=this;if(e)for(let t of e.items){if(t.elementOffsetContainer!==t.dragOffsetContainer){let{left:c,top:l}=pe(t.dragOffsetContainer,t.elementOffsetContainer,ze);t._containerDiffX=c,t._containerDiffY=l}let{left:n,top:r}=t.element.getBoundingClientRect(),s=t.x-t._moveDiffX-n;t.pX=t.pX-t._updateDiffX+s,t._updateDiffX=s;let o=t.y-t._moveDiffY-r;t.pY=t.pY-t._updateDiffY+o,t._updateDiffY=o}}_applyPositionUpdate(){let{drag:e}=this;if(e)for(let t of e.items)t._updateDiffX=0,t._updateDiffY=0,this.settings.setPosition({phase:"move",draggable:this,sensor:e.sensor,item:t,x:t.pX,y:t.pY})}on(e,t,n){return this._emitter.on(e,t,n)}off(e,t){this._emitter.off(e,t)}resolveStartPredicate(e,t){let n=this._sensorData.get(e);if(!n)return;let r=t||n.predicateEvent;n.predicateState===0&&r&&(n.predicateState=1,n.predicateEvent=null,this.drag=new Z,this.drag.sensor=e,this.drag.startEvent=r,this._sensorData.forEach((s,o)=>{o!==e&&(s.predicateState=2,s.predicateEvent=null)}),u.once(v,this._prepareStart,this._startId),u.once(D,this._applyStart,this._startId))}rejectStartPredicate(e){let t=this._sensorData.get(e);t?.predicateState===0&&(t.predicateState=2,t.predicateEvent=null)}stop(){let{drag:e}=this;if(!(!e||e.isEnded)){if(e.isEnded=!0,u.off(v,this._startId),u.off(D,this._startId),u.off(v,this._moveId),u.off(D,this._moveId),u.off(v,this._updateId),u.off(D,this._updateId),e.isStarted){window.removeEventListener("scroll",this._onScroll,Ue);let t=[];for(let n of e.items){if(t.push(n.element),n.elementContainer&&n.element.parentElement!==n.elementContainer&&(n.pX-=n._containerDiffX,n.pY-=n._containerDiffY,n._containerDiffX=0,n._containerDiffY=0,n.elementContainer.appendChild(n.element)),n.unfrozenProps)for(let r in n.unfrozenProps)n.element.style[r]=n.unfrozenProps[r]||"";this.settings.setPosition({phase:"end",draggable:this,sensor:e.sensor,item:n,x:n.pX,y:n.pY})}t.length&&this.settings.releaseElements({draggable:this,sensor:e.sensor,elements:t})}this._emit("end",e.endEvent),this.drag=null}}updatePosition(e=!1){this.drag&&(e?(this._preparePositionUpdate(),this._applyPositionUpdate()):(u.once(v,this._preparePositionUpdate,this._updateId),u.once(D,this._applyPositionUpdate,this._updateId)))}updateSettings(e={}){this.settings=this._parseSettings(e,this.settings)}use(e){return e(this)}destroy(){this.isDestroyed||(this.isDestroyed=!0,this.stop(),this._sensorData.forEach(({onMove:e,onEnd:t},n)=>{n.off("start",e),n.off("move",e),n.off("cancel",t),n.off("end",t),n.off("destroy",t)}),this._sensorData.clear(),this._emit("destroy"),this._emitter.off())}};import{Emitter as ut}from"eventti";import{getDistance as pt,getRect as Ge}from"mezr";var B=class{constructor(e,t){this._data=[],this._createObject=e,this._onPut=t}pick(){return this._data.length?this._data.pop():this._createObject()}put(e){this._data.indexOf(e)===-1&&(this._onPut&&this._onPut(e),this._data.push(e))}reset(){this._data.length=0}};import{getIntersection as mt}from"mezr";function He(i,e){let t=mt(i,e);return t?t.width*t.height:0}function ge(i,e){let t=He(i,e);if(!t)return 0;let n=Math.min(i.width,e.width)*Math.min(i.height,e.height);return t/n*100}function w(i){return i instanceof Window}function Se(i){return w(i)||i===document.documentElement||i===document.body?window:i}function N(i){return w(i)?i.pageXOffset:i.scrollLeft}function Ee(i){return w(i)&&(i=document.documentElement),i.scrollWidth-i.clientWidth}function q(i){return w(i)?i.pageYOffset:i.scrollTop}function ve(i){return w(i)&&(i=document.documentElement),i.scrollHeight-i.clientHeight}function _e(i,e){return!(i.right<=e.left||e.right<=i.left||i.bottom<=e.top||e.bottom<=i.top)}var xe={width:0,height:0,left:0,right:0,top:0,bottom:0},Fe={...xe},je=50,I={direction:"none",threshold:0,distance:0,value:0,maxValue:0,duration:0,speed:0,deltaTime:0,isEnding:!1},h={x:1,y:2},M={forward:4,reverse:8},ne={none:0,left:h.x|M.reverse,right:h.x|M.forward},H={none:0,up:h.y|M.reverse,down:h.y|M.forward},p={...ne,...H};function ye(i){switch(i){case ne.none:case H.none:return"none";case ne.left:return"left";case ne.right:return"right";case H.up:return"up";case H.down:return"down";default:throw new Error(`Unknown direction value: ${i}`)}}function $e(i,e,t){let{left:n=0,right:r=0,top:s=0,bottom:o=0}=e;return n=Math.max(0,n),r=Math.max(0,r),s=Math.max(0,s),o=Math.max(0,o),t.width=i.width+n+r,t.height=i.height+s+o,t.left=i.left-n,t.top=i.top-s,t.right=i.right+r,t.bottom=i.bottom+o,t}function re(i,e){return Math.ceil(i)>=Math.floor(e)}function be(i,e){return Math.min(e/2,i)}function De(i,e,t,n){return Math.max(0,t+i*2+n*e-n)/2}var Pe=class{constructor(){this.positionX=0,this.positionY=0,this.directionX=p.none,this.directionY=p.none,this.overlapCheckRequestTime=0}},Te=class{constructor(){this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}reset(){this.requestX&&(this.requestX.action=null),this.requestY&&(this.requestY.action=null),this.element=null,this.requestX=null,this.requestY=null,this.scrollLeft=0,this.scrollTop=0}addRequest(e){h.x&e.direction?(this.requestX&&this.removeRequest(this.requestX),this.requestX=e):(this.requestY&&this.removeRequest(this.requestY),this.requestY=e),e.action=this}removeRequest(e){this.requestX===e?(this.requestX=null,e.action=null):this.requestY===e&&(this.requestY=null,e.action=null)}computeScrollValues(){this.element&&(this.scrollLeft=this.requestX?this.requestX.value:N(this.element),this.scrollTop=this.requestY?this.requestY.value:q(this.element))}scroll(){this.element&&(this.element.scrollTo?this.element.scrollTo(this.scrollLeft,this.scrollTop):(this.element.scrollLeft=this.scrollLeft,this.element.scrollTop=this.scrollTop))}},we=class{constructor(){this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=0,this.value=NaN,this.maxValue=0,this.threshold=0,this.distance=0,this.deltaTime=0,this.speed=0,this.duration=0,this.action=null}reset(){this.isActive&&this.onStop(),this.item=null,this.element=null,this.isActive=!1,this.isEnding=!1,this.direction=0,this.value=NaN,this.maxValue=0,this.threshold=0,this.distance=0,this.deltaTime=0,this.speed=0,this.duration=0,this.action=null}hasReachedEnd(){return M.forward&this.direction?re(this.value,this.maxValue):this.value<=0}computeCurrentScrollValue(){return this.element?this.value!==this.value?h.x&this.direction?N(this.element):q(this.element):Math.max(0,Math.min(this.value,this.maxValue)):0}computeNextScrollValue(){let e=this.speed*(this.deltaTime/1e3),t=M.forward&this.direction?this.value+e:this.value-e;return Math.max(0,Math.min(t,this.maxValue))}computeSpeed(){if(!this.item||!this.element)return 0;let{speed:e}=this.item;return typeof e=="function"?(I.direction=ye(this.direction),I.threshold=this.threshold,I.distance=this.distance,I.value=this.value,I.maxValue=this.maxValue,I.duration=this.duration,I.speed=this.speed,I.deltaTime=this.deltaTime,I.isEnding=this.isEnding,e(this.element,I)):e}tick(e){return this.isActive||(this.isActive=!0,this.onStart()),this.deltaTime=e,this.value=this.computeCurrentScrollValue(),this.speed=this.computeSpeed(),this.value=this.computeNextScrollValue(),this.duration+=e,this.value}onStart(){if(!this.item||!this.element)return;let{onStart:e}=this.item;typeof e=="function"&&e(this.element,ye(this.direction))}onStop(){if(!this.item||!this.element)return;let{onStop:e}=this.item;typeof e=="function"&&e(this.element,ye(this.direction))}};function Je(i=500,e=.5,t=.25){let n=i*(e>0?1/e:1/0),r=i*(t>0?1/t:1/0);return function(s,o){let c=0;if(!o.isEnding)if(o.threshold>0){let d=o.threshold-Math.max(0,o.distance);c=i/o.threshold*d}else c=i;let l=o.speed;if(l===c)return c;let a=c;return l<c?(a=l+n*(o.deltaTime/1e3),Math.min(c,a)):(a=l-r*(o.deltaTime/1e3),Math.max(c,a))}}var ie=class{constructor(e={}){let{overlapCheckInterval:t=150}=e;this.items=[],this.settings={overlapCheckInterval:t},this._actions=[],this._isDestroyed=!1,this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,this._requests={[h.x]:new Map,[h.y]:new Map},this._itemData=new Map,this._requestPool=new B(()=>new we,n=>n.reset()),this._actionPool=new B(()=>new Te,n=>n.reset()),this._emitter=new ut,this._frameRead=this._frameRead.bind(this),this._frameWrite=this._frameWrite.bind(this)}_frameRead(e){this._isDestroyed||(e&&this._tickTime?(this._tickDeltaTime=e-this._tickTime,this._tickTime=e,this._updateItems(),this._updateRequests(),this._updateActions()):(this._tickTime=e,this._tickDeltaTime=0))}_frameWrite(){this._isDestroyed||this._applyActions()}_startTicking(){this._isTicking||(this._isTicking=!0,u.on(v,this._frameRead),u.on(D,this._frameWrite))}_stopTicking(){this._isTicking&&(this._isTicking=!1,this._tickTime=0,this._tickDeltaTime=0,u.off(v,this._frameRead),u.off(D,this._frameWrite))}_getItemClientRect(e,t={width:0,height:0,left:0,right:0,top:0,bottom:0}){let{clientRect:n}=e;return t.left=n.left,t.top=n.top,t.width=n.width,t.height=n.height,t.right=n.left+n.width,t.bottom=n.top+n.height,t}_requestItemScroll(e,t,n,r,s,o,c){let l=this._requests[t],a=l.get(e);a?(a.element!==n||a.direction!==r)&&a.reset():(a=this._requestPool.pick(),l.set(e,a)),a.item=e,a.element=n,a.direction=r,a.threshold=s,a.distance=o,a.maxValue=c}_cancelItemScroll(e,t){let n=this._requests[t],r=n.get(e);r&&(r.action&&r.action.removeRequest(r),this._requestPool.put(r),n.delete(e))}_checkItemOverlap(e,t,n){let{inertAreaSize:r,targets:s}=e;if(!s.length){t&&this._cancelItemScroll(e,h.x),n&&this._cancelItemScroll(e,h.y);return}let o=this._itemData.get(e),c=o?.directionX,l=o?.directionY;if(!c&&!l){t&&this._cancelItemScroll(e,h.x),n&&this._cancelItemScroll(e,h.y);return}let a=this._getItemClientRect(e,xe),d=null,m=-1/0,y=0,g=-1/0,S=p.none,b=0,f=0,E=null,x=-1/0,V=0,U=-1/0,se=p.none,Ce=0,Le=0,ae=0;for(;ae<s.length;ae++){let A=s[ae],Ke=typeof A.threshold=="number"?A.threshold:je,le=!!(t&&c&&A.axis!=="y"),ce=!!(n&&l&&A.axis!=="x"),R=A.priority||0;if((!le||R<m)&&(!ce||R<x))continue;let k=Se(A.element||A),F=le?Ee(k):-1,j=ce?ve(k):-1;if(F<=0&&j<=0)continue;let P=Ge([k,"padding"],window),O=ge(a,P)||-1/0;if(O===-1/0)if(A.padding&&_e(a,$e(P,A.padding,Fe)))O=-(pt(a,P)||0);else continue;if(le&&R>=m&&F>0&&(R>m||O>g)){let T=0,C=p.none,L=be(Ke,P.width),z=De(L,r,a.width,P.width);c===p.right?(T=P.right+z-a.right,T<=L&&!re(N(k),F)&&(C=p.right)):c===p.left&&(T=a.left-(P.left-z),T<=L&&N(k)>0&&(C=p.left)),C&&(d=k,m=R,y=L,g=O,S=C,b=T,f=F)}if(ce&&R>=x&&j>0&&(R>x||O>U)){let T=0,C=H.none,L=be(Ke,P.height),z=De(L,r,a.height,P.height);l===p.down?(T=P.bottom+z-a.bottom,T<=L&&!re(q(k),j)&&(C=p.down)):l===p.up&&(T=a.top-(P.top-z),T<=L&&q(k)>0&&(C=p.up)),C&&(E=k,x=R,V=L,U=O,se=C,Ce=T,Le=j)}}t&&(d&&S?this._requestItemScroll(e,h.x,d,S,y,b,f):this._cancelItemScroll(e,h.x)),n&&(E&&se?this._requestItemScroll(e,h.y,E,se,V,Ce,Le):this._cancelItemScroll(e,h.y))}_updateScrollRequest(e){let t=e.item,{inertAreaSize:n,smoothStop:r,targets:s}=t,o=this._getItemClientRect(t,xe),c=null,l=0;for(;l<s.length;l++){let a=s[l],d=Se(a.element||a);if(d!==e.element)continue;let m=!!(h.x&e.direction);if(m){if(a.axis==="y")continue}else if(a.axis==="x")continue;let y=m?Ee(d):ve(d);if(y<=0)break;let g=Ge([d,"padding"],window);if((ge(o,g)||-1/0)===-1/0){let U=a.scrollPadding||a.padding;if(!(U&&_e(o,$e(g,U,Fe))))break}let b=typeof a.threshold=="number"?a.threshold:je,f=be(b,m?g.width:g.height),E=De(f,n,m?o.width:o.height,m?g.width:g.height),x=0;if(e.direction===p.left?x=o.left-(g.left-E):e.direction===p.right?x=g.right+E-o.right:e.direction===p.up?x=o.top-(g.top-E):x=g.bottom+E-o.bottom,x>f)break;let V=m?N(d):q(d);if(c=M.forward&e.direction?re(V,y):V<=0,c)break;return e.maxValue=y,e.threshold=f,e.distance=x,e.isEnding=!1,!0}return r===!0&&e.speed>0?(c===null&&(c=e.hasReachedEnd()),e.isEnding=!c):e.isEnding=!1,e.isEnding}_updateItems(){for(let e=0;e<this.items.length;e++){let t=this.items[e],n=this._itemData.get(t),{x:r,y:s}=t.position,o=n.positionX,c=n.positionY;r===o&&s===c||(n.directionX=r>o?p.right:r<o?p.left:n.directionX,n.directionY=s>c?p.down:s<c?p.up:n.directionY,n.positionX=r,n.positionY=s,n.overlapCheckRequestTime===0&&(n.overlapCheckRequestTime=this._tickTime))}}_updateRequests(){let e=this.items,t=this._requests[h.x],n=this._requests[h.y],r=0;for(;r<e.length;r++){let s=e[r],o=this._itemData.get(s),c=o.overlapCheckRequestTime,l=c>0&&this._tickTime-c>this.settings.overlapCheckInterval,a=!0,d=t.get(s);d&&d.isActive&&(a=!this._updateScrollRequest(d),a&&(l=!0,this._cancelItemScroll(s,h.x)));let m=!0,y=n.get(s);y&&y.isActive&&(m=!this._updateScrollRequest(y),m&&(l=!0,this._cancelItemScroll(s,h.y))),l&&(o.overlapCheckRequestTime=0,this._checkItemOverlap(s,a,m))}}_requestAction(e,t){let n=t===h.x,r=null,s=0;for(;s<this._actions.length;s++){if(r=this._actions[s],e.element!==r.element){r=null;continue}if(n?r.requestX:r.requestY){this._cancelItemScroll(e.item,t);return}break}r||(r=this._actionPool.pick()),r.element=e.element,r.addRequest(e),e.tick(this._tickDeltaTime),this._actions.push(r)}_updateActions(){let e=0;for(e=0;e<this.items.length;e++){let t=this.items[e],n=this._requests[h.x].get(t),r=this._requests[h.y].get(t);n&&this._requestAction(n,h.x),r&&this._requestAction(r,h.y)}for(e=0;e<this._actions.length;e++)this._actions[e].computeScrollValues()}_applyActions(){if(!this._actions.length)return;this._emitter.emit("beforescroll");let e=0;for(e=0;e<this._actions.length;e++)this._actions[e].scroll(),this._actionPool.put(this._actions[e]);this._actions.length=0;let t;for(e=0;e<this.items.length;e++)t=this.items[e],t.onPrepareScrollEffect&&t.onPrepareScrollEffect();for(e=0;e<this.items.length;e++)t=this.items[e],t.onApplyScrollEffect&&t.onApplyScrollEffect();this._emitter.emit("afterscroll")}on(e,t){return this._emitter.on(e,t)}off(e,t){this._emitter.off(e,t)}addItem(e){if(this._isDestroyed||this._itemData.has(e))return;let{x:t,y:n}=e.position,r=new Pe;r.positionX=t,r.positionY=n,r.directionX=p.none,r.directionY=p.none,r.overlapCheckRequestTime=this._tickTime,this._itemData.set(e,r),this.items.push(e),this._isTicking||this._startTicking()}removeItem(e){if(this._isDestroyed)return;let t=this.items.indexOf(e);t!==-1&&(this._requests[h.x].get(e)&&(this._cancelItemScroll(e,h.x),this._requests[h.x].delete(e)),this._requests[h.y].get(e)&&(this._cancelItemScroll(e,h.y),this._requests[h.y].delete(e)),this._itemData.delete(e),this.items.splice(t,1),this._isTicking&&!this.items.length&&this._stopTicking())}isDestroyed(){return this._isDestroyed}isItemScrollingX(e){return!!this._requests[h.x].get(e)?.isActive}isItemScrollingY(e){return!!this._requests[h.y].get(e)?.isActive}isItemScrolling(e){return this.isItemScrollingX(e)||this.isItemScrollingY(e)}updateSettings(e={}){let{overlapCheckInterval:t=this.settings.overlapCheckInterval}=e;this.settings.overlapCheckInterval=t}destroy(){if(this._isDestroyed)return;let e=this.items.slice(0),t=0;for(;t<e.length;t++)this.removeItem(e[t]);this._actions.length=0,this._requestPool.reset(),this._actionPool.reset(),this._emitter.off(),this._isDestroyed=!0}};var Ie=new ie;var G={x:0,y:0},K={left:0,top:0,width:0,height:0};function ft(){return{targets:[],inertAreaSize:.2,speed:Je(),smoothStop:!1,getPosition:i=>{let{drag:e}=i,t=e?.items[0];if(t)G.x=t.pX,G.y=t.pY;else{let n=e&&(e.nextMoveEvent||e.startEvent);G.x=n?n.x:0,G.y=n?n.y:0}return G},getClientRect:i=>{let{drag:e}=i,t=e?.items[0];if(t&&t.element){let{left:n,top:r,width:s,height:o}=t.element.getBoundingClientRect();K.left=n,K.top=r,K.width=s,K.height=o}else{let n=e&&(e.nextMoveEvent||e.startEvent);K.left=n?n.x-25:0,K.top=n?n.y-25:0,K.width=n?50:0,K.height=n?50:0}return K},onStart:null,onStop:null}}var Ae=class{constructor(e,t){this._draggableAutoScroll=e,this._draggable=t,this._position={x:0,y:0},this._clientRect={left:0,top:0,width:0,height:0}}_getSettings(){return this._draggableAutoScroll.settings}get targets(){let{targets:e}=this._getSettings();return typeof e=="function"&&(e=e(this._draggable)),e}get position(){let{getPosition:e}=this._getSettings();if(typeof e=="function"){let t=e(this._draggable);this._position.x=t.x,this._position.y=t.y}else this._position.x=0,this._position.y=0;return this._position}get clientRect(){let{getClientRect:e}=this._getSettings();if(typeof e=="function"){let{left:t,top:n,width:r,height:s}=e(this._draggable);this._clientRect.left=t,this._clientRect.top=n,this._clientRect.width=r,this._clientRect.height=s}else this._clientRect.left=0,this._clientRect.top=0,this._clientRect.width=0,this._clientRect.height=0;return this._clientRect}get inertAreaSize(){return this._getSettings().inertAreaSize}get smoothStop(){return this._getSettings().smoothStop}get speed(){return this._getSettings().speed}get onStart(){return this._getSettings().onStart}get onStop(){return this._getSettings().onStop}onPrepareScrollEffect(){let e=this._draggable._updateId;u.off(v,e),u.off(D,e),this._draggable._preparePositionUpdate()}onApplyScrollEffect(){this._draggable._applyPositionUpdate()}},ke=class{constructor(e,t={}){this.name="autoscroll",this.version="0.0.2",this.settings=this._parseSettings(t),this._autoScrollProxy=null,e.on("start",()=>{this._autoScrollProxy||(this._autoScrollProxy=new Ae(this,e),Ie.addItem(this._autoScrollProxy))}),e.on("end",()=>{this._autoScrollProxy&&(Ie.removeItem(this._autoScrollProxy),this._autoScrollProxy=null)})}_parseSettings(e,t=ft()){let{targets:n=t.targets,inertAreaSize:r=t.inertAreaSize,speed:s=t.speed,smoothStop:o=t.smoothStop,getPosition:c=t.getPosition,getClientRect:l=t.getClientRect,onStart:a=t.onStart,onStop:d=t.onStop}=e||{};return{targets:n,inertAreaSize:r,speed:s,smoothStop:o,getPosition:c,getClientRect:l,onStart:a,onStop:d}}updateSettings(e={}){this.settings=this._parseSettings(e,this.settings)}};function dr(i){return e=>{let t=new ke(e,i),n=e;return n.plugins[t.name]=t,n}}var Qe=new Set(["auto","scroll","overlay"]);function oe(i){let e=te(i);return!!(Qe.has(e.overflowY)||Qe.has(e.overflowX))}function Ze(i){return i instanceof Document}function et(i,e=[]){let t=i?.parentNode;for(;t&&!Ze(t);)t instanceof Element?(oe(t)&&e.push(t),t=t.parentNode):t instanceof ShadowRoot?t=t.host:t=t.parentNode;return e.push(window),e}function gt(i){let e=[];return oe(i)&&e.push(i),et(i,e),e}function br(i={}){let e,t=0,n=null,r,{timeout:s=250,fallback:o=()=>!0}=i,c=d=>d.preventDefault(),l=d=>{if(t){if(e){d.cancelable&&d.preventDefault();return}e===void 0&&(d.cancelable&&d.timeStamp-t>s?(e=!0,d.preventDefault()):e=!1)}};return d=>{if(!(d.sensor instanceof Y))return o(d);let{draggable:m,sensor:y,event:g}=d,S=g;if(S.pointerType==="touch"){if(S.type==="start"&&(S.srcEvent.type==="pointerdown"||S.srcEvent.type==="touchstart")){n=S.target;let b=n?gt(n):[];b.forEach(E=>{E.addEventListener("touchmove",l,{passive:!1,capture:!0})});let f=()=>{t&&(m.off("end",f),m.sensors.forEach(E=>{E instanceof Y&&E.off("end",f)}),n?.removeEventListener("contextmenu",c),b.forEach(E=>{E.removeEventListener("touchmove",l,{capture:!0})}),t=0,e=void 0,n=null,r=void window.clearTimeout(r))};e=void 0,t=S.srcEvent.timeStamp,n?.addEventListener("contextmenu",c),m.on("end",f),m.sensors.forEach(E=>{E instanceof Y&&E.off("end",f)}),s>0&&(r=window.setTimeout(()=>{m.resolveStartPredicate(y),e=!0,r=void 0},s))}return e}return S.type==="start"&&!S.srcEvent.button}}export{h as AUTO_SCROLL_AXIS,M as AUTO_SCROLL_AXIS_DIRECTION,p as AUTO_SCROLL_DIRECTION,ie as AutoScroll,$ as BaseMotionSensor,W as BaseSensor,Be as Draggable,ke as DraggableAutoScroll,Ye as KeyboardMotionSensor,Xe as KeyboardSensor,Y as PointerSensor,_ as SensorEventType,Ie as autoScroll,dr as autoScrollPlugin,Je as autoScrollSmoothSpeed,br as createPointerSensorStartPredicate,wt as setTicker,u as ticker,v as tickerReadPhase,D as tickerWritePhase}; |
@@ -7,2 +7,2 @@ Copyright (c) 2022, Niklas Rämö | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "dragdoll", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Modular and extensible drag & drop system.", | ||
@@ -23,6 +23,10 @@ "keywords": [ | ||
"type": "module", | ||
"source": "src/index.ts", | ||
"source": "./src/index.ts", | ||
"main": "./dist/dragdoll.js", | ||
"umd:main": "./dist/dragdoll.umd.js", | ||
"types": "./dist/dragdoll.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/dragdoll.js", | ||
"require": "./dist/dragdoll.cjs" | ||
} | ||
}, | ||
"files": [ | ||
@@ -35,46 +39,55 @@ "src", | ||
], | ||
"targets": { | ||
"main": false | ||
}, | ||
"scripts": { | ||
"test": "npm run ts-check && npm run test-node && npm run test-browserstack", | ||
"build": "npm run del-dist && npm run ts-check && npm run format && npm run build-lib && npm run build-tests && npm run build-examples && npm run size", | ||
"build-lib": "tsup --config ./tsup.config.lib.ts", | ||
"build-tests": "tsup --config ./tsup.config.tests.ts", | ||
"build-examples": "node ./scripts/build-examples.mjs", | ||
"docs-build": "vitepress build docs", | ||
"docs-dev": "npm run build && vitepress dev docs", | ||
"docs-serve": "vitepress serve docs", | ||
"del-dist": "rimraf ./dist && rimraf ./tests/dist && rimraf ./docs/public/examples", | ||
"format": "prettier --write --no-error-on-unmatched-pattern \"./**/*\"", | ||
"format-check": "prettier --check --no-error-on-unmatched-pattern \"./**/*\"", | ||
"size": "for file in ./dist/*.{js,cjs}; do echo $file && gzip-size $file --include-original; done;", | ||
"test": "npm run ts-check && npm run test-browserstack", | ||
"test-browser": "karma start karma.cjs", | ||
"test-browserstack": "karma start karma.browserstack.cjs", | ||
"test-node": "mocha tests/dist/tests.js", | ||
"test-chrome-local": "karma start karma.chrome-local.cjs", | ||
"test-browserstack": "karma start karma.browserstack.ts", | ||
"build": "npm run del-dist && npm run ts-check && npm run format && rollup -c && npm run minify && npm run size", | ||
"ts-check": "tsc --noEmit", | ||
"del-dist": "del ./dist && del ./tests/dist", | ||
"format": "prettier --write ./src/ && prettier --write ./tests/src/", | ||
"size": "for file in ./dist/*.js; do echo $file && gzip-size $file --include-original; done", | ||
"minify": "for file in ./dist/*.js; do terser $file -o $file --compress --mangle --comments false; done", | ||
"docs-dev": "vitepress dev docs", | ||
"docs-build": "vitepress build docs", | ||
"docs-serve": "vitepress serve docs" | ||
"ts-check": "tsc --noEmit" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "11.1.2", | ||
"@types/chai": "4.3.5", | ||
"@types/mocha": "10.0.1", | ||
"chai": "4.3.7", | ||
"csstype": "3.1.2", | ||
"del-cli": "5.0.0", | ||
"@parcel/config-default": "2.10.3", | ||
"@types/chai": "4.3.11", | ||
"@types/mocha": "10.0.6", | ||
"chai": "4.3.10", | ||
"cpy-cli": "5.0.0", | ||
"dotenv": "16.3.1", | ||
"eventti": "3.0.0", | ||
"gzip-size-cli": "5.1.0", | ||
"jsdom": "23.0.1", | ||
"karma": "6.4.2", | ||
"karma-browserstack-launcher": "1.6.0", | ||
"karma-chrome-launcher": "3.2.0", | ||
"karma-firefox-launcher": "2.1.2", | ||
"karma-mocha": "2.0.1", | ||
"karma-mocha-reporter": "2.2.5", | ||
"mezr": "1.1.0", | ||
"mocha": "10.2.0", | ||
"prettier": "3.0.0", | ||
"rollup": "3.26.2", | ||
"rollup-plugin-dts": "5.3.0", | ||
"terser": "5.18.2", | ||
"parcel": "2.10.3", | ||
"prettier": "3.1.1", | ||
"rimraf": "5.0.5", | ||
"tikki": "2.0.0", | ||
"typescript": "5.1.6", | ||
"vitepress": "1.0.0-beta.5", | ||
"vue": "3.3.4" | ||
"tsup": "8.0.1", | ||
"typescript": "5.3.3", | ||
"vitepress": "1.0.0-rc.32", | ||
"vue": "3.3.12" | ||
}, | ||
"peerDependencies": { | ||
"eventti": "^3.0.0", | ||
"mezr": "^1.1.0", | ||
"tikki": "^2.0.0" | ||
} | ||
} |
@@ -0,0 +0,0 @@ <h1 align="center"> |
@@ -1,23 +0,23 @@ | ||
export * from './Sensors/Sensor'; | ||
export * from './sensors/sensor.js'; | ||
export * from './Sensors/BaseSensor'; | ||
export * from './sensors/base-sensor.js'; | ||
export * from './Sensors/BaseMotionSensor'; | ||
export * from './sensors/base-motion-sensor.js'; | ||
export * from './Sensors/PointerSensor'; | ||
export * from './sensors/pointer-sensor.js'; | ||
export * from './Sensors/KeyboardSensor'; | ||
export * from './sensors/keyboard-sensor.js'; | ||
export * from './Sensors/KeyboardMotionSensor'; | ||
export * from './sensors/keyboard-motion-sensor.js'; | ||
export * from './Draggable/Draggable'; | ||
export * from './draggable/draggable.js'; | ||
export * from './Draggable/plugins/autoScrollPlugin'; | ||
export * from './draggable/plugins/auto-scroll-plugin.js'; | ||
export * from './AutoScroll/AutoScroll'; | ||
export * from './auto-scroll/auto-scroll.js'; | ||
export * from './singletons/autoScroll'; | ||
export * from './singletons/auto-scroll.js'; | ||
export * from './singletons/ticker'; | ||
export * from './singletons/ticker.js'; | ||
export * from './utils/createPointerSensorStartPredicate'; | ||
export * from './utils/create-pointer-sensor-start-predicate.js'; |
@@ -7,7 +7,10 @@ export type Writeable<T> = { -readonly [P in keyof T]: T[P] }; | ||
export interface Rect { | ||
export type Dimensions = { | ||
width: number; | ||
height: number; | ||
}; | ||
export interface Rect extends Dimensions { | ||
left: number; | ||
top: number; | ||
width: number; | ||
height: number; | ||
} | ||
@@ -25,1 +28,14 @@ | ||
export type RemoveUnderscoreProperties<T extends {}> = Pick<T, FilterNotStartingWith<keyof T, '_'>>; | ||
export type CSSProperties = Partial< | ||
Omit< | ||
CSSStyleDeclaration, | ||
| 'getPropertyPriority' | ||
| 'getPropertyValue' | ||
| 'item' | ||
| 'removeProperty' | ||
| 'setProperty' | ||
| 'length' | ||
| 'parentRule' | ||
> | ||
>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
254295
4383
3
25
45
1