diff --git a/@interactjs/actions/.npmignore b/@interactjs/actions/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/actions/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/actions/LICENSE b/@interactjs/actions/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/actions/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/actions/actions.spec.d.ts b/@interactjs/actions/actions.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/actions/actions.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/actions/drag.d.ts b/@interactjs/actions/drag.d.ts new file mode 100644 index 000000000..08d5a0c49 --- /dev/null +++ b/@interactjs/actions/drag.d.ts @@ -0,0 +1,19 @@ +declare module '@interactjs/core/Interactable' { + interface Interactable { + draggable: DraggableMethod; + } +} +declare module '@interactjs/core/defaultOptions' { + interface ActionDefaults { + drag: Interact.DraggableOptions; + } +} +declare module '@interactjs/core/scope' { + interface ActionMap { + drag?: typeof drag; + } +} +export declare type DragEvent = Interact.InteractEvent<'drag'>; +export declare type DraggableMethod = Interact.ActionMethod; +declare const drag: Interact.Plugin; +export default drag; diff --git a/@interactjs/actions/drag.js b/@interactjs/actions/drag.js new file mode 100644 index 000000000..411e9cc0c --- /dev/null +++ b/@interactjs/actions/drag.js @@ -0,0 +1,162 @@ +import * as is from "../utils/is.js"; + +function install(scope) { + const { + actions, + Interactable, + defaults + } = scope; + Interactable.prototype.draggable = drag.draggable; + actions.map.drag = drag; + actions.methodDict.drag = 'draggable'; + defaults.actions.drag = drag.defaults; +} + +function beforeMove({ + interaction +}) { + if (interaction.prepared.name !== 'drag') { + return; + } + + const axis = interaction.prepared.axis; + + if (axis === 'x') { + interaction.coords.cur.page.y = interaction.coords.start.page.y; + interaction.coords.cur.client.y = interaction.coords.start.client.y; + interaction.coords.velocity.client.y = 0; + interaction.coords.velocity.page.y = 0; + } else if (axis === 'y') { + interaction.coords.cur.page.x = interaction.coords.start.page.x; + interaction.coords.cur.client.x = interaction.coords.start.client.x; + interaction.coords.velocity.client.x = 0; + interaction.coords.velocity.page.x = 0; + } +} + +function move({ + iEvent, + interaction +}) { + if (interaction.prepared.name !== 'drag') { + return; + } + + const axis = interaction.prepared.axis; + + if (axis === 'x' || axis === 'y') { + const opposite = axis === 'x' ? 'y' : 'x'; + iEvent.page[opposite] = interaction.coords.start.page[opposite]; + iEvent.client[opposite] = interaction.coords.start.client[opposite]; + iEvent.delta[opposite] = 0; + } +} +/** + * ```js + * interact(element).draggable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * // the axis in which the first movement must be + * // for the drag sequence to start + * // 'xy' by default - any direction + * startAxis: 'x' || 'y' || 'xy', + * + * // 'xy' by default - don't restrict to one axis (move in any direction) + * // 'x' or 'y' to restrict movement to either axis + * // 'start' to restrict movement to the axis the drag started in + * lockAxis: 'x' || 'y' || 'xy' || 'start', + * + * // max number of drags that can happen concurrently + * // with elements of this Interactable. Infinity by default + * max: Infinity, + * + * // max number of drags that can target the same element+Interactable + * // 1 by default + * maxPerElement: 2 + * }) + * + * var isDraggable = interact('element').draggable(); // true + * ``` + * + * Get or set whether drag actions can be performed on the target + * + * @alias Interactable.prototype.draggable + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on drag events (object makes the Interactable + * draggable) + * @return {boolean | Interactable} boolean indicating if this can be the + * target of drag events, or this Interctable + */ + + +const draggable = function draggable(options) { + if (is.object(options)) { + this.options.drag.enabled = options.enabled !== false; + this.setPerAction('drag', options); + this.setOnEvents('drag', options); + + if (/^(xy|x|y|start)$/.test(options.lockAxis)) { + this.options.drag.lockAxis = options.lockAxis; + } + + if (/^(xy|x|y)$/.test(options.startAxis)) { + this.options.drag.startAxis = options.startAxis; + } + + return this; + } + + if (is.bool(options)) { + this.options.drag.enabled = options; + return this; + } + + return this.options.drag; +}; + +const drag = { + id: 'actions/drag', + install, + listeners: { + 'interactions:before-action-move': beforeMove, + 'interactions:action-resume': beforeMove, + // dragmove + 'interactions:action-move': move, + 'auto-start:check': arg => { + const { + interaction, + interactable, + buttons + } = arg; + const dragOptions = interactable.options.drag; + + if (!(dragOptions && dragOptions.enabled) || // check mouseButton setting if the pointer is down + interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & interactable.options.drag.mouseButtons) === 0) { + return undefined; + } + + arg.action = { + name: 'drag', + axis: dragOptions.lockAxis === 'start' ? dragOptions.startAxis : dragOptions.lockAxis + }; + return false; + } + }, + draggable, + beforeMove, + move, + defaults: { + startAxis: 'xy', + lockAxis: 'xy' + }, + + getCursor() { + return 'move'; + } + +}; +export default drag; +//# sourceMappingURL=drag.js.map \ No newline at end of file diff --git a/@interactjs/actions/drag.js.map b/@interactjs/actions/drag.js.map new file mode 100644 index 000000000..fe5c420c2 --- /dev/null +++ b/@interactjs/actions/drag.js.map @@ -0,0 +1,61 @@ +{ + "version": 3, + "sources": [ + "drag.ts" + ], + "names": [ + "is", + "install", + "scope", + "actions", + "Interactable", + "defaults", + "prototype", + "draggable", + "drag", + "map", + "methodDict", + "beforeMove", + "interaction", + "prepared", + "name", + "axis", + "coords", + "cur", + "page", + "y", + "start", + "client", + "velocity", + "x", + "move", + "iEvent", + "opposite", + "delta", + "options", + "object", + "enabled", + "setPerAction", + "setOnEvents", + "test", + "lockAxis", + "startAxis", + "bool", + "id", + "listeners", + "arg", + "interactable", + "buttons", + "dragOptions", + "pointerIsDown", + "pointerType", + "mouseButtons", + "undefined", + "action", + "getCursor" + ], + "mappings": "AACA,OAAO,KAAKA,EAAZ;;AAwBA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AAC9B,QAAM;AACJC,IAAAA,OADI;AAEJC,IAAAA,YAFI;AAGJC,IAAAA;AAHI,MAIFH,KAJJ;AAMAE,EAAAA,YAAY,CAACE,SAAb,CAAuBC,SAAvB,GAAmCC,IAAI,CAACD,SAAxC;AAEAJ,EAAAA,OAAO,CAACM,GAAR,CAAYD,IAAZ,GAAmBA,IAAnB;AACAL,EAAAA,OAAO,CAACO,UAAR,CAAmBF,IAAnB,GAA0B,WAA1B;AAEAH,EAAAA,QAAQ,CAACF,OAAT,CAAiBK,IAAjB,GAAwBA,IAAI,CAACH,QAA7B;AACD;;AAED,SAASM,UAAT,CAAqB;AAAEC,EAAAA;AAAF,CAArB,EAAsC;AACpC,MAAIA,WAAW,CAACC,QAAZ,CAAqBC,IAArB,KAA8B,MAAlC,EAA0C;AAAE;AAAQ;;AAEpD,QAAMC,IAAI,GAAGH,WAAW,CAACC,QAAZ,CAAqBE,IAAlC;;AAEA,MAAIA,IAAI,KAAK,GAAb,EAAkB;AAChBH,IAAAA,WAAW,CAACI,MAAZ,CAAmBC,GAAnB,CAAuBC,IAAvB,CAA4BC,CAA5B,GAAkCP,WAAW,CAACI,MAAZ,CAAmBI,KA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s/core/scope'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n drag: Interact.DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = Interact.InteractEvent<'drag'>\n\nexport type DraggableMethod = Interact.ActionMethod\n\nfunction install (scope: Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n Interactable.prototype.draggable = drag.draggable\n\n actions.map.drag = drag\n actions.methodDict.drag = 'draggable'\n\n defaults.actions.drag = drag.defaults\n}\n\nfunction beforeMove ({ interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x') {\n interaction.coords.cur.page.y = interaction.coords.start.page.y\n interaction.coords.cur.client.y = interaction.coords.start.client.y\n\n interaction.coords.velocity.client.y = 0\n interaction.coords.velocity.page.y = 0\n }\n else if (axis === 'y') {\n interaction.coords.cur.page.x = interaction.coords.start.page.x\n interaction.coords.cur.client.x = interaction.coords.start.client.x\n\n interaction.coords.velocity.client.x = 0\n interaction.coords.velocity.page.x = 0\n }\n}\n\nfunction move ({ iEvent, interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x' || axis === 'y') {\n const opposite = axis === 'x' ? 'y' : 'x'\n\n iEvent.page[opposite] = interaction.coords.start.page[opposite]\n iEvent.client[opposite] = interaction.coords.start.client[opposite]\n iEvent.delta[opposite] = 0\n }\n}\n\n/**\n * ```js\n * interact(element).draggable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // the axis in which the first movement must be\n * // for the drag sequence to start\n * // 'xy' by default - any direction\n * startAxis: 'x' || 'y' || 'xy',\n *\n * // 'xy' by default - don't restrict to one axis (move in any direction)\n * // 'x' or 'y' to restrict movement to either axis\n * // 'start' to restrict movement to the axis the drag started in\n * lockAxis: 'x' || 'y' || 'xy' || 'start',\n *\n * // max number of drags that can happen concurrently\n * // with elements of this Interactable. Infinity by default\n * max: Infinity,\n *\n * // max number of drags that can target the same element+Interactable\n * // 1 by default\n * maxPerElement: 2\n * })\n *\n * var isDraggable = interact('element').draggable(); // true\n * ```\n *\n * Get or set whether drag actions can be performed on the target\n *\n * @alias Interactable.prototype.draggable\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on drag events (object makes the Interactable\n * draggable)\n * @return {boolean | Interactable} boolean indicating if this can be the\n * target of drag events, or this Interctable\n */\nconst draggable: DraggableMethod = function draggable (this: Interact.Interactable, options?: Interact.DraggableOptions | boolean): any {\n if (is.object(options)) {\n this.options.drag.enabled = options.enabled !== false\n this.setPerAction('drag', options)\n this.setOnEvents('drag', options)\n\n if (/^(xy|x|y|start)$/.test(options.lockAxis)) {\n this.options.drag.lockAxis = options.lockAxis\n }\n if (/^(xy|x|y)$/.test(options.startAxis)) {\n this.options.drag.startAxis = options.startAxis\n }\n\n return this\n }\n\n if (is.bool(options)) {\n this.options.drag.enabled = options\n\n return this\n }\n\n return this.options.drag\n}\n\nconst drag: Interact.Plugin = {\n id: 'actions/drag',\n install,\n listeners: {\n 'interactions:before-action-move': beforeMove,\n 'interactions:action-resume': beforeMove,\n\n // dragmove\n 'interactions:action-move': move,\n 'auto-start:check': arg => {\n const { interaction, interactable, buttons } = arg\n const dragOptions = interactable.options.drag\n\n if (\n !(dragOptions && dragOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & interactable.options.drag.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n arg.action = {\n name: 'drag',\n axis: (dragOptions.lockAxis === 'start'\n ? dragOptions.startAxis\n : dragOptions.lockAxis),\n }\n\n return false\n },\n },\n draggable,\n beforeMove,\n move,\n defaults: {\n startAxis : 'xy',\n lockAxis : 'xy',\n } as Interact.DropzoneOptions,\n\n getCursor () {\n return 'move'\n },\n}\n\nexport default drag\n" + ] +} \ No newline at end of file diff --git a/@interactjs/actions/drag.spec.d.ts b/@interactjs/actions/drag.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/actions/drag.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/actions/gesture.d.ts b/@interactjs/actions/gesture.d.ts new file mode 100644 index 000000000..73f8cf31d --- /dev/null +++ b/@interactjs/actions/gesture.d.ts @@ -0,0 +1,42 @@ +export declare type GesturableMethod = Interact.ActionMethod; +declare module '@interactjs/core/Interaction' { + interface Interaction { + gesture?: { + angle: number; + distance: number; + scale: number; + startAngle: number; + startDistance: number; + }; + } +} +declare module '@interactjs/core/Interactable' { + interface Interactable { + gesturable: GesturableMethod; + } +} +declare module '@interactjs/core/defaultOptions' { + interface ActionDefaults { + gesture: Interact.GesturableOptions; + } +} +declare module '@interactjs/core/scope' { + interface ActionMap { + gesture?: typeof gesture; + } +} +export interface GestureEvent extends Interact.InteractEvent<'gesture'> { + distance: number; + angle: number; + da: number; + scale: number; + ds: number; + box: Interact.Rect; + touches: Interact.PointerType[]; +} +export interface GestureSignalArg extends Interact.DoPhaseArg<'gesture', Interact.EventPhase> { + iEvent: GestureEvent; + interaction: Interact.Interaction<'gesture'>; +} +declare const gesture: Interact.Plugin; +export default gesture; diff --git a/@interactjs/actions/gesture.js b/@interactjs/actions/gesture.js new file mode 100644 index 000000000..02ce8942b --- /dev/null +++ b/@interactjs/actions/gesture.js @@ -0,0 +1,147 @@ +import * as utils from "../utils/index.js"; + +function install(scope) { + const { + actions, + Interactable, + defaults + } = scope; + /** + * ```js + * interact(element).gesturable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * // limit multiple gestures. + * // See the explanation in {@link Interactable.draggable} example + * max: Infinity, + * maxPerElement: 1, + * }) + * + * var isGestureable = interact(element).gesturable() + * ``` + * + * Gets or sets whether multitouch gestures can be performed on the target + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on gesture events (makes the Interactable gesturable) + * @return {boolean | Interactable} A boolean indicating if this can be the + * target of gesture events, or this Interactable + */ + + Interactable.prototype.gesturable = function (options) { + if (utils.is.object(options)) { + this.options.gesture.enabled = options.enabled !== false; + this.setPerAction('gesture', options); + this.setOnEvents('gesture', options); + return this; + } + + if (utils.is.bool(options)) { + this.options.gesture.enabled = options; + return this; + } + + return this.options.gesture; + }; + + actions.map.gesture = gesture; + actions.methodDict.gesture = 'gesturable'; + defaults.actions.gesture = gesture.defaults; +} + +function updateGestureProps({ + interaction, + iEvent, + phase +}) { + if (interaction.prepared.name !== 'gesture') { + return; + } + + const pointers = interaction.pointers.map(p => p.pointer); + const starting = phase === 'start'; + const ending = phase === 'end'; + const deltaSource = interaction.interactable.options.deltaSource; + iEvent.touches = [pointers[0], pointers[1]]; + + if (starting) { + iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource); + iEvent.box = utils.pointer.touchBBox(pointers); + iEvent.scale = 1; + iEvent.ds = 0; + iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource); + iEvent.da = 0; + interaction.gesture.startDistance = iEvent.distance; + interaction.gesture.startAngle = iEvent.angle; + } else if (ending) { + const prevEvent = interaction.prevEvent; + iEvent.distance = prevEvent.distance; + iEvent.box = prevEvent.box; + iEvent.scale = prevEvent.scale; + iEvent.ds = 0; + iEvent.angle = prevEvent.angle; + iEvent.da = 0; + } else { + iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource); + iEvent.box = utils.pointer.touchBBox(pointers); + iEvent.scale = iEvent.distance / interaction.gesture.startDistance; + iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource); + iEvent.ds = iEvent.scale - interaction.gesture.scale; + iEvent.da = iEvent.angle - interaction.gesture.angle; + } + + interaction.gesture.distance = iEvent.distance; + interaction.gesture.angle = iEvent.angle; + + if (utils.is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) { + interaction.gesture.scale = iEvent.scale; + } +} + +const gesture = { + id: 'actions/gesture', + before: ['actions/drag', 'actions/resize'], + install, + listeners: { + 'interactions:action-start': updateGestureProps, + 'interactions:action-move': updateGestureProps, + 'interactions:action-end': updateGestureProps, + 'interactions:new': ({ + interaction + }) => { + interaction.gesture = { + angle: 0, + distance: 0, + scale: 1, + startAngle: 0, + startDistance: 0 + }; + }, + 'auto-start:check': arg => { + if (arg.interaction.pointers.length < 2) { + return undefined; + } + + const gestureOptions = arg.interactable.options.gesture; + + if (!(gestureOptions && gestureOptions.enabled)) { + return undefined; + } + + arg.action = { + name: 'gesture' + }; + return false; + } + }, + defaults: {}, + + getCursor() { + return ''; + } + +}; +export default gesture; +//# sourceMappingURL=gesture.js.map \ No newline at end of file diff --git a/@interactjs/actions/gesture.js.map b/@interactjs/actions/gesture.js.map new file mode 100644 index 000000000..71cbfcfb4 --- /dev/null +++ b/@interactjs/actions/gesture.js.map @@ -0,0 +1,68 @@ +{ + "version": 3, + "sources": [ + "gesture.ts" + ], + "names": [ + "utils", + "install", + "scope", + "actions", + "Interactable", + "defaults", + "prototype", + "gesturable", + "options", + "is", + "object", + "gesture", + "enabled", + "setPerAction", + "setOnEvents", + "bool", + "map", + "methodDict", + "updateGestureProps", + "interaction", + "iEvent", + "phase", + "prepared", + "name", + "pointers", + "p", + "pointer", + "starting", + "ending", + "deltaSource", + "interactable", + "touches", + "distance", + "touchDistance", + "box", + "touchBBox", + "scale", + "ds", + "angle", + "touchAngle", + "da", + "startDistance", + "startAngle", + "prevEvent", + "number", + "Infinity", + "isNaN", + "id", + "before", + "listeners", + "arg", + "length", + "undefined", + "gestureOptions", + "action", + "getCursor" + ], + "mappings": "AAAA,OAAO,KAAKA,KAAZ;;AAiDA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AACvC,QAAM;AACJC,IAAAA,OADI;AAEJC,IAAAA,YAFI;AAGJC,IAAAA;AAHI,MAIF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/C,EAAAA,OAH+B;AAI/BgD,EAAAA,SAAS,EAAE;AACT,iCAA6B/B,kBADpB;AAET,gCAA4BA,kBAFnB;AAGT,+BAA2BA,kBAHlB;AAKT,wBAAoB,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAqB;AACvCA,MAAAA,WAAW,CAACR,OAAZ,GAAsB;AACpB2B,QAAAA,KAAK,EAAE,CADa;AAEpBN,QAAAA,QAAQ,EAAE,CAFU;AAGpBI,QAAAA,KAAK,EAAE,CAHa;AAIpBM,QAAAA,UAAU,EAAE,CAJQ;AAKpBD,QAAAA,aAAa,EAAE;AALK,OAAtB;AAOD,KAbQ;AAeT,wBAAoBS,GAAG,IAAI;AACzB,UAAIA,GAAG,CAAC/B,WAAJ,CAAgBK,QAAhB,CAAyB2B,MAAzB,GAAkC,CAAtC,EAAyC;AACvC,eAAOC,SAAP;AACD;;AAED,YAAMC,cAAc,GAAGH,GAAG,CAACpB,YAAJ,CAAiBtB,OAAjB,CAAyBG,OAAhD;;AAEA,UAAI,EAAE0C,cAAc,IAAIA,cAAc,CAACzC,OAAnC,CAAJ,EAAiD;AAC/C,eAAOwC,SAAP;AACD;;AAEDF,MAAAA,GAAG,CAACI,MAAJ,GAAa;AAAE/B,QAAAA,IAAI,EAAE;AAAR,OAAb;AAEA,aAAO,KAAP;AACD;AA7BQ,GAJoB;AAoC/BlB,EAAAA,QAAQ,EAAE,EApCqB;;AAuC/BkD,EAAAA,SAAS,GAAI;AACX,WAAO,EAAP;AACD;;AAzC8B,CAAjC;AA4CA,eAAe5C,OAAf", + "sourcesContent": [ + "import * as utils from '@interactjs/utils/index'\n\nexport type GesturableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n gesture?: {\n angle: number // angle from first to second touch\n distance: number\n scale: number // gesture.distance / gesture.startDistance\n startAngle: number // angle of line joining two touches\n startDistance: number // distance between two touches of touchStart\n }\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n gesturable: GesturableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n gesture: Interact.GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GestureEvent extends Interact.InteractEvent<'gesture'> {\n distance: number\n angle: number\n da: number // angle change\n scale: number // ratio of distance start to current event\n ds: number // scale change\n box: Interact.Rect // enclosing box of all points\n touches: Interact.PointerType[]\n}\n\nexport interface GestureSignalArg extends Interact.DoPhaseArg<'gesture', Interact.EventPhase> {\n iEvent: GestureEvent\n interaction: Interact.Interaction<'gesture'>\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n /**\n * ```js\n * interact(element).gesturable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // limit multiple gestures.\n * // See the explanation in {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isGestureable = interact(element).gesturable()\n * ```\n *\n * Gets or sets whether multitouch gestures can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on gesture events (makes the Interactable gesturable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of gesture events, or this Interactable\n */\n Interactable.prototype.gesturable = function (this: Interact.Interactable, options: Interact.GesturableOptions | boolean) {\n if (utils.is.object(options)) {\n this.options.gesture.enabled = options.enabled !== false\n this.setPerAction('gesture', options)\n this.setOnEvents('gesture', options)\n\n return this\n }\n\n if (utils.is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as Interact.Options\n } as GesturableMethod\n\n actions.map.gesture = gesture\n actions.methodDict.gesture = 'gesturable'\n\n defaults.actions.gesture = gesture.defaults\n}\n\nfunction updateGestureProps ({ interaction, iEvent, phase }: GestureSignalArg) {\n if (interaction.prepared.name !== 'gesture') { return }\n\n const pointers = interaction.pointers.map(p => p.pointer)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const deltaSource = interaction.interactable.options.deltaSource\n\n iEvent.touches = [pointers[0], pointers[1]]\n\n if (starting) {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n }\n else if (ending) {\n const prevEvent = interaction.prevEvent as GestureEvent\n\n iEvent.distance = prevEvent.distance\n iEvent.box = prevEvent.box\n iEvent.scale = prevEvent.scale\n iEvent.ds = 0\n iEvent.angle = prevEvent.angle\n iEvent.da = 0\n }\n else {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n\n iEvent.ds = iEvent.scale - interaction.gesture.scale\n iEvent.da = iEvent.angle - interaction.gesture.angle\n }\n\n interaction.gesture.distance = iEvent.distance\n interaction.gesture.angle = iEvent.angle\n\n if (utils.is.number(iEvent.scale) &&\n iEvent.scale !== Infinity &&\n !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: Interact.Plugin = {\n id: 'actions/gesture',\n before: ['actions/drag', 'actions/resize'],\n install,\n listeners: {\n 'interactions:action-start': updateGestureProps,\n 'interactions:action-move': updateGestureProps,\n 'interactions:action-end': updateGestureProps,\n\n 'interactions:new': ({ interaction }) => {\n interaction.gesture = {\n angle: 0,\n distance: 0,\n scale: 1,\n startAngle: 0,\n startDistance: 0,\n }\n },\n\n 'auto-start:check': arg => {\n if (arg.interaction.pointers.length < 2) {\n return undefined\n }\n\n const gestureOptions = arg.interactable.options.gesture\n\n if (!(gestureOptions && gestureOptions.enabled)) {\n return undefined\n }\n\n arg.action = { name: 'gesture' }\n\n return false\n },\n },\n\n defaults: {\n },\n\n getCursor () {\n return ''\n },\n}\n\nexport default gesture\n" + ] +} \ No newline at end of file diff --git a/@interactjs/actions/gesture.spec.d.ts b/@interactjs/actions/gesture.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/actions/gesture.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/actions/index.d.ts b/@interactjs/actions/index.d.ts new file mode 100644 index 000000000..272eb728a --- /dev/null +++ b/@interactjs/actions/index.d.ts @@ -0,0 +1,8 @@ +import { Scope } from '@interactjs/core/scope'; +import drag from './drag'; +import drop from './drop/index'; +import gesture from './gesture'; +import resize from './resize'; +declare function install(scope: Scope): void; +declare const id = "actions"; +export { id, install, gesture, resize, drag, drop, }; diff --git a/@interactjs/actions/index.js b/@interactjs/actions/index.js new file mode 100644 index 000000000..2257fd67b --- /dev/null +++ b/@interactjs/actions/index.js @@ -0,0 +1,15 @@ +import drag from "./drag.js"; +import drop from "./drop/index.js"; +import gesture from "./gesture.js"; +import resize from "./resize.js"; + +function install(scope) { + scope.usePlugin(gesture); + scope.usePlugin(resize); + scope.usePlugin(drag); + scope.usePlugin(drop); +} + +const id = 'actions'; +export { id, install, gesture, resize, drag, drop }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/actions/index.js.map b/@interactjs/actions/index.js.map new file mode 100644 index 000000000..dfbb48ae7 --- /dev/null +++ b/@interactjs/actions/index.js.map @@ -0,0 +1,20 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "drag", + "drop", + "gesture", + "resize", + "install", + "scope", + "usePlugin", + "id" + ], + "mappings": "AACA,OAAOA,IAAP;AACA,OAAOC,IAAP;AACA,OAAOC,OAAP;AACA,OAAOC,MAAP;;AAEA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AAC9BA,EAAAA,KAAK,CAACC,SAAN,CAAgBJ,OAAhB;AACAG,EAAAA,KAAK,CAACC,SAAN,CAAgBH,MAAhB;AACAE,EAAAA,KAAK,CAACC,SAAN,CAAgBN,IAAhB;AACAK,EAAAA,KAAK,CAACC,SAAN,CAAgBL,IAAhB;AACD;;AAED,MAAMM,EAAE,GAAG,SAAX;AAEA,SACEA,EADF,EAEEH,OAFF,EAGEF,OAHF,EAIEC,MAJF,EAKEH,IALF,EAMEC,IANF", + "sourcesContent": [ + "import { Scope } from '@interactjs/core/scope'\nimport drag from './drag'\nimport drop from './drop/index'\nimport gesture from './gesture'\nimport resize from './resize'\n\nfunction install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n}\n\nconst id = 'actions'\n\nexport {\n id,\n install,\n gesture,\n resize,\n drag,\n drop,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/actions/resize.d.ts b/@interactjs/actions/resize.d.ts new file mode 100644 index 000000000..1d050a5f2 --- /dev/null +++ b/@interactjs/actions/resize.d.ts @@ -0,0 +1,29 @@ +export declare type EdgeName = 'top' | 'left' | 'bottom' | 'right'; +export declare type ResizableMethod = Interact.ActionMethod; +declare module '@interactjs/core/Interactable' { + interface Interactable { + resizable: ResizableMethod; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + resizeAxes: 'x' | 'y' | 'xy'; + resizeStartAspectRatio: number; + } +} +declare module '@interactjs/core/defaultOptions' { + interface ActionDefaults { + resize: Interact.ResizableOptions; + } +} +declare module '@interactjs/core/scope' { + interface ActionMap { + resize?: typeof resize; + } +} +export interface ResizeEvent

extends Interact.InteractEvent<'resize', P> { + deltaRect?: Interact.FullRect; + edges?: Interact.ActionProps['edges']; +} +declare const resize: Interact.Plugin; +export default resize; diff --git a/@interactjs/actions/resize.js b/@interactjs/actions/resize.js new file mode 100644 index 000000000..6c3078aa5 --- /dev/null +++ b/@interactjs/actions/resize.js @@ -0,0 +1,446 @@ +import { Interaction } from "../core/Interaction.js"; +import * as dom from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import * as is from "../utils/is.js"; + +function install(scope) { + const { + actions, + browser, + + /** @lends Interactable */ + Interactable, + // tslint:disable-line no-shadowed-variable + defaults + } = scope; // Less Precision with touch input + + resize.cursors = initCursors(browser); + resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10; + /** + * ```js + * interact(element).resizable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * edges: { + * top : true, // Use pointer coords to check for resize. + * left : false, // Disable resizing from left edge. + * bottom: '.resize-s',// Resize if pointer target matches selector + * right : handleEl // Resize if pointer target is the given Element + * }, + * + * // Width and height can be adjusted independently. When `true`, width and + * // height are adjusted at a 1:1 ratio. + * square: false, + * + * // Width and height can be adjusted independently. When `true`, width and + * // height maintain the aspect ratio they had when resizing started. + * preserveAspectRatio: false, + * + * // a value of 'none' will limit the resize rect to a minimum of 0x0 + * // 'negate' will allow the rect to have negative width/height + * // 'reposition' will keep the width/height positive by swapping + * // the top and bottom edges and/or swapping the left and right edges + * invert: 'none' || 'negate' || 'reposition' + * + * // limit multiple resizes. + * // See the explanation in the {@link Interactable.draggable} example + * max: Infinity, + * maxPerElement: 1, + * }) + * + * var isResizeable = interact(element).resizable() + * ``` + * + * Gets or sets whether resize actions can be performed on the target + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on resize events (object makes the Interactable + * resizable) + * @return {boolean | Interactable} A boolean indicating if this can be the + * target of resize elements, or this Interactable + */ + + Interactable.prototype.resizable = function (options) { + return resizable(this, options, scope); + }; + + actions.map.resize = resize; + actions.methodDict.resize = 'resizable'; + defaults.actions.resize = resize.defaults; +} + +function resizeChecker(arg) { + const { + interaction, + interactable, + element, + rect, + buttons + } = arg; + + if (!rect) { + return undefined; + } + + const page = extend({}, interaction.coords.cur.page); + const resizeOptions = interactable.options.resize; + + if (!(resizeOptions && resizeOptions.enabled) || // check mouseButton setting if the pointer is down + interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & resizeOptions.mouseButtons) === 0) { + return undefined; + } // if using resize.edges + + + if (is.object(resizeOptions.edges)) { + const resizeEdges = { + left: false, + right: false, + top: false, + bottom: false + }; + + for (const edge in resizeEdges) { + resizeEdges[edge] = checkResizeEdge(edge, resizeOptions.edges[edge], page, interaction._latestPointer.eventTarget, element, rect, resizeOptions.margin || resize.defaultMargin); + } + + resizeEdges.left = resizeEdges.left && !resizeEdges.right; + resizeEdges.top = resizeEdges.top && !resizeEdges.bottom; + + if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) { + arg.action = { + name: 'resize', + edges: resizeEdges + }; + } + } else { + const right = resizeOptions.axis !== 'y' && page.x > rect.right - resize.defaultMargin; + const bottom = resizeOptions.axis !== 'x' && page.y > rect.bottom - resize.defaultMargin; + + if (right || bottom) { + arg.action = { + name: 'resize', + axes: (right ? 'x' : '') + (bottom ? 'y' : '') + }; + } + } + + return arg.action ? false : undefined; +} + +function resizable(interactable, options, scope) { + if (is.object(options)) { + interactable.options.resize.enabled = options.enabled !== false; + interactable.setPerAction('resize', options); + interactable.setOnEvents('resize', options); + + if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) { + interactable.options.resize.axis = options.axis; + } else if (options.axis === null) { + interactable.options.resize.axis = scope.defaults.actions.resize.axis; + } + + if (is.bool(options.preserveAspectRatio)) { + interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio; + } else if (is.bool(options.square)) { + interactable.options.resize.square = options.square; + } + + return interactable; + } + + if (is.bool(options)) { + interactable.options.resize.enabled = options; + return interactable; + } + + return interactable.options.resize; +} + +function checkResizeEdge(name, value, page, element, interactableElement, rect, margin) { + // false, '', undefined, null + if (!value) { + return false; + } // true value, use pointer coords and element rect + + + if (value === true) { + // if dimensions are negative, "switch" edges + const width = is.number(rect.width) ? rect.width : rect.right - rect.left; + const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top; // don't use margin greater than half the relevent dimension + + margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2); + + if (width < 0) { + if (name === 'left') { + name = 'right'; + } else if (name === 'right') { + name = 'left'; + } + } + + if (height < 0) { + if (name === 'top') { + name = 'bottom'; + } else if (name === 'bottom') { + name = 'top'; + } + } + + if (name === 'left') { + return page.x < (width >= 0 ? rect.left : rect.right) + margin; + } + + if (name === 'top') { + return page.y < (height >= 0 ? rect.top : rect.bottom) + margin; + } + + if (name === 'right') { + return page.x > (width >= 0 ? rect.right : rect.left) - margin; + } + + if (name === 'bottom') { + return page.y > (height >= 0 ? rect.bottom : rect.top) - margin; + } + } // the remaining checks require an element + + + if (!is.element(element)) { + return false; + } + + return is.element(value) // the value is an element to use as a resize handle + ? value === element // otherwise check if element matches value as selector + : dom.matchesUpTo(element, value, interactableElement); +} + +function initCursors(browser) { + return browser.isIe9 ? { + x: 'e-resize', + y: 's-resize', + xy: 'se-resize', + top: 'n-resize', + left: 'w-resize', + bottom: 's-resize', + right: 'e-resize', + topleft: 'se-resize', + bottomright: 'se-resize', + topright: 'ne-resize', + bottomleft: 'ne-resize' + } : { + x: 'ew-resize', + y: 'ns-resize', + xy: 'nwse-resize', + top: 'ns-resize', + left: 'ew-resize', + bottom: 'ns-resize', + right: 'ew-resize', + topleft: 'nwse-resize', + bottomright: 'nwse-resize', + topright: 'nesw-resize', + bottomleft: 'nesw-resize' + }; +} + +function start({ + iEvent, + interaction +}) { + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + const resizeEvent = iEvent; + const rect = interaction.rect; + interaction._rects = { + start: extend({}, rect), + corrected: extend({}, rect), + previous: extend({}, rect), + delta: { + left: 0, + right: 0, + width: 0, + top: 0, + bottom: 0, + height: 0 + } + }; + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = interaction._rects.corrected; + resizeEvent.deltaRect = interaction._rects.delta; +} + +function move({ + iEvent, + interaction +}) { + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + const resizeEvent = iEvent; + const resizeOptions = interaction.interactable.options.resize; + const invert = resizeOptions.invert; + const invertible = invert === 'reposition' || invert === 'negate'; // eslint-disable-next-line no-shadow + + const current = interaction.rect; + const { + start: startRect, + corrected, + delta: deltaRect, + previous + } = interaction._rects; + extend(previous, corrected); + + if (invertible) { + // if invertible, copy the current rect + extend(corrected, current); + + if (invert === 'reposition') { + // swap edge values if necessary to keep width/height positive + if (corrected.top > corrected.bottom) { + const swap = corrected.top; + corrected.top = corrected.bottom; + corrected.bottom = swap; + } + + if (corrected.left > corrected.right) { + const swap = corrected.left; + corrected.left = corrected.right; + corrected.right = swap; + } + } + } else { + // if not invertible, restrict to minimum of 0x0 rect + corrected.top = Math.min(current.top, startRect.bottom); + corrected.bottom = Math.max(current.bottom, startRect.top); + corrected.left = Math.min(current.left, startRect.right); + corrected.right = Math.max(current.right, startRect.left); + } + + corrected.width = corrected.right - corrected.left; + corrected.height = corrected.bottom - corrected.top; + + for (const edge in corrected) { + deltaRect[edge] = corrected[edge] - previous[edge]; + } + + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = corrected; + resizeEvent.deltaRect = deltaRect; +} + +function end({ + iEvent, + interaction +}) { + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + const resizeEvent = iEvent; + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = interaction._rects.corrected; + resizeEvent.deltaRect = interaction._rects.delta; +} + +function updateEventAxes({ + iEvent, + interaction +}) { + if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { + return; + } + + const options = interaction.interactable.options; + const resizeEvent = iEvent; + + if (options.resize.square) { + if (interaction.resizeAxes === 'y') { + resizeEvent.delta.x = resizeEvent.delta.y; + } else { + resizeEvent.delta.y = resizeEvent.delta.x; + } + + resizeEvent.axes = 'xy'; + } else { + resizeEvent.axes = interaction.resizeAxes; + + if (interaction.resizeAxes === 'x') { + resizeEvent.delta.y = 0; + } else if (interaction.resizeAxes === 'y') { + resizeEvent.delta.x = 0; + } + } +} + +const resize = { + id: 'actions/resize', + before: ['actions/drag'], + install, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.resizeAxes = 'xy'; + }, + 'interactions:action-start': arg => { + start(arg); + updateEventAxes(arg); + }, + 'interactions:action-move': arg => { + move(arg); + updateEventAxes(arg); + }, + 'interactions:action-end': end, + 'auto-start:check': resizeChecker + }, + defaults: { + square: false, + preserveAspectRatio: false, + axis: 'xy', + // use default margin + margin: NaN, + // object with props left, right, top, bottom which are + // true/false values to resize when the pointer is over that edge, + // CSS selectors to match the handles for each direction + // or the Elements for each handle + edges: null, + // a value of 'none' will limit the resize rect to a minimum of 0x0 + // 'negate' will alow the rect to have negative width/height + // 'reposition' will keep the width/height positive by swapping + // the top and bottom edges and/or swapping the left and right edges + invert: 'none' + }, + cursors: null, + + getCursor({ + edges, + axis, + name + }) { + const cursors = resize.cursors; + let result = null; + + if (axis) { + result = cursors[name + axis]; + } else if (edges) { + let cursorKey = ''; + + for (const edge of ['top', 'bottom', 'left', 'right']) { + if (edges[edge]) { + cursorKey += edge; + } + } + + result = cursors[cursorKey]; + } + + return result; + }, + + defaultMargin: null +}; +export default resize; +//# sourceMappingURL=resize.js.map \ No newline at end of file diff --git a/@interactjs/actions/resize.js.map b/@interactjs/actions/resize.js.map new file mode 100644 index 000000000..cbff92985 --- /dev/null +++ b/@interactjs/actions/resize.js.map @@ -0,0 +1,114 @@ +{ + "version": 3, + "sources": [ + "resize.ts" + ], + "names": [ + "Interaction", + "dom", + "extend", + "is", + "install", + "scope", + "actions", + "browser", + "Interactable", + "defaults", + "resize", + "cursors", + "initCursors", + "defaultMargin", + "supportsTouch", + "supportsPointerEvent", + "prototype", + "resizable", + "options", + "map", + "methodDict", + "resizeChecker", + "arg", + "interaction", + "interactable", + "element", + "rect", + "buttons", + "undefined", + "page", + "coords", + "cur", + "resizeOptions", + "enabled", + "pointerIsDown", + "test", + "pointerType", + "mouseButtons", + "object", + "edges", + "resizeEdges", + "left", + "right", + "top", + "bottom", + "edge", + "checkResizeEdge", + "_latestPointer", + "eventTarget", + "margin", + "action", + "name", + "axis", + "x", + "y", + "axes", + "setPerAction", + "setOnEvents", + "string", + "bool", + "preserveAspectRatio", + "square", + "value", + "interactableElement", + "width", + "number", + "height", + "Math", + "min", + "matchesUpTo", + "isIe9", + "xy", + "topleft", + "bottomright", + "topright", + "bottomleft", + "start", + "iEvent", + "prepared", + "resizeEvent", + "_rects", + "corrected", + "previous", + "delta", + "deltaRect", + "move", + "invert", + "invertible", + "current", + "startRect", + "swap", + "max", + "end", + "updateEventAxes", + "resizeAxes", + "id", + "before", + "listeners", + "NaN", + "getCursor", + "result", + "cursorKey" + ], + "mappings": "AAAA,SAASA,WAAT;AAEA,OAAO,KAAKC,GAAZ;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;;AAoCA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AAC9B,QAAM;AACJC,IAAAA,OADI;AAEJC,IAAAA,OAFI;;AAGJ;AACAC,IAAAA,YAJI;AAIU;AACdC,IAAAA;AALI,MAMFJ,KANJ,CAD8B,CAS9B;;AAEAK,EAAAA,MAAM,CAACC,OAAP,GAAiBC,WAAW,CAACL,OAAD,CAA5B;AACAG,EAAAA,MAAM,CAACG,aAAP,GAAuBN,OAAO,CAACO,aAAR,IAAyBP,OAAO,CAACQ,oBAAjC,GAAwD,EAAxD,GAA6D,EAApF;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CAP,EAAAA,YAAY,CAACQ,SAAb,CAAuBC,SAAvB,GAAmC,UAAuCC,OAAvC,EAAqF;AACtH,WAAOD,SAAS,CAAC,IAAD,EAAOC,OAAP,EAAgBb,KAAhB,CAAhB;AACD,GAFD;;AAIAC,EAAAA,OAAO,CAACa,GAAR,CAAYT,MAAZ,GAAqBA,MAArB;AACAJ,EAAAA,OAAO,CAACc,UAAR,CAAmBV,MAAnB,GAA4B,WAA5B;AAEAD,EAAAA,QAAQ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,EAAE;AACRoD,IAAAA,MAAM,EAAE,KADA;AAERD,IAAAA,mBAAmB,EAAE,KAFb;AAGRR,IAAAA,IAAI,EAAE,IAHE;AAKR;AACAH,IAAAA,MAAM,EAAEiD,GANA;AAQR;AACA;AACA;AACA;AACA3D,IAAAA,KAAK,EAAE,IAZC;AAcR;AACA;AACA;AACA;AACA+C,IAAAA,MAAM,EAAE;AAlBA,GArBoB;AA0C9B3E,EAAAA,OAAO,EAAE,IA1CqB;;AA4C9BwF,EAAAA,SAAS,CAAE;AAAE5D,IAAAA,KAAF;AAASa,IAAAA,IAAT;AAAeD,IAAAA;AAAf,GAAF,EAA+C;AACtD,UAAMxC,OAAO,GAAGD,MAAM,CAACC,OAAvB;AACA,QAAIyF,MAAc,GAAG,IAArB;;AAEA,QAAIhD,IAAJ,EAAU;AACRgD,MAAAA,MAAM,GAAGzF,OAAO,CAACwC,IAAI,GAAGC,IAAR,CAAhB;AACD,KAFD,MAGK,IAAIb,KAAJ,EAAW;AACd,UAAI8D,SAAS,GAAG,EAAhB;;AAEA,WAAK,MAAMxD,IAAX,IAAmB,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CAAnB,EAAuD;AACrD,YAAIN,KAAK,CAACM,IAAD,CAAT,EAAiB;AACfwD,UAAAA,SAAS,IAAIxD,IAAb;AACD;AACF;;AAEDuD,MAAAA,MAAM,GAAGzF,OAAO,CAAC0F,SAAD,CAAhB;AACD;;AAED,WAAOD,MAAP;AACD,GAhE6B;;AAkE9BvF,EAAAA,aAAa,EAAE;AAlEe,CAAhC;AAqEA,eAAeH,MAAf", + "sourcesContent": [ + "import { Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n resizable: ResizableMethod\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n resizeAxes: 'x' | 'y' | 'xy'\n resizeStartAspectRatio: number\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n resize: Interact.ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizeEvent

extends Interact.InteractEvent<'resize', P> {\n deltaRect?: Interact.FullRect\n edges?: Interact.ActionProps['edges']\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n browser,\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n defaults,\n } = scope\n\n // Less Precision with touch input\n\n resize.cursors = initCursors(browser)\n resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10\n\n /**\n * ```js\n * interact(element).resizable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * edges: {\n * top : true, // Use pointer coords to check for resize.\n * left : false, // Disable resizing from left edge.\n * bottom: '.resize-s',// Resize if pointer target matches selector\n * right : handleEl // Resize if pointer target is the given Element\n * },\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height are adjusted at a 1:1 ratio.\n * square: false,\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height maintain the aspect ratio they had when resizing started.\n * preserveAspectRatio: false,\n *\n * // a value of 'none' will limit the resize rect to a minimum of 0x0\n * // 'negate' will allow the rect to have negative width/height\n * // 'reposition' will keep the width/height positive by swapping\n * // the top and bottom edges and/or swapping the left and right edges\n * invert: 'none' || 'negate' || 'reposition'\n *\n * // limit multiple resizes.\n * // See the explanation in the {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isResizeable = interact(element).resizable()\n * ```\n *\n * Gets or sets whether resize actions can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on resize events (object makes the Interactable\n * resizable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of resize elements, or this Interactable\n */\n Interactable.prototype.resizable = function (this: Interact.Interactable, options: Interact.ResizableOptions | boolean) {\n return resizable(this, options, scope)\n } as ResizableMethod\n\n actions.map.resize = resize\n actions.methodDict.resize = 'resizable'\n\n defaults.actions.resize = resize.defaults\n}\n\nfunction resizeChecker (arg) {\n const { interaction, interactable, element, rect, buttons } = arg\n\n if (!rect) { return undefined }\n\n const page = extend({}, interaction.coords.cur.page)\n const resizeOptions = interactable.options.resize\n\n if (\n !(resizeOptions && resizeOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & resizeOptions.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n // if using resize.edges\n if (is.object(resizeOptions.edges)) {\n const resizeEdges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n\n for (const edge in resizeEdges) {\n resizeEdges[edge] = checkResizeEdge(edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin)\n }\n\n resizeEdges.left = resizeEdges.left && !resizeEdges.right\n resizeEdges.top = resizeEdges.top && !resizeEdges.bottom\n\n if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {\n arg.action = {\n name: 'resize',\n edges: resizeEdges,\n }\n }\n }\n else {\n const right = resizeOptions.axis !== 'y' && page.x > (rect.right - resize.defaultMargin)\n const bottom = resizeOptions.axis !== 'x' && page.y > (rect.bottom - resize.defaultMargin)\n\n if (right || bottom) {\n arg.action = {\n name: 'resize',\n axes: (right ? 'x' : '') + (bottom ? 'y' : ''),\n }\n }\n }\n\n return arg.action ? false : undefined\n}\n\nfunction resizable (interactable: Interact.Interactable, options: Interact.OrBoolean | boolean, scope: Scope) {\n if (is.object(options)) {\n interactable.options.resize.enabled = options.enabled !== false\n interactable.setPerAction('resize', options)\n interactable.setOnEvents('resize', options)\n\n if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {\n interactable.options.resize.axis = options.axis\n }\n else if (options.axis === null) {\n interactable.options.resize.axis = scope.defaults.actions.resize.axis\n }\n\n if (is.bool(options.preserveAspectRatio)) {\n interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio\n }\n else if (is.bool(options.square)) {\n interactable.options.resize.square = options.square\n }\n\n return interactable\n }\n if (is.bool(options)) {\n interactable.options.resize.enabled = options\n\n return interactable\n }\n return interactable.options.resize\n}\n\nfunction checkResizeEdge (\n name: string,\n value: any,\n page: Interact.Point,\n element: Node,\n interactableElement: Interact.Element,\n rect: Interact.Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) { return false }\n\n // true value, use pointer coords and element rect\n if (value === true) {\n // if dimensions are negative, \"switch\" edges\n const width = is.number(rect.width) ? rect.width : rect.right - rect.left\n const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top\n\n // don't use margin greater than half the relevent dimension\n margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2)\n\n if (width < 0) {\n if (name === 'left') { name = 'right' }\n else if (name === 'right') { name = 'left' }\n }\n if (height < 0) {\n if (name === 'top') { name = 'bottom' }\n else if (name === 'bottom') { name = 'top' }\n }\n\n if (name === 'left') { return page.x < ((width >= 0 ? rect.left : rect.right) + margin) }\n if (name === 'top') { return page.y < ((height >= 0 ? rect.top : rect.bottom) + margin) }\n\n if (name === 'right') { return page.x > ((width >= 0 ? rect.right : rect.left) - margin) }\n if (name === 'bottom') { return page.y > ((height >= 0 ? rect.bottom : rect.top) - margin) }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) { return false }\n\n return is.element(value)\n // the value is an element to use as a resize handle\n ? value === element\n // otherwise check if element matches value as selector\n : dom.matchesUpTo(element, value, interactableElement)\n}\n\nfunction initCursors (browser: typeof import ('@interactjs/utils/browser').default) {\n return (browser.isIe9 ? {\n x : 'e-resize',\n y : 's-resize',\n xy: 'se-resize',\n\n top : 'n-resize',\n left : 'w-resize',\n bottom : 's-resize',\n right : 'e-resize',\n topleft : 'se-resize',\n bottomright: 'se-resize',\n topright : 'ne-resize',\n bottomleft : 'ne-resize',\n } : {\n x : 'ew-resize',\n y : 'ns-resize',\n xy: 'nwse-resize',\n\n top : 'ns-resize',\n left : 'ew-resize',\n bottom : 'ns-resize',\n right : 'ew-resize',\n topleft : 'nwse-resize',\n bottomright: 'nwse-resize',\n topright : 'nesw-resize',\n bottomleft : 'nesw-resize',\n })\n}\n\nfunction start ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {\n return\n }\n\n const resizeEvent = iEvent as ResizeEvent\n const rect = interaction.rect\n\n interaction._rects = {\n start: extend({}, rect),\n corrected: extend({}, rect),\n previous: extend({}, rect),\n delta: {\n left: 0,\n right : 0,\n width : 0,\n top : 0,\n bottom: 0,\n height: 0,\n },\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction move ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n const resizeOptions = interaction.interactable.options.resize\n const invert = resizeOptions.invert\n const invertible = invert === 'reposition' || invert === 'negate'\n\n // eslint-disable-next-line no-shadow\n const current = interaction.rect\n const { start: startRect, corrected, delta: deltaRect, previous } = interaction._rects\n\n extend(previous, corrected)\n\n if (invertible) {\n // if invertible, copy the current rect\n extend(corrected, current)\n\n if (invert === 'reposition') {\n // swap edge values if necessary to keep width/height positive\n if (corrected.top > corrected.bottom) {\n const swap = corrected.top\n\n corrected.top = corrected.bottom\n corrected.bottom = swap\n }\n if (corrected.left > corrected.right) {\n const swap = corrected.left\n\n corrected.left = corrected.right\n corrected.right = swap\n }\n }\n }\n else {\n // if not invertible, restrict to minimum of 0x0 rect\n corrected.top = Math.min(current.top, startRect.bottom)\n corrected.bottom = Math.max(current.bottom, startRect.top)\n corrected.left = Math.min(current.left, startRect.right)\n corrected.right = Math.max(current.right, startRect.left)\n }\n\n corrected.width = corrected.right - corrected.left\n corrected.height = corrected.bottom - corrected.top\n\n for (const edge in corrected) {\n deltaRect[edge] = corrected[edge] - previous[edge]\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = corrected\n resizeEvent.deltaRect = deltaRect\n}\n\nfunction end ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction updateEventAxes ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { return }\n\n const options = interaction.interactable.options\n const resizeEvent = iEvent as ResizeEvent\n\n if (options.resize.square) {\n if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = resizeEvent.delta.y\n }\n else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n }\n else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n }\n else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: Interact.Plugin = {\n id: 'actions/resize',\n before: ['actions/drag'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.resizeAxes = 'xy'\n },\n\n 'interactions:action-start': arg => {\n start(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-move': arg => {\n move(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-end': end,\n 'auto-start:check': resizeChecker,\n },\n\n defaults: {\n square: false,\n preserveAspectRatio: false,\n axis: 'xy',\n\n // use default margin\n margin: NaN,\n\n // object with props left, right, top, bottom which are\n // true/false values to resize when the pointer is over that edge,\n // CSS selectors to match the handles for each direction\n // or the Elements for each handle\n edges: null,\n\n // a value of 'none' will limit the resize rect to a minimum of 0x0\n // 'negate' will alow the rect to have negative width/height\n // 'reposition' will keep the width/height positive by swapping\n // the top and bottom edges and/or swapping the left and right edges\n invert: 'none',\n } as Interact.ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: Interact.ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\n }\n else if (edges) {\n let cursorKey = ''\n\n for (const edge of ['top', 'bottom', 'left', 'right']) {\n if (edges[edge]) {\n cursorKey += edge\n }\n }\n\n result = cursors[cursorKey]\n }\n\n return result\n },\n\n defaultMargin: null as number,\n}\n\nexport default resize\n" + ] +} \ No newline at end of file diff --git a/@interactjs/actions/resize.spec.d.ts b/@interactjs/actions/resize.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/actions/resize.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/auto-scroll/.npmignore b/@interactjs/auto-scroll/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/auto-scroll/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/auto-scroll/LICENSE b/@interactjs/auto-scroll/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/auto-scroll/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/auto-scroll/index.d.ts b/@interactjs/auto-scroll/index.d.ts new file mode 100644 index 000000000..b898a5dde --- /dev/null +++ b/@interactjs/auto-scroll/index.d.ts @@ -0,0 +1,61 @@ +declare module '@interactjs/core/scope' { + interface Scope { + autoScroll: typeof autoScroll; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + autoScroll?: typeof autoScroll; + } +} +declare module '@interactjs/core/defaultOptions' { + interface PerActionDefaults { + autoScroll?: AutoScrollOptions; + } +} +export interface AutoScrollOptions { + container?: Window | HTMLElement; + margin?: number; + distance?: number; + interval?: number; + speed?: number; + enabled?: boolean; +} +declare const autoScroll: { + defaults: AutoScrollOptions; + now: () => number; + interaction: import("@interactjs/core/Interaction").Interaction; + i: number; + x: number; + y: number; + isScrolling: boolean; + prevTime: number; + margin: number; + speed: number; + start(interaction: import("@interactjs/core/Interaction").Interaction): void; + stop(): void; + scroll(): void; + check(interactable: import("@interactjs/core/Interactable").Interactable, actionName: "resize" | "drag" | "drop" | "gesture"): boolean; + onInteractionMove({ interaction, pointer }: { + interaction: import("@interactjs/core/Interaction").Interaction; + pointer: import("@interactjs/types/types").PointerType; + }): void; +}; +export declare function getContainer(value: any, interactable: Interact.Interactable, element: Interact.Element): any; +export declare function getScroll(container: any): { + x: any; + y: any; +}; +export declare function getScrollSize(container: any): { + x: any; + y: any; +}; +export declare function getScrollSizeDelta({ interaction, element }: { + interaction: Partial>; + element: Interact.Element; +}, func: any): { + x: number; + y: number; +}; +declare const autoScrollPlugin: Interact.Plugin; +export default autoScrollPlugin; diff --git a/@interactjs/auto-scroll/index.js b/@interactjs/auto-scroll/index.js new file mode 100644 index 000000000..653046c6b --- /dev/null +++ b/@interactjs/auto-scroll/index.js @@ -0,0 +1,246 @@ +import * as domUtils from "../utils/domUtils.js"; +import * as is from "../utils/is.js"; +import raf from "../utils/raf.js"; +import { getStringOptionResult } from "../utils/rect.js"; +import { getWindow } from "../utils/window.js"; + +function install(scope) { + const { + defaults, + actions + } = scope; + scope.autoScroll = autoScroll; + + autoScroll.now = () => scope.now(); + + actions.phaselessTypes.autoscroll = true; + defaults.perAction.autoScroll = autoScroll.defaults; +} + +const autoScroll = { + defaults: { + enabled: false, + margin: 60, + // the item that is scrolled (Window or HTMLElement) + container: null, + // the scroll speed in pixels per second + speed: 300 + }, + now: Date.now, + interaction: null, + i: 0, + // the handle returned by window.setInterval + x: 0, + y: 0, + // Direction each pulse is to scroll in + isScrolling: false, + prevTime: 0, + margin: 0, + speed: 0, + + start(interaction) { + autoScroll.isScrolling = true; + raf.cancel(autoScroll.i); + interaction.autoScroll = autoScroll; + autoScroll.interaction = interaction; + autoScroll.prevTime = autoScroll.now(); + autoScroll.i = raf.request(autoScroll.scroll); + }, + + stop() { + autoScroll.isScrolling = false; + + if (autoScroll.interaction) { + autoScroll.interaction.autoScroll = null; + } + + raf.cancel(autoScroll.i); + }, + + // scroll the window by the values in scroll.x/y + scroll() { + const { + interaction + } = autoScroll; + const { + interactable, + element + } = interaction; + const actionName = interaction.prepared.name; + const options = interactable.options[actionName].autoScroll; + const container = getContainer(options.container, interactable, element); + const now = autoScroll.now(); // change in time in seconds + + const dt = (now - autoScroll.prevTime) / 1000; // displacement + + const s = options.speed * dt; + + if (s >= 1) { + const scrollBy = { + x: autoScroll.x * s, + y: autoScroll.y * s + }; + + if (scrollBy.x || scrollBy.y) { + const prevScroll = getScroll(container); + + if (is.window(container)) { + container.scrollBy(scrollBy.x, scrollBy.y); + } else if (container) { + container.scrollLeft += scrollBy.x; + container.scrollTop += scrollBy.y; + } + + const curScroll = getScroll(container); + const delta = { + x: curScroll.x - prevScroll.x, + y: curScroll.y - prevScroll.y + }; + + if (delta.x || delta.y) { + interactable.fire({ + type: 'autoscroll', + target: element, + interactable, + delta, + interaction, + container + }); + } + } + + autoScroll.prevTime = now; + } + + if (autoScroll.isScrolling) { + raf.cancel(autoScroll.i); + autoScroll.i = raf.request(autoScroll.scroll); + } + }, + + check(interactable, actionName) { + const options = interactable.options; + return options[actionName].autoScroll && options[actionName].autoScroll.enabled; + }, + + onInteractionMove({ + interaction, + pointer + }) { + if (!(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))) { + return; + } + + if (interaction.simulation) { + autoScroll.x = autoScroll.y = 0; + return; + } + + let top; + let right; + let bottom; + let left; + const { + interactable, + element + } = interaction; + const actionName = interaction.prepared.name; + const options = interactable.options[actionName].autoScroll; + const container = getContainer(options.container, interactable, element); + + if (is.window(container)) { + left = pointer.clientX < autoScroll.margin; + top = pointer.clientY < autoScroll.margin; + right = pointer.clientX > container.innerWidth - autoScroll.margin; + bottom = pointer.clientY > container.innerHeight - autoScroll.margin; + } else { + const rect = domUtils.getElementClientRect(container); + left = pointer.clientX < rect.left + autoScroll.margin; + top = pointer.clientY < rect.top + autoScroll.margin; + right = pointer.clientX > rect.right - autoScroll.margin; + bottom = pointer.clientY > rect.bottom - autoScroll.margin; + } + + autoScroll.x = right ? 1 : left ? -1 : 0; + autoScroll.y = bottom ? 1 : top ? -1 : 0; + + if (!autoScroll.isScrolling) { + // set the autoScroll properties to those of the target + autoScroll.margin = options.margin; + autoScroll.speed = options.speed; + autoScroll.start(interaction); + } + } + +}; +export function getContainer(value, interactable, element) { + return (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element); +} +export function getScroll(container) { + if (is.window(container)) { + container = window.document.body; + } + + return { + x: container.scrollLeft, + y: container.scrollTop + }; +} +export function getScrollSize(container) { + if (is.window(container)) { + container = window.document.body; + } + + return { + x: container.scrollWidth, + y: container.scrollHeight + }; +} +export function getScrollSizeDelta({ + interaction, + element +}, func) { + const scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll; + + if (!scrollOptions || !scrollOptions.enabled) { + func(); + return { + x: 0, + y: 0 + }; + } + + const scrollContainer = getContainer(scrollOptions.container, interaction.interactable, element); + const prevSize = getScroll(scrollContainer); + func(); + const curSize = getScroll(scrollContainer); + return { + x: curSize.x - prevSize.x, + y: curSize.y - prevSize.y + }; +} +const autoScrollPlugin = { + id: 'auto-scroll', + install, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.autoScroll = null; + }, + 'interactions:destroy': ({ + interaction + }) => { + interaction.autoScroll = null; + autoScroll.stop(); + + if (autoScroll.interaction) { + autoScroll.interaction = null; + } + }, + 'interactions:stop': autoScroll.stop, + 'interactions:action-move': arg => autoScroll.onInteractionMove(arg) + } +}; +export default autoScrollPlugin; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/auto-scroll/index.js.map b/@interactjs/auto-scroll/index.js.map new file mode 100644 index 000000000..ccf0acbec --- /dev/null +++ b/@interactjs/auto-scroll/index.js.map @@ -0,0 +1,94 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "domUtils", + "is", + "raf", + "getStringOptionResult", + "getWindow", + "install", + "scope", + "defaults", + "actions", + "autoScroll", + "now", + "phaselessTypes", + "autoscroll", + "perAction", + "enabled", + "margin", + "container", + "speed", + "Date", + "interaction", + "i", + "x", + "y", + "isScrolling", + "prevTime", + "start", + "cancel", + "request", + "scroll", + "stop", + "interactable", + "element", + "actionName", + "prepared", + "name", + "options", + "getContainer", + "dt", + "s", + "scrollBy", + "prevScroll", + "getScroll", + "window", + "scrollLeft", + "scrollTop", + "curScroll", + "delta", + "fire", + "type", + "target", + "check", + "onInteractionMove", + "pointer", + "interacting", + "simulation", + "top", + "right", + "bottom", + "left", + "clientX", + "clientY", + "innerWidth", + "innerHeight", + "rect", + "getElementClientRect", + "value", + "string", + "document", + "body", + "getScrollSize", + "scrollWidth", + "scrollHeight", + "getScrollSizeDelta", + "func", + "scrollOptions", + "scrollContainer", + "prevSize", + "curSize", + "autoScrollPlugin", + "id", + "listeners", + "arg" + ], + "mappings": "AAAA,OAAO,KAAKA,QAAZ;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,GAAP;AACA,SAASC,qBAAT;AACA,SAASC,SAAT;;AA+BA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AAC9B,QAAM;AACJC,IAAAA,QADI;AAEJC,IAAAA;AAFI,MAGFF,KAHJ;AAKAA,EAAAA,KAAK,CAACG,UAAN,GAAmBA,UAAnB;;AACAA,EAAAA,UAAU,CAACC,GAAX,GAAiB,MAAMJ,KAAK,CAACI,GAAN,EAAvB;;AAEAF,EAAAA,OAAO,CAACG,cAAR,CAAuBC,UAAvB,GAAoC,IAApC;AACAL,EAAAA,QAAQ,CAACM,SAAT,CAAmBJ,UAAnB,GAAgCA,UAAU,CAACF,QAA3C;AACD;;AAED,MAAME,UAAU,GAAG;AACjBF,EAAAA,QAAQ,EAAE;AACRO,IAAAA,OAAO,EAAI,KADH;AAERC,IAAAA,MAAM,EAAK,EAFH;AAIR;AACAC,IAAAA,SAAS,EAAE,IALH;AAOR;AACAC,IAAAA,KAAK,EAAM;AARH,GADO;AAYjBP,EAAAA,GAAG,EAAEQ,IAAI,CAACR,GAZO;AAcjBS,EAAAA,WAAW,EAAE,IAdI;AAejBC,EAAAA,CAAC,EAAE,CAfc;AAeR;AACTC,EAAAA,CAAC,EAAE,CAhBc;AAiBjBC,EAAAA,CAAC,EAAE,CAjBc;AAiBX;AAENC,EAAAA,WAAW,EAAE,KAnBI;AAo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AACF,KAXQ;AAaT,yBAAqBV,UAAU,CAACoB,IAbvB;AAeT,gCAA6BoD,GAAD,IAAcxE,UAAU,CAAC0C,iBAAX,CAA6B8B,GAA7B;AAfjC;AAH6B,CAA1C;AAsBA,eAAeH,gBAAf", + "sourcesContent": [ + "import * as domUtils from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\n\ntype Scope = import ('@interactjs/core/scope').Scope\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoScroll: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoScroll?: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const {\n defaults,\n actions,\n } = scope\n\n scope.autoScroll = autoScroll\n autoScroll.now = () => scope.now()\n\n actions.phaselessTypes.autoscroll = true\n defaults.perAction.autoScroll = autoScroll.defaults\n}\n\nconst autoScroll = {\n defaults: {\n enabled : false,\n margin : 60,\n\n // the item that is scrolled (Window or HTMLElement)\n container: null as AutoScrollOptions['container'],\n\n // the scroll speed in pixels per second\n speed : 300,\n } as AutoScrollOptions,\n\n now: Date.now,\n\n interaction: null as Interact.Interaction,\n i: 0, // the handle returned by window.setInterval\n x: 0,\n y: 0, // Direction each pulse is to scroll in\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: Interact.Interaction) {\n autoScroll.isScrolling = true\n raf.cancel(autoScroll.i)\n\n interaction.autoScroll = autoScroll\n autoScroll.interaction = interaction\n autoScroll.prevTime = autoScroll.now()\n autoScroll.i = raf.request(autoScroll.scroll)\n },\n\n stop () {\n autoScroll.isScrolling = false\n if (autoScroll.interaction) {\n autoScroll.interaction.autoScroll = null\n }\n raf.cancel(autoScroll.i)\n },\n\n // scroll the window by the values in scroll.x/y\n scroll () {\n const { interaction } = autoScroll\n const { interactable, element } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n const now = autoScroll.now()\n // change in time in seconds\n const dt = (now - autoScroll.prevTime) / 1000\n // displacement\n const s = options.speed * dt\n\n if (s >= 1) {\n const scrollBy = {\n x: autoScroll.x * s,\n y: autoScroll.y * s,\n }\n\n if (scrollBy.x || scrollBy.y) {\n const prevScroll = getScroll(container)\n\n if (is.window(container)) {\n container.scrollBy(scrollBy.x, scrollBy.y)\n }\n else if (container) {\n container.scrollLeft += scrollBy.x\n container.scrollTop += scrollBy.y\n }\n\n const curScroll = getScroll(container)\n const delta = {\n x: curScroll.x - prevScroll.x,\n y: curScroll.y - prevScroll.y,\n }\n\n if (delta.x || delta.y) {\n interactable.fire({\n type: 'autoscroll',\n target: element,\n interactable,\n delta,\n interaction,\n container,\n })\n }\n }\n\n autoScroll.prevTime = now\n }\n\n if (autoScroll.isScrolling) {\n raf.cancel(autoScroll.i)\n autoScroll.i = raf.request(autoScroll.scroll)\n }\n },\n check (interactable: Interact.Interactable, actionName: Interact.ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll && options[actionName].autoScroll.enabled\n },\n onInteractionMove ({ interaction, pointer }: { interaction: Interact.Interaction, pointer: Interact.PointerType }) {\n if (!(interaction.interacting() &&\n autoScroll.check(interaction.interactable, interaction.prepared.name))) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top\n let right\n let bottom\n let left\n\n const { interactable, element } = interaction\n const actionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n\n if (is.window(container)) {\n left = pointer.clientX < autoScroll.margin\n top = pointer.clientY < autoScroll.margin\n right = pointer.clientX > container.innerWidth - autoScroll.margin\n bottom = pointer.clientY > container.innerHeight - autoScroll.margin\n }\n else {\n const rect = domUtils.getElementClientRect(container)\n\n left = pointer.clientX < rect.left + autoScroll.margin\n top = pointer.clientY < rect.top + autoScroll.margin\n right = pointer.clientX > rect.right - autoScroll.margin\n bottom = pointer.clientY > rect.bottom - autoScroll.margin\n }\n\n autoScroll.x = (right ? 1 : left ? -1 : 0)\n autoScroll.y = (bottom ? 1 : top ? -1 : 0)\n\n if (!autoScroll.isScrolling) {\n // set the autoScroll properties to those of the target\n autoScroll.margin = options.margin\n autoScroll.speed = options.speed\n\n autoScroll.start(interaction)\n }\n },\n}\n\nexport function getContainer (value: any, interactable: Interact.Interactable, element: Interact.Element) {\n return (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta ({ interaction, element }: {\n interaction: Partial>\n element: Interact.Element\n}, func: any) {\n const scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll\n\n if (!scrollOptions || !scrollOptions.enabled) {\n func()\n return { x: 0, y: 0 }\n }\n\n const scrollContainer = getContainer(\n scrollOptions.container,\n interaction.interactable,\n element,\n )\n\n const prevSize = getScroll(scrollContainer)\n func()\n const curSize = getScroll(scrollContainer)\n\n return {\n x: curSize.x - prevSize.x,\n y: curSize.y - prevSize.y,\n }\n}\n\nconst autoScrollPlugin: Interact.Plugin = {\n id: 'auto-scroll',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoScroll = null\n },\n\n 'interactions:destroy': ({ interaction }) => {\n interaction.autoScroll = null\n autoScroll.stop()\n if (autoScroll.interaction) {\n autoScroll.interaction = null\n }\n },\n\n 'interactions:stop': autoScroll.stop,\n\n 'interactions:action-move': (arg: any) => autoScroll.onInteractionMove(arg),\n },\n}\n\nexport default autoScrollPlugin\n" + ] +} \ No newline at end of file diff --git a/@interactjs/auto-start/.npmignore b/@interactjs/auto-start/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/auto-start/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/auto-start/InteractableMethods.d.ts b/@interactjs/auto-start/InteractableMethods.d.ts new file mode 100644 index 000000000..12bf73d47 --- /dev/null +++ b/@interactjs/auto-start/InteractableMethods.d.ts @@ -0,0 +1,28 @@ +declare module '@interactjs/core/Interactable' { + interface Interactable { + getAction: (this: Interact.Interactable, pointer: Interact.PointerType, event: Interact.PointerEventType, interaction: Interact.Interaction, element: Interact.Element) => Interact.ActionProps | null; + styleCursor: typeof styleCursor; + actionChecker: typeof actionChecker; + ignoreFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + allowFrom: { + (...args: any[]): Interactable; + (): boolean; + }; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + pointerIsDown: boolean; + } +} +declare function install(scope: Interact.Scope): void; +declare function styleCursor(this: Interact.Interactable, newValue?: boolean): any; +declare function actionChecker(this: Interact.Interactable, checker: any): any; +declare const _default: { + id: string; + install: typeof install; +}; +export default _default; diff --git a/@interactjs/auto-start/InteractableMethods.js b/@interactjs/auto-start/InteractableMethods.js new file mode 100644 index 000000000..0d5d6c6b8 --- /dev/null +++ b/@interactjs/auto-start/InteractableMethods.js @@ -0,0 +1,176 @@ +import { warnOnce } from "../utils/index.js"; +import * as is from "../utils/is.js"; + +function install(scope) { + const { + /** @lends Interactable */ + Interactable // tslint:disable-line no-shadowed-variable + + } = scope; + + Interactable.prototype.getAction = function getAction(pointer, event, interaction, element) { + const action = defaultActionChecker(this, event, interaction, element, scope); + + if (this.options.actionChecker) { + return this.options.actionChecker(pointer, event, action, this, element, interaction); + } + + return action; + }; + /** + * ```js + * interact(element, { ignoreFrom: document.getElementById('no-action') }) + * // or + * interact(element).ignoreFrom('input, textarea, a') + * ``` + * @deprecated + * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any + * of it's parents match the given CSS selector or Element, no + * drag/resize/gesture is started. + * + * Don't use this method. Instead set the `ignoreFrom` option for each action + * or for `pointerEvents` + * + * @example + * interact(targett) + * .draggable({ + * ignoreFrom: 'input, textarea, a[href]'', + * }) + * .pointerEvents({ + * ignoreFrom: '[no-pointer]', + * }) + * + * @param {string | Element | null} [newValue] a CSS selector string, an + * Element or `null` to not ignore any elements + * @return {string | Element | object} The current ignoreFrom value or this + * Interactable + */ + + + Interactable.prototype.ignoreFrom = warnOnce(function (newValue) { + return this._backCompatOption('ignoreFrom', newValue); + }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).'); + /** + * @deprecated + * + * A drag/resize/gesture is started only If the target of the `mousedown`, + * `pointerdown` or `touchstart` event or any of it's parents match the given + * CSS selector or Element. + * + * Don't use this method. Instead set the `allowFrom` option for each action + * or for `pointerEvents` + * + * @example + * interact(targett) + * .resizable({ + * allowFrom: '.resize-handle', + * .pointerEvents({ + * allowFrom: '.handle',, + * }) + * + * @param {string | Element | null} [newValue] a CSS selector string, an + * Element or `null` to allow from any element + * @return {string | Element | object} The current allowFrom value or this + * Interactable + */ + + Interactable.prototype.allowFrom = warnOnce(function (newValue) { + return this._backCompatOption('allowFrom', newValue); + }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).'); + /** + * ```js + * interact('.resize-drag') + * .resizable(true) + * .draggable(true) + * .actionChecker(function (pointer, event, action, interactable, element, interaction) { + * + * if (interact.matchesSelector(event.target, '.drag-handle')) { + * // force drag with handle target + * action.name = drag + * } + * else { + * // resize from the top and right edges + * action.name = 'resize' + * action.edges = { top: true, right: true } + * } + * + * return action + * }) + * ``` + * + * Returns or sets the function used to check action to be performed on + * pointerDown + * + * @param {function | null} [checker] A function which takes a pointer event, + * defaultAction string, interactable, element and interaction as parameters + * and returns an object with name property 'drag' 'resize' or 'gesture' and + * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right + * props. + * @return {Function | Interactable} The checker function or this Interactable + */ + + Interactable.prototype.actionChecker = actionChecker; + /** + * Returns or sets whether the the cursor should be changed depending on the + * action that would be performed if the mouse were pressed and dragged. + * + * @param {boolean} [newValue] + * @return {boolean | Interactable} The current setting or this Interactable + */ + + Interactable.prototype.styleCursor = styleCursor; +} + +function defaultActionChecker(interactable, event, interaction, element, scope) { + const rect = interactable.getRect(element); + const buttons = event.buttons || { + 0: 1, + 1: 4, + 3: 8, + 4: 16 + }[event.button]; + const arg = { + action: null, + interactable, + interaction, + element, + rect, + buttons + }; + scope.fire('auto-start:check', arg); + return arg.action; +} + +function styleCursor(newValue) { + if (is.bool(newValue)) { + this.options.styleCursor = newValue; + return this; + } + + if (newValue === null) { + delete this.options.styleCursor; + return this; + } + + return this.options.styleCursor; +} + +function actionChecker(checker) { + if (is.func(checker)) { + this.options.actionChecker = checker; + return this; + } + + if (checker === null) { + delete this.options.actionChecker; + return this; + } + + return this.options.actionChecker; +} + +export default { + id: 'auto-start/interactableMethods', + install +}; +//# sourceMappingURL=InteractableMethods.js.map \ No newline at end of file diff --git a/@interactjs/auto-start/InteractableMethods.js.map b/@interactjs/auto-start/InteractableMethods.js.map new file mode 100644 index 000000000..8b97a12aa --- /dev/null +++ b/@interactjs/auto-start/InteractableMethods.js.map @@ -0,0 +1,43 @@ +{ + "version": 3, + "sources": [ + "InteractableMethods.ts" + ], + "names": [ + "warnOnce", + "is", + "install", + "scope", + "Interactable", + "prototype", + "getAction", + "pointer", + "event", + "interaction", + "element", + "action", + "defaultActionChecker", + "options", + "actionChecker", + "ignoreFrom", + "newValue", + "_backCompatOption", + "allowFrom", + "styleCursor", + "interactable", + "rect", + "getRect", + "buttons", + "button", + "arg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L,CAAaC,aAApB;AAEA,WAAO,IAAP;AACD;;AAED,SAAO,KAAKD,OAAL,CAAaC,aAApB;AACD;;AAED,eAAe;AACbgB,EAAAA,EAAE,EAAE,gCADS;AAEb5B,EAAAA;AAFa,CAAf", + "sourcesContent": [ + "import { warnOnce } from '@interactjs/utils/index'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ) => Interact.ActionProps | null\n styleCursor: typeof styleCursor\n actionChecker: typeof actionChecker\n ignoreFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n allowFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n pointerIsDown: boolean\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n } = scope\n\n Interactable.prototype.getAction = function getAction (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ): Interact.ActionProps {\n const action = defaultActionChecker(this, event, interaction, element, scope)\n\n if (this.options.actionChecker) {\n return this.options.actionChecker(pointer, event, action, this, element, interaction)\n }\n\n return action\n }\n\n /**\n * ```js\n * interact(element, { ignoreFrom: document.getElementById('no-action') })\n * // or\n * interact(element).ignoreFrom('input, textarea, a')\n * ```\n * @deprecated\n * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\n * of it's parents match the given CSS selector or Element, no\n * drag/resize/gesture is started.\n *\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to not ignore any elements\n * @return {string | Element | object} The current ignoreFrom value or this\n * Interactable\n */\n Interactable.prototype.ignoreFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\n * @deprecated\n *\n * A drag/resize/gesture is started only If the target of the `mousedown`,\n * `pointerdown` or `touchstart` event or any of it's parents match the given\n * CSS selector or Element.\n *\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to allow from any element\n * @return {string | Element | object} The current allowFrom value or this\n * Interactable\n */\n Interactable.prototype.allowFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('allowFrom', newValue)\n }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).')\n\n /**\n * ```js\n * interact('.resize-drag')\n * .resizable(true)\n * .draggable(true)\n * .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n *\n * if (interact.matchesSelector(event.target, '.drag-handle')) {\n * // force drag with handle target\n * action.name = drag\n * }\n * else {\n * // resize from the top and right edges\n * action.name = 'resize'\n * action.edges = { top: true, right: true }\n * }\n *\n * return action\n * })\n * ```\n *\n * Returns or sets the function used to check action to be performed on\n * pointerDown\n *\n * @param {function | null} [checker] A function which takes a pointer event,\n * defaultAction string, interactable, element and interaction as parameters\n * and returns an object with name property 'drag' 'resize' or 'gesture' and\n * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right\n * props.\n * @return {Function | Interactable} The checker function or this Interactable\n */\n Interactable.prototype.actionChecker = actionChecker\n\n /**\n * Returns or sets whether the the cursor should be changed depending on the\n * action that would be performed if the mouse were pressed and dragged.\n *\n * @param {boolean} [newValue]\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.styleCursor = styleCursor\n}\n\nfunction defaultActionChecker (\n interactable: Interact.Interactable,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n scope: Interact.Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons = (event as MouseEvent).buttons || ({\n 0: 1,\n 1: 4,\n 3: 8,\n 4: 16,\n })[(event as MouseEvent).button as 0 | 1 | 3 | 4]\n const arg = {\n action: null,\n interactable,\n interaction,\n element,\n rect,\n buttons,\n }\n\n scope.fire('auto-start:check', arg)\n\n return arg.action\n}\n\nfunction styleCursor (this: Interact.Interactable, newValue?: boolean) {\n if (is.bool(newValue)) {\n this.options.styleCursor = newValue\n\n return this\n }\n\n if (newValue === null) {\n delete this.options.styleCursor\n\n return this\n }\n\n return this.options.styleCursor\n}\n\nfunction actionChecker (this: Interact.Interactable, checker: any) {\n if (is.func(checker)) {\n this.options.actionChecker = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.options.actionChecker\n\n return this\n }\n\n return this.options.actionChecker\n}\n\nexport default {\n id: 'auto-start/interactableMethods',\n install,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/auto-start/LICENSE b/@interactjs/auto-start/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/auto-start/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/auto-start/autoStart.spec.d.ts b/@interactjs/auto-start/autoStart.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/auto-start/autoStart.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/auto-start/base.d.ts b/@interactjs/auto-start/base.d.ts new file mode 100644 index 000000000..a5185ff14 --- /dev/null +++ b/@interactjs/auto-start/base.d.ts @@ -0,0 +1,49 @@ +declare module '@interactjs/interact/interact' { + interface InteractStatic { + maxInteractions: (newValue: any) => any; + } +} +declare module '@interactjs/core/scope' { + interface Scope { + autoStart: AutoStart; + maxInteractions: (...args: any[]) => any; + } + interface SignalArgs { + 'autoStart:before-start': Interact.SignalArgs['interactions:move']; + 'autoStart:prepared': { + interaction: Interact.Interaction; + }; + 'auto-start:check': CheckSignalArg; + } +} +declare module '@interactjs/core/defaultOptions' { + interface BaseDefaults { + actionChecker?: any; + cursorChecker?: any; + styleCursor?: any; + } + interface PerActionDefaults { + manualStart?: boolean; + max?: number; + maxPerElement?: number; + allowFrom?: string | Interact.Element; + ignoreFrom?: string | Interact.Element; + cursorChecker?: Interact.CursorChecker; + mouseButtons?: 0 | 1 | 2 | 4 | 16; + } +} +interface CheckSignalArg { + interactable: Interact.Interactable; + interaction: Interact.Interaction; + element: Interact.Element; + action: Interact.ActionProps; + buttons: number; +} +export interface AutoStart { + maxInteractions: number; + withinInteractionLimit: typeof withinInteractionLimit; + cursorElement: Interact.Element; +} +declare function withinInteractionLimit(interactable: Interact.Interactable, element: Interact.Element, action: Interact.ActionProps, scope: Interact.Scope): boolean; +declare const autoStart: Interact.Plugin; +export default autoStart; diff --git a/@interactjs/auto-start/base.js b/@interactjs/auto-start/base.js new file mode 100644 index 000000000..6abbc3087 --- /dev/null +++ b/@interactjs/auto-start/base.js @@ -0,0 +1,315 @@ +import * as utils from "../utils/index.js"; +import InteractableMethods from "./InteractableMethods.js"; + +function install(scope) { + const { + interact, + defaults + } = scope; + scope.usePlugin(InteractableMethods); + defaults.base.actionChecker = null; + defaults.base.styleCursor = true; + utils.extend(defaults.perAction, { + manualStart: false, + max: Infinity, + maxPerElement: 1, + allowFrom: null, + ignoreFrom: null, + // only allow left button by default + // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value + mouseButtons: 1 + }); + /** + * Returns or sets the maximum number of concurrent interactions allowed. By + * default only 1 interaction is allowed at a time (for backwards + * compatibility). To allow multiple interactions on the same Interactables and + * elements, you need to enable it in the draggable, resizable and gesturable + * `'max'` and `'maxPerElement'` options. + * + * @alias module:interact.maxInteractions + * + * @param {number} [newValue] Any number. newValue <= 0 means no interactions. + */ + + interact.maxInteractions = newValue => maxInteractions(newValue, scope); + + scope.autoStart = { + // Allow this many interactions to happen simultaneously + maxInteractions: Infinity, + withinInteractionLimit, + cursorElement: null + }; +} + +function prepareOnDown({ + interaction, + pointer, + event, + eventTarget +}, scope) { + if (interaction.interacting()) { + return; + } + + const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); + prepare(interaction, actionInfo, scope); +} + +function prepareOnMove({ + interaction, + pointer, + event, + eventTarget +}, scope) { + if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) { + return; + } + + const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); + prepare(interaction, actionInfo, scope); +} + +function startOnMove(arg, scope) { + const { + interaction + } = arg; + + if (!interaction.pointerIsDown || interaction.interacting() || !interaction.pointerWasMoved || !interaction.prepared.name) { + return; + } + + scope.fire('autoStart:before-start', arg); + const { + interactable + } = interaction; + const actionName = interaction.prepared.name; + + if (actionName && interactable) { + // check manualStart and interaction limit + if (interactable.options[actionName].manualStart || !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) { + interaction.stop(); + } else { + interaction.start(interaction.prepared, interactable, interaction.element); + setInteractionCursor(interaction, scope); + } + } +} + +function clearCursorOnStop({ + interaction +}, scope) { + const { + interactable + } = interaction; + + if (interactable && interactable.options.styleCursor) { + setCursor(interaction.element, '', scope); + } +} // Check if the current interactable supports the action. +// If so, return the validated action. Otherwise, return null + + +function validateAction(action, interactable, element, eventTarget, scope) { + if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) && interactable.options[action.name].enabled && withinInteractionLimit(interactable, element, action, scope)) { + return action; + } + + return null; +} + +function validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope) { + for (let i = 0, len = matches.length; i < len; i++) { + const match = matches[i]; + const matchElement = matchElements[i]; + const matchAction = match.getAction(pointer, event, interaction, matchElement); + + if (!matchAction) { + continue; + } + + const action = validateAction(matchAction, match, matchElement, eventTarget, scope); + + if (action) { + return { + action, + interactable: match, + element: matchElement + }; + } + } + + return { + action: null, + interactable: null, + element: null + }; +} + +function getActionInfo(interaction, pointer, event, eventTarget, scope) { + let matches = []; + let matchElements = []; + let element = eventTarget; + + function pushMatches(interactable) { + matches.push(interactable); + matchElements.push(element); + } + + while (utils.is.element(element)) { + matches = []; + matchElements = []; + scope.interactables.forEachMatch(element, pushMatches); + const actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope); + + if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) { + return actionInfo; + } + + element = utils.dom.parentNode(element); + } + + return { + action: null, + interactable: null, + element: null + }; +} + +function prepare(interaction, { + action, + interactable, + element +}, scope) { + action = action || { + name: null + }; + interaction.interactable = interactable; + interaction.element = element; + utils.copyAction(interaction.prepared, action); + interaction.rect = interactable && action.name ? interactable.getRect(element) : null; + setInteractionCursor(interaction, scope); + scope.fire('autoStart:prepared', { + interaction + }); +} + +function withinInteractionLimit(interactable, element, action, scope) { + const options = interactable.options; + const maxActions = options[action.name].max; + const maxPerElement = options[action.name].maxPerElement; + const autoStartMax = scope.autoStart.maxInteractions; + let activeInteractions = 0; + let interactableCount = 0; + let elementCount = 0; // no actions if any of these values == 0 + + if (!(maxActions && maxPerElement && autoStartMax)) { + return false; + } + + for (const interaction of scope.interactions.list) { + const otherAction = interaction.prepared.name; + + if (!interaction.interacting()) { + continue; + } + + activeInteractions++; + + if (activeInteractions >= autoStartMax) { + return false; + } + + if (interaction.interactable !== interactable) { + continue; + } + + interactableCount += otherAction === action.name ? 1 : 0; + + if (interactableCount >= maxActions) { + return false; + } + + if (interaction.element === element) { + elementCount++; + + if (otherAction === action.name && elementCount >= maxPerElement) { + return false; + } + } + } + + return autoStartMax > 0; +} + +function maxInteractions(newValue, scope) { + if (utils.is.number(newValue)) { + scope.autoStart.maxInteractions = newValue; + return this; + } + + return scope.autoStart.maxInteractions; +} + +function setCursor(element, cursor, scope) { + const { + cursorElement: prevCursorElement + } = scope.autoStart; + + if (prevCursorElement && prevCursorElement !== element) { + prevCursorElement.style.cursor = ''; + } + + element.ownerDocument.documentElement.style.cursor = cursor; + element.style.cursor = cursor; + scope.autoStart.cursorElement = cursor ? element : null; +} + +function setInteractionCursor(interaction, scope) { + const { + interactable, + element, + prepared + } = interaction; + + if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) { + // clear previous target element cursor + if (scope.autoStart.cursorElement) { + setCursor(scope.autoStart.cursorElement, '', scope); + } + + return; + } + + let cursor = ''; + + if (prepared.name) { + const cursorChecker = interactable.options[prepared.name].cursorChecker; + + if (utils.is.func(cursorChecker)) { + cursor = cursorChecker(prepared, interactable, element, interaction._interacting); + } else { + cursor = scope.actions.map[prepared.name].getCursor(prepared); + } + } + + setCursor(interaction.element, cursor || '', scope); +} + +const autoStart = { + id: 'auto-start/base', + before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'], + install, + listeners: { + 'interactions:down': prepareOnDown, + 'interactions:move': (arg, scope) => { + prepareOnMove(arg, scope); + startOnMove(arg, scope); + }, + 'interactions:stop': clearCursorOnStop + }, + maxInteractions, + withinInteractionLimit, + validateAction +}; +export default autoStart; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/@interactjs/auto-start/base.js.map b/@interactjs/auto-start/base.js.map new file mode 100644 index 000000000..2580dd1a2 --- /dev/null +++ b/@interactjs/auto-start/base.js.map @@ -0,0 +1,110 @@ +{ + "version": 3, + "sources": [ + "base.ts" + ], + "names": [ + "utils", + "InteractableMethods", + "install", + "scope", + "interact", + "defaults", + "usePlugin", + "base", + "actionChecker", + "styleCursor", + "extend", + "perAction", + "manualStart", + "max", + "Infinity", + "maxPerElement", + "allowFrom", + "ignoreFrom", + "mouseButtons", + "maxInteractions", + "newValue", + "autoStart", + "withinInteractionLimit", + "cursorElement", + "prepareOnDown", + "interaction", + "pointer", + "event", + "eventTarget", + "interacting", + "actionInfo", + "getActionInfo", + "prepare", + "prepareOnMove", + "pointerType", + "pointerIsDown", + "startOnMove", + "arg", + "pointerWasMoved", + "prepared", + "name", + "fire", + "interactable", + "actionName", + "options", + "element", + "stop", + "start", + "setInteractionCursor", + "clearCursorOnStop", + "setCursor", + "validateAction", + "action", + "testIgnoreAllow", + "enabled", + "validateMatches", + "matches", + "matchElements", + "i", + "len", + "length", + "match", + "matchElement", + "matchAction", + "getAction", + "pushMatches", + "push", + "is", + "interactables", + "forEachMatch", + "dom", + "parentNode", + "copyAction", + "rect", + "getRect", + "maxActions", + "autoStartMax", + "activeInteractions", + "interactableCount", + "elementCount", + "interactions", + "list", + "otherAction", + "number", + "cursor", + "prevCursorElement", + "style", + "ownerDocument", + "documentElement", + "cursorChecker", + "func", + "_interacting", + "actions", + "map", + "getCursor", + "id", + "before", + "listeners" + ], + "mappings": "AAAA,OAAO,KAAKA,KAAZ;AACA,OAAOC,mBAAP;;AAyDA,SAASC,OAAT,CAAkBC,KAAlB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MAAI7C,QAAQ,CAACC,IAAb,EAAmB;AACjB,UAAMiD,aAAqC,GAAG/C,YAAY,CAACE,OAAb,CAAqBL,QAAQ,CAACC,IAA9B,EAAoCiD,aAAlF;;AAEA,QAAIzF,KAAK,CAACmE,EAAN,CAASuB,IAAT,CAAcD,aAAd,CAAJ,EAAkC;AAChCL,MAAAA,MAAM,GAAGK,aAAa,CAAClD,QAAD,EAAWG,YAAX,EAAyBG,OAAzB,EAAkCpB,WAAW,CAACkE,YAA9C,CAAtB;AACD,KAFD,MAGK;AACHP,MAAAA,MAAM,GAAGjF,KAAK,CAACyF,OAAN,CAAcC,GAAd,CAAkBtD,QAAQ,CAACC,IAA3B,EAAiCsD,SAAjC,CAA2CvD,QAA3C,CAAT;AACD;AACF;;AAEDW,EAAAA,SAAS,CAACzB,WAAW,CAACoB,OAAb,EAAsBuC,MAAM,IAAI,EAAhC,EAAoCjF,KAApC,CAAT;AACD;;AAED,MAAMkB,SAA0B,GAAG;AACjC0E,EAAAA,EAAE,EAAE,iBAD6B;AAEjCC,EAAAA,MAAM,EAAE,CAAC,SAAD,EAAY,aAAZ,EAA2B,gBAA3B,EAA6C,iBAA7C,CAFyB;AAGjC9F,EAAAA,OAHiC;AAIjC+F,EAAAA,SAAS,EAAE;AACT,yBAAqBzE,aADZ;AAET,yBAAqB,CAACa,GAAD,EAAMlC,KAAN,KAAgB;AACnC8B,MAAAA,aAAa,CAACI,GAAD,EAAMlC,KAAN,CAAb;AACAiC,MAAAA,WAAW,CAACC,GAAD,EAAMlC,KAAN,CAAX;AACD,KALQ;AAMT,yBAAqB8C;AANZ,GAJsB;AAYjC9B,EAAAA,eAZiC;AAajCG,EAAAA,sBAbiC;AAcjC6B,EAAAA;AAdiC,CAAnC;AAiBA,eAAe9B,SAAf", + "sourcesContent": [ + "import * as utils from '@interactjs/utils/index'\nimport InteractableMethods from './InteractableMethods'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n maxInteractions: (...args: any[]) => any\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Interact.SignalArgs['interactions:move']\n 'autoStart:prepared': { interaction: Interact.Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n actionChecker?: any\n cursorChecker?: any\n styleCursor?: any\n }\n\n interface PerActionDefaults {\n manualStart?: boolean\n max?: number\n maxPerElement?: number\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n cursorChecker?: Interact.CursorChecker\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons?: 0 | 1 | 2 | 4 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interact.Interactable\n interaction: Interact.Interaction\n element: Interact.Element\n action: Interact.ActionProps\n buttons: number\n}\n\nexport interface AutoStart {\n // Allow this many interactions to happen simultaneously\n maxInteractions: number\n withinInteractionLimit: typeof withinInteractionLimit\n cursorElement: Interact.Element\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n interact,\n defaults,\n } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n utils.extend(defaults.perAction, {\n manualStart: false,\n max: Infinity,\n maxPerElement: 1,\n allowFrom: null,\n ignoreFrom: null,\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons: 1,\n })\n\n /**\n * Returns or sets the maximum number of concurrent interactions allowed. By\n * default only 1 interaction is allowed at a time (for backwards\n * compatibility). To allow multiple interactions on the same Interactables and\n * elements, you need to enable it in the draggable, resizable and gesturable\n * `'max'` and `'maxPerElement'` options.\n *\n * @alias module:interact.maxInteractions\n *\n * @param {number} [newValue] Any number. newValue <= 0 means no interactions.\n */\n interact.maxInteractions = newValue => maxInteractions(newValue, scope)\n\n scope.autoStart = {\n // Allow this many interactions to happen simultaneously\n maxInteractions: Infinity,\n withinInteractionLimit,\n cursorElement: null,\n }\n}\n\nfunction prepareOnDown ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n if (interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.pointerType !== 'mouse' ||\n interaction.pointerIsDown ||\n interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Interact.Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n const { interaction } = arg\n\n if (!interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) {\n interaction.stop()\n }\n else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interact.Interaction }, scope: Interact.Scope) {\n const { interactable } = interaction\n\n if (interactable && interactable.options.styleCursor) {\n setCursor(interaction.element, '', scope)\n }\n}\n\n// Check if the current interactable supports the action.\n// If so, return the validated action. Otherwise, return null\nfunction validateAction (\n action: Interact.ActionProps,\n interactable: Interact.Interactable,\n element: Interact.Element,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n matches: Interact.Interactable[],\n matchElements: Interact.Element[],\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n for (let i = 0, len = matches.length; i < len; i++) {\n const match = matches[i]\n const matchElement = matchElements[i]\n const matchAction = match.getAction(pointer, event, interaction, matchElement)\n\n if (!matchAction) { continue }\n\n const action = validateAction(\n matchAction,\n match,\n matchElement,\n eventTarget,\n scope)\n\n if (action) {\n return {\n action,\n interactable: match,\n element: matchElement,\n }\n }\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction getActionInfo (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n let matches: Interact.Interactable[] = []\n let matchElements: Interact.Element[] = []\n\n let element = eventTarget as Interact.Element\n\n function pushMatches (interactable: Interact.Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (utils.is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope)\n\n if (actionInfo.action &&\n !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = utils.dom.parentNode(element) as Interact.Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interact.Interaction,\n { action, interactable, element }: {\n action: Interact.ActionProps\n interactable: Interact.Interactable\n element: Interact.Element\n },\n scope: Interact.Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n utils.copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name\n ? interactable.getRect(element)\n : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interact.Interactable,\n element: Interact.Element,\n action: Interact.ActionProps,\n scope: Interact.Scope,\n) {\n const options = interactable.options\n const maxActions = options[action.name].max\n const maxPerElement = options[action.name].maxPerElement\n const autoStartMax = scope.autoStart.maxInteractions\n let activeInteractions = 0\n let interactableCount = 0\n let elementCount = 0\n\n // no actions if any of these values == 0\n if (!(maxActions && maxPerElement && autoStartMax)) { return false }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) { continue }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) { continue }\n\n interactableCount += otherAction === action.name ? 1 : 0\n\n if (interactableCount >= maxActions) {\n return false\n }\n\n if (interaction.element === element) {\n elementCount++\n\n if (otherAction === action.name && elementCount >= maxPerElement) {\n return false\n }\n }\n }\n\n return autoStartMax > 0\n}\n\nfunction maxInteractions (newValue: any, scope: Interact.Scope) {\n if (utils.is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Interact.Element, cursor: string, scope: Interact.Scope) {\n const { cursorElement: prevCursorElement } = scope.autoStart\n\n if (prevCursorElement && prevCursorElement !== element) {\n prevCursorElement.style.cursor = ''\n }\n\n element.ownerDocument.documentElement.style.cursor = cursor\n element.style.cursor = cursor\n scope.autoStart.cursorElement = cursor ? element : null\n}\n\nfunction setInteractionCursor (interaction: Interact.Interaction, scope: Interact.Scope) {\n const { interactable, element, prepared } = interaction\n\n if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {\n // clear previous target element cursor\n if (scope.autoStart.cursorElement) {\n setCursor(scope.autoStart.cursorElement, '', scope)\n }\n\n return\n }\n\n let cursor = ''\n\n if (prepared.name) {\n const cursorChecker: Interact.CursorChecker = interactable.options[prepared.name].cursorChecker\n\n if (utils.is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n }\n else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Interact.Plugin = {\n id: 'auto-start/base',\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n install,\n listeners: {\n 'interactions:down': prepareOnDown,\n 'interactions:move': (arg, scope) => {\n prepareOnMove(arg, scope)\n startOnMove(arg, scope)\n },\n 'interactions:stop': clearCursorOnStop,\n },\n maxInteractions,\n withinInteractionLimit,\n validateAction,\n} as Interact.Plugin\n\nexport default autoStart\n" + ] +} \ No newline at end of file diff --git a/@interactjs/auto-start/dragAxis.d.ts b/@interactjs/auto-start/dragAxis.d.ts new file mode 100644 index 000000000..c1e110d33 --- /dev/null +++ b/@interactjs/auto-start/dragAxis.d.ts @@ -0,0 +1,8 @@ +declare function beforeStart({ interaction, eventTarget, dx, dy }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope): void; +declare const _default: { + id: string; + listeners: { + 'autoStart:before-start': typeof beforeStart; + }; +}; +export default _default; diff --git a/@interactjs/auto-start/dragAxis.js b/@interactjs/auto-start/dragAxis.js new file mode 100644 index 000000000..884dfb95f --- /dev/null +++ b/@interactjs/auto-start/dragAxis.js @@ -0,0 +1,77 @@ +import { parentNode } from "../utils/domUtils.js"; +import * as is from "../utils/is.js"; +import autoStart from "./base.js"; + +function beforeStart({ + interaction, + eventTarget, + dx, + dy +}, scope) { + if (interaction.prepared.name !== 'drag') { + return; + } // check if a drag is in the correct axis + + + const absX = Math.abs(dx); + const absY = Math.abs(dy); + const targetOptions = interaction.interactable.options.drag; + const startAxis = targetOptions.startAxis; + const currentAxis = absX > absY ? 'x' : absX < absY ? 'y' : 'xy'; + interaction.prepared.axis = targetOptions.lockAxis === 'start' ? currentAxis[0] // always lock to one axis even if currentAxis === 'xy' + : targetOptions.lockAxis; // if the movement isn't in the startAxis of the interactable + + if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) { + // cancel the prepared action + interaction.prepared.name = null; // then try to get a drag from another ineractable + + let element = eventTarget; + + const getDraggable = function (interactable) { + if (interactable === interaction.interactable) { + return; + } + + const options = interaction.interactable.options.drag; + + if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) { + const action = interactable.getAction(interaction.downPointer, interaction.downEvent, interaction, element); + + if (action && action.name === 'drag' && checkStartAxis(currentAxis, interactable) && autoStart.validateAction(action, interactable, element, eventTarget, scope)) { + return interactable; + } + } + }; // check all interactables + + + while (is.element(element)) { + const interactable = scope.interactables.forEachMatch(element, getDraggable); + + if (interactable) { + interaction.prepared.name = 'drag'; + interaction.interactable = interactable; + interaction.element = element; + break; + } + + element = parentNode(element); + } + } +} + +function checkStartAxis(startAxis, interactable) { + if (!interactable) { + return false; + } + + const thisAxis = interactable.options.drag.startAxis; + return startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis; +} + +export default { + id: 'auto-start/dragAxis', + listeners: { + 'autoStart:before-start': beforeStart + } +}; +//# sourceMappingURL=dragAxis.js.map \ No newline at end of file diff --git a/@interactjs/auto-start/dragAxis.js.map b/@interactjs/auto-start/dragAxis.js.map new file mode 100644 index 000000000..63adf12b8 --- /dev/null +++ b/@interactjs/auto-start/dragAxis.js.map @@ -0,0 +1,50 @@ +{ + "version": 3, + "sources": [ + "dragAxis.ts" + ], + "names": [ + "parentNode", + "is", + "autoStart", + "beforeStart", + "interaction", + "eventTarget", + "dx", + "dy", + "scope", + "prepared", + "name", + "absX", + "Math", + "abs", + "absY", + "targetOptions", + "interactable", + "options", + "drag", + "startAxis", + "currentAxis", + "axis", + "lockAxis", + "element", + "getDraggable", + "manualStart", + "testIgnoreAllow", + "action", + "getAction", + "downPointer", + "downEvent", + "checkStartAxis", + "validateAction", + "interactables", + "forEachMatch", + "thisAxis", + "id", + "listeners" + ], + "mappings": "AAAA,SAASA,UAAT;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,SAAP;;AAEA,SAASC,WAA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E,qBADS;AAEbC,EAAAA,SAAS,EAAE;AAAE,8BAA0BlC;AAA5B;AAFE,CAAf", + "sourcesContent": [ + "import { parentNode } from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.prepared.name !== 'drag') { return }\n\n // check if a drag is in the correct axis\n const absX = Math.abs(dx)\n const absY = Math.abs(dy)\n const targetOptions = interaction.interactable.options.drag\n const startAxis = targetOptions.startAxis\n const currentAxis = (absX > absY ? 'x' : absX < absY ? 'y' : 'xy')\n\n interaction.prepared.axis = targetOptions.lockAxis === 'start'\n ? currentAxis[0] as 'x' | 'y' // always lock to one axis even if currentAxis === 'xy'\n : targetOptions.lockAxis\n\n // if the movement isn't in the startAxis of the interactable\n if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) {\n // cancel the prepared action\n interaction.prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Interact.Element\n\n const getDraggable = function (interactable: Interact.Interactable): Interact.Interactable | void {\n if (interactable === interaction.interactable) { return }\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart &&\n interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer, interaction.downEvent, interaction, element)\n\n if (action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)) {\n return interactable\n }\n }\n }\n\n // check all interactables\n while (is.element(element)) {\n const interactable = scope.interactables.forEachMatch(element, getDraggable)\n\n if (interactable) {\n interaction.prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Interact.Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interact.Interactable) {\n if (!interactable) { return false }\n\n const thisAxis = interactable.options.drag.startAxis\n\n return (startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis)\n}\n\nexport default {\n id: 'auto-start/dragAxis',\n listeners: { 'autoStart:before-start': beforeStart },\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/auto-start/hold.d.ts b/@interactjs/auto-start/hold.d.ts new file mode 100644 index 000000000..e26f11644 --- /dev/null +++ b/@interactjs/auto-start/hold.d.ts @@ -0,0 +1,34 @@ +declare module '@interactjs/core/defaultOptions' { + interface PerActionDefaults { + hold?: number; + delay?: number; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + autoStartHoldTimer?: any; + } +} +declare function install(scope: Interact.Scope): void; +declare function getHoldDuration(interaction: any): any; +declare const _default: { + id: string; + install: typeof install; + listeners: { + 'interactions:new': ({ interaction }: { + interaction: any; + }) => void; + 'autoStart:prepared': ({ interaction }: { + interaction: any; + }) => void; + 'interactions:move': ({ interaction, duplicate }: { + interaction: any; + duplicate: any; + }) => void; + 'autoStart:before-start': ({ interaction }: { + interaction: any; + }) => void; + }; + getHoldDuration: typeof getHoldDuration; +}; +export default _default; diff --git a/@interactjs/auto-start/hold.js b/@interactjs/auto-start/hold.js new file mode 100644 index 000000000..fad84d2c3 --- /dev/null +++ b/@interactjs/auto-start/hold.js @@ -0,0 +1,64 @@ +import basePlugin from "./base.js"; + +function install(scope) { + const { + defaults + } = scope; + scope.usePlugin(basePlugin); + defaults.perAction.hold = 0; + defaults.perAction.delay = 0; +} + +function getHoldDuration(interaction) { + const actionName = interaction.prepared && interaction.prepared.name; + + if (!actionName) { + return null; + } + + const options = interaction.interactable.options; + return options[actionName].hold || options[actionName].delay; +} + +export default { + id: 'auto-start/hold', + install, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.autoStartHoldTimer = null; + }, + 'autoStart:prepared': ({ + interaction + }) => { + const hold = getHoldDuration(interaction); + + if (hold > 0) { + interaction.autoStartHoldTimer = setTimeout(() => { + interaction.start(interaction.prepared, interaction.interactable, interaction.element); + }, hold); + } + }, + 'interactions:move': ({ + interaction, + duplicate + }) => { + if (interaction.pointerWasMoved && !duplicate) { + clearTimeout(interaction.autoStartHoldTimer); + } + }, + // prevent regular down->move autoStart + 'autoStart:before-start': ({ + interaction + }) => { + const hold = getHoldDuration(interaction); + + if (hold > 0) { + interaction.prepared.name = null; + } + } + }, + getHoldDuration +}; +//# sourceMappingURL=hold.js.map \ No newline at end of file diff --git a/@interactjs/auto-start/hold.js.map b/@interactjs/auto-start/hold.js.map new file mode 100644 index 000000000..3c823fa3b --- /dev/null +++ b/@interactjs/auto-start/hold.js.map @@ -0,0 +1,36 @@ +{ + "version": 3, + "sources": [ + "hold.ts" + ], + "names": [ + "basePlugin", + "install", + "scope", + "defaults", + "usePlugin", + "perAction", + "hold", + "delay", + "getHoldDuration", + "interaction", + "actionName", + "prepared", + "name", + "options", + "interactable", + "id", + "listeners", + "autoStartHoldTimer", + "setTimeout", + "start", + "element", + "duplicate", + "pointerWasMoved", + "clearTimeout" + ], + "mappings": "AAAA,OAAOA,UAAP;;AAeA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AACvC,QAAM;AACJC,IAAAA;AADI,MAEFD,KAFJ;AAIAA,EAAAA,KAAK,CAACE,SAAN,CAAgBJ,UAAhB;AAEAG,EAAAA,QAAQ,CAACE,SAAT,CAAmBC,IAAnB,GAA0B,CAA1B;AACAH,EAAAA,QAAQ,CAACE,SAAT,CAAmBE,KAAnB,GAA2B,CAA3B;AACD;;AAED,SAASC,eAAT,CAA0BC,WAA1B,EAAuC;AACrC,QAAMC,UAAU,GAAGD,WAAW,CAACE,QAAZ,IAAwBF,WAAW,CAACE,QAAZ,CAAqBC,IAAhE;;AAEA,MAAI,CAACF,UAAL,EAAiB;AAAE,WAAO,IAAP;AAAa;;AAEhC,QAAMG,OAAO,GAAGJ,WAAW,CAACK,YAAZ,CAAyBD,OAAzC;AAEA,SAAOA,OAAO,CAACH,UAAD,CAAP,CAAoBJ,IAApB,IAA4BO,OAAO,CAACH,UAAD,CAAP,CAAoBH,KAAvD;AACD;;AAED,eAAe;AACbQ,EAAAA,EAAE,EAAE,iBADS;AAEbd,EAAAA,OAFa;AAGbe,EAAAA,SAAS,EAAE;AACT,wBAAoB,CAAC;AAAEP,MAAAA;AAAF,KAAD,KAAqB;AACvCA,MAAAA,WAAW,CAACQ,kBAAZ,GAAiC,IAAjC;AACD,KAHQ;AAKT,0BAAsB,CAAC;AAAER,MAAAA;AAAF,KAAD,KAAqB;AACzC,YAAMH,IAAI,GAAGE,eAAe,CAACC,WAAD,CAA5B;;AAEA,UAAIH,IAAI,GAAG,CAAX,EAAc;AACZG,QAAAA,WAAW,CAACQ,kBAAZ,GAAiCC,UAAU,CAAC,MAAM;AAChDT,UAAAA,WAAW,CAACU,KAAZ,CAAkBV,WAAW,CAACE,QAA9B,EAAwCF,WAAW,CAACK,YAApD,EAAkEL,WAAW,CAACW,OAA9E;AACD,SAF0C,EAExCd,IAFwC,CAA3C;AAGD;AACF,KAbQ;AAeT,yBAAqB,CAAC;AAAEG,MAAAA,WAAF;AAAeY,MAAAA;AAAf,KAAD,KAAgC;AACnD,UAAIZ,WAAW,CAACa,eAAZ,IAA+B,CAACD,SAApC,EAA+C;AAC7CE,QAAAA,YAAY,CAACd,WAAW,CAACQ,kBAAb,CAAZ;AACD;AACF,KAnBQ;AAqBT;AACA,8BAA0B,CAAC;AAAER,MAAAA;AAAF,KAAD,KAAqB;AAC7C,YAAMH,IAAI,GAAGE,eAAe,CAACC,WAAD,CAA5B;;AAEA,UAAIH,IAAI,GAAG,CAAX,EAAc;AACZG,QAAAA,WAAW,CAACE,QAAZ,CAAqBC,IAArB,GAA4B,IAA5B;AACD;AACF;AA5BQ,GAHE;AAiCbJ,EAAAA;AAjCa,CAAf", + "sourcesContent": [ + "import basePlugin from './base'\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n hold?: number\n delay?: number\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoStartHoldTimer?: any\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) { return null }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nexport default {\n id: 'auto-start/hold',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoStartHoldTimer = null\n },\n\n 'autoStart:prepared': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.autoStartHoldTimer = setTimeout(() => {\n interaction.start(interaction.prepared, interaction.interactable, interaction.element)\n }, hold)\n }\n },\n\n 'interactions:move': ({ interaction, duplicate }) => {\n if (interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/auto-start/hold.spec.d.ts b/@interactjs/auto-start/hold.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/auto-start/hold.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/auto-start/index.d.ts b/@interactjs/auto-start/index.d.ts new file mode 100644 index 000000000..ba47b0181 --- /dev/null +++ b/@interactjs/auto-start/index.d.ts @@ -0,0 +1,6 @@ +import autoStart from './base'; +import dragAxis from './dragAxis'; +import hold from './hold'; +declare function install(scope: any): void; +declare const id = "auto-start"; +export { id, install, autoStart, hold, dragAxis, }; diff --git a/@interactjs/auto-start/index.js b/@interactjs/auto-start/index.js new file mode 100644 index 000000000..65c6f7cef --- /dev/null +++ b/@interactjs/auto-start/index.js @@ -0,0 +1,13 @@ +import autoStart from "./base.js"; +import dragAxis from "./dragAxis.js"; +import hold from "./hold.js"; + +function install(scope) { + scope.usePlugin(autoStart); + scope.usePlugin(hold); + scope.usePlugin(dragAxis); +} + +const id = 'auto-start'; +export { id, install, autoStart, hold, dragAxis }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/auto-start/index.js.map b/@interactjs/auto-start/index.js.map new file mode 100644 index 000000000..e0319d189 --- /dev/null +++ b/@interactjs/auto-start/index.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "autoStart", + "dragAxis", + "hold", + "install", + "scope", + "usePlugin", + "id" + ], + "mappings": "AAAA,OAAOA,SAAP;AACA,OAAOC,QAAP;AACA,OAAOC,IAAP;;AAEA,SAASC,OAAT,CAAkBC,KAAlB,EAAyB;AACvBA,EAAAA,KAAK,CAACC,SAAN,CAAgBL,SAAhB;AACAI,EAAAA,KAAK,CAACC,SAAN,CAAgBH,IAAhB;AACAE,EAAAA,KAAK,CAACC,SAAN,CAAgBJ,QAAhB;AACD;;AAED,MAAMK,EAAE,GAAG,YAAX;AAEA,SACEA,EADF,EAEEH,OAFF,EAGEH,SAHF,EAIEE,IAJF,EAKED,QALF", + "sourcesContent": [ + "import autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n\nfunction install (scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n}\n\nconst id = 'auto-start'\n\nexport {\n id,\n install,\n autoStart,\n hold,\n dragAxis,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/.npmignore b/@interactjs/core/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/core/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/core/BaseEvent.d.ts b/@interactjs/core/BaseEvent.d.ts new file mode 100644 index 000000000..a6a481525 --- /dev/null +++ b/@interactjs/core/BaseEvent.d.ts @@ -0,0 +1,23 @@ +import Interactable from './Interactable'; +export declare class BaseEvent { + type: string; + target: EventTarget; + currentTarget: EventTarget; + interactable: Interactable; + _interaction: Interact.Interaction; + timeStamp: any; + immediatePropagationStopped: boolean; + propagationStopped: boolean; + readonly interaction: Pick, "end" | "stop" | "start" | "move" | "interactable" | "element" | "prepared" | "pointerIsDown" | "pointerWasMoved" | "_proxy" | "interacting" | "offsetBy">; + constructor(interaction: Interact.Interaction); + preventDefault(): void; + /** + * Don't call any other listeners (even on the current target) + */ + stopPropagation(): void; + /** + * Don't call listeners on the remaining targets + */ + stopImmediatePropagation(): void; +} +export default BaseEvent; diff --git a/@interactjs/core/BaseEvent.js b/@interactjs/core/BaseEvent.js new file mode 100644 index 000000000..a89ecfc0f --- /dev/null +++ b/@interactjs/core/BaseEvent.js @@ -0,0 +1,48 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +export class BaseEvent { + get interaction() { + return this._interaction._proxy; + } + + constructor(interaction) { + _defineProperty(this, "type", void 0); + + _defineProperty(this, "target", void 0); + + _defineProperty(this, "currentTarget", void 0); + + _defineProperty(this, "interactable", void 0); + + _defineProperty(this, "_interaction", void 0); + + _defineProperty(this, "timeStamp", void 0); + + _defineProperty(this, "immediatePropagationStopped", false); + + _defineProperty(this, "propagationStopped", false); + + this._interaction = interaction; + } + + preventDefault() {} + /** + * Don't call any other listeners (even on the current target) + */ + + + stopPropagation() { + this.propagationStopped = true; + } + /** + * Don't call listeners on the remaining targets + */ + + + stopImmediatePropagation() { + this.immediatePropagationStopped = this.propagationStopped = true; + } + +} +export default BaseEvent; +//# sourceMappingURL=BaseEvent.js.map \ No newline at end of file diff --git a/@interactjs/core/BaseEvent.js.map b/@interactjs/core/BaseEvent.js.map new file mode 100644 index 000000000..f22a6db31 --- /dev/null +++ b/@interactjs/core/BaseEvent.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "sources": [ + "BaseEvent.ts" + ], + "names": [ + "BaseEvent", + "interaction", + "_interaction", + "_proxy", + "constructor", + "preventDefault", + "stopPropagation", + "propagationStopped", + "stopImmediatePropagation", + "immediatePropagationStopped" + ], + "mappings": ";;AAEA,OAAO,MAAMA,SAAN,CAAqD;AAU1D,MAAIC,WAAJ,GAAmB;AACjB,WAAO,KAAKC,YAAL,CAAkBC,MAAzB;AACD;;AAEDC,EAAAA,WAAW,CAAEH,WAAF,EAAqC;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,yDAPlB,KAOkB;;AAAA,gDAN3B,KAM2B;;AAC9C,SAAKC,YAAL,GAAoBD,WAApB;AACD;;AAEDI,EAAAA,cAAc,GAAI,CAAE;AAEpB;;;;;AAGAC,EAAAA,eAAe,GAAI;AACjB,SAAKC,kBAAL,GAA0B,IAA1B;AACD;AAED;;;;;AAGAC,EAAAA,wBAAwB,GAAI;AAC1B,SAAKC,2BAAL,GAAmC,KAAKF,kBAAL,GAA0B,IAA7D;AACD;;AAhCyD;AAmC5D,eAAeP,SAAf", + "sourcesContent": [ + "import Interactable from './Interactable'\n\nexport class BaseEvent {\n type: string\n target: EventTarget\n currentTarget: EventTarget\n interactable: Interactable\n _interaction: Interact.Interaction\n timeStamp: any\n immediatePropagationStopped = false\n propagationStopped = false\n\n get interaction () {\n return this._interaction._proxy\n }\n\n constructor (interaction: Interact.Interaction) {\n this._interaction = interaction\n }\n\n preventDefault () {}\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n}\n\nexport default BaseEvent\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Eventable.d.ts b/@interactjs/core/Eventable.d.ts new file mode 100644 index 000000000..113265a1c --- /dev/null +++ b/@interactjs/core/Eventable.d.ts @@ -0,0 +1,16 @@ +import { NormalizedListeners } from '@interactjs/utils/normalizeListeners'; +declare class Eventable { + options: any; + types: NormalizedListeners; + propagationStopped: boolean; + immediatePropagationStopped: boolean; + global: any; + constructor(options?: { + [index: string]: any; + }); + fire(event: any): void; + on(type: string, listener: Interact.ListenersArg): void; + off(type: string, listener: Interact.ListenersArg): void; + getRect(_element: Interact.Element): Interact.Rect; +} +export default Eventable; diff --git a/@interactjs/core/Eventable.js b/@interactjs/core/Eventable.js new file mode 100644 index 000000000..cfd1e040f --- /dev/null +++ b/@interactjs/core/Eventable.js @@ -0,0 +1,82 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import * as arr from "../utils/arr.js"; +import extend from "../utils/extend.js"; +import normalize from "../utils/normalizeListeners.js"; + +function fireUntilImmediateStopped(event, listeners) { + for (const listener of listeners) { + if (event.immediatePropagationStopped) { + break; + } + + listener(event); + } +} + +class Eventable { + constructor(options) { + _defineProperty(this, "options", void 0); + + _defineProperty(this, "types", {}); + + _defineProperty(this, "propagationStopped", false); + + _defineProperty(this, "immediatePropagationStopped", false); + + _defineProperty(this, "global", void 0); + + this.options = extend({}, options || {}); + } + + fire(event) { + let listeners; + const global = this.global; // Interactable#on() listeners + // tslint:disable no-conditional-assignment + + if (listeners = this.types[event.type]) { + fireUntilImmediateStopped(event, listeners); + } // interact.on() listeners + + + if (!event.propagationStopped && global && (listeners = global[event.type])) { + fireUntilImmediateStopped(event, listeners); + } + } + + on(type, listener) { + const listeners = normalize(type, listener); + + for (type in listeners) { + this.types[type] = arr.merge(this.types[type] || [], listeners[type]); + } + } + + off(type, listener) { + const listeners = normalize(type, listener); + + for (type in listeners) { + const eventList = this.types[type]; + + if (!eventList || !eventList.length) { + continue; + } + + for (const subListener of listeners[type]) { + const index = eventList.indexOf(subListener); + + if (index !== -1) { + eventList.splice(index, 1); + } + } + } + } + + getRect(_element) { + return null; + } + +} + +export default Eventable; +//# sourceMappingURL=Eventable.js.map \ No newline at end of file diff --git a/@interactjs/core/Eventable.js.map b/@interactjs/core/Eventable.js.map new file mode 100644 index 000000000..04e27efdd --- /dev/null +++ b/@interactjs/core/Eventable.js.map @@ -0,0 +1,39 @@ +{ + "version": 3, + "sources": [ + "Eventable.ts" + ], + "names": [ + "arr", + "extend", + "normalize", + "fireUntilImmediateStopped", + "event", + "listeners", + "listener", + "immediatePropagationStopped", + "Eventable", + "constructor", + "options", + "fire", + "global", + "types", + "type", + "propagationStopped", + "on", + "merge", + "off", + "eventList", + "length", + "subListener", + "index", + "indexOf", + "splice", + "getRect", + "_element" + ], + "mappings": ";;AAAA,OAAO,KAAKA,GAAZ;AACA,OAAOC,MAAP;AACA,OAAOC,SAAP;;AAEA,SAASC,yBAAT,CAGGC,KAHH,EAGwCC,SAHxC,EAGwE;AACtE,OAAK,MAAMC,QAAX,IAAuBD,SAAvB,EAAkC;AAChC,QAAID,KAAK,CAACG,2BAAV,EAAuC;AAAE;AAAO;;AAEhDD,IAAAA,QAAQ,CAACF,KAAD,CAAR;AACD;AACF;;AAED,MAAMI,SAAN,CAAgB;AAOdC,EAAAA,WAAW,CAAEC,OAAF,EAAsC;AAAA;;AAAA,mCALpB,EAKoB;;AAAA,gDAJ5B,KAI4B;;AAAA,yDAHnB,KAGmB;;AAAA;;AAC/C,SAAKA,OAAL,GAAeT,MAAM,CAAC,EAAD,EAAKS,OAAO,IAAI,EAAhB,CAArB;AACD;;AAEDC,EAAAA,IAAI,CAAEP,KAAF,EAAc;AAChB,QAAIC,SAAJ;AACA,UAAMO,MAAM,GAAG,KAAKA,MAApB,CAFgB,CAIhB;AACA;;AACA,QAAKP,SAAS,GAAG,KAAKQ,KAAL,CAAWT,KAAK,CAACU,IAAjB,CAAjB,EAA0C;AACxCX,MAAAA,yBAAyB,CAACC,KAAD,EAAQC,SAAR,CAAzB;AACD,KARe,CAUhB;;;AACA,QAAI,CAACD,KAAK,CAACW,kBAAP,IAA6BH,MAA7B,KAAwCP,SAAS,GAAGO,MAAM,CAACR,KAAK,CAACU,IAAP,CAA1D,CAAJ,EAA8E;AAC5EX,MAAAA,yBAAyB,CAACC,KAAD,EAAQC,SAAR,CAAzB;AACD;AACF;;AAEDW,EAAAA,EAAE,CAAEF,IAAF,EAAgBR,QAAhB,EAAiD;AACjD,UAAMD,SAAS,GAAGH,SAAS,CAACY,IAAD,EAAOR,QAAP,CAA3B;;AAEA,SAAKQ,IAAL,IAAaT,SAAb,EAAwB;AACtB,WAAKQ,KAAL,CAAWC,IAAX,IAAmBd,GAAG,CAACiB,KAAJ,CAAU,KAAKJ,KAAL,CAAWC,IAAX,KAAoB,EAA9B,EAAkCT,SAAS,CAACS,IAAD,CAA3C,CAAnB;AACD;AACF;;AAEDI,EAAAA,GAAG,CAAEJ,IAAF,EAAgBR,QAAhB,EAAiD;AAClD,UAAMD,SAAS,GAAGH,SAAS,CAACY,IAAD,EAAOR,QAAP,CAA3B;;AAEA,SAAKQ,IAAL,IAAaT,SAAb,EAAwB;AACtB,YAAMc,SAAS,GAAG,KAAKN,KAAL,CAAWC,IAAX,CAAlB;;AAEA,UAAI,CAACK,SAAD,IAAc,CAACA,SAAS,CAACC,MAA7B,EAAqC;AAAE;AAAU;;AAEjD,WAAK,MAAMC,WAAX,IAA0BhB,SAAS,CAACS,IAAD,CAAnC,EAA2C;AACzC,cAAMQ,KAAK,GAAGH,SAAS,CAACI,OAAV,CAAkBF,WAAlB,CAAd;;AAEA,YAAIC,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChBH,UAAAA,SAAS,CAACK,MAAV,CAAiBF,KAAjB,EAAwB,CAAxB;AACD;AACF;AACF;AACF;;AAEDG,EAAAA,OAAO,CAAEC,QAAF,EAA6C;AAClD,WAAO,IAAP;AACD;;AAvDa;;AA0DhB,eAAelB,SAAf", + "sourcesContent": [ + "import * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport normalize, { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped<\n T extends Interact.ActionName,\n P extends Interact.EventPhase,\n> (event: Interact.InteractEvent, listeners: Interact.Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) { break }\n\n listener(event)\n }\n}\n\nclass Eventable {\n options: any\n types: NormalizedListeners = {}\n propagationStopped = false\n immediatePropagationStopped = false\n global: any\n\n constructor (options?: { [index: string]: any }) {\n this.options = extend({}, options || {})\n }\n\n fire (event: any) {\n let listeners\n const global = this.global\n\n // Interactable#on() listeners\n // tslint:disable no-conditional-assignment\n if ((listeners = this.types[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n\n // interact.on() listeners\n if (!event.propagationStopped && global && (listeners = global[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n }\n\n on (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n this.types[type] = arr.merge(this.types[type] || [], listeners[type])\n }\n }\n\n off (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n const eventList = this.types[type]\n\n if (!eventList || !eventList.length) { continue }\n\n for (const subListener of listeners[type]) {\n const index = eventList.indexOf(subListener)\n\n if (index !== -1) {\n eventList.splice(index, 1)\n }\n }\n }\n }\n\n getRect (_element: Interact.Element): Interact.Rect {\n return null\n }\n}\n\nexport default Eventable\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Eventable.spec.d.ts b/@interactjs/core/Eventable.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/Eventable.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/InteractEvent.d.ts b/@interactjs/core/InteractEvent.d.ts new file mode 100644 index 000000000..f2774a548 --- /dev/null +++ b/@interactjs/core/InteractEvent.d.ts @@ -0,0 +1,72 @@ +import BaseEvent from './BaseEvent'; +import Interaction from './Interaction'; +export declare type EventPhase = keyof PhaseMap; +export interface PhaseMap { + start: true; + move: true; + end: true; +} +export declare class InteractEvent extends BaseEvent { + target: Interact.Element; + currentTarget: Interact.Element; + relatedTarget: null; + screenX?: number; + screenY?: number; + button: number; + buttons: number; + ctrlKey: boolean; + shiftKey: boolean; + altKey: boolean; + metaKey: boolean; + page: Interact.Point; + client: Interact.Point; + delta: Interact.Point; + rect: Interact.FullRect; + x0: number; + y0: number; + t0: number; + dt: number; + duration: number; + clientX0: number; + clientY0: number; + velocity: Interact.Point; + speed: number; + swipe: ReturnType['getSwipe']>; + timeStamp: any; + dragEnter?: Interact.Element; + dragLeave?: Interact.Element; + axes?: 'x' | 'y' | 'xy'; + preEnd?: boolean; + /** */ + constructor(interaction: Interaction, event: Interact.PointerEventType, actionName: T, phase: P, element: Interact.Element, preEnd?: boolean, type?: string); + pageX: number; + pageY: number; + clientX: number; + clientY: number; + dx: number; + dy: number; + velocityX: number; + velocityY: number; + getSwipe(): { + up: boolean; + down: boolean; + left: boolean; + right: boolean; + angle: number; + speed: number; + velocity: { + x: number; + y: number; + }; + }; + preventDefault(): void; + /** + * Don't call listeners on the remaining targets + */ + stopImmediatePropagation(): void; + /** + * Don't call any other listeners (even on the current target) + */ + stopPropagation(): void; +} +export default InteractEvent; diff --git a/@interactjs/core/InteractEvent.js b/@interactjs/core/InteractEvent.js new file mode 100644 index 000000000..87f0806ec --- /dev/null +++ b/@interactjs/core/InteractEvent.js @@ -0,0 +1,253 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import extend from "../utils/extend.js"; +import getOriginXY from "../utils/getOriginXY.js"; +import hypot from "../utils/hypot.js"; +import BaseEvent from "./BaseEvent.js"; +import defaults from "./defaultOptions.js"; +export class InteractEvent extends BaseEvent { + // drag + // resize + + /** */ + constructor(interaction, event, actionName, phase, element, preEnd, type) { + super(interaction); + + _defineProperty(this, "target", void 0); + + _defineProperty(this, "currentTarget", void 0); + + _defineProperty(this, "relatedTarget", null); + + _defineProperty(this, "screenX", void 0); + + _defineProperty(this, "screenY", void 0); + + _defineProperty(this, "button", void 0); + + _defineProperty(this, "buttons", void 0); + + _defineProperty(this, "ctrlKey", void 0); + + _defineProperty(this, "shiftKey", void 0); + + _defineProperty(this, "altKey", void 0); + + _defineProperty(this, "metaKey", void 0); + + _defineProperty(this, "page", void 0); + + _defineProperty(this, "client", void 0); + + _defineProperty(this, "delta", void 0); + + _defineProperty(this, "rect", void 0); + + _defineProperty(this, "x0", void 0); + + _defineProperty(this, "y0", void 0); + + _defineProperty(this, "t0", void 0); + + _defineProperty(this, "dt", void 0); + + _defineProperty(this, "duration", void 0); + + _defineProperty(this, "clientX0", void 0); + + _defineProperty(this, "clientY0", void 0); + + _defineProperty(this, "velocity", void 0); + + _defineProperty(this, "speed", void 0); + + _defineProperty(this, "swipe", void 0); + + _defineProperty(this, "timeStamp", void 0); + + _defineProperty(this, "dragEnter", void 0); + + _defineProperty(this, "dragLeave", void 0); + + _defineProperty(this, "axes", void 0); + + _defineProperty(this, "preEnd", void 0); + + element = element || interaction.element; + const target = interaction.interactable; + const deltaSource = (target && target.options || defaults).deltaSource; + const origin = getOriginXY(target, element, actionName); + const starting = phase === 'start'; + const ending = phase === 'end'; + const prevEvent = starting ? this : interaction.prevEvent; + const coords = starting ? interaction.coords.start : ending ? { + page: prevEvent.page, + client: prevEvent.client, + timeStamp: interaction.coords.cur.timeStamp + } : interaction.coords.cur; + this.page = extend({}, coords.page); + this.client = extend({}, coords.client); + this.rect = extend({}, interaction.rect); + this.timeStamp = coords.timeStamp; + + if (!ending) { + this.page.x -= origin.x; + this.page.y -= origin.y; + this.client.x -= origin.x; + this.client.y -= origin.y; + } + + this.ctrlKey = event.ctrlKey; + this.altKey = event.altKey; + this.shiftKey = event.shiftKey; + this.metaKey = event.metaKey; + this.button = event.button; + this.buttons = event.buttons; + this.target = element; + this.currentTarget = element; + this.preEnd = preEnd; + this.type = type || actionName + (phase || ''); + this.interactable = target; + this.t0 = starting ? interaction.pointers[interaction.pointers.length - 1].downTime : prevEvent.t0; + this.x0 = interaction.coords.start.page.x - origin.x; + this.y0 = interaction.coords.start.page.y - origin.y; + this.clientX0 = interaction.coords.start.client.x - origin.x; + this.clientY0 = interaction.coords.start.client.y - origin.y; + + if (starting || ending) { + this.delta = { + x: 0, + y: 0 + }; + } else { + this.delta = { + x: this[deltaSource].x - prevEvent[deltaSource].x, + y: this[deltaSource].y - prevEvent[deltaSource].y + }; + } + + this.dt = interaction.coords.delta.timeStamp; + this.duration = this.timeStamp - this.t0; // velocity and speed in pixels per second + + this.velocity = extend({}, interaction.coords.velocity[deltaSource]); + this.speed = hypot(this.velocity.x, this.velocity.y); + this.swipe = ending || phase === 'inertiastart' ? this.getSwipe() : null; + } + + get pageX() { + return this.page.x; + } + + set pageX(value) { + this.page.x = value; + } + + get pageY() { + return this.page.y; + } + + set pageY(value) { + this.page.y = value; + } + + get clientX() { + return this.client.x; + } + + set clientX(value) { + this.client.x = value; + } + + get clientY() { + return this.client.y; + } + + set clientY(value) { + this.client.y = value; + } + + get dx() { + return this.delta.x; + } + + set dx(value) { + this.delta.x = value; + } + + get dy() { + return this.delta.y; + } + + set dy(value) { + this.delta.y = value; + } + + get velocityX() { + return this.velocity.x; + } + + set velocityX(value) { + this.velocity.x = value; + } + + get velocityY() { + return this.velocity.y; + } + + set velocityY(value) { + this.velocity.y = value; + } + + getSwipe() { + const interaction = this._interaction; + + if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) { + return null; + } + + let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI; + const overlap = 22.5; + + if (angle < 0) { + angle += 360; + } + + const left = 135 - overlap <= angle && angle < 225 + overlap; + const up = 225 - overlap <= angle && angle < 315 + overlap; + const right = !left && (315 - overlap <= angle || angle < 45 + overlap); + const down = !up && 45 - overlap <= angle && angle < 135 + overlap; + return { + up, + down, + left, + right, + angle, + speed: interaction.prevEvent.speed, + velocity: { + x: interaction.prevEvent.velocityX, + y: interaction.prevEvent.velocityY + } + }; + } + + preventDefault() {} + /** + * Don't call listeners on the remaining targets + */ + + + stopImmediatePropagation() { + this.immediatePropagationStopped = this.propagationStopped = true; + } + /** + * Don't call any other listeners (even on the current target) + */ + + + stopPropagation() { + this.propagationStopped = true; + } + +} +export default InteractEvent; +//# sourceMappingURL=InteractEvent.js.map \ No newline at end of file diff --git a/@interactjs/core/InteractEvent.js.map b/@interactjs/core/InteractEvent.js.map new file mode 100644 index 000000000..f2293e557 --- /dev/null +++ b/@interactjs/core/InteractEvent.js.map @@ -0,0 +1,89 @@ +{ + "version": 3, + "sources": [ + "InteractEvent.ts" + ], + "names": [ + "extend", + "getOriginXY", + "hypot", + "BaseEvent", + "defaults", + "InteractEvent", + "constructor", + "interaction", + "event", + "actionName", + "phase", + "element", + "preEnd", + "type", + "target", + "interactable", + "deltaSource", + "options", + "origin", + "starting", + "ending", + "prevEvent", + "coords", + "start", + "page", + "client", + "timeStamp", + "cur", + "rect", + "x", + "y", + "ctrlKey", + "altKey", + "shiftKey", + "metaKey", + "button", + "buttons", + "currentTarget", + "t0", + "pointers", + "length", + "downTime", + "x0", + "y0", + "clientX0", + "clientY0", + "delta", + "dt", + "duration", + "velocity", + "speed", + "swipe", + "getSwipe", + "pageX", + "value", + "pageY", + "clientX", + "clientY", + "dx", + "dy", + "velocityX", + "velocityY", + "_interaction", + "angle", + "Math", + "atan2", + "PI", + "overlap", + "left", + "up", + "right", + "down", + "preventDefault", + "stopImmediatePropagation", + "immediatePropagationStopped", + "propagationStopped", + "stopPropagation" + ], + "mappings": ";;AAAA,OAAOA,MAAP;AACA,OAAOC,WAAP;AACA,OAAOC,KAAP;AACA,OAAOC,SAAP;AACA,OAAOC,QAAP;AAWA,OAAO,MAAMC,aAAN,SAGGF,SAHH,CAGgB;AA2BrB;AAGA;;AAIA;AACAG,EAAAA,WAAW,CACTC,WADS,EAET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AA,KALK;AAMLb,MAAAA,KAAK,EAAE3C,WAAW,CAACc,SAAZ,CAAsB6B,KANxB;AAOLD,MAAAA,QAAQ,EAAE;AACRpB,QAAAA,CAAC,EAAEtB,WAAW,CAACc,SAAZ,CAAsBuC,SADjB;AAER9B,QAAAA,CAAC,EAAEvB,WAAW,CAACc,SAAZ,CAAsBwC;AAFjB;AAPL,KAAP;AAYD;;AAEDW,EAAAA,cAAc,GAAI,CAAE;AAEpB;;;;;AAGAC,EAAAA,wBAAwB,GAAI;AAC1B,SAAKC,2BAAL,GAAmC,KAAKC,kBAAL,GAA0B,IAA7D;AACD;AAED;;;;;AAGAC,EAAAA,eAAe,GAAI;AACjB,SAAKD,kBAAL,GAA0B,IAA1B;AACD;;AAvLoB;AA0LvB,eAAetE,aAAf", + "sourcesContent": [ + "import extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport BaseEvent from './BaseEvent'\nimport defaults from './defaultOptions'\nimport Interaction from './Interaction'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\nexport class InteractEvent<\n T extends Interact.ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n target: Interact.Element\n currentTarget: Interact.Element\n relatedTarget: null = null\n screenX?: number\n screenY?: number\n button: number\n buttons: number\n ctrlKey: boolean\n shiftKey: boolean\n altKey: boolean\n metaKey: boolean\n page: Interact.Point\n client: Interact.Point\n delta: Interact.Point\n rect: Interact.FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Interact.Point\n speed: number\n swipe: ReturnType['getSwipe']>\n timeStamp: any\n // drag\n dragEnter?: Interact.Element\n dragLeave?: Interact.Element\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: Interact.PointerEventType,\n actionName: T,\n phase: P,\n element: Interact.Element,\n preEnd?: boolean,\n type?: string,\n ) {\n super(interaction)\n\n element = element || interaction.element\n\n const target = interaction.interactable\n const deltaSource = (((target && target.options) || defaults) as any).deltaSource as 'page' | 'client'\n const origin = getOriginXY(target, element, actionName)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const prevEvent = starting ? this : interaction.prevEvent\n const coords = starting\n ? interaction.coords.start\n : ending\n ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp }\n : interaction.coords.cur\n\n this.page = extend({}, coords.page)\n this.client = extend({}, coords.client)\n this.rect = extend({}, interaction.rect)\n this.timeStamp = coords.timeStamp\n\n if (!ending) {\n this.page.x -= origin.x\n this.page.y -= origin.y\n\n this.client.x -= origin.x\n this.client.y -= origin.y\n }\n\n this.ctrlKey = event.ctrlKey\n this.altKey = event.altKey\n this.shiftKey = event.shiftKey\n this.metaKey = event.metaKey\n this.button = (event as MouseEvent).button\n this.buttons = (event as MouseEvent).buttons\n this.target = element\n this.currentTarget = element\n this.preEnd = preEnd\n this.type = type || (actionName + (phase || ''))\n this.interactable = target\n\n this.t0 = starting\n ? interaction.pointers[interaction.pointers.length - 1].downTime\n : prevEvent.t0\n\n this.x0 = interaction.coords.start.page.x - origin.x\n this.y0 = interaction.coords.start.page.y - origin.y\n this.clientX0 = interaction.coords.start.client.x - origin.x\n this.clientY0 = interaction.coords.start.client.y - origin.y\n\n if (starting || ending) {\n this.delta = { x: 0, y: 0 }\n }\n else {\n this.delta = {\n x: this[deltaSource].x - prevEvent[deltaSource].x,\n y: this[deltaSource].y - prevEvent[deltaSource].y,\n }\n }\n\n this.dt = interaction.coords.delta.timeStamp\n this.duration = this.timeStamp - this.t0\n\n // velocity and speed in pixels per second\n this.velocity = extend({}, interaction.coords.velocity[deltaSource])\n this.speed = hypot(this.velocity.x, this.velocity.y)\n\n this.swipe = (ending || phase === 'inertiastart') ? this.getSwipe() : null\n }\n\n get pageX () { return this.page.x }\n set pageX (value) { this.page.x = value }\n get pageY () { return this.page.y }\n set pageY (value) { this.page.y = value }\n\n get clientX () { return this.client.x }\n set clientX (value) { this.client.x = value }\n get clientY () { return this.client.y }\n set clientY (value) { this.client.y = value }\n\n get dx () { return this.delta.x }\n set dx (value) { this.delta.x = value }\n get dy () { return this.delta.y }\n set dy (value) { this.delta.y = value }\n\n get velocityX () { return this.velocity.x }\n set velocityX (value) { this.velocity.x = value }\n get velocityY () { return this.velocity.y }\n set velocityY (value) { this.velocity.y = value }\n\n getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 ||\n this.timeStamp - interaction.prevEvent.timeStamp > 150) {\n return null\n }\n\n let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI\n const overlap = 22.5\n\n if (angle < 0) {\n angle += 360\n }\n\n const left = 135 - overlap <= angle && angle < 225 + overlap\n const up = 225 - overlap <= angle && angle < 315 + overlap\n\n const right = !left && (315 - overlap <= angle || angle < 45 + overlap)\n const down = !up && 45 - overlap <= angle && angle < 135 + overlap\n\n return {\n up,\n down,\n left,\n right,\n angle,\n speed: interaction.prevEvent.speed,\n velocity: {\n x: interaction.prevEvent.velocityX,\n y: interaction.prevEvent.velocityY,\n },\n }\n }\n\n preventDefault () {}\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n}\n\nexport default InteractEvent\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Interactable.d.ts b/@interactjs/core/Interactable.d.ts new file mode 100644 index 000000000..4c9f49486 --- /dev/null +++ b/@interactjs/core/Interactable.d.ts @@ -0,0 +1,133 @@ +import { Defaults, Options } from './defaultOptions'; +import Eventable from './Eventable'; +import { Actions } from './scope'; +declare type IgnoreValue = string | Interact.Element | boolean; +/** */ +export declare class Interactable implements Partial { + protected readonly _defaults: Defaults; + readonly options: Required; + readonly _actions: Actions; + readonly target: Interact.Target; + readonly events: Eventable; + readonly _context: Document | Interact.Element; + readonly _win: Window; + readonly _doc: Document; + /** */ + constructor(target: Interact.Target, options: any, defaultContext: Document | Interact.Element); + setOnEvents(actionName: Interact.ActionName, phases: NonNullable): this; + updatePerActionListeners(actionName: Interact.ActionName, prev: Interact.Listeners, cur: Interact.Listeners): void; + setPerAction(actionName: Interact.ActionName, options: Interact.OrBoolean): void; + /** + * The default function to get an Interactables bounding rect. Can be + * overridden using {@link Interactable.rectChecker}. + * + * @param {Element} [element] The element to measure. + * @return {object} The object's bounding rectangle. + */ + getRect(element: Interact.Element): { + left: number; + right: number; + top: number; + bottom: number; + width: number; + height: number; + }; + /** + * Returns or sets the function used to calculate the interactable's + * element's rectangle + * + * @param {function} [checker] A function which returns this Interactable's + * bounding rectangle. See {@link Interactable.getRect} + * @return {function | object} The checker function or this Interactable + */ + rectChecker(checker: (element: Interact.Element) => any): this | ((element: import("@interactjs/types/types").Element) => { + left: number; + right: number; + top: number; + bottom: number; + width: number; + height: number; + }); + _backCompatOption(optionName: keyof Interact.Options, newValue: any): any; + /** + * Gets or sets the origin of the Interactable's element. The x and y + * of the origin will be subtracted from action event coordinates. + * + * @param {Element | object | string} [origin] An HTML or SVG Element whose + * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self' + * or any CSS selector + * + * @return {object} The current origin or this Interactable + */ + origin(newValue: any): any; + /** + * Returns or sets the mouse coordinate types used to calculate the + * movement of the pointer. + * + * @param {string} [newValue] Use 'client' if you will be scrolling while + * interacting; Use 'page' if you want autoScroll to work + * @return {string | object} The current deltaSource or this Interactable + */ + deltaSource(newValue?: string): "page" | "client" | this; + /** + * Gets the selector context Node of the Interactable. The default is + * `window.document`. + * + * @return {Node} The context Node of this Interactable + */ + context(): Document | HTMLElement | SVGElement; + inContext(element: Document | Node): boolean; + testIgnoreAllow(this: Interactable, options: { + ignoreFrom?: IgnoreValue; + allowFrom?: IgnoreValue; + }, targetNode: Node, eventTarget: Interact.EventTarget): any; + testAllow(this: Interactable, allowFrom: IgnoreValue, targetNode: Node, element: Interact.EventTarget): any; + testIgnore(this: Interactable, ignoreFrom: IgnoreValue, targetNode: Node, element: Interact.EventTarget): any; + /** + * Calls listeners for the given InteractEvent type bound globally + * and directly to this Interactable + * + * @param {InteractEvent} iEvent The InteractEvent object to be fired on this + * Interactable + * @return {Interactable} this Interactable + */ + fire(iEvent: object): this; + _onOff(method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any): this; + /** + * Binds a listener for an InteractEvent, pointerEvent or DOM event. + * + * @param {string | array | object} types The types of events to listen + * for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * addEventListener + * @return {Interactable} This Interactable + */ + on(types: Interact.EventTypes, listener?: Interact.ListenersArg, options?: any): this; + /** + * Removes an InteractEvent, pointerEvent or DOM event listener. + * + * @param {string | array | object} types The types of events that were + * listened for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * removeEventListener + * @return {Interactable} This Interactable + */ + off(types: string | string[] | Interact.EventTypes, listener?: Interact.ListenersArg, options?: any): this; + /** + * Reset the options of this Interactable + * + * @param {object} options The new settings to apply + * @return {object} This Interactable + */ + set(options: Interact.OptionsArg): this; + /** + * Remove this interactable from the list of interactables and remove it's + * action capabilities and event listeners + * + * @return {interact} + */ + unset(): void; +} +export default Interactable; diff --git a/@interactjs/core/Interactable.js b/@interactjs/core/Interactable.js new file mode 100644 index 000000000..ed8acdcb0 --- /dev/null +++ b/@interactjs/core/Interactable.js @@ -0,0 +1,390 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import * as arr from "../utils/arr.js"; +import browser from "../utils/browser.js"; +import clone from "../utils/clone.js"; +import { getElementRect, matchesUpTo, nodeContains, trySelector } from "../utils/domUtils.js"; +import events from "../utils/events.js"; +import extend from "../utils/extend.js"; +import * as is from "../utils/is.js"; +import normalizeListeners from "../utils/normalizeListeners.js"; +import { getWindow } from "../utils/window.js"; +import Eventable from "./Eventable.js"; +import { isNonNativeEvent } from "./scope.js"; + +/** */ +export class Interactable { + get _defaults() { + return { + base: {}, + perAction: {}, + actions: {} + }; + } + + /** */ + constructor(target, options, defaultContext) { + _defineProperty(this, "options", void 0); + + _defineProperty(this, "_actions", void 0); + + _defineProperty(this, "target", void 0); + + _defineProperty(this, "events", new Eventable()); + + _defineProperty(this, "_context", void 0); + + _defineProperty(this, "_win", void 0); + + _defineProperty(this, "_doc", void 0); + + this._actions = options.actions; + this.target = target; + this._context = options.context || defaultContext; + this._win = getWindow(trySelector(target) ? this._context : target); + this._doc = this._win.document; + this.set(options); + } + + setOnEvents(actionName, phases) { + if (is.func(phases.onstart)) { + this.on(`${actionName}start`, phases.onstart); + } + + if (is.func(phases.onmove)) { + this.on(`${actionName}move`, phases.onmove); + } + + if (is.func(phases.onend)) { + this.on(`${actionName}end`, phases.onend); + } + + if (is.func(phases.oninertiastart)) { + this.on(`${actionName}inertiastart`, phases.oninertiastart); + } + + return this; + } + + updatePerActionListeners(actionName, prev, cur) { + if (is.array(prev) || is.object(prev)) { + this.off(actionName, prev); + } + + if (is.array(cur) || is.object(cur)) { + this.on(actionName, cur); + } + } + + setPerAction(actionName, options) { + const defaults = this._defaults; // for all the default per-action options + + for (const optionName_ in options) { + const optionName = optionName_; + const actionOptions = this.options[actionName]; + const optionValue = options[optionName]; // remove old event listeners and add new ones + + if (optionName === 'listeners') { + this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue); + } // if the option value is an array + + + if (is.array(optionValue)) { + actionOptions[optionName] = arr.from(optionValue); + } // if the option value is an object + else if (is.plainObject(optionValue)) { + // copy the object + actionOptions[optionName] = extend(actionOptions[optionName] || {}, clone(optionValue)); // set anabled field to true if it exists in the defaults + + if (is.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) { + actionOptions[optionName].enabled = optionValue.enabled !== false; + } + } // if the option value is a boolean and the default is an object + else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) { + actionOptions[optionName].enabled = optionValue; + } // if it's anything else, do a plain assignment + else { + actionOptions[optionName] = optionValue; + } + } + } + /** + * The default function to get an Interactables bounding rect. Can be + * overridden using {@link Interactable.rectChecker}. + * + * @param {Element} [element] The element to measure. + * @return {object} The object's bounding rectangle. + */ + + + getRect(element) { + element = element || (is.element(this.target) ? this.target : null); + + if (is.string(this.target)) { + element = element || this._context.querySelector(this.target); + } + + return getElementRect(element); + } + /** + * Returns or sets the function used to calculate the interactable's + * element's rectangle + * + * @param {function} [checker] A function which returns this Interactable's + * bounding rectangle. See {@link Interactable.getRect} + * @return {function | object} The checker function or this Interactable + */ + + + rectChecker(checker) { + if (is.func(checker)) { + this.getRect = checker; + return this; + } + + if (checker === null) { + delete this.getRect; + return this; + } + + return this.getRect; + } + + _backCompatOption(optionName, newValue) { + if (trySelector(newValue) || is.object(newValue)) { + this.options[optionName] = newValue; + + for (const action in this._actions.map) { + this.options[action][optionName] = newValue; + } + + return this; + } + + return this.options[optionName]; + } + /** + * Gets or sets the origin of the Interactable's element. The x and y + * of the origin will be subtracted from action event coordinates. + * + * @param {Element | object | string} [origin] An HTML or SVG Element whose + * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self' + * or any CSS selector + * + * @return {object} The current origin or this Interactable + */ + + + origin(newValue) { + return this._backCompatOption('origin', newValue); + } + /** + * Returns or sets the mouse coordinate types used to calculate the + * movement of the pointer. + * + * @param {string} [newValue] Use 'client' if you will be scrolling while + * interacting; Use 'page' if you want autoScroll to work + * @return {string | object} The current deltaSource or this Interactable + */ + + + deltaSource(newValue) { + if (newValue === 'page' || newValue === 'client') { + this.options.deltaSource = newValue; + return this; + } + + return this.options.deltaSource; + } + /** + * Gets the selector context Node of the Interactable. The default is + * `window.document`. + * + * @return {Node} The context Node of this Interactable + */ + + + context() { + return this._context; + } + + inContext(element) { + return this._context === element.ownerDocument || nodeContains(this._context, element); + } + + testIgnoreAllow(options, targetNode, eventTarget) { + return !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) && this.testAllow(options.allowFrom, targetNode, eventTarget); + } + + testAllow(allowFrom, targetNode, element) { + if (!allowFrom) { + return true; + } + + if (!is.element(element)) { + return false; + } + + if (is.string(allowFrom)) { + return matchesUpTo(element, allowFrom, targetNode); + } else if (is.element(allowFrom)) { + return nodeContains(allowFrom, element); + } + + return false; + } + + testIgnore(ignoreFrom, targetNode, element) { + if (!ignoreFrom || !is.element(element)) { + return false; + } + + if (is.string(ignoreFrom)) { + return matchesUpTo(element, ignoreFrom, targetNode); + } else if (is.element(ignoreFrom)) { + return nodeContains(ignoreFrom, element); + } + + return false; + } + /** + * Calls listeners for the given InteractEvent type bound globally + * and directly to this Interactable + * + * @param {InteractEvent} iEvent The InteractEvent object to be fired on this + * Interactable + * @return {Interactable} this Interactable + */ + + + fire(iEvent) { + this.events.fire(iEvent); + return this; + } + + _onOff(method, typeArg, listenerArg, options) { + if (is.object(typeArg) && !is.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + const addRemove = method === 'on' ? 'add' : 'remove'; + const listeners = normalizeListeners(typeArg, listenerArg); + + for (let type in listeners) { + if (type === 'wheel') { + type = browser.wheelEvent; + } + + for (const listener of listeners[type]) { + // if it is an action event type + if (isNonNativeEvent(type, this._actions)) { + this.events[method](type, listener); + } // delegated event + else if (is.string(this.target)) { + events[`${addRemove}Delegate`](this.target, this._context, type, listener, options); + } // remove listener from this Interactable's element + else { + events[addRemove](this.target, type, listener, options); + } + } + } + + return this; + } + /** + * Binds a listener for an InteractEvent, pointerEvent or DOM event. + * + * @param {string | array | object} types The types of events to listen + * for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * addEventListener + * @return {Interactable} This Interactable + */ + + + on(types, listener, options) { + return this._onOff('on', types, listener, options); + } + /** + * Removes an InteractEvent, pointerEvent or DOM event listener. + * + * @param {string | array | object} types The types of events that were + * listened for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * removeEventListener + * @return {Interactable} This Interactable + */ + + + off(types, listener, options) { + return this._onOff('off', types, listener, options); + } + /** + * Reset the options of this Interactable + * + * @param {object} options The new settings to apply + * @return {object} This Interactable + */ + + + set(options) { + const defaults = this._defaults; + + if (!is.object(options)) { + options = {}; + } + + this.options = clone(defaults.base); + + for (const actionName_ in this._actions.methodDict) { + const actionName = actionName_; + const methodName = this._actions.methodDict[actionName]; + this.options[actionName] = {}; + this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName])); + this[methodName](options[actionName]); + } + + for (const setting in options) { + if (is.func(this[setting])) { + this[setting](options[setting]); + } + } + + return this; + } + /** + * Remove this interactable from the list of interactables and remove it's + * action capabilities and event listeners + * + * @return {interact} + */ + + + unset() { + events.remove(this.target, 'all'); + + if (is.string(this.target)) { + // remove delegated events + for (const type in events.delegatedEvents) { + const delegated = events.delegatedEvents[type]; + + if (delegated.selectors[0] === this.target && delegated.contexts[0] === this._context) { + delegated.selectors.splice(0, 1); + delegated.contexts.splice(0, 1); + delegated.listeners.splice(0, 1); + } + + events.remove(this._context, type, events.delegateListener); + events.remove(this._context, type, events.delegateUseCapture, true); + } + } else { + events.remove(this.target, 'all'); + } + } + +} +export default Interactable; +//# sourceMappingURL=Interactable.js.map \ No newline at end of file diff --git a/@interactjs/core/Interactable.js.map b/@interactjs/core/Interactable.js.map new file mode 100644 index 000000000..f6e9a1fb1 --- /dev/null +++ b/@interactjs/core/Interactable.js.map @@ -0,0 +1,113 @@ +{ + "version": 3, + "sources": [ + "Interactable.ts" + ], + "names": [ + "arr", + "browser", + "clone", + "getElementRect", + "matchesUpTo", + "nodeContains", + "trySelector", + "events", + "extend", + "is", + "normalizeListeners", + "getWindow", + "Eventable", + "isNonNativeEvent", + "Interactable", + "_defaults", + "base", + "perAction", + "actions", + "constructor", + "target", + "options", + "defaultContext", + "_actions", + "_context", + "context", + "_win", + "_doc", + "document", + "set", + "setOnEvents", + "actionName", + "phases", + "func", + "onstart", + "on", + "onmove", + "onend", + "oninertiastart", + "updatePerActionListeners", + "prev", + "cur", + "array", + "object", + "off", + "setPerAction", + "defaults", + "optionName_", + "optionName", + "actionOptions", + "optionValue", + "listeners", + "from", + "plainObject", + "enabled", + "bool", + "getRect", + "element", + "string", + "querySelector", + "rectChecker", + "checker", + "_backCompatOption", + "newValue", + "action", + "map", + "origin", + "deltaSource", + "inContext", + "ownerDocument", + "testIgnoreAllow", + "targetNode", + "eventTarget", + "testIgnore", + "ignoreFrom", + "testAllow", + "allowFrom", + "fire", + "iEvent", + "_onOff", + "method", + "typeArg", + "listenerArg", + "addRemove", + "type", + "wheelEvent", + "listener", + "types", + "actionName_", + "methodDict", + "methodName", + "setting", + "unset", + "remove", + "delegatedEvents", + "delegated", + "selectors", + "contexts", + "splice", + "delegateListener", + "delegateUseCapture" + ], + "mappings": ";;AAAA,OAAO,KAAKA,GAAZ;AACA,OAAOC,OAAP;AACA,OAAOC,KAAP;AACA,SAASC,cAAT,EAAyBC,WAAzB,EAAsCC,YAAtC,EAAoDC,WAApD;AACA,OAAOC,MAAP;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,kBAAP;AACA,SAASC,SAAT;AAEA,OAAOC,SAAP;AACA,SAAkBC,gBAAlB;;AAIA;AACA,OAAO,MAAMC,YAAN,CAAiD;AACtD,MAAcC,SAAd,GAAqC;AACnC,WAAO;AACLC,MAAAA,IAAI,EAAE,EADD;AAELC,MAAAA,SAAS,EAAE,EAFN;AAGLC,MAAAA,OAAO,EAAE;AAHJ,KAAP;AAKD;;AAUD;AACAC,EAAAA,WAAW,CAAEC,MAAF,EAA2BC,OAA3B,EAAyCC,cAAzC,EAAsF;AAAA;;AAAA;;AAAA;;AAAA,oCAN/E,IAAIV,SAAJ,EAM+E;;AAAA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AnC;;AAEA,QAAIX,EAAE,CAACiD,MAAH,CAAU,KAAKtC,MAAf,CAAJ,EAA4B;AAC1B;AACA,WAAK,MAAMgE,IAAX,IAAmB7E,MAAM,CAACuF,eAA1B,EAA2C;AACzC,cAAMC,SAAS,GAAGxF,MAAM,CAACuF,eAAP,CAAuBV,IAAvB,CAAlB;;AAEA,YAAIW,SAAS,CAACC,SAAV,CAAoB,CAApB,MAA2B,KAAK5E,MAAhC,IACA2E,SAAS,CAACE,QAAV,CAAmB,CAAnB,MAA0B,KAAKzE,QADnC,EAC6C;AAC3CuE,UAAAA,SAAS,CAACC,SAAV,CAAoBE,MAApB,CAA2B,CAA3B,EAA8B,CAA9B;AACAH,UAAAA,SAAS,CAACE,QAAV,CAAmBC,MAAnB,CAA0B,CAA1B,EAA6B,CAA7B;AACAH,UAAAA,SAAS,CAAC5C,SAAV,CAAoB+C,MAApB,CAA2B,CAA3B,EAA8B,CAA9B;AACD;;AAED3F,QAAAA,MAAM,CAACsF,MAAP,CAAc,KAAKrE,QAAnB,EAA6B4D,IAA7B,EAAmC7E,MAAM,CAAC4F,gBAA1C;AACA5F,QAAAA,MAAM,CAACsF,MAAP,CAAc,KAAKrE,QAAnB,EAA6B4D,IAA7B,EAAmC7E,MAAM,CAAC6F,kBAA1C,EAA8D,IAA9D;AACD;AACF,KAfD,MAgBK;AACH7F,MAAAA,MAAM,CAACsF,MAAP,CAAc,KAAKzE,MAAnB,EAAmC,KAAnC;AACD;AACF;;AAvXqD;AA0XxD,eAAeN,YAAf", + "sourcesContent": [ + "import * as arr from '@interactjs/utils/arr'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\nimport { ActionDefaults, Defaults, Options } from './defaultOptions'\nimport Eventable from './Eventable'\nimport { Actions, isNonNativeEvent } from './scope'\n\ntype IgnoreValue = string | Interact.Element | boolean\n\n/** */\nexport class Interactable implements Partial {\n protected get _defaults (): Defaults {\n return {\n base: {},\n perAction: {},\n actions: {} as ActionDefaults,\n }\n }\n\n readonly options!: Required\n readonly _actions: Actions\n readonly target: Interact.Target\n readonly events = new Eventable()\n readonly _context: Document | Interact.Element\n readonly _win: Window\n readonly _doc: Document\n\n /** */\n constructor (target: Interact.Target, options: any, defaultContext: Document | Interact.Element) {\n this._actions = options.actions\n this.target = target\n this._context = options.context || defaultContext\n this._win = getWindow(trySelector(target) ? this._context : target)\n this._doc = this._win.document\n\n this.set(options)\n }\n\n setOnEvents (actionName: Interact.ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) { this.on(`${actionName}start`, phases.onstart) }\n if (is.func(phases.onmove)) { this.on(`${actionName}move`, phases.onmove) }\n if (is.func(phases.onend)) { this.on(`${actionName}end`, phases.onend) }\n if (is.func(phases.oninertiastart)) { this.on(`${actionName}inertiastart`, phases.oninertiastart) }\n\n return this\n }\n\n updatePerActionListeners (actionName: Interact.ActionName, prev: Interact.Listeners, cur: Interact.Listeners) {\n if (is.array(prev) || is.object(prev)) {\n this.off(actionName, prev)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this.on(actionName, cur)\n }\n }\n\n setPerAction (actionName: Interact.ActionName, options: Interact.OrBoolean) {\n const defaults = this._defaults\n\n // for all the default per-action options\n for (const optionName_ in options) {\n const optionName = optionName_ as keyof Interact.PerActionDefaults\n const actionOptions = this.options[actionName]\n const optionValue: any = options[optionName]\n\n // remove old event listeners and add new ones\n if (optionName === 'listeners') {\n this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue as Interact.Listeners)\n }\n\n // if the option value is an array\n if (is.array(optionValue)) {\n (actionOptions[optionName] as any) = arr.from(optionValue)\n }\n // if the option value is an object\n else if (is.plainObject(optionValue)) {\n // copy the object\n (actionOptions[optionName] as any) = extend(\n actionOptions[optionName] || {} as any,\n clone(optionValue))\n\n // set anabled field to true if it exists in the defaults\n if (is.object(defaults.perAction[optionName]) && 'enabled' in (defaults.perAction[optionName] as any)) {\n (actionOptions[optionName] as any).enabled = optionValue.enabled !== false\n }\n }\n // if the option value is a boolean and the default is an object\n else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {\n (actionOptions[optionName] as any).enabled = optionValue\n }\n // if it's anything else, do a plain assignment\n else {\n (actionOptions[optionName] as any) = optionValue\n }\n }\n }\n\n /**\n * The default function to get an Interactables bounding rect. Can be\n * overridden using {@link Interactable.rectChecker}.\n *\n * @param {Element} [element] The element to measure.\n * @return {object} The object's bounding rectangle.\n */\n getRect (element: Interact.Element) {\n element = element || (is.element(this.target)\n ? this.target\n : null)\n\n if (is.string(this.target)) {\n element = element || this._context.querySelector(this.target)\n }\n\n return getElementRect(element)\n }\n\n /**\n * Returns or sets the function used to calculate the interactable's\n * element's rectangle\n *\n * @param {function} [checker] A function which returns this Interactable's\n * bounding rectangle. See {@link Interactable.getRect}\n * @return {function | object} The checker function or this Interactable\n */\n rectChecker (checker: (element: Interact.Element) => any) {\n if (is.func(checker)) {\n this.getRect = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof Interact.Options, newValue: any) {\n if (trySelector(newValue) || is.object(newValue)) {\n (this.options[optionName] as any) = newValue\n\n for (const action in this._actions.map) {\n (this.options[action][optionName] as any) = newValue\n }\n\n return this\n }\n\n return this.options[optionName]\n }\n\n /**\n * Gets or sets the origin of the Interactable's element. The x and y\n * of the origin will be subtracted from action event coordinates.\n *\n * @param {Element | object | string} [origin] An HTML or SVG Element whose\n * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\n * or any CSS selector\n *\n * @return {object} The current origin or this Interactable\n */\n origin (newValue: any) {\n return this._backCompatOption('origin', newValue)\n }\n\n /**\n * Returns or sets the mouse coordinate types used to calculate the\n * movement of the pointer.\n *\n * @param {string} [newValue] Use 'client' if you will be scrolling while\n * interacting; Use 'page' if you want autoScroll to work\n * @return {string | object} The current deltaSource or this Interactable\n */\n deltaSource (newValue?: string) {\n if (newValue === 'page' || newValue === 'client') {\n this.options.deltaSource = newValue\n\n return this\n }\n\n return this.options.deltaSource\n }\n\n /**\n * Gets the selector context Node of the Interactable. The default is\n * `window.document`.\n *\n * @return {Node} The context Node of this Interactable\n */\n context () {\n return this._context\n }\n\n inContext (element: Document | Node) {\n return (this._context === element.ownerDocument ||\n nodeContains(this._context, element))\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Interact.EventTarget,\n ) {\n return (!this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget))\n }\n\n testAllow (\n this: Interactable,\n allowFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!allowFrom) { return true }\n\n if (!is.element(element)) { return false }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n }\n else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (\n this: Interactable,\n ignoreFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!ignoreFrom || !is.element(element)) { return false }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\n }\n else if (is.element(ignoreFrom)) {\n return nodeContains(ignoreFrom, element)\n }\n\n return false\n }\n\n /**\n * Calls listeners for the given InteractEvent type bound globally\n * and directly to this Interactable\n *\n * @param {InteractEvent} iEvent The InteractEvent object to be fired on this\n * Interactable\n * @return {Interactable} this Interactable\n */\n fire (iEvent: object) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const addRemove = method === 'on' ? 'add' : 'remove'\n const listeners = normalizeListeners(typeArg, listenerArg)\n\n for (let type in listeners) {\n if (type === 'wheel') { type = browser.wheelEvent }\n\n for (const listener of listeners[type]) {\n // if it is an action event type\n if (isNonNativeEvent(type, this._actions)) {\n this.events[method](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n events[`${addRemove}Delegate` as 'addDelegate' | 'removeDelegate'](this.target, this._context, type, listener, options)\n }\n // remove listener from this Interactable's element\n else {\n (events[addRemove] as typeof events.remove)(this.target, type, listener, options)\n }\n }\n }\n\n return this\n }\n\n /**\n * Binds a listener for an InteractEvent, pointerEvent or DOM event.\n *\n * @param {string | array | object} types The types of events to listen\n * for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * addEventListener\n * @return {Interactable} This Interactable\n */\n on (types: Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('on', types, listener, options)\n }\n\n /**\n * Removes an InteractEvent, pointerEvent or DOM event listener.\n *\n * @param {string | array | object} types The types of events that were\n * listened for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * removeEventListener\n * @return {Interactable} This Interactable\n */\n off (types: string | string[] | Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('off', types, listener, options)\n }\n\n /**\n * Reset the options of this Interactable\n *\n * @param {object} options The new settings to apply\n * @return {object} This Interactable\n */\n set (options: Interact.OptionsArg) {\n const defaults = this._defaults\n\n if (!is.object(options)) {\n options = {}\n }\n\n (this.options as Required) = clone(defaults.base) as Required\n\n for (const actionName_ in this._actions.methodDict) {\n const actionName = actionName_ as Interact.ActionName\n const methodName = this._actions.methodDict[actionName]\n\n this.options[actionName] = {}\n this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))\n\n this[methodName](options[actionName])\n }\n\n for (const setting in options) {\n if (is.func(this[setting])) {\n this[setting](options[setting])\n }\n }\n\n return this\n }\n\n /**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n *\n * @return {interact}\n */\n unset () {\n events.remove(this.target as Node, 'all')\n\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in events.delegatedEvents) {\n const delegated = events.delegatedEvents[type]\n\n if (delegated.selectors[0] === this.target &&\n delegated.contexts[0] === this._context) {\n delegated.selectors.splice(0, 1)\n delegated.contexts.splice(0, 1)\n delegated.listeners.splice(0, 1)\n }\n\n events.remove(this._context, type, events.delegateListener)\n events.remove(this._context, type, events.delegateUseCapture, true)\n }\n }\n else {\n events.remove(this.target as Node, 'all')\n }\n }\n}\n\nexport default Interactable\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Interactable.spec.d.ts b/@interactjs/core/Interactable.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/Interactable.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/InteractableSet.d.ts b/@interactjs/core/InteractableSet.d.ts new file mode 100644 index 000000000..b677fffc8 --- /dev/null +++ b/@interactjs/core/InteractableSet.d.ts @@ -0,0 +1,26 @@ +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactable:new': { + interactable: Interact.Interactable; + target: Interact.Target; + options: Interact.OptionsArg; + win: Window; + }; + } +} +interface InteractableScopeProp { + context: Document | Interact.Element; + interactable: Interact.Interactable; +} +export default class InteractableSet { + protected scope: Interact.Scope; + list: Interact.Interactable[]; + selectorMap: { + [selector: string]: InteractableScopeProp[]; + }; + constructor(scope: Interact.Scope); + new(target: Interact.Target, options?: any): Interact.Interactable; + get(target: Interact.Target, options?: Interact.Options): import("@interactjs/core/Interactable").Interactable; + forEachMatch(node: Node, callback: (interactable: Interact.Interactable) => T): T | void; +} +export {}; diff --git a/@interactjs/core/InteractableSet.js b/@interactjs/core/InteractableSet.js new file mode 100644 index 000000000..2babfe75b --- /dev/null +++ b/@interactjs/core/InteractableSet.js @@ -0,0 +1,107 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import * as arr from "../utils/arr.js"; +import * as domUtils from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import * as is from "../utils/is.js"; +export default class InteractableSet { + // all set interactables + constructor(scope) { + this.scope = scope; + + _defineProperty(this, "list", []); + + _defineProperty(this, "selectorMap", {}); + + scope.addListeners({ + 'interactable:unset': ({ + interactable + }) => { + const { + target, + _context: context + } = interactable; + const targetMappings = is.string(target) ? this.selectorMap[target] : target[this.scope.id]; + const targetIndex = targetMappings.findIndex(m => m.context === context); + + if (targetMappings[targetIndex]) { + // Destroying mappingInfo's context and interactable + targetMappings[targetIndex].context = null; + targetMappings[targetIndex].interactable = null; + } + + targetMappings.splice(targetIndex, 1); + } + }); + } + + new(target, options) { + options = extend(options || {}, { + actions: this.scope.actions + }); + const interactable = new this.scope.Interactable(target, options, this.scope.document); + const mappingInfo = { + context: interactable._context, + interactable + }; + this.scope.addDocument(interactable._doc); + this.list.push(interactable); + + if (is.string(target)) { + if (!this.selectorMap[target]) { + this.selectorMap[target] = []; + } + + this.selectorMap[target].push(mappingInfo); + } else { + if (!interactable.target[this.scope.id]) { + Object.defineProperty(target, this.scope.id, { + value: [], + configurable: true + }); + } + + target[this.scope.id].push(mappingInfo); + } + + this.scope.fire('interactable:new', { + target, + options, + interactable, + win: this.scope._win + }); + return interactable; + } + + get(target, options) { + const context = options && options.context || this.scope.document; + const isSelector = is.string(target); + const targetMappings = isSelector ? this.selectorMap[target] : target[this.scope.id]; + + if (!targetMappings) { + return null; + } + + const found = arr.find(targetMappings, m => m.context === context && (isSelector || m.interactable.inContext(target))); + return found && found.interactable; + } + + forEachMatch(node, callback) { + for (const interactable of this.list) { + let ret; + + if ((is.string(interactable.target) // target is a selector and the element matches + ? is.element(node) && domUtils.matchesSelector(node, interactable.target) : // target is the element + node === interactable.target) && // the element is in context + interactable.inContext(node)) { + ret = callback(interactable); + } + + if (ret !== undefined) { + return ret; + } + } + } + +} +//# sourceMappingURL=InteractableSet.js.map \ No newline at end of file diff --git a/@interactjs/core/InteractableSet.js.map b/@interactjs/core/InteractableSet.js.map new file mode 100644 index 000000000..8f921ea10 --- /dev/null +++ b/@interactjs/core/InteractableSet.js.map @@ -0,0 +1,61 @@ +{ + "version": 3, + "sources": [ + "InteractableSet.ts" + ], + "names": [ + "arr", + "domUtils", + "extend", + "is", + "InteractableSet", + "constructor", + "scope", + "addListeners", + "interactable", + "target", + "_context", + "context", + "targetMappings", + "string", + "selectorMap", + "id", + "targetIndex", + "findIndex", + "m", + "splice", + "new", + "options", + "actions", + "Interactable", + "document", + "mappingInfo", + "addDocument", + "_doc", + "list", + "push", + "Object", + "defineProperty", + "value", + "configurable", + "fire", + "win", + "_win", + "get", + "isSelector", + "found", + "find", + "inContext", + "forEachMatch", + "node", + "callback", + "ret", + "element", + "matchesSelector", + "undefined" + ], + "mappings": ";;AAAA,OAAO,KAAKA,GAAZ;AACA,OAAO,KAAKC,QAAZ;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;AAkBA,eAAe,MAAMC,eAAN,CAAsB;AACnC;AAOAC,EAAAA,WAAW,CAAYC,KAAZ,EAAmC;AAAA,SAAvBA,KAAuB,GAAvBA,KAAuB;;AAAA,kCANd,EAMc;;AAAA,yCAF1C,EAE0C;;AAC5CA,IAAAA,KAAK,CAACC,YAAN,CAAmB;AACjB,4BAAsB,CAAC;AAAEC,QAAAA;AAAF,OAAD,KAAsB;AAC1C,cAAM;AAAEC,UAAAA,MAAF;AAAUC,UAAAA,QAAQ,EAAEC;AAApB,YAAgCH,YAAtC;AACA,cAAMI,cAAuC,GAAGT,EAAE,CAACU,MAAH,CAAUJ,MAAV,IAC5C,KAAKK,WAAL,CAAiBL,MAAjB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K,CAAC/B,YAAtB;AACD;;AAEDkC,EAAAA,YAAY,CAAKC,IAAL,EAAiBC,QAAjB,EAAiF;AAC3F,SAAK,MAAMpC,YAAX,IAA2B,KAAKoB,IAAhC,EAAsC;AACpC,UAAIiB,GAAJ;;AAEA,UAAI,CAAC1C,EAAE,CAACU,MAAH,CAAUL,YAAY,CAACC,MAAvB,EACL;AADK,QAEAN,EAAE,CAAC2C,OAAH,CAAWH,IAAX,KAAoB1C,QAAQ,CAAC8C,eAAT,CAAyBJ,IAAzB,EAA+BnC,YAAY,CAACC,MAA5C,CAFpB,GAGH;AACEkC,MAAAA,IAAI,KAAKnC,YAAY,CAACC,MAJtB,KAKF;AACCD,MAAAA,YAAY,CAACiC,SAAb,CAAuBE,IAAvB,CANH,EAMkC;AAChCE,QAAAA,GAAG,GAAGD,QAAQ,CAACpC,YAAD,CAAd;AACD;;AAED,UAAIqC,GAAG,KAAKG,SAAZ,EAAuB;AACrB,eAAOH,GAAP;AACD;AACF;AACF;;AAhGkC", + "sourcesContent": [ + "import * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interact.Interactable\n target: Interact.Target\n options: Interact.OptionsArg\n win: Window\n }\n }\n}\n\ninterface InteractableScopeProp {\n context: Document | Interact.Element\n interactable: Interact.Interactable\n}\n\nexport default class InteractableSet {\n // all set interactables\n list: Interact.Interactable[] = []\n\n selectorMap: {\n [selector: string]: InteractableScopeProp[]\n } = {}\n\n constructor (protected scope: Interact.Scope) {\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target, _context: context } = interactable\n const targetMappings: InteractableScopeProp[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = targetMappings.findIndex(m => m.context === context)\n if (targetMappings[targetIndex]) {\n // Destroying mappingInfo's context and interactable\n targetMappings[targetIndex].context = null\n targetMappings[targetIndex].interactable = null\n }\n targetMappings.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Interact.Target, options?: any): Interact.Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document)\n const mappingInfo = { context: interactable._context, interactable }\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) { this.selectorMap[target] = [] }\n this.selectorMap[target].push(mappingInfo)\n } else {\n if (!((interactable.target as any)[this.scope.id])) {\n Object.defineProperty(target, this.scope.id, {\n value: [],\n configurable: true,\n })\n }\n\n (target as any)[this.scope.id].push(mappingInfo)\n }\n\n this.scope.fire('interactable:new', {\n target,\n options,\n interactable,\n win: this.scope._win,\n })\n\n return interactable\n }\n\n get (target: Interact.Target, options?: Interact.Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const targetMappings: InteractableScopeProp[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!targetMappings) { return null }\n\n const found = arr.find(\n targetMappings,\n m => m.context === context &&\n (isSelector || m.interactable.inContext(target as any)))\n\n return found && found.interactable\n }\n\n forEachMatch (node: Node, callback: (interactable: Interact.Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret\n\n if ((is.string(interactable.target)\n // target is a selector and the element matches\n ? (is.element(node) && domUtils.matchesSelector(node, interactable.target))\n // target is the element\n : node === interactable.target) &&\n // the element is in context\n (interactable.inContext(node))) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Interaction.d.ts b/@interactjs/core/Interaction.d.ts new file mode 100644 index 000000000..911161075 --- /dev/null +++ b/@interactjs/core/Interaction.d.ts @@ -0,0 +1,220 @@ +import * as utils from '@interactjs/utils/index'; +import Interactable from './Interactable'; +import InteractEvent, { EventPhase } from './InteractEvent'; +import PointerInfo from './PointerInfo'; +import { ActionName } from './scope'; +export interface ActionProps { + name: T; + axis?: 'x' | 'y' | 'xy'; + edges?: Interact.EdgeOptions; +} +export interface StartAction extends ActionProps { + name: ActionName; +} +export declare enum _ProxyValues { + interactable = "", + element = "", + prepared = "", + pointerIsDown = "", + pointerWasMoved = "", + _proxy = "" +} +export declare enum _ProxyMethods { + start = "", + move = "", + end = "", + stop = "", + interacting = "" +} +export declare type PointerArgProps = { + pointer: Interact.PointerType; + event: Interact.PointerEventType; + eventTarget: Interact.EventTarget; + pointerIndex: number; + pointerInfo: PointerInfo; + interaction: Interaction; +} & T; +export interface DoPhaseArg { + event: Interact.PointerEventType; + phase: EventPhase; + interaction: Interaction; + iEvent: InteractEvent; + preEnd?: boolean; + type?: string; +} +export declare type DoAnyPhaseArg = DoPhaseArg; +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactions:new': { + interaction: Interaction; + }; + 'interactions:down': PointerArgProps<{ + type: 'down'; + }>; + 'interactions:move': PointerArgProps<{ + type: 'move'; + dx: number; + dy: number; + duplicate: boolean; + }>; + 'interactions:up': PointerArgProps<{ + type: 'up'; + curEventTarget: EventTarget; + }>; + 'interactions:cancel': SignalArgs['interactions:up'] & { + type: 'cancel'; + curEventTarget: EventTarget; + }; + 'interactions:update-pointer': PointerArgProps<{ + down: boolean; + }>; + 'interactions:remove-pointer': PointerArgProps; + 'interactions:blur': any; + 'interactions:before-action-start': Omit; + 'interactions:action-start': DoAnyPhaseArg; + 'interactions:after-action-start': DoAnyPhaseArg; + 'interactions:before-action-move': Omit; + 'interactions:action-move': DoAnyPhaseArg; + 'interactions:after-action-move': DoAnyPhaseArg; + 'interactions:before-action-end': Omit; + 'interactions:action-end': DoAnyPhaseArg; + 'interactions:after-action-end': DoAnyPhaseArg; + 'interactions:stop': { + interaction: Interaction; + }; + } +} +export declare type _InteractionProxy = Pick; +export declare class Interaction { + interactable: Interactable; + element: Interact.Element; + rect: Interact.FullRect; + _rects?: { + start: Interact.FullRect; + corrected: Interact.FullRect; + previous: Interact.FullRect; + delta: Interact.FullRect; + }; + edges: Interact.EdgeOptions; + _scopeFire: Interact.Scope['fire']; + prepared: ActionProps; + pointerType: string; + pointers: PointerInfo[]; + downEvent: Interact.PointerEventType; + downPointer: Interact.PointerType; + _latestPointer: { + pointer: Interact.PointerType; + event: Interact.PointerEventType; + eventTarget: Node; + }; + prevEvent: InteractEvent; + pointerIsDown: boolean; + pointerWasMoved: boolean; + _interacting: boolean; + _ending: boolean; + _stopped: boolean; + _proxy: _InteractionProxy; + simulation: any; + readonly pointerMoveTolerance: number; + /** + * @alias Interaction.prototype.move + */ + doMove: (this: typeof utils) => any; + coords: Interact.CoordsSet; + readonly _id: number; + /** */ + constructor({ pointerType, scopeFire }: { + pointerType?: string; + scopeFire: Interact.Scope['fire']; + }); + pointerDown(pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget): void; + /** + * ```js + * interact(target) + * .draggable({ + * // disable the default drag start by down->move + * manualStart: true + * }) + * // start dragging after the user holds the pointer down + * .on('hold', function (event) { + * var interaction = event.interaction + * + * if (!interaction.interacting()) { + * interaction.start({ name: 'drag' }, + * event.interactable, + * event.currentTarget) + * } + * }) + * ``` + * + * Start an action with the given Interactable and Element as tartgets. The + * action must be enabled for the target Interactable and an appropriate + * number of pointers must be held down - 1 for drag/resize, 2 for gesture. + * + * Use it with `interactable.able({ manualStart: false })` to always + * [start actions manually](https://github.com/taye/interact.js/issues/114) + * + * @param {object} action The action to be performed - drag, resize, etc. + * @param {Interactable} target The Interactable to target + * @param {Element} element The DOM Element to target + * @return {object} interact + */ + start(action: StartAction, interactable: Interactable, element: Interact.Element): any; + pointerMove(pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget): void; + /** + * ```js + * interact(target) + * .draggable(true) + * .on('dragmove', function (event) { + * if (someCondition) { + * // change the snap settings + * event.interactable.draggable({ snap: { targets: [] }}) + * // fire another move event with re-calculated snap + * event.interaction.move() + * } + * }) + * ``` + * + * Force a move of the current action at the same coordinates. Useful if + * snap/restrict has been changed and you want a movement with the new + * settings. + */ + move(signalArg?: any): void; + pointerUp(pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, curEventTarget: Interact.EventTarget): void; + documentBlur(event: any): void; + /** + * ```js + * interact(target) + * .draggable(true) + * .on('move', function (event) { + * if (event.pageX > 1000) { + * // end the current action + * event.interaction.end() + * // stop all further listeners from being called + * event.stopImmediatePropagation() + * } + * }) + * ``` + * + * @param {PointerEvent} [event] + */ + end(event?: Interact.PointerEventType): void; + currentAction(): T; + interacting(): boolean; + /** */ + stop(): void; + getPointerIndex(pointer: any): number; + getPointerInfo(pointer: any): PointerInfo; + updatePointer(pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean): number; + removePointer(pointer: Interact.PointerType, event: Interact.PointerEventType): void; + _updateLatestPointer(pointer: any, event: any, eventTarget: any): void; + destroy(): void; + _createPreparedEvent

(event: Interact.PointerEventType, phase: P, preEnd?: boolean, type?: string): InteractEvent; + _fireEvent

(iEvent: InteractEvent): void; + _doPhase

(signalArg: Omit, 'iEvent'> & { + iEvent?: InteractEvent; + }): boolean; + _now(): number; +} +export default Interaction; +export { PointerInfo }; diff --git a/@interactjs/core/Interaction.js b/@interactjs/core/Interaction.js new file mode 100644 index 000000000..d0438a3c6 --- /dev/null +++ b/@interactjs/core/Interaction.js @@ -0,0 +1,539 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import * as utils from "../utils/index.js"; +import InteractEvent from "./InteractEvent.js"; +import PointerInfo from "./PointerInfo.js"; +export let _ProxyValues; + +(function (_ProxyValues) { + _ProxyValues["interactable"] = ""; + _ProxyValues["element"] = ""; + _ProxyValues["prepared"] = ""; + _ProxyValues["pointerIsDown"] = ""; + _ProxyValues["pointerWasMoved"] = ""; + _ProxyValues["_proxy"] = ""; +})(_ProxyValues || (_ProxyValues = {})); + +export let _ProxyMethods; + +(function (_ProxyMethods) { + _ProxyMethods["start"] = ""; + _ProxyMethods["move"] = ""; + _ProxyMethods["end"] = ""; + _ProxyMethods["stop"] = ""; + _ProxyMethods["interacting"] = ""; +})(_ProxyMethods || (_ProxyMethods = {})); + +let idCounter = 0; +export class Interaction { + // current interactable being interacted with + // the target element of the interactable + // action that's ready to be fired on next move event + // keep track of added pointers + // pointerdown/mousedown/touchstart event + // previous action event + get pointerMoveTolerance() { + return 1; + } + /** + * @alias Interaction.prototype.move + */ + + + /** */ + constructor({ + pointerType, + scopeFire + }) { + _defineProperty(this, "interactable", null); + + _defineProperty(this, "element", null); + + _defineProperty(this, "rect", void 0); + + _defineProperty(this, "_rects", void 0); + + _defineProperty(this, "edges", void 0); + + _defineProperty(this, "_scopeFire", void 0); + + _defineProperty(this, "prepared", { + name: null, + axis: null, + edges: null + }); + + _defineProperty(this, "pointerType", void 0); + + _defineProperty(this, "pointers", []); + + _defineProperty(this, "downEvent", null); + + _defineProperty(this, "downPointer", {}); + + _defineProperty(this, "_latestPointer", { + pointer: null, + event: null, + eventTarget: null + }); + + _defineProperty(this, "prevEvent", null); + + _defineProperty(this, "pointerIsDown", false); + + _defineProperty(this, "pointerWasMoved", false); + + _defineProperty(this, "_interacting", false); + + _defineProperty(this, "_ending", false); + + _defineProperty(this, "_stopped", true); + + _defineProperty(this, "_proxy", null); + + _defineProperty(this, "simulation", null); + + _defineProperty(this, "doMove", utils.warnOnce(function (signalArg) { + this.move(signalArg); + }, 'The interaction.doMove() method has been renamed to interaction.move()')); + + _defineProperty(this, "coords", { + // Starting InteractEvent pointer coordinates + start: utils.pointer.newCoords(), + // Previous native pointer move event coordinates + prev: utils.pointer.newCoords(), + // current native pointer move event coordinates + cur: utils.pointer.newCoords(), + // Change in coordinates and time of the pointer + delta: utils.pointer.newCoords(), + // pointer velocity + velocity: utils.pointer.newCoords() + }); + + _defineProperty(this, "_id", idCounter++); + + this._scopeFire = scopeFire; + this.pointerType = pointerType; + const that = this; + this._proxy = {}; + + for (const key in _ProxyValues) { + Object.defineProperty(this._proxy, key, { + get() { + return that[key]; + } + + }); + } + + for (const key in _ProxyMethods) { + Object.defineProperty(this._proxy, key, { + value: (...args) => that[key](...args) + }); + } + + this._scopeFire('interactions:new', { + interaction: this + }); + } + + pointerDown(pointer, event, eventTarget) { + const pointerIndex = this.updatePointer(pointer, event, eventTarget, true); + const pointerInfo = this.pointers[pointerIndex]; + + this._scopeFire('interactions:down', { + pointer, + event, + eventTarget, + pointerIndex, + pointerInfo, + type: 'down', + interaction: this + }); + } + /** + * ```js + * interact(target) + * .draggable({ + * // disable the default drag start by down->move + * manualStart: true + * }) + * // start dragging after the user holds the pointer down + * .on('hold', function (event) { + * var interaction = event.interaction + * + * if (!interaction.interacting()) { + * interaction.start({ name: 'drag' }, + * event.interactable, + * event.currentTarget) + * } + * }) + * ``` + * + * Start an action with the given Interactable and Element as tartgets. The + * action must be enabled for the target Interactable and an appropriate + * number of pointers must be held down - 1 for drag/resize, 2 for gesture. + * + * Use it with `interactable.able({ manualStart: false })` to always + * [start actions manually](https://github.com/taye/interact.js/issues/114) + * + * @param {object} action The action to be performed - drag, resize, etc. + * @param {Interactable} target The Interactable to target + * @param {Element} element The DOM Element to target + * @return {object} interact + */ + + + start(action, interactable, element) { + if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === 'gesture' ? 2 : 1) || !interactable.options[action.name].enabled) { + return false; + } + + utils.copyAction(this.prepared, action); + this.interactable = interactable; + this.element = element; + this.rect = interactable.getRect(element); + this.edges = this.prepared.edges ? utils.extend({}, this.prepared.edges) : { + left: true, + right: true, + top: true, + bottom: true + }; + this._stopped = false; + this._interacting = this._doPhase({ + interaction: this, + event: this.downEvent, + phase: 'start' + }) && !this._stopped; + return this._interacting; + } + + pointerMove(pointer, event, eventTarget) { + if (!this.simulation && !(this.modification && this.modification.endResult)) { + this.updatePointer(pointer, event, eventTarget, false); + } + + const duplicateMove = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y; + let dx; + let dy; // register movement greater than pointerMoveTolerance + + if (this.pointerIsDown && !this.pointerWasMoved) { + dx = this.coords.cur.client.x - this.coords.start.client.x; + dy = this.coords.cur.client.y - this.coords.start.client.y; + this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance; + } + + const pointerIndex = this.getPointerIndex(pointer); + const signalArg = { + pointer, + pointerIndex, + pointerInfo: this.pointers[pointerIndex], + event, + type: 'move', + eventTarget, + dx, + dy, + duplicate: duplicateMove, + interaction: this + }; + + if (!duplicateMove) { + // set pointer coordinate, time changes and velocity + utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta); + } + + this._scopeFire('interactions:move', signalArg); + + if (!duplicateMove && !this.simulation) { + // if interacting, fire an 'action-move' signal etc + if (this.interacting()) { + signalArg.type = null; + this.move(signalArg); + } + + if (this.pointerWasMoved) { + utils.pointer.copyCoords(this.coords.prev, this.coords.cur); + } + } + } + /** + * ```js + * interact(target) + * .draggable(true) + * .on('dragmove', function (event) { + * if (someCondition) { + * // change the snap settings + * event.interactable.draggable({ snap: { targets: [] }}) + * // fire another move event with re-calculated snap + * event.interaction.move() + * } + * }) + * ``` + * + * Force a move of the current action at the same coordinates. Useful if + * snap/restrict has been changed and you want a movement with the new + * settings. + */ + + + move(signalArg) { + if (!signalArg || !signalArg.event) { + utils.pointer.setZeroCoords(this.coords.delta); + } + + signalArg = utils.extend({ + pointer: this._latestPointer.pointer, + event: this._latestPointer.event, + eventTarget: this._latestPointer.eventTarget, + interaction: this + }, signalArg || {}); + signalArg.phase = 'move'; + + this._doPhase(signalArg); + } // End interact move events and stop auto-scroll unless simulation is running + + + pointerUp(pointer, event, eventTarget, curEventTarget) { + let pointerIndex = this.getPointerIndex(pointer); + + if (pointerIndex === -1) { + pointerIndex = this.updatePointer(pointer, event, eventTarget, false); + } + + const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'; + + this._scopeFire(`interactions:${type}`, { + pointer, + pointerIndex, + pointerInfo: this.pointers[pointerIndex], + event, + eventTarget, + type: type, + curEventTarget, + interaction: this + }); + + if (!this.simulation) { + this.end(event); + } + + this.pointerIsDown = false; + this.removePointer(pointer, event); + } + + documentBlur(event) { + this.end(event); + + this._scopeFire('interactions:blur', { + event, + type: 'blur', + interaction: this + }); + } + /** + * ```js + * interact(target) + * .draggable(true) + * .on('move', function (event) { + * if (event.pageX > 1000) { + * // end the current action + * event.interaction.end() + * // stop all further listeners from being called + * event.stopImmediatePropagation() + * } + * }) + * ``` + * + * @param {PointerEvent} [event] + */ + + + end(event) { + this._ending = true; + event = event || this._latestPointer.event; + let endPhaseResult; + + if (this.interacting()) { + endPhaseResult = this._doPhase({ + event, + interaction: this, + phase: 'end' + }); + } + + this._ending = false; + + if (endPhaseResult === true) { + this.stop(); + } + } + + currentAction() { + return this._interacting ? this.prepared.name : null; + } + + interacting() { + return this._interacting; + } + /** */ + + + stop() { + this._scopeFire('interactions:stop', { + interaction: this + }); + + this.interactable = this.element = null; + this._interacting = false; + this._stopped = true; + this.prepared.name = this.prevEvent = null; + } + + getPointerIndex(pointer) { + const pointerId = utils.pointer.getPointerId(pointer); // mouse and pen interactions may have only one pointer + + return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : utils.arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId); + } + + getPointerInfo(pointer) { + return this.pointers[this.getPointerIndex(pointer)]; + } + + updatePointer(pointer, event, eventTarget, down) { + const id = utils.pointer.getPointerId(pointer); + let pointerIndex = this.getPointerIndex(pointer); + let pointerInfo = this.pointers[pointerIndex]; + down = down === false ? false : down || /(down|start)$/i.test(event.type); + + if (!pointerInfo) { + pointerInfo = new PointerInfo(id, pointer, event, null, null); + pointerIndex = this.pointers.length; + this.pointers.push(pointerInfo); + } else { + pointerInfo.pointer = pointer; + } + + utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now()); + utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur); + + if (down) { + this.pointerIsDown = true; + pointerInfo.downTime = this.coords.cur.timeStamp; + pointerInfo.downTarget = eventTarget; + utils.pointer.pointerExtend(this.downPointer, pointer); + + if (!this.interacting()) { + utils.pointer.copyCoords(this.coords.start, this.coords.cur); + utils.pointer.copyCoords(this.coords.prev, this.coords.cur); + this.downEvent = event; + this.pointerWasMoved = false; + } + } + + this._updateLatestPointer(pointer, event, eventTarget); + + this._scopeFire('interactions:update-pointer', { + pointer, + event, + eventTarget, + down, + pointerInfo, + pointerIndex, + interaction: this + }); + + return pointerIndex; + } + + removePointer(pointer, event) { + const pointerIndex = this.getPointerIndex(pointer); + + if (pointerIndex === -1) { + return; + } + + const pointerInfo = this.pointers[pointerIndex]; + + this._scopeFire('interactions:remove-pointer', { + pointer, + event, + eventTarget: null, + pointerIndex, + pointerInfo, + interaction: this + }); + + this.pointers.splice(pointerIndex, 1); + } + + _updateLatestPointer(pointer, event, eventTarget) { + this._latestPointer.pointer = pointer; + this._latestPointer.event = event; + this._latestPointer.eventTarget = eventTarget; + } + + destroy() { + this._latestPointer.pointer = null; + this._latestPointer.event = null; + this._latestPointer.eventTarget = null; + } + + _createPreparedEvent(event, phase, preEnd, type) { + return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type); + } + + _fireEvent(iEvent) { + this.interactable.fire(iEvent); + + if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) { + this.prevEvent = iEvent; + } + } + + _doPhase(signalArg) { + const { + event, + phase, + preEnd, + type + } = signalArg; + const { + rect + } = this; + + if (rect && phase === 'move') { + // update the rect changes due to pointer move + utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource]); + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + + const beforeResult = this._scopeFire(`interactions:before-action-${phase}`, signalArg); + + if (beforeResult === false) { + return false; + } + + const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type); + + this._scopeFire(`interactions:action-${phase}`, signalArg); + + if (phase === 'start') { + this.prevEvent = iEvent; + } + + this._fireEvent(iEvent); + + this._scopeFire(`interactions:after-action-${phase}`, signalArg); + + return true; + } + + _now() { + return Date.now(); + } + +} +export default Interaction; +export { PointerInfo }; +//# sourceMappingURL=Interaction.js.map \ No newline at end of file diff --git a/@interactjs/core/Interaction.js.map b/@interactjs/core/Interaction.js.map new file mode 100644 index 000000000..28df65b9f --- /dev/null +++ b/@interactjs/core/Interaction.js.map @@ -0,0 +1,141 @@ +{ + "version": 3, + "sources": [ + "Interaction.ts" + ], + "names": [ + "utils", + "InteractEvent", + "PointerInfo", + "_ProxyValues", + "_ProxyMethods", + "idCounter", + "Interaction", + "pointerMoveTolerance", + "constructor", + "pointerType", + "scopeFire", + "name", + "axis", + "edges", + "pointer", + "event", + "eventTarget", + "warnOnce", + "signalArg", + "move", + "start", + "newCoords", + "prev", + "cur", + "delta", + "velocity", + "_scopeFire", + "that", + "_proxy", + "key", + "Object", + "defineProperty", + "get", + "value", + "args", + "interaction", + "pointerDown", + "pointerIndex", + "updatePointer", + "pointerInfo", + "pointers", + "type", + "action", + "interactable", + "element", + "interacting", + "pointerIsDown", + "length", + "options", + "enabled", + "copyAction", + "prepared", + "rect", + "getRect", + "extend", + "left", + "right", + "top", + "bottom", + "_stopped", + "_interacting", + "_doPhase", + "downEvent", + "phase", + "pointerMove", + "simulation", + "modification", + "endResult", + "duplicateMove", + "coords", + "page", + "x", + "y", + "client", + "dx", + "dy", + "pointerWasMoved", + "hypot", + "getPointerIndex", + "duplicate", + "setCoordVelocity", + "copyCoords", + "setZeroCoords", + "_latestPointer", + "pointerUp", + "curEventTarget", + "test", + "end", + "removePointer", + "documentBlur", + "_ending", + "endPhaseResult", + "stop", + "currentAction", + "prevEvent", + "pointerId", + "getPointerId", + "arr", + "findIndex", + "curPointer", + "id", + "getPointerInfo", + "down", + "push", + "setCoords", + "map", + "p", + "_now", + "setCoordDeltas", + "downTime", + "timeStamp", + "downTarget", + "pointerExtend", + "downPointer", + "_updateLatestPointer", + "splice", + "destroy", + "_createPreparedEvent", + "preEnd", + "_fireEvent", + "iEvent", + "fire", + "addEdges", + "deltaSource", + "width", + "height", + "beforeResult", + "Date", + "now" + ], + "mappings": ";;AAAA,OAAO,KAAKA,KAAZ;AAEA,OAAOC,aAAP;AACA,OAAOC,WAAP;AAaA,WAAYC,YAAZ;;WAAYA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;AAAAA,EAAAA,Y;GAAAA,Y,KAAAA,Y;;AASZ,WAAYC,aAAZ;;WAAYA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;AAAAA,EAAAA,a;GAAAA,a,KAAAA,a;;AAuEZ,IAAIC,SAAS,GAAG,CAAhB;AAEA,OAAO,MAAMC,WAAN,CAAqD;AAC1D;AAGA;AAaA;AASA;AAGA;AAeA;AAYA,MAAIC,oBAAJ,GAA4B;AAC1B,WAAO,CAAP;AACD;AAED;;;;;AAwBA;AACAC,EAAAA,WAAW,CAAE;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,GAAF,EAGR;AAAA,0CAtF0B,IAsF1B;;AAAA,qCAnFyB,IAmFzB;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,sCAtEwB;AACzBC,MAAAA,IAAI,EAAG,IADkB;AAEzBC,MAAAA,IAAI,EAAG,IAFkB;AAGzBC,MAAAA,KAAK,EAAE;AAHkB,KAsExB;;AAAA;;AAAA,sCA7DuB,EA6DvB;;AAAA,uCA1DoC,IA0DpC;;AAAA,yCAxDiC,EAwDjC;;AAAA,4CAlDC;AACFC,MAAAA,OAAO,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5D,eAAe1H,WAAf;AACA,SAASJ,WAAT", + "sourcesContent": [ + "import * as utils from '@interactjs/utils/index'\nimport Interactable from './Interactable'\nimport InteractEvent, { EventPhase } from './InteractEvent'\nimport PointerInfo from './PointerInfo'\nimport { ActionName } from './scope'\n\nexport interface ActionProps {\n name: T\n axis?: 'x' | 'y' | 'xy'\n edges?: Interact.EdgeOptions\n}\n\nexport interface StartAction extends ActionProps {\n name: ActionName\n}\n\nexport enum _ProxyValues {\n interactable = '',\n element = '',\n prepared = '',\n pointerIsDown = '',\n pointerWasMoved = '',\n _proxy = ''\n}\n\nexport enum _ProxyMethods {\n start = '',\n move = '',\n end = '',\n stop = '',\n interacting = ''\n}\n\nexport type PointerArgProps = {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Interact.EventTarget\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: Interact.PointerEventType\n phase: EventPhase\n interaction: Interaction\n iEvent: InteractEvent\n preEnd?: boolean\n type?: string\n}\n\nexport type DoAnyPhaseArg = DoPhaseArg\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:new': { interaction: Interaction }\n 'interactions:down': PointerArgProps<{\n type: 'down'\n }>\n 'interactions:move': PointerArgProps<{\n type: 'move'\n dx: number\n dy: number\n duplicate: boolean\n }>\n 'interactions:up': PointerArgProps<{\n type: 'up'\n curEventTarget: EventTarget\n }>\n 'interactions:cancel': SignalArgs['interactions:up'] & {\n type: 'cancel'\n curEventTarget: EventTarget\n }\n 'interactions:update-pointer': PointerArgProps<{\n down: boolean\n }>\n 'interactions:remove-pointer': PointerArgProps\n 'interactions:blur'\n 'interactions:before-action-start': Omit\n 'interactions:action-start': DoAnyPhaseArg\n 'interactions:after-action-start': DoAnyPhaseArg\n 'interactions:before-action-move': Omit\n 'interactions:action-move': DoAnyPhaseArg\n 'interactions:after-action-move': DoAnyPhaseArg\n 'interactions:before-action-end': Omit\n 'interactions:action-end': DoAnyPhaseArg\n 'interactions:after-action-end': DoAnyPhaseArg\n 'interactions:stop': { interaction: Interaction }\n }\n}\n\nexport type _InteractionProxy = Pick<\nInteraction,\nkeyof typeof _ProxyValues | keyof typeof _ProxyMethods\n>\n\nlet idCounter = 0\n\nexport class Interaction {\n // current interactable being interacted with\n interactable: Interactable = null\n\n // the target element of the interactable\n element: Interact.Element = null\n rect: Interact.FullRect\n _rects?: {\n start: Interact.FullRect\n corrected: Interact.FullRect\n previous: Interact.FullRect\n delta: Interact.FullRect\n }\n edges: Interact.EdgeOptions\n\n _scopeFire: Interact.Scope['fire']\n\n // action that's ready to be fired on next move event\n prepared: ActionProps = {\n name : null,\n axis : null,\n edges: null,\n }\n\n pointerType: string\n\n // keep track of added pointers\n pointers: PointerInfo[] = []\n\n // pointerdown/mousedown/touchstart event\n downEvent: Interact.PointerEventType = null\n\n downPointer: Interact.PointerType = {} as Interact.PointerType\n\n _latestPointer: {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Node\n } = {\n pointer: null,\n event: null,\n eventTarget: null,\n }\n\n // previous action event\n prevEvent: InteractEvent = null\n\n pointerIsDown = false\n pointerWasMoved = false\n _interacting = false\n _ending = false\n _stopped = true\n _proxy: _InteractionProxy = null\n\n simulation = null\n\n get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = utils.warnOnce(\n function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n },\n 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: Interact.CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: utils.pointer.newCoords(),\n // Previous native pointer move event coordinates\n prev: utils.pointer.newCoords(),\n // current native pointer move event coordinates\n cur: utils.pointer.newCoords(),\n // Change in coordinates and time of the pointer\n delta: utils.pointer.newCoords(),\n // pointer velocity\n velocity: utils.pointer.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: {\n pointerType?: string\n scopeFire: Interact.Scope['fire']\n }) {\n this._scopeFire = scopeFire\n this.pointerType = pointerType\n\n const that = this\n\n this._proxy = {} as _InteractionProxy\n\n for (const key in _ProxyValues) {\n Object.defineProperty(this._proxy, key, {\n get () { return that[key] },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n const pointerIndex = this.updatePointer(pointer, event, eventTarget, true)\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:down', {\n pointer,\n event,\n eventTarget,\n pointerIndex,\n pointerInfo,\n type: 'down',\n interaction: this,\n })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable({\n * // disable the default drag start by down->move\n * manualStart: true\n * })\n * // start dragging after the user holds the pointer down\n * .on('hold', function (event) {\n * var interaction = event.interaction\n *\n * if (!interaction.interacting()) {\n * interaction.start({ name: 'drag' },\n * event.interactable,\n * event.currentTarget)\n * }\n * })\n * ```\n *\n * Start an action with the given Interactable and Element as tartgets. The\n * action must be enabled for the target Interactable and an appropriate\n * number of pointers must be held down - 1 for drag/resize, 2 for gesture.\n *\n * Use it with `interactable.able({ manualStart: false })` to always\n * [start actions manually](https://github.com/taye/interact.js/issues/114)\n *\n * @param {object} action The action to be performed - drag, resize, etc.\n * @param {Interactable} target The Interactable to target\n * @param {Element} element The DOM Element to target\n * @return {object} interact\n */\n start (action: StartAction, interactable: Interactable, element: Interact.Element) {\n if (this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name].enabled) {\n return false\n }\n\n utils.copyAction(this.prepared, action)\n\n this.interactable = interactable\n this.element = element\n this.rect = interactable.getRect(element)\n this.edges = this.prepared.edges\n ? utils.extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting = this._doPhase({\n interaction: this,\n event: this.downEvent,\n phase: 'start',\n }) && !this._stopped\n\n return this._interacting\n }\n\n pointerMove (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove = (this.coords.cur.page.x === this.coords.prev.page.x &&\n this.coords.cur.page.y === this.coords.prev.page.y &&\n this.coords.cur.client.x === this.coords.prev.client.x &&\n this.coords.cur.client.y === this.coords.prev.client.y)\n\n let dx\n let dy\n\n // register movement greater than pointerMoveTolerance\n if (this.pointerIsDown && !this.pointerWasMoved) {\n dx = this.coords.cur.client.x - this.coords.start.client.x\n dy = this.coords.cur.client.y - this.coords.start.client.y\n\n this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance\n }\n\n const pointerIndex = this.getPointerIndex(pointer)\n const signalArg = {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n type: 'move' as const,\n eventTarget,\n dx,\n dy,\n duplicate: duplicateMove,\n interaction: this,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta)\n }\n\n this._scopeFire('interactions:move', signalArg)\n\n if (!duplicateMove && !this.simulation) {\n // if interacting, fire an 'action-move' signal etc\n if (this.interacting()) {\n signalArg.type = null\n this.move(signalArg)\n }\n\n if (this.pointerWasMoved) {\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n }\n }\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('dragmove', function (event) {\n * if (someCondition) {\n * // change the snap settings\n * event.interactable.draggable({ snap: { targets: [] }})\n * // fire another move event with re-calculated snap\n * event.interaction.move()\n * }\n * })\n * ```\n *\n * Force a move of the current action at the same coordinates. Useful if\n * snap/restrict has been changed and you want a movement with the new\n * settings.\n */\n move (signalArg?) {\n if (!signalArg || !signalArg.event) {\n utils.pointer.setZeroCoords(this.coords.delta)\n }\n\n signalArg = utils.extend({\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n }, signalArg || {})\n\n signalArg.phase = 'move'\n\n this._doPhase(signalArg)\n }\n\n // End interact move events and stop auto-scroll unless simulation is running\n pointerUp (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, curEventTarget: Interact.EventTarget) {\n let pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) {\n pointerIndex = this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'\n\n this._scopeFire(`interactions:${type}` as 'interactions:up' | 'interactions:cancel', {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n eventTarget,\n type: type as any,\n curEventTarget,\n interaction: this,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.pointerIsDown = false\n this.removePointer(pointer, event)\n }\n\n documentBlur (event) {\n this.end(event)\n this._scopeFire('interactions:blur', { event, type: 'blur', interaction: this })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('move', function (event) {\n * if (event.pageX > 1000) {\n * // end the current action\n * event.interaction.end()\n * // stop all further listeners from being called\n * event.stopImmediatePropagation()\n * }\n * })\n * ```\n *\n * @param {PointerEvent} [event]\n */\n end (event?: Interact.PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult\n\n if (this.interacting()) {\n endPhaseResult = this._doPhase({\n event,\n interaction: this,\n phase: 'end',\n })\n }\n\n this._ending = false\n\n if (endPhaseResult === true) {\n this.stop()\n }\n }\n\n currentAction () {\n return this._interacting ? this.prepared.name : null\n }\n\n interacting () {\n return this._interacting\n }\n\n /** */\n stop () {\n this._scopeFire('interactions:stop', { interaction: this })\n\n this.interactable = this.element = null\n\n this._interacting = false\n this._stopped = true\n this.prepared.name = this.prevEvent = null\n }\n\n getPointerIndex (pointer) {\n const pointerId = utils.pointer.getPointerId(pointer)\n\n // mouse and pen interactions may have only one pointer\n return (this.pointerType === 'mouse' || this.pointerType === 'pen')\n ? this.pointers.length - 1\n : utils.arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean) {\n const id = utils.pointer.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false\n ? false\n : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(\n id,\n pointer,\n event,\n null,\n null,\n )\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n }\n else {\n pointerInfo.pointer = pointer\n }\n\n utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now())\n utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)\n\n if (down) {\n this.pointerIsDown = true\n\n pointerInfo.downTime = this.coords.cur.timeStamp\n pointerInfo.downTarget = eventTarget\n utils.pointer.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n utils.pointer.copyCoords(this.coords.start, this.coords.cur)\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n\n this.downEvent = event\n this.pointerWasMoved = false\n }\n }\n\n this._updateLatestPointer(pointer, event, eventTarget)\n\n this._scopeFire('interactions:update-pointer', {\n pointer,\n event,\n eventTarget,\n down,\n pointerInfo,\n pointerIndex,\n interaction: this,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: Interact.PointerType, event: Interact.PointerEventType) {\n const pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) { return }\n\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:remove-pointer', {\n pointer,\n event,\n eventTarget: null,\n pointerIndex,\n pointerInfo,\n interaction: this,\n })\n\n this.pointers.splice(pointerIndex, 1)\n }\n\n _updateLatestPointer (pointer, event, eventTarget) {\n this._latestPointer.pointer = pointer\n this._latestPointer.event = event\n this._latestPointer.eventTarget = eventTarget\n }\n\n destroy () {\n this._latestPointer.pointer = null\n this._latestPointer.event = null\n this._latestPointer.eventTarget = null\n }\n\n _createPreparedEvent

(event: Interact.PointerEventType, phase: P, preEnd?: boolean, type?: string) {\n return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type)\n }\n\n _fireEvent

(iEvent: InteractEvent) {\n this.interactable.fire(iEvent)\n\n if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {\n this.prevEvent = iEvent\n }\n }\n\n _doPhase

(signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent }) {\n const { event, phase, preEnd, type } = signalArg\n const { rect } = this\n\n if (rect && phase === 'move') {\n // update the rect changes due to pointer move\n utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource])\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n const beforeResult = this._scopeFire(`interactions:before-action-${phase}` as any, signalArg)\n\n if (beforeResult === false) {\n return false\n }\n\n const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type)\n\n this._scopeFire(`interactions:action-${phase}` as any, signalArg)\n\n if (phase === 'start') { this.prevEvent = iEvent }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () { return Date.now() }\n}\n\nexport default Interaction\nexport { PointerInfo }\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/Interaction.spec.d.ts b/@interactjs/core/Interaction.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/Interaction.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/LICENSE b/@interactjs/core/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/core/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/core/PointerInfo.d.ts b/@interactjs/core/PointerInfo.d.ts new file mode 100644 index 000000000..41971b49a --- /dev/null +++ b/@interactjs/core/PointerInfo.d.ts @@ -0,0 +1,9 @@ +export declare class PointerInfo { + id: number; + pointer: Interact.PointerType; + event: Interact.PointerEventType; + downTime: number; + downTarget: Interact.EventTarget; + constructor(id: number, pointer: Interact.PointerType, event: Interact.PointerEventType, downTime: number, downTarget: Interact.EventTarget); +} +export default PointerInfo; diff --git a/@interactjs/core/PointerInfo.js b/@interactjs/core/PointerInfo.js new file mode 100644 index 000000000..93f8a8528 --- /dev/null +++ b/@interactjs/core/PointerInfo.js @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-parameter-properties */ +export class PointerInfo { + constructor(id, pointer, event, downTime, downTarget) { + this.id = id; + this.pointer = pointer; + this.event = event; + this.downTime = downTime; + this.downTarget = downTarget; + } + +} +export default PointerInfo; +//# sourceMappingURL=PointerInfo.js.map \ No newline at end of file diff --git a/@interactjs/core/PointerInfo.js.map b/@interactjs/core/PointerInfo.js.map new file mode 100644 index 000000000..88157f826 --- /dev/null +++ b/@interactjs/core/PointerInfo.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "sources": [ + "PointerInfo.ts" + ], + "names": [ + "PointerInfo", + "constructor", + "id", + "pointer", + "event", + "downTime", + "downTarget" + ], + "mappings": "AAAA;AACA,OAAO,MAAMA,WAAN,CAAkB;AACvBC,EAAAA,WAAW,CACFC,EADE,EAEFC,OAFE,EAGFC,KAHE,EAIFC,QAJE,EAKFC,UALE,EAMT;AAAA,SALOJ,EAKP,GALOA,EAKP;AAAA,SAJOC,OAIP,GAJOA,OAIP;AAAA,SAHOC,KAGP,GAHOA,KAGP;AAAA,SAFOC,QAEP,GAFOA,QAEP;AAAA,SADOC,UACP,GADOA,UACP;AAAE;;AAPmB;AAUzB,eAAeN,WAAf", + "sourcesContent": [ + "/* eslint-disable @typescript-eslint/no-parameter-properties */\nexport class PointerInfo {\n constructor (\n public id: number,\n public pointer: Interact.PointerType,\n public event: Interact.PointerEventType,\n public downTime: number,\n public downTarget: Interact.EventTarget,\n ) {}\n}\n\nexport default PointerInfo\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/defaultOptions.d.ts b/@interactjs/core/defaultOptions.d.ts new file mode 100644 index 000000000..5b72d9909 --- /dev/null +++ b/@interactjs/core/defaultOptions.d.ts @@ -0,0 +1,26 @@ +export interface Defaults { + base: BaseDefaults; + perAction: PerActionDefaults; + actions: ActionDefaults; +} +export interface ActionDefaults { +} +export interface BaseDefaults { + preventDefault?: 'auto' | 'never' | string; + deltaSource?: 'page' | 'client'; + context?: Interact.EventTarget; +} +export interface PerActionDefaults { + enabled?: boolean; + origin?: Interact.Point | string | Interact.Element; + listeners?: Interact.Listeners; + allowFrom?: string | Interact.Element; + ignoreFrom?: string | Interact.Element; +} +export declare type Options = Partial & Partial & { + [P in keyof ActionDefaults]?: Partial; +}; +export interface OptionsArg extends BaseDefaults, Interact.OrBoolean> { +} +export declare const defaults: Defaults; +export default defaults; diff --git a/@interactjs/core/defaultOptions.js b/@interactjs/core/defaultOptions.js new file mode 100644 index 000000000..9f08a0553 --- /dev/null +++ b/@interactjs/core/defaultOptions.js @@ -0,0 +1,19 @@ +// tslint:disable no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-interface +// export interface Options extends BaseDefaults, PerActionDefaults {} +export const defaults = { + base: { + preventDefault: 'auto', + deltaSource: 'page' + }, + perAction: { + enabled: false, + origin: { + x: 0, + y: 0 + } + }, + actions: {} +}; +export default defaults; +//# sourceMappingURL=defaultOptions.js.map \ No newline at end of file diff --git a/@interactjs/core/defaultOptions.js.map b/@interactjs/core/defaultOptions.js.map new file mode 100644 index 000000000..f305e20f6 --- /dev/null +++ b/@interactjs/core/defaultOptions.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "sources": [ + "defaultOptions.ts" + ], + "names": [ + "defaults", + "base", + "preventDefault", + "deltaSource", + "perAction", + "enabled", + "origin", + "x", + "y", + "actions" + ], + "mappings": "AAAA;AAQA;AAsBA;AAIA,OAAO,MAAMA,QAAkB,GAAG;AAChCC,EAAAA,IAAI,EAAE;AACJC,IAAAA,cAAc,EAAE,MADZ;AAEJC,IAAAA,WAAW,EAAE;AAFT,GAD0B;AAMhCC,EAAAA,SAAS,EAAE;AACTC,IAAAA,OAAO,EAAE,KADA;AAETC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,CAAC,EAAE,CAAL;AAAQC,MAAAA,CAAC,EAAE;AAAX;AAFC,GANqB;AAWhCC,EAAAA,OAAO,EAAE;AAXuB,CAA3B;AAcP,eAAeT,QAAf", + "sourcesContent": [ + "// tslint:disable no-empty-interface\n\nexport interface Defaults {\n base: BaseDefaults\n perAction: PerActionDefaults\n actions: ActionDefaults\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionDefaults {\n}\n\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Interact.EventTarget\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Interact.Point | string | Interact.Element\n listeners?: Interact.Listeners\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n}\n\nexport type Options = Partial & Partial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\n// export interface Options extends BaseDefaults, PerActionDefaults {}\n\nexport interface OptionsArg extends BaseDefaults, Interact.OrBoolean> {}\n\nexport const defaults: Defaults = {\n base: {\n preventDefault: 'auto',\n deltaSource: 'page',\n },\n\n perAction: {\n enabled: false,\n origin: { x: 0, y: 0 },\n },\n\n actions: {} as ActionDefaults,\n}\n\nexport default defaults\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/interactablePreventDefault.d.ts b/@interactjs/core/interactablePreventDefault.d.ts new file mode 100644 index 000000000..ad6eb2726 --- /dev/null +++ b/@interactjs/core/interactablePreventDefault.d.ts @@ -0,0 +1,14 @@ +declare module '@interactjs/core/Interactable' { + interface Interactable { + preventDefault: typeof preventDefault; + checkAndPreventDefault: (event: Event) => void; + } +} +declare function preventDefault(this: Interact.Interactable, newValue?: 'always' | 'never' | 'auto'): string | import("@interactjs/core/Interactable").Interactable; +export declare function install(scope: Interact.Scope): void; +declare const _default: { + id: string; + install: typeof install; + listeners: any; +}; +export default _default; diff --git a/@interactjs/core/interactablePreventDefault.js b/@interactjs/core/interactablePreventDefault.js new file mode 100644 index 000000000..e69472ff8 --- /dev/null +++ b/@interactjs/core/interactablePreventDefault.js @@ -0,0 +1,112 @@ +import { matchesSelector, nodeContains } from "../utils/domUtils.js"; +import events from "../utils/events.js"; +import * as is from "../utils/is.js"; +import { getWindow } from "../utils/window.js"; + +function preventDefault(newValue) { + if (/^(always|never|auto)$/.test(newValue)) { + this.options.preventDefault = newValue; + return this; + } + + if (is.bool(newValue)) { + this.options.preventDefault = newValue ? 'always' : 'never'; + return this; + } + + return this.options.preventDefault; +} + +function checkAndPreventDefault(interactable, scope, event) { + const setting = interactable.options.preventDefault; + + if (setting === 'never') { + return; + } + + if (setting === 'always') { + event.preventDefault(); + return; + } // setting === 'auto' + // if the browser supports passive event listeners and isn't running on iOS, + // don't preventDefault of touch{start,move} events. CSS touch-action and + // user-select should be used instead of calling event.preventDefault(). + + + if (events.supportsPassive && /^touch(start|move)$/.test(event.type)) { + const doc = getWindow(event.target).document; + const docOptions = scope.getDocOptions(doc); + + if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) { + return; + } + } // don't preventDefault of pointerdown events + + + if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) { + return; + } // don't preventDefault on editable elements + + + if (is.element(event.target) && matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) { + return; + } + + event.preventDefault(); +} + +function onInteractionEvent({ + interaction, + event +}) { + if (interaction.interactable) { + interaction.interactable.checkAndPreventDefault(event); + } +} + +export function install(scope) { + /** @lends Interactable */ + const { + Interactable + } = scope; + /** + * Returns or sets whether to prevent the browser's default behaviour in + * response to pointer events. Can be set to: + * - `'always'` to always prevent + * - `'never'` to never prevent + * - `'auto'` to let interact.js try to determine what would be best + * + * @param {string} [newValue] `'always'`, `'never'` or `'auto'` + * @return {string | Interactable} The current setting or this Interactable + */ + + Interactable.prototype.preventDefault = preventDefault; + + Interactable.prototype.checkAndPreventDefault = function (event) { + return checkAndPreventDefault(this, scope, event); + }; // prevent native HTML5 drag on interact.js target elements + + + scope.interactions.docEvents.push({ + type: 'dragstart', + + listener(event) { + for (const interaction of scope.interactions.list) { + if (interaction.element && (interaction.element === event.target || nodeContains(interaction.element, event.target))) { + interaction.interactable.checkAndPreventDefault(event); + return; + } + } + } + + }); +} +export default { + id: 'core/interactablePreventDefault', + install, + listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => { + acc[`interactions:${eventType}`] = onInteractionEvent; + return acc; + }, {}) +}; +//# sourceMappingURL=interactablePreventDefault.js.map \ No newline at end of file diff --git a/@interactjs/core/interactablePreventDefault.js.map b/@interactjs/core/interactablePreventDefault.js.map new file mode 100644 index 000000000..b788f0d40 --- /dev/null +++ b/@interactjs/core/interactablePreventDefault.js.map @@ -0,0 +1,51 @@ +{ + "version": 3, + "sources": [ + "interactablePreventDefault.ts" + ], + "names": [ + "matchesSelector", + "nodeContains", + "events", + "is", + "getWindow", + "preventDefault", + "newValue", + "test", + "options", + "bool", + "checkAndPreventDefault", + "interactable", + "scope", + "event", + "setting", + "supportsPassive", + "type", + "doc", + "target", + "document", + "docOptions", + "getDocOptions", + "passive", + "element", + "onInteractionEvent", + "interaction", + "install", + "Interactable", + "prototype", + "interactions", + "docEvents", + "push", + "listener", + "list", + "id", + "listeners", + "reduce", + "acc", + "eventType" + ], + "mappings": "AAAA,SAASA,eAAT,EAA0BC,YAA1B;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;AACA,SAASC,SAAT;;AASA,SAASC,cAAT,CAAsDC,QAAtD,EAA8F;AAC5F,MAAI,wBAAwBC,IAAxB,CAA6BD,QAA7B,CAAJ,EAA4C;AAC1C,SAAKE,OAAL,CAAaH,cAAb,GAA8BC,QAA9B;AACA,WAAO,IAAP;AACD;;AAED,MAAIH,EAAE,CAACM,IAAH,CAAQH,QAAR,CAAJ,EAAuB;AACrB,SAAKE,OAAL,CAAaH,cAAb,GAA8BC,QAAQ,GAAG,QAAH,GAAc,OAApD;AACA,WAAO,IAAP;AACD;;AAED,SAAO,KAAKE,OAAL,CAAaH,cAApB;AACD;;AAED,SAASK,sBAAT,CAAiCC,YAAjC,EAAsEC,KAAtE,EAA6FC,KAA7F,EAA2G;AACzG,QAAMC,OAAO,GAAGH,YAAY,CAACH,OAAb,CAAqBH,cAArC;;AAEA,MAAIS,OAAO,KAAK,OAAhB,EAAyB;AAAE;AAAQ;;AAEnC,MAAIA,OAAO,KAA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/D,WAAOH,sBAAsB,CAAC,IAAD,EAAOE,KAAP,EAAcC,KAAd,CAA7B;AACD,GAFD,CAhB8C,CAoB9C;;;AACAD,EAAAA,KAAK,CAACiB,YAAN,CAAmBC,SAAnB,CAA6BC,IAA7B,CAAkC;AAChCf,IAAAA,IAAI,EAAE,WAD0B;;AAEhCgB,IAAAA,QAAQ,CAAEnB,KAAF,EAAS;AACf,WAAK,MAAMY,WAAX,IAA0Bb,KAAK,CAACiB,YAAN,CAAmBI,IAA7C,EAAmD;AACjD,YAAIR,WAAW,CAACF,OAAZ,KACDE,WAAW,CAACF,OAAZ,KAAwBV,KAAK,CAACK,MAA9B,IACAjB,YAAY,CAACwB,WAAW,CAACF,OAAb,EAAsBV,KAAK,CAACK,MAA5B,CAFX,CAAJ,EAEqD;AACnDO,UAAAA,WAAW,CAACd,YAAZ,CAAyBD,sBAAzB,CAAgDG,KAAhD;AACA;AACD;AACF;AACF;;AAX+B,GAAlC;AAaD;AAED,eAAe;AACbqB,EAAAA,EAAE,EAAE,iCADS;AAEbR,EAAAA,OAFa;AAGbS,EAAAA,SAAS,EAAE,CAAC,MAAD,EAAS,MAAT,EAAiB,IAAjB,EAAuB,QAAvB,EAAiCC,MAAjC,CAAwC,CAACC,GAAD,EAAMC,SAAN,KAAoB;AACrED,IAAAA,GAAG,CAAE,gBAAeC,SAAU,EAA3B,CAAH,GAAmCd,kBAAnC;AACA,WAAOa,GAAP;AACD,GAHU,EAGR,EAHQ;AAHE,CAAf", + "sourcesContent": [ + "import { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as is from '@interactjs/utils/is'\nimport { getWindow } from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n preventDefault: typeof preventDefault\n checkAndPreventDefault: (event: Event) => void\n }\n}\n\nfunction preventDefault (this: Interact.Interactable, newValue?: 'always' | 'never' | 'auto') {\n if (/^(always|never|auto)$/.test(newValue)) {\n this.options.preventDefault = newValue\n return this\n }\n\n if (is.bool(newValue)) {\n this.options.preventDefault = newValue ? 'always' : 'never'\n return this\n }\n\n return this.options.preventDefault\n}\n\nfunction checkAndPreventDefault (interactable: Interact.Interactable, scope: Interact.Scope, event: Event) {\n const setting = interactable.options.preventDefault\n\n if (setting === 'never') { return }\n\n if (setting === 'always') {\n event.preventDefault()\n return\n }\n\n // setting === 'auto'\n\n // if the browser supports passive event listeners and isn't running on iOS,\n // don't preventDefault of touch{start,move} events. CSS touch-action and\n // user-select should be used instead of calling event.preventDefault().\n if (events.supportsPassive && /^touch(start|move)$/.test(event.type)) {\n const doc = getWindow(event.target).document\n const docOptions = scope.getDocOptions(doc)\n\n if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {\n return\n }\n }\n\n // don't preventDefault of pointerdown events\n if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {\n return\n }\n\n // don't preventDefault on editable elements\n if (is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interact.Interaction, event: Interact.PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: Interact.Scope) {\n /** @lends Interactable */\n const { Interactable } = scope\n\n /**\n * Returns or sets whether to prevent the browser's default behaviour in\n * response to pointer events. Can be set to:\n * - `'always'` to always prevent\n * - `'never'` to never prevent\n * - `'auto'` to let interact.js try to determine what would be best\n *\n * @param {string} [newValue] `'always'`, `'never'` or `'auto'`\n * @return {string | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.preventDefault = preventDefault\n\n Interactable.prototype.checkAndPreventDefault = function (event) {\n return checkAndPreventDefault(this, scope, event)\n }\n\n // prevent native HTML5 drag on interact.js target elements\n scope.interactions.docEvents.push({\n type: 'dragstart',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n if (interaction.element &&\n (interaction.element === event.target ||\n nodeContains(interaction.element, event.target))) {\n interaction.interactable.checkAndPreventDefault(event)\n return\n }\n }\n },\n })\n}\n\nexport default {\n id: 'core/interactablePreventDefault',\n install,\n listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => {\n acc[`interactions:${eventType}`] = onInteractionEvent\n return acc\n }, {} as any),\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/interactablePreventDefault.spec.d.ts b/@interactjs/core/interactablePreventDefault.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/interactablePreventDefault.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/interactionFinder.d.ts b/@interactjs/core/interactionFinder.d.ts new file mode 100644 index 000000000..2a6a8a821 --- /dev/null +++ b/@interactjs/core/interactionFinder.d.ts @@ -0,0 +1,18 @@ +export interface SearchDetails { + pointer: Interact.PointerType; + pointerId: number; + pointerType: string; + eventType: string; + eventTarget: Interact.EventTarget; + curEventTarget: Interact.EventTarget; + scope: Interact.Scope; +} +declare const finder: { + methodOrder: readonly ["simulationResume", "mouseOrPen", "hasPointer", "idle"]; + search(details: SearchDetails): any; + simulationResume({ pointerType, eventType, eventTarget, scope }: SearchDetails): import("@interactjs/core/Interaction").Interaction<"resize" | "drag" | "drop" | "gesture">; + mouseOrPen({ pointerId, pointerType, eventType, scope }: SearchDetails): any; + hasPointer({ pointerId, scope }: SearchDetails): import("@interactjs/core/Interaction").Interaction<"resize" | "drag" | "drop" | "gesture">; + idle({ pointerType, scope }: SearchDetails): import("@interactjs/core/Interaction").Interaction<"resize" | "drag" | "drop" | "gesture">; +}; +export default finder; diff --git a/@interactjs/core/interactionFinder.js b/@interactjs/core/interactionFinder.js new file mode 100644 index 000000000..cf0ad3142 --- /dev/null +++ b/@interactjs/core/interactionFinder.js @@ -0,0 +1,144 @@ +import * as dom from "../utils/domUtils.js"; +const finder = { + methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'], + + search(details) { + for (const method of finder.methodOrder) { + const interaction = finder[method](details); + + if (interaction) { + return interaction; + } + } + + return null; + }, + + // try to resume simulation with a new pointer + simulationResume({ + pointerType, + eventType, + eventTarget, + scope + }) { + if (!/down|start/i.test(eventType)) { + return null; + } + + for (const interaction of scope.interactions.list) { + let element = eventTarget; + + if (interaction.simulation && interaction.simulation.allowResume && interaction.pointerType === pointerType) { + while (element) { + // if the element is the interaction element + if (element === interaction.element) { + return interaction; + } + + element = dom.parentNode(element); + } + } + } + + return null; + }, + + // if it's a mouse or pen interaction + mouseOrPen({ + pointerId, + pointerType, + eventType, + scope + }) { + if (pointerType !== 'mouse' && pointerType !== 'pen') { + return null; + } + + let firstNonActive; + + for (const interaction of scope.interactions.list) { + if (interaction.pointerType === pointerType) { + // if it's a down event, skip interactions with running simulations + if (interaction.simulation && !hasPointerId(interaction, pointerId)) { + continue; + } // if the interaction is active, return it immediately + + + if (interaction.interacting()) { + return interaction; + } // otherwise save it and look for another active interaction + else if (!firstNonActive) { + firstNonActive = interaction; + } + } + } // if no active mouse interaction was found use the first inactive mouse + // interaction + + + if (firstNonActive) { + return firstNonActive; + } // find any mouse or pen interaction. + // ignore the interaction if the eventType is a *down, and a simulation + // is active + + + for (const interaction of scope.interactions.list) { + if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) { + return interaction; + } + } + + return null; + }, + + // get interaction that has this pointer + hasPointer({ + pointerId, + scope + }) { + for (const interaction of scope.interactions.list) { + if (hasPointerId(interaction, pointerId)) { + return interaction; + } + } + + return null; + }, + + // get first idle interaction with a matching pointerType + idle({ + pointerType, + scope + }) { + for (const interaction of scope.interactions.list) { + // if there's already a pointer held down + if (interaction.pointers.length === 1) { + const target = interaction.interactable; // don't add this pointer if there is a target interactable and it + // isn't gesturable + + if (target && !(target.options.gesture && target.options.gesture.enabled)) { + continue; + } + } // maximum of 2 pointers per interaction + else if (interaction.pointers.length >= 2) { + continue; + } + + if (!interaction.interacting() && pointerType === interaction.pointerType) { + return interaction; + } + } + + return null; + } + +}; + +function hasPointerId(interaction, pointerId) { + return interaction.pointers.some(({ + id + }) => id === pointerId); +} + +export default finder; +//# sourceMappingURL=interactionFinder.js.map \ No newline at end of file diff --git a/@interactjs/core/interactionFinder.js.map b/@interactjs/core/interactionFinder.js.map new file mode 100644 index 000000000..6b6356616 --- /dev/null +++ b/@interactjs/core/interactionFinder.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "sources": [ + "interactionFinder.ts" + ], + "names": [ + "dom", + "finder", + "methodOrder", + "search", + "details", + "method", + "interaction", + "simulationResume", + "pointerType", + "eventType", + "eventTarget", + "scope", + "test", + "interactions", + "list", + "element", + "simulation", + "allowResume", + "parentNode", + "mouseOrPen", + "pointerId", + "firstNonActive", + "hasPointerId", + "interacting", + "hasPointer", + "idle", + "pointers", + "length", + "target", + "interactable", + "options", + "gesture", + "enabled", + "some", + "id" + ], + "mappings": "AAAA,OAAO,KAAKA,GAAZ;AAYA,MAAMC,MAAM,GAAG;AACbC,EAAAA,WAAW,EAAE,CAAC,kBAAD,EAAqB,YAArB,EAAmC,YAAnC,EAAiD,MAAjD,CADA;;AAGbC,EAAAA,MAAM,CAAEC,OAAF,EAA0B;AAC9B,SAAK,MAAMC,MAAX,IAAqBJ,MAAM,CAACC,WAA5B,EAAyC;AACvC,YAAMI,WAAW,GAAGL,MAAM,CAACI,MAAD,CAAN,CAAeD,OAAf,CAApB;;AAEA,UAAIE,WAAJ,EAAiB;AACf,eAAOA,WAAP;AACD;AACF;;AAED,WAAO,IAAP;AACD,GAbY;;AAeb;AACAC,EAAAA,gBAAgB,CAAE;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,SAAf;AAA0BC,IAAAA,WAA1B;AAAuCC,IAAAA;AAAvC,GAAF,EAAiE;AAC/E,QAAI,CAAC,cAAcC,IAAd,CAAmBH,SAAnB,CAAL,EAAoC;AAClC,aAAO,IAAP;AACD;;AAED,SAAK,MAAMH,WAAX,IAA0BK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SAASgB,YAAT,CAAuBhB,WAAvB,EAA0Dc,SAA1D,EAA6E;AAC3E,SAAOd,WAAW,CAACoB,QAAZ,CAAqBO,IAArB,CAA0B,CAAC;AAAEC,IAAAA;AAAF,GAAD,KAAYA,EAAE,KAAKd,SAA7C,CAAP;AACD;;AAED,eAAenB,MAAf", + "sourcesContent": [ + "import * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: Interact.PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: Interact.EventTarget\n curEventTarget: Interact.EventTarget\n scope: Interact.Scope\n}\n\nconst finder = {\n methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'] as const,\n\n search (details: SearchDetails) {\n for (const method of finder.methodOrder) {\n const interaction = finder[method](details)\n\n if (interaction) {\n return interaction\n }\n }\n\n return null\n },\n\n // try to resume simulation with a new pointer\n simulationResume ({ pointerType, eventType, eventTarget, scope }: SearchDetails) {\n if (!/down|start/i.test(eventType)) {\n return null\n }\n\n for (const interaction of scope.interactions.list) {\n let element = eventTarget as Node\n\n if (interaction.simulation && interaction.simulation.allowResume &&\n (interaction.pointerType === pointerType)) {\n while (element) {\n // if the element is the interaction element\n if (element === interaction.element) {\n return interaction\n }\n element = dom.parentNode(element)\n }\n }\n }\n\n return null\n },\n\n // if it's a mouse or pen interaction\n mouseOrPen ({ pointerId, pointerType, eventType, scope }: SearchDetails) {\n if (pointerType !== 'mouse' && pointerType !== 'pen') {\n return null\n }\n\n let firstNonActive\n\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType) {\n // if it's a down event, skip interactions with running simulations\n if (interaction.simulation && !hasPointerId(interaction, pointerId)) { continue }\n\n // if the interaction is active, return it immediately\n if (interaction.interacting()) {\n return interaction\n }\n // otherwise save it and look for another active interaction\n else if (!firstNonActive) {\n firstNonActive = interaction\n }\n }\n }\n\n // if no active mouse interaction was found use the first inactive mouse\n // interaction\n if (firstNonActive) {\n return firstNonActive\n }\n\n // find any mouse or pen interaction.\n // ignore the interaction if the eventType is a *down, and a simulation\n // is active\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get interaction that has this pointer\n hasPointer ({ pointerId, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n if (hasPointerId(interaction, pointerId)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get first idle interaction with a matching pointerType\n idle ({ pointerType, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n // if there's already a pointer held down\n if (interaction.pointers.length === 1) {\n const target = interaction.interactable\n // don't add this pointer if there is a target interactable and it\n // isn't gesturable\n if (target && !(target.options.gesture && target.options.gesture.enabled)) {\n continue\n }\n }\n // maximum of 2 pointers per interaction\n else if (interaction.pointers.length >= 2) {\n continue\n }\n\n if (!interaction.interacting() && (pointerType === interaction.pointerType)) {\n return interaction\n }\n }\n\n return null\n },\n}\n\nfunction hasPointerId (interaction: Interact.Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/interactionFinder.spec.d.ts b/@interactjs/core/interactionFinder.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/interactionFinder.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/interactions.d.ts b/@interactjs/core/interactions.d.ts new file mode 100644 index 000000000..48ac5f3ff --- /dev/null +++ b/@interactjs/core/interactions.d.ts @@ -0,0 +1,44 @@ +import InteractionBase from './Interaction'; +import { SearchDetails } from './interactionFinder'; +import { Scope } from './scope'; +declare module '@interactjs/core/scope' { + interface Scope { + Interaction: typeof InteractionBase; + interactions: { + new: (options: any) => InteractionBase; + list: InteractionBase[]; + listeners: { + [type: string]: Interact.Listener; + }; + docEvents: Array<{ + type: string; + listener: Interact.Listener; + }>; + pointerMoveTolerance: number; + }; + prevTouchTime: number; + } +} +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactions:find': { + interaction: InteractionBase; + searchDetails: SearchDetails; + }; + } +} +declare function install(scope: Scope): void; +declare function doOnInteractions(method: any, scope: any): (event: any) => void; +declare function onDocSignal({ doc, scope, options }: Interact.SignalArgs[T], eventMethodName: 'add' | 'remove'): void; +declare const _default: { + id: string; + install: typeof install; + listeners: { + 'scope:add-document': (arg: any) => void; + 'scope:remove-document': (arg: any) => void; + }; + onDocSignal: typeof onDocSignal; + doOnInteractions: typeof doOnInteractions; + methodNames: string[]; +}; +export default _default; diff --git a/@interactjs/core/interactions.js b/@interactjs/core/interactions.js new file mode 100644 index 000000000..e3a988abe --- /dev/null +++ b/@interactjs/core/interactions.js @@ -0,0 +1,250 @@ +import browser from "../utils/browser.js"; +import domObjects from "../utils/domObjects.js"; +import { nodeContains } from "../utils/domUtils.js"; +import events from "../utils/events.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +import InteractionBase from "./Interaction.js"; +import finder from "./interactionFinder.js"; +import { Scope } from "./scope.js"; +const methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; + +function install(scope) { + const listeners = {}; + + for (const method of methodNames) { + listeners[method] = doOnInteractions(method, scope); + } + + const pEventTypes = browser.pEventTypes; + let docEvents; + + if (domObjects.PointerEvent) { + docEvents = [{ + type: pEventTypes.down, + listener: releasePointersOnRemovedEls + }, { + type: pEventTypes.down, + listener: listeners.pointerDown + }, { + type: pEventTypes.move, + listener: listeners.pointerMove + }, { + type: pEventTypes.up, + listener: listeners.pointerUp + }, { + type: pEventTypes.cancel, + listener: listeners.pointerUp + }]; + } else { + docEvents = [{ + type: 'mousedown', + listener: listeners.pointerDown + }, { + type: 'mousemove', + listener: listeners.pointerMove + }, { + type: 'mouseup', + listener: listeners.pointerUp + }, { + type: 'touchstart', + listener: releasePointersOnRemovedEls + }, { + type: 'touchstart', + listener: listeners.pointerDown + }, { + type: 'touchmove', + listener: listeners.pointerMove + }, { + type: 'touchend', + listener: listeners.pointerUp + }, { + type: 'touchcancel', + listener: listeners.pointerUp + }]; + } + + docEvents.push({ + type: 'blur', + + listener(event) { + for (const interaction of scope.interactions.list) { + interaction.documentBlur(event); + } + } + + }); // for ignoring browser's simulated mouse events + + scope.prevTouchTime = 0; + scope.Interaction = class Interaction extends InteractionBase { + get pointerMoveTolerance() { + return scope.interactions.pointerMoveTolerance; + } + + set pointerMoveTolerance(value) { + scope.interactions.pointerMoveTolerance = value; + } + + _now() { + return scope.now(); + } + + }; + scope.interactions = { + // all active and idle interactions + list: [], + + new(options) { + options.scopeFire = (name, arg) => scope.fire(name, arg); + + const interaction = new scope.Interaction(options); + scope.interactions.list.push(interaction); + return interaction; + }, + + listeners, + docEvents, + pointerMoveTolerance: 1 + }; + + function releasePointersOnRemovedEls() { + // for all inactive touch interactions with pointers down + for (const interaction of scope.interactions.list) { + if (!interaction.pointerIsDown || interaction.pointerType !== 'touch' || interaction._interacting) { + continue; + } // if a pointer is down on an element that is no longer in the DOM tree + + + for (const pointer of interaction.pointers) { + if (!scope.documents.some(({ + doc + }) => nodeContains(doc, pointer.downTarget))) { + // remove the pointer from the interaction + interaction.removePointer(pointer.pointer, pointer.event); + } + } + } + } +} + +function doOnInteractions(method, scope) { + return function (event) { + const interactions = scope.interactions.list; + const pointerType = pointerUtils.getPointerType(event); + const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event); + const matches = []; // [ [pointer, interaction], ...] + + if (/^touch/.test(event.type)) { + scope.prevTouchTime = scope.now(); + + for (const changedTouch of event.changedTouches) { + const pointer = changedTouch; + const pointerId = pointerUtils.getPointerId(pointer); + const searchDetails = { + pointer, + pointerId, + pointerType, + eventType: event.type, + eventTarget, + curEventTarget, + scope + }; + const interaction = getInteraction(searchDetails); + matches.push([searchDetails.pointer, searchDetails.eventTarget, searchDetails.curEventTarget, interaction]); + } + } else { + let invalidPointer = false; + + if (!browser.supportsPointerEvent && /mouse/.test(event.type)) { + // ignore mouse events while touch interactions are active + for (let i = 0; i < interactions.length && !invalidPointer; i++) { + invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown; + } // try to ignore mouse events that are simulated by the browser + // after a touch event + + + invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 || // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated + event.timeStamp === 0; + } + + if (!invalidPointer) { + const searchDetails = { + pointer: event, + pointerId: pointerUtils.getPointerId(event), + pointerType, + eventType: event.type, + curEventTarget, + eventTarget, + scope + }; + const interaction = getInteraction(searchDetails); + matches.push([searchDetails.pointer, searchDetails.eventTarget, searchDetails.curEventTarget, interaction]); + } + } // eslint-disable-next-line no-shadow + + + for (const [pointer, eventTarget, curEventTarget, interaction] of matches) { + interaction[method](pointer, event, eventTarget, curEventTarget); + } + }; +} + +function getInteraction(searchDetails) { + const { + pointerType, + scope + } = searchDetails; + const foundInteraction = finder.search(searchDetails); + const signalArg = { + interaction: foundInteraction, + searchDetails + }; + scope.fire('interactions:find', signalArg); + return signalArg.interaction || scope.interactions.new({ + pointerType + }); +} + +function onDocSignal({ + doc, + scope, + options +}, eventMethodName) { + const { + docEvents + } = scope.interactions; + const eventMethod = events[eventMethodName]; + + if (scope.browser.isIOS && !options.events) { + options.events = { + passive: false + }; + } // delegate event listener + + + for (const eventType in events.delegatedEvents) { + eventMethod(doc, eventType, events.delegateListener); + eventMethod(doc, eventType, events.delegateUseCapture, true); + } + + const eventOptions = options && options.events; + + for (const { + type, + listener + } of docEvents) { + eventMethod(doc, type, listener, eventOptions); + } +} + +export default { + id: 'core/interactions', + install, + listeners: { + 'scope:add-document': arg => onDocSignal(arg, 'add'), + 'scope:remove-document': arg => onDocSignal(arg, 'remove') + }, + onDocSignal, + doOnInteractions, + methodNames +}; +//# sourceMappingURL=interactions.js.map \ No newline at end of file diff --git a/@interactjs/core/interactions.js.map b/@interactjs/core/interactions.js.map new file mode 100644 index 000000000..3baa2c7c5 --- /dev/null +++ b/@interactjs/core/interactions.js.map @@ -0,0 +1,98 @@ +{ + "version": 3, + "sources": [ + "interactions.ts" + ], + "names": [ + "browser", + "domObjects", + "nodeContains", + "events", + "pointerUtils", + "InteractionBase", + "finder", + "Scope", + "methodNames", + "install", + "scope", + "listeners", + "method", + "doOnInteractions", + "pEventTypes", + "docEvents", + "PointerEvent", + "type", + "down", + "listener", + "releasePointersOnRemovedEls", + "pointerDown", + "move", + "pointerMove", + "up", + "pointerUp", + "cancel", + "push", + "event", + "interaction", + "interactions", + "list", + "documentBlur", + "prevTouchTime", + "Interaction", + "pointerMoveTolerance", + "value", + "_now", + "now", + "new", + "options", + "scopeFire", + "name", + "arg", + "fire", + "pointerIsDown", + "pointerType", + "_interacting", + "pointer", + "pointers", + "documents", + "some", + "doc", + "downTarget", + "removePointer", + "getPointerType", + "eventTarget", + "curEventTarget", + "getEventTargets", + "matches", + "test", + "changedTouch", + "changedTouches", + "pointerId", + "getPointerId", + "searchDetails", + "eventType", + "getInteraction", + "invalidPointer", + "supportsPointerEvent", + "i", + "length", + "timeStamp", + "foundInteraction", + "search", + "signalArg", + "onDocSignal", + "eventMethodName", + "eventMethod", + "isIOS", + "passive", + "delegatedEvents", + "delegateListener", + "delegateUseCapture", + "eventOptions", + "id" + ], + "mappings": "AAAA,OAAOA,OAAP;AACA,OAAOC,UAAP;AACA,SAASC,YAAT;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,YAAZ;AACA,OAAOC,eAAP;AACA,OAAOC,MAAP;AACA,SAASC,KAAT;AAyBA,MAAMC,WAAW,GAAG,CAClB,aADkB,EACH,aADG,EACY,WADZ,EAElB,eAFkB,EAED,eAFC,EAEgB,YAFhB,CAApB;;AAKA,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AAC9B,QAAMC,SAAS,GAAG,EAAlB;;AAEA,OAAK,MAAMC,MAAX,IAAqBJ,WAArB,EAAkC;AAChCG,IAAAA,SAAS,CAACC,MAAD,CAAT,GAAoBC,g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AD,EAAM,QAAN;AAFlC,GAHE;AAObiC,EAAAA,WAPa;AAQb/D,EAAAA,gBARa;AASbL,EAAAA;AATa,CAAf", + "sourcesContent": [ + "import browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport InteractionBase from './Interaction'\nimport finder, { SearchDetails } from './interactionFinder'\nimport { Scope } from './scope'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: InteractionBase[]\n listeners: { [type: string]: Interact.Listener }\n docEvents: Array<{ type: string, listener: Interact.Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown', 'pointerMove', 'pointerUp',\n 'updatePointer', 'removePointer', 'windowBlur',\n]\n\nfunction install (scope: Scope) {\n const listeners = {} as any\n\n for (const method of methodNames) {\n listeners[method] = doOnInteractions(method, scope)\n }\n\n const pEventTypes = browser.pEventTypes\n let docEvents: typeof scope.interactions.docEvents\n\n if (domObjects.PointerEvent) {\n docEvents = [\n { type: pEventTypes.down, listener: releasePointersOnRemovedEls },\n { type: pEventTypes.down, listener: listeners.pointerDown },\n { type: pEventTypes.move, listener: listeners.pointerMove },\n { type: pEventTypes.up, listener: listeners.pointerUp },\n { type: pEventTypes.cancel, listener: listeners.pointerUp },\n ]\n }\n else {\n docEvents = [\n { type: 'mousedown', listener: listeners.pointerDown },\n { type: 'mousemove', listener: listeners.pointerMove },\n { type: 'mouseup', listener: listeners.pointerUp },\n\n { type: 'touchstart', listener: releasePointersOnRemovedEls },\n { type: 'touchstart', listener: listeners.pointerDown },\n { type: 'touchmove', listener: listeners.pointerMove },\n { type: 'touchend', listener: listeners.pointerUp },\n { type: 'touchcancel', listener: listeners.pointerUp },\n ]\n }\n\n docEvents.push({\n type: 'blur',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n interaction.documentBlur(event)\n }\n },\n })\n\n // for ignoring browser's simulated mouse events\n scope.prevTouchTime = 0\n\n scope.Interaction = class Interaction extends InteractionBase {\n get pointerMoveTolerance () {\n return scope.interactions.pointerMoveTolerance\n }\n\n set pointerMoveTolerance (value) {\n scope.interactions.pointerMoveTolerance = value\n }\n\n _now () { return scope.now() }\n }\n\n scope.interactions = {\n // all active and idle interactions\n list: [],\n new (options: { pointerType?: string, scopeFire?: Scope['fire'] }) {\n options.scopeFire = (name, arg) => scope.fire(name, arg)\n\n const interaction = new scope.Interaction(options as Required)\n\n scope.interactions.list.push(interaction)\n return interaction\n },\n listeners,\n docEvents,\n pointerMoveTolerance: 1,\n }\n\n function releasePointersOnRemovedEls () {\n // for all inactive touch interactions with pointers down\n for (const interaction of scope.interactions.list) {\n if (!interaction.pointerIsDown ||\n interaction.pointerType !== 'touch' ||\n interaction._interacting) {\n continue\n }\n\n // if a pointer is down on an element that is no longer in the DOM tree\n for (const pointer of interaction.pointers) {\n if (!scope.documents.some(({ doc }) => nodeContains(doc, pointer.downTarget))) {\n // remove the pointer from the interaction\n interaction.removePointer(pointer.pointer, pointer.event)\n }\n }\n }\n }\n}\n\nfunction doOnInteractions (method, scope) {\n return function (event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n for (const changedTouch of event.changedTouches) {\n const pointer = changedTouch\n const pointerId = pointerUtils.getPointerId(pointer)\n const searchDetails: SearchDetails = {\n pointer,\n pointerId,\n pointerType,\n eventType: event.type,\n eventTarget,\n curEventTarget,\n scope,\n }\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n else {\n let invalidPointer = false\n\n if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {\n // ignore mouse events while touch interactions are active\n for (let i = 0; i < interactions.length && !invalidPointer; i++) {\n invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown\n }\n\n // try to ignore mouse events that are simulated by the browser\n // after a touch event\n invalidPointer = invalidPointer ||\n (scope.now() - scope.prevTouchTime < 500) ||\n // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated\n event.timeStamp === 0\n }\n\n if (!invalidPointer) {\n const searchDetails = {\n pointer: event,\n pointerId: pointerUtils.getPointerId(event),\n pointerType,\n eventType: event.type,\n curEventTarget,\n eventTarget,\n scope,\n }\n\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n\n // eslint-disable-next-line no-shadow\n for (const [pointer, eventTarget, curEventTarget, interaction] of matches) {\n interaction[method](pointer, event, eventTarget, curEventTarget)\n }\n }\n}\n\nfunction getInteraction (searchDetails: SearchDetails) {\n const { pointerType, scope } = searchDetails\n\n const foundInteraction = finder.search(searchDetails)\n const signalArg = { interaction: foundInteraction, searchDetails }\n\n scope.fire('interactions:find', signalArg)\n\n return signalArg.interaction || scope.interactions.new({ pointerType })\n}\n\nfunction onDocSignal ({ doc, scope, options }: Interact.SignalArgs[T], eventMethodName: 'add' | 'remove') {\n const { docEvents } = scope.interactions\n const eventMethod = events[eventMethodName]\n\n if (scope.browser.isIOS && !options.events) {\n options.events = { passive: false }\n }\n\n // delegate event listener\n for (const eventType in events.delegatedEvents) {\n eventMethod(doc, eventType, events.delegateListener)\n eventMethod(doc, eventType, events.delegateUseCapture, true)\n }\n\n const eventOptions = options && options.events\n\n for (const { type, listener } of docEvents) {\n eventMethod(doc, type, listener, eventOptions)\n }\n}\n\nexport default {\n id: 'core/interactions',\n install,\n listeners: {\n 'scope:add-document': arg => onDocSignal(arg, 'add'),\n 'scope:remove-document': arg => onDocSignal(arg, 'remove'),\n },\n onDocSignal,\n doOnInteractions,\n methodNames,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/interactions.spec.d.ts b/@interactjs/core/interactions.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/interactions.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/core/scope.d.ts b/@interactjs/core/scope.d.ts new file mode 100644 index 000000000..66ec36b26 --- /dev/null +++ b/@interactjs/core/scope.d.ts @@ -0,0 +1,143 @@ +import * as utils from '@interactjs/utils/index'; +import defaults from './defaultOptions'; +import Eventable from './Eventable'; +import InteractableBase from './Interactable'; +import InteractableSet from './InteractableSet'; +import InteractEvent, { PhaseMap } from './InteractEvent'; +export interface SignalArgs { + 'scope:add-document': DocSignalArg; + 'scope:remove-document': DocSignalArg; + 'interactable:unset': { + interactable: InteractableBase; + }; + 'interactable:set': { + interactable: InteractableBase; + options: Interact.Options; + }; + 'interactions:destroy': { + interaction: Interact.Interaction; + }; +} +export declare type ListenerName = keyof SignalArgs; +export declare type ListenerMap = { + [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean; +}; +interface DocSignalArg { + doc: Document; + window: Window; + scope: Scope; + options?: { + [index: string]: any; + }; +} +export interface ActionMap { +} +export declare type ActionName = keyof ActionMap; +export interface Actions { + map: ActionMap; + phases: PhaseMap; + methodDict: { + [P in ActionName]?: string; + }; + phaselessTypes: { + [type: string]: true; + }; +} +export declare function createScope(): Scope; +export declare type Defaults = typeof defaults; +export interface Plugin { + [key: string]: any; + id?: string; + listeners?: ListenerMap; + before?: string[]; + install?(scope: Scope, options?: any): void; +} +export declare class Scope { + id: string; + listenerMaps: Array<{ + map: ListenerMap; + id: string; + }>; + browser: { + init: (window: any) => void; + supportsTouch: boolean; + supportsPointerEvent: boolean; + isIOS7: boolean; + isIOS: boolean; + isIe9: boolean; + isOperaMobile: boolean; + prefixedMatchesSelector: string; + pEventTypes: { + up: string; + down: string; + over: string; + out: string; + move: string; + cancel: string; + }; + wheelEvent: string; + }; + events: { + add: (element: EventTarget, type: string, listener: (event: Event | import("@interactjs/utils/events").FakeEvent) => any, optionalArg?: any) => void; + remove: (element: EventTarget, type: string, listener?: ((event: Event | import("@interactjs/utils/events").FakeEvent) => any) | "all", optionalArg?: any) => void; + addDelegate: (selector: string, context: Node, type: string, listener: (event: Event | import("@interactjs/utils/events").FakeEvent) => any, optionalArg?: any) => void; + removeDelegate: (selector: string, context: Document | HTMLElement | SVGElement, type: string, listener?: (event: Event | import("@interactjs/utils/events").FakeEvent) => any, optionalArg?: any) => void; + delegateListener: (event: Event, optionalArg?: any) => void; + delegateUseCapture: (event: Event) => any; + delegatedEvents: { + [type: string]: { + selectors: string[]; + contexts: Node[]; + listeners: [(event: Event | import("@interactjs/utils/events").FakeEvent) => any, boolean, boolean][][]; + }; + }; + documents: Document[]; + supportsOptions: boolean; + supportsPassive: boolean; + _elements: EventTarget[]; + _targets: { + events: { + [type: string]: ((event: Event | import("@interactjs/utils/events").FakeEvent) => any)[]; + }; + typeCount: number; + }[]; + init(window: Window): void; + }; + utils: typeof utils; + defaults: Defaults; + Eventable: typeof Eventable; + actions: Actions; + InteractEvent: typeof InteractEvent; + Interactable: typeof InteractableBase; + interactables: InteractableSet; + _win: Window; + document: Document; + window: Window; + documents: Array<{ + doc: Document; + options: any; + }>; + _plugins: { + list: Plugin[]; + map: { + [id: string]: Plugin; + }; + }; + constructor(); + addListeners(map: ListenerMap, id?: string): void; + fire(name: T, arg: SignalArgs[T]): void | false; + onWindowUnload: (event: BeforeUnloadEvent) => void; + init(window: Window): Scope; + pluginIsInstalled(plugin: Plugin): boolean | Plugin; + usePlugin(plugin: Plugin, options?: { + [key: string]: any; + }): this; + addDocument(doc: Document, options?: any): void | false; + removeDocument(doc: Document): void; + getDocIndex(doc: Document): number; + getDocOptions(doc: Document): any; + now(): number; +} +export declare function isNonNativeEvent(type: string, actions: Actions): boolean; +export declare function initScope(scope: Scope, window: Window): Scope; +export {}; diff --git a/@interactjs/core/scope.js b/@interactjs/core/scope.js new file mode 100644 index 000000000..4dd37e798 --- /dev/null +++ b/@interactjs/core/scope.js @@ -0,0 +1,273 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import domObjects from "../utils/domObjects.js"; +import * as utils from "../utils/index.js"; +import defaults from "./defaultOptions.js"; +import Eventable from "./Eventable.js"; +import InteractableBase from "./Interactable.js"; +import InteractableSet from "./InteractableSet.js"; +import InteractEvent from "./InteractEvent.js"; +import interactions from "./interactions.js"; +const { + win, + browser, + raf, + events +} = utils; // eslint-disable-next-line @typescript-eslint/no-empty-interface + +export function createScope() { + return new Scope(); +} +export class Scope { + // main window + // main document + // main window + // all documents being listened to + constructor() { + _defineProperty(this, "id", `__interact_scope_${Math.floor(Math.random() * 100)}`); + + _defineProperty(this, "listenerMaps", []); + + _defineProperty(this, "browser", browser); + + _defineProperty(this, "events", events); + + _defineProperty(this, "utils", utils); + + _defineProperty(this, "defaults", utils.clone(defaults)); + + _defineProperty(this, "Eventable", Eventable); + + _defineProperty(this, "actions", { + map: {}, + phases: { + start: true, + move: true, + end: true + }, + methodDict: {}, + phaselessTypes: {} + }); + + _defineProperty(this, "InteractEvent", InteractEvent); + + _defineProperty(this, "Interactable", void 0); + + _defineProperty(this, "interactables", new InteractableSet(this)); + + _defineProperty(this, "_win", void 0); + + _defineProperty(this, "document", void 0); + + _defineProperty(this, "window", void 0); + + _defineProperty(this, "documents", []); + + _defineProperty(this, "_plugins", { + list: [], + map: {} + }); + + _defineProperty(this, "onWindowUnload", event => this.removeDocument(event.target)); + + const scope = this; + this.Interactable = class Interactable extends InteractableBase { + get _defaults() { + return scope.defaults; + } + + set(options) { + super.set(options); + scope.fire('interactable:set', { + options, + interactable: this + }); + return this; + } + + unset() { + super.unset(); + + for (let i = scope.interactions.list.length - 1; i >= 0; i--) { + const interaction = scope.interactions.list[i]; + + if (interaction.interactable === this) { + interaction.stop(); + scope.fire('interactions:destroy', { + interaction + }); + interaction.destroy(); + + if (scope.interactions.list.length > 2) { + scope.interactions.list.splice(i, 1); + } + } + } + + scope.fire('interactable:unset', { + interactable: this + }); + } + + }; + } + + addListeners(map, id) { + this.listenerMaps.push({ + id, + map + }); + } + + fire(name, arg) { + for (const { + map: { + [name]: listener + } + } of this.listenerMaps) { + if (!!listener && listener(arg, this, name) === false) { + return false; + } + } + } + + init(window) { + return initScope(this, window); + } + + pluginIsInstalled(plugin) { + return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1; + } + + usePlugin(plugin, options) { + if (this.pluginIsInstalled(plugin)) { + return this; + } + + if (plugin.id) { + this._plugins.map[plugin.id] = plugin; + } + + this._plugins.list.push(plugin); + + if (plugin.install) { + plugin.install(this, options); + } + + if (plugin.listeners && plugin.before) { + let index = 0; + const len = this.listenerMaps.length; + const before = plugin.before.reduce((acc, id) => { + acc[id] = true; + return acc; + }, {}); + + for (; index < len; index++) { + const otherId = this.listenerMaps[index].id; + + if (before[otherId]) { + break; + } + } + + this.listenerMaps.splice(index, 0, { + id: plugin.id, + map: plugin.listeners + }); + } else if (plugin.listeners) { + this.listenerMaps.push({ + id: plugin.id, + map: plugin.listeners + }); + } + + return this; + } + + addDocument(doc, options) { + // do nothing if document is already known + if (this.getDocIndex(doc) !== -1) { + return false; + } + + const window = win.getWindow(doc); + options = options ? utils.extend({}, options) : {}; + this.documents.push({ + doc, + options + }); + events.documents.push(doc); // don't add an unload event for the main document + // so that the page may be cached in browser history + + if (doc !== this.document) { + events.add(window, 'unload', this.onWindowUnload); + } + + this.fire('scope:add-document', { + doc, + window, + scope: this, + options + }); + } + + removeDocument(doc) { + const index = this.getDocIndex(doc); + const window = win.getWindow(doc); + const options = this.documents[index].options; + events.remove(window, 'unload', this.onWindowUnload); + this.documents.splice(index, 1); + events.documents.splice(index, 1); + this.fire('scope:remove-document', { + doc, + window, + scope: this, + options + }); + } + + getDocIndex(doc) { + for (let i = 0; i < this.documents.length; i++) { + if (this.documents[i].doc === doc) { + return i; + } + } + + return -1; + } + + getDocOptions(doc) { + const docIndex = this.getDocIndex(doc); + return docIndex === -1 ? null : this.documents[docIndex].options; + } + + now() { + return (this.window.Date || Date).now(); + } + +} +export function isNonNativeEvent(type, actions) { + if (actions.phaselessTypes[type]) { + return true; + } + + for (const name in actions.map) { + if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) { + return true; + } + } + + return false; +} +export function initScope(scope, window) { + win.init(window); + domObjects.init(window); + browser.init(window); + raf.init(window); + events.init(window); + scope.usePlugin(interactions); + scope.document = window.document; + scope.window = window; + return scope; +} +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/@interactjs/core/scope.js.map b/@interactjs/core/scope.js.map new file mode 100644 index 000000000..27ab860ae --- /dev/null +++ b/@interactjs/core/scope.js.map @@ -0,0 +1,97 @@ +{ + "version": 3, + "sources": [ + "scope.ts" + ], + "names": [ + "domObjects", + "utils", + "defaults", + "Eventable", + "InteractableBase", + "InteractableSet", + "InteractEvent", + "interactions", + "win", + "browser", + "raf", + "events", + "createScope", + "Scope", + "constructor", + "Math", + "floor", + "random", + "clone", + "map", + "phases", + "start", + "move", + "end", + "methodDict", + "phaselessTypes", + "list", + "event", + "removeDocument", + "target", + "scope", + "Interactable", + "_defaults", + "set", + "options", + "fire", + "interactable", + "unset", + "i", + "length", + "interaction", + "stop", + "destroy", + "splice", + "addListeners", + "id", + "listenerMaps", + "push", + "name", + "arg", + "listener", + "init", + "window", + "initScope", + "pluginIsInstalled", + "plugin", + "_plugins", + "indexOf", + "usePlugin", + "install", + "listeners", + "before", + "index", + "len", + "reduce", + "acc", + "otherId", + "addDocument", + "doc", + "getDocIndex", + "getWindow", + "extend", + "documents", + "document", + "add", + "onWindowUnload", + "remove", + "getDocOptions", + "docIndex", + "now", + "Date", + "isNonNativeEvent", + "type", + "actions", + "substr" + ], + "mappings": ";;AAAA,OAAOA,UAAP;AACA,OAAO,KAAKC,KAAZ;AACA,OAAOC,QAAP;AACA,OAAOC,SAAP;AACA,OAAOC,gBAAP;AACA,OAAOC,eAAP;AACA,OAAOC,aAAP;AACA,OAAOC,YAAP;AAuBA,MAAM;AACJC,EAAAA,GADI;AAEJC,EAAAA,OAFI;AAGJC,EAAAA,GAHI;AAIJC,EAAAA;AAJI,IAKFV,KALJ,C,CAOA;;AAaA,OAAO,SAASW,WAAT,GAAwB;AAC7B,SAAO,IAAIC,KAAJ,EAAP;AACD;AAYD,OAAO,MAAMA,KAAN,CAAY;AA2BjB;AAGA;AAGA;AAGA;AAWAC,EAAAA,WAAW,GAAI;AAAA,gCA9CT,oBAAmBC,IAAI,CAACC,KAAL,CAAWD,IAAI,CAACE,MAAL,KAAgB,GAA3B,CAAgC,EA8C1C;;AAAA,0CA1CV,EA0CU;;AAAA,qCAxCLR,OAwCK;;AAAA,oCAvCNE,MAuCM;;AAAA,mCAtCPV,KAsCO;;AAAA,sCArCMA,KAAK,CAACiB,KAAN,CAAYhB,QAAZ,CAqCN;;AAAA,uCApCHC,SAoCG;;AAAA,qCAnCI;AACjBgB,MAAAA,GAAG,EAAE,EADY;AAEjBC,MAAAA,MAAM,EAAE;AACNC,QAAAA,KAAK,EAAE,IADD;AAENC,QAAAA,IAAI,EAAE,IAFA;AAGNC,QAAAA,GAAG,EAAE;AAHC,OAFS;AAOjBC,MAAAA,UAAU,EAAE,EAPK;AAQjBC,MAAAA,cAAc,EAAE;AARC,KAmCJ;;AAAA,2CAxBCnB,aAwBD;;AAAA;;AAAA,2CAtBC,IAAID,eAAJ,CAAoB,IAApB,CAsBD;;AAAA;;AAAA;;AAAA;;AAAA,uCAVqC,EAUrC;;AAAA,sCALX;AACFqB,MAAAA,IAAI,EAAE,EADJ;AAEFP,M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,CAAgBC,MAAhB;AACA3C,EAAAA,OAAO,CAAC0C,IAAR,CAAaC,MAAb;AACA1C,EAAAA,GAAG,CAACyC,IAAJ,CAASC,MAAT;AACAzC,EAAAA,MAAM,CAACwC,IAAP,CAAYC,MAAZ;AAEAtB,EAAAA,KAAK,CAAC4B,SAAN,CAAgBnD,YAAhB;AACAuB,EAAAA,KAAK,CAAC2C,QAAN,GAAiBrB,MAAM,CAACqB,QAAxB;AACA3C,EAAAA,KAAK,CAACsB,MAAN,GAAeA,MAAf;AAEA,SAAOtB,KAAP;AACD", + "sourcesContent": [ + "import domObjects from '@interactjs/utils/domObjects'\nimport * as utils from '@interactjs/utils/index'\nimport defaults from './defaultOptions'\nimport Eventable from './Eventable'\nimport InteractableBase from './Interactable'\nimport InteractableSet from './InteractableSet'\nimport InteractEvent, { PhaseMap } from './InteractEvent'\nimport interactions from './interactions'\n\nexport interface SignalArgs {\n 'scope:add-document': DocSignalArg\n 'scope:remove-document': DocSignalArg\n 'interactable:unset': { interactable: InteractableBase }\n 'interactable:set': { interactable: InteractableBase, options: Interact.Options }\n 'interactions:destroy': { interaction: Interact.Interaction }\n}\n\nexport type ListenerName = keyof SignalArgs\n\nexport type ListenerMap = {\n [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean\n}\n\ninterface DocSignalArg {\n doc: Document\n window: Window\n scope: Scope\n options?: { [index: string]: any }\n}\n\nconst {\n win,\n browser,\n raf,\n events,\n} = utils\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionMap { // tslint:disable-line no-empty-interface\n}\n\nexport type ActionName = keyof ActionMap\n\nexport interface Actions {\n map: ActionMap\n phases: PhaseMap\n methodDict: { [P in ActionName]?: string }\n phaselessTypes: { [type: string]: true }\n}\n\nexport function createScope () {\n return new Scope()\n}\n\nexport type Defaults = typeof defaults\n\nexport interface Plugin {\n [key: string]: any\n id?: string\n listeners?: ListenerMap\n before?: string[]\n install? (scope: Scope, options?: any): void\n}\n\nexport class Scope {\n id = `__interact_scope_${Math.floor(Math.random() * 100)}`\n listenerMaps: Array<{\n map: ListenerMap\n id: string\n }> = []\n\n browser = browser\n events = events\n utils = utils\n defaults: Defaults = utils.clone(defaults) as Defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {},\n phaselessTypes: {},\n }\n\n InteractEvent = InteractEvent\n Interactable!: typeof InteractableBase\n interactables = new InteractableSet(this)\n\n // main window\n _win!: Window\n\n // main document\n document!: Document\n\n // main window\n window!: Window\n\n // all documents being listened to\n documents: Array<{ doc: Document, options: any }> = []\n\n _plugins: {\n list: Plugin[]\n map: { [id: string]: Plugin }\n } = {\n list: [],\n map: {},\n }\n\n constructor () {\n const scope = this as Scope\n\n ;(this as { Interactable: typeof InteractableBase }).Interactable = class Interactable extends InteractableBase implements InteractableBase {\n get _defaults () { return scope.defaults }\n\n set (options: Interact.Options) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset () {\n super.unset()\n for (let i = scope.interactions.list.length - 1; i >= 0; i--) {\n const interaction = scope.interactions.list[i]\n\n if (interaction.interactable === this) {\n interaction.stop()\n scope.fire('interactions:destroy', { interaction })\n interaction.destroy()\n\n if (scope.interactions.list.length > 2) {\n scope.interactions.list.splice(i, 1)\n }\n }\n }\n\n scope.fire('interactable:unset', { interactable: this })\n }\n }\n }\n\n addListeners (map: ListenerMap, id?: string) {\n this.listenerMaps.push({ id, map })\n }\n\n fire (name: T, arg: SignalArgs[T]): void | false {\n for (const { map: { [name]: listener } } of this.listenerMaps) {\n if (!!listener && listener(arg as any, this, name as never) === false) {\n return false\n }\n }\n }\n\n onWindowUnload = (event: BeforeUnloadEvent) => this.removeDocument(event.target as Document)\n\n init (window: Window) {\n return initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) { this._plugins.map[plugin.id] = plugin }\n this._plugins.list.push(plugin)\n\n if (plugin.install) {\n plugin.install(this, options)\n }\n\n if (plugin.listeners && plugin.before) {\n let index = 0\n const len = this.listenerMaps.length\n const before = plugin.before.reduce((acc, id) => {\n acc[id] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (before[otherId]) { break }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\n }\n else if (plugin.listeners) {\n this.listenerMaps.push({ id: plugin.id, map: plugin.listeners })\n }\n\n return this\n }\n\n addDocument (doc: Document, options?: any): void | false {\n // do nothing if document is already known\n if (this.getDocIndex(doc) !== -1) { return false }\n\n const window = win.getWindow(doc)\n\n options = options ? utils.extend({}, options) : {}\n\n this.documents.push({ doc, options })\n events.documents.push(doc)\n\n // don't add an unload event for the main document\n // so that the page may be cached in browser history\n if (doc !== this.document) {\n events.add(window, 'unload', this.onWindowUnload)\n }\n\n this.fire('scope:add-document', { doc, window, scope: this, options })\n }\n\n removeDocument (doc: Document) {\n const index = this.getDocIndex(doc)\n\n const window = win.getWindow(doc)\n const options = this.documents[index].options\n\n events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n events.documents.splice(index, 1)\n\n this.fire('scope:remove-document', { doc, window, scope: this, options })\n }\n\n getDocIndex (doc: Document) {\n for (let i = 0; i < this.documents.length; i++) {\n if (this.documents[i].doc === doc) {\n return i\n }\n }\n\n return -1\n }\n\n getDocOptions (doc: Document) {\n const docIndex = this.getDocIndex(doc)\n\n return docIndex === -1 ? null : this.documents[docIndex].options\n }\n\n now () {\n return ((this.window as any).Date as typeof Date || Date).now()\n }\n}\n\nexport function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) { return true }\n\n for (const name in actions.map) {\n if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) {\n return true\n }\n }\n\n return false\n}\n\nexport function initScope (scope: Scope, window: Window) {\n win.init(window)\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n events.init(window)\n\n scope.usePlugin(interactions)\n scope.document = window.document\n scope.window = window\n\n return scope\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/core/scope.spec.d.ts b/@interactjs/core/scope.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/core/scope.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/dev-tools/.npmignore b/@interactjs/dev-tools/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/dev-tools/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/dev-tools/LICENSE b/@interactjs/dev-tools/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/dev-tools/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/dev-tools/devTools.spec.d.ts b/@interactjs/dev-tools/devTools.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/dev-tools/devTools.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/dev-tools/index.d.ts b/@interactjs/dev-tools/index.d.ts new file mode 100644 index 000000000..7e7facca7 --- /dev/null +++ b/@interactjs/dev-tools/index.d.ts @@ -0,0 +1,38 @@ +declare module '@interactjs/core/scope' { + interface Scope { + logger: Logger; + } +} +declare module '@interactjs/core/defaultOptions' { + interface BaseDefaults { + devTools?: DevToolsOptions; + } +} +declare module '@interactjs/core/Interactable' { + interface Interactable { + devTools?: Interact.OptionMethod; + } +} +export interface DevToolsOptions { + ignore: { + [P in keyof typeof CheckName]?: boolean; + }; +} +export interface Logger { + warn: (...args: any[]) => void; + error: (...args: any[]) => void; + log: (...args: any[]) => void; +} +export interface Check { + name: CheckName; + text: string; + perform: (interaction: Interact.Interaction) => boolean; + getInfo: (interaction: Interact.Interaction) => any[]; +} +declare enum CheckName { + touchAction = "touchAction", + boxSizing = "boxSizing", + noListeners = "noListeners" +} +declare const defaultExport: Interact.Plugin; +export default defaultExport; diff --git a/@interactjs/dev-tools/index.js b/@interactjs/dev-tools/index.js new file mode 100644 index 000000000..b133f2383 --- /dev/null +++ b/@interactjs/dev-tools/index.js @@ -0,0 +1,140 @@ +/* eslint-disable no-console */ + +/* global process */ +import domObjects from "../utils/domObjects.js"; +import { parentNode } from "../utils/domUtils.js"; +import extend from "../utils/extend.js"; +import * as is from "../utils/is.js"; +import win from "../utils/window.js"; +var CheckName; + +(function (CheckName) { + CheckName["touchAction"] = "touchAction"; + CheckName["boxSizing"] = "boxSizing"; + CheckName["noListeners"] = "noListeners"; +})(CheckName || (CheckName = {})); + +const prefix = '[interact.js] '; +const links = { + touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action', + boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing' +}; +const isProduction = undefined === 'production'; // eslint-disable-next-line no-restricted-syntax + +function install(scope, { + logger +} = {}) { + const { + Interactable, + defaults + } = scope; + scope.logger = logger || console; + defaults.base.devTools = { + ignore: {} + }; + + Interactable.prototype.devTools = function (options) { + if (options) { + extend(this.options.devTools, options); + return this; + } + + return this.options.devTools; + }; +} + +const checks = [{ + name: CheckName.touchAction, + + perform({ + element + }) { + return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/); + }, + + getInfo({ + element + }) { + return [element, links.touchAction]; + }, + + text: 'Consider adding CSS "touch-action: none" to this element\n' +}, { + name: CheckName.boxSizing, + + perform(interaction) { + const { + element + } = interaction; + return interaction.prepared.name === 'resize' && element instanceof domObjects.HTMLElement && !hasStyle(element, 'boxSizing', /border-box/); + }, + + text: 'Consider adding CSS "box-sizing: border-box" to this resizable element', + + getInfo({ + element + }) { + return [element, links.boxSizing]; + } + +}, { + name: CheckName.noListeners, + + perform(interaction) { + const actionName = interaction.prepared.name; + const moveListeners = interaction.interactable.events.types[`${actionName}move`] || []; + return !moveListeners.length; + }, + + getInfo(interaction) { + return [interaction.prepared.name, interaction.interactable]; + }, + + text: 'There are no listeners set for this action' +}]; + +function hasStyle(element, prop, styleRe) { + return styleRe.test(element.style[prop] || win.window.getComputedStyle(element)[prop]); +} + +function parentHasStyle(element, prop, styleRe) { + let parent = element; + + while (is.element(parent)) { + if (hasStyle(parent, prop, styleRe)) { + return true; + } + + parent = parentNode(parent); + } + + return false; +} + +const id = 'dev-tools'; +const defaultExport = isProduction ? { + id, + install: () => {} +} : { + id, + install, + listeners: { + 'interactions:action-start': ({ + interaction + }, scope) => { + for (const check of checks) { + const options = interaction.interactable && interaction.interactable.options; + + if (!(options && options.devTools && options.devTools.ignore[check.name]) && check.perform(interaction)) { + scope.logger.warn(prefix + check.text, ...check.getInfo(interaction)); + } + } + } + }, + checks, + CheckName, + links, + prefix +}; +export default defaultExport; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/dev-tools/index.js.map b/@interactjs/dev-tools/index.js.map new file mode 100644 index 000000000..981a4549a --- /dev/null +++ b/@interactjs/dev-tools/index.js.map @@ -0,0 +1,64 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "domObjects", + "parentNode", + "extend", + "is", + "win", + "CheckName", + "prefix", + "links", + "touchAction", + "boxSizing", + "isProduction", + "install", + "scope", + "logger", + "Interactable", + "defaults", + "console", + "base", + "devTools", + "ignore", + "prototype", + "options", + "checks", + "name", + "perform", + "element", + "parentHasStyle", + "getInfo", + "text", + "interaction", + "prepared", + "HTMLElement", + "hasStyle", + "noListeners", + "actionName", + "moveListeners", + "interactable", + "events", + "types", + "length", + "prop", + "styleRe", + "test", + "style", + "window", + "getComputedStyle", + "parent", + "id", + "defaultExport", + "listeners", + "check", + "warn" + ], + "mappings": "AAAA;;AACA;AACA,OAAOA,UAAP;AACA,SAASC,UAAT;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,GAAP;IAqCKC,S;;WAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;AAAAA,EAAAA,S;GAAAA,S,KAAAA,S;;AAML,MAAMC,MAAM,GAAI,gBAAhB;AACA,MAAMC,KAAK,GAAG;AACZC,EAAAA,WAAW,EAAE,+DADD;AAEZC,EAAAA,SAAS,EAAE;AAFC,CAAd;AAKA,MAAMC,YAAY,GAAG,cAAyB,YAA9C,C,CAEA;;AACA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AAAEC,EAAAA;AAAF,IAAkC,EAA3E,EAA+E;AAC7E,QAAM;AACJC,IAAAA,YADI;AAEJC,IAAAA;AAFI,MAGFH,KAHJ;AAKAA,EAAAA,KAAK,CAACC,MAAN,GAAeA,MAAM,IAAIG,OAAzB;AAEAD,EAAAA,QAAQ,CAACE,IAAT,CAAcC,QAAd,GAAyB;AACvBC,IAAAA,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AA6B,CAAC;AAAEpB,MAAAA;AAAF,KAAD,EAAkBjB,KAAlB,KAA4B;AACvD,WAAK,MAAMsC,KAAX,IAAoB5B,MAApB,EAA4B;AAC1B,cAAMD,OAAO,GAAGQ,WAAW,CAACO,YAAZ,IAA4BP,WAAW,CAACO,YAAZ,CAAyBf,OAArE;;AAEA,YACE,EAAEA,OAAO,IAAIA,OAAO,CAACH,QAAnB,IAA+BG,OAAO,CAACH,QAAR,CAAiBC,MAAjB,CAAwB+B,KAAK,CAAC3B,IAA9B,CAAjC,KACA2B,KAAK,CAAC1B,OAAN,CAAcK,WAAd,CAFF,EAGE;AACAjB,UAAAA,KAAK,CAACC,MAAN,CAAasC,IAAb,CAAkB7C,MAAM,GAAG4C,KAAK,CAACtB,IAAjC,EAAuC,GAAGsB,KAAK,CAACvB,OAAN,CAAcE,WAAd,CAA1C;AACD;AACF;AACF;AAZQ,GAHX;AAiBAP,EAAAA,MAjBA;AAkBAjB,EAAAA,SAlBA;AAmBAE,EAAAA,KAnBA;AAoBAD,EAAAA;AApBA,CAFJ;AAyBA,eAAe0C,aAAf", + "sourcesContent": [ + "/* eslint-disable no-console */\n/* global process */\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools?: Interact.OptionMethod\n }\n}\n\nexport interface DevToolsOptions {\n ignore: { [P in keyof typeof CheckName]?: boolean }\n}\n\nexport interface Logger {\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n log: (...args: any[]) => void\n}\n\nexport interface Check {\n name: CheckName\n text: string\n perform: (interaction: Interact.Interaction) => boolean\n getInfo: (interaction: Interact.Interaction) => any[]\n}\n\nenum CheckName {\n touchAction = 'touchAction',\n boxSizing = 'boxSizing',\n noListeners = 'noListeners',\n}\n\nconst prefix = '[interact.js] '\nconst links = {\n touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action',\n boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing',\n}\n\nconst isProduction = process.env.NODE_ENV === 'production'\n\n// eslint-disable-next-line no-restricted-syntax\nfunction install (scope: Interact.Scope, { logger }: { logger?: Logger } = {}) {\n const {\n Interactable,\n defaults,\n } = scope\n\n scope.logger = logger || console\n\n defaults.base.devTools = {\n ignore: {},\n }\n\n Interactable.prototype.devTools = function (options?: object) {\n if (options) {\n extend(this.options.devTools, options)\n return this\n }\n\n return this.options.devTools\n }\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [\n element,\n links.touchAction,\n ]\n },\n text: 'Consider adding CSS \"touch-action: none\" to this element\\n',\n },\n\n {\n name: CheckName.boxSizing,\n perform (interaction) {\n const { element } = interaction\n\n return interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [\n element,\n links.boxSizing,\n ]\n },\n },\n\n {\n name: CheckName.noListeners,\n perform (interaction) {\n const actionName = interaction.prepared.name\n const moveListeners = interaction.interactable.events.types[`${actionName}move`] || []\n\n return !moveListeners.length\n },\n getInfo (interaction) {\n return [\n interaction.prepared.name,\n interaction.interactable,\n ]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n return styleRe.test(element.style[prop] || win.window.getComputedStyle(element)[prop])\n}\n\nfunction parentHasStyle (element: Interact.Element, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n let parent = element as HTMLElement\n\n while (is.element(parent)) {\n if (hasStyle(parent, prop, styleRe)) {\n return true\n }\n\n parent = parentNode(parent) as HTMLElement\n }\n\n return false\n}\n\nconst id = 'dev-tools'\nconst defaultExport: Interact.Plugin = isProduction\n ? { id, install: () => {} }\n : {\n id,\n install,\n listeners: {\n 'interactions:action-start': ({ interaction }, scope) => {\n for (const check of checks) {\n const options = interaction.interactable && interaction.interactable.options\n\n if (\n !(options && options.devTools && options.devTools.ignore[check.name]) &&\n check.perform(interaction)\n ) {\n scope.logger.warn(prefix + check.text, ...check.getInfo(interaction))\n }\n }\n },\n },\n checks,\n CheckName,\n links,\n prefix,\n }\n\nexport default defaultExport\n" + ] +} \ No newline at end of file diff --git a/@interactjs/inertia/.npmignore b/@interactjs/inertia/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/inertia/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/inertia/LICENSE b/@interactjs/inertia/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/inertia/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/inertia/index.d.ts b/@interactjs/inertia/index.d.ts new file mode 100644 index 000000000..038fe983e --- /dev/null +++ b/@interactjs/inertia/index.d.ts @@ -0,0 +1,66 @@ +import * as modifiers from '@interactjs/modifiers/base'; +import Modification from '@interactjs/modifiers/Modification'; +declare module '@interactjs/core/InteractEvent' { + interface PhaseMap { + resume?: true; + inertiastart?: true; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + inertia?: InertiaState; + } +} +declare module '@interactjs/core/defaultOptions' { + interface PerActionDefaults { + inertia?: { + enabled?: boolean; + resistance?: number; + minSpeed?: number; + endSpeed?: number; + allowResume?: true; + smoothEndDuration?: number; + }; + } +} +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'interactions:before-action-inertiastart': Omit, 'iEvent'>; + 'interactions:action-inertiastart': Interact.DoPhaseArg; + 'interactions:after-action-inertiastart': Interact.DoPhaseArg; + 'interactions:before-action-resume': Omit, 'iEvent'>; + 'interactions:action-resume': Interact.DoPhaseArg; + 'interactions:after-action-resume': Interact.DoPhaseArg; + } +} +export declare class InertiaState { + private readonly interaction; + active: boolean; + isModified: boolean; + smoothEnd: boolean; + allowResume: boolean; + modification: Modification; + modifierCount: number; + modifierArg: modifiers.ModifierArg; + startCoords: Interact.Point; + t0: number; + v0: number; + te: number; + targetOffset: Interact.Point; + modifiedOffset: Interact.Point; + currentOffset: Interact.Point; + lambda_v0?: number; + one_ve_v0?: number; + timeout: number; + constructor(interaction: Interact.Interaction); + start(event: Interact.PointerEventType): boolean; + startInertia(): void; + startSmoothEnd(): void; + inertiaTick(): void; + smoothEndTick(): void; + resume({ pointer, event, eventTarget }: Interact.SignalArgs['interactions:down']): void; + end(): void; + stop(): void; +} +declare const inertia: Interact.Plugin; +export default inertia; diff --git a/@interactjs/inertia/index.js b/@interactjs/inertia/index.js new file mode 100644 index 000000000..5c89291e4 --- /dev/null +++ b/@interactjs/inertia/index.js @@ -0,0 +1,406 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import * as modifiers from "../modifiers/base.js"; +import Modification from "../modifiers/Modification.js"; +import offset from "../offset/index.js"; +import * as dom from "../utils/domUtils.js"; +import hypot from "../utils/hypot.js"; +import * as is from "../utils/is.js"; +import { copyCoords } from "../utils/pointerUtils.js"; +import raf from "../utils/raf.js"; + +function install(scope) { + const { + defaults + } = scope; + scope.usePlugin(offset); + scope.usePlugin(modifiers.default); + scope.actions.phases.inertiastart = true; + scope.actions.phases.resume = true; + defaults.perAction.inertia = { + enabled: false, + resistance: 10, + // the lambda in exponential decay + minSpeed: 100, + // target speed must be above this for inertia to start + endSpeed: 10, + // the speed at which inertia is slow enough to stop + allowResume: true, + // allow resuming an action in inertia phase + smoothEndDuration: 300 // animate to snap/restrict endOnly if there's no inertia + + }; +} + +export class InertiaState { + // eslint-disable-line camelcase + // eslint-disable-line camelcase + constructor(interaction) { + this.interaction = interaction; + + _defineProperty(this, "active", false); + + _defineProperty(this, "isModified", false); + + _defineProperty(this, "smoothEnd", false); + + _defineProperty(this, "allowResume", false); + + _defineProperty(this, "modification", null); + + _defineProperty(this, "modifierCount", 0); + + _defineProperty(this, "modifierArg", null); + + _defineProperty(this, "startCoords", null); + + _defineProperty(this, "t0", 0); + + _defineProperty(this, "v0", 0); + + _defineProperty(this, "te", 0); + + _defineProperty(this, "targetOffset", null); + + _defineProperty(this, "modifiedOffset", null); + + _defineProperty(this, "currentOffset", null); + + _defineProperty(this, "lambda_v0", 0); + + _defineProperty(this, "one_ve_v0", 0); + + _defineProperty(this, "timeout", null); + } + + start(event) { + const { + interaction + } = this; + const options = getOptions(interaction); + + if (!options || !options.enabled) { + return false; + } + + const { + client: velocityClient + } = interaction.coords.velocity; + const pointerSpeed = hypot(velocityClient.x, velocityClient.y); + const modification = this.modification || (this.modification = new Modification(interaction)); + modification.copyFrom(interaction.modification); + this.t0 = interaction._now(); + this.allowResume = options.allowResume; + this.v0 = pointerSpeed; + this.currentOffset = { + x: 0, + y: 0 + }; + this.startCoords = interaction.coords.cur.page; + this.modifierArg = { + interaction, + interactable: interaction.interactable, + element: interaction.element, + rect: interaction.rect, + edges: interaction.edges, + pageCoords: this.startCoords, + preEnd: true, + phase: 'inertiastart' + }; + const thrown = this.t0 - interaction.coords.cur.timeStamp < 50 && pointerSpeed > options.minSpeed && pointerSpeed > options.endSpeed; + + if (thrown) { + this.startInertia(); + } else { + modification.result = modification.setAll(this.modifierArg); + + if (!modification.result.changed) { + return false; + } + + this.startSmoothEnd(); + } // force modification change + + + interaction.modification.result.rect = null; // bring inertiastart event to the target coords + + interaction.offsetBy(this.targetOffset); + + interaction._doPhase({ + interaction, + event, + phase: 'inertiastart' + }); + + interaction.offsetBy({ + x: -this.targetOffset.x, + y: -this.targetOffset.y + }); // force modification change + + interaction.modification.result.rect = null; + this.active = true; + interaction.simulation = this; + return true; + } + + startInertia() { + const startVelocity = this.interaction.coords.velocity.client; + const options = getOptions(this.interaction); + const lambda = options.resistance; + const inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda; + this.targetOffset = { + x: (startVelocity.x - inertiaDur) / lambda, + y: (startVelocity.y - inertiaDur) / lambda + }; + this.te = inertiaDur; + this.lambda_v0 = lambda / this.v0; + this.one_ve_v0 = 1 - options.endSpeed / this.v0; + const { + modification, + modifierArg + } = this; + modifierArg.pageCoords = { + x: this.startCoords.x + this.targetOffset.x, + y: this.startCoords.y + this.targetOffset.y + }; + modification.result = modification.setAll(modifierArg); + + if (modification.result.changed) { + this.isModified = true; + this.modifiedOffset = { + x: this.targetOffset.x + modification.result.delta.x, + y: this.targetOffset.y + modification.result.delta.y + }; + } + + this.timeout = raf.request(() => this.inertiaTick()); + } + + startSmoothEnd() { + this.smoothEnd = true; + this.isModified = true; + this.targetOffset = { + x: this.modification.result.delta.x, + y: this.modification.result.delta.y + }; + this.timeout = raf.request(() => this.smoothEndTick()); + } + + inertiaTick() { + const { + interaction + } = this; + const options = getOptions(interaction); + const lambda = options.resistance; + const t = (interaction._now() - this.t0) / 1000; + + if (t < this.te) { + const progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0; + let newOffset; + + if (this.isModified) { + newOffset = getQuadraticCurvePoint(0, 0, this.targetOffset.x, this.targetOffset.y, this.modifiedOffset.x, this.modifiedOffset.y, progress); + } else { + newOffset = { + x: this.targetOffset.x * progress, + y: this.targetOffset.y * progress + }; + } + + const delta = { + x: newOffset.x - this.currentOffset.x, + y: newOffset.y - this.currentOffset.y + }; + this.currentOffset.x += delta.x; + this.currentOffset.y += delta.y; + interaction.offsetBy(delta); + interaction.move(); + this.timeout = raf.request(() => this.inertiaTick()); + } else { + interaction.offsetBy({ + x: this.modifiedOffset.x - this.currentOffset.x, + y: this.modifiedOffset.y - this.currentOffset.y + }); + this.end(); + } + } + + smoothEndTick() { + const { + interaction + } = this; + const t = interaction._now() - this.t0; + const { + smoothEndDuration: duration + } = getOptions(interaction); + + if (t < duration) { + const newOffset = { + x: easeOutQuad(t, 0, this.targetOffset.x, duration), + y: easeOutQuad(t, 0, this.targetOffset.y, duration) + }; + const delta = { + x: newOffset.x - this.currentOffset.x, + y: newOffset.y - this.currentOffset.y + }; + this.currentOffset.x += delta.x; + this.currentOffset.y += delta.y; + interaction.offsetBy(delta); + interaction.move({ + skipModifiers: this.modifierCount + }); + this.timeout = raf.request(() => this.smoothEndTick()); + } else { + interaction.offsetBy({ + x: this.targetOffset.x - this.currentOffset.x, + y: this.targetOffset.y - this.currentOffset.y + }); + this.end(); + } + } + + resume({ + pointer, + event, + eventTarget + }) { + const { + interaction + } = this; // undo inertia changes to interaction coords + + interaction.offsetBy({ + x: -this.currentOffset.x, + y: -this.currentOffset.y + }); // update pointer at pointer down position + + interaction.updatePointer(pointer, event, eventTarget, true); // fire resume signals and event + + interaction._doPhase({ + interaction, + event, + phase: 'resume' + }); + + copyCoords(interaction.coords.prev, interaction.coords.cur); + this.stop(); + } + + end() { + this.interaction.move(); + this.interaction.end(); + this.stop(); + } + + stop() { + this.active = this.smoothEnd = false; + this.interaction.simulation = null; + raf.cancel(this.timeout); + } + +} + +function start({ + interaction, + event +}) { + if (!interaction._interacting || interaction.simulation) { + return null; + } + + const started = interaction.inertia.start(event); // prevent action end if inertia or smoothEnd + + return started ? false : null; +} // Check if the down event hits the current inertia target +// control should be return to the user + + +function resume(arg) { + const { + interaction, + eventTarget + } = arg; + const state = interaction.inertia; + + if (!state.active) { + return; + } + + let element = eventTarget; // climb up the DOM tree from the event target + + while (is.element(element)) { + // if interaction element is the current inertia target element + if (element === interaction.element) { + state.resume(arg); + break; + } + + element = dom.parentNode(element); + } +} + +function stop({ + interaction +}) { + const state = interaction.inertia; + + if (state.active) { + state.stop(); + } +} + +function getOptions({ + interactable, + prepared +}) { + return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia; +} + +const inertia = { + id: 'inertia', + before: ['modifiers/base'], + install, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.inertia = new InertiaState(interaction); + }, + 'interactions:before-action-end': start, + 'interactions:down': resume, + 'interactions:stop': stop, + 'interactions:before-action-resume': arg => { + const { + modification + } = arg.interaction; + modification.stop(arg); + modification.start(arg, arg.interaction.coords.cur.page); + modification.applyToInteraction(arg); + }, + 'interactions:before-action-inertiastart': arg => arg.interaction.modification.setAndApply(arg), + 'interactions:action-resume': modifiers.addEventModifiers, + 'interactions:action-inertiastart': modifiers.addEventModifiers, + 'interactions:after-action-inertiastart': arg => arg.interaction.modification.restoreInteractionCoords(arg), + 'interactions:after-action-resume': arg => arg.interaction.modification.restoreInteractionCoords(arg) + } +}; // http://stackoverflow.com/a/5634528/2280888 + +function _getQBezierValue(t, p1, p2, p3) { + const iT = 1 - t; + return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3; +} + +function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) { + return { + x: _getQBezierValue(position, startX, cpX, endX), + y: _getQBezierValue(position, startY, cpY, endY) + }; +} // http://gizma.com/easing/ + + +function easeOutQuad(t, b, c, d) { + t /= d; + return -c * t * (t - 2) + b; +} + +export default inertia; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/inertia/index.js.map b/@interactjs/inertia/index.js.map new file mode 100644 index 000000000..b365c1180 --- /dev/null +++ b/@interactjs/inertia/index.js.map @@ -0,0 +1,142 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "modifiers", + "Modification", + "offset", + "dom", + "hypot", + "is", + "copyCoords", + "raf", + "install", + "scope", + "defaults", + "usePlugin", + "default", + "actions", + "phases", + "inertiastart", + "resume", + "perAction", + "inertia", + "enabled", + "resistance", + "minSpeed", + "endSpeed", + "allowResume", + "smoothEndDuration", + "InertiaState", + "constructor", + "interaction", + "start", + "event", + "options", + "getOptions", + "client", + "velocityClient", + "coords", + "velocity", + "pointerSpeed", + "x", + "y", + "modification", + "copyFrom", + "t0", + "_now", + "v0", + "currentOffset", + "startCoords", + "cur", + "page", + "modifierArg", + "interactable", + "element", + "rect", + "edges", + "pageCoords", + "preEnd", + "phase", + "thrown", + "timeStamp", + "startInertia", + "result", + "setAll", + "changed", + "startSmoothEnd", + "offsetBy", + "targetOffset", + "_doPhase", + "active", + "simulation", + "startVelocity", + "lambda", + "inertiaDur", + "Math", + "log", + "te", + "lambda_v0", + "one_ve_v0", + "isModified", + "modifiedOffset", + "delta", + "timeout", + "request", + "inertiaTick", + "smoothEnd", + "smoothEndTick", + "t", + "progress", + "exp", + "newOffset", + "getQuadraticCurvePoint", + "move", + "end", + "duration", + "easeOutQuad", + "skipModifiers", + "modifierCount", + "pointer", + "eventTarget", + "updatePointer", + "prev", + "stop", + "cancel", + "_interacting", + "started", + "arg", + "state", + "parentNode", + "prepared", + "name", + "id", + "before", + "listeners", + "applyToInteraction", + "setAndApply", + "addEventModifiers", + "restoreInteractionCoords", + "_getQBezierValue", + "p1", + "p2", + "p3", + "iT", + "startX", + "startY", + "cpX", + "cpY", + "endX", + "endY", + "position", + "b", + "c", + "d" + ], + "mappings": ";;AAAA,OAAO,KAAKA,SAAZ;AACA,OAAOC,YAAP;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,GAAZ;AACA,OAAOC,KAAP;AACA,OAAO,KAAKC,EAAZ;AACA,SAASC,UAAT;AACA,OAAOC,GAAP;;AAwCA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AACvC,QAAM;AACJC,IAAAA;AADI,MAEFD,KAFJ;AAIAA,EAAAA,KAAK,CAACE,SAAN,CAAgBT,MAAhB;AACAO,EAAAA,KAAK,CAACE,SAAN,CAAgBX,SAAS,CAACY,OAA1B;AACAH,EAAAA,KAAK,CAACI,OAAN,CAAcC,MAAd,CAAqBC,YAArB,GAAoC,IAApC;AACAN,EAAAA,KAAK,CAACI,OAAN,CAAcC,MAAd,CAAqBE,MAArB,GAA8B,IAA9B;AAEAN,EAAAA,QAAQ,CAACO,SAAT,CAAmBC,OAAnB,GAA6B;AAC3BC,IAAAA,OAAO,EAAY,KADQ;AAE3BC,IAAAA,UAAU,EAAS,EAFQ;AAED;AAC1BC,IAAAA,QAAQ,EAAW,GAHQ;AAGD;AAC1BC,IAAAA,QAAQ,EAAW,EAJQ;AAID;AAC1BC,IAAAA,WAAW,EAAQ,IALQ;AAKD;AAC1BC,IAAAA,iBAAiB,EAAE,GANQ,CAMD;;AANC,GAA7B;AAQD;;AAED,OAAO,MAAMC,YAAN,CAAmB;AAmBT;AACA;AAGfC,EAAAA,WAAW,CACQC,WADR,EAET;AAAA,SADiBA,WACjB,GADiBA,WACjB;;AAAA,oCAxBO,KAwBP;;AAAA,wCAvBW,KAuBX;;AAAA,uCAtBU,KAsBV;;AAAA,yCArBY,KAqB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BAA7B,CAAsDX,GAAtD,CApBxC;AAqBT,wCAAoCA,GAAG,IAAIA,GAAG,CAAC5E,WAAJ,CAAgBY,YAAhB,CAA6B2E,wBAA7B,CAAsDX,GAAtD;AArBlC;AAJoB,CAAjC,C,CA6BA;;AACA,SAASY,gBAAT,CAA2B/B,CAA3B,EAAsCgC,EAAtC,EAAkDC,EAAlD,EAA8DC,EAA9D,EAA0E;AACxE,QAAMC,EAAE,GAAG,IAAInC,CAAf;AACA,SAAOmC,EAAE,GAAGA,EAAL,GAAUH,EAAV,GAAe,IAAIG,EAAJ,GAASnC,CAAT,GAAaiC,EAA5B,GAAiCjC,CAAC,GAAGA,CAAJ,GAAQkC,EAAhD;AACD;;AAED,SAAS9B,sBAAT,CACEgC,MADF,EACkBC,MADlB,EACkCC,GADlC,EAC+CC,GAD/C,EAC4DC,IAD5D,EAC0EC,IAD1E,EACwFC,QADxF,EAC0G;AACxG,SAAO;AACLzF,IAAAA,CAAC,EAAG8E,gBAAgB,CAACW,QAAD,EAAWN,MAAX,EAAmBE,GAAnB,EAAwBE,IAAxB,CADf;AAELtF,IAAAA,CAAC,EAAG6E,gBAAgB,CAACW,QAAD,EAAWL,MAAX,EAAmBE,GAAnB,EAAwBE,IAAxB;AAFf,GAAP;AAID,C,CAED;;;AACA,SAASjC,WAAT,CAAsBR,CAAtB,EAAiC2C,CAAjC,EAA4CC,CAA5C,EAAuDC,CAAvD,EAAkE;AAChE7C,EAAAA,CAAC,IAAI6C,CAAL;AACA,SAAO,CAACD,CAAD,GAAK5C,CAAL,IAAUA,CAAC,GAAG,CAAd,IAAmB2C,CAA1B;AACD;;AAED,eAAe7G,OAAf", + "sourcesContent": [ + "import * as modifiers from '@interactjs/modifiers/base'\nimport Modification from '@interactjs/modifiers/Modification'\nimport offset from '@interactjs/offset'\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport * as is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n resume?: true\n inertiastart?: true\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n inertia?: InertiaState\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n inertia?: {\n enabled?: boolean\n resistance?: number // the lambda in exponential decay\n minSpeed?: number // target speed must be above this for inertia to start\n endSpeed?: number // the speed at which inertia is slow enough to stop\n allowResume?: true // allow resuming an action in inertia phase\n smoothEndDuration?: number // animate to snap/restrict endOnly if there's no inertia\n }\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-inertiastart': Omit, 'iEvent'>\n 'interactions:action-inertiastart': Interact.DoPhaseArg\n 'interactions:after-action-inertiastart': Interact.DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': Interact.DoPhaseArg\n 'interactions:after-action-resume': Interact.DoPhaseArg\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(offset)\n scope.usePlugin(modifiers.default)\n scope.actions.phases.inertiastart = true\n scope.actions.phases.resume = true\n\n defaults.perAction.inertia = {\n enabled : false,\n resistance : 10, // the lambda in exponential decay\n minSpeed : 100, // target speed must be above this for inertia to start\n endSpeed : 10, // the speed at which inertia is slow enough to stop\n allowResume : true, // allow resuming an action in inertia phase\n smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia\n }\n}\n\nexport class InertiaState {\n active = false\n isModified = false\n smoothEnd = false\n allowResume = false\n\n modification: Modification = null\n modifierCount = 0\n modifierArg: modifiers.ModifierArg = null\n\n startCoords: Interact.Point = null\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset: Interact.Point = null\n modifiedOffset: Interact.Point = null\n currentOffset: Interact.Point = null\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout: number = null\n\n constructor (\n private readonly interaction: Interact.Interaction,\n ) {}\n\n start (event: Interact.PointerEventType) {\n const { interaction } = this\n const options = getOptions(interaction)\n\n if (!options || !options.enabled) {\n return false\n }\n\n const { client: velocityClient } = interaction.coords.velocity\n const pointerSpeed = hypot(velocityClient.x, velocityClient.y)\n const modification = this.modification || (this.modification = new Modification(interaction))\n\n modification.copyFrom(interaction.modification)\n\n this.t0 = interaction._now()\n this.allowResume = options.allowResume\n this.v0 = pointerSpeed\n this.currentOffset = { x: 0, y: 0 }\n this.startCoords = interaction.coords.cur.page\n\n this.modifierArg = {\n interaction,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: interaction.rect,\n edges: interaction.edges,\n pageCoords: this.startCoords,\n preEnd: true,\n phase: 'inertiastart',\n }\n\n const thrown = (\n (this.t0 - interaction.coords.cur.timeStamp) < 50 &&\n pointerSpeed > options.minSpeed &&\n pointerSpeed > options.endSpeed\n )\n\n if (thrown) {\n this.startInertia()\n } else {\n modification.result = modification.setAll(this.modifierArg)\n\n if (!modification.result.changed) {\n return false\n }\n\n this.startSmoothEnd()\n }\n\n // force modification change\n interaction.modification.result.rect = null\n\n // bring inertiastart event to the target coords\n interaction.offsetBy(this.targetOffset)\n interaction._doPhase({\n interaction,\n event,\n phase: 'inertiastart',\n })\n interaction.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y })\n // force modification change\n interaction.modification.result.rect = null\n\n this.active = true\n interaction.simulation = this\n\n return true\n }\n\n startInertia () {\n const startVelocity = this.interaction.coords.velocity.client\n const options = getOptions(this.interaction)\n const lambda = options.resistance\n const inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda\n\n this.targetOffset = {\n x: (startVelocity.x - inertiaDur) / lambda,\n y: (startVelocity.y - inertiaDur) / lambda,\n }\n\n this.te = inertiaDur\n this.lambda_v0 = lambda / this.v0\n this.one_ve_v0 = 1 - options.endSpeed / this.v0\n\n const { modification, modifierArg } = this\n\n modifierArg.pageCoords = {\n x: this.startCoords.x + this.targetOffset.x,\n y: this.startCoords.y + this.targetOffset.y,\n }\n\n modification.result = modification.setAll(modifierArg)\n\n if (modification.result.changed) {\n this.isModified = true\n this.modifiedOffset = {\n x: this.targetOffset.x + modification.result.delta.x,\n y: this.targetOffset.y + modification.result.delta.y,\n }\n }\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n\n startSmoothEnd () {\n this.smoothEnd = true\n this.isModified = true\n this.targetOffset = {\n x: this.modification.result.delta.x,\n y: this.modification.result.delta.y,\n }\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n\n inertiaTick () {\n const { interaction } = this\n const options = getOptions(interaction)\n const lambda = options.resistance\n const t = (interaction._now() - this.t0) / 1000\n\n if (t < this.te) {\n const progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0\n let newOffset: Interact.Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0, 0,\n this.targetOffset.x, this.targetOffset.y,\n this.modifiedOffset.x, this.modifiedOffset.y,\n progress,\n )\n }\n else {\n newOffset = {\n x: this.targetOffset.x * progress,\n y: this.targetOffset.y * progress,\n }\n }\n\n const delta = { x: newOffset.x - this.currentOffset.x, y: newOffset.y - this.currentOffset.y }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move()\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n else {\n interaction.offsetBy({\n x: this.modifiedOffset.x - this.currentOffset.x,\n y: this.modifiedOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n smoothEndTick () {\n const { interaction } = this\n const t = interaction._now() - this.t0\n const { smoothEndDuration: duration } = getOptions(interaction)\n\n if (t < duration) {\n const newOffset = {\n x: easeOutQuad(t, 0, this.targetOffset.x, duration),\n y: easeOutQuad(t, 0, this.targetOffset.y, duration),\n }\n const delta = {\n x: newOffset.x - this.currentOffset.x,\n y: newOffset.y - this.currentOffset.y,\n }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move({ skipModifiers: this.modifierCount })\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n else {\n interaction.offsetBy({\n x: this.targetOffset.x - this.currentOffset.x,\n y: this.targetOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n resume ({ pointer, event, eventTarget }: Interact.SignalArgs['interactions:down']) {\n const { interaction } = this\n\n // undo inertia changes to interaction coords\n interaction.offsetBy({\n x: -this.currentOffset.x,\n y: -this.currentOffset.y,\n })\n\n // update pointer at pointer down position\n interaction.updatePointer(pointer, event, eventTarget, true)\n\n // fire resume signals and event\n interaction._doPhase({\n interaction,\n event,\n phase: 'resume',\n })\n copyCoords(interaction.coords.prev, interaction.coords.cur)\n\n this.stop()\n }\n\n end () {\n this.interaction.move()\n this.interaction.end()\n this.stop()\n }\n\n stop () {\n this.active = this.smoothEnd = false\n this.interaction.simulation = null\n raf.cancel(this.timeout)\n }\n}\n\nfunction start ({ interaction, event }: Interact.DoPhaseArg) {\n if (!interaction._interacting || interaction.simulation) {\n return null\n }\n\n const started = interaction.inertia.start(event)\n\n // prevent action end if inertia or smoothEnd\n return started ? false : null\n}\n\n// Check if the down event hits the current inertia target\n// control should be return to the user\nfunction resume (arg: Interact.SignalArgs['interactions:down']) {\n const { interaction, eventTarget } = arg\n const state = interaction.inertia\n\n if (!state.active) { return }\n\n let element = eventTarget as Node\n\n // climb up the DOM tree from the event target\n while (is.element(element)) {\n // if interaction element is the current inertia target element\n if (element === interaction.element) {\n state.resume(arg)\n break\n }\n\n element = dom.parentNode(element)\n }\n}\n\nfunction stop ({ interaction }: { interaction: Interact.Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interact.Interaction) {\n return interactable &&\n interactable.options &&\n prepared.name &&\n interactable.options[prepared.name].inertia\n}\n\nconst inertia: Interact.Plugin = {\n id: 'inertia',\n before: ['modifiers/base'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.inertia = new InertiaState(interaction)\n },\n\n 'interactions:before-action-end': start,\n 'interactions:down': resume,\n 'interactions:stop': stop,\n\n 'interactions:before-action-resume': arg => {\n const { modification } = arg.interaction\n\n modification.stop(arg)\n modification.start(arg, arg.interaction.coords.cur.page)\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-inertiastart': arg => arg.interaction.modification.setAndApply(arg),\n 'interactions:action-resume': modifiers.addEventModifiers,\n 'interactions:action-inertiastart': modifiers.addEventModifiers,\n 'interactions:after-action-inertiastart': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-resume': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n },\n}\n\n// http://stackoverflow.com/a/5634528/2280888\nfunction _getQBezierValue (t: number, p1: number, p2: number, p3: number) {\n const iT = 1 - t\n return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3\n}\n\nfunction getQuadraticCurvePoint (\n startX: number, startY: number, cpX: number, cpY: number, endX: number, endY: number, position: number) {\n return {\n x: _getQBezierValue(position, startX, cpX, endX),\n y: _getQBezierValue(position, startY, cpY, endY),\n }\n}\n\n// http://gizma.com/easing/\nfunction easeOutQuad (t: number, b: number, c: number, d: number) {\n t /= d\n return -c * t * (t - 2) + b\n}\n\nexport default inertia\n" + ] +} \ No newline at end of file diff --git a/@interactjs/inertia/inertia.spec.d.ts b/@interactjs/inertia/inertia.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/inertia/inertia.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/interact/.npmignore b/@interactjs/interact/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/interact/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/interact/LICENSE b/@interactjs/interact/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/interact/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/interact/index.d.ts b/@interactjs/interact/index.d.ts new file mode 100644 index 000000000..4494090a2 --- /dev/null +++ b/@interactjs/interact/index.d.ts @@ -0,0 +1,3 @@ +import interact from './interact'; +export declare function init(window: Window): import("@interactjs/interact/interact").InteractStatic; +export default interact; diff --git a/@interactjs/interact/index.js b/@interactjs/interact/index.js new file mode 100644 index 000000000..42a4d8ed1 --- /dev/null +++ b/@interactjs/interact/index.js @@ -0,0 +1,51 @@ +import * as actions from "../actions/index.js"; +import autoScroll from "../auto-scroll/index.js"; +import * as autoStart from "../auto-start/index.js"; +import interactablePreventDefault from "../core/interactablePreventDefault.js"; +import devTools from "../dev-tools/index.js"; +import inertia from "../inertia/index.js"; +import modifiersBase from "../modifiers/base.js"; +import * as modifiers from "../modifiers/index.js"; +import offset from "../offset/index.js"; +import * as pointerEvents from "../pointer-events/index.js"; +import reflow from "../reflow/index.js"; +import interact, { scope } from "./interact.js"; +export function init(window) { + scope.init(window); + interact.use(interactablePreventDefault); + interact.use(offset); // pointerEvents + + interact.use(pointerEvents); // inertia + + interact.use(inertia); // snap, resize, etc. + + interact.use(modifiersBase); // autoStart, hold + + interact.use(autoStart); // drag and drop, resize, gesture + + interact.use(actions); // for backwrads compatibility + + for (const type in modifiers) { + const { + _defaults, + _methods + } = modifiers[type]; + _defaults._methods = _methods; + scope.defaults.perAction[type] = _defaults; + } // autoScroll + + + interact.use(autoScroll); // reflow + + interact.use(reflow); // eslint-disable-next-line no-undef + + if (undefined !== 'production') { + interact.use(devTools); + } + + return interact; +} // eslint-disable-next-line no-undef + +interact.version = "1.8.5"; +export default interact; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/interact/index.js.map b/@interactjs/interact/index.js.map new file mode 100644 index 000000000..1e826daff --- /dev/null +++ b/@interactjs/interact/index.js.map @@ -0,0 +1,34 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "actions", + "autoScroll", + "autoStart", + "interactablePreventDefault", + "devTools", + "inertia", + "modifiersBase", + "modifiers", + "offset", + "pointerEvents", + "reflow", + "interact", + "scope", + "init", + "window", + "use", + "type", + "_defaults", + "_methods", + "defaults", + "perAction", + "version" + ], + "mappings": "AAAA,OAAO,KAAKA,OAAZ;AACA,OAAOC,UAAP;AACA,OAAO,KAAKC,SAAZ;AACA,OAAOC,0BAAP;AACA,OAAOC,QAAP;AACA,OAAOC,OAAP;AACA,OAAOC,aAAP;AACA,OAAO,KAAKC,SAAZ;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,aAAZ;AACA,OAAOC,MAAP;AACA,OAAOC,QAAP,IAAmBC,KAAnB;AAEA,OAAO,SAASC,IAAT,CAAeC,MAAf,EAA+B;AACpCF,EAAAA,KAAK,CAACC,IAAN,CAAWC,MAAX;AAEAH,EAAAA,QAAQ,CAACI,GAAT,CAAaZ,0BAAb;AAEAQ,EAAAA,QAAQ,CAACI,GAAT,CAAaP,MAAb,EALoC,CAOpC;;AACAG,EAAAA,QAAQ,CAACI,GAAT,CAAaN,aAAb,EARoC,CAUpC;;AACAE,EAAAA,QAAQ,CAACI,GAAT,CAAaV,OAAb,EAXoC,CAapC;;AACAM,EAAAA,QAAQ,CAACI,GAAT,CAAaT,aAAb,EAdoC,CAgBpC;;AACAK,EAAAA,QAAQ,CAACI,GAAT,CAAab,SAAb,EAjBoC,CAmBpC;;AACAS,EAAAA,QAAQ,CAACI,GAAT,CAAaf,OAAb,EApBoC,CAsBpC;;AACA,OAAK,MAAMgB,IAAX,IAAmBT,SAAnB,EAA8B;AAC5B,UAAM;AAAEU,MAAAA,SAAF;AAAaC,MAAAA;AAAb,QAA0BX,SAAS,CAACS,IAAD,CAAzC;AAEEC,IAAAA,SAAD,CAAmBC,QAAnB,GAA8BA,QAA9B;AACCN,IAAAA,KAAK,CAACO,QAAN,CAAeC,SAAhB,CAAkCJ,IAAlC,IAA0CC,SAA1C;AACF,GA5BmC,CA8BpC;;;AACAN,EAAAA,QAAQ,CAACI,GAAT,CAAad,UAAb,EA/BoC,CAiCpC;;AACAU,EAAAA,QAAQ,CAACI,GAAT,CAAaL,MAAb,EAlCoC,CAoCpC;;AACA,MAAI,cAAyB,YAA7B,EAA2C;AACzCC,IAAAA,QAAQ,CAACI,GAAT,CAAaX,QAAb;AACD;;AAED,SAAOO,QAAP;AACD,C,CAED;;AACAA,QAAQ,CAACU,OAAT;AAEA,eAAeV,QAAf", + "sourcesContent": [ + "import * as actions from '@interactjs/actions/index'\nimport autoScroll from '@interactjs/auto-scroll/index'\nimport * as autoStart from '@interactjs/auto-start/index'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/index'\nimport inertia from '@interactjs/inertia/index'\nimport modifiersBase from '@interactjs/modifiers/base'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport offset from '@interactjs/offset'\nimport * as pointerEvents from '@interactjs/pointer-events/index'\nimport reflow from '@interactjs/reflow/index'\nimport interact, { scope } from './interact'\n\nexport function init (window: Window) {\n scope.init(window)\n\n interact.use(interactablePreventDefault)\n\n interact.use(offset)\n\n // pointerEvents\n interact.use(pointerEvents)\n\n // inertia\n interact.use(inertia)\n\n // snap, resize, etc.\n interact.use(modifiersBase)\n\n // autoStart, hold\n interact.use(autoStart)\n\n // drag and drop, resize, gesture\n interact.use(actions)\n\n // for backwrads compatibility\n for (const type in modifiers) {\n const { _defaults, _methods } = modifiers[type as keyof typeof modifiers]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n\n // autoScroll\n interact.use(autoScroll)\n\n // reflow\n interact.use(reflow)\n\n // eslint-disable-next-line no-undef\n if (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n }\n\n return interact\n}\n\n// eslint-disable-next-line no-undef\ninteract.version = process.env.npm_package_version\n\nexport default interact\n" + ] +} \ No newline at end of file diff --git a/@interactjs/interact/interact.d.ts b/@interactjs/interact/interact.d.ts new file mode 100644 index 000000000..05d37c515 --- /dev/null +++ b/@interactjs/interact/interact.d.ts @@ -0,0 +1,74 @@ +/** @module interact */ +import { Options } from '@interactjs/core/defaultOptions'; +import Interactable from '@interactjs/core/Interactable'; +import { Scope } from '@interactjs/core/scope'; +import * as utils from '@interactjs/utils/index'; +declare module '@interactjs/core/scope' { + interface Scope { + interact: InteractStatic; + } +} +export interface InteractStatic { + (target: Interact.Target, options?: Options): Interactable; + on: typeof on; + pointerMoveTolerance: typeof pointerMoveTolerance; + stop: typeof stop; + supportsPointerEvent: typeof supportsPointerEvent; + supportsTouch: typeof supportsTouch; + debug: typeof debug; + off: typeof off; + isSet: typeof isSet; + use: typeof use; + getPointerAverage: typeof utils.pointer.pointerAverage; + getTouchBBox: typeof utils.pointer.touchBBox; + getTouchDistance: typeof utils.pointer.touchDistance; + getTouchAngle: typeof utils.pointer.touchAngle; + getElementRect: typeof utils.dom.getElementRect; + getElementClientRect: typeof utils.dom.getElementClientRect; + matchesSelector: typeof utils.dom.matchesSelector; + closest: typeof utils.dom.closest; + addDocument: typeof scope.addDocument; + removeDocument: typeof scope.removeDocument; + dynamicDrop: (newValue?: boolean) => boolean | Interact.interact; + version: string; +} +declare const scope: Scope; +/** + * ```js + * interact('#draggable').draggable(true) + * + * var rectables = interact('rect') + * rectables + * .gesturable(true) + * .on('gesturemove', function (event) { + * // ... + * }) + * ``` + * + * The methods of this variable can be used to set elements as interactables + * and also to change various default settings. + * + * Calling it as a function and passing an element or a valid CSS selector + * string returns an Interactable object which has various methods to configure + * it. + * + * @global + * + * @param {Element | string} target The HTML or SVG Element to interact with + * or CSS selector + * @return {Interactable} + */ +export declare const interact: InteractStatic; +declare function use(plugin: Interact.Plugin, options?: { + [key: string]: any; +}): InteractStatic; +declare function isSet(target: Interact.Element, options?: any): boolean; +declare function on(type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object): InteractStatic; +declare function off(type: Interact.EventTypes, listener: any, options?: object): InteractStatic; +declare function debug(): Scope; +declare function supportsTouch(): boolean; +declare function supportsPointerEvent(): boolean; +declare function stop(): InteractStatic; +declare function pointerMoveTolerance(newValue?: number): number | InteractStatic; +export { scope }; +export default interact; diff --git a/@interactjs/interact/interact.js b/@interactjs/interact/interact.js new file mode 100644 index 000000000..3614df9e9 --- /dev/null +++ b/@interactjs/interact/interact.js @@ -0,0 +1,279 @@ +/** @module interact */ +import { isNonNativeEvent, Scope } from "../core/scope.js"; +import browser from "../utils/browser.js"; +import events from "../utils/events.js"; +import * as utils from "../utils/index.js"; +const globalEvents = {}; +const scope = new Scope(); +/** + * ```js + * interact('#draggable').draggable(true) + * + * var rectables = interact('rect') + * rectables + * .gesturable(true) + * .on('gesturemove', function (event) { + * // ... + * }) + * ``` + * + * The methods of this variable can be used to set elements as interactables + * and also to change various default settings. + * + * Calling it as a function and passing an element or a valid CSS selector + * string returns an Interactable object which has various methods to configure + * it. + * + * @global + * + * @param {Element | string} target The HTML or SVG Element to interact with + * or CSS selector + * @return {Interactable} + */ + +export const interact = function interact(target, options) { + let interactable = scope.interactables.get(target, options); + + if (!interactable) { + interactable = scope.interactables.new(target, options); + interactable.events.global = globalEvents; + } + + return interactable; +}; +/** + * Use a plugin + * + * @alias module:interact.use + * + * @param {Object} plugin + * @param {function} plugin.install + * @return {interact} + */ + +interact.use = use; + +function use(plugin, options) { + scope.usePlugin(plugin, options); + return interact; +} +/** + * Check if an element or selector has been set with the {@link interact} + * function + * + * @alias module:interact.isSet + * + * @param {Element} element The Element being searched for + * @return {boolean} Indicates if the element or CSS selector was previously + * passed to interact + */ + + +interact.isSet = isSet; + +function isSet(target, options) { + return !!scope.interactables.get(target, options && options.context); +} +/** + * Add a global listener for an InteractEvent or adds a DOM event to `document` + * + * @alias module:interact.on + * + * @param {string | array | object} type The types of events to listen for + * @param {function} listener The function event (s) + * @param {object | boolean} [options] object or useCapture flag for + * addEventListener + * @return {object} interact + */ + + +interact.on = on; + +function on(type, listener, options) { + if (utils.is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (utils.is.array(type)) { + for (const eventType of type) { + interact.on(eventType, listener, options); + } + + return interact; + } + + if (utils.is.object(type)) { + for (const prop in type) { + interact.on(prop, type[prop], listener); + } + + return interact; + } // if it is an InteractEvent type, add listener to globalEvents + + + if (isNonNativeEvent(type, scope.actions)) { + // if this type of event was never bound + if (!globalEvents[type]) { + globalEvents[type] = [listener]; + } else { + globalEvents[type].push(listener); + } + } // If non InteractEvent type, addEventListener to document + else { + events.add(scope.document, type, listener, { + options + }); + } + + return interact; +} +/** + * Removes a global InteractEvent listener or DOM event from `document` + * + * @alias module:interact.off + * + * @param {string | array | object} type The types of events that were listened + * for + * @param {function} listener The listener function to be removed + * @param {object | boolean} options [options] object or useCapture flag for + * removeEventListener + * @return {object} interact + */ + + +interact.off = off; + +function off(type, listener, options) { + if (utils.is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (utils.is.array(type)) { + for (const eventType of type) { + interact.off(eventType, listener, options); + } + + return interact; + } + + if (utils.is.object(type)) { + for (const prop in type) { + interact.off(prop, type[prop], listener); + } + + return interact; + } + + if (isNonNativeEvent(type, scope.actions)) { + let index; + + if (type in globalEvents && (index = globalEvents[type].indexOf(listener)) !== -1) { + globalEvents[type].splice(index, 1); + } + } else { + events.remove(scope.document, type, listener, options); + } + + return interact; +} + +interact.debug = debug; + +function debug() { + return scope; +} // expose the functions used to calculate multi-touch properties + + +interact.getPointerAverage = utils.pointer.pointerAverage; +interact.getTouchBBox = utils.pointer.touchBBox; +interact.getTouchDistance = utils.pointer.touchDistance; +interact.getTouchAngle = utils.pointer.touchAngle; +interact.getElementRect = utils.dom.getElementRect; +interact.getElementClientRect = utils.dom.getElementClientRect; +interact.matchesSelector = utils.dom.matchesSelector; +interact.closest = utils.dom.closest; +/** + * @alias module:interact.supportsTouch + * + * @return {boolean} Whether or not the browser supports touch input + */ + +interact.supportsTouch = supportsTouch; + +function supportsTouch() { + return browser.supportsTouch; +} +/** + * @alias module:interact.supportsPointerEvent + * + * @return {boolean} Whether or not the browser supports PointerEvents + */ + + +interact.supportsPointerEvent = supportsPointerEvent; + +function supportsPointerEvent() { + return browser.supportsPointerEvent; +} +/** + * Cancels all interactions (end events are not fired) + * + * @alias module:interact.stop + * + * @return {object} interact + */ + + +interact.stop = stop; + +function stop() { + for (const interaction of scope.interactions.list) { + interaction.stop(); + } + + return interact; +} +/** + * Returns or sets the distance the pointer must be moved before an action + * sequence occurs. This also affects tolerance for tap events. + * + * @alias module:interact.pointerMoveTolerance + * + * @param {number} [newValue] The movement from the start position must be greater than this value + * @return {interact | number} + */ + + +interact.pointerMoveTolerance = pointerMoveTolerance; + +function pointerMoveTolerance(newValue) { + if (utils.is.number(newValue)) { + scope.interactions.pointerMoveTolerance = newValue; + return interact; + } + + return scope.interactions.pointerMoveTolerance; +} + +scope.addListeners({ + 'interactable:unset': ({ + interactable + }) => { + scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1); // Stop related interactions when an Interactable is unset + + for (const interaction of scope.interactions.list) { + if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) { + interaction.stop(); + } + } + } +}); + +interact.addDocument = (doc, options) => scope.addDocument(doc, options); + +interact.removeDocument = doc => scope.removeDocument(doc); + +scope.interact = interact; +export { scope }; +export default interact; +//# sourceMappingURL=interact.js.map \ No newline at end of file diff --git a/@interactjs/interact/interact.js.map b/@interactjs/interact/interact.js.map new file mode 100644 index 000000000..272d3bc2b --- /dev/null +++ b/@interactjs/interact/interact.js.map @@ -0,0 +1,83 @@ +{ + "version": 3, + "sources": [ + "interact.ts" + ], + "names": [ + "isNonNativeEvent", + "Scope", + "browser", + "events", + "utils", + "globalEvents", + "scope", + "interact", + "target", + "options", + "interactable", + "interactables", + "get", + "new", + "global", + "use", + "plugin", + "usePlugin", + "isSet", + "context", + "on", + "type", + "listener", + "is", + "string", + "search", + "trim", + "split", + "array", + "eventType", + "object", + "prop", + "actions", + "push", + "add", + "document", + "off", + "index", + "indexOf", + "splice", + "remove", + "debug", + "getPointerAverage", + "pointer", + "pointerAverage", + "getTouchBBox", + "touchBBox", + "getTouchDistance", + "touchDistance", + "getTouchAngle", + "touchAngle", + "getElementRect", + "dom", + "getElementClientRect", + "matchesSelector", + "closest", + "supportsTouch", + "supportsPointerEvent", + "stop", + "interaction", + "interactions", + "list", + "pointerMoveTolerance", + "newValue", + "number", + "addListeners", + "interacting", + "_ending", + "addDocument", + "doc", + "removeDocument" + ], + "mappings": "AAAA;AAIA,SAASA,gBAAT,EAA2BC,KAA3B;AACA,OAAOC,OAAP;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,KAAZ;AAiCA,MAAMC,YAAiB,GAAG,EAA1B;AACA,MAAMC,KAAK,GAAG,IAAIL,KAAJ,EAAd;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,MAAMM,QAAwB,GAAG,S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N,CAAmBE,oBAA1B;AACD;;AAEDxD,KAAK,CAAC2D,YAAN,CAAmB;AACjB,wBAAsB,CAAC;AAAEvD,IAAAA;AAAF,GAAD,KAAsB;AAC1CJ,IAAAA,KAAK,CAACK,aAAN,CAAoBkD,IAApB,CAAyBtB,MAAzB,CAAgCjC,KAAK,CAACK,aAAN,CAAoBkD,IAApB,CAAyBvB,OAAzB,CAAiC5B,YAAjC,CAAhC,EAAgF,CAAhF,EAD0C,CAG1C;;AACA,SAAK,MAAMiD,WAAX,IAA0BrD,KAAK,CAACsD,YAAN,CAAmBC,IAA7C,EAAmD;AACjD,UAAIF,WAAW,CAACjD,YAAZ,KAA6BA,YAA7B,IAA6CiD,WAAW,CAACO,WAAZ,EAA7C,IAA0E,CAACP,WAAW,CAACQ,OAA3F,EAAoG;AAClGR,QAAAA,WAAW,CAACD,IAAZ;AACD;AACF;AACF;AAVgB,CAAnB;;AAaAnD,QAAQ,CAAC6D,WAAT,GAAuB,CAACC,GAAD,EAAM5D,OAAN,KAAkBH,KAAK,CAAC8D,WAAN,CAAkBC,GAAlB,EAAuB5D,OAAvB,CAAzC;;AACAF,QAAQ,CAAC+D,cAAT,GAA0BD,GAAG,IAAI/D,KAAK,CAACgE,cAAN,CAAqBD,GAArB,CAAjC;;AAEA/D,KAAK,CAACC,QAAN,GAAiBA,QAAjB;AAEA,SAASD,KAAT;AACA,eAAeC,QAAf", + "sourcesContent": [ + "/** @module interact */\n\nimport { Options } from '@interactjs/core/defaultOptions'\nimport Interactable from '@interactjs/core/Interactable'\nimport { isNonNativeEvent, Scope } from '@interactjs/core/scope'\nimport browser from '@interactjs/utils/browser'\nimport events from '@interactjs/utils/events'\nimport * as utils from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n interact: InteractStatic\n }\n}\n\nexport interface InteractStatic {\n (target: Interact.Target, options?: Options): Interactable\n on: typeof on\n pointerMoveTolerance: typeof pointerMoveTolerance\n stop: typeof stop\n supportsPointerEvent: typeof supportsPointerEvent\n supportsTouch: typeof supportsTouch\n debug: typeof debug\n off: typeof off\n isSet: typeof isSet\n use: typeof use\n getPointerAverage: typeof utils.pointer.pointerAverage\n getTouchBBox: typeof utils.pointer.touchBBox\n getTouchDistance: typeof utils.pointer.touchDistance\n getTouchAngle: typeof utils.pointer.touchAngle\n getElementRect: typeof utils.dom.getElementRect\n getElementClientRect: typeof utils.dom.getElementClientRect\n matchesSelector: typeof utils.dom.matchesSelector\n closest: typeof utils.dom.closest\n addDocument: typeof scope.addDocument\n removeDocument: typeof scope.removeDocument\n dynamicDrop: (newValue?: boolean) => boolean | Interact.interact\n version: string\n}\n\nconst globalEvents: any = {}\nconst scope = new Scope()\n\n/**\n * ```js\n * interact('#draggable').draggable(true)\n *\n * var rectables = interact('rect')\n * rectables\n * .gesturable(true)\n * .on('gesturemove', function (event) {\n * // ...\n * })\n * ```\n *\n * The methods of this variable can be used to set elements as interactables\n * and also to change various default settings.\n *\n * Calling it as a function and passing an element or a valid CSS selector\n * string returns an Interactable object which has various methods to configure\n * it.\n *\n * @global\n *\n * @param {Element | string} target The HTML or SVG Element to interact with\n * or CSS selector\n * @return {Interactable}\n */\nexport const interact: InteractStatic = function interact (target: Interact.Target, options?: any) {\n let interactable = scope.interactables.get(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = globalEvents\n }\n\n return interactable\n} as InteractStatic\n\n/**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n * @param {Object} plugin\n * @param {function} plugin.install\n * @return {interact}\n */\ninteract.use = use\nfunction use (plugin: Interact.Plugin, options?: { [key: string]: any }) {\n scope.usePlugin(plugin, options)\n\n return interact\n}\n\n/**\n * Check if an element or selector has been set with the {@link interact}\n * function\n *\n * @alias module:interact.isSet\n *\n * @param {Element} element The Element being searched for\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\ninteract.isSet = isSet\nfunction isSet (target: Interact.Element, options?: any) {\n return !!scope.interactables.get(target, options && options.context)\n}\n\n/**\n * Add a global listener for an InteractEvent or adds a DOM event to `document`\n *\n * @alias module:interact.on\n *\n * @param {string | array | object} type The types of events to listen for\n * @param {function} listener The function event (s)\n * @param {object | boolean} [options] object or useCapture flag for\n * addEventListener\n * @return {object} interact\n */\ninteract.on = on\nfunction on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of (type as any[])) {\n interact.on(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.on(prop, (type as any)[prop], listener)\n }\n\n return interact\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, scope.actions)) {\n // if this type of event was never bound\n if (!globalEvents[type]) {\n globalEvents[type] = [listener]\n }\n else {\n globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n events.add(scope.document, type, listener as Interact.Listener, { options })\n }\n\n return interact\n}\n\n/**\n * Removes a global InteractEvent listener or DOM event from `document`\n *\n * @alias module:interact.off\n *\n * @param {string | array | object} type The types of events that were listened\n * for\n * @param {function} listener The listener function to be removed\n * @param {object | boolean} options [options] object or useCapture flag for\n * removeEventListener\n * @return {object} interact\n */\ninteract.off = off\nfunction off (type: Interact.EventTypes, listener: any, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of type) {\n interact.off(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.off(prop, type[prop], listener)\n }\n\n return interact\n }\n\n if (isNonNativeEvent(type, scope.actions)) {\n let index\n\n if (type in globalEvents &&\n (index = globalEvents[type].indexOf(listener)) !== -1) {\n globalEvents[type].splice(index, 1)\n }\n }\n else {\n events.remove(scope.document, type, listener, options)\n }\n\n return interact\n}\n\ninteract.debug = debug\nfunction debug () {\n return scope\n}\n\n// expose the functions used to calculate multi-touch properties\ninteract.getPointerAverage = utils.pointer.pointerAverage\ninteract.getTouchBBox = utils.pointer.touchBBox\ninteract.getTouchDistance = utils.pointer.touchDistance\ninteract.getTouchAngle = utils.pointer.touchAngle\n\ninteract.getElementRect = utils.dom.getElementRect\ninteract.getElementClientRect = utils.dom.getElementClientRect\ninteract.matchesSelector = utils.dom.matchesSelector\ninteract.closest = utils.dom.closest\n\n/**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\ninteract.supportsTouch = supportsTouch\nfunction supportsTouch () {\n return browser.supportsTouch\n}\n\n/**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\ninteract.supportsPointerEvent = supportsPointerEvent\nfunction supportsPointerEvent () {\n return browser.supportsPointerEvent\n}\n\n/**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */\ninteract.stop = stop\nfunction stop () {\n for (const interaction of scope.interactions.list) {\n interaction.stop()\n }\n\n return interact\n}\n\n/**\n * Returns or sets the distance the pointer must be moved before an action\n * sequence occurs. This also affects tolerance for tap events.\n *\n * @alias module:interact.pointerMoveTolerance\n *\n * @param {number} [newValue] The movement from the start position must be greater than this value\n * @return {interact | number}\n */\ninteract.pointerMoveTolerance = pointerMoveTolerance\nfunction pointerMoveTolerance (newValue?: number) {\n if (utils.is.number(newValue)) {\n scope.interactions.pointerMoveTolerance = newValue\n\n return interact\n }\n\n return scope.interactions.pointerMoveTolerance\n}\n\nscope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1)\n\n // Stop related interactions when an Interactable is unset\n for (const interaction of scope.interactions.list) {\n if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) {\n interaction.stop()\n }\n }\n },\n})\n\ninteract.addDocument = (doc, options) => scope.addDocument(doc, options)\ninteract.removeDocument = doc => scope.removeDocument(doc)\n\nscope.interact = interact\n\nexport { scope }\nexport default interact\n" + ] +} \ No newline at end of file diff --git a/@interactjs/interact/interact.spec.d.ts b/@interactjs/interact/interact.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/interact/interact.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/interactjs/.npmignore b/@interactjs/interactjs/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/interactjs/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/interactjs/LICENSE b/@interactjs/interactjs/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/interactjs/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/interactjs/index.d.ts b/@interactjs/interactjs/index.d.ts new file mode 100644 index 000000000..ebd544dd3 --- /dev/null +++ b/@interactjs/interactjs/index.d.ts @@ -0,0 +1,13 @@ +import interact from '@interactjs/interact/index'; +import * as modifiers from '@interactjs/modifiers/index'; +import '@interactjs/types/index'; +import * as snappers from '@interactjs/utils/snappers/index'; +declare module '@interactjs/interact/interact' { + interface InteractStatic { + modifiers: typeof modifiers; + snappers: typeof snappers; + createSnapGrid: typeof snappers.grid; + } +} +export declare function init(win: Window): import("@interactjs/interact/interact").InteractStatic; +export default interact; diff --git a/@interactjs/interactjs/index.js b/@interactjs/interactjs/index.js new file mode 100644 index 000000000..3b568b970 --- /dev/null +++ b/@interactjs/interactjs/index.js @@ -0,0 +1,25 @@ +import interact, { init as initInteract } from "../interact/index.js"; +import * as modifiers from "../modifiers/index.js"; +import "../types/index.js"; +import extend from "../utils/extend.js"; +import * as snappers from "../utils/snappers/index.js"; + +if (typeof window === 'object' && !!window) { + init(window); +} + +export function init(win) { + initInteract(win); + return interact.use({ + id: 'interactjs', + + install() { + interact.modifiers = extend({}, modifiers); + interact.snappers = snappers; + interact.createSnapGrid = interact.snappers.grid; + } + + }); +} +export default interact; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/interactjs/index.js.map b/@interactjs/interactjs/index.js.map new file mode 100644 index 000000000..f58b53c35 --- /dev/null +++ b/@interactjs/interactjs/index.js.map @@ -0,0 +1,25 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "interact", + "init", + "initInteract", + "modifiers", + "extend", + "snappers", + "window", + "win", + "use", + "id", + "install", + "createSnapGrid", + "grid" + ], + "mappings": "AAAA,OAAOA,QAAP,IAAmBC,IAAI,IAAIC,YAA3B;AACA,OAAO,KAAKC,SAAZ;AACA;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,QAAZ;;AAUA,IAAI,OAAOC,MAAP,KAAkB,QAAlB,IAA8B,CAAC,CAACA,MAApC,EAA4C;AAC1CL,EAAAA,IAAI,CAACK,MAAD,CAAJ;AACD;;AAED,OAAO,SAASL,IAAT,CAAeM,GAAf,EAA4B;AACjCL,EAAAA,YAAY,CAACK,GAAD,CAAZ;AAEA,SAAOP,QAAQ,CAACQ,GAAT,CAAa;AAClBC,IAAAA,EAAE,EAAE,YADc;;AAElBC,IAAAA,OAAO,GAAI;AACTV,MAAAA,QAAQ,CAACG,SAAT,GAAqBC,MAAM,CAAC,EAAD,EAAKD,SAAL,CAA3B;AACAH,MAAAA,QAAQ,CAACK,QAAT,GAAoBA,QAApB;AACAL,MAAAA,QAAQ,CAACW,cAAT,GAA0BX,QAAQ,CAACK,QAAT,CAAkBO,IAA5C;AACD;;AANiB,GAAb,CAAP;AAQD;AAED,eAAeZ,QAAf", + "sourcesContent": [ + "import interact, { init as initInteract } from '@interactjs/interact/index'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport '@interactjs/types/index'\nimport extend from '@interactjs/utils/extend'\nimport * as snappers from '@interactjs/utils/snappers/index'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n modifiers: typeof modifiers\n snappers: typeof snappers\n createSnapGrid: typeof snappers.grid\n }\n}\n\nif (typeof window === 'object' && !!window) {\n init(window)\n}\n\nexport function init (win: Window) {\n initInteract(win)\n\n return interact.use({\n id: 'interactjs',\n install () {\n interact.modifiers = extend({}, modifiers)\n interact.snappers = snappers\n interact.createSnapGrid = interact.snappers.grid\n },\n })\n}\n\nexport default interact\n" + ] +} \ No newline at end of file diff --git a/@interactjs/modifiers/.npmignore b/@interactjs/modifiers/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/modifiers/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/modifiers/LICENSE b/@interactjs/modifiers/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/modifiers/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/modifiers/Modification.d.ts b/@interactjs/modifiers/Modification.d.ts new file mode 100644 index 000000000..1d67b70c0 --- /dev/null +++ b/@interactjs/modifiers/Modification.d.ts @@ -0,0 +1,71 @@ +import { Modifier, ModifierArg, ModifierState } from './base'; +export interface ModificationResult { + delta: Interact.Point; + rectDelta: Interact.Rect; + coords: Interact.Point; + rect: Interact.FullRect; + eventProps: any[]; + changed: boolean; +} +interface MethodArg { + phase: Interact.EventPhase; + pageCoords?: Interact.Point; + rect?: Interact.FullRect; + coords?: Interact.Point; + preEnd?: boolean; + skipModifiers?: number; +} +export default class Modification { + readonly interaction: Readonly; + states: ModifierState[]; + startOffset: Interact.Rect; + startDelta: Interact.Point; + result?: ModificationResult; + endResult?: Interact.Point; + edges: Interact.EdgeOptions; + constructor(interaction: Readonly); + start({ phase }: MethodArg, pageCoords: Interact.Point): ModificationResult; + fillArg(arg: Partial): void; + startAll(arg: MethodArg & Partial): void; + setAll(arg: MethodArg & Partial): ModificationResult; + applyToInteraction(arg: { + phase: Interact.EventPhase; + rect?: Interact.Rect; + }): void; + setAndApply(arg: Partial & { + phase: Interact.EventPhase; + preEnd?: boolean; + skipModifiers?: number; + modifiedCoords?: Interact.Point; + }): void | false; + beforeEnd(arg: Omit & { + state?: ModifierState; + }): void | false; + stop(arg: { + interaction: Interact.Interaction; + }): void; + prepareStates(modifierList: Modifier[]): { + options: {}; + methods?: { + start?: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd?: (arg: ModifierArg) => void | import("@interactjs/types/types").Point; + stop?: (arg: ModifierArg) => void; + }; + index?: number; + name?: any; + }[]; + restoreInteractionCoords({ interaction: { coords, rect, modification } }: { + interaction: Interact.Interaction; + }): void; + shouldDo(options: any, preEnd?: boolean, phase?: string): any; + copyFrom(other: Modification): void; + destroy(): void; +} +export declare function getRectOffset(rect: any, coords: any): { + left: number; + top: number; + right: number; + bottom: number; +}; +export {}; diff --git a/@interactjs/modifiers/Modification.js b/@interactjs/modifiers/Modification.js new file mode 100644 index 000000000..af453836f --- /dev/null +++ b/@interactjs/modifiers/Modification.js @@ -0,0 +1,392 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import clone from "../utils/clone.js"; +import extend from "../utils/extend.js"; +import * as rectUtils from "../utils/rect.js"; +export default class Modification { + constructor(interaction) { + this.interaction = interaction; + + _defineProperty(this, "states", []); + + _defineProperty(this, "startOffset", { + left: 0, + right: 0, + top: 0, + bottom: 0 + }); + + _defineProperty(this, "startDelta", null); + + _defineProperty(this, "result", null); + + _defineProperty(this, "endResult", null); + + _defineProperty(this, "edges", void 0); + } + + start({ + phase + }, pageCoords) { + const { + interaction + } = this; + const modifierList = getModifierList(interaction); + this.prepareStates(modifierList); + this.edges = extend({}, interaction.edges); + this.startOffset = getRectOffset(interaction.rect, pageCoords); + this.startDelta = { + x: 0, + y: 0 + }; + const arg = { + phase, + pageCoords, + preEnd: false + }; + this.result = createResult(); + this.startAll(arg); + const result = this.result = this.setAll(arg); + return result; + } + + fillArg(arg) { + const { + interaction + } = this; + arg.interaction = interaction; + arg.interactable = interaction.interactable; + arg.element = interaction.element; + arg.rect = arg.rect || interaction.rect; + arg.edges = this.edges; + arg.startOffset = this.startOffset; + } + + startAll(arg) { + this.fillArg(arg); + + for (const state of this.states) { + if (state.methods.start) { + arg.state = state; + state.methods.start(arg); + } + } + } + + setAll(arg) { + this.fillArg(arg); + const { + phase, + preEnd, + skipModifiers, + rect: unmodifiedRect + } = arg; + arg.coords = extend({}, arg.pageCoords); + arg.rect = extend({}, unmodifiedRect); + const states = skipModifiers ? this.states.slice(skipModifiers) : this.states; + const newResult = createResult(arg.coords, arg.rect); + + for (const state of states) { + const { + options + } = state; + const lastModifierCoords = extend({}, arg.coords); + let returnValue = null; + + if (state.methods.set && this.shouldDo(options, preEnd, phase)) { + arg.state = state; + returnValue = state.methods.set(arg); + rectUtils.addEdges(this.interaction.edges, arg.rect, { + x: arg.coords.x - lastModifierCoords.x, + y: arg.coords.y - lastModifierCoords.y + }); + } + + newResult.eventProps.push(returnValue); + } + + newResult.delta.x = arg.coords.x - arg.pageCoords.x; + newResult.delta.y = arg.coords.y - arg.pageCoords.y; + newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left; + newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right; + newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top; + newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom; + const prevCoords = this.result.coords; + const prevRect = this.result.rect; + const rectChanged = !prevRect || newResult.rect.left !== prevRect.left || newResult.rect.right !== prevRect.right || newResult.rect.top !== prevRect.top || newResult.rect.bottom !== prevRect.bottom; + newResult.changed = rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y; + newResult.rect = arg.rect; + return newResult; + } + + applyToInteraction(arg) { + const { + interaction + } = this; + const { + phase + } = arg; + const curCoords = interaction.coords.cur; + const startCoords = interaction.coords.start; + const { + result, + startDelta + } = this; + const curDelta = result.delta; + + if (phase === 'start') { + extend(this.startDelta, result.delta); + } + + for (const [coordsSet, delta] of [[startCoords, startDelta], [curCoords, curDelta]]) { + coordsSet.page.x += delta.x; + coordsSet.page.y += delta.y; + coordsSet.client.x += delta.x; + coordsSet.client.y += delta.y; + } + + const { + rectDelta + } = this.result; + const rect = arg.rect || interaction.rect; + rect.left += rectDelta.left; + rect.right += rectDelta.right; + rect.top += rectDelta.top; + rect.bottom += rectDelta.bottom; + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + + setAndApply(arg) { + const { + interaction + } = this; + const { + phase, + preEnd, + skipModifiers + } = arg; + const result = this.setAll({ + preEnd, + phase, + pageCoords: arg.modifiedCoords || interaction.coords.cur.page + }); + this.result = result; // don't fire an action move if a modifier would keep the event in the same + // cordinates as before + + if (!result.changed && (!skipModifiers || skipModifiers < this.states.length) && interaction.interacting()) { + return false; + } + + if (arg.modifiedCoords) { + const { + page + } = interaction.coords.cur; + const adjustment = { + x: arg.modifiedCoords.x - page.x, + y: arg.modifiedCoords.y - page.y + }; + result.coords.x += adjustment.x; + result.coords.y += adjustment.y; + result.delta.x += adjustment.x; + result.delta.y += adjustment.y; + } + + this.applyToInteraction(arg); + } + + beforeEnd(arg) { + const { + interaction, + event + } = arg; + const states = this.states; + + if (!states || !states.length) { + return; + } + + let doPreend = false; + + for (const state of states) { + arg.state = state; + const { + options, + methods + } = state; + const endPosition = methods.beforeEnd && methods.beforeEnd(arg); + + if (endPosition) { + this.endResult = endPosition; + return false; + } + + doPreend = doPreend || !doPreend && this.shouldDo(options, true); + } + + if (!doPreend) { + // trigger a final modified move before ending + interaction.move({ + event, + preEnd: true + }); + } + } + + stop(arg) { + const { + interaction + } = arg; + + if (!this.states || !this.states.length) { + return; + } + + const modifierArg = extend({ + states: this.states, + interactable: interaction.interactable, + element: interaction.element, + rect: null + }, arg); + this.fillArg(modifierArg); + + for (const state of this.states) { + modifierArg.state = state; + + if (state.methods.stop) { + state.methods.stop(modifierArg); + } + } + + this.states = null; + this.endResult = null; + } + + prepareStates(modifierList) { + this.states = []; + + for (let index = 0; index < modifierList.length; index++) { + const { + options, + methods, + name + } = modifierList[index]; + + if (options && options.enabled === false) { + continue; + } + + this.states.push({ + options, + methods, + index, + name + }); + } + + return this.states; + } + + restoreInteractionCoords({ + interaction: { + coords, + rect, + modification + } + }) { + if (!modification.result) { + return; + } + + const { + startDelta + } = modification; + const { + delta: curDelta, + rectDelta + } = modification.result; + const coordsAndDeltas = [[coords.start, startDelta], [coords.cur, curDelta]]; + + for (const [coordsSet, delta] of coordsAndDeltas) { + coordsSet.page.x -= delta.x; + coordsSet.page.y -= delta.y; + coordsSet.client.x -= delta.x; + coordsSet.client.y -= delta.y; + } + + rect.left -= rectDelta.left; + rect.right -= rectDelta.right; + rect.top -= rectDelta.top; + rect.bottom -= rectDelta.bottom; + } + + shouldDo(options, preEnd, phase) { + return options ? options.enabled !== false && (preEnd || !options.endOnly) && (options.setStart || phase !== 'start') : true; + } + + copyFrom(other) { + this.startOffset = other.startOffset; + this.startDelta = other.startDelta; + this.edges = other.edges; + this.states = other.states.map(s => clone(s)); + this.result = createResult(extend({}, other.result.coords), extend({}, other.result.rect)); + } + + destroy() { + for (const prop in this) { + this[prop] = null; + } + } + +} + +function createResult(coords, rect) { + return { + rect, + coords, + delta: { + x: 0, + y: 0 + }, + rectDelta: { + left: 0, + right: 0, + top: 0, + bottom: 0 + }, + eventProps: [], + changed: true + }; +} + +function getModifierList(interaction) { + const actionOptions = interaction.interactable.options[interaction.prepared.name]; + const actionModifiers = actionOptions.modifiers; + + if (actionModifiers && actionModifiers.length) { + return actionModifiers.filter(modifier => !modifier.options || modifier.options.enabled !== false); + } + + return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize'].map(type => { + const options = actionOptions[type]; + return options && options.enabled && { + options, + methods: options._methods + }; + }).filter(m => !!m); +} + +export function getRectOffset(rect, coords) { + return rect ? { + left: coords.x - rect.left, + top: coords.y - rect.top, + right: rect.right - coords.x, + bottom: rect.bottom - coords.y + } : { + left: 0, + top: 0, + right: 0, + bottom: 0 + }; +} +//# sourceMappingURL=Modification.js.map \ No newline at end of file diff --git a/@interactjs/modifiers/Modification.js.map b/@interactjs/modifiers/Modification.js.map new file mode 100644 index 000000000..cd2775e58 --- /dev/null +++ b/@interactjs/modifiers/Modification.js.map @@ -0,0 +1,112 @@ +{ + "version": 3, + "sources": [ + "Modification.ts" + ], + "names": [ + "clone", + "extend", + "rectUtils", + "Modification", + "constructor", + "interaction", + "left", + "right", + "top", + "bottom", + "start", + "phase", + "pageCoords", + "modifierList", + "getModifierList", + "prepareStates", + "edges", + "startOffset", + "getRectOffset", + "rect", + "startDelta", + "x", + "y", + "arg", + "preEnd", + "result", + "createResult", + "startAll", + "setAll", + "fillArg", + "interactable", + "element", + "state", + "states", + "methods", + "skipModifiers", + "unmodifiedRect", + "coords", + "slice", + "newResult", + "options", + "lastModifierCoords", + "returnValue", + "set", + "shouldDo", + "addEdges", + "eventProps", + "push", + "delta", + "rectDelta", + "prevCoords", + "prevRect", + "rectChanged", + "changed", + "applyToInteraction", + "curCoords", + "cur", + "startCoords", + "curDelta", + "coordsSet", + "page", + "client", + "width", + "height", + "setAndApply", + "modifiedCoords", + "length", + "interacting", + "adjustment", + "beforeEnd", + "event", + "doPreend", + "endPosition", + "endResult", + "move", + "stop", + "modifierArg", + "index", + "name", + "enabled", + "restoreInteractionCoords", + "modification", + "coordsAndDeltas", + "endOnly", + "setStart", + "copyFrom", + "other", + "map", + "s", + "destroy", + "prop", + "actionOptions", + "prepared", + "actionModifiers", + "modifiers", + "filter", + "modifier", + "type", + "_methods", + "m" + ], + "mappings": ";;AAAA,OAAOA,KAAP;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,SAAZ;AAqBA,eAAe,MAAMC,YAAN,CAAmB;AAQhCC,EAAAA,WAAW,CAAWC,WAAX,EAAwD;AAAA,SAA7CA,WAA6C,GAA7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", + "sourcesContent": [ + "import clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { Modifier, ModifierArg, ModifierState } from './base'\n\nexport interface ModificationResult {\n delta: Interact.Point\n rectDelta: Interact.Rect\n coords: Interact.Point\n rect: Interact.FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: Interact.EventPhase\n pageCoords?: Interact.Point\n rect?: Interact.FullRect\n coords?: Interact.Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Interact.Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta: Interact.Point = null\n result?: ModificationResult = null\n endResult?: Interact.Point = null\n edges: Interact.EdgeOptions\n\n constructor (readonly interaction: Readonly) {}\n\n start (\n { phase }: MethodArg,\n pageCoords: Interact.Point,\n ) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.edges = extend({}, interaction.edges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg: MethodArg = {\n phase,\n pageCoords,\n preEnd: false,\n }\n\n this.result = createResult()\n this.startAll(arg)\n\n const result = this.result = this.setAll(arg)\n\n return result\n }\n\n fillArg (arg: Partial) {\n const { interaction } = this\n\n arg.interaction = interaction\n arg.interactable = interaction.interactable\n arg.element = interaction.element\n arg.rect = arg.rect || interaction.rect\n arg.edges = this.edges\n arg.startOffset = this.startOffset\n }\n\n startAll (arg: MethodArg & Partial) {\n this.fillArg(arg)\n\n for (const state of this.states) {\n if (state.methods.start) {\n arg.state = state\n state.methods.start(arg as ModifierArg)\n }\n }\n }\n\n setAll (arg: MethodArg & Partial): ModificationResult {\n this.fillArg(arg)\n\n const {\n phase,\n preEnd,\n skipModifiers,\n rect: unmodifiedRect,\n } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n\n const states = skipModifiers\n ? this.states.slice(skipModifiers)\n : this.states\n\n const newResult = createResult(arg.coords, arg.rect)\n\n for (const state of states) {\n const { options } = state\n const lastModifierCoords = extend({}, arg.coords)\n let returnValue = null\n\n if (state.methods.set && this.shouldDo(options, preEnd, phase)) {\n arg.state = state\n returnValue = state.methods.set(arg as ModifierArg)\n\n rectUtils.addEdges(this.interaction.edges, arg.rect, { x: arg.coords.x - lastModifierCoords.x, y: arg.coords.y - lastModifierCoords.y })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n newResult.delta.x = arg.coords.x - arg.pageCoords.x\n newResult.delta.y = arg.coords.y - arg.pageCoords.y\n\n newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left\n newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right\n newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top\n newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom\n\n const prevCoords = this.result.coords\n const prevRect = this.result.rect\n const rectChanged = !prevRect || newResult.rect.left !== prevRect.left ||\n newResult.rect.right !== prevRect.right ||\n newResult.rect.top !== prevRect.top ||\n newResult.rect.bottom !== prevRect.bottom\n\n newResult.changed = rectChanged ||\n prevCoords.x !== newResult.coords.x ||\n prevCoords.y !== newResult.coords.y\n\n newResult.rect = arg.rect\n return newResult\n }\n\n applyToInteraction (arg: { phase: Interact.EventPhase, rect?: Interact.Rect }) {\n const { interaction } = this\n const { phase } = arg\n const curCoords = interaction.coords.cur\n const startCoords = interaction.coords.start\n const { result, startDelta } = this\n const curDelta = result.delta\n\n if (phase === 'start') {\n extend(this.startDelta, result.delta)\n }\n\n for (const [coordsSet, delta] of [[startCoords, startDelta], [curCoords, curDelta]] as const) {\n coordsSet.page.x += delta.x\n coordsSet.page.y += delta.y\n coordsSet.client.x += delta.x\n coordsSet.client.y += delta.y\n }\n\n const { rectDelta } = this.result\n const rect = arg.rect || interaction.rect\n\n rect.left += rectDelta.left\n rect.right += rectDelta.right\n rect.top += rectDelta.top\n rect.bottom += rectDelta.bottom\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n setAndApply (arg: Partial & {\n phase: Interact.EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Interact.Point\n }): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n })\n\n this.result = result\n\n // don't fire an action move if a modifier would keep the event in the same\n // cordinates as before\n if (!result.changed && (!skipModifiers || skipModifiers < this.states.length) && interaction.interacting()) {\n return false\n }\n\n if (arg.modifiedCoords) {\n const { page } = interaction.coords.cur\n const adjustment = {\n x: arg.modifiedCoords.x - page.x,\n y: arg.modifiedCoords.y - page.y,\n }\n\n result.coords.x += adjustment.x\n result.coords.y += adjustment.y\n result.delta.x += adjustment.x\n result.delta.y += adjustment.y\n }\n\n this.applyToInteraction(arg)\n }\n\n beforeEnd (arg: Omit & { state?: ModifierState }): void | false {\n const { interaction, event } = arg\n const states = this.states\n\n if (!states || !states.length) {\n return\n }\n\n let doPreend = false\n\n for (const state of states) {\n arg.state = state\n const { options, methods } = state\n\n const endPosition = methods.beforeEnd && methods.beforeEnd(arg as unknown as ModifierArg)\n\n if (endPosition) {\n this.endResult = endPosition\n return false\n }\n\n doPreend = doPreend || (!doPreend && this.shouldDo(options, true))\n }\n\n if (!doPreend) {\n // trigger a final modified move before ending\n interaction.move({ event, preEnd: true })\n }\n }\n\n stop (arg: { interaction: Interact.Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend({\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n }, arg)\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) { state.methods.stop(modifierArg as ModifierArg) }\n }\n\n this.states = null\n this.endResult = null\n }\n\n prepareStates (modifierList: Modifier[]) {\n this.states = []\n\n for (let index = 0; index < modifierList.length; index++) {\n const { options, methods, name } = modifierList[index]\n\n if (options && options.enabled === false) { continue }\n\n this.states.push({\n options,\n methods,\n index,\n name,\n })\n }\n\n return this.states\n }\n\n restoreInteractionCoords ({ interaction: { coords, rect, modification } }: { interaction: Interact.Interaction }) {\n if (!modification.result) { return }\n\n const { startDelta } = modification\n const { delta: curDelta, rectDelta } = modification.result\n\n const coordsAndDeltas = [\n [coords.start, startDelta],\n [coords.cur, curDelta],\n ]\n\n for (const [coordsSet, delta] of coordsAndDeltas as any) {\n coordsSet.page.x -= delta.x\n coordsSet.page.y -= delta.y\n coordsSet.client.x -= delta.x\n coordsSet.client.y -= delta.y\n }\n\n rect.left -= rectDelta.left\n rect.right -= rectDelta.right\n rect.top -= rectDelta.top\n rect.bottom -= rectDelta.bottom\n }\n\n shouldDo (options, preEnd?: boolean, phase?: string) {\n return options\n ? options.enabled !== false &&\n (preEnd || !options.endOnly) &&\n (options.setStart || phase !== 'start')\n : true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.edges = other.edges\n this.states = other.states.map(s => clone(s) as ModifierState)\n this.result = createResult(extend({}, other.result.coords), extend({}, other.result.rect))\n }\n\n destroy () {\n for (const prop in this) {\n this[prop] = null\n }\n }\n}\n\nfunction createResult (coords?: Interact.Point, rect?: Interact.FullRect): ModificationResult {\n return {\n rect,\n coords,\n delta: { x: 0, y: 0 },\n rectDelta: {\n left : 0,\n right : 0,\n top : 0,\n bottom: 0,\n },\n eventProps: [],\n changed: true,\n }\n}\n\nfunction getModifierList (interaction) {\n const actionOptions = interaction.interactable.options[interaction.prepared.name]\n const actionModifiers = actionOptions.modifiers\n\n if (actionModifiers && actionModifiers.length) {\n return actionModifiers.filter(\n modifier => !modifier.options || modifier.options.enabled !== false,\n )\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map(type => {\n const options = actionOptions[type]\n\n return options && options.enabled && {\n options,\n methods: options._methods,\n }\n })\n .filter(m => !!m)\n}\n\nexport function getRectOffset (rect, coords) {\n return rect\n ? {\n left : coords.x - rect.left,\n top : coords.y - rect.top,\n right : rect.right - coords.x,\n bottom: rect.bottom - coords.y,\n }\n : {\n left : 0,\n top : 0,\n right : 0,\n bottom: 0,\n }\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/modifiers/aspectRatio.d.ts b/@interactjs/modifiers/aspectRatio.d.ts new file mode 100644 index 000000000..969638314 --- /dev/null +++ b/@interactjs/modifiers/aspectRatio.d.ts @@ -0,0 +1,20 @@ +import { Modifier, ModifierModule, ModifierState } from './base'; +import Modification from './Modification'; +export interface AspectRatioOptions { + ratio?: number | 'preserve'; + equalDelta?: boolean; + modifiers?: Modifier[]; + enabled?: boolean; +} +export declare type AspectRatioState = ModifierState; +declare const aspectRatio: ModifierModule; +export default aspectRatio; diff --git a/@interactjs/modifiers/aspectRatio.js b/@interactjs/modifiers/aspectRatio.js new file mode 100644 index 000000000..e6ca0ebef --- /dev/null +++ b/@interactjs/modifiers/aspectRatio.js @@ -0,0 +1,150 @@ +/* eslint-disable */ + +/** + * @module modifiers/aspectRatio + * + * @description + * This module forces elements to be resized with a specified dx/dy ratio. + * + * @example + * interact(target).resizable({ + * modifiers: [ + * interact.modifiers.snapSize({ + * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ], + * }), + * interact.aspectRatio({ ratio: 'preserve' }), + * ], + * }); + */ +import extend from "../utils/extend.js"; +import { addEdges } from "../utils/rect.js"; +import Modification from "./Modification.js"; +const aspectRatio = { + start(arg) { + const { + state, + rect, + edges: originalEdges, + pageCoords: coords + } = arg; + let { + ratio + } = state.options; + const { + equalDelta, + modifiers + } = state.options; + + if (ratio === 'preserve') { + ratio = rect.width / rect.height; + } + + state.startCoords = extend({}, coords); + state.startRect = extend({}, rect); + state.ratio = ratio; + state.equalDelta = equalDelta; + const linkedEdges = state.linkedEdges = { + top: originalEdges.top || originalEdges.left && !originalEdges.bottom, + left: originalEdges.left || originalEdges.top && !originalEdges.right, + bottom: originalEdges.bottom || originalEdges.right && !originalEdges.top, + right: originalEdges.right || originalEdges.bottom && !originalEdges.left + }; + state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right); + + if (state.equalDelta) { + state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1); + } else { + const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left; + state.edgeSign = negativeSecondaryEdge ? -1 : 1; + } + + extend(arg.edges, linkedEdges); + + if (!modifiers || !modifiers.length) { + return; + } + + const subModification = new Modification(arg.interaction); + subModification.copyFrom(arg.interaction.modification); + subModification.prepareStates(modifiers); + state.subModification = subModification; + subModification.startAll({ ...arg + }); + }, + + set(arg) { + const { + state, + rect, + coords + } = arg; + const initialCoords = extend({}, coords); + const aspectMethod = state.equalDelta ? setEqualDelta : setRatio; + aspectMethod(state, state.xIsPrimaryAxis, coords, rect); + + if (!state.subModification) { + return null; + } + + const correctedRect = extend({}, rect); + addEdges(state.linkedEdges, correctedRect, { + x: coords.x - initialCoords.x, + y: coords.y - initialCoords.y + }); + const result = state.subModification.setAll({ ...arg, + rect: correctedRect, + edges: state.linkedEdges, + pageCoords: coords, + prevCoords: coords, + prevRect: correctedRect + }); + const { + delta + } = result; + + if (result.changed) { + const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y); // do aspect modification again with critical edge axis as primary + + aspectMethod(state, xIsCriticalAxis, result.coords, result.rect); + extend(coords, result.coords); + } + + return result.eventProps; + }, + + defaults: { + ratio: 'preserve', + equalDelta: false, + modifiers: [], + enabled: false + } +}; + +function setEqualDelta({ + startCoords, + edgeSign +}, xIsPrimaryAxis, coords) { + if (xIsPrimaryAxis) { + coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign; + } else { + coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign; + } +} + +function setRatio({ + startRect, + startCoords, + ratio, + edgeSign +}, xIsPrimaryAxis, coords, rect) { + if (xIsPrimaryAxis) { + const newHeight = rect.width / ratio; + coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign; + } else { + const newWidth = rect.height * ratio; + coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign; + } +} + +export default aspectRatio; +//# sourceMappingURL=aspectRatio.js.map \ No newline at end of file diff --git a/@interactjs/modifiers/aspectRatio.js.map b/@interactjs/modifiers/aspectRatio.js.map new file mode 100644 index 000000000..0b4aa366a --- /dev/null +++ b/@interactjs/modifiers/aspectRatio.js.map @@ -0,0 +1,69 @@ +{ + "version": 3, + "sources": [ + "aspectRatio.ts" + ], + "names": [ + "extend", + "addEdges", + "Modification", + "aspectRatio", + "start", + "arg", + "state", + "rect", + "edges", + "originalEdges", + "pageCoords", + "coords", + "ratio", + "options", + "equalDelta", + "modifiers", + "width", + "height", + "startCoords", + "startRect", + "linkedEdges", + "top", + "left", + "bottom", + "right", + "xIsPrimaryAxis", + "edgeSign", + "negativeSecondaryEdge", + "length", + "subModification", + "interaction", + "copyFrom", + "modification", + "prepareStates", + "startAll", + "set", + "initialCoords", + "aspectMethod", + "setEqualDelta", + "setRatio", + "correctedRect", + "x", + "y", + "result", + "setAll", + "prevCoords", + "prevRect", + "delta", + "changed", + "xIsCriticalAxis", + "Math", + "abs", + "eventProps", + "defaults", + "enabled", + "newHeight", + "newWidth" + ], + "mappings": "AAAA;;AAEA;;;;;;;;;;;;;;;;AAiBA,OAAOA,MAAP;AACA,SAASC,QAAT;AAEA,OAAOC,YAAP;AAoBA,MAAMC,WAAiE,GAAG;AACxEC,EAAAA,KAAK,CAAEC,GAAF,EAAO;AACV,UAAM;AAAEC,MAAAA,KAAF;AAASC,MAAAA,IAAT;AAAeC,MAAAA,KAAK,EAAEC,aAAtB;AAAqCC,MAAAA,UAAU,EAAEC;AAAjD,QAA4DN,GAAlE;AACA,QAAI;AAAEO,MAAAA;AAAF,QAAYN,KAAK,CAACO,OAAtB;AACA,UAAM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Af,CAAxB,EAAqED,cAArE,EAA8Fd,MAA9F,EAAsH;AACpH,MAAIc,cAAJ,EAAoB;AAClBd,IAAAA,MAAM,CAAC+B,CAAP,GAAWxB,WAAW,CAACwB,CAAZ,GAAgB,CAAC/B,MAAM,CAAC8B,CAAP,GAAWvB,WAAW,CAACuB,CAAxB,IAA6Bf,QAAxD;AACD,GAFD,MAGK;AACHf,IAAAA,MAAM,CAAC8B,CAAP,GAAWvB,WAAW,CAACuB,CAAZ,GAAgB,CAAC9B,MAAM,CAAC+B,CAAP,GAAWxB,WAAW,CAACwB,CAAxB,IAA6BhB,QAAxD;AACD;AACF;;AAED,SAASa,QAAT,CAAmB;AAAEpB,EAAAA,SAAF;AAAaD,EAAAA,WAAb;AAA0BN,EAAAA,KAA1B;AAAiCc,EAAAA;AAAjC,CAAnB,EAAkFD,cAAlF,EAA2Gd,MAA3G,EAAmIJ,IAAnI,EAAwJ;AACtJ,MAAIkB,cAAJ,EAAoB;AAClB,UAAM8B,SAAS,GAAGhD,IAAI,CAACS,KAAL,GAAaJ,KAA/B;AAEAD,IAAAA,MAAM,CAAC+B,CAAP,GAAWxB,WAAW,CAACwB,CAAZ,GAAgB,CAACa,SAAS,GAAGpC,SAAS,CAACF,MAAvB,IAAiCS,QAA5D;AACD,GAJD,MAKK;AACH,UAAM8B,QAAQ,GAAGjD,IAAI,CAACU,MAAL,GAAcL,KAA/B;AAEAD,IAAAA,MAAM,CAAC8B,CAAP,GAAWvB,WAAW,CAACuB,CAAZ,GAAgB,CAACe,QAAQ,GAAGrC,SAAS,CAACH,KAAtB,IAA+BU,QAA1D;AACD;AACF;;AAED,eAAevB,WAAf", + "sourcesContent": [ + "/* eslint-disable */\n\n/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * @example\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n */\n\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\nimport { Modifier, ModifierModule, ModifierState } from './base'\nimport Modification from './Modification'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges: originalEdges, pageCoords: coords } = arg\n let { ratio } = state.options\n const { equalDelta, modifiers } = state.options\n\n if (ratio === 'preserve') {\n ratio = rect.width / rect.height\n }\n\n state.startCoords = extend({}, coords)\n state.startRect = extend({}, rect)\n state.ratio = ratio\n state.equalDelta = equalDelta\n\n const linkedEdges = state.linkedEdges = {\n top : originalEdges.top || (originalEdges.left && !originalEdges.bottom),\n left : originalEdges.left || (originalEdges.top && !originalEdges.right),\n bottom: originalEdges.bottom || (originalEdges.right && !originalEdges.top),\n right : originalEdges.right || (originalEdges.bottom && !originalEdges.left),\n }\n\n state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)\n\n if (state.equalDelta) {\n state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1) as 1 | -1\n }\n else {\n const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left\n state.edgeSign = negativeSecondaryEdge ? -1 : 1\n }\n\n extend(arg.edges, linkedEdges)\n\n if (!modifiers || !modifiers.length) { return }\n\n const subModification = new Modification(arg.interaction)\n\n subModification.copyFrom(arg.interaction.modification)\n subModification.prepareStates(modifiers)\n\n state.subModification = subModification\n subModification.startAll({ ...arg })\n },\n\n set (arg) {\n const { state, rect, coords } = arg\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) { return null }\n\n const correctedRect = extend({}, rect)\n\n addEdges(state.linkedEdges, correctedRect, { x: coords.x - initialCoords.x, y: coords.y - initialCoords.y })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: state.linkedEdges,\n pageCoords: coords,\n prevCoords: coords,\n prevRect: correctedRect,\n })\n\n const { delta } = result\n\n if (result.changed) {\n const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y)\n\n // do aspect modification again with critical edge axis as primary\n aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)\n extend(coords, result.coords)\n }\n\n return result.eventProps\n },\n\n defaults: {\n ratio: 'preserve',\n equalDelta: false,\n modifiers: [],\n enabled: false,\n },\n}\n\nfunction setEqualDelta ({ startCoords, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign\n }\n else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign\n }\n}\n\nfunction setRatio ({ startRect, startCoords, ratio, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point, rect: Interact.Rect) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign\n }\n else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign\n }\n}\n\nexport default aspectRatio\n" + ] +} \ No newline at end of file diff --git a/@interactjs/modifiers/aspectRatio.spec.d.ts b/@interactjs/modifiers/aspectRatio.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/modifiers/aspectRatio.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/modifiers/base.d.ts b/@interactjs/modifiers/base.d.ts new file mode 100644 index 000000000..33b6962ef --- /dev/null +++ b/@interactjs/modifiers/base.d.ts @@ -0,0 +1,84 @@ +import Modification from './Modification'; +declare module '@interactjs/core/scope' { + interface Scope { + modifiers?: any; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + modification?: Modification; + } +} +declare module '@interactjs/core/InteractEvent' { + interface InteractEvent { + modifiers?: Array<{ + name: string; + [key: string]: any; + }>; + } +} +declare module '@interactjs/core/defaultOptions' { + interface PerActionDefaults { + modifiers?: Modifier[]; + } +} +export interface Modifier { + options?: Defaults; + methods: { + start?: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => void; + beforeEnd?: (arg: ModifierArg) => Interact.Point | void; + stop?: (arg: ModifierArg) => void; + }; + name?: Name; +} +export declare type ModifierState = { + options: Defaults; + methods?: Modifier['methods']; + index?: number; + name?: Name; +} & StateProps; +export interface ModifierArg { + interaction: Interact.Interaction; + interactable: Interact.Interactable; + phase: Interact.EventPhase; + rect: Interact.FullRect; + edges: Interact.EdgeOptions; + state?: State; + element: Interact.Element; + pageCoords?: Interact.Point; + prevCoords?: Interact.Point; + prevRect?: Interact.FullRect; + coords?: Interact.Point; + startOffset?: Interact.Rect; + preEnd?: boolean; +} +export interface ModifierModule { + defaults?: Defaults; + start?(arg: ModifierArg): void; + set?(arg: ModifierArg): any; + beforeEnd?(arg: ModifierArg): Interact.Point | void; + stop?(arg: ModifierArg): void; +} +export declare function makeModifier(module: ModifierModule, name?: Name): { + (_options?: Partial): Modifier; + _defaults: Defaults; + _methods: { + start: (arg: ModifierArg) => void; + set: (arg: ModifierArg) => any; + beforeEnd: (arg: ModifierArg) => void | import("@interactjs/types/types").Point; + stop: (arg: ModifierArg) => void; + }; +}; +export declare function addEventModifiers({ iEvent, interaction: { modification: { result } } }: { + iEvent: Interact.InteractEvent; + interaction: Interact.Interaction; +}): void; +declare const modifiersBase: Interact.Plugin; +export default modifiersBase; diff --git a/@interactjs/modifiers/base.js b/@interactjs/modifiers/base.js new file mode 100644 index 000000000..f40e69ca5 --- /dev/null +++ b/@interactjs/modifiers/base.js @@ -0,0 +1,82 @@ +import Modification from "./Modification.js"; +export function makeModifier(module, name) { + const { + defaults + } = module; + const methods = { + start: module.start, + set: module.set, + beforeEnd: module.beforeEnd, + stop: module.stop + }; + + const modifier = _options => { + const options = _options || {}; + options.enabled = options.enabled !== false; // add missing defaults to options + + for (const prop in defaults) { + if (!(prop in options)) { + options[prop] = defaults[prop]; + } + } + + const m = { + options, + methods, + name + }; + return m; + }; + + if (name && typeof name === 'string') { + // for backwrads compatibility + modifier._defaults = defaults; + modifier._methods = methods; + } + + return modifier; +} +export function addEventModifiers({ + iEvent, + interaction: { + modification: { + result + } + } +}) { + if (result) { + iEvent.modifiers = result.eventProps; + } +} +const modifiersBase = { + id: 'modifiers/base', + install: scope => { + scope.defaults.perAction.modifiers = []; + }, + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.modification = new Modification(interaction); + }, + 'interactions:before-action-start': arg => { + const { + modification + } = arg.interaction; + modification.start(arg, arg.interaction.coords.start.page); + arg.interaction.edges = modification.edges; + modification.applyToInteraction(arg); + }, + 'interactions:before-action-move': arg => arg.interaction.modification.setAndApply(arg), + 'interactions:before-action-end': arg => arg.interaction.modification.beforeEnd(arg), + 'interactions:action-start': addEventModifiers, + 'interactions:action-move': addEventModifiers, + 'interactions:action-end': addEventModifiers, + 'interactions:after-action-start': arg => arg.interaction.modification.restoreInteractionCoords(arg), + 'interactions:after-action-move': arg => arg.interaction.modification.restoreInteractionCoords(arg), + 'interactions:stop': arg => arg.interaction.modification.stop(arg) + }, + before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'] +}; +export default modifiersBase; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/@interactjs/modifiers/base.js.map b/@interactjs/modifiers/base.js.map new file mode 100644 index 000000000..b80c4f5b5 --- /dev/null +++ b/@interactjs/modifiers/base.js.map @@ -0,0 +1,51 @@ +{ + "version": 3, + "sources": [ + "base.ts" + ], + "names": [ + "Modification", + "makeModifier", + "module", + "name", + "defaults", + "methods", + "start", + "set", + "beforeEnd", + "stop", + "modifier", + "_options", + "options", + "enabled", + "prop", + "m", + "_defaults", + "_methods", + "addEventModifiers", + "iEvent", + "interaction", + "modification", + "result", + "modifiers", + "eventProps", + "modifiersBase", + "id", + "install", + "scope", + "perAction", + "listeners", + "arg", + "coords", + "page", + "edges", + "applyToInteraction", + "setAndApply", + "restoreInteractionCoords", + "before" + ], + "mappings": "AAAA,OAAOA,YAAP;AAiFA,OAAO,SAASC,YAAT,CAKLC,MALK,EAMLC,IANK,EAOL;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAeF,MAArB;AACA,QAAMG,OAAO,GAAG;AACdC,IAAAA,KAAK,EAAEJ,MAAM,CAACI,KADA;AAEdC,IAAAA,GAAG,EAAEL,MAAM,CAACK,GAFE;AAGdC,IAAAA,SAAS,EAAEN,MAAM,CAACM,SAHJ;AAIdC,IAAAA,IAAI,EAAEP,MAAM,CAACO;AAJC,GAAhB;;AAOA,QAAMC,QAAQ,GAAIC,QAAD,IAAkC;AACjD,UAAMC,OAAiB,GAAID,QAAQ,IAAI,EAAvC;AAEAC,IAAAA,OAAO,CAACC,OAAR,GAAkBD,OAAO,CAACC,OAAR,KAAoB,KAAtC,CAHiD,CAKjD;;AACA,SAAK,MAAMC,IAAX,IAAmBV,QAAnB,EAA6B;AAC3B,UAAI,EAAEU,IAAI,IAAIF,OAAV,CAAJ,EAAwB;AACtBA,QAAAA,OAAO,CAACE,IAAD,CAAP,GAAgBV,QAAQ,CAACU,IAAD,CAAxB;AACD;AACF;;AAED,UAAMC,CAAkC,GAAG;AAAEH,MAAAA,OAAF;AAAWP,MAAAA,OAAX;AAAoBF,MAAAA;AAApB,KAA3C;AAEA,WAAOY,CAAP;AACD,GAfD;;AAiBA,MAAIZ,IAAI,IAAI,OAAOA,IAAP,KAAgB,QAA5B,EAAsC;AACpC;AACAO,IAAAA,QAAQ,CAACM,SAAT,GAAqBZ,QAArB;AACAM,IAAAA,QAAQ,CAACO,QAAT,GAAoBZ,OAApB;AACD;;AAED,SAAOK,QAAP;AACD;AAED,OAAO,SAASQ,iBAAT,CAA4B;AAAEC,EAAAA,MAA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AACX,WAAJ,CAAgBC,YAAhB,CAA6BgB,wBAA7B,CAAsDN,GAAtD,CArBjC;AAsBT,sCAAkCA,GAAG,IAAIA,GAAG,CAACX,WAAJ,CAAgBC,YAAhB,CAA6BgB,wBAA7B,CAAsDN,GAAtD,CAtBhC;AAwBT,yBAAqBA,GAAG,IAAIA,GAAG,CAACX,WAAJ,CAAgBC,YAAhB,CAA6BZ,IAA7B,CAAkCsB,GAAlC;AAxBnB,GAL0B;AA+BrCO,EAAAA,MAAM,EAAE,CAAC,SAAD,EAAY,aAAZ,EAA2B,gBAA3B,EAA6C,iBAA7C;AA/B6B,CAAvC;AAkCA,eAAeb,aAAf", + "sourcesContent": [ + "import Modification from './Modification'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n modifiers?: any\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n modification?: Modification\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface InteractEvent {\n modifiers?: Array<{\n name: string\n [key: string]: any\n }>\n }\n}\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport interface Modifier<\n Defaults = any,\n State extends ModifierState = any,\n Name extends string = any\n> {\n options?: Defaults\n methods: {\n start?: (arg: ModifierArg) => void\n set: (arg: ModifierArg) => void\n beforeEnd?: (arg: ModifierArg) => Interact.Point | void\n stop?: (arg: ModifierArg) => void\n }\n name?: Name\n}\n\nexport type ModifierState<\n Defaults = {},\n StateProps extends { [prop: string]: any } = {},\n Name extends string = any\n> = {\n options: Defaults\n methods?: Modifier['methods']\n index?: number\n name?: Name\n} & StateProps\n\nexport interface ModifierArg {\n interaction: Interact.Interaction\n interactable: Interact.Interactable\n phase: Interact.EventPhase\n rect: Interact.FullRect\n edges: Interact.EdgeOptions\n state?: State\n element: Interact.Element\n pageCoords?: Interact.Point\n prevCoords?: Interact.Point\n prevRect?: Interact.FullRect\n coords?: Interact.Point\n startOffset?: Interact.Rect\n preEnd?: boolean\n}\n\nexport interface ModifierModule<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n> {\n defaults?: Defaults\n start? (arg: ModifierArg): void\n set? (arg: ModifierArg): any\n beforeEnd? (arg: ModifierArg): Interact.Point | void\n stop? (arg: ModifierArg): void\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string\n> (\n module: ModifierModule,\n name?: Name,\n) {\n const { defaults } = module\n const methods = {\n start: module.start,\n set: module.set,\n beforeEnd: module.beforeEnd,\n stop: module.stop,\n }\n\n const modifier = (_options?: Partial) => {\n const options: Defaults = (_options || {}) as Defaults\n\n options.enabled = options.enabled !== false\n\n // add missing defaults to options\n for (const prop in defaults) {\n if (!(prop in options)) {\n options[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = { options, methods, name }\n\n return m\n }\n\n if (name && typeof name === 'string') {\n // for backwrads compatibility\n modifier._defaults = defaults\n modifier._methods = methods\n }\n\n return modifier\n}\n\nexport function addEventModifiers ({ iEvent, interaction: { modification: { result } } }: {\n iEvent: Interact.InteractEvent\n interaction: Interact.Interaction\n}) {\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Interact.Plugin = {\n id: 'modifiers/base',\n install: scope => {\n scope.defaults.perAction.modifiers = []\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.modification = new Modification(interaction)\n },\n\n 'interactions:before-action-start': arg => {\n const { modification } = arg.interaction\n\n modification.start(arg, arg.interaction.coords.start.page)\n arg.interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': arg => arg.interaction.modification.setAndApply(arg),\n\n 'interactions:before-action-end': arg => arg.interaction.modification.beforeEnd(arg),\n\n 'interactions:action-start': addEventModifiers,\n 'interactions:action-move': addEventModifiers,\n 'interactions:action-end': addEventModifiers,\n\n 'interactions:after-action-start': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-move': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n\n 'interactions:stop': arg => arg.interaction.modification.stop(arg),\n },\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n}\n\nexport default modifiersBase\n" + ] +} \ No newline at end of file diff --git a/@interactjs/modifiers/base.spec.d.ts b/@interactjs/modifiers/base.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/modifiers/base.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/modifiers/index.d.ts b/@interactjs/modifiers/index.d.ts new file mode 100644 index 000000000..537546481 --- /dev/null +++ b/@interactjs/modifiers/index.d.ts @@ -0,0 +1,266 @@ +export declare const snap: { + (_options?: Partial): import("./base").Modifier, "snap">; + _defaults: import("./snap/pointer").SnapOptions; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const snapSize: { + (_options?: Partial>): import("./base").Modifier, import("./base").ModifierState, "snapSize">; + _defaults: Pick; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const snapEdges: { + (_options?: Partial>): import("./base").Modifier, import("./base").ModifierState, "snapEdges">; + _defaults: Pick; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const restrict: { + (_options?: Partial): import("./base").Modifier, "restrict">; + _defaults: import("./restrict/pointer").RestrictOptions; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const restrictRect: { + (_options?: Partial): import("./base").Modifier, "restrictRect">; + _defaults: import("./restrict/pointer").RestrictOptions & { + elementRect: { + top: number; + left: number; + bottom: number; + right: number; + }; + }; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const restrictEdges: { + (_options?: Partial): import("./base").Modifier, "restrictEdges">; + _defaults: import("./restrict/edges").RestrictEdgesOptions; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const restrictSize: { + (_options?: Partial): import("./base").Modifier, "restrictSize">; + _defaults: import("./restrict/size").RestrictSizeOptions; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; +export declare const aspectRatio: { + (_options?: Partial): import("./base").Modifier, "aspectRatio">; + _defaults: import("./aspectRatio").AspectRatioOptions; + _methods: { + start: (arg: import("./base").ModifierArg>) => void; + set: (arg: import("./base").ModifierArg>) => any; + beforeEnd: (arg: import("./base").ModifierArg>) => void | import("@interactjs/types/types").Point; + stop: (arg: import("./base").ModifierArg>) => void; + }; +}; diff --git a/@interactjs/modifiers/index.js b/@interactjs/modifiers/index.js new file mode 100644 index 000000000..c22ce44fd --- /dev/null +++ b/@interactjs/modifiers/index.js @@ -0,0 +1,18 @@ +import aspectRatioModule from "./aspectRatio.js"; +import { makeModifier } from "./base.js"; +import restrictEdgesModule from "./restrict/edges.js"; +import restrictModule from "./restrict/pointer.js"; +import restrictRectModule from "./restrict/rect.js"; +import restrictSizeModule from "./restrict/size.js"; +import snapEdgesModule from "./snap/edges.js"; +import snapModule from "./snap/pointer.js"; +import snapSizeModule from "./snap/size.js"; +export const snap = makeModifier(snapModule, 'snap'); +export const snapSize = makeModifier(snapSizeModule, 'snapSize'); +export const snapEdges = makeModifier(snapEdgesModule, 'snapEdges'); +export const restrict = makeModifier(restrictModule, 'restrict'); +export const restrictRect = makeModifier(restrictRectModule, 'restrictRect'); +export const restrictEdges = makeModifier(restrictEdgesModule, 'restrictEdges'); +export const restrictSize = makeModifier(restrictSizeModule, 'restrictSize'); +export const aspectRatio = makeModifier(aspectRatioModule, 'aspectRatio'); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/modifiers/index.js.map b/@interactjs/modifiers/index.js.map new file mode 100644 index 000000000..ef3a2cbb9 --- /dev/null +++ b/@interactjs/modifiers/index.js.map @@ -0,0 +1,29 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "aspectRatioModule", + "makeModifier", + "restrictEdgesModule", + "restrictModule", + "restrictRectModule", + "restrictSizeModule", + "snapEdgesModule", + "snapModule", + "snapSizeModule", + "snap", + "snapSize", + "snapEdges", + "restrict", + "restrictRect", + "restrictEdges", + "restrictSize", + "aspectRatio" + ], + "mappings": "AAAA,OAAOA,iBAAP;AACA,SAASC,YAAT;AACA,OAAOC,mBAAP;AACA,OAAOC,cAAP;AACA,OAAOC,kBAAP;AACA,OAAOC,kBAAP;AACA,OAAOC,eAAP;AACA,OAAOC,UAAP;AACA,OAAOC,cAAP;AAEA,OAAO,MAAMC,IAAI,GAAGR,YAAY,CAACM,UAAD,EAAa,MAAb,CAAzB;AACP,OAAO,MAAMG,QAAQ,GAAGT,YAAY,CAACO,cAAD,EAAiB,UAAjB,CAA7B;AACP,OAAO,MAAMG,SAAS,GAAGV,YAAY,CAACK,eAAD,EAAkB,WAAlB,CAA9B;AACP,OAAO,MAAMM,QAAQ,GAAGX,YAAY,CAACE,cAAD,EAAiB,UAAjB,CAA7B;AACP,OAAO,MAAMU,YAAY,GAAGZ,YAAY,CAACG,kBAAD,EAAqB,cAArB,CAAjC;AACP,OAAO,MAAMU,aAAa,GAAGb,YAAY,CAACC,mBAAD,EAAsB,eAAtB,CAAlC;AACP,OAAO,MAAMa,YAAY,GAAGd,YAAY,CAACI,kBAAD,EAAqB,cAArB,CAAjC;AACP,OAAO,MAAMW,WAAW,GAAGf,YAAY,CAACD,iBAAD,EAAoB,aAApB,CAAhC", + "sourcesContent": [ + "import aspectRatioModule from './aspectRatio'\nimport { makeModifier } from './base'\nimport restrictEdgesModule from './restrict/edges'\nimport restrictModule from './restrict/pointer'\nimport restrictRectModule from './restrict/rect'\nimport restrictSizeModule from './restrict/size'\nimport snapEdgesModule from './snap/edges'\nimport snapModule from './snap/pointer'\nimport snapSizeModule from './snap/size'\n\nexport const snap = makeModifier(snapModule, 'snap')\nexport const snapSize = makeModifier(snapSizeModule, 'snapSize')\nexport const snapEdges = makeModifier(snapEdgesModule, 'snapEdges')\nexport const restrict = makeModifier(restrictModule, 'restrict')\nexport const restrictRect = makeModifier(restrictRectModule, 'restrictRect')\nexport const restrictEdges = makeModifier(restrictEdgesModule, 'restrictEdges')\nexport const restrictSize = makeModifier(restrictSizeModule, 'restrictSize')\nexport const aspectRatio = makeModifier(aspectRatioModule, 'aspectRatio')\n" + ] +} \ No newline at end of file diff --git a/@interactjs/offset/.npmignore b/@interactjs/offset/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/offset/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/offset/LICENSE b/@interactjs/offset/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/offset/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/offset/index.d.ts b/@interactjs/offset/index.d.ts new file mode 100644 index 000000000..63231e31e --- /dev/null +++ b/@interactjs/offset/index.d.ts @@ -0,0 +1,17 @@ +declare module '@interactjs/core/Interaction' { + interface Interaction { + offsetBy?: typeof offsetBy; + offset: { + total: Interact.Point; + pending: Interact.Point; + }; + } + enum _ProxyMethods { + offsetBy = "" + } +} +export declare function addTotal(interaction: Interact.Interaction): void; +export declare function applyPending(interaction: Interact.Interaction): boolean; +declare function offsetBy(this: Interact.Interaction, { x, y }: Interact.Point): void; +declare const offset: Interact.Plugin; +export default offset; diff --git a/@interactjs/offset/index.js b/@interactjs/offset/index.js new file mode 100644 index 000000000..b318304bd --- /dev/null +++ b/@interactjs/offset/index.js @@ -0,0 +1,120 @@ +import { _ProxyMethods } from "../core/Interaction.js"; +import * as rectUtils from "../utils/rect.js"; +_ProxyMethods.offsetBy = ''; +export function addTotal(interaction) { + if (!interaction.pointerIsDown) { + return; + } + + addToCoords(interaction.coords.cur, interaction.offset.total); + interaction.offset.pending.x = 0; + interaction.offset.pending.y = 0; +} + +function beforeAction({ + interaction +}) { + applyPending(interaction); +} + +function beforeEnd({ + interaction +}) { + const hadPending = applyPending(interaction); + + if (!hadPending) { + return; + } + + interaction.move({ + offset: true + }); + interaction.end(); + return false; +} + +function end({ + interaction +}) { + interaction.offset.total.x = 0; + interaction.offset.total.y = 0; + interaction.offset.pending.x = 0; + interaction.offset.pending.y = 0; +} + +export function applyPending(interaction) { + if (!hasPending(interaction)) { + return false; + } + + const { + pending + } = interaction.offset; + addToCoords(interaction.coords.cur, pending); + addToCoords(interaction.coords.delta, pending); + rectUtils.addEdges(interaction.edges, interaction.rect, pending); + pending.x = 0; + pending.y = 0; + return true; +} + +function offsetBy({ + x, + y +}) { + this.offset.pending.x += x; + this.offset.pending.y += y; + this.offset.total.x += x; + this.offset.total.y += y; +} + +function addToCoords({ + page, + client +}, { + x, + y +}) { + page.x += x; + page.y += y; + client.x += x; + client.y += y; +} + +function hasPending(interaction) { + return !!(interaction.offset.pending.x || interaction.offset.pending.y); +} + +const offset = { + id: 'offset', + + install(scope) { + scope.Interaction.prototype.offsetBy = offsetBy; + }, + + listeners: { + 'interactions:new': ({ + interaction + }) => { + interaction.offset = { + total: { + x: 0, + y: 0 + }, + pending: { + x: 0, + y: 0 + } + }; + }, + 'interactions:update-pointer': ({ + interaction + }) => addTotal(interaction), + 'interactions:before-action-start': beforeAction, + 'interactions:before-action-move': beforeAction, + 'interactions:before-action-end': beforeEnd, + 'interactions:stop': end + } +}; +export default offset; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/offset/index.js.map b/@interactjs/offset/index.js.map new file mode 100644 index 000000000..4cd77343e --- /dev/null +++ b/@interactjs/offset/index.js.map @@ -0,0 +1,45 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "_ProxyMethods", + "rectUtils", + "offsetBy", + "addTotal", + "interaction", + "pointerIsDown", + "addToCoords", + "coords", + "cur", + "offset", + "total", + "pending", + "x", + "y", + "beforeAction", + "applyPending", + "beforeEnd", + "hadPending", + "move", + "end", + "hasPending", + "delta", + "addEdges", + "edges", + "rect", + "page", + "client", + "id", + "install", + "scope", + "Interaction", + "prototype", + "listeners" + ], + "mappings": "AAAA,SAASA,aAAT;AACA,OAAO,KAAKC,SAAZ;AAkBCD,aAAD,CAAuBE,QAAvB,GAAkC,EAAlC;AAEA,OAAO,SAASC,QAAT,CAAmBC,WAAnB,EAAsD;AAC3D,MAAI,CAACA,WAAW,CAACC,aAAjB,EAAgC;AAAE;AAAQ;;AAE1CC,EAAAA,WAAW,CAACF,WAAW,CAACG,MAAZ,CAAmBC,GAApB,EAAyBJ,WAAW,CAACK,MAAZ,CAAmBC,KAA5C,CAAX;AAEAN,EAAAA,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BC,CAA3B,GAA+B,CAA/B;AACAR,EAAAA,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BE,CAA3B,GAA+B,CAA/B;AACD;;AAED,SAASC,YAAT,CAAuB;AAAEV,EAAAA;AAAF,CAAvB,EAA+E;AAC7EW,EAAAA,YAAY,CAACX,WAAD,CAAZ;AACD;;AAED,SAASY,SAAT,CAAoB;AAAEZ,EAAAA;AAAF,CAApB,EAA4F;AAC1F,QAAMa,UAAU,GAAGF,YAAY,CAACX,WAAD,CAA/B;;AAEA,MAAI,CAACa,UAAL,EAAiB;AAAE;AAAQ;;AAE3Bb,EAAAA,WAAW,CAACc,IAAZ,CAAiB;AAAET,IAAAA,MAAM,EAAE;AAAV,GAAjB;AACAL,EAAAA,WAAW,CAACe,GAAZ;AAEA,SAAO,KAAP;AACD;;AAED,SAASA,GAAT,CAAc;AAAEf,EAAAA;AAAF,CAAd,EAAsE;AACpEA,EAAAA,WAAW,CAACK,MAAZ,CAAmBC,KAAnB,CAAyBE,CAAzB,GAA6B,CAA7B;AACAR,EAAAA,WAAW,CAACK,MAAZ,CAAmBC,KAAnB,CAAyBG,CAAzB,GAA6B,C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I,CAACb,CAAL,IAAUA,CAAV;AACAa,EAAAA,IAAI,CAACZ,CAAL,IAAUA,CAAV;AACAa,EAAAA,MAAM,CAACd,CAAP,IAAYA,CAAZ;AACAc,EAAAA,MAAM,CAACb,CAAP,IAAYA,CAAZ;AACD;;AAED,SAASO,UAAT,CAAqBhB,WAArB,EAAkC;AAChC,SAAO,CAAC,EAAEA,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BC,CAA3B,IAAgCR,WAAW,CAACK,MAAZ,CAAmBE,OAAnB,CAA2BE,CAA7D,CAAR;AACD;;AAED,MAAMJ,MAAuB,GAAG;AAC9BkB,EAAAA,EAAE,EAAE,QAD0B;;AAE9BC,EAAAA,OAAO,CAAEC,KAAF,EAAS;AACdA,IAAAA,KAAK,CAACC,WAAN,CAAkBC,SAAlB,CAA4B7B,QAA5B,GAAuCA,QAAvC;AACD,GAJ6B;;AAK9B8B,EAAAA,SAAS,EAAE;AACT,wBAAoB,CAAC;AAAE5B,MAAAA;AAAF,KAAD,KAAqB;AACvCA,MAAAA,WAAW,CAACK,MAAZ,GAAqB;AACnBC,QAAAA,KAAK,EAAE;AAAEE,UAAAA,CAAC,EAAE,CAAL;AAAQC,UAAAA,CAAC,EAAE;AAAX,SADY;AAEnBF,QAAAA,OAAO,EAAE;AAAEC,UAAAA,CAAC,EAAE,CAAL;AAAQC,UAAAA,CAAC,EAAE;AAAX;AAFU,OAArB;AAID,KANQ;AAOT,mCAA+B,CAAC;AAAET,MAAAA;AAAF,KAAD,KAAqBD,QAAQ,CAACC,WAAD,CAPnD;AAQT,wCAAoCU,YAR3B;AAST,uCAAmCA,YAT1B;AAUT,sCAAkCE,SAVzB;AAWT,yBAAqBG;AAXZ;AALmB,CAAhC;AAoBA,eAAeV,MAAf", + "sourcesContent": [ + "import { _ProxyMethods } from '@interactjs/core/Interaction'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Interact.Point\n pending: Interact.Point\n }\n }\n\n // eslint-disable-next-line no-shadow\n enum _ProxyMethods {\n // eslint-disable-next-line no-shadow\n offsetBy = ''\n }\n}\n\n(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interact.Interaction) {\n if (!interaction.pointerIsDown) { return }\n\n addToCoords(interaction.coords.cur, interaction.offset.total)\n\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nfunction beforeAction ({ interaction }: { interaction: Interact.Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: Interact.Interaction }): boolean | void {\n const hadPending = applyPending(interaction)\n\n if (!hadPending) { return }\n\n interaction.move({ offset: true })\n interaction.end()\n\n return false\n}\n\nfunction end ({ interaction }: { interaction: Interact.Interaction }) {\n interaction.offset.total.x = 0\n interaction.offset.total.y = 0\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nexport function applyPending (interaction: Interact.Interaction) {\n if (!hasPending(interaction)) {\n return false\n }\n\n const { pending } = interaction.offset\n\n addToCoords(interaction.coords.cur, pending)\n addToCoords(interaction.coords.delta, pending)\n rectUtils.addEdges(interaction.edges, interaction.rect, pending)\n\n pending.x = 0\n pending.y = 0\n\n return true\n}\n\nfunction offsetBy (this: Interact.Interaction, { x, y }: Interact.Point) {\n this.offset.pending.x += x\n this.offset.pending.y += y\n\n this.offset.total.x += x\n this.offset.total.y += y\n}\n\nfunction addToCoords ({ page, client }, { x, y }: Interact.Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Interact.Plugin = {\n id: 'offset',\n install (scope) {\n scope.Interaction.prototype.offsetBy = offsetBy\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.offset = {\n total: { x: 0, y: 0 },\n pending: { x: 0, y: 0 },\n }\n },\n 'interactions:update-pointer': ({ interaction }) => addTotal(interaction),\n 'interactions:before-action-start': beforeAction,\n 'interactions:before-action-move': beforeAction,\n 'interactions:before-action-end': beforeEnd,\n 'interactions:stop': end,\n },\n}\n\nexport default offset\n" + ] +} \ No newline at end of file diff --git a/@interactjs/offset/offset.spec.d.ts b/@interactjs/offset/offset.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/offset/offset.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/pointer-events/.npmignore b/@interactjs/pointer-events/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/pointer-events/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/pointer-events/LICENSE b/@interactjs/pointer-events/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/pointer-events/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/pointer-events/PointerEvent.d.ts b/@interactjs/pointer-events/PointerEvent.d.ts new file mode 100644 index 000000000..7ea650d3b --- /dev/null +++ b/@interactjs/pointer-events/PointerEvent.d.ts @@ -0,0 +1,24 @@ +import BaseEvent from '../core/BaseEvent'; +export default class PointerEvent extends BaseEvent { + type: T; + originalEvent: Interact.PointerEventType; + pointerId: number; + pointerType: string; + double: boolean; + pageX: number; + pageY: number; + clientX: number; + clientY: number; + dt: number; + eventable: any; + [key: string]: any; + /** */ + constructor(type: T, pointer: Interact.PointerType | PointerEvent, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, interaction: Interact.Interaction, timeStamp: number); + _subtractOrigin({ x: originX, y: originY }: Interact.Point): this; + _addOrigin({ x: originX, y: originY }: Interact.Point): this; + /** + * Prevent the default behaviour of the original Event + */ + preventDefault(): void; +} +export { PointerEvent }; diff --git a/@interactjs/pointer-events/PointerEvent.js b/@interactjs/pointer-events/PointerEvent.js new file mode 100644 index 000000000..166b60fa1 --- /dev/null +++ b/@interactjs/pointer-events/PointerEvent.js @@ -0,0 +1,88 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import BaseEvent from "../core/BaseEvent.js"; +import * as pointerUtils from "../utils/pointerUtils.js"; +export default class PointerEvent extends BaseEvent { + /** */ + constructor(type, pointer, event, eventTarget, interaction, timeStamp) { + super(interaction); + + _defineProperty(this, "type", void 0); + + _defineProperty(this, "originalEvent", void 0); + + _defineProperty(this, "pointerId", void 0); + + _defineProperty(this, "pointerType", void 0); + + _defineProperty(this, "double", void 0); + + _defineProperty(this, "pageX", void 0); + + _defineProperty(this, "pageY", void 0); + + _defineProperty(this, "clientX", void 0); + + _defineProperty(this, "clientY", void 0); + + _defineProperty(this, "dt", void 0); + + _defineProperty(this, "eventable", void 0); + + pointerUtils.pointerExtend(this, event); + + if (event !== pointer) { + pointerUtils.pointerExtend(this, pointer); + } + + this.timeStamp = timeStamp; + this.originalEvent = event; + this.type = type; + this.pointerId = pointerUtils.getPointerId(pointer); + this.pointerType = pointerUtils.getPointerType(pointer); + this.target = eventTarget; + this.currentTarget = null; + + if (type === 'tap') { + const pointerIndex = interaction.getPointerIndex(pointer); + this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime; + const interval = this.timeStamp - interaction.tapTime; + this.double = !!(interaction.prevTap && interaction.prevTap.type !== 'doubletap' && interaction.prevTap.target === this.target && interval < 500); + } else if (type === 'doubletap') { + this.dt = pointer.timeStamp - interaction.tapTime; + } + } + + _subtractOrigin({ + x: originX, + y: originY + }) { + this.pageX -= originX; + this.pageY -= originY; + this.clientX -= originX; + this.clientY -= originY; + return this; + } + + _addOrigin({ + x: originX, + y: originY + }) { + this.pageX += originX; + this.pageY += originY; + this.clientX += originX; + this.clientY += originY; + return this; + } + /** + * Prevent the default behaviour of the original Event + */ + + + preventDefault() { + this.originalEvent.preventDefault(); + } + +} +export { PointerEvent }; +//# sourceMappingURL=PointerEvent.js.map \ No newline at end of file diff --git a/@interactjs/pointer-events/PointerEvent.js.map b/@interactjs/pointer-events/PointerEvent.js.map new file mode 100644 index 000000000..f566b83db --- /dev/null +++ b/@interactjs/pointer-events/PointerEvent.js.map @@ -0,0 +1,50 @@ +{ + "version": 3, + "sources": [ + "PointerEvent.ts" + ], + "names": [ + "BaseEvent", + "pointerUtils", + "PointerEvent", + "constructor", + "type", + "pointer", + "event", + "eventTarget", + "interaction", + "timeStamp", + "pointerExtend", + "originalEvent", + "pointerId", + "getPointerId", + "pointerType", + "getPointerType", + "target", + "currentTarget", + "pointerIndex", + "getPointerIndex", + "dt", + "pointers", + "downTime", + "interval", + "tapTime", + "double", + "prevTap", + "_subtractOrigin", + "x", + "originX", + "y", + "originY", + "pageX", + "pageY", + "clientX", + "clientY", + "_addOrigin", + "preventDefault" + ], + "mappings": ";;AAAA,OAAOA,SAAP;AACA,OAAO,KAAKC,YAAZ;AAEA,eAAe,M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AA0B;AAC7B,WAAKgB,EAAL,GAAWf,OAAD,CAAiCI,SAAjC,GAA6CD,WAAW,CAACgB,OAAnE;AACD;AACF;;AAEDG,EAAAA,eAAe,CAAE;AAAEC,IAAAA,CAAC,EAAEC,OAAL;AAAcC,IAAAA,CAAC,EAAEC;AAAjB,GAAF,EAA8C;AAC3D,SAAKC,KAAL,IAAgBH,OAAhB;AACA,SAAKI,KAAL,IAAgBF,OAAhB;AACA,SAAKG,OAAL,IAAgBL,OAAhB;AACA,SAAKM,OAAL,IAAgBJ,OAAhB;AAEA,WAAO,IAAP;AACD;;AAEDK,EAAAA,UAAU,CAAE;AAAER,IAAAA,CAAC,EAAEC,OAAL;AAAcC,IAAAA,CAAC,EAAEC;AAAjB,GAAF,EAA8C;AACtD,SAAKC,KAAL,IAAgBH,OAAhB;AACA,SAAKI,KAAL,IAAgBF,OAAhB;AACA,SAAKG,OAAL,IAAgBL,OAAhB;AACA,SAAKM,OAAL,IAAgBJ,OAAhB;AAEA,WAAO,IAAP;AACD;AAED;;;;;AAGAM,EAAAA,cAAc,GAAI;AAChB,SAAK1B,aAAL,CAAmB0B,cAAnB;AACD;;AA7EyE;AAgF5E,SAASnC,YAAT", + "sourcesContent": [ + "import BaseEvent from '../core/BaseEvent'\nimport * as pointerUtils from '../utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n type: T\n originalEvent: Interact.PointerEventType\n pointerId: number\n pointerType: string\n double: boolean\n pageX: number\n pageY: number\n clientX: number\n clientY: number\n dt: number\n eventable: any\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: Interact.PointerType | PointerEvent,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n interaction: Interact.Interaction,\n timeStamp: number,\n ) {\n super(interaction)\n pointerUtils.pointerExtend(this, event)\n\n if (event !== pointer) {\n pointerUtils.pointerExtend(this, pointer)\n }\n\n this.timeStamp = timeStamp\n this.originalEvent = event\n this.type = type\n this.pointerId = pointerUtils.getPointerId(pointer)\n this.pointerType = pointerUtils.getPointerType(pointer)\n this.target = eventTarget\n this.currentTarget = null\n\n if (type === 'tap') {\n const pointerIndex = interaction.getPointerIndex(pointer)\n this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime\n\n const interval = this.timeStamp - interaction.tapTime\n\n this.double = !!(interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500)\n }\n else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX -= originX\n this.pageY -= originY\n this.clientX -= originX\n this.clientY -= originY\n\n return this\n }\n\n _addOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX += originX\n this.pageY += originY\n this.clientX += originX\n this.clientY += originY\n\n return this\n }\n\n /**\n * Prevent the default behaviour of the original Event\n */\n preventDefault () {\n this.originalEvent.preventDefault()\n }\n}\n\nexport { PointerEvent }\n" + ] +} \ No newline at end of file diff --git a/@interactjs/pointer-events/PointerEvent.spec.d.ts b/@interactjs/pointer-events/PointerEvent.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/pointer-events/PointerEvent.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/pointer-events/base.d.ts b/@interactjs/pointer-events/base.d.ts new file mode 100644 index 000000000..f22fa5b38 --- /dev/null +++ b/@interactjs/pointer-events/base.d.ts @@ -0,0 +1,116 @@ +import { PerActionDefaults } from '@interactjs/core/defaultOptions'; +import Eventable from '@interactjs/core/Eventable'; +import Interaction from '@interactjs/core/Interaction'; +import { Scope } from '@interactjs/core/scope'; +import PointerEvent from './PointerEvent'; +export declare type EventTargetList = Array<{ + node: Node; + eventable: Eventable; + props: { + [key: string]: any; + }; +}>; +export interface PointerEventOptions extends PerActionDefaults { + enabled?: undefined; + holdDuration?: number; + ignoreFrom?: any; + allowFrom?: any; + origin?: Interact.Point | string | Interact.Element; +} +declare module '@interactjs/core/scope' { + interface Scope { + pointerEvents: typeof pointerEvents; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + prevTap?: PointerEvent; + tapTime?: number; + } +} +declare module '@interactjs/core/PointerInfo' { + interface PointerInfo { + hold?: { + duration: number; + timeout: any; + }; + } +} +declare module '@interactjs/core/defaultOptions' { + interface ActionDefaults { + pointerEvents: Interact.Options; + } +} +declare module '@interactjs/core/scope' { + interface SignalArgs { + 'pointerEvents:new': { + pointerEvent: PointerEvent; + }; + 'pointerEvents:fired': { + interaction: Interaction; + pointer: Interact.PointerType | PointerEvent; + event: Interact.PointerEventType | PointerEvent; + eventTarget: Interact.EventTarget; + pointerEvent: PointerEvent; + targets?: EventTargetList; + type: string; + }; + 'pointerEvents:collect-targets': { + interaction: Interaction; + pointer: Interact.PointerType | PointerEvent; + event: Interact.PointerEventType | PointerEvent; + eventTarget: Interact.EventTarget; + targets?: EventTargetList; + type: string; + path: Node[]; + node: null; + }; + } +} +declare const pointerEvents: { + id: string; + install: typeof install; + listeners: { + 'interactions:new': typeof addInteractionProps; + 'interactions:update-pointer': typeof addHoldInfo; + 'interactions:move': typeof moveAndClearHold; + 'interactions:down': (arg: any, scope: any) => void; + 'interactions:up': (arg: any, scope: any) => void; + 'interactions:cancel': (arg: any, scope: any) => void; + }; + PointerEvent: typeof PointerEvent; + fire: typeof fire; + collectEventTargets: typeof collectEventTargets; + defaults: PointerEventOptions; + types: { + [type: string]: true; + }; +}; +declare function fire(arg: { + pointer: Interact.PointerType | PointerEvent; + event: Interact.PointerEventType | PointerEvent; + eventTarget: Interact.EventTarget; + interaction: Interaction; + type: T; + targets?: EventTargetList; +}, scope: Interact.Scope): import("@interactjs/pointer-events/PointerEvent").default; +declare function collectEventTargets({ interaction, pointer, event, eventTarget, type }: { + interaction: Interaction; + pointer: Interact.PointerType | PointerEvent; + event: Interact.PointerEventType | PointerEvent; + eventTarget: Interact.EventTarget; + type: T; +}, scope: Interact.Scope): { + node: Node; + eventable: Eventable; + props: { + [key: string]: any; + }; +}[]; +declare function addInteractionProps({ interaction }: { + interaction: any; +}): void; +declare function addHoldInfo({ down, pointerInfo }: Interact.SignalArgs['interactions:update-pointer']): void; +declare function moveAndClearHold({ interaction, pointer, event, eventTarget, duplicate }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope): void; +declare function install(scope: Scope): void; +export default pointerEvents; diff --git a/@interactjs/pointer-events/base.js b/@interactjs/pointer-events/base.js new file mode 100644 index 000000000..63a5c2069 --- /dev/null +++ b/@interactjs/pointer-events/base.js @@ -0,0 +1,283 @@ +import Interaction from "../core/Interaction.js"; +import { Scope } from "../core/scope.js"; +import * as utils from "../utils/index.js"; +import PointerEvent from "./PointerEvent.js"; +const defaults = { + holdDuration: 600, + ignoreFrom: null, + allowFrom: null, + origin: { + x: 0, + y: 0 + } +}; +const pointerEvents = { + id: 'pointer-events/base', + install, + listeners: { + 'interactions:new': addInteractionProps, + 'interactions:update-pointer': addHoldInfo, + 'interactions:move': moveAndClearHold, + 'interactions:down': (arg, scope) => { + downAndStartHold(arg, scope); + fire(arg, scope); + }, + 'interactions:up': (arg, scope) => { + clearHold(arg); + fire(arg, scope); + tapAfterUp(arg, scope); + }, + 'interactions:cancel': (arg, scope) => { + clearHold(arg); + fire(arg, scope); + } + }, + PointerEvent, + fire, + collectEventTargets, + defaults, + types: { + down: true, + move: true, + up: true, + cancel: true, + tap: true, + doubletap: true, + hold: true + } +}; + +function fire(arg, scope) { + const { + interaction, + pointer, + event, + eventTarget, + type, + targets = collectEventTargets(arg, scope) + } = arg; + const pointerEvent = new PointerEvent(type, pointer, event, eventTarget, interaction, scope.now()); + scope.fire('pointerEvents:new', { + pointerEvent + }); + const signalArg = { + interaction, + pointer, + event, + eventTarget, + targets, + type, + pointerEvent + }; + + for (let i = 0; i < targets.length; i++) { + const target = targets[i]; + + for (const prop in target.props || {}) { + pointerEvent[prop] = target.props[prop]; + } + + const origin = utils.getOriginXY(target.eventable, target.node); + + pointerEvent._subtractOrigin(origin); + + pointerEvent.eventable = target.eventable; + pointerEvent.currentTarget = target.node; + target.eventable.fire(pointerEvent); + + pointerEvent._addOrigin(origin); + + if (pointerEvent.immediatePropagationStopped || pointerEvent.propagationStopped && i + 1 < targets.length && targets[i + 1].node !== pointerEvent.currentTarget) { + break; + } + } + + scope.fire('pointerEvents:fired', signalArg); + + if (type === 'tap') { + // if pointerEvent should make a double tap, create and fire a doubletap + // PointerEvent and use that as the prevTap + const prevTap = pointerEvent.double ? fire({ + interaction, + pointer, + event, + eventTarget, + type: 'doubletap' + }, scope) : pointerEvent; + interaction.prevTap = prevTap; + interaction.tapTime = prevTap.timeStamp; + } + + return pointerEvent; +} + +function collectEventTargets({ + interaction, + pointer, + event, + eventTarget, + type +}, scope) { + const pointerIndex = interaction.getPointerIndex(pointer); + const pointerInfo = interaction.pointers[pointerIndex]; // do not fire a tap event if the pointer was moved before being lifted + + if (type === 'tap' && (interaction.pointerWasMoved || // or if the pointerup target is different to the pointerdown target + !(pointerInfo && pointerInfo.downTarget === eventTarget))) { + return []; + } + + const path = utils.dom.getPath(eventTarget); + const signalArg = { + interaction, + pointer, + event, + eventTarget, + type, + path, + targets: [], + node: null + }; + + for (const node of path) { + signalArg.node = node; + scope.fire('pointerEvents:collect-targets', signalArg); + } + + if (type === 'hold') { + signalArg.targets = signalArg.targets.filter(target => target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration); + } + + return signalArg.targets; +} + +function addInteractionProps({ + interaction +}) { + interaction.prevTap = null; // the most recent tap event on this interaction + + interaction.tapTime = 0; // time of the most recent tap event +} + +function addHoldInfo({ + down, + pointerInfo +}) { + if (!down && pointerInfo.hold) { + return; + } + + pointerInfo.hold = { + duration: Infinity, + timeout: null + }; +} + +function clearHold({ + interaction, + pointerIndex +}) { + if (interaction.pointers[pointerIndex].hold) { + clearTimeout(interaction.pointers[pointerIndex].hold.timeout); + } +} + +function moveAndClearHold({ + interaction, + pointer, + event, + eventTarget, + duplicate +}, scope) { + const pointerIndex = interaction.getPointerIndex(pointer); + + if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { + if (interaction.pointerIsDown) { + clearTimeout(interaction.pointers[pointerIndex].hold.timeout); + } + + fire({ + interaction, + pointer, + event, + eventTarget: eventTarget, + type: 'move' + }, scope); + } +} + +function downAndStartHold({ + interaction, + pointer, + event, + eventTarget, + pointerIndex +}, scope) { + const timer = interaction.pointers[pointerIndex].hold; + const path = utils.dom.getPath(eventTarget); + const signalArg = { + interaction, + pointer, + event, + eventTarget, + type: 'hold', + targets: [], + path, + node: null + }; + + for (const node of path) { + signalArg.node = node; + scope.fire('pointerEvents:collect-targets', signalArg); + } + + if (!signalArg.targets.length) { + return; + } + + let minDuration = Infinity; + + for (const target of signalArg.targets) { + const holdDuration = target.eventable.options.holdDuration; + + if (holdDuration < minDuration) { + minDuration = holdDuration; + } + } + + timer.duration = minDuration; + timer.timeout = setTimeout(() => { + fire({ + interaction, + eventTarget, + pointer, + event, + type: 'hold' + }, scope); + }, minDuration); +} + +function tapAfterUp({ + interaction, + pointer, + event, + eventTarget +}, scope) { + if (!interaction.pointerWasMoved) { + fire({ + interaction, + eventTarget, + pointer, + event, + type: 'tap' + }, scope); + } +} + +function install(scope) { + scope.pointerEvents = pointerEvents; + scope.defaults.actions.pointerEvents = pointerEvents.defaults; + utils.extend(scope.actions.phaselessTypes, pointerEvents.types); +} + +export default pointerEvents; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/@interactjs/pointer-events/base.js.map b/@interactjs/pointer-events/base.js.map new file mode 100644 index 000000000..8bf2a5e9b --- /dev/null +++ b/@interactjs/pointer-events/base.js.map @@ -0,0 +1,94 @@ +{ + "version": 3, + "sources": [ + "base.ts" + ], + "names": [ + "Interaction", + "Scope", + "utils", + "PointerEvent", + "defaults", + "holdDuration", + "ignoreFrom", + "allowFrom", + "origin", + "x", + "y", + "pointerEvents", + "id", + "install", + "listeners", + "addInteractionProps", + "addHoldInfo", + "moveAndClearHold", + "arg", + "scope", + "downAndStartHold", + "fire", + "clearHold", + "tapAfterUp", + "collectEventTargets", + "types", + "down", + "move", + "up", + "cancel", + "tap", + "doubletap", + "hold", + "interaction", + "pointer", + "event", + "eventTarget", + "type", + "targets", + "pointerEvent", + "now", + "signalArg", + "i", + "length", + "target", + "prop", + "props", + "getOriginXY", + "eventable", + "node", + "_subtractOrigin", + "currentTarget", + "_addOrigin", + "immediatePropagationStopped", + "propagationStopped", + "prevTap", + "double", + "tapTime", + "timeStamp", + "pointerIndex", + "getPointerIndex", + "pointerInfo", + "pointers", + "pointerWasMoved", + "downTarget", + "path", + "dom", + "getPath", + "filter", + "options", + "duration", + "Infinity", + "timeout", + "clearTimeout", + "duplicate", + "pointerIsDown", + "timer", + "minDuration", + "setTimeout", + "actions", + "extend", + "phaselessTypes" + ], + "mappings": "AAEA,OAAOA,WAAP;AACA,SAASC,KAAT;AACA,OAAO,KAAKC,KAAZ;AACA,OAAOC,YAAP;AAqEA,MAAMC,QAA6B,GAAG;AACpCC,EAAAA,YAAY,EAAE,GADsB;AAEpCC,EAAAA,UAAU,EAAI,IAFsB;AAGpCC,EAAAA,SAAS,EAAK,IAHsB;AAIpCC,EAAAA,MAAM,EAAQ;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX;AAJsB,CAAtC;AAOA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,EAAE,EAAE,qBADgB;AAEpBC,EAAAA,OAFoB;AAGpBC,EAAAA,SAAS,EAAE;AACT,wBAAoBC,mBADX;AAET,mCAA+BC,WAFtB;AAGT,yBAAqBC,gBAHZ;AAIT,yBAAqB,CAACC,GAAD,EAAMC,KAAN,KAAgB;AACnCC,MAAAA,gBAAgB,CAACF,GAAD,EAAMC,KAAN,CAAhB;AACAE,MAAAA,IAAI,CAACH,GAAD,EAAMC,KAAN,CAAJ;AACD,KAPQ;AAQT,uBAAmB,CAACD,GAAD,EAAMC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tB;AACAQ,EAAAA,KAAK,CAACf,QAAN,CAAe2E,OAAf,CAAuBpE,aAAvB,GAAuCA,aAAa,CAACP,QAArD;AACAF,EAAAA,KAAK,CAAC8E,MAAN,CAAa7D,KAAK,CAAC4D,OAAN,CAAcE,cAA3B,EAA2CtE,aAAa,CAACc,KAAzD;AACD;;AAED,eAAed,aAAf", + "sourcesContent": [ + "import { PerActionDefaults } from '@interactjs/core/defaultOptions'\nimport Eventable from '@interactjs/core/Eventable'\nimport Interaction from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as utils from '@interactjs/utils/index'\nimport PointerEvent from './PointerEvent'\n\nexport type EventTargetList = Array<{\n node: Node\n eventable: Eventable\n props: { [key: string]: any }\n}>\n\nexport interface PointerEventOptions extends PerActionDefaults {\n enabled?: undefined // not used\n holdDuration?: number\n ignoreFrom?: any\n allowFrom?: any\n origin?: Interact.Point | string | Interact.Element\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n pointerEvents: typeof pointerEvents\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n prevTap?: PointerEvent\n tapTime?: number\n }\n}\n\ndeclare module '@interactjs/core/PointerInfo' {\n interface PointerInfo {\n hold?: {\n duration: number\n timeout: any\n }\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n pointerEvents: Interact.Options\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'pointerEvents:new': { pointerEvent: PointerEvent }\n 'pointerEvents:fired': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n targets?: EventTargetList\n type: string\n path: Node[]\n node: null\n }\n }\n}\n\nconst defaults: PointerEventOptions = {\n holdDuration: 600,\n ignoreFrom : null,\n allowFrom : null,\n origin : { x: 0, y: 0 },\n}\n\nconst pointerEvents = {\n id: 'pointer-events/base',\n install,\n listeners: {\n 'interactions:new': addInteractionProps,\n 'interactions:update-pointer': addHoldInfo,\n 'interactions:move': moveAndClearHold,\n 'interactions:down': (arg, scope) => {\n downAndStartHold(arg, scope)\n fire(arg, scope)\n },\n 'interactions:up': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n tapAfterUp(arg, scope)\n },\n 'interactions:cancel': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n },\n },\n PointerEvent,\n fire,\n collectEventTargets,\n defaults,\n types: {\n down: true,\n move: true,\n up: true,\n cancel: true,\n tap: true,\n doubletap: true,\n hold: true,\n } as { [type: string]: true },\n}\n\nfunction fire (\n arg: {\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Interact.Scope,\n) {\n const {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n targets = collectEventTargets(arg, scope),\n } = arg\n\n const pointerEvent = new PointerEvent(type, pointer, event, eventTarget, interaction, scope.now())\n\n scope.fire('pointerEvents:new', { pointerEvent })\n\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n targets,\n type,\n pointerEvent,\n }\n\n for (let i = 0; i < targets.length; i++) {\n const target = targets[i]\n\n for (const prop in target.props || {}) {\n (pointerEvent as any)[prop] = target.props[prop]\n }\n\n const origin = utils.getOriginXY(target.eventable, target.node)\n\n pointerEvent._subtractOrigin(origin)\n pointerEvent.eventable = target.eventable\n pointerEvent.currentTarget = target.node\n\n target.eventable.fire(pointerEvent)\n\n pointerEvent._addOrigin(origin)\n\n if (pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n (i + 1) < targets.length && targets[i + 1].node !== pointerEvent.currentTarget)) {\n break\n }\n }\n\n scope.fire('pointerEvents:fired', signalArg)\n\n if (type === 'tap') {\n // if pointerEvent should make a double tap, create and fire a doubletap\n // PointerEvent and use that as the prevTap\n const prevTap = pointerEvent.double\n ? fire({\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n }, scope)\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets ({ interaction, pointer, event, eventTarget, type }: {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n type: T\n}, scope: Interact.Scope) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n const pointerInfo = interaction.pointers[pointerIndex]\n\n // do not fire a tap event if the pointer was moved before being lifted\n if (type === 'tap' && (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))) {\n return []\n }\n\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n path,\n targets: [] as EventTargetList,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (type === 'hold') {\n signalArg.targets = signalArg.targets.filter(target =>\n target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration)\n }\n\n return signalArg.targets\n}\n\nfunction addInteractionProps ({ interaction }) {\n interaction.prevTap = null // the most recent tap event on this interaction\n interaction.tapTime = 0 // time of the most recent tap event\n}\n\nfunction addHoldInfo ({ down, pointerInfo }: Interact.SignalArgs['interactions:update-pointer']) {\n if (!down && pointerInfo.hold) {\n return\n }\n\n pointerInfo.hold = { duration: Infinity, timeout: null }\n}\n\nfunction clearHold ({ interaction, pointerIndex }) {\n if (interaction.pointers[pointerIndex].hold) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n}\n\nfunction moveAndClearHold (\n { interaction, pointer, event, eventTarget, duplicate }: Interact.SignalArgs['interactions:move'],\n scope: Interact.Scope,\n) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n\n fire({\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Interact.Element,\n type: 'move',\n }, scope)\n }\n}\n\nfunction downAndStartHold ({ interaction, pointer, event, eventTarget, pointerIndex }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n const timer = interaction.pointers[pointerIndex].hold\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'hold',\n targets: [] as EventTargetList,\n path,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (!signalArg.targets.length) { return }\n\n let minDuration = Infinity\n\n for (const target of signalArg.targets) {\n const holdDuration = target.eventable.options.holdDuration\n\n if (holdDuration < minDuration) {\n minDuration = holdDuration\n }\n }\n\n timer.duration = minDuration\n timer.timeout = setTimeout(() => {\n fire({\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n }, scope)\n }, minDuration)\n}\n\nfunction tapAfterUp ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:up'], scope: Interact.Scope) {\n if (!interaction.pointerWasMoved) {\n fire({ interaction, eventTarget, pointer, event, type: 'tap' }, scope)\n }\n}\n\nfunction install (scope: Scope) {\n scope.pointerEvents = pointerEvents\n scope.defaults.actions.pointerEvents = pointerEvents.defaults\n utils.extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n" + ] +} \ No newline at end of file diff --git a/@interactjs/pointer-events/base.spec.d.ts b/@interactjs/pointer-events/base.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/pointer-events/base.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/pointer-events/holdRepeat.d.ts b/@interactjs/pointer-events/holdRepeat.d.ts new file mode 100644 index 000000000..ad23fb83e --- /dev/null +++ b/@interactjs/pointer-events/holdRepeat.d.ts @@ -0,0 +1,17 @@ +declare module '@interactjs/core/Interaction' { + interface Interaction { + holdIntervalHandle?: any; + } +} +declare module '@interactjs/pointer-events/PointerEvent' { + interface PointerEvent { + count?: number; + } +} +declare module '@interactjs/pointer-events/base' { + interface PointerEventOptions { + holdRepeatInterval?: number; + } +} +declare const holdRepeat: Interact.Plugin; +export default holdRepeat; diff --git a/@interactjs/pointer-events/holdRepeat.js b/@interactjs/pointer-events/holdRepeat.js new file mode 100644 index 000000000..8483ed105 --- /dev/null +++ b/@interactjs/pointer-events/holdRepeat.js @@ -0,0 +1,76 @@ +import basePlugin from "./base.js"; +import PointerEvent from "./PointerEvent.js"; + +function install(scope) { + scope.usePlugin(basePlugin); + const { + pointerEvents + } = scope; // don't repeat by default + + pointerEvents.defaults.holdRepeatInterval = 0; + pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true; +} + +function onNew({ + pointerEvent +}) { + if (pointerEvent.type !== 'hold') { + return; + } + + pointerEvent.count = (pointerEvent.count || 0) + 1; +} + +function onFired({ + interaction, + pointerEvent, + eventTarget, + targets +}, scope) { + if (pointerEvent.type !== 'hold' || !targets.length) { + return; + } // get the repeat interval from the first eventable + + + const interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less + + if (interval <= 0) { + return; + } // set a timeout to fire the holdrepeat event + + + interaction.holdIntervalHandle = setTimeout(() => { + scope.pointerEvents.fire({ + interaction, + eventTarget, + type: 'hold', + pointer: pointerEvent, + event: pointerEvent + }, scope); + }, interval); +} + +function endHoldRepeat({ + interaction +}) { + // set the interaction's holdStopTime property + // to stop further holdRepeat events + if (interaction.holdIntervalHandle) { + clearInterval(interaction.holdIntervalHandle); + interaction.holdIntervalHandle = null; + } +} + +const holdRepeat = { + id: 'pointer-events/holdRepeat', + install, + listeners: ['move', 'up', 'cancel', 'endall'].reduce((acc, enderTypes) => { + acc[`pointerEvents:${enderTypes}`] = endHoldRepeat; + return acc; + }, { + 'pointerEvents:new': onNew, + 'pointerEvents:fired': onFired + }) +}; +export default holdRepeat; +//# sourceMappingURL=holdRepeat.js.map \ No newline at end of file diff --git a/@interactjs/pointer-events/holdRepeat.js.map b/@interactjs/pointer-events/holdRepeat.js.map new file mode 100644 index 000000000..579e730a2 --- /dev/null +++ b/@interactjs/pointer-events/holdRepeat.js.map @@ -0,0 +1,49 @@ +{ + "version": 3, + "sources": [ + "holdRepeat.ts" + ], + "names": [ + "basePlugin", + "PointerEvent", + "install", + "scope", + "usePlugin", + "pointerEvents", + "defaults", + "holdRepeatInterval", + "types", + "holdrepeat", + "actions", + "phaselessTypes", + "onNew", + "pointerEvent", + "type", + "count", + "onFired", + "interaction", + "eventTarget", + "targets", + "length", + "interval", + "eventable", + "options", + "holdIntervalHandle", + "setTimeout", + "fire", + "pointer", + "event", + "endHoldRepeat", + "clearInterval", + "holdRepeat", + "id", + "listeners", + "reduce", + "acc", + "enderTypes" + ], + "mappings": "AACA,OAAOA,UAAP;AACA,OAAOC,YAAP;;AAoBA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AACvCA,EAAAA,KAAK,CAACC,SAAN,CAAgBJ,UAAhB;AAEA,QAAM;AACJK,IAAAA;AADI,MAEFF,KAFJ,CAHuC,CAOvC;;AACAE,EAAAA,aAAa,CAACC,QAAd,CAAuBC,kBAAvB,GAA4C,CAA5C;AACAF,EAAAA,aAAa,CAACG,KAAd,CAAoBC,UAApB,GAAiCN,KAAK,CAACO,OAAN,CAAcC,cAAd,CAA6BF,UAA7B,GAA0C,IAA3E;AACD;;AAED,SAASG,KAAT,CAAgB;AAAEC,EAAAA;AAAF,CAAhB,EAAuE;AACrE,MAAIA,YAAY,CAACC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CAAC,MAAD,EAAS,IAAT,EAAe,QAAf,EAAyB,QAAzB,EAAmCC,MAAnC,CACT,CAACC,GAAD,EAAMC,UAAN,KAAqB;AAClBD,IAAAA,GAAD,CAAc,iBAAgBC,UAAW,EAAzC,IAA8CP,aAA9C;AACA,WAAOM,GAAP;AACD,GAJQ,EAKT;AACE,yBAAqBvB,KADvB;AAEE,2BAAuBI;AAFzB,GALS;AAHuB,CAApC;AAeA,eAAee,UAAf", + "sourcesContent": [ + "import { ListenerMap } from '@interactjs/core/scope'\nimport basePlugin from './base'\nimport PointerEvent from './PointerEvent'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n holdIntervalHandle?: any\n }\n}\n\ndeclare module '@interactjs/pointer-events/PointerEvent' {\n interface PointerEvent {\n count?: number\n }\n}\n\ndeclare module '@interactjs/pointer-events/base' {\n interface PointerEventOptions {\n holdRepeatInterval?: number\n }\n}\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(basePlugin)\n\n const {\n pointerEvents,\n } = scope\n\n // don't repeat by default\n pointerEvents.defaults.holdRepeatInterval = 0\n pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true\n}\n\nfunction onNew ({ pointerEvent }: { pointerEvent: PointerEvent }) {\n if (pointerEvent.type !== 'hold') { return }\n\n pointerEvent.count = (pointerEvent.count || 0) + 1\n}\n\nfunction onFired (\n { interaction, pointerEvent, eventTarget, targets }: Interact.SignalArgs['pointerEvents:fired'],\n scope: Interact.Scope,\n) {\n if (pointerEvent.type !== 'hold' || !targets.length) { return }\n\n // get the repeat interval from the first eventable\n const interval = targets[0].eventable.options.holdRepeatInterval\n\n // don't repeat if the interval is 0 or less\n if (interval <= 0) { return }\n\n // set a timeout to fire the holdrepeat event\n interaction.holdIntervalHandle = setTimeout(() => {\n scope.pointerEvents.fire({\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n }, scope)\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: Interact.Interaction }) {\n // set the interaction's holdStopTime property\n // to stop further holdRepeat events\n if (interaction.holdIntervalHandle) {\n clearInterval(interaction.holdIntervalHandle)\n interaction.holdIntervalHandle = null\n }\n}\n\nconst holdRepeat: Interact.Plugin = {\n id: 'pointer-events/holdRepeat',\n install,\n listeners: ['move', 'up', 'cancel', 'endall'].reduce(\n (acc, enderTypes) => {\n (acc as any)[`pointerEvents:${enderTypes}`] = endHoldRepeat\n return acc\n },\n {\n 'pointerEvents:new': onNew,\n 'pointerEvents:fired': onFired,\n } as ListenerMap,\n ),\n}\n\nexport default holdRepeat\n" + ] +} \ No newline at end of file diff --git a/@interactjs/pointer-events/holdRepeat.spec.d.ts b/@interactjs/pointer-events/holdRepeat.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/pointer-events/holdRepeat.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/pointer-events/index.d.ts b/@interactjs/pointer-events/index.d.ts new file mode 100644 index 000000000..b59f418a1 --- /dev/null +++ b/@interactjs/pointer-events/index.d.ts @@ -0,0 +1,6 @@ +import * as pointerEvents from './base'; +import holdRepeat from './holdRepeat'; +import interactableTargets from './interactableTargets'; +declare function install(scope: Interact.Scope): void; +declare const id = "pointer-events"; +export { id, pointerEvents, holdRepeat, interactableTargets, install }; diff --git a/@interactjs/pointer-events/index.js b/@interactjs/pointer-events/index.js new file mode 100644 index 000000000..bf9e35346 --- /dev/null +++ b/@interactjs/pointer-events/index.js @@ -0,0 +1,13 @@ +import * as pointerEvents from "./base.js"; +import holdRepeat from "./holdRepeat.js"; +import interactableTargets from "./interactableTargets.js"; + +function install(scope) { + scope.usePlugin(pointerEvents); + scope.usePlugin(holdRepeat); + scope.usePlugin(interactableTargets); +} + +const id = 'pointer-events'; +export { id, pointerEvents, holdRepeat, interactableTargets, install }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/pointer-events/index.js.map b/@interactjs/pointer-events/index.js.map new file mode 100644 index 000000000..ce7016214 --- /dev/null +++ b/@interactjs/pointer-events/index.js.map @@ -0,0 +1,19 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "pointerEvents", + "holdRepeat", + "interactableTargets", + "install", + "scope", + "usePlugin", + "id" + ], + "mappings": "AAAA,OAAO,KAAKA,aAAZ;AACA,OAAOC,UAAP;AACA,OAAOC,mBAAP;;AAEA,SAASC,OAAT,CAAkBC,KAAlB,EAAyC;AACvCA,EAAAA,KAAK,CAACC,SAAN,CAAgBL,aAAhB;AACAI,EAAAA,KAAK,CAACC,SAAN,CAAgBJ,UAAhB;AACAG,EAAAA,KAAK,CAACC,SAAN,CAAgBH,mBAAhB;AACD;;AAED,MAAMI,EAAE,GAAG,gBAAX;AAEA,SAASA,EAAT,EAAaN,aAAb,EAA4BC,UAA5B,EAAwCC,mBAAxC,EAA6DC,OAA7D", + "sourcesContent": [ + "import * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n}\n\nconst id = 'pointer-events'\n\nexport { id, pointerEvents, holdRepeat, interactableTargets, install }\n" + ] +} \ No newline at end of file diff --git a/@interactjs/pointer-events/interactableTargets.d.ts b/@interactjs/pointer-events/interactableTargets.d.ts new file mode 100644 index 000000000..b6ede3dd7 --- /dev/null +++ b/@interactjs/pointer-events/interactableTargets.d.ts @@ -0,0 +1,9 @@ +declare module '@interactjs/core/Interactable' { + interface Interactable { + pointerEvents: typeof pointerEventsMethod; + __backCompatOption: (optionName: string, newValue: any) => any; + } +} +declare function pointerEventsMethod(this: Interact.Interactable, options: any): import("@interactjs/core/Interactable").Interactable; +declare const plugin: Interact.Plugin; +export default plugin; diff --git a/@interactjs/pointer-events/interactableTargets.js b/@interactjs/pointer-events/interactableTargets.js new file mode 100644 index 000000000..8d05cbb93 --- /dev/null +++ b/@interactjs/pointer-events/interactableTargets.js @@ -0,0 +1,68 @@ +import extend from "../utils/extend.js"; + +function install(scope) { + const { + Interactable + } = scope; + Interactable.prototype.pointerEvents = pointerEventsMethod; + const __backCompatOption = Interactable.prototype._backCompatOption; + + Interactable.prototype._backCompatOption = function (optionName, newValue) { + const ret = __backCompatOption.call(this, optionName, newValue); + + if (ret === this) { + this.events.options[optionName] = newValue; + } + + return ret; + }; +} + +function pointerEventsMethod(options) { + extend(this.events.options, options); + return this; +} + +const plugin = { + id: 'pointer-events/interactableTargets', + install, + listeners: { + 'pointerEvents:collect-targets': ({ + targets, + node, + type, + eventTarget + }, scope) => { + scope.interactables.forEachMatch(node, interactable => { + const eventable = interactable.events; + const options = eventable.options; + + if (eventable.types[type] && eventable.types[type].length && interactable.testIgnoreAllow(options, node, eventTarget)) { + targets.push({ + node, + eventable, + props: { + interactable + } + }); + } + }); + }, + 'interactable:new': ({ + interactable + }) => { + interactable.events.getRect = function (element) { + return interactable.getRect(element); + }; + }, + 'interactable:set': ({ + interactable, + options + }, scope) => { + extend(interactable.events.options, scope.pointerEvents.defaults); + extend(interactable.events.options, options.pointerEvents || {}); + } + } +}; +export default plugin; +//# sourceMappingURL=interactableTargets.js.map \ No newline at end of file diff --git a/@interactjs/pointer-events/interactableTargets.js.map b/@interactjs/pointer-events/interactableTargets.js.map new file mode 100644 index 000000000..8b4704c9e --- /dev/null +++ b/@interactjs/pointer-events/interactableTargets.js.map @@ -0,0 +1,46 @@ +{ + "version": 3, + "sources": [ + "interactableTargets.ts" + ], + "names": [ + "extend", + "install", + "scope", + "Interactable", + "prototype", + "pointerEvents", + "pointerEventsMethod", + "__backCompatOption", + "_backCompatOption", + "optionName", + "newValue", + "ret", + "call", + "events", + "options", + "plugin", + "id", + "listeners", + "targets", + "node", + "type", + "eventTarget", + "interactables", + "forEachMatch", + "interactable", + "eventable", + "types", + "length", + "testIgnoreAllow", + "push", + "props", + "getRect", + "element", + "defaults" + ], + "mapp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IAAhB,EAAsBO,MADtB,IAEFH,YAAY,CAACI,eAAb,CAA6Bd,OAA7B,EAAsCK,IAAtC,EAA4CE,WAA5C,CAHA,EAG0D;AACxDH,UAAAA,OAAO,CAACW,IAAR,CAAa;AACXV,YAAAA,IADW;AAEXM,YAAAA,SAFW;AAGXK,YAAAA,KAAK,EAAE;AAAEN,cAAAA;AAAF;AAHI,WAAb;AAKD;AACF,OAdD;AAeD,KAtBQ;AAwBT,wBAAoB,CAAC;AAAEA,MAAAA;AAAF,KAAD,KAAsB;AACxCA,MAAAA,YAAY,CAACX,MAAb,CAAoBkB,OAApB,GAA8B,UAAUC,OAAV,EAAqC;AACjE,eAAOR,YAAY,CAACO,OAAb,CAAqBC,OAArB,CAAP;AACD,OAFD;AAGD,KA5BQ;AA8BT,wBAAoB,CAAC;AAAER,MAAAA,YAAF;AAAgBV,MAAAA;AAAhB,KAAD,EAA4BZ,KAA5B,KAAsC;AACxDF,MAAAA,MAAM,CAACwB,YAAY,CAACX,MAAb,CAAoBC,OAArB,EAA8BZ,KAAK,CAACG,aAAN,CAAoB4B,QAAlD,CAAN;AACAjC,MAAAA,MAAM,CAACwB,YAAY,CAACX,MAAb,CAAoBC,OAArB,EAA8BA,OAAO,CAACT,aAAR,IAAyB,EAAvD,CAAN;AACD;AAjCQ;AAHmB,CAAhC;AAwCA,eAAeU,MAAf", + "sourcesContent": [ + "import { Scope } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\ntype Interactable = import ('@interactjs/core/Interactable').default\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n pointerEvents: typeof pointerEventsMethod\n __backCompatOption: (optionName: string, newValue: any) => any\n }\n}\n\nfunction install (scope: Scope) {\n const { Interactable } = scope\n\n Interactable.prototype.pointerEvents = pointerEventsMethod\n\n const __backCompatOption = Interactable.prototype._backCompatOption\n\n Interactable.prototype._backCompatOption = function (optionName, newValue) {\n const ret = __backCompatOption.call(this, optionName, newValue)\n\n if (ret === this) {\n this.events.options[optionName] = newValue\n }\n\n return ret\n }\n}\n\nfunction pointerEventsMethod (this: Interact.Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Interact.Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({\n targets,\n node,\n type,\n eventTarget,\n }, scope) => {\n scope.interactables.forEachMatch(node, (interactable: Interactable) => {\n const eventable = interactable.events\n const options = eventable.options\n\n if (\n eventable.types[type] &&\n eventable.types[type].length &&\n interactable.testIgnoreAllow(options, node, eventTarget)) {\n targets.push({\n node,\n eventable,\n props: { interactable },\n })\n }\n })\n },\n\n 'interactable:new': ({ interactable }) => {\n interactable.events.getRect = function (element: Interact.Element) {\n return interactable.getRect(element)\n }\n },\n\n 'interactable:set': ({ interactable, options }, scope) => {\n extend(interactable.events.options, scope.pointerEvents.defaults)\n extend(interactable.events.options, options.pointerEvents || {})\n },\n },\n}\n\nexport default plugin\n" + ] +} \ No newline at end of file diff --git a/@interactjs/reflow/.npmignore b/@interactjs/reflow/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/reflow/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/reflow/LICENSE b/@interactjs/reflow/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/reflow/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/reflow/index.d.ts b/@interactjs/reflow/index.d.ts new file mode 100644 index 000000000..167747aab --- /dev/null +++ b/@interactjs/reflow/index.d.ts @@ -0,0 +1,23 @@ +import Interactable from '@interactjs/core/Interactable'; +import { ActionProps } from '@interactjs/core/Interaction'; +import { Scope } from '@interactjs/core/scope'; +declare module '@interactjs/core/Interactable' { + interface Interactable { + reflow: (action: ActionProps) => ReturnType; + } +} +declare module '@interactjs/core/Interaction' { + interface Interaction { + _reflowPromise: Promise; + _reflowResolve: () => void; + } +} +declare module '@interactjs/core/InteractEvent' { + interface PhaseMap { + reflow?: true; + } +} +export declare function install(scope: Scope): void; +declare function reflow(interactable: Interactable, action: ActionProps, scope: Scope): Promise; +declare const _default: import("@interactjs/core/scope").Plugin; +export default _default; diff --git a/@interactjs/reflow/index.js b/@interactjs/reflow/index.js new file mode 100644 index 000000000..d96fb7586 --- /dev/null +++ b/@interactjs/reflow/index.js @@ -0,0 +1,139 @@ +import Interactable from "../core/Interactable.js"; +import { Interaction } from "../core/Interaction.js"; +import { arr, extend, is, pointer as pointerUtils, rect as rectUtils, win } from "../utils/index.js"; +export function install(scope) { + const { + /** @lends Interactable */ + // eslint-disable-next-line no-shadow + Interactable + } = scope; + scope.actions.phases.reflow = true; + /** + * ```js + * const interactable = interact(target) + * const drag = { name: drag, axis: 'x' } + * const resize = { name: resize, edges: { left: true, bottom: true } + * + * interactable.reflow(drag) + * interactable.reflow(resize) + * ``` + * + * Start an action sequence to re-apply modifiers, check drops, etc. + * + * @param { Object } action The action to begin + * @param { string } action.name The name of the action + * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended + */ + + Interactable.prototype.reflow = function (action) { + return reflow(this, action, scope); + }; +} + +function reflow(interactable, action, scope) { + const elements = is.string(interactable.target) ? arr.from(interactable._context.querySelectorAll(interactable.target)) : [interactable.target]; // tslint:disable-next-line variable-name + + const Promise = win.window.Promise; + const promises = Promise ? [] : null; + + for (const element of elements) { + const rect = interactable.getRect(element); + + if (!rect) { + break; + } + + const runningInteraction = arr.find(scope.interactions.list, interaction => { + return interaction.interacting() && interaction.interactable === interactable && interaction.element === element && interaction.prepared.name === action.name; + }); + let reflowPromise; + + if (runningInteraction) { + runningInteraction.move(); + + if (promises) { + reflowPromise = runningInteraction._reflowPromise || new Promise(resolve => { + runningInteraction._reflowResolve = resolve; + }); + } + } else { + const xywh = rectUtils.tlbrToXywh(rect); + const coords = { + page: { + x: xywh.x, + y: xywh.y + }, + client: { + x: xywh.x, + y: xywh.y + }, + timeStamp: scope.now() + }; + const event = pointerUtils.coordsToEvent(coords); + reflowPromise = startReflow(scope, interactable, element, action, event); + } + + if (promises) { + promises.push(reflowPromise); + } + } + + return promises && Promise.all(promises).then(() => interactable); +} + +function startReflow(scope, interactable, element, action, event) { + const interaction = scope.interactions.new({ + pointerType: 'reflow' + }); + const signalArg = { + interaction, + event, + pointer: event, + eventTarget: element, + phase: 'reflow' + }; + interaction.interactable = interactable; + interaction.element = element; + interaction.prepared = extend({}, action); + interaction.prevEvent = event; + interaction.updatePointer(event, event, element, true); + + interaction._doPhase(signalArg); + + const reflowPromise = win.window.Promise ? new win.window.Promise(resolve => { + interaction._reflowResolve = resolve; + }) : null; + interaction._reflowPromise = reflowPromise; + interaction.start(action, interactable, element); + + if (interaction._interacting) { + interaction.move(signalArg); + interaction.end(event); + } else { + interaction.stop(); + } + + interaction.removePointer(event, event); + interaction.pointerIsDown = false; + return reflowPromise; +} + +export default { + id: 'reflow', + install, + listeners: { + // remove completed reflow interactions + 'interactions:stop': ({ + interaction + }, scope) => { + if (interaction.pointerType === 'reflow') { + if (interaction._reflowResolve) { + interaction._reflowResolve(); + } + + arr.remove(scope.interactions.list, interaction); + } + } + } +}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/reflow/index.js.map b/@interactjs/reflow/index.js.map new file mode 100644 index 000000000..c0d244c66 --- /dev/null +++ b/@interactjs/reflow/index.js.map @@ -0,0 +1,86 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "Interactable", + "Interaction", + "arr", + "extend", + "is", + "pointer", + "pointerUtils", + "rect", + "rectUtils", + "win", + "install", + "scope", + "actions", + "phases", + "reflow", + "prototype", + "action", + "interactable", + "elements", + "string", + "target", + "from", + "_context", + "querySelectorAll", + "Promise", + "window", + "promises", + "element", + "getRect", + "runningInteraction", + "find", + "interactions", + "list", + "interaction", + "interacting", + "prepared", + "name", + "reflowPromise", + "move", + "_reflowPromise", + "resolve", + "_reflowResolve", + "xywh", + "tlbrToXywh", + "coords", + "page", + "x", + "y", + "client", + "timeStamp", + "now", + "event", + "coordsToEvent", + "startReflow", + "push", + "all", + "then", + "new", + "pointerType", + "signalArg", + "eventTarget", + "phase", + "prevEvent", + "updatePointer", + "_doPhase", + "start", + "_interacting", + "end", + "stop", + "removePointer", + "pointerIsDown", + "id", + "listeners", + "remove" + ], + "mappings": "AAAA,OAAOA,YAAP;AACA,SAAsBC,WAAtB;AAEA,SAASC,GAAT,EAAcC,MAAd,EAAsBC,EAAtB,EAA0BC,OAAO,IAAIC,YAArC,EAAmDC,IAAI,IAAIC,SAA3D,EAAsEC,GAAtE;AAsBA,OAAO,SAASC,OAAT,CAAkBC,KAAlB,EAAgC;AACrC,QAAM;AACJ;AACA;AACAX,IAAAA;AAHI,MAIFW,KAJJ;AAMAA,EAAAA,KAAK,CAACC,OAAN,CAAcC,MAAd,CAAqBC,MAArB,GAA8B,IAA9B;AAEA;;;;;;;;;;;;;;;;;A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AA,OAFa;AAGb8D,EAAAA,SAAS,EAAE;AACT;AACA,yBAAqB,CAAC;AAAEvC,MAAAA;AAAF,KAAD,EAAkBtB,KAAlB,KAA4B;AAC/C,UAAIsB,WAAW,CAACyB,WAAZ,KAA4B,QAAhC,EAA0C;AACxC,YAAIzB,WAAW,CAACQ,cAAhB,EAAgC;AAC9BR,UAAAA,WAAW,CAACQ,cAAZ;AACD;;AAEDvC,QAAAA,GAAG,CAACuE,MAAJ,CAAW9D,KAAK,CAACoB,YAAN,CAAmBC,IAA9B,EAAoCC,WAApC;AACD;AACF;AAVQ;AAHE,CAAf", + "sourcesContent": [ + "import Interactable from '@interactjs/core/Interactable'\nimport { ActionProps, Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport { arr, extend, is, pointer as pointerUtils, rect as rectUtils, win } from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n reflow: (action: ActionProps) => ReturnType\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n _reflowPromise: Promise\n _reflowResolve: () => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\n // eslint-disable-next-line no-shadow\n Interactable,\n } = scope\n\n scope.actions.phases.reflow = true\n\n /**\n * ```js\n * const interactable = interact(target)\n * const drag = { name: drag, axis: 'x' }\n * const resize = { name: resize, edges: { left: true, bottom: true }\n *\n * interactable.reflow(drag)\n * interactable.reflow(resize)\n * ```\n *\n * Start an action sequence to re-apply modifiers, check drops, etc.\n *\n * @param { Object } action The action to begin\n * @param { string } action.name The name of the action\n * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended\n */\n Interactable.prototype.reflow = function (action) {\n return reflow(this, action, scope)\n }\n}\n\nfunction reflow (interactable: Interactable, action: ActionProps, scope: Scope): Promise {\n const elements = (is.string(interactable.target)\n ? arr.from(interactable._context.querySelectorAll(interactable.target))\n : [interactable.target]) as Interact.Element[]\n\n // tslint:disable-next-line variable-name\n const Promise = (win.window as any).Promise\n const promises: Array> | null = Promise ? [] : null\n\n for (const element of elements) {\n const rect = interactable.getRect(element as HTMLElement | SVGElement)\n\n if (!rect) { break }\n\n const runningInteraction = arr.find(\n scope.interactions.list,\n (interaction: Interaction) => {\n return interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise = runningInteraction._reflowPromise || new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n }\n else {\n const xywh = rectUtils.tlbrToXywh(rect)\n const coords = {\n page : { x: xywh.x, y: xywh.y },\n client : { x: xywh.x, y: xywh.y },\n timeStamp: scope.now(),\n }\n\n const event = pointerUtils.coordsToEvent(coords)\n reflowPromise = startReflow(scope, interactable, element, action, event)\n }\n\n if (promises) {\n promises.push(reflowPromise)\n }\n }\n\n return promises && Promise.all(promises).then(() => interactable)\n}\n\nfunction startReflow (scope: Scope, interactable: Interactable, element: Interact.Element, action: ActionProps, event: any) {\n const interaction = scope.interactions.new({ pointerType: 'reflow' })\n const signalArg = {\n interaction,\n event,\n pointer: event,\n eventTarget: element,\n phase: 'reflow',\n } as const\n\n interaction.interactable = interactable\n interaction.element = element\n interaction.prepared = extend({}, action)\n interaction.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n\n interaction._doPhase(signalArg)\n\n const reflowPromise = (win.window as unknown as any).Promise\n ? new (win.window as unknown as any).Promise((resolve: any) => {\n interaction._reflowResolve = resolve\n })\n : null\n\n interaction._reflowPromise = reflowPromise\n interaction.start(action, interactable, element)\n\n if (interaction._interacting) {\n interaction.move(signalArg)\n interaction.end(event)\n }\n else {\n interaction.stop()\n }\n\n interaction.removePointer(event, event)\n interaction.pointerIsDown = false\n\n return reflowPromise\n}\n\nexport default {\n id: 'reflow',\n install,\n listeners: {\n // remove completed reflow interactions\n 'interactions:stop': ({ interaction }, scope) => {\n if (interaction.pointerType === 'reflow') {\n if (interaction._reflowResolve) {\n interaction._reflowResolve()\n }\n\n arr.remove(scope.interactions.list, interaction)\n }\n },\n },\n} as Interact.Plugin\n" + ] +} \ No newline at end of file diff --git a/@interactjs/reflow/reflow.spec.d.ts b/@interactjs/reflow/reflow.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/reflow/reflow.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/types/.npmignore b/@interactjs/types/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/types/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/types/LICENSE b/@interactjs/types/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/types/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/types/NativePointerEventType.d.ts b/@interactjs/types/NativePointerEventType.d.ts new file mode 100644 index 000000000..98a3fe135 --- /dev/null +++ b/@interactjs/types/NativePointerEventType.d.ts @@ -0,0 +1 @@ +export default PointerEvent; diff --git a/@interactjs/types/NativePointerEventType.js b/@interactjs/types/NativePointerEventType.js new file mode 100644 index 000000000..2868da298 --- /dev/null +++ b/@interactjs/types/NativePointerEventType.js @@ -0,0 +1,2 @@ +export default PointerEvent; +//# sourceMappingURL=NativePointerEventType.js.map \ No newline at end of file diff --git a/@interactjs/types/NativePointerEventType.js.map b/@interactjs/types/NativePointerEventType.js.map new file mode 100644 index 000000000..b16d52e22 --- /dev/null +++ b/@interactjs/types/NativePointerEventType.js.map @@ -0,0 +1,13 @@ +{ + "version": 3, + "sources": [ + "NativePointerEventType.ts" + ], + "names": [ + "PointerEvent" + ], + "mappings": "AAAA,eAAeA,YAAf", + "sourcesContent": [ + "export default PointerEvent\n" + ] +} \ No newline at end of file diff --git a/@interactjs/types/index.d.ts b/@interactjs/types/index.d.ts new file mode 100644 index 000000000..8d2205dfa --- /dev/null +++ b/@interactjs/types/index.d.ts @@ -0,0 +1 @@ +/// diff --git a/@interactjs/types/index.js b/@interactjs/types/index.js new file mode 100644 index 000000000..77c678825 --- /dev/null +++ b/@interactjs/types/index.js @@ -0,0 +1,2 @@ +/// +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/types/index.js.map b/@interactjs/types/index.js.map new file mode 100644 index 000000000..fdb992c59 --- /dev/null +++ b/@interactjs/types/index.js.map @@ -0,0 +1,11 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [], + "mappings": "AAAA", + "sourcesContent": [ + "/// \n" + ] +} \ No newline at end of file diff --git a/@interactjs/types/interactjs-test.d.ts b/@interactjs/types/interactjs-test.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/types/interactjs-test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/types/interactjs-test.js b/@interactjs/types/interactjs-test.js new file mode 100644 index 000000000..1fe0e57b5 --- /dev/null +++ b/@interactjs/types/interactjs-test.js @@ -0,0 +1,244 @@ +// eslint-disable-next-line node/no-extraneous-import +import interact from "../interactjs/index.js"; // Interactables + +interact(document.body); +interact(document); +interact(window); +interact('.drag-and-resize').draggable({ + inertia: true, + modifiers: [interact.modifiers.snap({ + targets: [{ + x: 100, + y: 200 + }, (x, y) => ({ + x: x % 20, + y + }), interact.snappers.grid({ + x: 20, + y: 0 + })], + offset: 'startCoords', + relativePoints: [{ + x: 0, + y: 1 + }], + endOnly: true + }), interact.modifiers.snapSize({ + targets: [{ + x: 100, + y: 200 + }, (x, y) => ({ + x: x % 20, + y + }), interact.snappers.grid({ + width: 100, + height: 500 + })], + endOnly: true + }), interact.modifiers.restrictRect({ + restriction: 'parent', + endOnly: true + }), interact.modifiers.restrict({ + restriction: _ => ({ + top: 0, + left: 0, + bottom: 1, + right: 1 + }) + }), interact.modifiers.restrict({ + restriction: _ => document.body + }), interact.modifiers.restrictSize({ + min: document.body, + max: 'parent' + }), interact.modifiers.restrictEdges({ + inner: document.body, + outer: 'parent' + })] +}).resizable({ + inertia: true +}); // Selector context + +const myList = document.querySelector('#my-list'); +interact('li', { + context: myList +}).draggable({ + /* ... */ +}); // Action options + +const target = 'li'; +interact(target).draggable({ + max: 1, + maxPerElement: 2, + manualStart: true, + modifiers: [], + inertia: { + /* ... */ + }, + autoScroll: { + /* ... */ + }, + lockAxis: 'x' || 'y' || 'start', + startAxis: 'x' || 'y' +}).resizable({ + max: 1, + maxPerElement: 2, + manualStart: true, + modifiers: [], + inertia: { + /* ... */ + }, + autoScroll: { + /* ... */ + }, + margin: 50, + square: true || false, + axis: 'x' || 'y' +}).gesturable({ + max: 1, + maxPerElement: 2, + manualStart: true, + modifiers: [] +}); // autoscroll + +const element = 'li'; +interact(element).draggable({ + autoScroll: true +}).resizable({ + autoScroll: { + container: document.body, + margin: 50, + distance: 5, + interval: 10 + } +}); // axis + +interact(target).draggable({ + startAxis: 'x', + lockAxis: 'y' +}).draggable({ + startAxis: 'xy', + lockAxis: 'x' +}); +interact(target).resizable({ + axis: 'x' +}); +const handleEl = 'li'; +interact(target).resizable({ + edges: { + top: true, + // Use pointer coords to check for resize. + left: false, + // Disable resizing from left edge. + bottom: '.resize-s', + // Resize if pointer target matches selector + right: handleEl // Resize if pointer target is the given Element + + } +}); // resize invert + +interact(target).resizable({ + edges: { + bottom: true, + right: true + }, + invert: 'reposition' +}); // resize square + +interact(target).resizable({ + squareResize: true +}); // dropzone accept + +interact(target).dropzone({ + accept: '.drag0, .drag1' +}); // dropzone overlap + +interact(target).dropzone({ + overlap: 0.25 +}); // dropzone checker + +interact(target).dropzone({ + checker(_dragEvent, // related dragmove or dragend + _event, // Touch, Pointer or Mouse Event + dropped, // bool default checker result + _dropzone, // dropzone Interactable + dropElement, // dropzone elemnt + _draggable, // draggable Interactable + _draggableElement) { + // draggable element + // only allow drops into empty dropzone elements + return dropped && !dropElement.hasChildNodes(); + } + +}); +interact.dynamicDrop(); +interact.dynamicDrop(false); // Events + +function listener(event) { + const { + type, + pageX, + pageY + } = event; + alert({ + type, + pageX, + pageY + }); +} + +interact(target).on('dragstart', listener).on('dragmove dragend', listener).on(['resizemove', 'resizeend'], listener).on({ + gesturestart: listener, + gestureend: listener +}); +interact.on('resize', event => { + const { + rect, + deltaRect + } = event; + alert(JSON.stringify({ + rect, + deltaRect + })); +}); +interact(target).resizable({ + listeners: [{ + start: listener, + move: listener + }] +}); +interact(target).draggable({ + listeners: { + start: listener, + end: listener + } +}); +interact(target).draggable({ + onstart: listener, + onmove: listener, + onend: listener +}); +interact.on(['dragmove', 'resizestart'], listener); // devTools options + +interact(target).devTools({ + ignore: { + boxSizing: true, + touchAction: true + } +}); +const dropTarget = 'div'; // Drop Events + +interact(dropTarget).dropzone({ + ondrop(event) { + alert(event.relatedTarget.id + ' was dropped into ' + event.target.id); + } + +}).on('dropactivate', event => { + event.target.classList.add('drop-activated'); +}); +interact(target).on('up', _event => {}); // fast click + +interact('a[href]').on('tap', event => { + window.location.href = event.currentTarget.href; + event.preventDefault(); +}); +//# sourceMappingURL=interactjs-test.js.map \ No newline at end of file diff --git a/@interactjs/types/interactjs-test.js.map b/@interactjs/types/interactjs-test.js.map new file mode 100644 index 000000000..51bdc17a5 --- /dev/null +++ b/@interactjs/types/interactjs-test.js.map @@ -0,0 +1,114 @@ +{ + "version": 3, + "sources": [ + "interactjs-test.ts" + ], + "names": [ + "interact", + "document", + "body", + "window", + "draggable", + "inertia", + "modifiers", + "snap", + "targets", + "x", + "y", + "snappers", + "grid", + "offset", + "relativePoints", + "endOnly", + "snapSize", + "width", + "height", + "restrictRect", + "restriction", + "restrict", + "_", + "top", + "left", + "bottom", + "right", + "restrictSize", + "min", + "max", + "restrictEdges", + "inner", + "outer", + "resizable", + "myList", + "querySelector", + "context", + "target", + "maxPerElement", + "manualStart", + "autoScroll", + "lockAxis", + "startAxis", + "margin", + "square", + "axis", + "gesturable", + "element", + "container", + "distance", + "interval", + "handleEl", + "edges", + "invert", + "squareResize", + "dropzone", + "accept", + "overlap", + "checker", + "_dragEvent", + "_event", + "dropped", + "_dropzone", + "dropElement", + "_draggable", + "_draggableElement", + "hasChildNodes", + "dynamicDrop", + "listener", + "event", + "type", + "pageX", + "pageY", + "alert", + "on", + "gesturestart", + "gestureend", + "rect", + "deltaRect", + "JSON", + "stringify", + "listeners", + "start", + "move", + "end", + "onstart", + "onmove", + "onend", + "devTools", + "ignore", + "boxSizing", + "touchAction", + "dropTarget", + "ondrop", + "relatedTarget", + "id", + "classList", + "add", + "location", + "href", + "currentTarget", + "preventDefault" + ], + "mappings": "AAAA;AACA,OAAOA,QAAP,+B,CAEA;;AACAA,QAAQ,CAACC,QAAQ,CAACC,IAAV,CAAR;AACAF,QAAQ,CAACC,QAAD,CAAR;AACAD,QAAQ,CAACG,M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ous-import\nimport interact from '@interactjs/interactjs/index'\n\n// Interactables\ninteract(document.body)\ninteract(document)\ninteract(window)\n\ninteract('.drag-and-resize')\n .draggable({\n inertia: true,\n modifiers: [\n interact.modifiers.snap({\n targets: [\n { x: 100, y: 200 },\n (x: number, y: number) => ({ x: x % 20, y }),\n interact.snappers.grid({ x: 20, y: 0 }),\n ],\n offset: 'startCoords',\n relativePoints: [{ x: 0, y: 1 }],\n endOnly: true,\n }),\n interact.modifiers.snapSize({\n targets: [\n { x: 100, y: 200 },\n (x: number, y: number) => ({ x: x % 20, y }),\n interact.snappers.grid({ width: 100, height: 500 }),\n ],\n endOnly: true,\n }),\n interact.modifiers.restrictRect({\n restriction: 'parent',\n endOnly: true,\n }),\n interact.modifiers.restrict({\n restriction: _ => ({ top: 0, left: 0, bottom: 1, right: 1 }),\n }),\n interact.modifiers.restrict({\n restriction: _ => document.body,\n }),\n interact.modifiers.restrictSize({\n min: document.body,\n max: 'parent',\n }),\n interact.modifiers.restrictEdges({\n inner: document.body,\n outer: 'parent',\n }),\n ],\n })\n .resizable({\n inertia: true,\n })\n\n// Selector context\nconst myList: HTMLElement | SVGElement = document.querySelector('#my-list')\n\ninteract('li', {\n context: myList,\n})\n .draggable({ /* ... */ })\n\n// Action options\nconst target = 'li'\ninteract(target)\n .draggable({\n max : 1,\n maxPerElement: 2,\n manualStart : true,\n modifiers : [],\n inertia : {/* ... */},\n autoScroll : {/* ... */},\n\n lockAxis : 'x' || 'y' || 'start',\n startAxis : 'x' || 'y',\n })\n .resizable({\n max : 1,\n maxPerElement: 2,\n manualStart : true,\n modifiers : [],\n inertia : {/* ... */},\n autoScroll : {/* ... */},\n margin : 50,\n\n square : true || false,\n axis : 'x' || 'y',\n })\n .gesturable({\n max : 1,\n maxPerElement: 2,\n manualStart : true,\n modifiers : [],\n })\n\n// autoscroll\nconst element = 'li'\ninteract(element)\n .draggable({\n autoScroll: true,\n })\n .resizable({\n autoScroll: {\n container: document.body,\n margin: 50,\n distance: 5,\n interval: 10,\n },\n })\n\n// axis\ninteract(target).draggable({\n startAxis: 'x',\n lockAxis: 'y',\n}).draggable({\n startAxis: 'xy',\n lockAxis: 'x',\n})\n\ninteract(target).resizable({\n axis: 'x',\n})\n\nconst handleEl = 'li'\ninteract(target).resizable({\n edges: {\n top : true, // Use pointer coords to check for resize.\n left : false, // Disable resizing from left edge.\n bottom: '.resize-s', // Resize if pointer target matches selector\n right : handleEl, // Resize if pointer target is the given Element\n },\n})\n\n// resize invert\ninteract(target).resizable({\n edges: { bottom: true, right: true },\n invert: 'reposition',\n})\n\n// resize square\ninteract(target).resizable({\n squareResize: true,\n})\n\n// dropzone accept\ninteract(target).dropzone({\n accept: '.drag0, .drag1',\n})\n\n// dropzone overlap\ninteract(target).dropzone({\n overlap: 0.25,\n})\n\n// dropzone checker\ninteract(target).dropzone({\n checker (\n _dragEvent: Interact.Element, // related dragmove or dragend\n _event: Event, // Touch, Pointer or Mouse Event\n dropped: boolean, // bool default checker result\n _dropzone: Interact.Interactable, // dropzone Interactable\n dropElement: Interact.Element, // dropzone elemnt\n _draggable: Interact.Interactable, // draggable Interactable\n _draggableElement: Interact.Element) { // draggable element\n // only allow drops into empty dropzone elements\n return dropped && !dropElement.hasChildNodes()\n },\n})\n\ninteract.dynamicDrop()\ninteract.dynamicDrop(false)\n\n// Events\nfunction listener (event) {\n const { type, pageX, pageY } = event\n alert({ type, pageX, pageY })\n}\n\ninteract(target)\n .on('dragstart', listener)\n .on('dragmove dragend', listener)\n .on(['resizemove', 'resizeend'], listener)\n .on({\n gesturestart: listener,\n gestureend: listener,\n })\n\ninteract.on('resize', (event: Interact.ResizeEvent) => {\n const { rect, deltaRect } = event\n alert(JSON.stringify({ rect, deltaRect }))\n})\n\ninteract(target).resizable({\n listeners: [\n { start: listener, move: listener },\n ],\n})\n\ninteract(target).draggable({\n listeners: { start: listener, end: listener },\n})\n\ninteract(target).draggable({\n onstart: listener,\n onmove: listener,\n onend: listener,\n})\n\ninteract.on(['dragmove', 'resizestart'], listener)\n\n// devTools options\ninteract(target).devTools({\n ignore: { boxSizing: true, touchAction: true },\n})\n\nconst dropTarget = 'div'\n// Drop Events\ninteract(dropTarget)\n .dropzone({\n ondrop (event) {\n alert(event.relatedTarget.id +\n ' was dropped into ' +\n event.target.id)\n },\n })\n .on('dropactivate', event => {\n event.target.classList.add('drop-activated')\n })\n\ninteract(target).on('up', _event => {})\n\n// fast click\ninteract('a[href]').on('tap', event => {\n window.location.href = event.currentTarget.href\n\n event.preventDefault()\n})\n" + ] +} \ No newline at end of file diff --git a/@interactjs/types/types.spec.d.ts b/@interactjs/types/types.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/types/types.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/utils/.npmignore b/@interactjs/utils/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/@interactjs/utils/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/@interactjs/utils/LICENSE b/@interactjs/utils/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/@interactjs/utils/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/@interactjs/utils/arr.d.ts b/@interactjs/utils/arr.d.ts new file mode 100644 index 000000000..515cba641 --- /dev/null +++ b/@interactjs/utils/arr.d.ts @@ -0,0 +1,8 @@ +declare type Filter = (element: T, index: number, array: T[]) => boolean; +export declare function contains(array: T[], target: T): boolean; +export declare function remove(array: T[], target: T): T[]; +export declare function merge(target: Array, source: U[]): (T | U)[]; +export declare function from(source: ArrayLike): T[]; +export declare function findIndex(array: T[], func: Filter): number; +export declare function find(array: T[], func: Filter): T; +export {}; diff --git a/@interactjs/utils/arr.js b/@interactjs/utils/arr.js new file mode 100644 index 000000000..81f52fea2 --- /dev/null +++ b/@interactjs/utils/arr.js @@ -0,0 +1,29 @@ +export function contains(array, target) { + return array.indexOf(target) !== -1; +} +export function remove(array, target) { + return array.splice(array.indexOf(target), 1); +} +export function merge(target, source) { + for (const item of source) { + target.push(item); + } + + return target; +} +export function from(source) { + return merge([], source); +} +export function findIndex(array, func) { + for (let i = 0; i < array.length; i++) { + if (func(array[i], i, array)) { + return i; + } + } + + return -1; +} +export function find(array, func) { + return array[findIndex(array, func)]; +} +//# sourceMappingURL=arr.js.map \ No newline at end of file diff --git a/@interactjs/utils/arr.js.map b/@interactjs/utils/arr.js.map new file mode 100644 index 000000000..84f92d778 --- /dev/null +++ b/@interactjs/utils/arr.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "sources": [ + "arr.ts" + ], + "names": [ + "contains", + "array", + "target", + "indexOf", + "remove", + "splice", + "merge", + "source", + "item", + "push", + "from", + "findIndex", + "func", + "i", + "length", + "find" + ], + "mappings": "AAEA,OAAO,SAASA,QAAT,CAAsBC,KAAtB,EAAkCC,MAAlC,EAA6C;AAClD,SAAOD,KAAK,CAACE,OAAN,CAAcD,MAAd,MAA0B,CAAC,CAAlC;AACD;AAED,OAAO,SAASE,MAAT,CAAoBH,KAApB,EAAgCC,MAAhC,EAA2C;AAChD,SAAOD,KAAK,CAACI,MAAN,CAAaJ,KAAK,CAACE,OAAN,CAAcD,MAAd,CAAb,EAAoC,CAApC,CAAP;AACD;AAED,OAAO,SAASI,KAAT,CAAsBJ,MAAtB,EAA4CK,MAA5C,EAAyD;AAC9D,OAAK,MAAMC,IAAX,IAAmBD,MAAnB,EAA2B;AACzBL,IAAAA,MAAM,CAACO,IAAP,CAAYD,IAAZ;AACD;;AAED,SAAON,MAAP;AACD;AAED,OAAO,SAASQ,IAAT,CAAwBH,MAAxB,EAA8C;AACnD,SAAOD,KAAK,CAAC,EAAD,EAAYC,MAAZ,CAAZ;AACD;AAED,OAAO,SAASI,SAAT,CAAuBV,KAAvB,EAAmCW,IAAnC,EAAoD;AACzD,OAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGZ,KAAK,CAACa,MAA1B,EAAkCD,CAAC,EAAnC,EAAuC;AACrC,QAAID,IAAI,CAACX,KAAK,CAACY,CAAD,CAAN,EAAWA,CAAX,EAAcZ,KAAd,CAAR,EAA8B;AAC5B,aAAOY,CAAP;AACD;AACF;;AAED,SAAO,CAAC,CAAR;AACD;AAED,OAAO,SAASE,IAAT,CAAwBd,KAAxB,EAAoCW,IAApC,EAAqD;AAC1D,SAAOX,KAAK,CAACU,SAAS,CAACV,KAAD,EAAQW,IAAR,CAAV,CAAZ;AACD", + "sourcesContent": [ + "type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport function contains (array: T[], target: T) {\n return array.indexOf(target) !== -1\n}\n\nexport function remove (array: T[], target: T) {\n return array.splice(array.indexOf(target), 1)\n}\n\nexport function merge (target: Array, source: U[]) {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport function from (source: ArrayLike) {\n return merge([] as T[], source as T[])\n}\n\nexport function findIndex (array: T[], func: Filter) {\n for (let i = 0; i < array.length; i++) {\n if (func(array[i], i, array)) {\n return i\n }\n }\n\n return -1\n}\n\nexport function find (array: T[], func: Filter) {\n return array[findIndex(array, func)]\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/browser.d.ts b/@interactjs/utils/browser.d.ts new file mode 100644 index 000000000..95b2654d1 --- /dev/null +++ b/@interactjs/utils/browser.d.ts @@ -0,0 +1,21 @@ +declare const browser: { + init: typeof init; + supportsTouch: boolean; + supportsPointerEvent: boolean; + isIOS7: boolean; + isIOS: boolean; + isIe9: boolean; + isOperaMobile: boolean; + prefixedMatchesSelector: string; + pEventTypes: { + up: string; + down: string; + over: string; + out: string; + move: string; + cancel: string; + }; + wheelEvent: string; +}; +declare function init(window: any): void; +export default browser; diff --git a/@interactjs/utils/browser.js b/@interactjs/utils/browser.js new file mode 100644 index 000000000..9cfb27f8c --- /dev/null +++ b/@interactjs/utils/browser.js @@ -0,0 +1,52 @@ +import domObjects from "./domObjects.js"; +import * as is from "./is.js"; +import win from "./window.js"; +const browser = { + init, + supportsTouch: null, + supportsPointerEvent: null, + isIOS7: null, + isIOS: null, + isIe9: null, + isOperaMobile: null, + prefixedMatchesSelector: null, + pEventTypes: null, + wheelEvent: null +}; + +function init(window) { + const Element = domObjects.Element; + const navigator = win.window.navigator; // Does the browser support touch input? + + browser.supportsTouch = 'ontouchstart' in window || is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch; // Does the browser support PointerEvents + + browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!domObjects.PointerEvent; + browser.isIOS = /iP(hone|od|ad)/.test(navigator.platform); // scrolling doesn't change the result of getClientRects on iOS 7 + + browser.isIOS7 = /iP(hone|od|ad)/.test(navigator.platform) && /OS 7[^\d]/.test(navigator.appVersion); + browser.isIe9 = /MSIE 9/.test(navigator.userAgent); // Opera Mobile must be handled differently + + browser.isOperaMobile = navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent); // prefix matchesSelector + + browser.prefixedMatchesSelector = 'matches' in Element.prototype ? 'matches' : 'webkitMatchesSelector' in Element.prototype ? 'webkitMatchesSelector' : 'mozMatchesSelector' in Element.prototype ? 'mozMatchesSelector' : 'oMatchesSelector' in Element.prototype ? 'oMatchesSelector' : 'msMatchesSelector'; + browser.pEventTypes = browser.supportsPointerEvent ? domObjects.PointerEvent === window.MSPointerEvent ? { + up: 'MSPointerUp', + down: 'MSPointerDown', + over: 'mouseover', + out: 'mouseout', + move: 'MSPointerMove', + cancel: 'MSPointerCancel' + } : { + up: 'pointerup', + down: 'pointerdown', + over: 'pointerover', + out: 'pointerout', + move: 'pointermove', + cancel: 'pointercancel' + } : null; // because Webkit and Opera still use 'mousewheel' event type + + browser.wheelEvent = 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'; +} + +export default browser; +//# sourceMappingURL=browser.js.map \ No newline at end of file diff --git a/@interactjs/utils/browser.js.map b/@interactjs/utils/browser.js.map new file mode 100644 index 000000000..7fcb7eb46 --- /dev/null +++ b/@interactjs/utils/browser.js.map @@ -0,0 +1,47 @@ +{ + "version": 3, + "sources": [ + "browser.ts" + ], + "names": [ + "domObjects", + "is", + "win", + "browser", + "init", + "supportsTouch", + "supportsPointerEvent", + "isIOS7", + "isIOS", + "isIe9", + "isOperaMobile", + "prefixedMatchesSelector", + "pEventTypes", + "wheelEvent", + "window", + "Element", + "navigator", + "func", + "DocumentTouch", + "document", + "pointerEnabled", + "PointerEvent", + "test", + "platform", + "appVersion", + "userAgent", + "appName", + "prototype", + "MSPointerEvent", + "up", + "down", + "over", + "out", + "move", + "cancel" + ], + "mappings": "AAAA,OAAOA,UAAP;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,GAAP;AAEA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IADc;AAEdC,EAAAA,aAAa,EAAE,IAFD;AAGdC,EAAAA,oBAAoB,EAAE,IAHR;AAIdC,EAAAA,MAAM,EAAE,IAJM;AAKdC,EAAAA,KAAK,EAAE,IALO;A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A2BZ,OAAO,CAACY,SAAnC,GACE,uBADF,GAEE,wBAAwBZ,OAAO,CAACY,SAAhC,GACE,oBADF,GAEE,sBAAsBZ,OAAO,CAACY,SAA9B,GACE,kBADF,GAEE,mBARV;AAUAxB,EAAAA,OAAO,CAACS,WAAR,GAAuBT,OAAO,CAACG,oBAAR,GAClBN,UAAU,CAACqB,YAAX,KAA4BP,MAAM,CAACc,cAAnC,GACC;AACAC,IAAAA,EAAE,EAAM,aADR;AAEAC,IAAAA,IAAI,EAAI,eAFR;AAGAC,IAAAA,IAAI,EAAI,WAHR;AAIAC,IAAAA,GAAG,EAAK,UAJR;AAKAC,IAAAA,IAAI,EAAI,eALR;AAMAC,IAAAA,MAAM,EAAE;AANR,GADD,GASC;AACAL,IAAAA,EAAE,EAAM,WADR;AAEAC,IAAAA,IAAI,EAAI,aAFR;AAGAC,IAAAA,IAAI,EAAI,aAHR;AAIAC,IAAAA,GAAG,EAAK,YAJR;AAKAC,IAAAA,IAAI,EAAI,aALR;AAMAC,IAAAA,MAAM,EAAE;AANR,GAViB,GAkBnB,IAlBJ,CAnC0B,CAuD1B;;AACA/B,EAAAA,OAAO,CAACU,UAAR,GAAqB,kBAAkBb,UAAU,CAACmB,QAA7B,GAAwC,YAAxC,GAAuD,OAA5E;AACD;;AAED,eAAehB,OAAf", + "sourcesContent": [ + "import domObjects from './domObjects'\nimport * as is from './is'\nimport win from './window'\n\nconst browser = {\n init,\n supportsTouch: null as boolean,\n supportsPointerEvent: null as boolean,\n isIOS7: null as boolean,\n isIOS: null as boolean,\n isIe9: null as boolean,\n isOperaMobile: null as boolean,\n prefixedMatchesSelector: null as string,\n pEventTypes: null as {\n up: string\n down: string\n over: string\n out: string\n move: string\n cancel: string\n },\n wheelEvent: null as string,\n}\n\nfunction init (window: any) {\n const Element = domObjects.Element\n const navigator = win.window.navigator\n\n // Does the browser support touch input?\n browser.supportsTouch = ('ontouchstart' in window) ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!domObjects.PointerEvent\n\n browser.isIOS = (/iP(hone|od|ad)/.test(navigator.platform))\n\n // scrolling doesn't change the result of getClientRects on iOS 7\n browser.isIOS7 = (/iP(hone|od|ad)/.test(navigator.platform) &&\n /OS 7[^\\d]/.test(navigator.appVersion))\n\n browser.isIe9 = /MSIE 9/.test(navigator.userAgent)\n\n // Opera Mobile must be handled differently\n browser.isOperaMobile = (navigator.appName === 'Opera' &&\n browser.supportsTouch &&\n /Presto/.test(navigator.userAgent))\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = 'matches' in Element.prototype\n ? 'matches'\n : 'webkitMatchesSelector' in Element.prototype\n ? 'webkitMatchesSelector'\n : 'mozMatchesSelector' in Element.prototype\n ? 'mozMatchesSelector'\n : 'oMatchesSelector' in Element.prototype\n ? 'oMatchesSelector'\n : 'msMatchesSelector'\n\n browser.pEventTypes = (browser.supportsPointerEvent\n ? (domObjects.PointerEvent === window.MSPointerEvent\n ? {\n up: 'MSPointerUp',\n down: 'MSPointerDown',\n over: 'mouseover',\n out: 'mouseout',\n move: 'MSPointerMove',\n cancel: 'MSPointerCancel',\n }\n : {\n up: 'pointerup',\n down: 'pointerdown',\n over: 'pointerover',\n out: 'pointerout',\n move: 'pointermove',\n cancel: 'pointercancel',\n })\n : null)\n\n // because Webkit and Opera still use 'mousewheel' event type\n browser.wheelEvent = 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/clone.d.ts b/@interactjs/utils/clone.d.ts new file mode 100644 index 000000000..08b411b09 --- /dev/null +++ b/@interactjs/utils/clone.d.ts @@ -0,0 +1 @@ +export default function clone(source: T): Partial; diff --git a/@interactjs/utils/clone.js b/@interactjs/utils/clone.js new file mode 100644 index 000000000..2458c9a92 --- /dev/null +++ b/@interactjs/utils/clone.js @@ -0,0 +1,21 @@ +import * as arr from "./arr.js"; +import * as is from "./is.js"; // tslint:disable-next-line ban-types + +export default function clone(source) { + const dest = {}; + + for (const prop in source) { + const value = source[prop]; + + if (is.plainObject(value)) { + dest[prop] = clone(value); + } else if (is.array(value)) { + dest[prop] = arr.from(value); + } else { + dest[prop] = value; + } + } + + return dest; +} +//# sourceMappingURL=clone.js.map \ No newline at end of file diff --git a/@interactjs/utils/clone.js.map b/@interactjs/utils/clone.js.map new file mode 100644 index 000000000..f31102a70 --- /dev/null +++ b/@interactjs/utils/clone.js.map @@ -0,0 +1,22 @@ +{ + "version": 3, + "sources": [ + "clone.ts" + ], + "names": [ + "arr", + "is", + "clone", + "source", + "dest", + "prop", + "value", + "plainObject", + "array", + "from" + ], + "mappings": "AAAA,OAAO,KAAKA,GAAZ;AACA,OAAO,KAAKC,EAAZ,gB,CAEA;;AACA,eAAe,SAASC,KAAT,CAAkCC,MAAlC,EAAyD;AACtE,QAAMC,IAAI,GAAG,EAAb;;AAEA,OAAK,MAAMC,IAAX,IAAmBF,MAAnB,EAA2B;AACzB,UAAMG,KAAK,GAAGH,MAAM,CAACE,IAAD,CAApB;;AAEA,QAAIJ,EAAE,CAACM,WAAH,CAAeD,KAAf,CAAJ,EAA2B;AACzBF,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaH,KAAK,CAACI,KAAD,CAAlB;AACD,KAFD,MAGK,IAAIL,EAAE,CAACO,KAAH,CAASF,KAAT,CAAJ,EAAqB;AACxBF,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaL,GAAG,CAACS,IAAJ,CAASH,KAAT,CAAb;AACD,KAFI,MAGA;AACHF,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaC,KAAb;AACD;AACF;;AAED,SAAOF,IAAP;AACD", + "sourcesContent": [ + "import * as arr from './arr'\nimport * as is from './is'\n\n// tslint:disable-next-line ban-types\nexport default function clone (source: T): Partial {\n const dest = {} as Partial\n\n for (const prop in source) {\n const value = source[prop]\n\n if (is.plainObject(value)) {\n dest[prop] = clone(value) as any\n }\n else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n }\n else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/domObjects.d.ts b/@interactjs/utils/domObjects.d.ts new file mode 100644 index 000000000..8207499aa --- /dev/null +++ b/@interactjs/utils/domObjects.d.ts @@ -0,0 +1,14 @@ +declare const domObjects: { + init: any; + document: Document; + DocumentFragment: typeof DocumentFragment; + SVGElement: typeof SVGElement; + SVGSVGElement: typeof SVGSVGElement; + SVGElementInstance: any; + Element: typeof Element; + HTMLElement: typeof HTMLElement; + Event: typeof Event; + Touch: typeof Touch; + PointerEvent: typeof PointerEvent; +}; +export default domObjects; diff --git a/@interactjs/utils/domObjects.js b/@interactjs/utils/domObjects.js new file mode 100644 index 000000000..3ad02276b --- /dev/null +++ b/@interactjs/utils/domObjects.js @@ -0,0 +1,32 @@ +const domObjects = { + init, + document: null, + DocumentFragment: null, + SVGElement: null, + SVGSVGElement: null, + SVGElementInstance: null, + Element: null, + HTMLElement: null, + Event: null, + Touch: null, + PointerEvent: null +}; + +function blank() {} + +export default domObjects; + +function init(window) { + const win = window; + domObjects.document = win.document; + domObjects.DocumentFragment = win.DocumentFragment || blank; + domObjects.SVGElement = win.SVGElement || blank; + domObjects.SVGSVGElement = win.SVGSVGElement || blank; + domObjects.SVGElementInstance = win.SVGElementInstance || blank; + domObjects.Element = win.Element || blank; + domObjects.HTMLElement = win.HTMLElement || domObjects.Element; + domObjects.Event = win.Event; + domObjects.Touch = win.Touch || blank; + domObjects.PointerEvent = win.PointerEvent || win.MSPointerEvent; +} +//# sourceMappingURL=domObjects.js.map \ No newline at end of file diff --git a/@interactjs/utils/domObjects.js.map b/@interactjs/utils/domObjects.js.map new file mode 100644 index 000000000..9499c2ea5 --- /dev/null +++ b/@interactjs/utils/domObjects.js.map @@ -0,0 +1,28 @@ +{ + "version": 3, + "sources": [ + "domObjects.ts" + ], + "names": [ + "domObjects", + "init", + "document", + "DocumentFragment", + "SVGElement", + "SVGSVGElement", + "SVGElementInstance", + "Element", + "HTMLElement", + "Event", + "Touch", + "PointerEvent", + "blank", + "window", + "win", + "MSPointerEvent" + ], + "mappings": "AAAA,MAAMA,UAYL,GACD;AACEC,EAAAA,IADF;AAEEC,EAAAA,QAAQ,EAAE,IAFZ;AAGEC,EAAAA,gBAAgB,EAAE,IAHpB;AAIEC,EAAAA,UAAU,EAAE,IAJd;AAKEC,EAAAA,aAAa,EAAE,IALjB;AAMEC,EAAAA,kBAAkB,EAAE,IANtB;AAOEC,EAAAA,OAAO,EAAE,IAPX;AAQEC,EAAAA,WAAW,EAAE,IARf;AASEC,EAAAA,KAAK,EAAE,IATT;AAUEC,EAAAA,KAAK,EAAE,IAVT;AAWEC,EAAAA,YAAY,EAAE;AAXhB,CAbA;;AA2BA,SAASC,KAAT,GAAkB,CAAE;;AAEpB,eAAeZ,UAAf;;AAEA,SAASC,IAAT,CAAeY,MAAf,EAA+B;AAC7B,QAAMC,GAAG,GAAGD,MAAZ;AAEAb,EAAAA,UAAU,CAACE,QAAX,GAAgCY,GAAG,CAACZ,QAApC;AACAF,EAAAA,UAAU,CAACG,gBAAX,GAAgCW,GAAG,CAACX,gBAAJ,IAA0BS,KAA1D;AACAZ,EAAAA,UAAU,CAACI,UAAX,GAAgCU,GAAG,CAACV,UAAJ,IAA0BQ,KAA1D;AACAZ,EAAAA,UAAU,CAACK,aAAX,GAAgCS,GAAG,CAACT,aAAJ,IAA0BO,KAA1D;AACAZ,EAAAA,UAAU,CAACM,kBAAX,GAAgCQ,GAAG,CAACR,kBAAJ,IAA0BM,KAA1D;AACAZ,EAAAA,UAAU,CAACO,OAAX,GAAgCO,GAAG,CAACP,OAAJ,IAA0BK,KAA1D;AACAZ,EAAAA,UAAU,CAACQ,WAAX,GAAgCM,GAAG,CAACN,WAAJ,IAA0BR,UAAU,CAACO,OAArE;AAEAP,EAAAA,UAAU,CAACS,KAAX,GAA0BK,GAAG,CAACL,KAA9B;AACAT,EAAAA,UAAU,CAACU,KAAX,GAA0BI,GAAG,CAACJ,KAAJ,IAAaE,KAAvC;AACAZ,EAAAA,UAAU,CAACW,YAAX,GAA2BG,GAAG,CAACH,YAAJ,IAAoBG,GAAG,CAACC,cAAnD;AACD", + "sourcesContent": [ + "const domObjects: {\n init: any\n document: Document\n DocumentFragment: typeof DocumentFragment\n SVGElement: typeof SVGElement\n SVGSVGElement: typeof SVGSVGElement\n SVGElementInstance: any\n Element: typeof Element\n HTMLElement: typeof HTMLElement\n Event: typeof Event\n Touch: typeof Touch\n PointerEvent: typeof PointerEvent\n} =\n{\n init,\n document: null,\n DocumentFragment: null,\n SVGElement: null,\n SVGSVGElement: null,\n SVGElementInstance: null,\n Element: null,\n HTMLElement: null,\n Event: null,\n Touch: null,\n PointerEvent: null,\n}\n\nfunction blank () {}\n\nexport default domObjects\n\nfunction init (window: Window) {\n const win = window as any\n\n domObjects.document = win.document\n domObjects.DocumentFragment = win.DocumentFragment || blank\n domObjects.SVGElement = win.SVGElement || blank\n domObjects.SVGSVGElement = win.SVGSVGElement || blank\n domObjects.SVGElementInstance = win.SVGElementInstance || blank\n domObjects.Element = win.Element || blank\n domObjects.HTMLElement = win.HTMLElement || domObjects.Element\n\n domObjects.Event = win.Event\n domObjects.Touch = win.Touch || blank\n domObjects.PointerEvent = (win.PointerEvent || win.MSPointerEvent)\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/domUtils.d.ts b/@interactjs/utils/domUtils.d.ts new file mode 100644 index 000000000..2d61fdfa5 --- /dev/null +++ b/@interactjs/utils/domUtils.d.ts @@ -0,0 +1,29 @@ +export declare function nodeContains(parent: Node | Interact.EventTarget, child: Node | Interact.EventTarget): boolean; +export declare function closest(element: Node, selector: string): import("@interactjs/types/types").Element; +export declare function parentNode(node: Node | Document): Node & ParentNode; +export declare function matchesSelector(element: Interact.Element, selector: string): any; +export declare function indexOfDeepestElement(elements: Interact.Element[] | NodeListOf): number; +export declare function matchesUpTo(element: Interact.Element, selector: string, limit: Node): any; +export declare function getActualElement(element: Interact.Element): import("@interactjs/types/types").Element; +export declare function getScrollXY(relevantWindow: any): { + x: any; + y: any; +}; +export declare function getElementClientRect(element: Interact.Element): { + left: number; + right: number; + top: number; + bottom: number; + width: number; + height: number; +}; +export declare function getElementRect(element: Interact.Element): { + left: number; + right: number; + top: number; + bottom: number; + width: number; + height: number; +}; +export declare function getPath(node: Node | Document): any[]; +export declare function trySelector(value: any): boolean; diff --git a/@interactjs/utils/domUtils.js b/@interactjs/utils/domUtils.js new file mode 100644 index 000000000..4ef91757f --- /dev/null +++ b/@interactjs/utils/domUtils.js @@ -0,0 +1,222 @@ +import browser from "./browser.js"; +import domObjects from "./domObjects.js"; +import * as is from "./is.js"; +import win, { getWindow } from "./window.js"; +export function nodeContains(parent, child) { + while (child) { + if (child === parent) { + return true; + } + + child = child.parentNode; + } + + return false; +} +export function closest(element, selector) { + while (is.element(element)) { + if (matchesSelector(element, selector)) { + return element; + } + + element = parentNode(element); + } + + return null; +} +export function parentNode(node) { + let parent = node.parentNode; + + if (is.docFrag(parent)) { + // skip past #shado-root fragments + // tslint:disable-next-line + while ((parent = parent.host) && is.docFrag(parent)) { + continue; + } + + return parent; + } + + return parent; +} +export function matchesSelector(element, selector) { + // remove /deep/ from selectors if shadowDOM polyfill is used + if (win.window !== win.realWindow) { + selector = selector.replace(/\/deep\//g, ' '); + } + + return element[browser.prefixedMatchesSelector](selector); +} + +const getParent = el => el.parentNode ? el.parentNode : el.host; // Test for the element that's "above" all other qualifiers + + +export function indexOfDeepestElement(elements) { + let deepestZoneParents = []; + let deepestZone = elements[0]; + let index = deepestZone ? 0 : -1; + let i; + let n; + + for (i = 1; i < elements.length; i++) { + const dropzone = elements[i]; // an element might belong to multiple selector dropzones + + if (!dropzone || dropzone === deepestZone) { + continue; + } + + if (!deepestZone) { + deepestZone = dropzone; + index = i; + continue; + } // check if the deepest or current are document.documentElement or document.rootElement + // - if the current dropzone is, do nothing and continue + + + if (dropzone.parentNode === dropzone.ownerDocument) { + continue; + } // - if deepest is, update with the current dropzone and continue to next + else if (deepestZone.parentNode === dropzone.ownerDocument) { + deepestZone = dropzone; + index = i; + continue; + } // compare zIndex of siblings + + + if (dropzone.parentNode === deepestZone.parentNode) { + const deepestZIndex = parseInt(getWindow(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0; + const dropzoneZIndex = parseInt(getWindow(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0; + + if (dropzoneZIndex >= deepestZIndex) { + deepestZone = dropzone; + index = i; + } + + continue; + } // populate the ancestry array for the latest deepest dropzone + + + if (!deepestZoneParents.length) { + let parent = deepestZone; + let parentParent; + + while ((parentParent = getParent(parent)) && parentParent !== parent.ownerDocument) { + deepestZoneParents.unshift(parent); + parent = parentParent; + } + } + + let parent; // if this element is an svg element and the current deepest is an + // HTMLElement + + if (deepestZone instanceof domObjects.HTMLElement && dropzone instanceof domObjects.SVGElement && !(dropzone instanceof domObjects.SVGSVGElement)) { + if (dropzone === deepestZone.parentNode) { + continue; + } + + parent = dropzone.ownerSVGElement; + } else { + parent = dropzone; + } + + const dropzoneParents = []; + + while (parent.parentNode !== parent.ownerDocument) { + dropzoneParents.unshift(parent); + parent = getParent(parent); + } + + n = 0; // get (position of last common ancestor) + 1 + + while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) { + n++; + } + + const parents = [dropzoneParents[n - 1], dropzoneParents[n], deepestZoneParents[n]]; + let child = parents[0].lastChild; + + while (child) { + if (child === parents[1]) { + deepestZone = dropzone; + index = i; + deepestZoneParents = dropzoneParents; + break; + } else if (child === parents[2]) { + break; + } + + child = child.previousSibling; + } + } + + return index; +} +export function matchesUpTo(element, selector, limit) { + while (is.element(element)) { + if (matchesSelector(element, selector)) { + return true; + } + + element = parentNode(element); + + if (element === limit) { + return matchesSelector(element, selector); + } + } + + return false; +} +export function getActualElement(element) { + return element instanceof domObjects.SVGElementInstance ? element.correspondingUseElement : element; +} +export function getScrollXY(relevantWindow) { + relevantWindow = relevantWindow || win.window; + return { + x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft, + y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop + }; +} +export function getElementClientRect(element) { + const clientRect = element instanceof domObjects.SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]; + return clientRect && { + left: clientRect.left, + right: clientRect.right, + top: clientRect.top, + bottom: clientRect.bottom, + width: clientRect.width || clientRect.right - clientRect.left, + height: clientRect.height || clientRect.bottom - clientRect.top + }; +} +export function getElementRect(element) { + const clientRect = getElementClientRect(element); + + if (!browser.isIOS7 && clientRect) { + const scroll = getScrollXY(win.getWindow(element)); + clientRect.left += scroll.x; + clientRect.right += scroll.x; + clientRect.top += scroll.y; + clientRect.bottom += scroll.y; + } + + return clientRect; +} +export function getPath(node) { + const path = []; + + while (node) { + path.push(node); + node = parentNode(node); + } + + return path; +} +export function trySelector(value) { + if (!is.string(value)) { + return false; + } // an exception will be raised if it is invalid + + + domObjects.document.querySelector(value); + return true; +} +//# sourceMappingURL=domUtils.js.map \ No newline at end of file diff --git a/@interactjs/utils/domUtils.js.map b/@interactjs/utils/domUtils.js.map new file mode 100644 index 000000000..7d7c0ae20 --- /dev/null +++ b/@interactjs/utils/domUtils.js.map @@ -0,0 +1,94 @@ +{ + "version": 3, + "sources": [ + "domUtils.ts" + ], + "names": [ + "browser", + "domObjects", + "is", + "win", + "getWindow", + "nodeContains", + "parent", + "child", + "parentNode", + "closest", + "element", + "selector", + "matchesSelector", + "node", + "docFrag", + "host", + "window", + "realWindow", + "replace", + "prefixedMatchesSelector", + "getParent", + "el", + "indexOfDeepestElement", + "elements", + "deepestZoneParents", + "deepestZone", + "index", + "i", + "n", + "length", + "dropzone", + "ownerDocument", + "deepestZIndex", + "parseInt", + "getComputedStyle", + "zIndex", + "dropzoneZIndex", + "parentParent", + "unshift", + "HTMLElement", + "SVGElement", + "SVGSVGElement", + "ownerSVGElement", + "dropzoneParents", + "parents", + "lastChild", + "previousSibling", + "matchesUpTo", + "limit", + "getActualElement", + "SVGElementInstance", + "correspondingUseElement", + "getScrollXY", + "relevantWindow", + "x", + "scrollX", + "document", + "documentElement", + "scrollLeft", + "y", + "scrollY", + "scrollTop", + "getElementClientRect", + "clientRect", + "getBoundingClientRect", + "getClientRects", + "left", + "right", + "top", + "bottom", + "width", + "height", + "getElementRect", + "isIOS7", + "scroll", + "getPath", + "path", + "push", + "trySelector", + "value", + "string", + "querySelector" + ], + "mappings": "AAAA,OAAOA,OAAP;AACA,OAAOC,UAAP;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,GAAP,IAAcC,SAAd;AAEA,OAAO,SAASC,YAAT,CAAuBC,MAAvB,EAA4DC,KAA5D,EAAgG;AACrG,SAAOA,KAAP,EAAc;AACZ,QAAIA,KAAK,KAAKD,MAAd,EAAsB;AACpB,aAAO,IAAP;AACD;;AAEDC,IAAAA,KAAK,GAAIA,KAAD,CAAgBC,UAAxB;AACD;;AAED,SAAO,KAAP;AACD;AAED,OAAO,SAASC,OAAT,CAAkBC,OAAlB,EAAiCC,QAAjC,EAAmD;AACxD,SAAOT,EAAE,CAACQ,OAAH,CAAWA,OAAX,CAAP,EAA4B;AAC1B,QAAIE,eAAe,CAACF,OAAD,EAAUC,QAAV,CAAnB,EAAwC;AAAE,aAAOD,OAAP;AAAgB;;AAE1DA,IAAAA,OAAO,GAAGF,UAAU,CAACE,OAAD,CAApB;AACD;;AAED,SAAO,IAAP;AACD;AAED,OAAO,SAASF,UAAT,CAAqBK,IAArB,EAA4C;AACjD,MAAIP,MAAM,GAAGO,IAAI,CAACL,UAAlB;;AAEA,MAAIN,EAAE,CAACY,OAAH,CAAWR,MAAX,CAAJ,EAAwB;AACtB;AACA;AACA,WAAO,CAACA,MAAM,GAAIA,MAAD,CAAgBS,IAA1B,KAAmCb,EAAE,CAACY,OAAH,CAAWR,MAAX,CAA1C,EAA8D;AAC5D;AACD;;AAED,WAAOA,M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,MAAX,IAAqBR,UAAU,CAACM,MAAX,GAAoBN,UAAU,CAACK;AANzC,GAArB;AAQD;AAED,OAAO,SAASI,cAAT,CAAyB9D,OAAzB,EAAoD;AACzD,QAAMqD,UAAU,GAAGD,oBAAoB,CAACpD,OAAD,CAAvC;;AAEA,MAAI,CAACV,OAAO,CAACyE,MAAT,IAAmBV,UAAvB,EAAmC;AACjC,UAAMW,MAAM,GAAGtB,WAAW,CAACjD,GAAG,CAACC,SAAJ,CAAcM,OAAd,CAAD,CAA1B;AAEAqD,IAAAA,UAAU,CAACG,IAAX,IAAqBQ,MAAM,CAACpB,CAA5B;AACAS,IAAAA,UAAU,CAACI,KAAX,IAAqBO,MAAM,CAACpB,CAA5B;AACAS,IAAAA,UAAU,CAACK,GAAX,IAAqBM,MAAM,CAACf,CAA5B;AACAI,IAAAA,UAAU,CAACM,MAAX,IAAqBK,MAAM,CAACf,CAA5B;AACD;;AAED,SAAOI,UAAP;AACD;AAED,OAAO,SAASY,OAAT,CAAkB9D,IAAlB,EAAyC;AAC9C,QAAM+D,IAAI,GAAG,EAAb;;AAEA,SAAO/D,IAAP,EAAa;AACX+D,IAAAA,IAAI,CAACC,IAAL,CAAUhE,IAAV;AACAA,IAAAA,IAAI,GAAGL,UAAU,CAACK,IAAD,CAAjB;AACD;;AAED,SAAO+D,IAAP;AACD;AAED,OAAO,SAASE,WAAT,CAAsBC,KAAtB,EAA6B;AAClC,MAAI,CAAC7E,EAAE,CAAC8E,MAAH,CAAUD,KAAV,CAAL,EAAuB;AAAE,WAAO,KAAP;AAAc,GADL,CAGlC;;;AACA9E,EAAAA,UAAU,CAACuD,QAAX,CAAoByB,aAApB,CAAkCF,KAAlC;AACA,SAAO,IAAP;AACD", + "sourcesContent": [ + "import browser from './browser'\nimport domObjects from './domObjects'\nimport * as is from './is'\nimport win, { getWindow } from './window'\n\nexport function nodeContains (parent: Node | Interact.EventTarget, child: Node | Interact.EventTarget) {\n while (child) {\n if (child === parent) {\n return true\n }\n\n child = (child as Node).parentNode\n }\n\n return false\n}\n\nexport function closest (element: Node, selector: string) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) { return element }\n\n element = parentNode(element)\n }\n\n return null\n}\n\nexport function parentNode (node: Node | Document) {\n let parent = node.parentNode\n\n if (is.docFrag(parent)) {\n // skip past #shado-root fragments\n // tslint:disable-next-line\n while ((parent = (parent as any).host) && is.docFrag(parent)) {\n continue\n }\n\n return parent\n }\n\n return parent\n}\n\nexport function matchesSelector (element: Interact.Element, selector: string) {\n // remove /deep/ from selectors if shadowDOM polyfill is used\n if (win.window !== win.realWindow) {\n selector = selector.replace(/\\/deep\\//g, ' ')\n }\n\n return element[browser.prefixedMatchesSelector](selector)\n}\n\nconst getParent = el => el.parentNode ? el.parentNode : el.host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Interact.Element[] | NodeListOf) {\n let deepestZoneParents = []\n let deepestZone = elements[0]\n let index = deepestZone ? 0 : -1\n let i\n let n\n\n for (i = 1; i < elements.length; i++) {\n const dropzone = elements[i]\n\n // an element might belong to multiple selector dropzones\n if (!dropzone || dropzone === deepestZone) {\n continue\n }\n\n if (!deepestZone) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // check if the deepest or current are document.documentElement or document.rootElement\n // - if the current dropzone is, do nothing and continue\n if (dropzone.parentNode === dropzone.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current dropzone and continue to next\n else if (deepestZone.parentNode === dropzone.ownerDocument) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // compare zIndex of siblings\n if (dropzone.parentNode === deepestZone.parentNode) {\n const deepestZIndex = parseInt(getWindow(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0\n const dropzoneZIndex = parseInt(getWindow(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0\n\n if (dropzoneZIndex >= deepestZIndex) {\n deepestZone = dropzone\n index = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest dropzone\n if (!deepestZoneParents.length) {\n let parent = deepestZone\n let parentParent\n\n while ((parentParent = getParent(parent)) && parentParent !== parent.ownerDocument) {\n deepestZoneParents.unshift(parent)\n parent = parentParent\n }\n }\n\n let parent\n\n // if this element is an svg element and the current deepest is an\n // HTMLElement\n if (deepestZone instanceof domObjects.HTMLElement &&\n dropzone instanceof domObjects.SVGElement &&\n !(dropzone instanceof domObjects.SVGSVGElement)) {\n if (dropzone === deepestZone.parentNode) {\n continue\n }\n\n parent = dropzone.ownerSVGElement\n }\n else {\n parent = dropzone\n }\n\n const dropzoneParents = []\n\n while (parent.parentNode !== parent.ownerDocument) {\n dropzoneParents.unshift(parent)\n parent = getParent(parent)\n }\n\n n = 0\n\n // get (position of last common ancestor) + 1\n while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) {\n n++\n }\n\n const parents = [\n dropzoneParents[n - 1],\n dropzoneParents[n],\n deepestZoneParents[n],\n ]\n\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestZone = dropzone\n index = i\n deepestZoneParents = dropzoneParents\n\n break\n }\n else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n\n return index\n}\n\nexport function matchesUpTo (element: Interact.Element, selector: string, limit: Node) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) {\n return true\n }\n\n element = parentNode(element) as Interact.Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Interact.Element) {\n return (element instanceof domObjects.SVGElementInstance\n ? (element as SVGElement).correspondingUseElement\n : element)\n}\n\nexport function getScrollXY (relevantWindow) {\n relevantWindow = relevantWindow || win.window\n return {\n x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft,\n y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop,\n }\n}\n\nexport function getElementClientRect (element: Interact.Element) {\n const clientRect = (element instanceof domObjects.SVGElement\n ? element.getBoundingClientRect()\n : element.getClientRects()[0])\n\n return clientRect && {\n left : clientRect.left,\n right : clientRect.right,\n top : clientRect.top,\n bottom: clientRect.bottom,\n width : clientRect.width || clientRect.right - clientRect.left,\n height: clientRect.height || clientRect.bottom - clientRect.top,\n }\n}\n\nexport function getElementRect (element: Interact.Element) {\n const clientRect = getElementClientRect(element)\n\n if (!browser.isIOS7 && clientRect) {\n const scroll = getScrollXY(win.getWindow(element))\n\n clientRect.left += scroll.x\n clientRect.right += scroll.x\n clientRect.top += scroll.y\n clientRect.bottom += scroll.y\n }\n\n return clientRect\n}\n\nexport function getPath (node: Node | Document) {\n const path = []\n\n while (node) {\n path.push(node)\n node = parentNode(node)\n }\n\n return path\n}\n\nexport function trySelector (value) {\n if (!is.string(value)) { return false }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/domUtils.spec.d.ts b/@interactjs/utils/domUtils.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/utils/domUtils.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/utils/events.d.ts b/@interactjs/utils/events.d.ts new file mode 100644 index 000000000..61e251686 --- /dev/null +++ b/@interactjs/utils/events.d.ts @@ -0,0 +1,42 @@ +declare type Listener = (event: Event | FakeEvent) => any; +declare function add(element: EventTarget, type: string, listener: Listener, optionalArg?: boolean | any): void; +declare function remove(element: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any): void; +declare function addDelegate(selector: string, context: Node, type: string, listener: Listener, optionalArg?: any): void; +declare function removeDelegate(selector: string, context: Document | Interact.Element, type: string, listener?: Listener, optionalArg?: any): void; +declare function delegateListener(event: Event, optionalArg?: any): void; +declare function delegateUseCapture(event: Event): any; +export declare class FakeEvent implements Partial { + originalEvent: Event; + currentTarget: EventTarget; + constructor(originalEvent: Event); + preventOriginalDefault(): void; + stopPropagation(): void; + stopImmediatePropagation(): void; +} +declare const events: { + add: typeof add; + remove: typeof remove; + addDelegate: typeof addDelegate; + removeDelegate: typeof removeDelegate; + delegateListener: typeof delegateListener; + delegateUseCapture: typeof delegateUseCapture; + delegatedEvents: { + [type: string]: { + selectors: string[]; + contexts: Node[]; + listeners: [Listener, boolean, boolean][][]; + }; + }; + documents: Document[]; + supportsOptions: boolean; + supportsPassive: boolean; + _elements: EventTarget[]; + _targets: { + events: { + [type: string]: Listener[]; + }; + typeCount: number; + }[]; + init(window: Window): void; +}; +export default events; diff --git a/@interactjs/utils/events.js b/@interactjs/utils/events.js new file mode 100644 index 000000000..d45a1b726 --- /dev/null +++ b/@interactjs/utils/events.js @@ -0,0 +1,266 @@ +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +import { contains } from "./arr.js"; +import * as domUtils from "./domUtils.js"; +import * as is from "./is.js"; +import pExtend from "./pointerExtend.js"; +import * as pointerUtils from "./pointerUtils.js"; +const elements = []; +const targets = []; +const delegatedEvents = {}; +const documents = []; + +function add(element, type, listener, optionalArg) { + const options = getOptions(optionalArg); + let elementIndex = elements.indexOf(element); + let target = targets[elementIndex]; + + if (!target) { + target = { + events: {}, + typeCount: 0 + }; + elementIndex = elements.push(element) - 1; + targets.push(target); + } + + if (!target.events[type]) { + target.events[type] = []; + target.typeCount++; + } + + if (element.removeEventListener && !contains(target.events[type], listener)) { + element.addEventListener(type, listener, events.supportsOptions ? options : !!options.capture); + target.events[type].push(listener); + } +} + +function remove(element, type, listener, optionalArg) { + const options = getOptions(optionalArg); + const elementIndex = elements.indexOf(element); + const target = targets[elementIndex]; + + if (!target || !target.events) { + return; + } + + if (type === 'all') { + for (type in target.events) { + if (target.events.hasOwnProperty(type)) { + remove(element, type, 'all'); + } + } + + return; + } + + if (target.events[type]) { + const len = target.events[type].length; + + if (listener === 'all') { + for (let i = 0; i < len; i++) { + remove(element, type, target.events[type][i], options); + } + + return; + } else { + for (let i = 0; i < len; i++) { + if (element.removeEventListener && target.events[type][i] === listener) { + element.removeEventListener(type, listener, events.supportsOptions ? options : !!options.capture); + target.events[type].splice(i, 1); + break; + } + } + } + + if (target.events[type] && target.events[type].length === 0) { + target.events[type] = null; + target.typeCount--; + } + } + + if (!target.typeCount) { + targets.splice(elementIndex, 1); + elements.splice(elementIndex, 1); + } +} + +function addDelegate(selector, context, type, listener, optionalArg) { + const options = getOptions(optionalArg); + + if (!delegatedEvents[type]) { + delegatedEvents[type] = { + contexts: [], + listeners: [], + selectors: [] + }; // add delegate listener functions + + for (const doc of documents) { + add(doc, type, delegateListener); + add(doc, type, delegateUseCapture, true); + } + } + + const delegated = delegatedEvents[type]; + let index; + + for (index = delegated.selectors.length - 1; index >= 0; index--) { + if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { + break; + } + } + + if (index === -1) { + index = delegated.selectors.length; + delegated.selectors.push(selector); + delegated.contexts.push(context); + delegated.listeners.push([]); + } // keep listener and capture and passive flags + + + delegated.listeners[index].push([listener, !!options.capture, options.passive]); +} + +function removeDelegate(selector, context, type, listener, optionalArg) { + const options = getOptions(optionalArg); + const delegated = delegatedEvents[type]; + let matchFound = false; + let index; + + if (!delegated) { + return; + } // count from last index of delegated to 0 + + + for (index = delegated.selectors.length - 1; index >= 0; index--) { + // look for matching selector and context Node + if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { + const listeners = delegated.listeners[index]; // each item of the listeners array is an array: [function, capture, passive] + + for (let i = listeners.length - 1; i >= 0; i--) { + const [fn, capture, passive] = listeners[i]; // check if the listener functions and capture and passive flags match + + if (fn === listener && capture === !!options.capture && passive === options.passive) { + // remove the listener from the array of listeners + listeners.splice(i, 1); // if all listeners for this interactable have been removed + // remove the interactable from the delegated arrays + + if (!listeners.length) { + delegated.selectors.splice(index, 1); + delegated.contexts.splice(index, 1); + delegated.listeners.splice(index, 1); // remove delegate function from context + + remove(context, type, delegateListener); + remove(context, type, delegateUseCapture, true); // remove the arrays if they are empty + + if (!delegated.selectors.length) { + delegatedEvents[type] = null; + } + } // only remove one listener + + + matchFound = true; + break; + } + } + + if (matchFound) { + break; + } + } + } +} // bound to the interactable context when a DOM event +// listener is added to a selector interactable + + +function delegateListener(event, optionalArg) { + const options = getOptions(optionalArg); + const fakeEvent = new FakeEvent(event); + const delegated = delegatedEvents[event.type]; + const [eventTarget] = pointerUtils.getEventTargets(event); + let element = eventTarget; // climb up document tree looking for selector matches + + while (is.element(element)) { + for (let i = 0; i < delegated.selectors.length; i++) { + const selector = delegated.selectors[i]; + const context = delegated.contexts[i]; + + if (domUtils.matchesSelector(element, selector) && domUtils.nodeContains(context, eventTarget) && domUtils.nodeContains(context, element)) { + const listeners = delegated.listeners[i]; + fakeEvent.currentTarget = element; + + for (const [fn, capture, passive] of listeners) { + if (capture === !!options.capture && passive === options.passive) { + fn(fakeEvent); + } + } + } + } + + element = domUtils.parentNode(element); + } +} + +function delegateUseCapture(event) { + return delegateListener.call(this, event, true); +} + +function getOptions(param) { + return is.object(param) ? param : { + capture: param + }; +} + +export class FakeEvent { + constructor(originalEvent) { + this.originalEvent = originalEvent; + + _defineProperty(this, "currentTarget", void 0); + + // duplicate the event so that currentTarget can be changed + pExtend(this, originalEvent); + } + + preventOriginalDefault() { + this.originalEvent.preventDefault(); + } + + stopPropagation() { + this.originalEvent.stopPropagation(); + } + + stopImmediatePropagation() { + this.originalEvent.stopImmediatePropagation(); + } + +} +const events = { + add, + remove, + addDelegate, + removeDelegate, + delegateListener, + delegateUseCapture, + delegatedEvents, + documents, + supportsOptions: false, + supportsPassive: false, + _elements: elements, + _targets: targets, + + init(window) { + window.document.createElement('div').addEventListener('test', null, { + get capture() { + return events.supportsOptions = true; + }, + + get passive() { + return events.supportsPassive = true; + } + + }); + } + +}; +export default events; +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/@interactjs/utils/events.js.map b/@interactjs/utils/events.js.map new file mode 100644 index 000000000..a8c0a540c --- /dev/null +++ b/@interactjs/utils/events.js.map @@ -0,0 +1,84 @@ +{ + "version": 3, + "sources": [ + "events.ts" + ], + "names": [ + "contains", + "domUtils", + "is", + "pExtend", + "pointerUtils", + "elements", + "targets", + "delegatedEvents", + "documents", + "add", + "element", + "type", + "listener", + "optionalArg", + "options", + "getOptions", + "elementIndex", + "indexOf", + "target", + "events", + "typeCount", + "push", + "removeEventListener", + "addEventListener", + "supportsOptions", + "capture", + "remove", + "hasOwnProperty", + "len", + "length", + "i", + "splice", + "addDelegate", + "selector", + "context", + "contexts", + "listeners", + "selectors", + "doc", + "delegateListener", + "delegateUseCapture", + "delegated", + "index", + "passive", + "removeDelegate", + "matchFound", + "fn", + "event", + "fakeEvent", + "FakeEvent", + "eventTarget", + "getEventTargets", + "matchesSelector", + "nodeContains", + "currentTarget", + "parentNode", + "call", + "param", + "object", + "constructor", + "originalEvent", + "preventOriginalDefault", + "preventDefault", + "stopPropagation", + "stopImmediatePropagation", + "supportsPassive", + "_elements", + "_targets", + "init", + "window", + "document", + "createElement" + ], + "mappings": ";;AAAA,SAASA,QAAT;AACA,OAAO,KAAKC,QAAZ;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,OAAP;AACA,OAAO,KAAKC,YAAZ;AAIA,MAAMC,QAAuB,GAAG,EAAhC;AACA,MAAMC,OAGJ,GAAG,EAHL;AAKA,MAAMC,eAML,GAAG,EANJ;AAOA,MAAMC,SAAqB,GAAG,EAA9B;;AAEA,SAASC,GAAT,CAAcC,OAAd,EAAoCC,IAApC,EAAkDC,QAAlD,EAAsEC,WAAtE,EAAmG;AACjG,QAAMC,OAAO,GAAGC,UAAU,CAACF,WAAD,CAA1B;AACA,MAAIG,YAAY,GAAGX,QAAQ,CAACY,OAAT,CAAiBP,OAAjB,CAAnB;AACA,MAAIQ,MAAM,GAAGZ,OAAO,CAACU,YAAD,CAApB;;AAEA,MAAI,CAACE,MAAL,EAAa;AACXA,IAAAA,MAAM,GAAG;AACPC,MAAAA,MAAM,EAAE,EADD;AAEPC,MAAAA,SAAS,EAAE;AAFJ,KAAT;AAK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C,IAAAA,OAAO,EAAEgC;AAAX,GAAlC;AACD;;AAED,OAAO,MAAMR,SAAN,CAA0C;AAG/CU,EAAAA,WAAW,CAASC,aAAT,EAA+B;AAAA,SAAtBA,aAAsB,GAAtBA,aAAsB;;AAAA;;AACxC;AACAzD,IAAAA,OAAO,CAAC,IAAD,EAAOyD,aAAP,CAAP;AACD;;AAEDC,EAAAA,sBAAsB,GAAI;AACxB,SAAKD,aAAL,CAAmBE,cAAnB;AACD;;AAEDC,EAAAA,eAAe,GAAI;AACjB,SAAKH,aAAL,CAAmBG,eAAnB;AACD;;AAEDC,EAAAA,wBAAwB,GAAI;AAC1B,SAAKJ,aAAL,CAAmBI,wBAAnB;AACD;;AAlB8C;AAqBjD,MAAM7C,MAAM,GAAG;AACbV,EAAAA,GADa;AAEbiB,EAAAA,MAFa;AAIbM,EAAAA,WAJa;AAKbY,EAAAA,cALa;AAObL,EAAAA,gBAPa;AAQbC,EAAAA,kBARa;AASbjC,EAAAA,eATa;AAUbC,EAAAA,SAVa;AAYbgB,EAAAA,eAAe,EAAE,KAZJ;AAabyC,EAAAA,eAAe,EAAE,KAbJ;AAebC,EAAAA,SAAS,EAAE7D,QAfE;AAgBb8D,EAAAA,QAAQ,EAAE7D,OAhBG;;AAkBb8D,EAAAA,IAAI,CAAEC,MAAF,EAAkB;AACpBA,IAAAA,MAAM,CAACC,QAAP,CAAgBC,aAAhB,CAA8B,KAA9B,EAAqChD,gBAArC,CAAsD,MAAtD,EAA8D,IAA9D,EAAoE;AAClE,UAAIE,OAAJ,GAAe;AAAE,eAAQN,MAAM,CAACK,eAAP,GAAyB,IAAjC;AAAwC,OADS;;AAElE,UAAImB,OAAJ,GAAe;AAAE,eAAQxB,MAAM,CAAC8C,eAAP,GAAyB,IAAjC;AAAwC;;AAFS,KAApE;AAID;;AAvBY,CAAf;AA0BA,eAAe9C,MAAf", + "sourcesContent": [ + "import { contains } from './arr'\nimport * as domUtils from './domUtils'\nimport * as is from './is'\nimport pExtend from './pointerExtend'\nimport * as pointerUtils from './pointerUtils'\n\ntype Listener = (event: Event | FakeEvent) => any\n\nconst elements: EventTarget[] = []\nconst targets: Array<{\n events: { [type: string]: Listener[] }\n typeCount: number\n}> = []\n\nconst delegatedEvents: {\n [type: string]: {\n selectors: string[]\n contexts: Node[]\n listeners: Array>\n }\n} = {}\nconst documents: Document[] = []\n\nfunction add (element: EventTarget, type: string, listener: Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n let elementIndex = elements.indexOf(element)\n let target = targets[elementIndex]\n\n if (!target) {\n target = {\n events: {},\n typeCount: 0,\n }\n\n elementIndex = elements.push(element) - 1\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n target.typeCount++\n }\n\n if (element.removeEventListener && !contains(target.events[type], listener)) {\n element.addEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].push(listener)\n }\n}\n\nfunction remove (element: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n const elementIndex = elements.indexOf(element)\n const target = targets[elementIndex]\n\n if (!target || !target.events) {\n return\n }\n\n if (type === 'all') {\n for (type in target.events) {\n if (target.events.hasOwnProperty(type)) {\n remove(element, type, 'all')\n }\n }\n return\n }\n\n if (target.events[type]) {\n const len = target.events[type].length\n\n if (listener === 'all') {\n for (let i = 0; i < len; i++) {\n remove(element, type, target.events[type][i], options)\n }\n return\n }\n else {\n for (let i = 0; i < len; i++) {\n if (element.removeEventListener && target.events[type][i] === listener) {\n element.removeEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].splice(i, 1)\n\n break\n }\n }\n }\n\n if (target.events[type] && target.events[type].length === 0) {\n (target.events[type] as any) = null\n target.typeCount--\n }\n }\n\n if (!target.typeCount) {\n targets.splice(elementIndex, 1)\n elements.splice(elementIndex, 1)\n }\n}\n\nfunction addDelegate (selector: string, context: Node, type: string, listener: Listener, optionalArg?: any) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = {\n contexts : [],\n listeners: [],\n selectors: [],\n }\n\n // add delegate listener functions\n for (const doc of documents) {\n add(doc, type, delegateListener)\n add(doc, type, delegateUseCapture, true)\n }\n }\n\n const delegated = delegatedEvents[type]\n let index\n\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n break\n }\n }\n\n if (index === -1) {\n index = delegated.selectors.length\n\n delegated.selectors.push(selector)\n delegated.contexts.push(context)\n delegated.listeners.push([])\n }\n\n // keep listener and capture and passive flags\n delegated.listeners[index].push([listener, !!options.capture, options.passive])\n}\n\nfunction removeDelegate (\n selector: string,\n context: Document | Interact.Element,\n type: string,\n listener?: Listener,\n optionalArg?: any,\n) {\n const options = getOptions(optionalArg)\n const delegated = delegatedEvents[type]\n let matchFound = false\n let index\n\n if (!delegated) { return }\n\n // count from last index of delegated to 0\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n // look for matching selector and context Node\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n const listeners = delegated.listeners[index]\n\n // each item of the listeners array is an array: [function, capture, passive]\n for (let i = listeners.length - 1; i >= 0; i--) {\n const [fn, capture, passive] = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (fn === listener && capture === !!options.capture && passive === options.passive) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this interactable have been removed\n // remove the interactable from the delegated arrays\n if (!listeners.length) {\n delegated.selectors.splice(index, 1)\n delegated.contexts.splice(index, 1)\n delegated.listeners.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n\n // remove the arrays if they are empty\n if (!delegated.selectors.length) {\n delegatedEvents[type] = null\n }\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) { break }\n }\n }\n}\n\n// bound to the interactable context when a DOM event\n// listener is added to a selector interactable\nfunction delegateListener (event: Event, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event)\n const delegated = delegatedEvents[event.type]\n const [eventTarget] = (pointerUtils.getEventTargets(event))\n let element: Node = eventTarget\n\n // climb up document tree looking for selector matches\n while (is.element(element)) {\n for (let i = 0; i < delegated.selectors.length; i++) {\n const selector = delegated.selectors[i]\n const context = delegated.contexts[i]\n\n if (domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)) {\n const listeners = delegated.listeners[i]\n\n fakeEvent.currentTarget = element\n\n for (const [fn, capture, passive] of listeners) {\n if (capture === !!options.capture && passive === options.passive) {\n fn(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n}\n\nfunction delegateUseCapture (event: Event) {\n return delegateListener.call(this, event, true)\n}\n\nfunction getOptions (param: object) {\n return is.object(param) ? param : { capture: param }\n}\n\nexport class FakeEvent implements Partial {\n currentTarget: EventTarget\n\n constructor (public originalEvent: Event) {\n // duplicate the event so that currentTarget can be changed\n pExtend(this, originalEvent)\n }\n\n preventOriginalDefault () {\n this.originalEvent.preventDefault()\n }\n\n stopPropagation () {\n this.originalEvent.stopPropagation()\n }\n\n stopImmediatePropagation () {\n this.originalEvent.stopImmediatePropagation()\n }\n}\n\nconst events = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n supportsOptions: false,\n supportsPassive: false,\n\n _elements: elements,\n _targets: targets,\n\n init (window: Window) {\n window.document.createElement('div').addEventListener('test', null, {\n get capture () { return (events.supportsOptions = true) },\n get passive () { return (events.supportsPassive = true) },\n })\n },\n}\n\nexport default events\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/extend.d.ts b/@interactjs/utils/extend.d.ts new file mode 100644 index 000000000..3179be382 --- /dev/null +++ b/@interactjs/utils/extend.d.ts @@ -0,0 +1 @@ +export default function extend(dest: U & Partial, source: T): T & U; diff --git a/@interactjs/utils/extend.js b/@interactjs/utils/extend.js new file mode 100644 index 000000000..ec4020785 --- /dev/null +++ b/@interactjs/utils/extend.js @@ -0,0 +1,9 @@ +export default function extend(dest, source) { + for (const prop in source) { + dest[prop] = source[prop]; + } + + const ret = dest; + return ret; +} +//# sourceMappingURL=extend.js.map \ No newline at end of file diff --git a/@interactjs/utils/extend.js.map b/@interactjs/utils/extend.js.map new file mode 100644 index 000000000..971abdeff --- /dev/null +++ b/@interactjs/utils/extend.js.map @@ -0,0 +1,17 @@ +{ + "version": 3, + "sources": [ + "extend.ts" + ], + "names": [ + "extend", + "dest", + "source", + "prop", + "ret" + ], + "mappings": "AAAA,eAAe,SAASA,MAAT,CAAsCC,IAAtC,EAA4DC,MAA5D,EAA8E;AAC3F,OAAK,MAAMC,IAAX,IAAmBD,MAAnB,EAA2B;AACxBD,IAAAA,IAAD,CAAuBE,IAAvB,IAA+BD,MAAM,CAACC,IAAD,CAArC;AACD;;AAED,QAAMC,GAAG,GAAGH,IAAZ;AAEA,SAAOG,GAAP;AACD", + "sourcesContent": [ + "export default function extend (dest: U & Partial, source: T): T & U {\n for (const prop in source) {\n (dest as unknown as T)[prop] = source[prop]\n }\n\n const ret = dest as T & U\n\n return ret\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/getOriginXY.d.ts b/@interactjs/utils/getOriginXY.d.ts new file mode 100644 index 000000000..a225708f8 --- /dev/null +++ b/@interactjs/utils/getOriginXY.d.ts @@ -0,0 +1,6 @@ +export default function (target: Interact.HasGetRect & { + options: Interact.PerActionDefaults; +}, element: Node, actionName?: Interact.ActionName): { + x: any; + y: any; +}; diff --git a/@interactjs/utils/getOriginXY.js b/@interactjs/utils/getOriginXY.js new file mode 100644 index 000000000..f694f1a08 --- /dev/null +++ b/@interactjs/utils/getOriginXY.js @@ -0,0 +1,12 @@ +import { rectToXY, resolveRectLike } from "./rect.js"; +export default function (target, element, actionName) { + const actionOptions = target.options[actionName]; + const actionOrigin = actionOptions && actionOptions.origin; + const origin = actionOrigin || target.options.origin; + const originRect = resolveRectLike(origin, target, element, [target && element]); + return rectToXY(originRect) || { + x: 0, + y: 0 + }; +} +//# sourceMappingURL=getOriginXY.js.map \ No newline at end of file diff --git a/@interactjs/utils/getOriginXY.js.map b/@interactjs/utils/getOriginXY.js.map new file mode 100644 index 000000000..7ee69ee20 --- /dev/null +++ b/@interactjs/utils/getOriginXY.js.map @@ -0,0 +1,24 @@ +{ + "version": 3, + "sources": [ + "getOriginXY.ts" + ], + "names": [ + "rectToXY", + "resolveRectLike", + "target", + "element", + "actionName", + "actionOptions", + "options", + "actionOrigin", + "origin", + "originRect", + "x", + "y" + ], + "mappings": "AAAA,SAASA,QAAT,EAAmBC,eAAnB;AAEA,eAAe,UACbC,MADa,EAEbC,OAFa,EAGbC,UAHa,EAIb;AACA,QAAMC,aAAa,GAAIH,MAAM,CAACI,OAAR,CAAwBF,UAAxB,CAAtB;AACA,QAAMG,YAAY,GAAGF,aAAa,IAAIA,aAAa,CAACG,MAApD;AACA,QAAMA,MAAM,GAAGD,YAAY,IAAIL,MAAM,CAACI,OAAP,CAAeE,MAA9C;AAEA,QAAMC,UAAU,GAAGR,eAAe,CAACO,MAAD,EAASN,MAAT,EAAiBC,OAAjB,EAA0B,CAACD,MAAM,IAAIC,OAAX,CAA1B,CAAlC;AAEA,SAAOH,QAAQ,CAACS,UAAD,CAAR,IAAwB;AAAEC,IAAAA,CAAC,EAAE,CAAL;AAAQC,IAAAA,CAAC,EAAE;AAAX,GAA/B;AACD", + "sourcesContent": [ + "import { rectToXY, resolveRectLike } from './rect'\n\nexport default function (\n target: Interact.HasGetRect & { options: Interact.PerActionDefaults },\n element: Node,\n actionName?: Interact.ActionName,\n) {\n const actionOptions = (target.options as any)[actionName]\n const actionOrigin = actionOptions && actionOptions.origin\n const origin = actionOrigin || target.options.origin\n\n const originRect = resolveRectLike(origin, target, element, [target && element])\n\n return rectToXY(originRect) || { x: 0, y: 0 }\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/hypot.d.ts b/@interactjs/utils/hypot.d.ts new file mode 100644 index 000000000..a9ae05c6f --- /dev/null +++ b/@interactjs/utils/hypot.d.ts @@ -0,0 +1,2 @@ +declare const _default: (x: number, y: number) => number; +export default _default; diff --git a/@interactjs/utils/hypot.js b/@interactjs/utils/hypot.js new file mode 100644 index 000000000..d3512e243 --- /dev/null +++ b/@interactjs/utils/hypot.js @@ -0,0 +1,2 @@ +export default ((x, y) => Math.sqrt(x * x + y * y)); +//# sourceMappingURL=hypot.js.map \ No newline at end of file diff --git a/@interactjs/utils/hypot.js.map b/@interactjs/utils/hypot.js.map new file mode 100644 index 000000000..02b62f173 --- /dev/null +++ b/@interactjs/utils/hypot.js.map @@ -0,0 +1,16 @@ +{ + "version": 3, + "sources": [ + "hypot.ts" + ], + "names": [ + "x", + "y", + "Math", + "sqrt" + ], + "mappings": "AAAA,gBAAe,CAACA,CAAD,EAAYC,CAAZ,KAA2BC,IAAI,CAACC,IAAL,CAAUH,CAAC,GAAGA,CAAJ,GAAQC,CAAC,GAAGA,CAAtB,CAA1C", + "sourcesContent": [ + "export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/index.d.ts b/@interactjs/utils/index.d.ts new file mode 100644 index 000000000..4244cebb9 --- /dev/null +++ b/@interactjs/utils/index.d.ts @@ -0,0 +1,17 @@ +import * as arr from './arr'; +import * as dom from './domUtils'; +import * as is from './is'; +import * as pointer from './pointerUtils'; +import * as rect from './rect'; +import win from './window'; +export declare function warnOnce(this: T, method: (...args: any[]) => any, message: string): (this: T) => any; +export declare function copyAction(dest: Interact.ActionProps, src: Interact.ActionProps): import("@interactjs/core/Interaction").ActionProps; +export { default as browser } from './browser'; +export { default as clone } from './clone'; +export { default as events } from './events'; +export { default as extend } from './extend'; +export { default as getOriginXY } from './getOriginXY'; +export { default as hypot } from './hypot'; +export { default as normalizeListeners } from './normalizeListeners'; +export { default as raf } from './raf'; +export { win, arr, dom, is, pointer, rect }; diff --git a/@interactjs/utils/index.js b/@interactjs/utils/index.js new file mode 100644 index 000000000..28c2bc7a4 --- /dev/null +++ b/@interactjs/utils/index.js @@ -0,0 +1,34 @@ +import * as arr from "./arr.js"; +import * as dom from "./domUtils.js"; +import * as is from "./is.js"; +import * as pointer from "./pointerUtils.js"; +import * as rect from "./rect.js"; +import win from "./window.js"; +export function warnOnce(method, message) { + let warned = false; // eslint-disable-next-line no-shadow + + return function () { + if (!warned) { + win.window.console.warn(message); + warned = true; + } + + return method.apply(this, arguments); + }; +} +export function copyAction(dest, src) { + dest.name = src.name; + dest.axis = src.axis; + dest.edges = src.edges; + return dest; +} +export { default as browser } from "./browser.js"; +export { default as clone } from "./clone.js"; +export { default as events } from "./events.js"; +export { default as extend } from "./extend.js"; +export { default as getOriginXY } from "./getOriginXY.js"; +export { default as hypot } from "./hypot.js"; +export { default as normalizeListeners } from "./normalizeListeners.js"; +export { default as raf } from "./raf.js"; +export { win, arr, dom, is, pointer, rect }; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/@interactjs/utils/index.js.map b/@interactjs/utils/index.js.map new file mode 100644 index 000000000..0e02b4b41 --- /dev/null +++ b/@interactjs/utils/index.js.map @@ -0,0 +1,42 @@ +{ + "version": 3, + "sources": [ + "index.ts" + ], + "names": [ + "arr", + "dom", + "is", + "pointer", + "rect", + "win", + "warnOnce", + "method", + "message", + "warned", + "window", + "console", + "warn", + "apply", + "arguments", + "copyAction", + "dest", + "src", + "name", + "axis", + "edges", + "default", + "browser", + "clone", + "events", + "extend", + "getOriginXY", + "hypot", + "normalizeListeners", + "raf" + ], + "mappings": "AAAA,OAAO,KAAKA,GAAZ;AACA,OAAO,KAAKC,GAAZ;AACA,OAAO,KAAKC,EAAZ;AACA,OAAO,KAAKC,OAAZ;AACA,OAAO,KAAKC,IAAZ;AACA,OAAOC,GAAP;AAEA,OAAO,SAASC,QAAT,CAA+BC,MAA/B,EAAgEC,OAAhE,EAAiF;AACtF,MAAIC,MAAM,GAAG,KAAb,CADsF,CAGtF;;AACA,SAAO,YAAmB;AACxB,QAAI,CAACA,MAAL,EAAa;AACVJ,MAAAA,GAAD,CAAaK,MAAb,CAAoBC,OAApB,CAA4BC,IAA5B,CAAiCJ,OAAjC;AACAC,MAAAA,MAAM,GAAG,IAAT;AACD;;AAED,WAAOF,MAAM,CAACM,KAAP,CAAa,IAAb,EAAmBC,SAAnB,CAAP;AACD,GAPD;AAQD;AAED,OAAO,SAASC,UAAT,CAAqBC,IAArB,EAAiDC,GAAjD,EAA4E;AACjFD,EAAAA,IAAI,CAACE,IAAL,GAAaD,GAAG,CAACC,IAAjB;AACAF,EAAAA,IAAI,CAACG,IAAL,GAAaF,GAAG,CAACE,IAAjB;AACAH,EAAAA,IAAI,CAACI,KAAL,GAAaH,GAAG,CAACG,KAAjB;AAEA,SAAOJ,IAAP;AACD;AAED,SAASK,OAAO,IAAIC,OAApB;AACA,SAASD,OAAO,IAAIE,KAApB;AACA,SAASF,OAAO,IAAIG,MAApB;AACA,SAASH,OAAO,IAAII,MAApB;AACA,SAASJ,OAAO,IAAIK,WAApB;AACA,SAASL,OAAO,IAAIM,KAApB;AACA,SAASN,OAAO,IAAIO,kBAApB;AACA,SAASP,OAAO,IAAIQ,GAApB;AACA,SAASxB,GAAT,EAAcL,GAAd,EAAmBC,GAAnB,EAAwBC,EAAxB,EAA4BC,OAA5B,EAAqCC,IAArC", + "sourcesContent": [ + "import * as arr from './arr'\nimport * as dom from './domUtils'\nimport * as is from './is'\nimport * as pointer from './pointerUtils'\nimport * as rect from './rect'\nimport win from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n // eslint-disable-next-line no-shadow\n return function (this: T) {\n if (!warned) {\n (win as any).window.console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: Interact.ActionProps, src: Interact.ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport { default as browser } from './browser'\nexport { default as clone } from './clone'\nexport { default as events } from './events'\nexport { default as extend } from './extend'\nexport { default as getOriginXY } from './getOriginXY'\nexport { default as hypot } from './hypot'\nexport { default as normalizeListeners } from './normalizeListeners'\nexport { default as raf } from './raf'\nexport { win, arr, dom, is, pointer, rect }\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/is.d.ts b/@interactjs/utils/is.d.ts new file mode 100644 index 000000000..f8b0fe799 --- /dev/null +++ b/@interactjs/utils/is.d.ts @@ -0,0 +1,12 @@ +export declare const window: (thing: any) => thing is Window; +export declare const docFrag: (thing: any) => thing is DocumentFragment; +export declare const object: (thing: any) => thing is { + [index: string]: any; +}; +export declare const func: (thing: any) => thing is (...args: any[]) => any; +export declare const number: (thing: any) => thing is number; +export declare const bool: (thing: any) => thing is boolean; +export declare const string: (thing: any) => thing is string; +export declare const element: (thing: any) => thing is import("@interactjs/types/types").Element; +export declare const plainObject: typeof object; +export declare const array: (thing: any) => thing is T[]; diff --git a/@interactjs/utils/is.js b/@interactjs/utils/is.js new file mode 100644 index 000000000..90008a46d --- /dev/null +++ b/@interactjs/utils/is.js @@ -0,0 +1,23 @@ +// tslint:disable variable-name +import isWindow from "./isWindow.js"; +import win from "./window.js"; +export const window = thing => thing === win.window || isWindow(thing); +export const docFrag = thing => object(thing) && thing.nodeType === 11; +export const object = thing => !!thing && typeof thing === 'object'; +export const func = thing => typeof thing === 'function'; +export const number = thing => typeof thing === 'number'; +export const bool = thing => typeof thing === 'boolean'; +export const string = thing => typeof thing === 'string'; +export const element = thing => { + if (!thing || typeof thing !== 'object') { + return false; + } + + const _window = win.getWindow(thing) || win.window; + + return /object|function/.test(typeof _window.Element) ? thing instanceof _window.Element // DOM2 + : thing.nodeType === 1 && typeof thing.nodeName === 'string'; +}; +export const plainObject = thing => object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString()); +export const array = thing => object(thing) && typeof thing.length !== 'undefined' && func(thing.splice); +//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/@interactjs/utils/is.js.map b/@interactjs/utils/is.js.map new file mode 100644 index 000000000..f9a321614 --- /dev/null +++ b/@interactjs/utils/is.js.map @@ -0,0 +1,35 @@ +{ + "version": 3, + "sources": [ + "is.ts" + ], + "names": [ + "isWindow", + "win", + "window", + "thing", + "docFrag", + "object", + "nodeType", + "func", + "number", + "bool", + "string", + "element", + "_window", + "getWindow", + "test", + "Element", + "nodeName", + "plainObject", + "constructor", + "toString", + "array", + "length", + "splice" + ], + "mappings": "AAAA;AAEA,OAAOA,QAAP;AACA,OAAOC,GAAP;AAEA,OAAO,MAAMC,MAAM,GAAIC,KAAD,IACpBA,KAAK,KAAKF,GAAG,CAACC,MAAd,IAAwBF,QAAQ,CAACG,KAAD,CAD3B;AAGP,OAAO,MAAMC,OAAO,GAAID,KAAD,IACrBE,MAAM,CAACF,KAAD,CAAN,IAAiBA,KAAK,CAACG,QAAN,KAAmB,EAD/B;AAGP,OAAO,MAAMD,MAAM,GAAIF,KAAD,IACpB,CAAC,CAACA,KAAF,IAAY,OAAOA,KAAP,KAAiB,QADxB;AAGP,OAAO,MAAMI,IAAI,GAAIJ,KAAD,IAClB,OAAOA,KAAP,KAAiB,UADZ;AAGP,OAAO,MAAMK,MAAM,GAAIL,KAAD,IACpB,OAAOA,KAAP,KAAiB,QADZ;AAGP,OAAO,MAAMM,IAAI,GAAIN,KAAD,IAClB,OAAOA,KAAP,KAAiB,SADZ;AAGP,OAAO,MAAMO,MAAM,GAAIP,KAAD,IACpB,OAAOA,KAAP,KAAiB,QADZ;AAGP,OAAO,MAAMQ,OAAO,GAAIR,KAAD,IAA2C;AAChE,MAAI,CAACA,KAAD,IAAW,OAAOA,KAAP,KAAiB,QAAhC,EAA2C;AAAE,WAAO,KAAP;AAAc;;AAE3D,QAAMS,OAAO,GAAGX,GAAG,CAACY,SAAJ,CAAcV,KAAd,KAAwBF,GAAG,CAACC,MAA5C;;AAEA,SAAQ,kBAAkBY,IAAlB,CAAuB,OAAOF,OAAO,CAACG,OAAtC,IACJZ,KAAK,YAAYS,OAAO,CAACG,OADrB,CAC6B;AAD7B,IAEJZ,KAAK,CAACG,QAAN,KAAmB,CAAnB,IAAwB,OAAOH,KAAK,CAACa,QAAb,KAA0B,QAFtD;AAGD,CARM;AAUP,OAAO,MAAMC,WAA0B,GAAId,KAAD,IACxCE,MAAM,CAACF,KAAD,CAAN,IACA,CAAC,CAACA,KAAK,CAACe,WADR,IAEA,oBAAoBJ,IAApB,CAAyBX,KAAK,CAACe,WAAN,CAAkBC,QAAlB,EAAzB,CAHK;AAKP,OAAO,MAAMC,KAAK,GAAuBjB,KAApB,IAClBE,MAAM,CAACF,KAAD,CAAN,IACA,OAAOA,KAAK,CAACkB,MAAb,KAAwB,WADxB,IAEDd,IAAI,CAACJ,KAAK,CAACmB,MAAP,CAHC", + "sourcesContent": [ + "// tslint:disable variable-name\n\nimport isWindow from './isWindow'\nimport win from './window'\n\nexport const window = (thing: any): thing is Window =>\n thing === win.window || isWindow(thing)\n\nexport const docFrag = (thing: any): thing is DocumentFragment =>\n object(thing) && thing.nodeType === 11\n\nexport const object = (thing: any): thing is { [index: string]: any } =>\n !!thing && (typeof thing === 'object')\n\nexport const func = (thing: any): thing is (...args: any[]) => any =>\n typeof thing === 'function'\n\nexport const number = (thing: any): thing is number =>\n typeof thing === 'number'\n\nexport const bool = (thing: any): thing is boolean =>\n typeof thing === 'boolean'\n\nexport const string = (thing: any): thing is string =>\n typeof thing === 'string'\n\nexport const element = (thing: any): thing is Interact.Element => {\n if (!thing || (typeof thing !== 'object')) { return false }\n\n const _window = win.getWindow(thing) || win.window\n\n return (/object|function/.test(typeof _window.Element)\n ? thing instanceof _window.Element // DOM2\n : thing.nodeType === 1 && typeof thing.nodeName === 'string')\n}\n\nexport const plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) &&\n !!thing.constructor &&\n /function Object\\b/.test(thing.constructor.toString())\n\nexport const array = (thing: any): thing is T[] =>\n (object(thing) &&\n (typeof thing.length !== 'undefined') &&\n func(thing.splice))\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/isWindow.d.ts b/@interactjs/utils/isWindow.d.ts new file mode 100644 index 000000000..eb3719fa8 --- /dev/null +++ b/@interactjs/utils/isWindow.d.ts @@ -0,0 +1,2 @@ +declare const _default: (thing: any) => boolean; +export default _default; diff --git a/@interactjs/utils/isWindow.js b/@interactjs/utils/isWindow.js new file mode 100644 index 000000000..55efd021e --- /dev/null +++ b/@interactjs/utils/isWindow.js @@ -0,0 +1,2 @@ +export default (thing => !!(thing && thing.Window) && thing instanceof thing.Window); +//# sourceMappingURL=isWindow.js.map \ No newline at end of file diff --git a/@interactjs/utils/isWindow.js.map b/@interactjs/utils/isWindow.js.map new file mode 100644 index 000000000..b8fd6d38e --- /dev/null +++ b/@interactjs/utils/isWindow.js.map @@ -0,0 +1,14 @@ +{ + "version": 3, + "sources": [ + "isWindow.ts" + ], + "names": [ + "thing", + "Window" + ], + "mappings": "AAAA,gBAAgBA,KAAD,IAAgB,CAAC,EAAEA,KAAK,IAAIA,KAAK,CAACC,MAAjB,CAAD,IAA8BD,KAAK,YAAYA,KAAK,CAACC,MAApF", + "sourcesContent": [ + "export default (thing: any) => !!(thing && thing.Window) && (thing instanceof thing.Window)\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/normalizeListeners.d.ts b/@interactjs/utils/normalizeListeners.d.ts new file mode 100644 index 000000000..96389ffc6 --- /dev/null +++ b/@interactjs/utils/normalizeListeners.d.ts @@ -0,0 +1,4 @@ +export interface NormalizedListeners { + [type: string]: Interact.Listener[]; +} +export default function normalize(type: Interact.EventTypes, listeners?: Interact.ListenersArg | Interact.ListenersArg[], result?: NormalizedListeners): NormalizedListeners; diff --git a/@interactjs/utils/normalizeListeners.js b/@interactjs/utils/normalizeListeners.js new file mode 100644 index 000000000..514876dc8 --- /dev/null +++ b/@interactjs/utils/normalizeListeners.js @@ -0,0 +1,40 @@ +import extend from "./extend.js"; +import * as is from "./is.js"; +export default function normalize(type, listeners, result) { + result = result || {}; + + if (is.string(type) && type.search(' ') !== -1) { + type = split(type); + } + + if (is.array(type)) { + return type.reduce((acc, t) => extend(acc, normalize(t, listeners, result)), result); + } // ({ type: fn }) -> ('', { type: fn }) + + + if (is.object(type)) { + listeners = type; + type = ''; + } + + if (is.func(listeners)) { + result[type] = result[type] || []; + result[type].push(listeners); + } else if (is.array(listeners)) { + for (const l of listeners) { + normalize(type, l, result); + } + } else if (is.object(listeners)) { + for (const prefix in listeners) { + const combinedTypes = split(prefix).map(p => `${type}${p}`); + normalize(combinedTypes, listeners[prefix], result); + } + } + + return result; +} + +function split(type) { + return type.trim().split(/ +/); +} +//# sourceMappingURL=normalizeListeners.js.map \ No newline at end of file diff --git a/@interactjs/utils/normalizeListeners.js.map b/@interactjs/utils/normalizeListeners.js.map new file mode 100644 index 000000000..65942be15 --- /dev/null +++ b/@interactjs/utils/normalizeListeners.js.map @@ -0,0 +1,34 @@ +{ + "version": 3, + "sources": [ + "normalizeListeners.ts" + ], + "names": [ + "extend", + "is", + "normalize", + "type", + "listeners", + "result", + "string", + "search", + "split", + "array", + "reduce", + "acc", + "t", + "object", + "func", + "push", + "l", + "prefix", + "combinedTypes", + "map", + "p", + "trim" + ], + "mappings": "AAAA,OAAOA,MAAP;AACA,OAAO,KAAKC,EAAZ;AAMA,eAAe,SAASC,SAAT,CACbC,IADa,EAEbC,SAFa,EAGbC,MAHa,EAIQ;AACrBA,EAAAA,MAAM,GAAGA,MAAM,IAAI,EAAnB;;AAEA,MAAIJ,EAAE,CAACK,MAAH,CAAUH,IAAV,KAAmBA,IAAI,CAACI,MAAL,CAAY,GAAZ,MAAqB,CAAC,CAA7C,EAAgD;AAC9CJ,IAAAA,IAAI,GAAGK,KAAK,CAACL,IAAD,CAAZ;AACD;;AAED,MAAIF,EAAE,CAACQ,KAAH,CAASN,IAAT,CAAJ,EAAoB;AAClB,WAA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from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Interact.Listener[]\n}\n\nexport default function normalize (\n type: Interact.EventTypes,\n listeners?: Interact.ListenersArg | Interact.ListenersArg[],\n result?: NormalizedListeners,\n): NormalizedListeners {\n result = result || {}\n\n if (is.string(type) && type.search(' ') !== -1) {\n type = split(type)\n }\n\n if (is.array(type)) {\n return type.reduce(\n (acc, t) => extend(acc, normalize(t, listeners, result)),\n result,\n )\n }\n\n // ({ type: fn }) -> ('', { type: fn })\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n }\n else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, result)\n }\n }\n else if (is.object(listeners)) {\n for (const prefix in listeners) {\n const combinedTypes = split(prefix).map(p => `${type}${p}`)\n\n normalize(combinedTypes, listeners[prefix], result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/normalizeListeners.spec.d.ts b/@interactjs/utils/normalizeListeners.spec.d.ts new file mode 100644 index 000000000..cb0ff5c3b --- /dev/null +++ b/@interactjs/utils/normalizeListeners.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/@interactjs/utils/pointerExtend.d.ts b/@interactjs/utils/pointerExtend.d.ts new file mode 100644 index 000000000..8aad3417e --- /dev/null +++ b/@interactjs/utils/pointerExtend.d.ts @@ -0,0 +1,12 @@ +export interface PointerExtend { + webkit: RegExp; + [prefix: string]: RegExp; +} +declare function pointerExtend(dest: any, source: any): any; +declare namespace pointerExtend { + var prefixedPropREs: { + webkit: RegExp; + moz: RegExp; + }; +} +export default pointerExtend; diff --git a/@interactjs/utils/pointerExtend.js b/@interactjs/utils/pointerExtend.js new file mode 100644 index 000000000..62a9c622d --- /dev/null +++ b/@interactjs/utils/pointerExtend.js @@ -0,0 +1,26 @@ +function pointerExtend(dest, source) { + for (const prop in source) { + const prefixedPropREs = pointerExtend.prefixedPropREs; + let deprecated = false; // skip deprecated prefixed properties + + for (const vendor in prefixedPropREs) { + if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) { + deprecated = true; + break; + } + } + + if (!deprecated && typeof source[prop] !== 'function') { + dest[prop] = source[prop]; + } + } + + return dest; +} + +pointerExtend.prefixedPropREs = { + webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/, + moz: /(Pressure)$/ +}; +export default pointerExtend; +//# sourceMappingURL=pointerExtend.js.map \ No newline at end of file diff --git a/@interactjs/utils/pointerExtend.js.map b/@interactjs/utils/pointerExtend.js.map new file mode 100644 index 000000000..fd9040cfa --- /dev/null +++ b/@interactjs/utils/pointerExtend.js.map @@ -0,0 +1,23 @@ +{ + "version": 3, + "sources": [ + "pointerExtend.ts" + ], + "names": [ + "pointerExtend", + "dest", + "source", + "prop", + "prefixedPropREs", + "deprecated", + "vendor", + "indexOf", + "test", + "webkit", + "moz" + ], + "mappings": "AAKA,SAASA,aAAT,CAAwBC,IAAxB,EAA8BC,MAA9B,EAAsC;AACpC,OAAK,MAAMC,IAAX,IAAmBD,MAAnB,EAA2B;AACzB,UAAME,eAAe,GAAGJ,aAAa,CAACI,eAAtC;AACA,QAAIC,UAAU,GAAG,KAAjB,CAFyB,CAIzB;;AACA,SAAK,MAAMC,MAAX,IAAqBF,eAArB,EAAsC;AACpC,UAAID,IAAI,CAACI,OAAL,CAAaD,MAAb,MAAyB,CAAzB,IAA8BF,eAAe,CAACE,MAAD,CAAf,CAAwBE,IAAxB,CAA6BL,IAA7B,CAAlC,EAAsE;AACpEE,QAAAA,UAAU,GAAG,IAAb;AACA;AACD;AACF;;AAED,QAAI,CAACA,UAAD,IAAe,OAAOH,MAAM,CAACC,IAAD,CAAb,KAAwB,UAA3C,EAAuD;AACrDF,MAAAA,IAAI,CAACE,IAAD,CAAJ,GAAaD,MAAM,CAACC,IAAD,CAAnB;AACD;AACF;;AACD,SAAOF,IAAP;AACD;;AAEDD,aAAa,CAACI,eAAd,GAAgC;AAC9BK,EAAAA,MAAM,EAAE,gDADsB;AAE9BC,EAAAA,GAAG,EAAE;AAFyB,CAAhC;AAKA,eAAeV,aAAf", + "sourcesContent": [ + "export interface PointerExtend {\n webkit: RegExp\n [prefix: string]: RegExp\n}\n\nfunction pointerExtend (dest, source) {\n for (const prop in source) {\n const prefixedPropREs = pointerExtend.prefixedPropREs\n let deprecated = false\n\n // skip deprecated prefixed properties\n for (const vendor in prefixedPropREs) {\n if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) {\n deprecated = true\n break\n }\n }\n\n if (!deprecated && typeof source[prop] !== 'function') {\n dest[prop] = source[prop]\n }\n }\n return dest\n}\n\npointerExtend.prefixedPropREs = {\n webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/,\n moz: /(Pressure)$/,\n}\n\nexport default pointerExtend\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/pointerUtils.d.ts b/@interactjs/utils/pointerUtils.d.ts new file mode 100644 index 000000000..e277f29ae --- /dev/null +++ b/@interactjs/utils/pointerUtils.d.ts @@ -0,0 +1,397 @@ +import pointerExtend from './pointerExtend'; +export declare function copyCoords(dest: Interact.CoordsSetMember, src: Interact.CoordsSetMember): void; +export declare function setCoordDeltas(targetObj: Interact.CoordsSetMember, prev: Interact.CoordsSetMember, cur: Interact.CoordsSetMember): void; +export declare function setCoordVelocity(targetObj: Interact.CoordsSetMember, delta: Interact.CoordsSetMember): void; +export declare function setZeroCoords(targetObj: Interact.CoordsSetMember): void; +export declare function isNativePointer(pointer: any): boolean; +export declare function getXY(type: any, pointer: any, xy: any): any; +export declare function getPageXY(pointer: Interact.PointerType | Interact.InteractEvent, page?: Interact.Point): import("@interactjs/types/types").Point; +export declare function getClientXY(pointer: any, client: any): any; +export declare function getPointerId(pointer: any): any; +export declare function setCoords(targetObj: any, pointers: any[], timeStamp: number): void; +export declare function getTouchPair(event: any): any[]; +export declare function pointerAverage(pointers: PointerEvent[] | Event[]): { + pageX: number; + pageY: number; + clientX: number; + clientY: number; + screenX: number; + screenY: number; +}; +export declare function touchBBox(event: Event | Array<(Interact.PointerType) | TouchEvent>): { + x: number; + y: number; + left: number; + top: number; + right: number; + bottom: number; + width: number; + height: number; +}; +export declare function touchDistance(event: any, deltaSource: any): number; +export declare function touchAngle(event: any, deltaSource: any): number; +export declare function getPointerType(pointer: any): any; +export declare function getEventTargets(event: any): import("@interactjs/types/types").Element[]; +export declare function newCoords(): Interact.CoordsSetMember; +export declare function coordsToEvent(coords: MockCoords): ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & MouseEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & MouseEvent & PointerEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & MouseEvent & import("@interactjs/pointer-events/PointerEvent").default) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & MouseEvent & import("@interactjs/core/InteractEvent").InteractEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & MouseEvent & TouchEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & Touch & MouseEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & Touch & PointerEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & Touch & import("@interactjs/pointer-events/PointerEvent").default) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & Touch & import("@interactjs/core/InteractEvent").InteractEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & Touch & TouchEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & PointerEvent & MouseEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & PointerEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & PointerEvent & import("@interactjs/pointer-events/PointerEvent").default) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & PointerEvent & import("@interactjs/core/InteractEvent").InteractEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & PointerEvent & TouchEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/pointer-events/PointerEvent").default & MouseEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/pointer-events/PointerEvent").default & PointerEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/pointer-events/PointerEvent").default) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/pointer-events/PointerEvent").default & import("@interactjs/core/InteractEvent").InteractEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/pointer-events/PointerEvent").default & TouchEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/core/InteractEvent").InteractEvent & MouseEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/core/InteractEvent").InteractEvent & PointerEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/core/InteractEvent").InteractEvent & import("@interactjs/pointer-events/PointerEvent").default) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/core/InteractEvent").InteractEvent) | ({ + coords: MockCoords; + readonly page: any; + readonly client: any; + readonly timeStamp: any; + readonly pageX: any; + readonly pageY: any; + readonly clientX: any; + readonly clientY: any; + readonly pointerId: any; + readonly target: any; + readonly type: any; + readonly pointerType: any; + readonly buttons: any; +} & import("@interactjs/core/InteractEvent").InteractEvent & TouchEvent); +export interface MockCoords { + page: Interact.Point; + client: Interact.Point; + timeStamp?: number; + pointerId?: any; + target?: any; + type?: string; + pointerType?: string; + buttons?: number; +} +export { pointerExtend }; diff --git a/@interactjs/utils/pointerUtils.js b/@interactjs/utils/pointerUtils.js new file mode 100644 index 000000000..c97f87a57 --- /dev/null +++ b/@interactjs/utils/pointerUtils.js @@ -0,0 +1,253 @@ +import browser from "./browser.js"; +import dom from "./domObjects.js"; +import * as domUtils from "./domUtils.js"; +import hypot from "./hypot.js"; +import * as is from "./is.js"; +import pointerExtend from "./pointerExtend.js"; +export function copyCoords(dest, src) { + dest.page = dest.page || {}; + dest.page.x = src.page.x; + dest.page.y = src.page.y; + dest.client = dest.client || {}; + dest.client.x = src.client.x; + dest.client.y = src.client.y; + dest.timeStamp = src.timeStamp; +} +export function setCoordDeltas(targetObj, prev, cur) { + targetObj.page.x = cur.page.x - prev.page.x; + targetObj.page.y = cur.page.y - prev.page.y; + targetObj.client.x = cur.client.x - prev.client.x; + targetObj.client.y = cur.client.y - prev.client.y; + targetObj.timeStamp = cur.timeStamp - prev.timeStamp; +} +export function setCoordVelocity(targetObj, delta) { + const dt = Math.max(delta.timeStamp / 1000, 0.001); + targetObj.page.x = delta.page.x / dt; + targetObj.page.y = delta.page.y / dt; + targetObj.client.x = delta.client.x / dt; + targetObj.client.y = delta.client.y / dt; + targetObj.timeStamp = dt; +} +export function setZeroCoords(targetObj) { + targetObj.page.x = 0; + targetObj.page.y = 0; + targetObj.client.x = 0; + targetObj.client.y = 0; +} +export function isNativePointer(pointer) { + return pointer instanceof dom.Event || pointer instanceof dom.Touch; +} // Get specified X/Y coords for mouse or event.touches[0] + +export function getXY(type, pointer, xy) { + xy = xy || {}; + type = type || 'page'; + xy.x = pointer[type + 'X']; + xy.y = pointer[type + 'Y']; + return xy; +} +export function getPageXY(pointer, page) { + page = page || { + x: 0, + y: 0 + }; // Opera Mobile handles the viewport and scrolling oddly + + if (browser.isOperaMobile && isNativePointer(pointer)) { + getXY('screen', pointer, page); + page.x += window.scrollX; + page.y += window.scrollY; + } else { + getXY('page', pointer, page); + } + + return page; +} +export function getClientXY(pointer, client) { + client = client || {}; + + if (browser.isOperaMobile && isNativePointer(pointer)) { + // Opera Mobile handles the viewport and scrolling oddly + getXY('screen', pointer, client); + } else { + getXY('client', pointer, client); + } + + return client; +} +export function getPointerId(pointer) { + return is.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier; +} +export function setCoords(targetObj, pointers, timeStamp) { + const pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]; + const tmpXY = {}; + getPageXY(pointer, tmpXY); + targetObj.page.x = tmpXY.x; + targetObj.page.y = tmpXY.y; + getClientXY(pointer, tmpXY); + targetObj.client.x = tmpXY.x; + targetObj.client.y = tmpXY.y; + targetObj.timeStamp = timeStamp; +} +export function getTouchPair(event) { + const touches = []; // array of touches is supplied + + if (is.array(event)) { + touches[0] = event[0]; + touches[1] = event[1]; + } // an event + else { + if (event.type === 'touchend') { + if (event.touches.length === 1) { + touches[0] = event.touches[0]; + touches[1] = event.changedTouches[0]; + } else if (event.touches.length === 0) { + touches[0] = event.changedTouches[0]; + touches[1] = event.changedTouches[1]; + } + } else { + touches[0] = event.touches[0]; + touches[1] = event.touches[1]; + } + } + + return touches; +} +export function pointerAverage(pointers) { + const average = { + pageX: 0, + pageY: 0, + clientX: 0, + clientY: 0, + screenX: 0, + screenY: 0 + }; + + for (const pointer of pointers) { + for (const prop in average) { + average[prop] += pointer[prop]; + } + } + + for (const prop in average) { + average[prop] /= pointers.length; + } + + return average; +} +export function touchBBox(event) { + if (!event.length && !(event.touches && event.touches.length > 1)) { + return null; + } + + const touches = getTouchPair(event); + const minX = Math.min(touches[0].pageX, touches[1].pageX); + const minY = Math.min(touches[0].pageY, touches[1].pageY); + const maxX = Math.max(touches[0].pageX, touches[1].pageX); + const maxY = Math.max(touches[0].pageY, touches[1].pageY); + return { + x: minX, + y: minY, + left: minX, + top: minY, + right: maxX, + bottom: maxY, + width: maxX - minX, + height: maxY - minY + }; +} +export function touchDistance(event, deltaSource) { + const sourceX = deltaSource + 'X'; + const sourceY = deltaSource + 'Y'; + const touches = getTouchPair(event); + const dx = touches[0][sourceX] - touches[1][sourceX]; + const dy = touches[0][sourceY] - touches[1][sourceY]; + return hypot(dx, dy); +} +export function touchAngle(event, deltaSource) { + const sourceX = deltaSource + 'X'; + const sourceY = deltaSource + 'Y'; + const touches = getTouchPair(event); + const dx = touches[1][sourceX] - touches[0][sourceX]; + const dy = touches[1][sourceY] - touches[0][sourceY]; + const angle = 180 * Math.atan2(dy, dx) / Math.PI; + return angle; +} +export function getPointerType(pointer) { + return is.string(pointer.pointerType) ? pointer.pointerType : is.number(pointer.pointerType) ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType] // if the PointerEvent API isn't available, then the "pointer" must + // be either a MouseEvent, TouchEvent, or Touch object + : /touch/.test(pointer.type) || pointer instanceof dom.Touch ? 'touch' : 'mouse'; +} // [ event.target, event.currentTarget ] + +export function getEventTargets(event) { + const path = is.func(event.composedPath) ? event.composedPath() : event.path; + return [domUtils.getActualElement(path ? path[0] : event.target), domUtils.getActualElement(event.currentTarget)]; +} +export function newCoords() { + return { + page: { + x: 0, + y: 0 + }, + client: { + x: 0, + y: 0 + }, + timeStamp: 0 + }; +} +export function coordsToEvent(coords) { + const event = { + coords, + + get page() { + return this.coords.page; + }, + + get client() { + return this.coords.client; + }, + + get timeStamp() { + return this.coords.timeStamp; + }, + + get pageX() { + return this.coords.page.x; + }, + + get pageY() { + return this.coords.page.y; + }, + + get clientX() { + return this.coords.client.x; + }, + + get clientY() { + return this.coords.client.y; + }, + + get pointerId() { + return this.coords.pointerId; + }, + + get target() { + return this.coords.target; + }, + + get type() { + return this.coords.type; + }, + + get pointerType() { + return this.coords.pointerType; + }, + + get buttons() { + return this.coords.buttons; + } + + }; + return event; +} +export { pointerExtend }; +//# sourceMappingURL=pointerUtils.js.map \ No newline at end of file diff --git a/@interactjs/utils/pointerUtils.js.map b/@interactjs/utils/pointerUtils.js.map new file mode 100644 index 000000000..caad67046 --- /dev/null +++ b/@interactjs/utils/pointerUtils.js.map @@ -0,0 +1,109 @@ +{ + "version": 3, + "sources": [ + "pointerUtils.ts" + ], + "names": [ + "browser", + "dom", + "domUtils", + "hypot", + "is", + "pointerExtend", + "copyCoords", + "dest", + "src", + "page", + "x", + "y", + "client", + "timeStamp", + "setCoordDeltas", + "targetObj", + "prev", + "cur", + "setCoordVelocity", + "delta", + "dt", + "Math", + "max", + "setZeroCoords", + "isNativePointer", + "pointer", + "Event", + "Touch", + "getXY", + "type", + "xy", + "getPageXY", + "isOperaMobile", + "window", + "scrollX", + "scrollY", + "getClientXY", + "getPointerId", + "number", + "pointerId", + "identifier", + "setCoords", + "pointers", + "length", + "pointerAverage", + "tmpXY", + "getTouchPair", + "event", + "touches", + "array", + "changedTouches", + "average", + "pageX", + "pageY", + "clientX", + "clientY", + "screenX", + "screenY", + "prop", + "touchBBox", + "minX", + "min", + "minY", + "maxX", + "maxY", + "left", + "top", + "right", + "bottom", + "width", + "height", + "touchDistance", + "deltaSource", + "sourceX", + "sourceY", + "dx", + "dy", + "touchAngle", + "angle", + "atan2", + "PI", + "getPointerType", + "string", + "pointerType", + "undefined", + "test", + "getEventTargets", + "path", + "func", + "composedPath", + "getActualElement", + "target", + "currentTarget", + "newCoords", + "coordsToEvent", + "coords", + "buttons" + ], + "mappings": "AAAA,OAAOA,OAAP;AACA,OAAOC,GAAP;AACA,OAAO,KAAKC,QAAZ;AACA,OAAOC,KAAP;AACA,OAAO,KAAKC,EAAZ;AACA,OAAOC,aAAP;AAEA,OAAO,SAASC,UAAT,CAAqBC,IAArB,EAAqDC,GAArD,EAAoF;AACzFD,EAA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,aAAO,KAAK2C,MAAL,CAAYtF,IAAZ,CAAiBC,CAAxB;AAA2B,KAL9B;;AAMZ,QAAI2C,KAAJ,GAAa;AAAE,aAAO,KAAK0C,MAAL,CAAYtF,IAAZ,CAAiBE,CAAxB;AAA2B,KAN9B;;AAOZ,QAAI2C,OAAJ,GAAe;AAAE,aAAO,KAAKyC,MAAL,CAAYnF,MAAZ,CAAmBF,CAA1B;AAA6B,KAPlC;;AAQZ,QAAI6C,OAAJ,GAAe;AAAE,aAAO,KAAKwC,MAAL,CAAYnF,MAAZ,CAAmBD,CAA1B;AAA6B,KARlC;;AASZ,QAAI4B,SAAJ,GAAiB;AAAE,aAAO,KAAKwD,MAAL,CAAYxD,SAAnB;AAA8B,KATrC;;AAUZ,QAAIoD,MAAJ,GAAc;AAAE,aAAO,KAAKI,MAAL,CAAYJ,MAAnB;AAA2B,KAV/B;;AAWZ,QAAI9D,IAAJ,GAAY;AAAE,aAAO,KAAKkE,MAAL,CAAYlE,IAAnB;AAAyB,KAX3B;;AAYZ,QAAIsD,WAAJ,GAAmB;AAAE,aAAO,KAAKY,MAAL,CAAYZ,WAAnB;AAAgC,KAZzC;;AAaZ,QAAIa,OAAJ,GAAe;AAAE,aAAO,KAAKD,MAAL,CAAYC,OAAnB;AAA4B;;AAbjC,GAAd;AAgBA,SAAOjD,KAAP;AACD;AAaD,SAAS1C,aAAT", + "sourcesContent": [ + "import browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport * as is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: Interact.CoordsSetMember, src: Interact.CoordsSetMember) {\n dest.page = dest.page || {} as any\n dest.page.x = src.page.x\n dest.page.y = src.page.y\n\n dest.client = dest.client || {} as any\n dest.client.x = src.client.x\n dest.client.y = src.client.y\n\n dest.timeStamp = src.timeStamp\n}\n\nexport function setCoordDeltas (targetObj: Interact.CoordsSetMember, prev: Interact.CoordsSetMember, cur: Interact.CoordsSetMember) {\n targetObj.page.x = cur.page.x - prev.page.x\n targetObj.page.y = cur.page.y - prev.page.y\n targetObj.client.x = cur.client.x - prev.client.x\n targetObj.client.y = cur.client.y - prev.client.y\n targetObj.timeStamp = cur.timeStamp - prev.timeStamp\n}\n\nexport function setCoordVelocity (targetObj: Interact.CoordsSetMember, delta: Interact.CoordsSetMember) {\n const dt = Math.max(delta.timeStamp / 1000, 0.001)\n\n targetObj.page.x = delta.page.x / dt\n targetObj.page.y = delta.page.y / dt\n targetObj.client.x = delta.client.x / dt\n targetObj.client.y = delta.client.y / dt\n targetObj.timeStamp = dt\n}\n\nexport function setZeroCoords (targetObj: Interact.CoordsSetMember) {\n targetObj.page.x = 0\n targetObj.page.y = 0\n targetObj.client.x = 0\n targetObj.client.y = 0\n}\n\nexport function isNativePointer (pointer: any) {\n return (pointer instanceof dom.Event || pointer instanceof dom.Touch)\n}\n\n// Get specified X/Y coords for mouse or event.touches[0]\nexport function getXY (type, pointer, xy) {\n xy = xy || {}\n type = type || 'page'\n\n xy.x = pointer[type + 'X']\n xy.y = pointer[type + 'Y']\n\n return xy\n}\n\nexport function getPageXY (pointer: Interact.PointerType | Interact.InteractEvent, page?: Interact.Point) {\n page = page || { x: 0, y: 0 }\n\n // Opera Mobile handles the viewport and scrolling oddly\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n getXY('screen', pointer, page)\n\n page.x += window.scrollX\n page.y += window.scrollY\n }\n else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer, client) {\n client = client || {}\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n }\n else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer) {\n return is.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier\n}\n\nexport function setCoords (targetObj, pointers: any[], timeStamp: number) {\n const pointer = (pointers.length > 1\n ? pointerAverage(pointers)\n : pointers[0])\n\n const tmpXY = {} as { x: number, y: number }\n\n getPageXY(pointer, tmpXY)\n targetObj.page.x = tmpXY.x\n targetObj.page.y = tmpXY.y\n\n getClientXY(pointer, tmpXY)\n targetObj.client.x = tmpXY.x\n targetObj.client.y = tmpXY.y\n\n targetObj.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event) {\n const touches = []\n\n // array of touches is supplied\n if (is.array(event)) {\n touches[0] = event[0]\n touches[1] = event[1]\n }\n // an event\n else {\n if (event.type === 'touchend') {\n if (event.touches.length === 1) {\n touches[0] = event.touches[0]\n touches[1] = event.changedTouches[0]\n }\n else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\n }\n }\n else {\n touches[0] = event.touches[0]\n touches[1] = event.touches[1]\n }\n }\n\n return touches\n}\n\nexport function pointerAverage (pointers: PointerEvent[] | Event[]) {\n const average = {\n pageX : 0,\n pageY : 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop] += pointer[prop]\n }\n }\n for (const prop in average) {\n average[prop] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: Event | Array<(Interact.PointerType) | TouchEvent>) {\n if (!(event as any).length &&\n !((event as TouchEvent).touches &&\n (event as TouchEvent).touches.length > 1)) {\n return null\n }\n\n const touches = getTouchPair(event)\n const minX = Math.min(touches[0].pageX, touches[1].pageX)\n const minY = Math.min(touches[0].pageY, touches[1].pageY)\n const maxX = Math.max(touches[0].pageX, touches[1].pageX)\n const maxY = Math.max(touches[0].pageY, touches[1].pageY)\n\n return {\n x: minX,\n y: minY,\n left: minX,\n top: minY,\n right: maxX,\n bottom: maxY,\n width: maxX - minX,\n height: maxY - minY,\n }\n}\n\nexport function touchDistance (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n\n const dx = touches[0][sourceX] - touches[1][sourceX]\n const dy = touches[0][sourceY] - touches[1][sourceY]\n\n return hypot(dx, dy)\n}\n\nexport function touchAngle (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n const dx = touches[1][sourceX] - touches[0][sourceX]\n const dy = touches[1][sourceY] - touches[0][sourceY]\n const angle = 180 * Math.atan2(dy, dx) / Math.PI\n\n return angle\n}\n\nexport function getPointerType (pointer) {\n return is.string(pointer.pointerType)\n ? pointer.pointerType\n : is.number(pointer.pointerType)\n ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType]\n // if the PointerEvent API isn't available, then the \"pointer\" must\n // be either a MouseEvent, TouchEvent, or Touch object\n : /touch/.test(pointer.type) || pointer instanceof dom.Touch\n ? 'touch'\n : 'mouse'\n}\n\n// [ event.target, event.currentTarget ]\nexport function getEventTargets (event) {\n const path = is.func(event.composedPath) ? event.composedPath() : event.path\n\n return [\n domUtils.getActualElement(path ? path[0] : event.target),\n domUtils.getActualElement(event.currentTarget),\n ]\n}\n\nexport function newCoords (): Interact.CoordsSetMember {\n return {\n page : { x: 0, y: 0 },\n client : { x: 0, y: 0 },\n timeStamp: 0,\n }\n}\n\nexport function coordsToEvent (coords: MockCoords) {\n const event = {\n coords,\n get page () { return this.coords.page },\n get client () { return this.coords.client },\n get timeStamp () { return this.coords.timeStamp },\n get pageX () { return this.coords.page.x },\n get pageY () { return this.coords.page.y },\n get clientX () { return this.coords.client.x },\n get clientY () { return this.coords.client.y },\n get pointerId () { return this.coords.pointerId },\n get target () { return this.coords.target },\n get type () { return this.coords.type },\n get pointerType () { return this.coords.pointerType },\n get buttons () { return this.coords.buttons },\n }\n\n return event as typeof event & Interact.PointerType & Interact.PointerEventType\n}\n\nexport interface MockCoords {\n page: Interact.Point\n client: Interact.Point\n timeStamp?: number\n pointerId?: any\n target?: any\n type?: string\n pointerType?: string\n buttons?: number\n}\n\nexport { pointerExtend }\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/raf.d.ts b/@interactjs/utils/raf.d.ts new file mode 100644 index 000000000..21c9996dd --- /dev/null +++ b/@interactjs/utils/raf.d.ts @@ -0,0 +1,7 @@ +declare function init(window: any): void; +declare const _default: { + request: (callback: any) => any; + cancel: (token: any) => any; + init: typeof init; +}; +export default _default; diff --git a/@interactjs/utils/raf.js b/@interactjs/utils/raf.js new file mode 100644 index 000000000..d6f1ee49b --- /dev/null +++ b/@interactjs/utils/raf.js @@ -0,0 +1,39 @@ +let lastTime = 0; +let request; +let cancel; + +function init(window) { + request = window.requestAnimationFrame; + cancel = window.cancelAnimationFrame; + + if (!request) { + const vendors = ['ms', 'moz', 'webkit', 'o']; + + for (const vendor of vendors) { + request = window[`${vendor}RequestAnimationFrame`]; + cancel = window[`${vendor}CancelAnimationFrame`] || window[`${vendor}CancelRequestAnimationFrame`]; + } + } + + if (!request) { + request = callback => { + const currTime = Date.now(); + const timeToCall = Math.max(0, 16 - (currTime - lastTime)); // eslint-disable-next-line standard/no-callback-literal + + const token = setTimeout(() => { + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return token; + }; + + cancel = token => clearTimeout(token); + } +} + +export default { + request: callback => request(callback), + cancel: token => cancel(token), + init +}; +//# sourceMappingURL=raf.js.map \ No newline at end of file diff --git a/@interactjs/utils/raf.js.map b/@interactjs/utils/raf.js.map new file mode 100644 index 000000000..71a91e9fa --- /dev/null +++ b/@interactjs/utils/raf.js.map @@ -0,0 +1,31 @@ +{ + "version": 3, + "sources": [ + "raf.ts" + ], + "names": [ + "lastTime", + "request", + "cancel", + "init", + "window", + "requestAnimationFrame", + "cancelAnimationFrame", + "vendors", + "vendor", + "callback", + "currTime", + "Date", + "now", + "timeToCall", + "Math", + "max", + "token", + "setTimeout", + "clearTimeout" + ], + "mappings": "AAAA,IAAIA,QAAQ,GAAG,CAAf;AACA,IAAIC,OAAJ;AACA,IAAIC,MAAJ;;AAEA,SAASC,IAAT,CAAeC,MAAf,EAAuB;AACrBH,EAAAA,OAAO,GAAGG,MAAM,CAACC,qBAAjB;AACAH,EAAAA,MAAM,GAAGE,MAAM,CAACE,oBAAhB;;AAEA,MAAI,CAACL,OAAL,EAAc;AACZ,UAAMM,OAAO,GAAG,CAAC,IAAD,EAAO,KAAP,EAAc,QAAd,EAAwB,GAAxB,CAAhB;;AAEA,SAAK,MAAMC,MAAX,IAAqBD,OAArB,EAA8B;AAC5BN,MAAAA,OAAO,GAAGG,MAAM,CAAE,GAAEI,MAAO,uBAAX,CAAhB;AACAN,MAAAA,MAAM,GAAGE,MAAM,CAAE,GAAEI,MAAO,sBAAX,CAAN,IAA2CJ,MAAM,CAAE,GAAEI,MAAO,6BAAX,CAA1D;AACD;AACF;;AAED,MAAI,CAACP,OAAL,EAAc;AACZA,IAAAA,OAAO,GAAGQ,QAAQ,IAAI;AACpB,YAAMC,QAAQ,GAAGC,IAAI,CAACC,GAAL,EAAjB;AACA,YAAMC,UAAU,GAAGC,IAAI,CAACC,GAAL,CAAS,CAAT,EAAY,MAAML,QAAQ,GAAGV,QAAjB,CAAZ,CAAnB,CAFoB,CAGpB;;AACA,YAAMgB,KAAK,GAAGC,UAAU,CAAC,MAAM;AAAER,QAAAA,QAAQ,CAACC,QAAQ,GAAGG,UAAZ,CAAR;AAAiC,OAA1C,EACtBA,UADsB,CAAxB;AAGAb,MAAAA,QAAQ,GAAGU,QAAQ,GAAGG,UAAtB;AACA,aAAOG,KAAP;AACD,KATD;;AAWAd,IAAAA,MAAM,GAAGc,KAAK,IAAIE,YAAY,CAACF,KAAD,CAA9B;AACD;AACF;;AAED,eAAe;AACbf,EAAAA,OAAO,EAAEQ,QAAQ,IAAIR,OAAO,CAACQ,QAAD,CADf;AAEbP,EAAAA,MAAM,EAAEc,KAAK,IAAId,MAAM,CAACc,KAAD,CAFV;AAGbb,EAAAA;AAHa,CAAf", + "sourcesContent": [ + "let lastTime = 0\nlet request\nlet cancel\n\nfunction init (window) {\n request = window.requestAnimationFrame\n cancel = window.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = window[`${vendor}RequestAnimationFrame`]\n cancel = window[`${vendor}CancelAnimationFrame`] || window[`${vendor}CancelRequestAnimationFrame`]\n }\n }\n\n if (!request) {\n request = callback => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n // eslint-disable-next-line standard/no-callback-literal\n const token = setTimeout(() => { callback(currTime + timeToCall) },\n timeToCall)\n\n lastTime = currTime + timeToCall\n return token\n }\n\n cancel = token => clearTimeout(token)\n }\n}\n\nexport default {\n request: callback => request(callback),\n cancel: token => cancel(token),\n init,\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/rect.d.ts b/@interactjs/utils/rect.d.ts new file mode 100644 index 000000000..91779fd58 --- /dev/null +++ b/@interactjs/utils/rect.d.ts @@ -0,0 +1,9 @@ +export declare function getStringOptionResult(value: any, target: Interact.HasGetRect, element: any): (Node & ParentNode) | import("@interactjs/types/types").Rect; +export declare function resolveRectLike(value: Interact.RectResolvable, target?: Interact.HasGetRect, element?: Node, functionArgs?: T): import("@interactjs/types/types").Rect; +export declare function rectToXY(rect: any): { + x: any; + y: any; +}; +export declare function xywhToTlbr(rect: any): any; +export declare function tlbrToXywh(rect: any): any; +export declare function addEdges(edges: Interact.EdgeOptions, rect: Interact.Rect, delta: Interact.Point): void; diff --git a/@interactjs/utils/rect.js b/@interactjs/utils/rect.js new file mode 100644 index 000000000..ac757a45b --- /dev/null +++ b/@interactjs/utils/rect.js @@ -0,0 +1,78 @@ +import { closest, getElementRect, parentNode } from "./domUtils.js"; +import extend from "./extend.js"; +import * as is from "./is.js"; +export function getStringOptionResult(value, target, element) { + if (value === 'parent') { + return parentNode(element); + } + + if (value === 'self') { + return target.getRect(element); + } + + return closest(element, value); +} +export function resolveRectLike(value, target, element, functionArgs) { + let returnValue = value; + + if (is.string(returnValue)) { + returnValue = getStringOptionResult(returnValue, target, element); + } else if (is.func(returnValue)) { + returnValue = returnValue(...functionArgs); + } + + if (is.element(returnValue)) { + returnValue = getElementRect(returnValue); + } + + return returnValue; +} +export function rectToXY(rect) { + return rect && { + x: 'x' in rect ? rect.x : rect.left, + y: 'y' in rect ? rect.y : rect.top + }; +} +export function xywhToTlbr(rect) { + if (rect && !('left' in rect && 'top' in rect)) { + rect = extend({}, rect); + rect.left = rect.x || 0; + rect.top = rect.y || 0; + rect.right = rect.right || rect.left + rect.width; + rect.bottom = rect.bottom || rect.top + rect.height; + } + + return rect; +} +export function tlbrToXywh(rect) { + if (rect && !('x' in rect && 'y' in rect)) { + rect = extend({}, rect); + rect.x = rect.left || 0; + rect.y = rect.top || 0; + rect.width = rect.width || rect.right || 0 - rect.x; + rect.height = rect.height || rect.bottom || 0 - rect.y; + } + + return rect; +} +export function addEdges(edges, rect, delta) { + if (edges.left) { + rect.left += delta.x; + } + + if (edges.right) { + rect.right += delta.x; + } + + if (edges.top) { + rect.top += delta.y; + } + + if (edges.bottom) { + rect.bottom += delta.y; + } + + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; +} +//# sourceMappingURL=rect.js.map \ No newline at end of file diff --git a/@interactjs/utils/rect.js.map b/@interactjs/utils/rect.js.map new file mode 100644 index 000000000..d2f9cd490 --- /dev/null +++ b/@interactjs/utils/rect.js.map @@ -0,0 +1,42 @@ +{ + "version": 3, + "sources": [ + "rect.ts" + ], + "names": [ + "closest", + "getElementRect", + "parentNode", + "extend", + "is", + "getStringOptionResult", + "value", + "target", + "element", + "getRect", + "resolveRectLike", + "functionArgs", + "returnValue", + "string", + "func", + "rectToXY", + "rect", + "x", + "left", + "y", + "top", + "xywhToTlbr", + "right", + "width", + "bottom", + "height", + "tlbrToXywh", + "addEdges", + "edges", + "delta" + ], + "mappings": "AAAA,SAASA,OAAT,EAAkBC,cAAlB,EAAkCC,UAAlC;AACA,OAAOC,MAAP;AACA,OAAO,KAAKC,EAAZ;AAEA,OAAO,SAASC,qBAAT,CAAgCC,KAAhC,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CAACN,KAAV,EAAkB;AAAEN,IAAAA,IAAI,CAACM,KAAL,IAAeO,KAAK,CAACZ,CAArB;AAAwB;;AAC5C,MAAIW,KAAK,CAACR,GAAV,EAAkB;AAAEJ,IAAAA,IAAI,CAACI,GAAL,IAAeS,KAAK,CAACV,CAArB;AAAwB;;AAC5C,MAAIS,KAAK,CAACJ,MAAV,EAAkB;AAAER,IAAAA,IAAI,CAACQ,MAAL,IAAeK,KAAK,CAACV,CAArB;AAAwB;;AAE5CH,EAAAA,IAAI,CAACO,KAAL,GAAaP,IAAI,CAACM,KAAL,GAAaN,IAAI,CAACE,IAA/B;AACAF,EAAAA,IAAI,CAACS,MAAL,GAAcT,IAAI,CAACQ,MAAL,GAAcR,IAAI,CAACI,GAAjC;AACD", + "sourcesContent": [ + "import { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport * as is from './is'\n\nexport function getStringOptionResult (value: any, target: Interact.HasGetRect, element) {\n if (value === 'parent') { return parentNode(element) }\n\n if (value === 'self') { return target.getRect(element) }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: Interact.RectResolvable,\n target?: Interact.HasGetRect,\n element?: Node,\n functionArgs?: T,\n) {\n let returnValue: any = value\n if (is.string(returnValue)) {\n returnValue = getStringOptionResult(returnValue, target, element)\n }\n else if (is.func(returnValue)) {\n returnValue = returnValue(...functionArgs)\n }\n\n if (is.element(returnValue)) {\n returnValue = getElementRect(returnValue)\n }\n\n return returnValue as Interact.Rect\n}\n\nexport function rectToXY (rect) {\n return rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n}\n\nexport function xywhToTlbr (rect) {\n if (rect && !('left' in rect && 'top' in rect)) {\n rect = extend({}, rect)\n\n rect.left = rect.x || 0\n rect.top = rect.y || 0\n rect.right = rect.right || (rect.left + rect.width)\n rect.bottom = rect.bottom || (rect.top + rect.height)\n }\n\n return rect\n}\n\nexport function tlbrToXywh (rect) {\n if (rect && !('x' in rect && 'y' in rect)) {\n rect = extend({}, rect)\n\n rect.x = rect.left || 0\n rect.y = rect.top || 0\n rect.width = rect.width || (rect.right || 0 - rect.x)\n rect.height = rect.height || (rect.bottom || 0 - rect.y)\n }\n\n return rect\n}\n\nexport function addEdges (edges: Interact.EdgeOptions, rect: Interact.Rect, delta: Interact.Point) {\n if (edges.left) { rect.left += delta.x }\n if (edges.right) { rect.right += delta.x }\n if (edges.top) { rect.top += delta.y }\n if (edges.bottom) { rect.bottom += delta.y }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n" + ] +} \ No newline at end of file diff --git a/@interactjs/utils/window.d.ts b/@interactjs/utils/window.d.ts new file mode 100644 index 000000000..81a122c94 --- /dev/null +++ b/@interactjs/utils/window.d.ts @@ -0,0 +1,11 @@ +declare const win: { + realWindow: Window; + window: Window; + getWindow: typeof getWindow; + init: typeof init; +}; +export declare function init(window: Window & { + wrap?: (...args: any[]) => any; +}): void; +export declare function getWindow(node: any): any; +export default win; diff --git a/@interactjs/utils/window.js b/@interactjs/utils/window.js new file mode 100644 index 000000000..165a0b877 --- /dev/null +++ b/@interactjs/utils/window.js @@ -0,0 +1,39 @@ +import isWindow from "./isWindow.js"; +const win = { + realWindow: undefined, + window: undefined, + getWindow, + init +}; +export function init(window) { + // get wrapped window if using Shadow DOM polyfill + win.realWindow = window; // create a TextNode + + const el = window.document.createTextNode(''); // check if it's wrapped by a polyfill + + if (el.ownerDocument !== window.document && typeof window.wrap === 'function' && window.wrap(el) === el) { + // use wrapped window + window = window.wrap(window); + } + + win.window = window; +} + +if (typeof window === 'undefined') { + win.window = undefined; + win.realWindow = undefined; +} else { + init(window); +} + +export function getWindow(node) { + if (isWindow(node)) { + return node; + } + + const rootNode = node.ownerDocument || node; + return rootNode.defaultView || win.window; +} +win.init = init; +export default win; +//# sourceMappingURL=window.js.map \ No newline at end of file diff --git a/@interactjs/utils/window.js.map b/@interactjs/utils/window.js.map new file mode 100644 index 000000000..377f2ce3a --- /dev/null +++ b/@interactjs/utils/window.js.map @@ -0,0 +1,27 @@ +{ + "version": 3, + "sources": [ + "window.ts" + ], + "names": [ + "isWindow", + "win", + "realWindow", + "undefined", + "window", + "getWindow", + "init", + "el", + "document", + "createTextNode", + "ownerDocument", + "wrap", + "node", + "rootNode", + "defaultView" + ], + "mappings": "AAAA,OAAOA,QAAP;AAEA,MAAMC,GAAG,GAAG;AACVC,EAAAA,UAAU,EAAEC,SADF;AAEVC,EAAAA,MAAM,EAAED,SAFE;AAGVE,EAAAA,SAHU;AAIVC,EAAAA;AAJU,CAAZ;AAOA,OAAO,SAASA,IAAT,CAAeF,MAAf,EAAoE;AACzE;AAEAH,EAAAA,GAAG,CAACC,UAAJ,GAAiBE,MAAjB,CAHyE,CAKzE;;AACA,QAAMG,EAAE,GAAGH,MAAM,CAACI,QAAP,CAAgBC,cAAhB,CAA+B,EAA/B,CAAX,CANyE,CAQzE;;AACA,MAAIF,EAAE,CAACG,aAAH,KAAqBN,MAAM,CAACI,QAA5B,IACA,OAAOJ,MAAM,CAACO,IAAd,KAAuB,UADvB,IAEFP,MAAM,CAACO,IAAP,CAAYJ,EAAZ,MAAoBA,EAFtB,EAE0B;AACxB;AACAH,IAAAA,MAAM,GAAGA,MAAM,CAACO,IAAP,CAAYP,MAAZ,CAAT;AACD;;AAEDH,EAAAA,GAAG,CAACG,MAAJ,GAAaA,MAAb;AACD;;AAED,IAAI,OAAOA,MAAP,KAAkB,WAAtB,EAAmC;AACjCH,EAAAA,GAAG,CAACG,MAAJ,GAAiBD,SAAjB;AACAF,EAAAA,GAAG,CAACC,UAAJ,GAAiBC,SAAjB;AACD,CAHD,MAIK;AACHG,EAAAA,IAAI,CAACF,MAAD,CAAJ;AACD;;AAED,OAAO,SAASC,SAAT,CAAoBO,IAApB,EAA+B;AACpC,MAAIZ,QAAQ,CAACY,IAAD,CAAZ,EAAoB;AAClB,WAAOA,IAAP;AACD;;AAED,QAAMC,QAAQ,GAAID,IAAI,CAACF,aAAL,IAAsBE,IAAxC;AAEA,SAAOC,QAAQ,CAACC,WAAT,IAAwBb,GAAG,CAACG,MAAnC;AACD;AAEDH,GAAG,CAACK,IAAJ,GAAWA,IAAX;AAEA,eAAeL,GAAf", + "sourcesContent": [ + "import isWindow from './isWindow'\n\nconst win = {\n realWindow: undefined as Window,\n window: undefined as Window,\n getWindow,\n init,\n}\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n win.realWindow = window\n\n // create a TextNode\n const el = window.document.createTextNode('')\n\n // check if it's wrapped by a polyfill\n if (el.ownerDocument !== window.document &&\n typeof window.wrap === 'function' &&\n window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win.window = window\n}\n\nif (typeof window === 'undefined') {\n win.window = undefined\n win.realWindow = undefined\n}\nelse {\n init(window)\n}\n\nexport function getWindow (node: any) {\n if (isWindow(node)) {\n return node\n }\n\n const rootNode = (node.ownerDocument || node)\n\n return rootNode.defaultView || win.window\n}\n\nwin.init = init\n\nexport default win\n" + ] +} \ No newline at end of file diff --git a/interactjs/.npmignore b/interactjs/.npmignore new file mode 100644 index 000000000..468d7c506 --- /dev/null +++ b/interactjs/.npmignore @@ -0,0 +1,7 @@ +# copied from [root]/.npmignore +*.ts +!*.d.ts +*.spec.ts +*.spec.js +dist/docs +guide diff --git a/interactjs/LICENSE b/interactjs/LICENSE new file mode 100644 index 000000000..e4854f77d --- /dev/null +++ b/interactjs/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2012-present Taye Adeyemi + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to +whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of 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. diff --git a/interactjs/README.md b/interactjs/README.md new file mode 100644 index 000000000..6fb0ade83 --- /dev/null +++ b/interactjs/README.md @@ -0,0 +1,112 @@ +interact.js + +

+ JavaScript drag and drop, resizing and multi-touch gestures with inertia and snapping for modern browsers (and also IE9+). +

+ +
+Gitter +jsDelivr +Build Status + +
+
+ +Features include: + + - **inertia** and **snapping** + - **multi-touch**, simultaneous interactions + - cross browser and device, supporting the **desktop and mobile** versions of + Chrome, Firefox and Opera as well as **Internet Explorer 9+** + - interaction with [**SVG**](http://interactjs.io/#use_in_svg_files) elements + - being **standalone and customizable** + - **not modifying the DOM** except to change the cursor (but you can disable + that) + +Installation +------------ + +* [npm](https://www.npmjs.org/): `npm install interactjs` +* [jsDelivr CDN](https://cdn.jsdelivr.net/npm/interactjs/): `` +* [unpkg CDN](https://unpkg.com/interactjs/): `` +* [Rails 5.1+](https://rubyonrails.org/): + 1. `yarn add interactjs` + 2. `//= require interactjs/interact` +* [Webjars SBT/Play 2](https://www.webjars.org/): `libraryDependencies ++= Seq("org.webjars.npm" % "interactjs" % version)` + +### Typescript definitions + +The project is written in Typescript and the npm package includes the type +definitions, but if you need the typings alone, you can install them with: + +``` +npm install --save-dev @interactjs/types +``` + +Documentation +------------- + +http://interactjs.io/docs + +Example +------- + +```javascript +var pixelSize = 16; + +interact('.rainbow-pixel-canvas') + .origin('self') + .draggable({ + modifiers: [ + interact.modifiers.snap({ + // snap to the corners of a grid + targets: [ + interact.snappers.grid({ x: pixelSize, y: pixelSize }), + ], + }) + ], + listeners: { + // draw colored squares on move + move: function (event) { + var context = event.target.getContext('2d'), + // calculate the angle of the drag direction + dragAngle = 180 * Math.atan2(event.dx, event.dy) / Math.PI; + + // set color based on drag angle and speed + context.fillStyle = 'hsl(' + dragAngle + ', 86%, ' + + (30 + Math.min(event.speed / 1000, 1) * 50) + '%)'; + + // draw squares + context.fillRect(event.pageX - pixelSize / 2, event.pageY - pixelSize / 2, + pixelSize, pixelSize); + } + } + }) + // clear the canvas on doubletap + .on('doubletap', function (event) { + var context = event.target.getContext('2d'); + + context.clearRect(0, 0, context.canvas.width, context.canvas.height); + }); + + function resizeCanvases () { + [].forEach.call(document.querySelectorAll('.rainbow-pixel-canvas'), function (canvas) { + canvas.width = document.body.clientWidth; + canvas.height = window.innerHeight * 0.7; + }); + } + + // interact.js can also add DOM event listeners + interact(document).on('DOMContentLoaded', resizeCanvases); + interact(window).on('resize', resizeCanvases); +``` + +See the above code in action at https://codepen.io/taye/pen/tCKAm + +License +------- + +interact.js is released under the [MIT License](http://taye.mit-license.org). + +[ijs-twitter]: https://twitter.com/interactjs +[upcoming-changes]: https://github.com/taye/interact.js/blob/master/CHANGELOG.md#upcoming-changes diff --git a/interactjs/dist/api/@interactjs_actions_drag.ts.html b/interactjs/dist/api/@interactjs_actions_drag.ts.html new file mode 100644 index 000000000..468216b4e --- /dev/null +++ b/interactjs/dist/api/@interactjs_actions_drag.ts.html @@ -0,0 +1,242 @@ + + + + + + @interactjs/actions/drag.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/actions/drag.ts

+ + + + + + + +
+
+
import { Scope } from '@interactjs/core/scope'
+import * as is from '@interactjs/utils/is'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    draggable: DraggableMethod
+  }
+}
+
+declare module '@interactjs/core/defaultOptions' {
+  interface ActionDefaults {
+    drag: Interact.DraggableOptions
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface ActionMap {
+    drag?: typeof drag
+  }
+}
+
+export type DragEvent = Interact.InteractEvent<'drag'>
+
+export type DraggableMethod = Interact.ActionMethod<Interact.DraggableOptions>
+
+function install (scope: Scope) {
+  const {
+    actions,
+    Interactable,
+    defaults,
+  } = scope
+
+  Interactable.prototype.draggable = drag.draggable
+
+  actions.map.drag = drag
+  actions.methodDict.drag = 'draggable'
+
+  defaults.actions.drag = drag.defaults
+}
+
+function beforeMove ({ interaction }) {
+  if (interaction.prepared.name !== 'drag') { return }
+
+  const axis = interaction.prepared.axis
+
+  if (axis === 'x') {
+    interaction.coords.cur.page.y   = interaction.coords.start.page.y
+    interaction.coords.cur.client.y = interaction.coords.start.client.y
+
+    interaction.coords.velocity.client.y = 0
+    interaction.coords.velocity.page.y   = 0
+  }
+  else if (axis === 'y') {
+    interaction.coords.cur.page.x   = interaction.coords.start.page.x
+    interaction.coords.cur.client.x = interaction.coords.start.client.x
+
+    interaction.coords.velocity.client.x = 0
+    interaction.coords.velocity.page.x   = 0
+  }
+}
+
+function move ({ iEvent, interaction }) {
+  if (interaction.prepared.name !== 'drag') { return }
+
+  const axis = interaction.prepared.axis
+
+  if (axis === 'x' || axis === 'y') {
+    const opposite = axis === 'x' ? 'y' : 'x'
+
+    iEvent.page[opposite]   = interaction.coords.start.page[opposite]
+    iEvent.client[opposite] = interaction.coords.start.client[opposite]
+    iEvent.delta[opposite] = 0
+  }
+}
+
+/**
+ * ```js
+ * interact(element).draggable({
+ *     onstart: function (event) {},
+ *     onmove : function (event) {},
+ *     onend  : function (event) {},
+ *
+ *     // the axis in which the first movement must be
+ *     // for the drag sequence to start
+ *     // 'xy' by default - any direction
+ *     startAxis: 'x' || 'y' || 'xy',
+ *
+ *     // 'xy' by default - don't restrict to one axis (move in any direction)
+ *     // 'x' or 'y' to restrict movement to either axis
+ *     // 'start' to restrict movement to the axis the drag started in
+ *     lockAxis: 'x' || 'y' || 'xy' || 'start',
+ *
+ *     // max number of drags that can happen concurrently
+ *     // with elements of this Interactable. Infinity by default
+ *     max: Infinity,
+ *
+ *     // max number of drags that can target the same element+Interactable
+ *     // 1 by default
+ *     maxPerElement: 2
+ * })
+ *
+ * var isDraggable = interact('element').draggable(); // true
+ * ```
+ *
+ * Get or set whether drag actions can be performed on the target
+ *
+ * @alias Interactable.prototype.draggable
+ *
+ * @param {boolean | object} [options] true/false or An object with event
+ * listeners to be fired on drag events (object makes the Interactable
+ * draggable)
+ * @return {boolean | Interactable} boolean indicating if this can be the
+ * target of drag events, or this Interctable
+ */
+const draggable: DraggableMethod = function draggable (this: Interact.Interactable, options?: Interact.DraggableOptions | boolean): any {
+  if (is.object(options)) {
+    this.options.drag.enabled = options.enabled !== false
+    this.setPerAction('drag', options)
+    this.setOnEvents('drag', options)
+
+    if (/^(xy|x|y|start)$/.test(options.lockAxis)) {
+      this.options.drag.lockAxis = options.lockAxis
+    }
+    if (/^(xy|x|y)$/.test(options.startAxis)) {
+      this.options.drag.startAxis = options.startAxis
+    }
+
+    return this
+  }
+
+  if (is.bool(options)) {
+    this.options.drag.enabled = options
+
+    return this
+  }
+
+  return this.options.drag
+}
+
+const drag: Interact.Plugin = {
+  id: 'actions/drag',
+  install,
+  listeners: {
+    'interactions:before-action-move': beforeMove,
+    'interactions:action-resume': beforeMove,
+
+    // dragmove
+    'interactions:action-move': move,
+    'auto-start:check': arg => {
+      const { interaction, interactable, buttons } = arg
+      const dragOptions = interactable.options.drag
+
+      if (
+        !(dragOptions && dragOptions.enabled) ||
+        // check mouseButton setting if the pointer is down
+        (interaction.pointerIsDown &&
+         /mouse|pointer/.test(interaction.pointerType) &&
+       (buttons & interactable.options.drag.mouseButtons) === 0)
+      ) {
+        return undefined
+      }
+
+      arg.action = {
+        name: 'drag',
+        axis: (dragOptions.lockAxis === 'start'
+          ? dragOptions.startAxis
+          : dragOptions.lockAxis),
+      }
+
+      return false
+    },
+  },
+  draggable,
+  beforeMove,
+  move,
+  defaults: {
+    startAxis : 'xy',
+    lockAxis  : 'xy',
+  } as Interact.DropzoneOptions,
+
+  getCursor () {
+    return 'move'
+  },
+}
+
+export default drag
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_actions_drop_DropEvent.ts.html b/interactjs/dist/api/@interactjs_actions_drop_DropEvent.ts.html new file mode 100644 index 000000000..ce435bc75 --- /dev/null +++ b/interactjs/dist/api/@interactjs_actions_drop_DropEvent.ts.html @@ -0,0 +1,148 @@ + + + + + + @interactjs/actions/drop/DropEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/actions/drop/DropEvent.ts

+ + + + + + + +
+
+
import BaseEvent from '@interactjs/core/BaseEvent'
+import Interactable from '@interactjs/core/Interactable'
+import InteractEvent from '@interactjs/core/InteractEvent'
+import * as arr from '@interactjs/utils/arr'
+
+class DropEvent extends BaseEvent {
+  target: Interact.Element
+  dropzone: Interactable
+  dragEvent: InteractEvent<'drag'>
+  relatedTarget: Interact.Element
+  draggable: Interactable
+  timeStamp: number
+  propagationStopped = false
+  immediatePropagationStopped = false
+
+  /**
+   * Class of events fired on dropzones during drags with acceptable targets.
+   */
+  constructor (dropState: import('./').DropState, dragEvent: InteractEvent<'drag'>, type: string) {
+    super(dragEvent._interaction)
+
+    const { element, dropzone } = type === 'dragleave'
+      ? dropState.prev
+      : dropState.cur
+
+    this.type          = type
+    this.target        = element
+    this.currentTarget = element
+    this.dropzone      = dropzone
+    this.dragEvent     = dragEvent
+    this.relatedTarget = dragEvent.target
+    this.draggable     = dragEvent.interactable
+    this.timeStamp     = dragEvent.timeStamp
+  }
+
+  /**
+   * If this is a `dropactivate` event, the dropzone element will be
+   * deactivated.
+   *
+   * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the
+   * dropzone element and more.
+   */
+  reject () {
+    const { dropState } = this._interaction
+
+    if (
+      (this.type !== 'dropactivate') && (
+        !this.dropzone ||
+        dropState.cur.dropzone !== this.dropzone ||
+        dropState.cur.element !== this.target)) {
+      return
+    }
+
+    dropState.prev.dropzone = this.dropzone
+    dropState.prev.element = this.target
+
+    dropState.rejected = true
+    dropState.events.enter = null
+
+    this.stopImmediatePropagation()
+
+    if (this.type === 'dropactivate') {
+      const activeDrops = dropState.activeDrops
+      const index = arr.findIndex(activeDrops, ({ dropzone, element }) =>
+        dropzone === this.dropzone && element === this.target)
+
+      dropState.activeDrops.splice(index, 1)
+
+      const deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate')
+
+      deactivateEvent.dropzone = this.dropzone
+      deactivateEvent.target = this.target
+
+      this.dropzone.fire(deactivateEvent)
+    }
+    else {
+      this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave'))
+    }
+  }
+
+  preventDefault () {}
+
+  stopPropagation () {
+    this.propagationStopped = true
+  }
+
+  stopImmediatePropagation () {
+    this.immediatePropagationStopped = this.propagationStopped = true
+  }
+}
+
+export default DropEvent
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_actions_drop_index.ts.html b/interactjs/dist/api/@interactjs_actions_drop_index.ts.html new file mode 100644 index 000000000..e4a4ee977 --- /dev/null +++ b/interactjs/dist/api/@interactjs_actions_drop_index.ts.html @@ -0,0 +1,631 @@ + + + + + + @interactjs/actions/drop/index.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/actions/drop/index.ts

+ + + + + + + +
+
+
import Interactable from '@interactjs/core/Interactable'
+import InteractEvent from '@interactjs/core/InteractEvent'
+import { Scope } from '@interactjs/core/scope'
+import * as utils from '@interactjs/utils/index'
+import drag from '../drag'
+import DropEvent from './DropEvent'
+
+export interface DropzoneMethod {
+  (options: Interact.DropzoneOptions | boolean): Interact.Interactable
+  (): Interact.DropzoneOptions
+}
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    dropzone: DropzoneMethod
+    dropCheck: (
+      dragEvent: InteractEvent,
+      event: Interact.PointerEventType,
+      draggable: Interactable,
+      draggableElement: Interact.Element,
+      dropElemen: Interact.Element,
+      rect: any
+    ) => boolean
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    dropState?: DropState
+  }
+}
+
+declare module '@interactjs/core/defaultOptions' {
+  interface ActionDefaults {
+    drop: Interact.DropzoneOptions
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface ActionMap {
+    drop?: typeof drop
+  }
+
+  interface Scope {
+    dynamicDrop?: boolean
+  }
+
+  interface SignalArgs {
+    'actions/drop:start': DropSignalArg
+    'actions/drop:move': DropSignalArg
+    'actions/drop:end': DropSignalArg
+  }
+}
+
+interface DropSignalArg {
+  interaction: Interact.Interaction
+  dragEvent: Interact.DragEvent
+}
+
+export interface DropState {
+  cur: {
+    dropzone: Interactable    // the dropzone a drag target might be dropped into
+    element: Interact.Element // the element at the time of checking
+  }
+  prev: {
+    dropzone: Interactable    // the dropzone that was recently dragged away from
+    element: Interact.Element // the element at the time of checking
+  }
+  rejected: boolean           // wheather the potential drop was rejected from a listener
+  events: any                 // the drop events related to the current drag event
+  activeDrops: Array<{
+    dropzone: Interactable
+    element: Interact.Element
+    rect: Interact.Rect
+  }>
+}
+
+function install (scope: Scope) {
+  const {
+    actions,
+    /** @lends module:interact */
+    interact,
+    /** @lends Interactable */
+    Interactable, // eslint-disable-line no-shadow
+    defaults,
+  } = scope
+
+  scope.usePlugin(drag)
+
+  /**
+   *
+   * ```js
+   * interact('.drop').dropzone({
+   *   accept: '.can-drop' || document.getElementById('single-drop'),
+   *   overlap: 'pointer' || 'center' || zeroToOne
+   * }
+   * ```
+   *
+   * Returns or sets whether draggables can be dropped onto this target to
+   * trigger drop events
+   *
+   * Dropzones can receive the following events:
+   *  - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends
+   *  - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone
+   *  - `dragmove` when a draggable that has entered the dropzone is moved
+   *  - `drop` when a draggable is dropped into this dropzone
+   *
+   * Use the `accept` option to allow only elements that match the given CSS
+   * selector or element. The value can be:
+   *
+   *  - **an Element** - only that element can be dropped into this dropzone.
+   *  - **a string**, - the element being dragged must match it as a CSS selector.
+   *  - **`null`** - accept options is cleared - it accepts any element.
+   *
+   * Use the `overlap` option to set how drops are checked for. The allowed
+   * values are:
+   *
+   *   - `'pointer'`, the pointer must be over the dropzone (default)
+   *   - `'center'`, the draggable element's center must be over the dropzone
+   *   - a number from 0-1 which is the `(intersection area) / (draggable area)`.
+   *   e.g. `0.5` for drop to happen when half of the area of the draggable is
+   *   over the dropzone
+   *
+   * Use the `checker` option to specify a function to check if a dragged element
+   * is over this Interactable.
+   *
+   * @param {boolean | object | null} [options] The new options to be set.
+   * @return {boolean | Interactable} The current setting or this Interactable
+   */
+  Interactable.prototype.dropzone = function (this: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {
+    return dropzoneMethod(this, options)
+  }
+
+  /**
+   * ```js
+   * interact(target)
+   * .dropChecker(function(dragEvent,         // related dragmove or dragend event
+   *                       event,             // TouchEvent/PointerEvent/MouseEvent
+   *                       dropped,           // bool result of the default checker
+   *                       dropzone,          // dropzone Interactable
+   *                       dropElement,       // dropzone elemnt
+   *                       draggable,         // draggable Interactable
+   *                       draggableElement) {// draggable element
+   *
+   *   return dropped && event.target.hasAttribute('allow-drop')
+   * }
+   * ```
+   */
+  Interactable.prototype.dropCheck = function (this: Interact.Interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) {
+    return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect)
+  }
+
+  /**
+   * Returns or sets whether the dimensions of dropzone elements are calculated
+   * on every dragmove or only on dragstart for the default dropChecker
+   *
+   * @param {boolean} [newValue] True to check on each move. False to check only
+   * before start
+   * @return {boolean | interact} The current setting or interact
+   */
+  interact.dynamicDrop = function (newValue?: boolean) {
+    if (utils.is.bool(newValue)) {
+      // if (dragging && scope.dynamicDrop !== newValue && !newValue) {
+      //  calcRects(dropzones)
+      // }
+
+      scope.dynamicDrop = newValue
+
+      return interact
+    }
+    return scope.dynamicDrop
+  }
+
+  utils.extend(actions.phaselessTypes, {
+    dragenter: true,
+    dragleave: true,
+    dropactivate: true,
+    dropdeactivate: true,
+    dropmove: true,
+    drop: true,
+  })
+  actions.methodDict.drop = 'dropzone'
+
+  scope.dynamicDrop = false
+
+  defaults.actions.drop = drop.defaults
+}
+
+function collectDrops ({ interactables }, draggableElement) {
+  const drops = []
+
+  // collect all dropzones and their elements which qualify for a drop
+  for (const dropzone of interactables.list) {
+    if (!dropzone.options.drop.enabled) { continue }
+
+    const accept = dropzone.options.drop.accept
+
+    // test the draggable draggableElement against the dropzone's accept setting
+    if ((utils.is.element(accept) && accept !== draggableElement) ||
+        (utils.is.string(accept) &&
+        !utils.dom.matchesSelector(draggableElement, accept)) ||
+        (utils.is.func(accept) && !accept({ dropzone, draggableElement }))) {
+      continue
+    }
+
+    // query for new elements if necessary
+    const dropElements = utils.is.string(dropzone.target)
+      ? dropzone._context.querySelectorAll(dropzone.target)
+      : utils.is.array(dropzone.target) ? dropzone.target : [dropzone.target]
+
+    for (const dropzoneElement of dropElements) {
+      if (dropzoneElement !== draggableElement) {
+        drops.push({
+          dropzone,
+          element: dropzoneElement,
+        })
+      }
+    }
+  }
+
+  return drops
+}
+
+function fireActivationEvents (activeDrops, event) {
+  // loop through all active dropzones and trigger event
+  for (const { dropzone, element } of activeDrops.slice()) {
+    event.dropzone = dropzone
+
+    // set current element as event target
+    event.target = element
+    dropzone.fire(event)
+    event.propagationStopped = event.immediatePropagationStopped = false
+  }
+}
+
+// return a new array of possible drops. getActiveDrops should always be
+// called when a drag has just started or a drag event happens while
+// dynamicDrop is true
+function getActiveDrops (scope: Scope, dragElement: Interact.Element) {
+  // get dropzones and their elements that could receive the draggable
+  const activeDrops = collectDrops(scope, dragElement)
+
+  for (const activeDrop of activeDrops) {
+    activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element)
+  }
+
+  return activeDrops
+}
+
+function getDrop ({ dropState, interactable: draggable, element: dragElement }: Partial<Interact.Interaction>, dragEvent, pointerEvent) {
+  const validDrops = []
+
+  // collect all dropzones and their elements which qualify for a drop
+  for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {
+    validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect)
+      ? dropzoneElement
+      : null)
+  }
+
+  // get the most appropriate dropzone based on DOM depth and order
+  const dropIndex = utils.dom.indexOfDeepestElement(validDrops)
+
+  return dropState.activeDrops[dropIndex] || null
+}
+
+function getDropEvents (interaction: Interact.Interaction, _pointerEvent, dragEvent) {
+  const { dropState } = interaction
+  const dropEvents = {
+    enter     : null,
+    leave     : null,
+    activate  : null,
+    deactivate: null,
+    move      : null,
+    drop      : null,
+  }
+
+  if (dragEvent.type === 'dragstart') {
+    dropEvents.activate = new DropEvent(dropState, dragEvent, 'dropactivate')
+
+    dropEvents.activate.target   = null
+    dropEvents.activate.dropzone = null
+  }
+  if (dragEvent.type === 'dragend') {
+    dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')
+
+    dropEvents.deactivate.target   = null
+    dropEvents.deactivate.dropzone = null
+  }
+
+  if (dropState.rejected) {
+    return dropEvents
+  }
+
+  if (dropState.cur.element !== dropState.prev.element) {
+    // if there was a previous dropzone, create a dragleave event
+    if (dropState.prev.dropzone) {
+      dropEvents.leave = new DropEvent(dropState, dragEvent, 'dragleave')
+
+      dragEvent.dragLeave    = dropEvents.leave.target   = dropState.prev.element
+      dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone
+    }
+    // if dropzone is not null, create a dragenter event
+    if (dropState.cur.dropzone) {
+      dropEvents.enter = new DropEvent(dropState, dragEvent, 'dragenter')
+
+      dragEvent.dragEnter = dropState.cur.element
+      dragEvent.dropzone = dropState.cur.dropzone
+    }
+  }
+
+  if (dragEvent.type === 'dragend' && dropState.cur.dropzone) {
+    dropEvents.drop = new DropEvent(dropState, dragEvent, 'drop')
+
+    dragEvent.dropzone = dropState.cur.dropzone
+    dragEvent.relatedTarget = dropState.cur.element
+  }
+  if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) {
+    dropEvents.move = new DropEvent(dropState, dragEvent, 'dropmove')
+
+    dropEvents.move.dragmove = dragEvent
+    dragEvent.dropzone = dropState.cur.dropzone
+  }
+
+  return dropEvents
+}
+
+function fireDropEvents (interaction: Interact.Interaction, events) {
+  const { dropState } = interaction
+  const {
+    activeDrops,
+    cur,
+    prev,
+  } = dropState
+
+  if (events.leave) { prev.dropzone.fire(events.leave) }
+  if (events.move) { cur.dropzone.fire(events.move) }
+  if (events.enter) { cur.dropzone.fire(events.enter) }
+  if (events.drop) { cur.dropzone.fire(events.drop) }
+
+  if (events.deactivate) {
+    fireActivationEvents(activeDrops, events.deactivate)
+  }
+
+  dropState.prev.dropzone  = cur.dropzone
+  dropState.prev.element = cur.element
+}
+
+function onEventCreated ({ interaction, iEvent, event }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {
+  if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { return }
+
+  const { dropState } = interaction
+
+  if (scope.dynamicDrop) {
+    dropState.activeDrops = getActiveDrops(scope, interaction.element)
+  }
+
+  const dragEvent = iEvent
+  const dropResult = getDrop(interaction, dragEvent, event)
+
+  // update rejected status
+  dropState.rejected = dropState.rejected &&
+    !!dropResult &&
+    dropResult.dropzone === dropState.cur.dropzone &&
+    dropResult.element === dropState.cur.element
+
+  dropState.cur.dropzone  = dropResult && dropResult.dropzone
+  dropState.cur.element = dropResult && dropResult.element
+
+  dropState.events = getDropEvents(interaction, event, dragEvent)
+}
+
+function dropzoneMethod (interactable: Interact.Interactable): Interact.DropzoneOptions
+function dropzoneMethod (interactable: Interact.Interactable, options: Interact.DropzoneOptions | boolean)
+function dropzoneMethod (interactable: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {
+  if (utils.is.object(options)) {
+    interactable.options.drop.enabled = options.enabled !== false
+
+    if (options.listeners) {
+      const normalized = utils.normalizeListeners(options.listeners)
+      // rename 'drop' to '' as it will be prefixed with 'drop'
+      const corrected = Object.keys(normalized).reduce((acc, type) => {
+        const correctedType = /^(enter|leave)/.test(type)
+          ? `drag${type}`
+          : /^(activate|deactivate|move)/.test(type)
+            ? `drop${type}`
+            : type
+
+        acc[correctedType] = normalized[type]
+
+        return acc
+      }, {})
+
+      interactable.off(interactable.options.drop.listeners)
+      interactable.on(corrected)
+      interactable.options.drop.listeners = corrected
+    }
+
+    if (utils.is.func(options.ondrop)) { interactable.on('drop', options.ondrop) }
+    if (utils.is.func(options.ondropactivate)) { interactable.on('dropactivate', options.ondropactivate) }
+    if (utils.is.func(options.ondropdeactivate)) { interactable.on('dropdeactivate', options.ondropdeactivate) }
+    if (utils.is.func(options.ondragenter)) { interactable.on('dragenter', options.ondragenter) }
+    if (utils.is.func(options.ondragleave)) { interactable.on('dragleave', options.ondragleave) }
+    if (utils.is.func(options.ondropmove)) { interactable.on('dropmove', options.ondropmove) }
+
+    if (/^(pointer|center)$/.test(options.overlap as string)) {
+      interactable.options.drop.overlap = options.overlap
+    }
+    else if (utils.is.number(options.overlap)) {
+      interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0)
+    }
+    if ('accept' in options) {
+      interactable.options.drop.accept = options.accept
+    }
+    if ('checker' in options) {
+      interactable.options.drop.checker = options.checker
+    }
+
+    return interactable
+  }
+
+  if (utils.is.bool(options)) {
+    interactable.options.drop.enabled = options
+
+    return interactable
+  }
+
+  return interactable.options.drop
+}
+
+function dropCheckMethod (
+  interactable: Interact.Interactable,
+  dragEvent: InteractEvent,
+  event: Interact.PointerEventType,
+  draggable: Interact.Interactable,
+  draggableElement: Interact.Element,
+  dropElement: Interact.Element,
+  rect: any,
+) {
+  let dropped = false
+
+  // if the dropzone has no rect (eg. display: none)
+  // call the custom dropChecker or just return false
+  if (!(rect = rect || interactable.getRect(dropElement))) {
+    return (interactable.options.drop.checker
+      ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)
+      : false)
+  }
+
+  const dropOverlap = interactable.options.drop.overlap
+
+  if (dropOverlap === 'pointer') {
+    const origin = utils.getOriginXY(draggable, draggableElement, 'drag')
+    const page = utils.pointer.getPageXY(dragEvent)
+
+    page.x += origin.x
+    page.y += origin.y
+
+    const horizontal = (page.x > rect.left) && (page.x < rect.right)
+    const vertical   = (page.y > rect.top) && (page.y < rect.bottom)
+
+    dropped = horizontal && vertical
+  }
+
+  const dragRect = draggable.getRect(draggableElement)
+
+  if (dragRect && dropOverlap === 'center') {
+    const cx = dragRect.left + dragRect.width  / 2
+    const cy = dragRect.top  + dragRect.height / 2
+
+    dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom
+  }
+
+  if (dragRect && utils.is.number(dropOverlap)) {
+    const overlapArea  = (Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) *
+                          Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top)))
+
+    const overlapRatio = overlapArea / (dragRect.width * dragRect.height)
+
+    dropped = overlapRatio >= dropOverlap
+  }
+
+  if (interactable.options.drop.checker) {
+    dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)
+  }
+
+  return dropped
+}
+
+const drop: Interact.Plugin = {
+  id: 'actions/drop',
+  install,
+  listeners: {
+    'interactions:before-action-start': ({ interaction }) => {
+      if (interaction.prepared.name !== 'drag') { return }
+
+      interaction.dropState = {
+        cur: {
+          dropzone: null,
+          element: null,
+        },
+        prev: {
+          dropzone: null,
+          element: null,
+        },
+        rejected: null,
+        events: null,
+        activeDrops: [],
+      }
+    },
+
+    'interactions:after-action-start': ({ interaction, event, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {
+      if (interaction.prepared.name !== 'drag') { return }
+
+      const { dropState } = interaction
+
+      // reset active dropzones
+      dropState.activeDrops = null
+      dropState.events = null
+      dropState.activeDrops = getActiveDrops(scope, interaction.element)
+      dropState.events = getDropEvents(interaction, event, dragEvent)
+
+      if (dropState.events.activate) {
+        fireActivationEvents(dropState.activeDrops, dropState.events.activate)
+        scope.fire('actions/drop:start', { interaction, dragEvent })
+      }
+    },
+
+    // FIXME proper signal types
+    'interactions:action-move': onEventCreated,
+    'interactions:action-end': onEventCreated,
+
+    'interactions:after-action-move': function fireDropAfterMove ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {
+      if (interaction.prepared.name !== 'drag') { return }
+
+      fireDropEvents(interaction, interaction.dropState.events)
+
+      scope.fire('actions/drop:move', { interaction, dragEvent })
+      interaction.dropState.events = {}
+    },
+
+    'interactions:after-action-end': ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {
+      if (interaction.prepared.name !== 'drag') { return }
+
+      fireDropEvents(interaction, interaction.dropState.events)
+      scope.fire('actions/drop:end', { interaction, dragEvent })
+    },
+
+    'interactions:stop': ({ interaction }) => {
+      if (interaction.prepared.name !== 'drag') { return }
+
+      const { dropState } = interaction
+
+      if (dropState) {
+        dropState.activeDrops = null
+        dropState.events = null
+        dropState.cur.dropzone = null
+        dropState.cur.element = null
+        dropState.prev.dropzone = null
+        dropState.prev.element = null
+        dropState.rejected = false
+      }
+    },
+  },
+  getActiveDrops,
+  getDrop,
+  getDropEvents,
+  fireDropEvents,
+  defaults: {
+    enabled: false,
+    accept : null,
+    overlap: 'pointer',
+  } as Interact.DropzoneOptions,
+}
+
+export default drop
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_actions_gesture.ts.html b/interactjs/dist/api/@interactjs_actions_gesture.ts.html new file mode 100644 index 000000000..80b808e4b --- /dev/null +++ b/interactjs/dist/api/@interactjs_actions_gesture.ts.html @@ -0,0 +1,255 @@ + + + + + + @interactjs/actions/gesture.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/actions/gesture.ts

+ + + + + + + +
+
+
import * as utils from '@interactjs/utils/index'
+
+export type GesturableMethod = Interact.ActionMethod<Interact.GesturableOptions>
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    gesture?: {
+      angle: number           // angle from first to second touch
+      distance: number
+      scale: number           // gesture.distance / gesture.startDistance
+      startAngle: number      // angle of line joining two touches
+      startDistance: number   // distance between two touches of touchStart
+    }
+  }
+}
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    gesturable: GesturableMethod
+  }
+}
+
+declare module '@interactjs/core/defaultOptions' {
+  interface ActionDefaults {
+    gesture: Interact.GesturableOptions
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface ActionMap {
+    gesture?: typeof gesture
+  }
+}
+
+export interface GestureEvent extends Interact.InteractEvent<'gesture'> {
+  distance: number
+  angle: number
+  da: number // angle change
+  scale: number // ratio of distance start to current event
+  ds: number // scale change
+  box: Interact.Rect // enclosing box of all points
+  touches: Interact.PointerType[]
+}
+
+export interface GestureSignalArg extends Interact.DoPhaseArg<'gesture', Interact.EventPhase> {
+  iEvent: GestureEvent
+  interaction: Interact.Interaction<'gesture'>
+}
+
+function install (scope: Interact.Scope) {
+  const {
+    actions,
+    Interactable,
+    defaults,
+  } = scope
+
+  /**
+   * ```js
+   * interact(element).gesturable({
+   *     onstart: function (event) {},
+   *     onmove : function (event) {},
+   *     onend  : function (event) {},
+   *
+   *     // limit multiple gestures.
+   *     // See the explanation in {@link Interactable.draggable} example
+   *     max: Infinity,
+   *     maxPerElement: 1,
+   * })
+   *
+   * var isGestureable = interact(element).gesturable()
+   * ```
+   *
+   * Gets or sets whether multitouch gestures can be performed on the target
+   *
+   * @param {boolean | object} [options] true/false or An object with event
+   * listeners to be fired on gesture events (makes the Interactable gesturable)
+   * @return {boolean | Interactable} A boolean indicating if this can be the
+   * target of gesture events, or this Interactable
+   */
+  Interactable.prototype.gesturable = function (this: Interact.Interactable, options: Interact.GesturableOptions | boolean) {
+    if (utils.is.object(options)) {
+      this.options.gesture.enabled = options.enabled !== false
+      this.setPerAction('gesture', options)
+      this.setOnEvents('gesture', options)
+
+      return this
+    }
+
+    if (utils.is.bool(options)) {
+      this.options.gesture.enabled = options
+
+      return this
+    }
+
+    return this.options.gesture as Interact.Options
+  } as GesturableMethod
+
+  actions.map.gesture = gesture
+  actions.methodDict.gesture = 'gesturable'
+
+  defaults.actions.gesture = gesture.defaults
+}
+
+function updateGestureProps ({ interaction, iEvent, phase }: GestureSignalArg) {
+  if (interaction.prepared.name !== 'gesture') { return }
+
+  const pointers = interaction.pointers.map(p => p.pointer)
+  const starting = phase === 'start'
+  const ending = phase === 'end'
+  const deltaSource = interaction.interactable.options.deltaSource
+
+  iEvent.touches = [pointers[0], pointers[1]]
+
+  if (starting) {
+    iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)
+    iEvent.box      = utils.pointer.touchBBox(pointers)
+    iEvent.scale    = 1
+    iEvent.ds       = 0
+    iEvent.angle    = utils.pointer.touchAngle(pointers, deltaSource)
+    iEvent.da       = 0
+
+    interaction.gesture.startDistance = iEvent.distance
+    interaction.gesture.startAngle = iEvent.angle
+  }
+  else if (ending) {
+    const prevEvent = interaction.prevEvent as GestureEvent
+
+    iEvent.distance = prevEvent.distance
+    iEvent.box      = prevEvent.box
+    iEvent.scale    = prevEvent.scale
+    iEvent.ds       = 0
+    iEvent.angle    = prevEvent.angle
+    iEvent.da       = 0
+  }
+  else {
+    iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)
+    iEvent.box      = utils.pointer.touchBBox(pointers)
+    iEvent.scale    = iEvent.distance / interaction.gesture.startDistance
+    iEvent.angle    = utils.pointer.touchAngle(pointers, deltaSource)
+
+    iEvent.ds = iEvent.scale - interaction.gesture.scale
+    iEvent.da = iEvent.angle - interaction.gesture.angle
+  }
+
+  interaction.gesture.distance = iEvent.distance
+  interaction.gesture.angle = iEvent.angle
+
+  if (utils.is.number(iEvent.scale) &&
+      iEvent.scale !== Infinity &&
+      !isNaN(iEvent.scale)) {
+    interaction.gesture.scale = iEvent.scale
+  }
+}
+
+const gesture: Interact.Plugin = {
+  id: 'actions/gesture',
+  before: ['actions/drag', 'actions/resize'],
+  install,
+  listeners: {
+    'interactions:action-start': updateGestureProps,
+    'interactions:action-move': updateGestureProps,
+    'interactions:action-end': updateGestureProps,
+
+    'interactions:new': ({ interaction }) => {
+      interaction.gesture = {
+        angle: 0,
+        distance: 0,
+        scale: 1,
+        startAngle: 0,
+        startDistance: 0,
+      }
+    },
+
+    'auto-start:check': arg => {
+      if (arg.interaction.pointers.length < 2) {
+        return undefined
+      }
+
+      const gestureOptions = arg.interactable.options.gesture
+
+      if (!(gestureOptions && gestureOptions.enabled)) {
+        return undefined
+      }
+
+      arg.action = { name: 'gesture' }
+
+      return false
+    },
+  },
+
+  defaults: {
+  },
+
+  getCursor () {
+    return ''
+  },
+}
+
+export default gesture
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_actions_resize.ts.html b/interactjs/dist/api/@interactjs_actions_resize.ts.html new file mode 100644 index 000000000..b6a6a5c30 --- /dev/null +++ b/interactjs/dist/api/@interactjs_actions_resize.ts.html @@ -0,0 +1,522 @@ + + + + + + @interactjs/actions/resize.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/actions/resize.ts

+ + + + + + + +
+
+
import { Interaction } from '@interactjs/core/Interaction'
+import { Scope } from '@interactjs/core/scope'
+import * as dom from '@interactjs/utils/domUtils'
+import extend from '@interactjs/utils/extend'
+import * as is from '@interactjs/utils/is'
+
+export type EdgeName = 'top' | 'left' | 'bottom' | 'right'
+
+export type ResizableMethod = Interact.ActionMethod<Interact.ResizableOptions>
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    resizable: ResizableMethod
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    resizeAxes: 'x' | 'y' | 'xy'
+    resizeStartAspectRatio: number
+  }
+}
+
+declare module '@interactjs/core/defaultOptions' {
+  interface ActionDefaults {
+    resize: Interact.ResizableOptions
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface ActionMap {
+    resize?: typeof resize
+  }
+}
+
+export interface ResizeEvent<P extends Interact.EventPhase = Interact.EventPhase> extends Interact.InteractEvent<'resize', P> {
+  deltaRect?: Interact.FullRect
+  edges?: Interact.ActionProps['edges']
+}
+
+function install (scope: Scope) {
+  const {
+    actions,
+    browser,
+    /** @lends Interactable */
+    Interactable, // tslint:disable-line no-shadowed-variable
+    defaults,
+  } = scope
+
+  // Less Precision with touch input
+
+  resize.cursors = initCursors(browser)
+  resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10
+
+  /**
+   * ```js
+   * interact(element).resizable({
+   *   onstart: function (event) {},
+   *   onmove : function (event) {},
+   *   onend  : function (event) {},
+   *
+   *   edges: {
+   *     top   : true,       // Use pointer coords to check for resize.
+   *     left  : false,      // Disable resizing from left edge.
+   *     bottom: '.resize-s',// Resize if pointer target matches selector
+   *     right : handleEl    // Resize if pointer target is the given Element
+   *   },
+   *
+   *     // Width and height can be adjusted independently. When `true`, width and
+   *     // height are adjusted at a 1:1 ratio.
+   *     square: false,
+   *
+   *     // Width and height can be adjusted independently. When `true`, width and
+   *     // height maintain the aspect ratio they had when resizing started.
+   *     preserveAspectRatio: false,
+   *
+   *   // a value of 'none' will limit the resize rect to a minimum of 0x0
+   *   // 'negate' will allow the rect to have negative width/height
+   *   // 'reposition' will keep the width/height positive by swapping
+   *   // the top and bottom edges and/or swapping the left and right edges
+   *   invert: 'none' || 'negate' || 'reposition'
+   *
+   *   // limit multiple resizes.
+   *   // See the explanation in the {@link Interactable.draggable} example
+   *   max: Infinity,
+   *   maxPerElement: 1,
+   * })
+   *
+   * var isResizeable = interact(element).resizable()
+   * ```
+   *
+   * Gets or sets whether resize actions can be performed on the target
+   *
+   * @param {boolean | object} [options] true/false or An object with event
+   * listeners to be fired on resize events (object makes the Interactable
+   * resizable)
+   * @return {boolean | Interactable} A boolean indicating if this can be the
+   * target of resize elements, or this Interactable
+   */
+  Interactable.prototype.resizable = function (this: Interact.Interactable, options: Interact.ResizableOptions | boolean) {
+    return resizable(this, options, scope)
+  } as ResizableMethod
+
+  actions.map.resize = resize
+  actions.methodDict.resize = 'resizable'
+
+  defaults.actions.resize = resize.defaults
+}
+
+function resizeChecker (arg) {
+  const { interaction, interactable, element, rect, buttons } = arg
+
+  if (!rect) { return undefined }
+
+  const page = extend({}, interaction.coords.cur.page)
+  const resizeOptions = interactable.options.resize
+
+  if (
+    !(resizeOptions && resizeOptions.enabled) ||
+    // check mouseButton setting if the pointer is down
+    (interaction.pointerIsDown &&
+     /mouse|pointer/.test(interaction.pointerType) &&
+   (buttons & resizeOptions.mouseButtons) === 0)
+  ) {
+    return undefined
+  }
+
+  // if using resize.edges
+  if (is.object(resizeOptions.edges)) {
+    const resizeEdges = {
+      left: false,
+      right: false,
+      top: false,
+      bottom: false,
+    }
+
+    for (const edge in resizeEdges) {
+      resizeEdges[edge] = checkResizeEdge(edge,
+        resizeOptions.edges[edge],
+        page,
+        interaction._latestPointer.eventTarget,
+        element,
+        rect,
+        resizeOptions.margin || resize.defaultMargin)
+    }
+
+    resizeEdges.left = resizeEdges.left && !resizeEdges.right
+    resizeEdges.top  = resizeEdges.top  && !resizeEdges.bottom
+
+    if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {
+      arg.action = {
+        name: 'resize',
+        edges: resizeEdges,
+      }
+    }
+  }
+  else {
+    const right  = resizeOptions.axis !== 'y' && page.x > (rect.right  - resize.defaultMargin)
+    const bottom = resizeOptions.axis !== 'x' && page.y > (rect.bottom - resize.defaultMargin)
+
+    if (right || bottom) {
+      arg.action = {
+        name: 'resize',
+        axes: (right ? 'x' : '') + (bottom ? 'y' : ''),
+      }
+    }
+  }
+
+  return arg.action ? false : undefined
+}
+
+function resizable (interactable: Interact.Interactable, options: Interact.OrBoolean<Interact.ResizableOptions> | boolean, scope: Scope) {
+  if (is.object(options)) {
+    interactable.options.resize.enabled = options.enabled !== false
+    interactable.setPerAction('resize', options)
+    interactable.setOnEvents('resize', options)
+
+    if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {
+      interactable.options.resize.axis = options.axis
+    }
+    else if (options.axis === null) {
+      interactable.options.resize.axis = scope.defaults.actions.resize.axis
+    }
+
+    if (is.bool(options.preserveAspectRatio)) {
+      interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio
+    }
+    else if (is.bool(options.square)) {
+      interactable.options.resize.square = options.square
+    }
+
+    return interactable
+  }
+  if (is.bool(options)) {
+    interactable.options.resize.enabled = options
+
+    return interactable
+  }
+  return interactable.options.resize
+}
+
+function checkResizeEdge (
+  name: string,
+  value: any,
+  page: Interact.Point,
+  element: Node,
+  interactableElement: Interact.Element,
+  rect: Interact.Rect,
+  margin: number,
+) {
+  // false, '', undefined, null
+  if (!value) { return false }
+
+  // true value, use pointer coords and element rect
+  if (value === true) {
+    // if dimensions are negative, "switch" edges
+    const width  = is.number(rect.width) ? rect.width  : rect.right  - rect.left
+    const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top
+
+    // don't use margin greater than half the relevent dimension
+    margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2)
+
+    if (width < 0) {
+      if      (name === 'left')  { name = 'right' }
+      else if (name === 'right') { name = 'left'  }
+    }
+    if (height < 0) {
+      if      (name === 'top')    { name = 'bottom' }
+      else if (name === 'bottom') { name = 'top'    }
+    }
+
+    if (name === 'left') { return page.x < ((width  >= 0 ? rect.left : rect.right) + margin) }
+    if (name === 'top') { return page.y < ((height >= 0 ? rect.top : rect.bottom) + margin) }
+
+    if (name === 'right') { return page.x > ((width  >= 0 ? rect.right : rect.left) - margin) }
+    if (name === 'bottom') { return page.y > ((height >= 0 ? rect.bottom : rect.top) - margin) }
+  }
+
+  // the remaining checks require an element
+  if (!is.element(element)) { return false }
+
+  return is.element(value)
+  // the value is an element to use as a resize handle
+    ? value === element
+    // otherwise check if element matches value as selector
+    : dom.matchesUpTo(element, value, interactableElement)
+}
+
+function initCursors (browser: typeof import ('@interactjs/utils/browser').default) {
+  return (browser.isIe9 ? {
+    x : 'e-resize',
+    y : 's-resize',
+    xy: 'se-resize',
+
+    top        : 'n-resize',
+    left       : 'w-resize',
+    bottom     : 's-resize',
+    right      : 'e-resize',
+    topleft    : 'se-resize',
+    bottomright: 'se-resize',
+    topright   : 'ne-resize',
+    bottomleft : 'ne-resize',
+  } : {
+    x : 'ew-resize',
+    y : 'ns-resize',
+    xy: 'nwse-resize',
+
+    top        : 'ns-resize',
+    left       : 'ew-resize',
+    bottom     : 'ns-resize',
+    right      : 'ew-resize',
+    topleft    : 'nwse-resize',
+    bottomright: 'nwse-resize',
+    topright   : 'nesw-resize',
+    bottomleft : 'nesw-resize',
+  })
+}
+
+function start ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
+  if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {
+    return
+  }
+
+  const resizeEvent = iEvent as ResizeEvent
+  const rect = interaction.rect
+
+  interaction._rects = {
+    start: extend({}, rect),
+    corrected: extend({}, rect),
+    previous: extend({}, rect),
+    delta: {
+      left: 0,
+      right : 0,
+      width : 0,
+      top : 0,
+      bottom: 0,
+      height: 0,
+    },
+  }
+
+  resizeEvent.edges = interaction.prepared.edges
+  resizeEvent.rect = interaction._rects.corrected
+  resizeEvent.deltaRect = interaction._rects.delta
+}
+
+function move ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
+  if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }
+
+  const resizeEvent = iEvent as ResizeEvent
+  const resizeOptions = interaction.interactable.options.resize
+  const invert = resizeOptions.invert
+  const invertible = invert === 'reposition' || invert === 'negate'
+
+  // eslint-disable-next-line no-shadow
+  const current = interaction.rect
+  const { start: startRect, corrected, delta: deltaRect, previous } = interaction._rects
+
+  extend(previous, corrected)
+
+  if (invertible) {
+    // if invertible, copy the current rect
+    extend(corrected, current)
+
+    if (invert === 'reposition') {
+      // swap edge values if necessary to keep width/height positive
+      if (corrected.top > corrected.bottom) {
+        const swap = corrected.top
+
+        corrected.top = corrected.bottom
+        corrected.bottom = swap
+      }
+      if (corrected.left > corrected.right) {
+        const swap = corrected.left
+
+        corrected.left = corrected.right
+        corrected.right = swap
+      }
+    }
+  }
+  else {
+    // if not invertible, restrict to minimum of 0x0 rect
+    corrected.top    = Math.min(current.top, startRect.bottom)
+    corrected.bottom = Math.max(current.bottom, startRect.top)
+    corrected.left   = Math.min(current.left, startRect.right)
+    corrected.right  = Math.max(current.right, startRect.left)
+  }
+
+  corrected.width  = corrected.right  - corrected.left
+  corrected.height = corrected.bottom - corrected.top
+
+  for (const edge in corrected) {
+    deltaRect[edge] = corrected[edge] - previous[edge]
+  }
+
+  resizeEvent.edges = interaction.prepared.edges
+  resizeEvent.rect = corrected
+  resizeEvent.deltaRect = deltaRect
+}
+
+function end ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
+  if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }
+
+  const resizeEvent = iEvent as ResizeEvent
+
+  resizeEvent.edges = interaction.prepared.edges
+  resizeEvent.rect = interaction._rects.corrected
+  resizeEvent.deltaRect = interaction._rects.delta
+}
+
+function updateEventAxes ({ iEvent, interaction }: { iEvent: Interact.InteractEvent<any, any>, interaction: Interaction }) {
+  if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { return }
+
+  const options = interaction.interactable.options
+  const resizeEvent = iEvent as ResizeEvent
+
+  if (options.resize.square) {
+    if (interaction.resizeAxes === 'y') {
+      resizeEvent.delta.x = resizeEvent.delta.y
+    }
+    else {
+      resizeEvent.delta.y = resizeEvent.delta.x
+    }
+    resizeEvent.axes = 'xy'
+  }
+  else {
+    resizeEvent.axes = interaction.resizeAxes
+
+    if (interaction.resizeAxes === 'x') {
+      resizeEvent.delta.y = 0
+    }
+    else if (interaction.resizeAxes === 'y') {
+      resizeEvent.delta.x = 0
+    }
+  }
+}
+
+const resize: Interact.Plugin = {
+  id: 'actions/resize',
+  before: ['actions/drag'],
+  install,
+  listeners: {
+    'interactions:new': ({ interaction }) => {
+      interaction.resizeAxes = 'xy'
+    },
+
+    'interactions:action-start': arg => {
+      start(arg)
+      updateEventAxes(arg)
+    },
+    'interactions:action-move': arg => {
+      move(arg)
+      updateEventAxes(arg)
+    },
+    'interactions:action-end': end,
+    'auto-start:check': resizeChecker,
+  },
+
+  defaults: {
+    square: false,
+    preserveAspectRatio: false,
+    axis: 'xy',
+
+    // use default margin
+    margin: NaN,
+
+    // object with props left, right, top, bottom which are
+    // true/false values to resize when the pointer is over that edge,
+    // CSS selectors to match the handles for each direction
+    // or the Elements for each handle
+    edges: null,
+
+    // a value of 'none' will limit the resize rect to a minimum of 0x0
+    // 'negate' will alow the rect to have negative width/height
+    // 'reposition' will keep the width/height positive by swapping
+    // the top and bottom edges and/or swapping the left and right edges
+    invert: 'none',
+  } as Interact.ResizableOptions,
+
+  cursors: null as ReturnType<typeof initCursors>,
+
+  getCursor ({ edges, axis, name }: Interact.ActionProps) {
+    const cursors = resize.cursors
+    let result: string = null
+
+    if (axis) {
+      result = cursors[name + axis]
+    }
+    else if (edges) {
+      let cursorKey = ''
+
+      for (const edge of ['top', 'bottom', 'left', 'right']) {
+        if (edges[edge]) {
+          cursorKey += edge
+        }
+      }
+
+      result = cursors[cursorKey]
+    }
+
+    return result
+  },
+
+  defaultMargin: null as number,
+}
+
+export default resize
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_auto-start_InteractableMethods.ts.html b/interactjs/dist/api/@interactjs_auto-start_InteractableMethods.ts.html new file mode 100644 index 000000000..dc6888aa3 --- /dev/null +++ b/interactjs/dist/api/@interactjs_auto-start_InteractableMethods.ts.html @@ -0,0 +1,275 @@ + + + + + + @interactjs/auto-start/InteractableMethods.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/auto-start/InteractableMethods.ts

+ + + + + + + +
+
+
import { warnOnce } from '@interactjs/utils/index'
+import * as is from '@interactjs/utils/is'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    getAction: (
+      this: Interact.Interactable,
+      pointer: Interact.PointerType,
+      event: Interact.PointerEventType,
+      interaction: Interact.Interaction,
+      element: Interact.Element,
+    ) => Interact.ActionProps | null
+    styleCursor: typeof styleCursor
+    actionChecker: typeof actionChecker
+    ignoreFrom: {
+      (...args: any[]): Interactable
+      (): boolean
+    }
+    allowFrom: {
+      (...args: any[]): Interactable
+      (): boolean
+    }
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    pointerIsDown: boolean
+  }
+}
+
+function install (scope: Interact.Scope) {
+  const {
+    /** @lends Interactable */
+    Interactable, // tslint:disable-line no-shadowed-variable
+  } = scope
+
+  Interactable.prototype.getAction = function getAction (
+    this: Interact.Interactable,
+    pointer: Interact.PointerType,
+    event: Interact.PointerEventType,
+    interaction: Interact.Interaction,
+    element: Interact.Element,
+  ): Interact.ActionProps {
+    const action = defaultActionChecker(this, event, interaction, element, scope)
+
+    if (this.options.actionChecker) {
+      return this.options.actionChecker(pointer, event, action, this, element, interaction)
+    }
+
+    return action
+  }
+
+  /**
+   * ```js
+   * interact(element, { ignoreFrom: document.getElementById('no-action') })
+   * // or
+   * interact(element).ignoreFrom('input, textarea, a')
+   * ```
+   * @deprecated
+   * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any
+   * of it's parents match the given CSS selector or Element, no
+   * drag/resize/gesture is started.
+   *
+   * Don't use this method. Instead set the `ignoreFrom` option for each action
+   * or for `pointerEvents`
+   *
+   * @example
+   * interact(targett)
+   *   .draggable({
+   *     ignoreFrom: 'input, textarea, a[href]'',
+   *   })
+   *   .pointerEvents({
+   *     ignoreFrom: '[no-pointer]',
+   *   })
+   *
+   * @param {string | Element | null} [newValue] a CSS selector string, an
+   * Element or `null` to not ignore any elements
+   * @return {string | Element | object} The current ignoreFrom value or this
+   * Interactable
+   */
+  Interactable.prototype.ignoreFrom = warnOnce(function (this: Interact.Interactable, newValue) {
+    return this._backCompatOption('ignoreFrom', newValue)
+  }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')
+
+  /**
+   * @deprecated
+   *
+   * A drag/resize/gesture is started only If the target of the `mousedown`,
+   * `pointerdown` or `touchstart` event or any of it's parents match the given
+   * CSS selector or Element.
+   *
+   * Don't use this method. Instead set the `allowFrom` option for each action
+   * or for `pointerEvents`
+   *
+   * @example
+   * interact(targett)
+   *   .resizable({
+   *     allowFrom: '.resize-handle',
+   *   .pointerEvents({
+   *     allowFrom: '.handle',,
+   *   })
+   *
+   * @param {string | Element | null} [newValue] a CSS selector string, an
+   * Element or `null` to allow from any element
+   * @return {string | Element | object} The current allowFrom value or this
+   * Interactable
+   */
+  Interactable.prototype.allowFrom = warnOnce(function (this: Interact.Interactable, newValue) {
+    return this._backCompatOption('allowFrom', newValue)
+  }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).')
+
+  /**
+   * ```js
+   * interact('.resize-drag')
+   *   .resizable(true)
+   *   .draggable(true)
+   *   .actionChecker(function (pointer, event, action, interactable, element, interaction) {
+   *
+   *   if (interact.matchesSelector(event.target, '.drag-handle')) {
+   *     // force drag with handle target
+   *     action.name = drag
+   *   }
+   *   else {
+   *     // resize from the top and right edges
+   *     action.name  = 'resize'
+   *     action.edges = { top: true, right: true }
+   *   }
+   *
+   *   return action
+   * })
+   * ```
+   *
+   * Returns or sets the function used to check action to be performed on
+   * pointerDown
+   *
+   * @param {function | null} [checker] A function which takes a pointer event,
+   * defaultAction string, interactable, element and interaction as parameters
+   * and returns an object with name property 'drag' 'resize' or 'gesture' and
+   * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right
+   * props.
+   * @return {Function | Interactable} The checker function or this Interactable
+   */
+  Interactable.prototype.actionChecker = actionChecker
+
+  /**
+   * Returns or sets whether the the cursor should be changed depending on the
+   * action that would be performed if the mouse were pressed and dragged.
+   *
+   * @param {boolean} [newValue]
+   * @return {boolean | Interactable} The current setting or this Interactable
+   */
+  Interactable.prototype.styleCursor = styleCursor
+}
+
+function defaultActionChecker (
+  interactable: Interact.Interactable,
+  event: Interact.PointerEventType,
+  interaction: Interact.Interaction,
+  element: Interact.Element,
+  scope: Interact.Scope,
+) {
+  const rect = interactable.getRect(element)
+  const buttons = (event as MouseEvent).buttons || ({
+    0: 1,
+    1: 4,
+    3: 8,
+    4: 16,
+  })[(event as MouseEvent).button as 0 | 1 | 3 | 4]
+  const arg = {
+    action: null,
+    interactable,
+    interaction,
+    element,
+    rect,
+    buttons,
+  }
+
+  scope.fire('auto-start:check', arg)
+
+  return arg.action
+}
+
+function styleCursor (this: Interact.Interactable, newValue?: boolean) {
+  if (is.bool(newValue)) {
+    this.options.styleCursor = newValue
+
+    return this
+  }
+
+  if (newValue === null) {
+    delete this.options.styleCursor
+
+    return this
+  }
+
+  return this.options.styleCursor
+}
+
+function actionChecker (this: Interact.Interactable, checker: any) {
+  if (is.func(checker)) {
+    this.options.actionChecker = checker
+
+    return this
+  }
+
+  if (checker === null) {
+    delete this.options.actionChecker
+
+    return this
+  }
+
+  return this.options.actionChecker
+}
+
+export default {
+  id: 'auto-start/interactableMethods',
+  install,
+}
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_auto-start_base.ts.html b/interactjs/dist/api/@interactjs_auto-start_base.ts.html new file mode 100644 index 000000000..4e7fc9203 --- /dev/null +++ b/interactjs/dist/api/@interactjs_auto-start_base.ts.html @@ -0,0 +1,439 @@ + + + + + + @interactjs/auto-start/base.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/auto-start/base.ts

+ + + + + + + +
+
+
import * as utils from '@interactjs/utils/index'
+import InteractableMethods from './InteractableMethods'
+
+declare module '@interactjs/interact/interact' {
+  interface InteractStatic {
+    maxInteractions: (newValue: any) => any
+  }
+}
+
+declare module '@interactjs/core/scope' {
+  interface Scope {
+    autoStart: AutoStart
+    maxInteractions: (...args: any[]) => any
+  }
+
+  interface SignalArgs {
+    'autoStart:before-start': Interact.SignalArgs['interactions:move']
+    'autoStart:prepared': { interaction: Interact.Interaction }
+    'auto-start:check': CheckSignalArg
+  }
+}
+
+declare module '@interactjs/core/defaultOptions' {
+  interface BaseDefaults {
+    actionChecker?: any
+    cursorChecker?: any
+    styleCursor?: any
+  }
+
+  interface PerActionDefaults {
+    manualStart?: boolean
+    max?: number
+    maxPerElement?: number
+    allowFrom?: string | Interact.Element
+    ignoreFrom?: string | Interact.Element
+    cursorChecker?: Interact.CursorChecker
+
+    // only allow left button by default
+    // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value
+    mouseButtons?: 0 | 1 | 2 | 4 | 16
+  }
+}
+
+interface CheckSignalArg {
+  interactable: Interact.Interactable
+  interaction: Interact.Interaction
+  element: Interact.Element
+  action: Interact.ActionProps
+  buttons: number
+}
+
+export interface AutoStart {
+  // Allow this many interactions to happen simultaneously
+  maxInteractions: number
+  withinInteractionLimit: typeof withinInteractionLimit
+  cursorElement: Interact.Element
+}
+
+function install (scope: Interact.Scope) {
+  const {
+    interact,
+    defaults,
+  } = scope
+
+  scope.usePlugin(InteractableMethods)
+
+  defaults.base.actionChecker = null
+  defaults.base.styleCursor = true
+
+  utils.extend(defaults.perAction, {
+    manualStart: false,
+    max: Infinity,
+    maxPerElement: 1,
+    allowFrom:  null,
+    ignoreFrom: null,
+
+    // only allow left button by default
+    // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value
+    mouseButtons: 1,
+  })
+
+  /**
+   * Returns or sets the maximum number of concurrent interactions allowed.  By
+   * default only 1 interaction is allowed at a time (for backwards
+   * compatibility). To allow multiple interactions on the same Interactables and
+   * elements, you need to enable it in the draggable, resizable and gesturable
+   * `'max'` and `'maxPerElement'` options.
+   *
+   * @alias module:interact.maxInteractions
+   *
+   * @param {number} [newValue] Any number. newValue <= 0 means no interactions.
+   */
+  interact.maxInteractions = newValue => maxInteractions(newValue, scope)
+
+  scope.autoStart = {
+    // Allow this many interactions to happen simultaneously
+    maxInteractions: Infinity,
+    withinInteractionLimit,
+    cursorElement: null,
+  }
+}
+
+function prepareOnDown ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {
+  if (interaction.interacting()) { return }
+
+  const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)
+  prepare(interaction, actionInfo, scope)
+}
+
+function prepareOnMove ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {
+  if (interaction.pointerType !== 'mouse' ||
+      interaction.pointerIsDown ||
+      interaction.interacting()) { return }
+
+  const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Interact.Element, scope)
+  prepare(interaction, actionInfo, scope)
+}
+
+function startOnMove (arg: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {
+  const { interaction } = arg
+
+  if (!interaction.pointerIsDown ||
+      interaction.interacting() ||
+      !interaction.pointerWasMoved ||
+      !interaction.prepared.name) {
+    return
+  }
+
+  scope.fire('autoStart:before-start', arg)
+
+  const { interactable } = interaction
+  const actionName: Interact.ActionName = interaction.prepared.name
+
+  if (actionName && interactable) {
+    // check manualStart and interaction limit
+    if (interactable.options[actionName].manualStart ||
+        !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) {
+      interaction.stop()
+    }
+    else {
+      interaction.start(interaction.prepared, interactable, interaction.element)
+      setInteractionCursor(interaction, scope)
+    }
+  }
+}
+
+function clearCursorOnStop ({ interaction }: { interaction: Interact.Interaction }, scope: Interact.Scope) {
+  const { interactable } = interaction
+
+  if (interactable && interactable.options.styleCursor) {
+    setCursor(interaction.element, '', scope)
+  }
+}
+
+// Check if the current interactable supports the action.
+// If so, return the validated action. Otherwise, return null
+function validateAction<T extends Interact.ActionName> (
+  action: Interact.ActionProps<T>,
+  interactable: Interact.Interactable,
+  element: Interact.Element,
+  eventTarget: Interact.EventTarget,
+  scope: Interact.Scope,
+) {
+  if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&
+      interactable.options[action.name].enabled &&
+      withinInteractionLimit(interactable, element, action, scope)) {
+    return action
+  }
+
+  return null
+}
+
+function validateMatches (
+  interaction: Interact.Interaction,
+  pointer: Interact.PointerType,
+  event: Interact.PointerEventType,
+  matches: Interact.Interactable[],
+  matchElements: Interact.Element[],
+  eventTarget: Interact.EventTarget,
+  scope: Interact.Scope,
+) {
+  for (let i = 0, len = matches.length; i < len; i++) {
+    const match = matches[i]
+    const matchElement = matchElements[i]
+    const matchAction = match.getAction(pointer, event, interaction, matchElement)
+
+    if (!matchAction) { continue }
+
+    const action = validateAction(
+      matchAction,
+      match,
+      matchElement,
+      eventTarget,
+      scope)
+
+    if (action) {
+      return {
+        action,
+        interactable: match,
+        element: matchElement,
+      }
+    }
+  }
+
+  return { action: null, interactable: null, element: null }
+}
+
+function getActionInfo (
+  interaction: Interact.Interaction,
+  pointer: Interact.PointerType,
+  event: Interact.PointerEventType,
+  eventTarget: Interact.EventTarget,
+  scope: Interact.Scope,
+) {
+  let matches: Interact.Interactable[] = []
+  let matchElements: Interact.Element[] = []
+
+  let element = eventTarget as Interact.Element
+
+  function pushMatches (interactable: Interact.Interactable) {
+    matches.push(interactable)
+    matchElements.push(element)
+  }
+
+  while (utils.is.element(element)) {
+    matches = []
+    matchElements = []
+
+    scope.interactables.forEachMatch(element, pushMatches)
+
+    const actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope)
+
+    if (actionInfo.action &&
+      !actionInfo.interactable.options[actionInfo.action.name].manualStart) {
+      return actionInfo
+    }
+
+    element = utils.dom.parentNode(element) as Interact.Element
+  }
+
+  return { action: null, interactable: null, element: null }
+}
+
+function prepare (
+  interaction: Interact.Interaction,
+  { action, interactable, element }: {
+    action: Interact.ActionProps
+    interactable: Interact.Interactable
+    element: Interact.Element
+  },
+  scope: Interact.Scope,
+) {
+  action = action || { name: null }
+
+  interaction.interactable = interactable
+  interaction.element = element
+  utils.copyAction(interaction.prepared, action)
+
+  interaction.rect = interactable && action.name
+    ? interactable.getRect(element)
+    : null
+
+  setInteractionCursor(interaction, scope)
+
+  scope.fire('autoStart:prepared', { interaction })
+}
+
+function withinInteractionLimit<T extends Interact.ActionName> (
+  interactable: Interact.Interactable,
+  element: Interact.Element,
+  action: Interact.ActionProps<T>,
+  scope: Interact.Scope,
+) {
+  const options = interactable.options
+  const maxActions = options[action.name].max
+  const maxPerElement = options[action.name].maxPerElement
+  const autoStartMax = scope.autoStart.maxInteractions
+  let activeInteractions = 0
+  let interactableCount = 0
+  let elementCount = 0
+
+  // no actions if any of these values == 0
+  if (!(maxActions && maxPerElement && autoStartMax)) { return false }
+
+  for (const interaction of scope.interactions.list) {
+    const otherAction = interaction.prepared.name
+
+    if (!interaction.interacting()) { continue }
+
+    activeInteractions++
+
+    if (activeInteractions >= autoStartMax) {
+      return false
+    }
+
+    if (interaction.interactable !== interactable) { continue }
+
+    interactableCount += otherAction === action.name ? 1 : 0
+
+    if (interactableCount >= maxActions) {
+      return false
+    }
+
+    if (interaction.element === element) {
+      elementCount++
+
+      if (otherAction === action.name && elementCount >= maxPerElement) {
+        return false
+      }
+    }
+  }
+
+  return autoStartMax > 0
+}
+
+function maxInteractions (newValue: any, scope: Interact.Scope) {
+  if (utils.is.number(newValue)) {
+    scope.autoStart.maxInteractions = newValue
+
+    return this
+  }
+
+  return scope.autoStart.maxInteractions
+}
+
+function setCursor (element: Interact.Element, cursor: string, scope: Interact.Scope) {
+  const { cursorElement: prevCursorElement } = scope.autoStart
+
+  if (prevCursorElement && prevCursorElement !== element) {
+    prevCursorElement.style.cursor = ''
+  }
+
+  element.ownerDocument.documentElement.style.cursor = cursor
+  element.style.cursor = cursor
+  scope.autoStart.cursorElement = cursor ? element : null
+}
+
+function setInteractionCursor<T extends Interact.ActionName> (interaction: Interact.Interaction<T>, scope: Interact.Scope) {
+  const { interactable, element, prepared } = interaction
+
+  if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {
+    // clear previous target element cursor
+    if (scope.autoStart.cursorElement) {
+      setCursor(scope.autoStart.cursorElement, '', scope)
+    }
+
+    return
+  }
+
+  let cursor = ''
+
+  if (prepared.name) {
+    const cursorChecker: Interact.CursorChecker = interactable.options[prepared.name].cursorChecker
+
+    if (utils.is.func(cursorChecker)) {
+      cursor = cursorChecker(prepared, interactable, element, interaction._interacting)
+    }
+    else {
+      cursor = scope.actions.map[prepared.name].getCursor(prepared)
+    }
+  }
+
+  setCursor(interaction.element, cursor || '', scope)
+}
+
+const autoStart: Interact.Plugin = {
+  id: 'auto-start/base',
+  before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],
+  install,
+  listeners: {
+    'interactions:down': prepareOnDown,
+    'interactions:move': (arg, scope) => {
+      prepareOnMove(arg, scope)
+      startOnMove(arg, scope)
+    },
+    'interactions:stop': clearCursorOnStop,
+  },
+  maxInteractions,
+  withinInteractionLimit,
+  validateAction,
+} as Interact.Plugin
+
+export default autoStart
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_core_BaseEvent.ts.html b/interactjs/dist/api/@interactjs_core_BaseEvent.ts.html new file mode 100644 index 000000000..e2ef59e52 --- /dev/null +++ b/interactjs/dist/api/@interactjs_core_BaseEvent.ts.html @@ -0,0 +1,94 @@ + + + + + + @interactjs/core/BaseEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/core/BaseEvent.ts

+ + + + + + + +
+
+
import Interactable from './Interactable'
+
+export class BaseEvent<T extends Interact.ActionName = any> {
+  type: string
+  target: EventTarget
+  currentTarget: EventTarget
+  interactable: Interactable
+  _interaction: Interact.Interaction<T>
+  timeStamp: any
+  immediatePropagationStopped = false
+  propagationStopped = false
+
+  get interaction () {
+    return this._interaction._proxy
+  }
+
+  constructor (interaction: Interact.Interaction) {
+    this._interaction = interaction
+  }
+
+  preventDefault () {}
+
+  /**
+   * Don't call any other listeners (even on the current target)
+   */
+  stopPropagation () {
+    this.propagationStopped = true
+  }
+
+  /**
+   * Don't call listeners on the remaining targets
+   */
+  stopImmediatePropagation () {
+    this.immediatePropagationStopped = this.propagationStopped = true
+  }
+}
+
+export default BaseEvent
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_core_InteractEvent.ts.html b/interactjs/dist/api/@interactjs_core_InteractEvent.ts.html new file mode 100644 index 000000000..064c98340 --- /dev/null +++ b/interactjs/dist/api/@interactjs_core_InteractEvent.ts.html @@ -0,0 +1,261 @@ + + + + + + @interactjs/core/InteractEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/core/InteractEvent.ts

+ + + + + + + +
+
+
import extend from '@interactjs/utils/extend'
+import getOriginXY from '@interactjs/utils/getOriginXY'
+import hypot from '@interactjs/utils/hypot'
+import BaseEvent from './BaseEvent'
+import defaults from './defaultOptions'
+import Interaction from './Interaction'
+
+export type EventPhase = keyof PhaseMap
+
+export interface PhaseMap {
+  start: true
+  move: true
+  end: true
+}
+
+export class InteractEvent<
+  T extends Interact.ActionName = never,
+  P extends EventPhase = EventPhase,
+> extends BaseEvent<T> {
+  target: Interact.Element
+  currentTarget: Interact.Element
+  relatedTarget: null = null
+  screenX?: number
+  screenY?: number
+  button: number
+  buttons: number
+  ctrlKey: boolean
+  shiftKey: boolean
+  altKey: boolean
+  metaKey: boolean
+  page: Interact.Point
+  client: Interact.Point
+  delta: Interact.Point
+  rect: Interact.FullRect
+  x0: number
+  y0: number
+  t0: number
+  dt: number
+  duration: number
+  clientX0: number
+  clientY0: number
+  velocity: Interact.Point
+  speed: number
+  swipe: ReturnType<InteractEvent<T>['getSwipe']>
+  timeStamp: any
+  // drag
+  dragEnter?: Interact.Element
+  dragLeave?: Interact.Element
+  // resize
+  axes?: 'x' | 'y' | 'xy'
+  preEnd?: boolean
+
+  /** */
+  constructor (
+    interaction: Interaction,
+    event: Interact.PointerEventType,
+    actionName: T,
+    phase: P,
+    element: Interact.Element,
+    preEnd?: boolean,
+    type?: string,
+  ) {
+    super(interaction)
+
+    element = element || interaction.element
+
+    const target      = interaction.interactable
+    const deltaSource = (((target && target.options) || defaults) as any).deltaSource as 'page' | 'client'
+    const origin      = getOriginXY(target, element, actionName)
+    const starting    = phase === 'start'
+    const ending      = phase === 'end'
+    const prevEvent   = starting ? this : interaction.prevEvent
+    const coords      = starting
+      ? interaction.coords.start
+      : ending
+        ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp }
+        : interaction.coords.cur
+
+    this.page      = extend({}, coords.page)
+    this.client    = extend({}, coords.client)
+    this.rect      = extend({}, interaction.rect)
+    this.timeStamp = coords.timeStamp
+
+    if (!ending) {
+      this.page.x -= origin.x
+      this.page.y -= origin.y
+
+      this.client.x -= origin.x
+      this.client.y -= origin.y
+    }
+
+    this.ctrlKey       = event.ctrlKey
+    this.altKey        = event.altKey
+    this.shiftKey      = event.shiftKey
+    this.metaKey       = event.metaKey
+    this.button        = (event as MouseEvent).button
+    this.buttons       = (event as MouseEvent).buttons
+    this.target        = element
+    this.currentTarget = element
+    this.preEnd        = preEnd
+    this.type          = type || (actionName + (phase || ''))
+    this.interactable  = target
+
+    this.t0 = starting
+      ? interaction.pointers[interaction.pointers.length - 1].downTime
+      : prevEvent.t0
+
+    this.x0       = interaction.coords.start.page.x - origin.x
+    this.y0       = interaction.coords.start.page.y - origin.y
+    this.clientX0 = interaction.coords.start.client.x - origin.x
+    this.clientY0 = interaction.coords.start.client.y - origin.y
+
+    if (starting || ending) {
+      this.delta = { x: 0, y: 0 }
+    }
+    else {
+      this.delta = {
+        x: this[deltaSource].x - prevEvent[deltaSource].x,
+        y: this[deltaSource].y - prevEvent[deltaSource].y,
+      }
+    }
+
+    this.dt        = interaction.coords.delta.timeStamp
+    this.duration  = this.timeStamp - this.t0
+
+    // velocity and speed in pixels per second
+    this.velocity = extend({}, interaction.coords.velocity[deltaSource])
+    this.speed = hypot(this.velocity.x, this.velocity.y)
+
+    this.swipe = (ending || phase === 'inertiastart') ? this.getSwipe() : null
+  }
+
+  get pageX () { return this.page.x }
+  set pageX (value) { this.page.x = value }
+  get pageY () { return this.page.y }
+  set pageY (value) { this.page.y = value }
+
+  get clientX () { return this.client.x }
+  set clientX (value) { this.client.x = value }
+  get clientY () { return this.client.y }
+  set clientY (value) { this.client.y = value }
+
+  get dx () { return this.delta.x }
+  set dx (value) { this.delta.x = value }
+  get dy () { return this.delta.y }
+  set dy (value) { this.delta.y = value }
+
+  get velocityX () { return this.velocity.x }
+  set velocityX (value) { this.velocity.x = value }
+  get velocityY () { return this.velocity.y }
+  set velocityY (value) { this.velocity.y = value }
+
+  getSwipe () {
+    const interaction = this._interaction
+
+    if (interaction.prevEvent.speed < 600 ||
+        this.timeStamp - interaction.prevEvent.timeStamp > 150) {
+      return null
+    }
+
+    let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI
+    const overlap = 22.5
+
+    if (angle < 0) {
+      angle += 360
+    }
+
+    const left = 135 - overlap <= angle && angle < 225 + overlap
+    const up   = 225 - overlap <= angle && angle < 315 + overlap
+
+    const right = !left && (315 - overlap <= angle || angle <  45 + overlap)
+    const down  = !up   &&   45 - overlap <= angle && angle < 135 + overlap
+
+    return {
+      up,
+      down,
+      left,
+      right,
+      angle,
+      speed: interaction.prevEvent.speed,
+      velocity: {
+        x: interaction.prevEvent.velocityX,
+        y: interaction.prevEvent.velocityY,
+      },
+    }
+  }
+
+  preventDefault () {}
+
+  /**
+   * Don't call listeners on the remaining targets
+   */
+  stopImmediatePropagation () {
+    this.immediatePropagationStopped = this.propagationStopped = true
+  }
+
+  /**
+   * Don't call any other listeners (even on the current target)
+   */
+  stopPropagation () {
+    this.propagationStopped = true
+  }
+}
+
+export default InteractEvent
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_core_Interactable.ts.html b/interactjs/dist/api/@interactjs_core_Interactable.ts.html new file mode 100644 index 000000000..22b45a19f --- /dev/null +++ b/interactjs/dist/api/@interactjs_core_Interactable.ts.html @@ -0,0 +1,451 @@ + + + + + + @interactjs/core/Interactable.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/core/Interactable.ts

+ + + + + + + +
+
+
import * as arr from '@interactjs/utils/arr'
+import browser from '@interactjs/utils/browser'
+import clone from '@interactjs/utils/clone'
+import { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'
+import events from '@interactjs/utils/events'
+import extend from '@interactjs/utils/extend'
+import * as is from '@interactjs/utils/is'
+import normalizeListeners from '@interactjs/utils/normalizeListeners'
+import { getWindow } from '@interactjs/utils/window'
+import { ActionDefaults, Defaults, Options } from './defaultOptions'
+import Eventable from './Eventable'
+import { Actions, isNonNativeEvent } from './scope'
+
+type IgnoreValue = string | Interact.Element | boolean
+
+/** */
+export class Interactable implements Partial<Eventable> {
+  protected get _defaults (): Defaults {
+    return {
+      base: {},
+      perAction: {},
+      actions: {} as ActionDefaults,
+    }
+  }
+
+  readonly options!: Required<Options>
+  readonly _actions: Actions
+  readonly target: Interact.Target
+  readonly events = new Eventable()
+  readonly _context: Document | Interact.Element
+  readonly _win: Window
+  readonly _doc: Document
+
+  /** */
+  constructor (target: Interact.Target, options: any, defaultContext: Document | Interact.Element) {
+    this._actions = options.actions
+    this.target   = target
+    this._context = options.context || defaultContext
+    this._win     = getWindow(trySelector(target) ? this._context : target)
+    this._doc     = this._win.document
+
+    this.set(options)
+  }
+
+  setOnEvents (actionName: Interact.ActionName, phases: NonNullable<any>) {
+    if (is.func(phases.onstart)) { this.on(`${actionName}start`, phases.onstart) }
+    if (is.func(phases.onmove)) { this.on(`${actionName}move`, phases.onmove) }
+    if (is.func(phases.onend)) { this.on(`${actionName}end`, phases.onend) }
+    if (is.func(phases.oninertiastart)) { this.on(`${actionName}inertiastart`, phases.oninertiastart) }
+
+    return this
+  }
+
+  updatePerActionListeners (actionName: Interact.ActionName, prev: Interact.Listeners, cur: Interact.Listeners) {
+    if (is.array(prev) || is.object(prev)) {
+      this.off(actionName, prev)
+    }
+
+    if (is.array(cur) || is.object(cur)) {
+      this.on(actionName, cur)
+    }
+  }
+
+  setPerAction (actionName: Interact.ActionName, options: Interact.OrBoolean<Options>) {
+    const defaults = this._defaults
+
+    // for all the default per-action options
+    for (const optionName_ in options) {
+      const optionName = optionName_ as keyof Interact.PerActionDefaults
+      const actionOptions = this.options[actionName]
+      const optionValue: any = options[optionName]
+
+      // remove old event listeners and add new ones
+      if (optionName === 'listeners') {
+        this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue as Interact.Listeners)
+      }
+
+      // if the option value is an array
+      if (is.array<any>(optionValue)) {
+        (actionOptions[optionName] as any) = arr.from(optionValue)
+      }
+      // if the option value is an object
+      else if (is.plainObject(optionValue)) {
+        // copy the object
+        (actionOptions[optionName] as any) = extend(
+          actionOptions[optionName] || {} as any,
+          clone(optionValue))
+
+        // set anabled field to true if it exists in the defaults
+        if (is.object(defaults.perAction[optionName]) && 'enabled' in (defaults.perAction[optionName] as any)) {
+          (actionOptions[optionName] as any).enabled = optionValue.enabled !== false
+        }
+      }
+      // if the option value is a boolean and the default is an object
+      else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {
+        (actionOptions[optionName] as any).enabled = optionValue
+      }
+      // if it's anything else, do a plain assignment
+      else {
+        (actionOptions[optionName] as any) = optionValue
+      }
+    }
+  }
+
+  /**
+   * The default function to get an Interactables bounding rect. Can be
+   * overridden using {@link Interactable.rectChecker}.
+   *
+   * @param {Element} [element] The element to measure.
+   * @return {object} The object's bounding rectangle.
+   */
+  getRect (element: Interact.Element) {
+    element = element || (is.element(this.target)
+      ? this.target
+      : null)
+
+    if (is.string(this.target)) {
+      element = element || this._context.querySelector(this.target)
+    }
+
+    return getElementRect(element)
+  }
+
+  /**
+   * Returns or sets the function used to calculate the interactable's
+   * element's rectangle
+   *
+   * @param {function} [checker] A function which returns this Interactable's
+   * bounding rectangle. See {@link Interactable.getRect}
+   * @return {function | object} The checker function or this Interactable
+   */
+  rectChecker (checker: (element: Interact.Element) => any) {
+    if (is.func(checker)) {
+      this.getRect = checker
+
+      return this
+    }
+
+    if (checker === null) {
+      delete this.getRect
+
+      return this
+    }
+
+    return this.getRect
+  }
+
+  _backCompatOption (optionName: keyof Interact.Options, newValue: any) {
+    if (trySelector(newValue) || is.object(newValue)) {
+      (this.options[optionName] as any) = newValue
+
+      for (const action in this._actions.map) {
+        (this.options[action][optionName] as any) = newValue
+      }
+
+      return this
+    }
+
+    return this.options[optionName]
+  }
+
+  /**
+   * Gets or sets the origin of the Interactable's element.  The x and y
+   * of the origin will be subtracted from action event coordinates.
+   *
+   * @param {Element | object | string} [origin] An HTML or SVG Element whose
+   * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'
+   * or any CSS selector
+   *
+   * @return {object} The current origin or this Interactable
+   */
+  origin (newValue: any) {
+    return this._backCompatOption('origin', newValue)
+  }
+
+  /**
+   * Returns or sets the mouse coordinate types used to calculate the
+   * movement of the pointer.
+   *
+   * @param {string} [newValue] Use 'client' if you will be scrolling while
+   * interacting; Use 'page' if you want autoScroll to work
+   * @return {string | object} The current deltaSource or this Interactable
+   */
+  deltaSource (newValue?: string) {
+    if (newValue === 'page' || newValue === 'client') {
+      this.options.deltaSource = newValue
+
+      return this
+    }
+
+    return this.options.deltaSource
+  }
+
+  /**
+   * Gets the selector context Node of the Interactable. The default is
+   * `window.document`.
+   *
+   * @return {Node} The context Node of this Interactable
+   */
+  context () {
+    return this._context
+  }
+
+  inContext (element: Document | Node) {
+    return (this._context === element.ownerDocument ||
+            nodeContains(this._context, element))
+  }
+
+  testIgnoreAllow (
+    this: Interactable,
+    options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },
+    targetNode: Node,
+    eventTarget: Interact.EventTarget,
+  ) {
+    return (!this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&
+            this.testAllow(options.allowFrom, targetNode, eventTarget))
+  }
+
+  testAllow (
+    this: Interactable,
+    allowFrom: IgnoreValue,
+    targetNode: Node,
+    element: Interact.EventTarget,
+  ) {
+    if (!allowFrom) { return true }
+
+    if (!is.element(element)) { return false }
+
+    if (is.string(allowFrom)) {
+      return matchesUpTo(element, allowFrom, targetNode)
+    }
+    else if (is.element(allowFrom)) {
+      return nodeContains(allowFrom, element)
+    }
+
+    return false
+  }
+
+  testIgnore (
+    this: Interactable,
+    ignoreFrom: IgnoreValue,
+    targetNode: Node,
+    element: Interact.EventTarget,
+  ) {
+    if (!ignoreFrom || !is.element(element)) { return false }
+
+    if (is.string(ignoreFrom)) {
+      return matchesUpTo(element, ignoreFrom, targetNode)
+    }
+    else if (is.element(ignoreFrom)) {
+      return nodeContains(ignoreFrom, element)
+    }
+
+    return false
+  }
+
+  /**
+   * Calls listeners for the given InteractEvent type bound globally
+   * and directly to this Interactable
+   *
+   * @param {InteractEvent} iEvent The InteractEvent object to be fired on this
+   * Interactable
+   * @return {Interactable} this Interactable
+   */
+  fire (iEvent: object) {
+    this.events.fire(iEvent)
+
+    return this
+  }
+
+  _onOff (method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any) {
+    if (is.object(typeArg) && !is.array(typeArg)) {
+      options = listenerArg
+      listenerArg = null
+    }
+
+    const addRemove = method === 'on' ? 'add' : 'remove'
+    const listeners = normalizeListeners(typeArg, listenerArg)
+
+    for (let type in listeners) {
+      if (type === 'wheel') { type = browser.wheelEvent }
+
+      for (const listener of listeners[type]) {
+        // if it is an action event type
+        if (isNonNativeEvent(type, this._actions)) {
+          this.events[method](type, listener)
+        }
+        // delegated event
+        else if (is.string(this.target)) {
+          events[`${addRemove}Delegate` as 'addDelegate' | 'removeDelegate'](this.target, this._context, type, listener, options)
+        }
+        // remove listener from this Interactable's element
+        else {
+          (events[addRemove] as typeof events.remove)(this.target, type, listener, options)
+        }
+      }
+    }
+
+    return this
+  }
+
+  /**
+   * Binds a listener for an InteractEvent, pointerEvent or DOM event.
+   *
+   * @param {string | array | object} types The types of events to listen
+   * for
+   * @param {function | array | object} [listener] The event listener function(s)
+   * @param {object | boolean} [options] options object or useCapture flag for
+   * addEventListener
+   * @return {Interactable} This Interactable
+   */
+  on (types: Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {
+    return this._onOff('on', types, listener, options)
+  }
+
+  /**
+   * Removes an InteractEvent, pointerEvent or DOM event listener.
+   *
+   * @param {string | array | object} types The types of events that were
+   * listened for
+   * @param {function | array | object} [listener] The event listener function(s)
+   * @param {object | boolean} [options] options object or useCapture flag for
+   * removeEventListener
+   * @return {Interactable} This Interactable
+   */
+  off (types: string | string[] | Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {
+    return this._onOff('off', types, listener, options)
+  }
+
+  /**
+   * Reset the options of this Interactable
+   *
+   * @param {object} options The new settings to apply
+   * @return {object} This Interactable
+   */
+  set (options: Interact.OptionsArg) {
+    const defaults = this._defaults
+
+    if (!is.object(options)) {
+      options = {}
+    }
+
+    (this.options as Required<Options>) = clone(defaults.base) as Required<Options>
+
+    for (const actionName_ in this._actions.methodDict) {
+      const actionName = actionName_ as Interact.ActionName
+      const methodName = this._actions.methodDict[actionName]
+
+      this.options[actionName] = {}
+      this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))
+
+      this[methodName](options[actionName])
+    }
+
+    for (const setting in options) {
+      if (is.func(this[setting])) {
+        this[setting](options[setting])
+      }
+    }
+
+    return this
+  }
+
+  /**
+   * Remove this interactable from the list of interactables and remove it's
+   * action capabilities and event listeners
+   *
+   * @return {interact}
+   */
+  unset () {
+    events.remove(this.target as Node, 'all')
+
+    if (is.string(this.target)) {
+      // remove delegated events
+      for (const type in events.delegatedEvents) {
+        const delegated = events.delegatedEvents[type]
+
+        if (delegated.selectors[0] === this.target &&
+            delegated.contexts[0] === this._context) {
+          delegated.selectors.splice(0, 1)
+          delegated.contexts.splice(0, 1)
+          delegated.listeners.splice(0, 1)
+        }
+
+        events.remove(this._context, type, events.delegateListener)
+        events.remove(this._context, type, events.delegateUseCapture, true)
+      }
+    }
+    else {
+      events.remove(this.target as Node, 'all')
+    }
+  }
+}
+
+export default Interactable
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_core_Interaction.ts.html b/interactjs/dist/api/@interactjs_core_Interaction.ts.html new file mode 100644 index 000000000..5edfb3110 --- /dev/null +++ b/interactjs/dist/api/@interactjs_core_Interaction.ts.html @@ -0,0 +1,667 @@ + + + + + + @interactjs/core/Interaction.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/core/Interaction.ts

+ + + + + + + +
+
+
import * as utils from '@interactjs/utils/index'
+import Interactable from './Interactable'
+import InteractEvent, { EventPhase } from './InteractEvent'
+import PointerInfo from './PointerInfo'
+import { ActionName } from './scope'
+
+export interface ActionProps<T extends ActionName = Interact.ActionName> {
+  name: T
+  axis?: 'x' | 'y' | 'xy'
+  edges?: Interact.EdgeOptions
+}
+
+export interface StartAction extends ActionProps {
+  name: ActionName
+}
+
+export enum _ProxyValues {
+  interactable = '',
+  element = '',
+  prepared = '',
+  pointerIsDown = '',
+  pointerWasMoved = '',
+  _proxy = ''
+}
+
+export enum _ProxyMethods {
+  start = '',
+  move = '',
+  end = '',
+  stop = '',
+  interacting = ''
+}
+
+export type PointerArgProps<T extends {} = {}> = {
+  pointer: Interact.PointerType
+  event: Interact.PointerEventType
+  eventTarget: Interact.EventTarget
+  pointerIndex: number
+  pointerInfo: PointerInfo
+  interaction: Interaction
+} & T
+
+export interface DoPhaseArg<T extends ActionName, P extends EventPhase> {
+  event: Interact.PointerEventType
+  phase: EventPhase
+  interaction: Interaction<T>
+  iEvent: InteractEvent<T, P>
+  preEnd?: boolean
+  type?: string
+}
+
+export type DoAnyPhaseArg = DoPhaseArg<ActionName, EventPhase>
+
+declare module '@interactjs/core/scope' {
+  interface SignalArgs {
+    'interactions:new': { interaction: Interaction }
+    'interactions:down': PointerArgProps<{
+      type: 'down'
+    }>
+    'interactions:move': PointerArgProps<{
+      type: 'move'
+      dx: number
+      dy: number
+      duplicate: boolean
+    }>
+    'interactions:up': PointerArgProps<{
+      type: 'up'
+      curEventTarget: EventTarget
+    }>
+    'interactions:cancel': SignalArgs['interactions:up'] & {
+      type: 'cancel'
+      curEventTarget: EventTarget
+    }
+    'interactions:update-pointer': PointerArgProps<{
+      down: boolean
+    }>
+    'interactions:remove-pointer': PointerArgProps
+    'interactions:blur'
+    'interactions:before-action-start': Omit<DoAnyPhaseArg, 'iEvent'>
+    'interactions:action-start': DoAnyPhaseArg
+    'interactions:after-action-start': DoAnyPhaseArg
+    'interactions:before-action-move': Omit<DoAnyPhaseArg, 'iEvent'>
+    'interactions:action-move': DoAnyPhaseArg
+    'interactions:after-action-move': DoAnyPhaseArg
+    'interactions:before-action-end': Omit<DoAnyPhaseArg, 'iEvent'>
+    'interactions:action-end': DoAnyPhaseArg
+    'interactions:after-action-end': DoAnyPhaseArg
+    'interactions:stop': { interaction: Interaction }
+  }
+}
+
+export type _InteractionProxy = Pick<
+Interaction,
+keyof typeof _ProxyValues | keyof typeof _ProxyMethods
+>
+
+let idCounter = 0
+
+export class Interaction<T extends ActionName = ActionName> {
+  // current interactable being interacted with
+  interactable: Interactable = null
+
+  // the target element of the interactable
+  element: Interact.Element = null
+  rect: Interact.FullRect
+  _rects?: {
+    start: Interact.FullRect
+    corrected: Interact.FullRect
+    previous: Interact.FullRect
+    delta: Interact.FullRect
+  }
+  edges: Interact.EdgeOptions
+
+  _scopeFire: Interact.Scope['fire']
+
+  // action that's ready to be fired on next move event
+  prepared: ActionProps<T> = {
+    name : null,
+    axis : null,
+    edges: null,
+  }
+
+  pointerType: string
+
+  // keep track of added pointers
+  pointers: PointerInfo[] = []
+
+  // pointerdown/mousedown/touchstart event
+  downEvent: Interact.PointerEventType = null
+
+  downPointer: Interact.PointerType = {} as Interact.PointerType
+
+  _latestPointer: {
+    pointer: Interact.PointerType
+    event: Interact.PointerEventType
+    eventTarget: Node
+  } = {
+    pointer: null,
+    event: null,
+    eventTarget: null,
+  }
+
+  // previous action event
+  prevEvent: InteractEvent<T, EventPhase> = null
+
+  pointerIsDown = false
+  pointerWasMoved = false
+  _interacting = false
+  _ending = false
+  _stopped = true
+  _proxy: _InteractionProxy = null
+
+  simulation = null
+
+  get pointerMoveTolerance () {
+    return 1
+  }
+
+  /**
+   * @alias Interaction.prototype.move
+   */
+  doMove = utils.warnOnce(
+    function (this: Interaction, signalArg: any) {
+      this.move(signalArg)
+    },
+    'The interaction.doMove() method has been renamed to interaction.move()')
+
+  coords: Interact.CoordsSet = {
+    // Starting InteractEvent pointer coordinates
+    start: utils.pointer.newCoords(),
+    // Previous native pointer move event coordinates
+    prev: utils.pointer.newCoords(),
+    // current native pointer move event coordinates
+    cur: utils.pointer.newCoords(),
+    // Change in coordinates and time of the pointer
+    delta: utils.pointer.newCoords(),
+    // pointer velocity
+    velocity: utils.pointer.newCoords(),
+  }
+
+  readonly _id: number = idCounter++
+
+  /** */
+  constructor ({ pointerType, scopeFire }: {
+    pointerType?: string
+    scopeFire: Interact.Scope['fire']
+  }) {
+    this._scopeFire = scopeFire
+    this.pointerType = pointerType
+
+    const that = this
+
+    this._proxy = {} as _InteractionProxy
+
+    for (const key in _ProxyValues) {
+      Object.defineProperty(this._proxy, key, {
+        get () { return that[key] },
+      })
+    }
+
+    for (const key in _ProxyMethods) {
+      Object.defineProperty(this._proxy, key, {
+        value: (...args) => that[key](...args),
+      })
+    }
+
+    this._scopeFire('interactions:new', { interaction: this })
+  }
+
+  pointerDown (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {
+    const pointerIndex = this.updatePointer(pointer, event, eventTarget, true)
+    const pointerInfo = this.pointers[pointerIndex]
+
+    this._scopeFire('interactions:down', {
+      pointer,
+      event,
+      eventTarget,
+      pointerIndex,
+      pointerInfo,
+      type: 'down',
+      interaction: this,
+    })
+  }
+
+  /**
+   * ```js
+   * interact(target)
+   *   .draggable({
+   *     // disable the default drag start by down->move
+   *     manualStart: true
+   *   })
+   *   // start dragging after the user holds the pointer down
+   *   .on('hold', function (event) {
+   *     var interaction = event.interaction
+   *
+   *     if (!interaction.interacting()) {
+   *       interaction.start({ name: 'drag' },
+   *                         event.interactable,
+   *                         event.currentTarget)
+   *     }
+   * })
+   * ```
+   *
+   * Start an action with the given Interactable and Element as tartgets. The
+   * action must be enabled for the target Interactable and an appropriate
+   * number of pointers must be held down - 1 for drag/resize, 2 for gesture.
+   *
+   * Use it with `interactable.<action>able({ manualStart: false })` to always
+   * [start actions manually](https://github.com/taye/interact.js/issues/114)
+   *
+   * @param {object} action   The action to be performed - drag, resize, etc.
+   * @param {Interactable} target  The Interactable to target
+   * @param {Element} element The DOM Element to target
+   * @return {object} interact
+   */
+  start (action: StartAction, interactable: Interactable, element: Interact.Element) {
+    if (this.interacting() ||
+        !this.pointerIsDown ||
+        this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||
+        !interactable.options[action.name].enabled) {
+      return false
+    }
+
+    utils.copyAction(this.prepared, action)
+
+    this.interactable = interactable
+    this.element      = element
+    this.rect         = interactable.getRect(element)
+    this.edges        = this.prepared.edges
+      ? utils.extend({}, this.prepared.edges)
+      : { left: true, right: true, top: true, bottom: true }
+    this._stopped     = false
+    this._interacting = this._doPhase({
+      interaction: this,
+      event: this.downEvent,
+      phase: 'start',
+    }) && !this._stopped
+
+    return this._interacting
+  }
+
+  pointerMove (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {
+    if (!this.simulation && !(this.modification && this.modification.endResult)) {
+      this.updatePointer(pointer, event, eventTarget, false)
+    }
+
+    const duplicateMove = (this.coords.cur.page.x === this.coords.prev.page.x &&
+                           this.coords.cur.page.y === this.coords.prev.page.y &&
+                           this.coords.cur.client.x === this.coords.prev.client.x &&
+                           this.coords.cur.client.y === this.coords.prev.client.y)
+
+    let dx
+    let dy
+
+    // register movement greater than pointerMoveTolerance
+    if (this.pointerIsDown && !this.pointerWasMoved) {
+      dx = this.coords.cur.client.x - this.coords.start.client.x
+      dy = this.coords.cur.client.y - this.coords.start.client.y
+
+      this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance
+    }
+
+    const pointerIndex = this.getPointerIndex(pointer)
+    const signalArg = {
+      pointer,
+      pointerIndex,
+      pointerInfo: this.pointers[pointerIndex],
+      event,
+      type: 'move' as const,
+      eventTarget,
+      dx,
+      dy,
+      duplicate: duplicateMove,
+      interaction: this,
+    }
+
+    if (!duplicateMove) {
+      // set pointer coordinate, time changes and velocity
+      utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta)
+    }
+
+    this._scopeFire('interactions:move', signalArg)
+
+    if (!duplicateMove && !this.simulation) {
+      // if interacting, fire an 'action-move' signal etc
+      if (this.interacting()) {
+        signalArg.type = null
+        this.move(signalArg)
+      }
+
+      if (this.pointerWasMoved) {
+        utils.pointer.copyCoords(this.coords.prev, this.coords.cur)
+      }
+    }
+  }
+
+  /**
+   * ```js
+   * interact(target)
+   *   .draggable(true)
+   *   .on('dragmove', function (event) {
+   *     if (someCondition) {
+   *       // change the snap settings
+   *       event.interactable.draggable({ snap: { targets: [] }})
+   *       // fire another move event with re-calculated snap
+   *       event.interaction.move()
+   *     }
+   *   })
+   * ```
+   *
+   * Force a move of the current action at the same coordinates. Useful if
+   * snap/restrict has been changed and you want a movement with the new
+   * settings.
+   */
+  move (signalArg?) {
+    if (!signalArg || !signalArg.event) {
+      utils.pointer.setZeroCoords(this.coords.delta)
+    }
+
+    signalArg = utils.extend({
+      pointer: this._latestPointer.pointer,
+      event: this._latestPointer.event,
+      eventTarget: this._latestPointer.eventTarget,
+      interaction: this,
+    }, signalArg || {})
+
+    signalArg.phase = 'move'
+
+    this._doPhase(signalArg)
+  }
+
+  // End interact move events and stop auto-scroll unless simulation is running
+  pointerUp (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, curEventTarget: Interact.EventTarget) {
+    let pointerIndex = this.getPointerIndex(pointer)
+
+    if (pointerIndex === -1) {
+      pointerIndex = this.updatePointer(pointer, event, eventTarget, false)
+    }
+
+    const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'
+
+    this._scopeFire(`interactions:${type}` as 'interactions:up' | 'interactions:cancel', {
+      pointer,
+      pointerIndex,
+      pointerInfo: this.pointers[pointerIndex],
+      event,
+      eventTarget,
+      type: type as any,
+      curEventTarget,
+      interaction: this,
+    })
+
+    if (!this.simulation) {
+      this.end(event)
+    }
+
+    this.pointerIsDown = false
+    this.removePointer(pointer, event)
+  }
+
+  documentBlur (event) {
+    this.end(event)
+    this._scopeFire('interactions:blur', { event, type: 'blur', interaction: this })
+  }
+
+  /**
+   * ```js
+   * interact(target)
+   *   .draggable(true)
+   *   .on('move', function (event) {
+   *     if (event.pageX > 1000) {
+   *       // end the current action
+   *       event.interaction.end()
+   *       // stop all further listeners from being called
+   *       event.stopImmediatePropagation()
+   *     }
+   *   })
+   * ```
+   *
+   * @param {PointerEvent} [event]
+   */
+  end (event?: Interact.PointerEventType) {
+    this._ending = true
+    event = event || this._latestPointer.event
+    let endPhaseResult
+
+    if (this.interacting()) {
+      endPhaseResult = this._doPhase({
+        event,
+        interaction: this,
+        phase: 'end',
+      })
+    }
+
+    this._ending = false
+
+    if (endPhaseResult === true) {
+      this.stop()
+    }
+  }
+
+  currentAction () {
+    return this._interacting ? this.prepared.name : null
+  }
+
+  interacting () {
+    return this._interacting
+  }
+
+  /** */
+  stop () {
+    this._scopeFire('interactions:stop', { interaction: this })
+
+    this.interactable = this.element = null
+
+    this._interacting = false
+    this._stopped = true
+    this.prepared.name = this.prevEvent = null
+  }
+
+  getPointerIndex (pointer) {
+    const pointerId = utils.pointer.getPointerId(pointer)
+
+    // mouse and pen interactions may have only one pointer
+    return (this.pointerType === 'mouse' || this.pointerType === 'pen')
+      ? this.pointers.length - 1
+      : utils.arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId)
+  }
+
+  getPointerInfo (pointer) {
+    return this.pointers[this.getPointerIndex(pointer)]
+  }
+
+  updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean) {
+    const id = utils.pointer.getPointerId(pointer)
+    let pointerIndex = this.getPointerIndex(pointer)
+    let pointerInfo = this.pointers[pointerIndex]
+
+    down = down === false
+      ? false
+      : down || /(down|start)$/i.test(event.type)
+
+    if (!pointerInfo) {
+      pointerInfo = new PointerInfo(
+        id,
+        pointer,
+        event,
+        null,
+        null,
+      )
+
+      pointerIndex = this.pointers.length
+      this.pointers.push(pointerInfo)
+    }
+    else {
+      pointerInfo.pointer = pointer
+    }
+
+    utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now())
+    utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)
+
+    if (down) {
+      this.pointerIsDown = true
+
+      pointerInfo.downTime = this.coords.cur.timeStamp
+      pointerInfo.downTarget = eventTarget
+      utils.pointer.pointerExtend(this.downPointer, pointer)
+
+      if (!this.interacting()) {
+        utils.pointer.copyCoords(this.coords.start, this.coords.cur)
+        utils.pointer.copyCoords(this.coords.prev, this.coords.cur)
+
+        this.downEvent = event
+        this.pointerWasMoved = false
+      }
+    }
+
+    this._updateLatestPointer(pointer, event, eventTarget)
+
+    this._scopeFire('interactions:update-pointer', {
+      pointer,
+      event,
+      eventTarget,
+      down,
+      pointerInfo,
+      pointerIndex,
+      interaction: this,
+    })
+
+    return pointerIndex
+  }
+
+  removePointer (pointer: Interact.PointerType, event: Interact.PointerEventType) {
+    const pointerIndex = this.getPointerIndex(pointer)
+
+    if (pointerIndex === -1) { return }
+
+    const pointerInfo = this.pointers[pointerIndex]
+
+    this._scopeFire('interactions:remove-pointer', {
+      pointer,
+      event,
+      eventTarget: null,
+      pointerIndex,
+      pointerInfo,
+      interaction: this,
+    })
+
+    this.pointers.splice(pointerIndex, 1)
+  }
+
+  _updateLatestPointer (pointer, event, eventTarget) {
+    this._latestPointer.pointer = pointer
+    this._latestPointer.event = event
+    this._latestPointer.eventTarget = eventTarget
+  }
+
+  destroy () {
+    this._latestPointer.pointer = null
+    this._latestPointer.event = null
+    this._latestPointer.eventTarget = null
+  }
+
+  _createPreparedEvent<P extends EventPhase> (event: Interact.PointerEventType, phase: P, preEnd?: boolean, type?: string) {
+    return new InteractEvent<T, P>(this, event, this.prepared.name, phase, this.element, preEnd, type)
+  }
+
+  _fireEvent<P extends EventPhase> (iEvent: InteractEvent<T, P>) {
+    this.interactable.fire(iEvent)
+
+    if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {
+      this.prevEvent = iEvent
+    }
+  }
+
+  _doPhase<P extends EventPhase> (signalArg: Omit<DoPhaseArg<T, P>, 'iEvent'> & { iEvent?: InteractEvent<T, P> }) {
+    const { event, phase, preEnd, type } = signalArg
+    const { rect } = this
+
+    if (rect && phase === 'move') {
+      // update the rect changes due to pointer move
+      utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource])
+
+      rect.width = rect.right - rect.left
+      rect.height = rect.bottom - rect.top
+    }
+
+    const beforeResult = this._scopeFire(`interactions:before-action-${phase}` as any, signalArg)
+
+    if (beforeResult === false) {
+      return false
+    }
+
+    const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type)
+
+    this._scopeFire(`interactions:action-${phase}` as any, signalArg)
+
+    if (phase === 'start') { this.prevEvent = iEvent }
+
+    this._fireEvent(iEvent)
+
+    this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)
+
+    return true
+  }
+
+  _now () { return Date.now() }
+}
+
+export default Interaction
+export { PointerInfo }
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_core_interactablePreventDefault.ts.html b/interactjs/dist/api/@interactjs_core_interactablePreventDefault.ts.html new file mode 100644 index 000000000..0cacbfdbe --- /dev/null +++ b/interactjs/dist/api/@interactjs_core_interactablePreventDefault.ts.html @@ -0,0 +1,170 @@ + + + + + + @interactjs/core/interactablePreventDefault.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/core/interactablePreventDefault.ts

+ + + + + + + +
+
+
import { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'
+import events from '@interactjs/utils/events'
+import * as is from '@interactjs/utils/is'
+import { getWindow } from '@interactjs/utils/window'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    preventDefault: typeof preventDefault
+    checkAndPreventDefault: (event: Event) => void
+  }
+}
+
+function preventDefault (this: Interact.Interactable, newValue?: 'always' | 'never' | 'auto') {
+  if (/^(always|never|auto)$/.test(newValue)) {
+    this.options.preventDefault = newValue
+    return this
+  }
+
+  if (is.bool(newValue)) {
+    this.options.preventDefault = newValue ? 'always' : 'never'
+    return this
+  }
+
+  return this.options.preventDefault
+}
+
+function checkAndPreventDefault (interactable: Interact.Interactable, scope: Interact.Scope, event: Event) {
+  const setting = interactable.options.preventDefault
+
+  if (setting === 'never') { return }
+
+  if (setting === 'always') {
+    event.preventDefault()
+    return
+  }
+
+  // setting === 'auto'
+
+  // if the browser supports passive event listeners and isn't running on iOS,
+  // don't preventDefault of touch{start,move} events. CSS touch-action and
+  // user-select should be used instead of calling event.preventDefault().
+  if (events.supportsPassive && /^touch(start|move)$/.test(event.type)) {
+    const doc = getWindow(event.target).document
+    const docOptions = scope.getDocOptions(doc)
+
+    if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {
+      return
+    }
+  }
+
+  // don't preventDefault of pointerdown events
+  if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {
+    return
+  }
+
+  // don't preventDefault on editable elements
+  if (is.element(event.target) &&
+      matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {
+    return
+  }
+
+  event.preventDefault()
+}
+
+function onInteractionEvent ({ interaction, event }: { interaction: Interact.Interaction, event: Interact.PointerEventType }) {
+  if (interaction.interactable) {
+    interaction.interactable.checkAndPreventDefault(event as Event)
+  }
+}
+
+export function install (scope: Interact.Scope) {
+  /** @lends Interactable */
+  const { Interactable } = scope
+
+  /**
+   * Returns or sets whether to prevent the browser's default behaviour in
+   * response to pointer events. Can be set to:
+   *  - `'always'` to always prevent
+   *  - `'never'` to never prevent
+   *  - `'auto'` to let interact.js try to determine what would be best
+   *
+   * @param {string} [newValue] `'always'`, `'never'` or `'auto'`
+   * @return {string | Interactable} The current setting or this Interactable
+   */
+  Interactable.prototype.preventDefault = preventDefault
+
+  Interactable.prototype.checkAndPreventDefault = function (event) {
+    return checkAndPreventDefault(this, scope, event)
+  }
+
+  // prevent native HTML5 drag on interact.js target elements
+  scope.interactions.docEvents.push({
+    type: 'dragstart',
+    listener (event) {
+      for (const interaction of scope.interactions.list) {
+        if (interaction.element &&
+          (interaction.element === event.target ||
+           nodeContains(interaction.element, event.target))) {
+          interaction.interactable.checkAndPreventDefault(event)
+          return
+        }
+      }
+    },
+  })
+}
+
+export default {
+  id: 'core/interactablePreventDefault',
+  install,
+  listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => {
+    acc[`interactions:${eventType}`] = onInteractionEvent
+    return acc
+  }, {} as any),
+}
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_interact_interact.ts.html b/interactjs/dist/api/@interactjs_interact_interact.ts.html new file mode 100644 index 000000000..6c93feb6e --- /dev/null +++ b/interactjs/dist/api/@interactjs_interact_interact.ts.html @@ -0,0 +1,358 @@ + + + + + + @interactjs/interact/interact.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/interact/interact.ts

+ + + + + + + +
+
+
/** @module interact */
+
+import { Options } from '@interactjs/core/defaultOptions'
+import Interactable from '@interactjs/core/Interactable'
+import { isNonNativeEvent, Scope } from '@interactjs/core/scope'
+import browser from '@interactjs/utils/browser'
+import events from '@interactjs/utils/events'
+import * as utils from '@interactjs/utils/index'
+
+declare module '@interactjs/core/scope' {
+  interface Scope {
+    interact: InteractStatic
+  }
+}
+
+export interface InteractStatic {
+  (target: Interact.Target, options?: Options): Interactable
+  on: typeof on
+  pointerMoveTolerance: typeof pointerMoveTolerance
+  stop: typeof stop
+  supportsPointerEvent: typeof supportsPointerEvent
+  supportsTouch: typeof supportsTouch
+  debug: typeof debug
+  off: typeof off
+  isSet: typeof isSet
+  use: typeof use
+  getPointerAverage: typeof utils.pointer.pointerAverage
+  getTouchBBox: typeof utils.pointer.touchBBox
+  getTouchDistance: typeof utils.pointer.touchDistance
+  getTouchAngle: typeof utils.pointer.touchAngle
+  getElementRect: typeof utils.dom.getElementRect
+  getElementClientRect: typeof utils.dom.getElementClientRect
+  matchesSelector: typeof utils.dom.matchesSelector
+  closest: typeof utils.dom.closest
+  addDocument: typeof scope.addDocument
+  removeDocument: typeof scope.removeDocument
+  dynamicDrop: (newValue?: boolean) => boolean | Interact.interact
+  version: string
+}
+
+const globalEvents: any = {}
+const scope = new Scope()
+
+/**
+ * ```js
+ * interact('#draggable').draggable(true)
+ *
+ * var rectables = interact('rect')
+ * rectables
+ *   .gesturable(true)
+ *   .on('gesturemove', function (event) {
+ *       // ...
+ *   })
+ * ```
+ *
+ * The methods of this variable can be used to set elements as interactables
+ * and also to change various default settings.
+ *
+ * Calling it as a function and passing an element or a valid CSS selector
+ * string returns an Interactable object which has various methods to configure
+ * it.
+ *
+ * @global
+ *
+ * @param {Element | string} target The HTML or SVG Element to interact with
+ * or CSS selector
+ * @return {Interactable}
+ */
+export const interact: InteractStatic = function interact (target: Interact.Target, options?: any) {
+  let interactable = scope.interactables.get(target, options)
+
+  if (!interactable) {
+    interactable = scope.interactables.new(target, options)
+    interactable.events.global = globalEvents
+  }
+
+  return interactable
+} as InteractStatic
+
+/**
+ * Use a plugin
+ *
+ * @alias module:interact.use
+ *
+ * @param {Object} plugin
+ * @param {function} plugin.install
+ * @return {interact}
+ */
+interact.use = use
+function use (plugin: Interact.Plugin, options?: { [key: string]: any }) {
+  scope.usePlugin(plugin, options)
+
+  return interact
+}
+
+/**
+ * Check if an element or selector has been set with the {@link interact}
+ * function
+ *
+ * @alias module:interact.isSet
+ *
+ * @param {Element} element The Element being searched for
+ * @return {boolean} Indicates if the element or CSS selector was previously
+ * passed to interact
+ */
+interact.isSet = isSet
+function isSet (target: Interact.Element, options?: any) {
+  return !!scope.interactables.get(target, options && options.context)
+}
+
+/**
+ * Add a global listener for an InteractEvent or adds a DOM event to `document`
+ *
+ * @alias module:interact.on
+ *
+ * @param {string | array | object} type The types of events to listen for
+ * @param {function} listener The function event (s)
+ * @param {object | boolean} [options] object or useCapture flag for
+ * addEventListener
+ * @return {object} interact
+ */
+interact.on = on
+function on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object) {
+  if (utils.is.string(type) && type.search(' ') !== -1) {
+    type = type.trim().split(/ +/)
+  }
+
+  if (utils.is.array(type)) {
+    for (const eventType of (type as any[])) {
+      interact.on(eventType, listener, options)
+    }
+
+    return interact
+  }
+
+  if (utils.is.object(type)) {
+    for (const prop in type) {
+      interact.on(prop, (type as any)[prop], listener)
+    }
+
+    return interact
+  }
+
+  // if it is an InteractEvent type, add listener to globalEvents
+  if (isNonNativeEvent(type, scope.actions)) {
+    // if this type of event was never bound
+    if (!globalEvents[type]) {
+      globalEvents[type] = [listener]
+    }
+    else {
+      globalEvents[type].push(listener)
+    }
+  }
+  // If non InteractEvent type, addEventListener to document
+  else {
+    events.add(scope.document, type, listener as Interact.Listener, { options })
+  }
+
+  return interact
+}
+
+/**
+ * Removes a global InteractEvent listener or DOM event from `document`
+ *
+ * @alias module:interact.off
+ *
+ * @param {string | array | object} type The types of events that were listened
+ * for
+ * @param {function} listener The listener function to be removed
+ * @param {object | boolean} options [options] object or useCapture flag for
+ * removeEventListener
+ * @return {object} interact
+ */
+interact.off = off
+function off (type: Interact.EventTypes, listener: any, options?: object) {
+  if (utils.is.string(type) && type.search(' ') !== -1) {
+    type = type.trim().split(/ +/)
+  }
+
+  if (utils.is.array(type)) {
+    for (const eventType of type) {
+      interact.off(eventType, listener, options)
+    }
+
+    return interact
+  }
+
+  if (utils.is.object(type)) {
+    for (const prop in type) {
+      interact.off(prop, type[prop], listener)
+    }
+
+    return interact
+  }
+
+  if (isNonNativeEvent(type, scope.actions)) {
+    let index
+
+    if (type in globalEvents &&
+        (index = globalEvents[type].indexOf(listener)) !== -1) {
+      globalEvents[type].splice(index, 1)
+    }
+  }
+  else {
+    events.remove(scope.document, type, listener, options)
+  }
+
+  return interact
+}
+
+interact.debug = debug
+function debug () {
+  return scope
+}
+
+// expose the functions used to calculate multi-touch properties
+interact.getPointerAverage  = utils.pointer.pointerAverage
+interact.getTouchBBox       = utils.pointer.touchBBox
+interact.getTouchDistance   = utils.pointer.touchDistance
+interact.getTouchAngle      = utils.pointer.touchAngle
+
+interact.getElementRect       = utils.dom.getElementRect
+interact.getElementClientRect = utils.dom.getElementClientRect
+interact.matchesSelector      = utils.dom.matchesSelector
+interact.closest              = utils.dom.closest
+
+/**
+ * @alias module:interact.supportsTouch
+ *
+ * @return {boolean} Whether or not the browser supports touch input
+ */
+interact.supportsTouch = supportsTouch
+function supportsTouch () {
+  return browser.supportsTouch
+}
+
+/**
+ * @alias module:interact.supportsPointerEvent
+ *
+ * @return {boolean} Whether or not the browser supports PointerEvents
+ */
+interact.supportsPointerEvent = supportsPointerEvent
+function supportsPointerEvent () {
+  return browser.supportsPointerEvent
+}
+
+/**
+ * Cancels all interactions (end events are not fired)
+ *
+ * @alias module:interact.stop
+ *
+ * @return {object} interact
+ */
+interact.stop = stop
+function stop () {
+  for (const interaction of scope.interactions.list) {
+    interaction.stop()
+  }
+
+  return interact
+}
+
+/**
+ * Returns or sets the distance the pointer must be moved before an action
+ * sequence occurs. This also affects tolerance for tap events.
+ *
+ * @alias module:interact.pointerMoveTolerance
+ *
+ * @param {number} [newValue] The movement from the start position must be greater than this value
+ * @return {interact | number}
+ */
+interact.pointerMoveTolerance = pointerMoveTolerance
+function pointerMoveTolerance (newValue?: number) {
+  if (utils.is.number(newValue)) {
+    scope.interactions.pointerMoveTolerance = newValue
+
+    return interact
+  }
+
+  return scope.interactions.pointerMoveTolerance
+}
+
+scope.addListeners({
+  'interactable:unset': ({ interactable }) => {
+    scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1)
+
+    // Stop related interactions when an Interactable is unset
+    for (const interaction of scope.interactions.list) {
+      if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) {
+        interaction.stop()
+      }
+    }
+  },
+})
+
+interact.addDocument = (doc, options) => scope.addDocument(doc, options)
+interact.removeDocument = doc => scope.removeDocument(doc)
+
+scope.interact = interact
+
+export { scope }
+export default interact
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_modifiers_aspectRatio.ts.html b/interactjs/dist/api/@interactjs_modifiers_aspectRatio.ts.html new file mode 100644 index 000000000..85c742a26 --- /dev/null +++ b/interactjs/dist/api/@interactjs_modifiers_aspectRatio.ts.html @@ -0,0 +1,209 @@ + + + + + + @interactjs/modifiers/aspectRatio.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/modifiers/aspectRatio.ts

+ + + + + + + +
+
+
/* eslint-disable */
+
+/**
+ * @module modifiers/aspectRatio
+ *
+ * @description
+ * This module forces elements to be resized with a specified dx/dy ratio.
+ *
+ * @example
+ * interact(target).resizable({
+ *   modifiers: [
+ *     interact.modifiers.snapSize({
+ *       targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],
+ *     }),
+ *     interact.aspectRatio({ ratio: 'preserve' }),
+ *   ],
+ * });
+ */
+
+import extend from '@interactjs/utils/extend'
+import { addEdges } from '@interactjs/utils/rect'
+import { Modifier, ModifierModule, ModifierState } from './base'
+import Modification from './Modification'
+
+export interface AspectRatioOptions {
+  ratio?: number | 'preserve'
+  equalDelta?: boolean
+  modifiers?: Modifier[]
+  enabled?: boolean
+}
+
+export type AspectRatioState = ModifierState<AspectRatioOptions, {
+  startCoords: Interact.Point
+  startRect: Interact.Rect
+  linkedEdges: Interact.EdgeOptions
+  ratio: number
+  equalDelta: boolean
+  xIsPrimaryAxis: boolean
+  edgeSign: 1 | -1
+  subModification: Modification
+}>
+
+const aspectRatio: ModifierModule<AspectRatioOptions, AspectRatioState> = {
+  start (arg) {
+    const { state, rect, edges: originalEdges, pageCoords: coords } = arg
+    let { ratio } = state.options
+    const { equalDelta, modifiers } = state.options
+
+    if (ratio === 'preserve') {
+      ratio = rect.width / rect.height
+    }
+
+    state.startCoords = extend({}, coords)
+    state.startRect = extend({}, rect)
+    state.ratio = ratio
+    state.equalDelta = equalDelta
+
+    const linkedEdges = state.linkedEdges = {
+      top   : originalEdges.top    || (originalEdges.left   && !originalEdges.bottom),
+      left  : originalEdges.left   || (originalEdges.top    && !originalEdges.right),
+      bottom: originalEdges.bottom || (originalEdges.right  && !originalEdges.top),
+      right : originalEdges.right  || (originalEdges.bottom && !originalEdges.left),
+    }
+
+    state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)
+
+    if (state.equalDelta) {
+      state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1) as 1 | -1
+    }
+    else {
+      const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left
+      state.edgeSign = negativeSecondaryEdge ? -1 : 1
+    }
+
+    extend(arg.edges, linkedEdges)
+
+    if (!modifiers || !modifiers.length) { return }
+
+    const subModification = new Modification(arg.interaction)
+
+    subModification.copyFrom(arg.interaction.modification)
+    subModification.prepareStates(modifiers)
+
+    state.subModification = subModification
+    subModification.startAll({ ...arg })
+  },
+
+  set (arg) {
+    const { state, rect, coords } = arg
+    const initialCoords = extend({}, coords)
+    const aspectMethod = state.equalDelta ? setEqualDelta : setRatio
+
+    aspectMethod(state, state.xIsPrimaryAxis, coords, rect)
+
+    if (!state.subModification) { return null }
+
+    const correctedRect = extend({}, rect)
+
+    addEdges(state.linkedEdges, correctedRect, { x: coords.x - initialCoords.x, y: coords.y - initialCoords.y })
+
+    const result = state.subModification.setAll({
+      ...arg,
+      rect: correctedRect,
+      edges: state.linkedEdges,
+      pageCoords: coords,
+      prevCoords: coords,
+      prevRect: correctedRect,
+    })
+
+    const { delta } = result
+
+    if (result.changed) {
+      const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y)
+
+      // do aspect modification again with critical edge axis as primary
+      aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)
+      extend(coords, result.coords)
+    }
+
+    return result.eventProps
+  },
+
+  defaults: {
+    ratio: 'preserve',
+    equalDelta: false,
+    modifiers: [],
+    enabled: false,
+  },
+}
+
+function setEqualDelta ({ startCoords, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point) {
+  if (xIsPrimaryAxis) {
+    coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign
+  }
+  else {
+    coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign
+  }
+}
+
+function setRatio ({ startRect, startCoords, ratio, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point, rect: Interact.Rect) {
+  if (xIsPrimaryAxis) {
+    const newHeight = rect.width / ratio
+
+    coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign
+  }
+  else {
+    const newWidth = rect.height * ratio
+
+    coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign
+  }
+}
+
+export default aspectRatio
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_modifiers_snap_edges.ts.html b/interactjs/dist/api/@interactjs_modifiers_snap_edges.ts.html new file mode 100644 index 000000000..9d393505e --- /dev/null +++ b/interactjs/dist/api/@interactjs_modifiers_snap_edges.ts.html @@ -0,0 +1,118 @@ + + + + + + @interactjs/modifiers/snap/edges.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/modifiers/snap/edges.ts

+ + + + + + + +
+
+
/**
+ * @module modifiers/snapEdges
+ *
+ * @description
+ * This module allows snapping of the edges of targets during resize
+ * interactions.
+ *
+ * @example
+ * interact(target).resizable({
+ *   snapEdges: {
+ *     targets: [interact.snappers.grid({ x: 100, y: 50 })],
+ *   },
+ * })
+ *
+ * interact(target).resizable({
+ *   snapEdges: {
+ *     targets: [
+ *       interact.snappers.grid({
+ *        top: 50,
+ *        left: 50,
+ *        bottom: 100,
+ *        right: 100,
+ *       }),
+ *     ],
+ *   },
+ * })
+ */
+
+import clone from '@interactjs/utils/clone'
+import extend from '@interactjs/utils/extend'
+import { ModifierArg, ModifierModule } from '../base'
+import { SnapOptions, SnapState } from './pointer'
+import snapSize from './size'
+
+export type SnapEdgesOptions = Pick<SnapOptions, 'targets' | 'range' | 'offset' | 'endOnly' | 'enabled'>
+
+function start (arg: ModifierArg<SnapState>) {
+  const { edges } = arg
+
+  if (!edges) { return null }
+
+  arg.state.targetFields = arg.state.targetFields || [
+    [edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom'],
+  ]
+
+  return snapSize.start(arg)
+}
+
+const snapEdges: ModifierModule<SnapEdgesOptions, SnapState> = {
+  start,
+  set: snapSize.set,
+  defaults: extend(
+    clone(snapSize.defaults),
+    {
+      targets: null,
+      range: null,
+      offset: { x: 0, y: 0 },
+    } as const,
+  ),
+}
+
+export default snapEdges
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_pointer-events_PointerEvent.ts.html b/interactjs/dist/api/@interactjs_pointer-events_PointerEvent.ts.html new file mode 100644 index 000000000..5f41dab89 --- /dev/null +++ b/interactjs/dist/api/@interactjs_pointer-events_PointerEvent.ts.html @@ -0,0 +1,140 @@ + + + + + + @interactjs/pointer-events/PointerEvent.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/pointer-events/PointerEvent.ts

+ + + + + + + +
+
+
import BaseEvent from '../core/BaseEvent'
+import * as pointerUtils from '../utils/pointerUtils'
+
+export default class PointerEvent<T extends string = any> extends BaseEvent {
+  type: T
+  originalEvent: Interact.PointerEventType
+  pointerId: number
+  pointerType: string
+  double: boolean
+  pageX: number
+  pageY: number
+  clientX: number
+  clientY: number
+  dt: number
+  eventable: any
+  [key: string]: any
+
+  /** */
+  constructor (
+    type: T,
+    pointer: Interact.PointerType | PointerEvent<any>,
+    event: Interact.PointerEventType,
+    eventTarget: Interact.EventTarget,
+    interaction: Interact.Interaction,
+    timeStamp: number,
+  ) {
+    super(interaction)
+    pointerUtils.pointerExtend(this, event)
+
+    if (event !== pointer) {
+      pointerUtils.pointerExtend(this, pointer)
+    }
+
+    this.timeStamp     = timeStamp
+    this.originalEvent = event
+    this.type          = type
+    this.pointerId     = pointerUtils.getPointerId(pointer)
+    this.pointerType   = pointerUtils.getPointerType(pointer)
+    this.target        = eventTarget
+    this.currentTarget = null
+
+    if (type === 'tap') {
+      const pointerIndex = interaction.getPointerIndex(pointer)
+      this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime
+
+      const interval = this.timeStamp - interaction.tapTime
+
+      this.double = !!(interaction.prevTap &&
+        interaction.prevTap.type !== 'doubletap' &&
+        interaction.prevTap.target === this.target &&
+        interval < 500)
+    }
+    else if (type === 'doubletap') {
+      this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime
+    }
+  }
+
+  _subtractOrigin ({ x: originX, y: originY }: Interact.Point) {
+    this.pageX   -= originX
+    this.pageY   -= originY
+    this.clientX -= originX
+    this.clientY -= originY
+
+    return this
+  }
+
+  _addOrigin ({ x: originX, y: originY }: Interact.Point) {
+    this.pageX   += originX
+    this.pageY   += originY
+    this.clientX += originX
+    this.clientY += originY
+
+    return this
+  }
+
+  /**
+   * Prevent the default behaviour of the original Event
+   */
+  preventDefault () {
+    this.originalEvent.preventDefault()
+  }
+}
+
+export { PointerEvent }
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/@interactjs_reflow_index.ts.html b/interactjs/dist/api/@interactjs_reflow_index.ts.html new file mode 100644 index 000000000..709f43c05 --- /dev/null +++ b/interactjs/dist/api/@interactjs_reflow_index.ts.html @@ -0,0 +1,221 @@ + + + + + + @interactjs/reflow/index.ts - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

@interactjs/reflow/index.ts

+ + + + + + + +
+
+
import Interactable from '@interactjs/core/Interactable'
+import { ActionProps, Interaction } from '@interactjs/core/Interaction'
+import { Scope } from '@interactjs/core/scope'
+import { arr, extend, is, pointer as pointerUtils, rect as rectUtils, win } from '@interactjs/utils/index'
+
+declare module '@interactjs/core/Interactable' {
+  interface Interactable {
+    reflow: (action: ActionProps) => ReturnType<typeof reflow>
+  }
+}
+
+declare module '@interactjs/core/Interaction' {
+  interface Interaction {
+    _reflowPromise: Promise<void>
+    _reflowResolve: () => void
+  }
+}
+
+declare module '@interactjs/core/InteractEvent' {
+  // eslint-disable-next-line no-shadow
+  interface PhaseMap {
+    reflow?: true
+  }
+}
+
+export function install (scope: Scope) {
+  const {
+    /** @lends Interactable */
+    // eslint-disable-next-line no-shadow
+    Interactable,
+  } = scope
+
+  scope.actions.phases.reflow = true
+
+  /**
+   * ```js
+   * const interactable = interact(target)
+   * const drag = { name: drag, axis: 'x' }
+   * const resize = { name: resize, edges: { left: true, bottom: true }
+   *
+   * interactable.reflow(drag)
+   * interactable.reflow(resize)
+   * ```
+   *
+   * Start an action sequence to re-apply modifiers, check drops, etc.
+   *
+   * @param { Object } action The action to begin
+   * @param { string } action.name The name of the action
+   * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended
+   */
+  Interactable.prototype.reflow = function (action) {
+    return reflow(this, action, scope)
+  }
+}
+
+function reflow<T extends Interact.ActionName> (interactable: Interactable, action: ActionProps<T>, scope: Scope): Promise<Interactable> {
+  const elements = (is.string(interactable.target)
+    ? arr.from(interactable._context.querySelectorAll(interactable.target))
+    : [interactable.target]) as Interact.Element[]
+
+  // tslint:disable-next-line variable-name
+  const Promise = (win.window as any).Promise
+  const promises: Array<Promise<null>> | null = Promise ? [] : null
+
+  for (const element of elements) {
+    const rect = interactable.getRect(element as HTMLElement | SVGElement)
+
+    if (!rect) { break }
+
+    const runningInteraction = arr.find(
+      scope.interactions.list,
+      (interaction: Interaction) => {
+        return interaction.interacting() &&
+          interaction.interactable === interactable &&
+          interaction.element === element &&
+          interaction.prepared.name === action.name
+      })
+    let reflowPromise: Promise<null>
+
+    if (runningInteraction) {
+      runningInteraction.move()
+
+      if (promises) {
+        reflowPromise = runningInteraction._reflowPromise || new Promise((resolve: any) => {
+          runningInteraction._reflowResolve = resolve
+        })
+      }
+    }
+    else {
+      const xywh = rectUtils.tlbrToXywh(rect)
+      const coords = {
+        page     : { x: xywh.x, y: xywh.y },
+        client   : { x: xywh.x, y: xywh.y },
+        timeStamp: scope.now(),
+      }
+
+      const event = pointerUtils.coordsToEvent(coords)
+      reflowPromise = startReflow<T>(scope, interactable, element, action, event)
+    }
+
+    if (promises) {
+      promises.push(reflowPromise)
+    }
+  }
+
+  return promises && Promise.all(promises).then(() => interactable)
+}
+
+function startReflow<T extends Interact.ActionName> (scope: Scope, interactable: Interactable, element: Interact.Element, action: ActionProps<T>, event: any) {
+  const interaction = scope.interactions.new({ pointerType: 'reflow' })
+  const signalArg = {
+    interaction,
+    event,
+    pointer: event,
+    eventTarget: element,
+    phase: 'reflow',
+  } as const
+
+  interaction.interactable = interactable
+  interaction.element = element
+  interaction.prepared = extend({}, action)
+  interaction.prevEvent = event
+  interaction.updatePointer(event, event, element, true)
+
+  interaction._doPhase(signalArg)
+
+  const reflowPromise = (win.window as unknown as any).Promise
+    ? new (win.window as unknown as any).Promise((resolve: any) => {
+      interaction._reflowResolve = resolve
+    })
+    : null
+
+  interaction._reflowPromise = reflowPromise
+  interaction.start(action, interactable, element)
+
+  if (interaction._interacting) {
+    interaction.move(signalArg)
+    interaction.end(event)
+  }
+  else {
+    interaction.stop()
+  }
+
+  interaction.removePointer(event, event)
+  interaction.pointerIsDown = false
+
+  return reflowPromise
+}
+
+export default {
+  id: 'reflow',
+  install,
+  listeners: {
+    // remove completed reflow interactions
+    'interactions:stop': ({ interaction }, scope) => {
+      if (interaction.pointerType === 'reflow') {
+        if (interaction._reflowResolve) {
+          interaction._reflowResolve()
+        }
+
+        arr.remove(scope.interactions.list, interaction)
+      }
+    },
+  },
+} as Interact.Plugin
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/DropEvent.html b/interactjs/dist/api/DropEvent.html new file mode 100644 index 000000000..e0f2e46f0 --- /dev/null +++ b/interactjs/dist/api/DropEvent.html @@ -0,0 +1,262 @@ + + + + + + DropEvent - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

DropEvent

+ + + + + + + +
+ +
+ +

+ DropEvent +

+ + +
+ +
+
+ + +
+ + + +

new DropEvent()

+ + + + + +
+

Class of events fired on dropzones during drags with acceptable targets.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + +

Methods

+ + + +
+ + + +

reject()

+ + + + + +
+

If this is a dropactivate event, the dropzone element will be +deactivated.

+

If this is a dragmove or dragenter, a dragleave will be fired on the +dropzone element and more.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/InteractEvent_InteractEvent.html b/interactjs/dist/api/InteractEvent_InteractEvent.html new file mode 100644 index 000000000..13863221b --- /dev/null +++ b/interactjs/dist/api/InteractEvent_InteractEvent.html @@ -0,0 +1,167 @@ + + + + + + InteractEvent - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

InteractEvent

+ + + + + + + +
+ +
+ +

+ InteractEvent +

+ + +
+ +
+
+ + +
+ + + +

new InteractEvent()

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/Interactable.html b/interactjs/dist/api/Interactable.html new file mode 100644 index 000000000..baff294a6 --- /dev/null +++ b/interactjs/dist/api/Interactable.html @@ -0,0 +1,3477 @@ + + + + + + Interactable - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

Interactable

+ + + + + + + +
+ +
+ +

+ Interactable +

+ + +
+ +
+
+ + +
+ + + +

new Interactable()

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + +

Classes

+ +
+
Interactable
+
+
+ + + + + + + +

Members

+ + + +
+

actionChecker

+ + + + +
+
interact('.resize-drag')
+  .resizable(true)
+  .draggable(true)
+  .actionChecker(function (pointer, event, action, interactable, element, interaction) {
+
+  if (interact.matchesSelector(event.target, '.drag-handle')) {
+    // force drag with handle target
+    action.name = drag
+  }
+  else {
+    // resize from the top and right edges
+    action.name  = 'resize'
+    action.edges = { top: true, right: true }
+  }
+
+  return action
+})
+
+

Returns or sets the function used to check action to be performed on +pointerDown

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

allowFrom

+ + + + + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • A drag/resize/gesture is started only If the target of the `mousedown`, +`pointerdown` or `touchstart` event or any of it's parents match the given +CSS selector or Element. + +Don't use this method. Instead set the `allowFrom` option for each action +or for `pointerEvents`
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +
interact(targett)
+  .resizable({
+    allowFrom: '.resize-handle',
+  .pointerEvents({
+    allowFrom: '.handle',,
+  })
+ + +
+ + + +
+

ignoreFrom

+ + + + +
+
interact(element, { ignoreFrom: document.getElementById('no-action') })
+// or
+interact(element).ignoreFrom('input, textarea, a')
+
+
+ + + + + +
+ + + + + + + + + + + + + + + + +
Deprecated:
  • If the target of the `mousedown`, `pointerdown` or `touchstart` event or any +of it's parents match the given CSS selector or Element, no +drag/resize/gesture is started. + +Don't use this method. Instead set the `ignoreFrom` option for each action +or for `pointerEvents`
+ + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +
interact(targett)
+  .draggable({
+    ignoreFrom: 'input, textarea, a[href]'',
+  })
+  .pointerEvents({
+    ignoreFrom: '[no-pointer]',
+  })
+ + +
+ + + +
+

preventDefault

+ + + + +
+

Returns or sets whether to prevent the browser's default behaviour in +response to pointer events. Can be set to:

+
    +
  • 'always' to always prevent
  • +
  • 'never' to never prevent
  • +
  • 'auto' to let interact.js try to determine what would be best
  • +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

styleCursor

+ + + + +
+

Returns or sets whether the the cursor should be changed depending on the +action that would be performed if the mouse were pressed and dragged.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + + + +

Methods

+ + + +
+ + + +

context() → {Node}

+ + + + + +
+

Gets the selector context Node of the Interactable. The default is +window.document.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Node + + +
+
+ + +
+

The context Node of this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

deltaSource(newValueopt) → {string|object}

+ + + + + +
+

Returns or sets the mouse coordinate types used to calculate the +movement of the pointer.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
newValue + + +string + + + + + + <optional>
+ + + + + +
+

Use 'client' if you will be scrolling while +interacting; Use 'page' if you want autoScroll to work

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +string +| + +object + + +
+
+ + +
+

The current deltaSource or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

draggable(optionsopt) → {boolean|Interactable}

+ + + + + +
+
interact(element).draggable({
+    onstart: function (event) {},
+    onmove : function (event) {},
+    onend  : function (event) {},
+
+    // the axis in which the first movement must be
+    // for the drag sequence to start
+    // 'xy' by default - any direction
+    startAxis: 'x' || 'y' || 'xy',
+
+    // 'xy' by default - don't restrict to one axis (move in any direction)
+    // 'x' or 'y' to restrict movement to either axis
+    // 'start' to restrict movement to the axis the drag started in
+    lockAxis: 'x' || 'y' || 'xy' || 'start',
+
+    // max number of drags that can happen concurrently
+    // with elements of this Interactable. Infinity by default
+    max: Infinity,
+
+    // max number of drags that can target the same element+Interactable
+    // 1 by default
+    maxPerElement: 2
+})
+
+var isDraggable = interact('element').draggable(); // true
+
+

Get or set whether drag actions can be performed on the target

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +boolean +| + +object + + + + + + <optional>
+ + + + + +
+

true/false or An object with event +listeners to be fired on drag events (object makes the Interactable +draggable)

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean +| + +Interactable + + +
+
+ + +
+

boolean indicating if this can be the +target of drag events, or this Interctable

+
+ + +
+ + + +
+ + + +
+ + + +

dropCheck()

+ + + + + +
+
interact(target)
+.dropChecker(function(dragEvent,         // related dragmove or dragend event
+                      event,             // TouchEvent/PointerEvent/MouseEvent
+                      dropped,           // bool result of the default checker
+                      dropzone,          // dropzone Interactable
+                      dropElement,       // dropzone elemnt
+                      draggable,         // draggable Interactable
+                      draggableElement) {// draggable element
+
+  return dropped && event.target.hasAttribute('allow-drop')
+}
+
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +

dropzone(optionsopt) → {boolean|Interactable}

+ + + + + +
+
interact('.drop').dropzone({
+  accept: '.can-drop' || document.getElementById('single-drop'),
+  overlap: 'pointer' || 'center' || zeroToOne
+}
+
+

Returns or sets whether draggables can be dropped onto this target to +trigger drop events

+

Dropzones can receive the following events:

+
    +
  • dropactivate and dropdeactivate when an acceptable drag starts and ends
  • +
  • dragenter and dragleave when a draggable enters and leaves the dropzone
  • +
  • dragmove when a draggable that has entered the dropzone is moved
  • +
  • drop when a draggable is dropped into this dropzone
  • +
+

Use the accept option to allow only elements that match the given CSS +selector or element. The value can be:

+
    +
  • an Element - only that element can be dropped into this dropzone.
  • +
  • a string, - the element being dragged must match it as a CSS selector.
  • +
  • null - accept options is cleared - it accepts any element.
  • +
+

Use the overlap option to set how drops are checked for. The allowed +values are:

+
    +
  • 'pointer', the pointer must be over the dropzone (default)
  • +
  • 'center', the draggable element's center must be over the dropzone
  • +
  • a number from 0-1 which is the (intersection area) / (draggable area). +e.g. 0.5 for drop to happen when half of the area of the draggable is +over the dropzone
  • +
+

Use the checker option to specify a function to check if a dragged element +is over this Interactable.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +boolean +| + +object +| + +null + + + + + + <optional>
+ + + + + +
+

The new options to be set.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean +| + +Interactable + + +
+
+ + +
+

The current setting or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

fire(iEvent) → {Interactable}

+ + + + + +
+

Calls listeners for the given InteractEvent type bound globally +and directly to this Interactable

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
iEvent + + +InteractEvent + + + + +

The InteractEvent object to be fired on this +Interactable

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Interactable + + +
+
+ + +
+

this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

gesturable(optionsopt) → {boolean|Interactable}

+ + + + + +
+
interact(element).gesturable({
+    onstart: function (event) {},
+    onmove : function (event) {},
+    onend  : function (event) {},
+
+    // limit multiple gestures.
+    // See the explanation in Interactable.draggable example
+    max: Infinity,
+    maxPerElement: 1,
+})
+
+var isGestureable = interact(element).gesturable()
+
+

Gets or sets whether multitouch gestures can be performed on the target

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +boolean +| + +object + + + + + + <optional>
+ + + + + +
+

true/false or An object with event +listeners to be fired on gesture events (makes the Interactable gesturable)

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean +| + +Interactable + + +
+
+ + +
+

A boolean indicating if this can be the +target of gesture events, or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

getRect(elementopt) → {object}

+ + + + + +
+

The default function to get an Interactables bounding rect. Can be +overridden using Interactable.rectChecker.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
element + + +Element + + + + + + <optional>
+ + + + + +
+

The element to measure.

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +object + + +
+
+ + +
+

The object's bounding rectangle.

+
+ + +
+ + + +
+ + + +
+ + + +

off(types, listeneropt, optionsopt) → {Interactable}

+ + + + + +
+

Removes an InteractEvent, pointerEvent or DOM event listener.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
types + + +string +| + +array +| + +object + + + + + + + + + + +

The types of events that were +listened for

+ +
listener + + +function +| + +array +| + +object + + + + + + <optional>
+ + + + + +
+

The event listener function(s)

+ +
options + + +object +| + +boolean + + + + + + <optional>
+ + + + + +
+

options object or useCapture flag for +removeEventListener

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Interactable + + +
+
+ + +
+

This Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

on(types, listeneropt, optionsopt) → {Interactable}

+ + + + + +
+

Binds a listener for an InteractEvent, pointerEvent or DOM event.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
types + + +string +| + +array +| + +object + + + + + + + + + + +

The types of events to listen +for

+ +
listener + + +function +| + +array +| + +object + + + + + + <optional>
+ + + + + +
+

The event listener function(s)

+ +
options + + +object +| + +boolean + + + + + + <optional>
+ + + + + +
+

options object or useCapture flag for +addEventListener

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Interactable + + +
+
+ + +
+

This Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

origin(originopt) → {object}

+ + + + + +
+

Gets or sets the origin of the Interactable's element. The x and y +of the origin will be subtracted from action event coordinates.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
origin + + +Element +| + +object +| + +string + + + + + + <optional>
+ + + + + +
+

An HTML or SVG Element whose +rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self' +or any CSS selector

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +object + + +
+
+ + +
+

The current origin or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

rectChecker(checkeropt) → {function|object}

+ + + + + +
+

Returns or sets the function used to calculate the interactable's +element's rectangle

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
checker + + +function + + + + + + <optional>
+ + + + + +
+

A function which returns this Interactable's +bounding rectangle. See Interactable.getRect

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +function +| + +object + + +
+
+ + +
+

The checker function or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

reflow(action) → {Promise}

+ + + + + +
+
const interactable = interact(target)
+const drag = { name: drag, axis: 'x' }
+const resize = { name: resize, edges: { left: true, bottom: true }
+
+interactable.reflow(drag)
+interactable.reflow(resize)
+
+

Start an action sequence to re-apply modifiers, check drops, etc.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
action + + +Object + + + + +

The action to begin

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + + +string + + + + +

The name of the action

+ +
+ + +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +Promise + + +
+
+ + +
+

A promise that resolves to the Interactable when actions on all targets have ended

+
+ + +
+ + + +
+ + + +
+ + + +

resizable(optionsopt) → {boolean|Interactable}

+ + + + + +
+
interact(element).resizable({
+  onstart: function (event) {},
+  onmove : function (event) {},
+  onend  : function (event) {},
+
+  edges: {
+    top   : true,       // Use pointer coords to check for resize.
+    left  : false,      // Disable resizing from left edge.
+    bottom: '.resize-s',// Resize if pointer target matches selector
+    right : handleEl    // Resize if pointer target is the given Element
+  },
+
+    // Width and height can be adjusted independently. When `true`, width and
+    // height are adjusted at a 1:1 ratio.
+    square: false,
+
+    // Width and height can be adjusted independently. When `true`, width and
+    // height maintain the aspect ratio they had when resizing started.
+    preserveAspectRatio: false,
+
+  // a value of 'none' will limit the resize rect to a minimum of 0x0
+  // 'negate' will allow the rect to have negative width/height
+  // 'reposition' will keep the width/height positive by swapping
+  // the top and bottom edges and/or swapping the left and right edges
+  invert: 'none' || 'negate' || 'reposition'
+
+  // limit multiple resizes.
+  // See the explanation in the Interactable.draggable example
+  max: Infinity,
+  maxPerElement: 1,
+})
+
+var isResizeable = interact(element).resizable()
+
+

Gets or sets whether resize actions can be performed on the target

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
options + + +boolean +| + +object + + + + + + <optional>
+ + + + + +
+

true/false or An object with event +listeners to be fired on resize events (object makes the Interactable +resizable)

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +boolean +| + +Interactable + + +
+
+ + +
+

A boolean indicating if this can be the +target of resize elements, or this Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

set(options) → {object}

+ + + + + +
+

Reset the options of this Interactable

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
options + + +object + + + + +

The new settings to apply

+ +
+ + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +object + + +
+
+ + +
+

This Interactable

+
+ + +
+ + + +
+ + + +
+ + + +

unset() → {interact}

+ + + + + +
+

Remove this interactable from the list of interactables and remove it's +action capabilities and event listeners

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
+
Returns:
+ + + +
+
+ Type: +
+
+ +interact + + +
+
+ + + +
+ + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/Interaction_Interaction.html b/interactjs/dist/api/Interaction_Interaction.html new file mode 100644 index 000000000..c729760d8 --- /dev/null +++ b/interactjs/dist/api/Interaction_Interaction.html @@ -0,0 +1,167 @@ + + + + + + Interaction - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

Interaction

+ + + + + + + +
+ +
+ +

+ Interaction +

+ + +
+ +
+
+ + +
+ + + +

new Interaction()

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/doclets.json b/interactjs/dist/api/doclets.json new file mode 100644 index 000000000..a53f20691 --- /dev/null +++ b/interactjs/dist/api/doclets.json @@ -0,0 +1 @@ +[{"comment":"/** @article /home/travis/build/taye/interact.js/jsdoc/index.md **/","meta":{"filename":"index.md","lineno":1,"columnno":0,"path":"","code":{},"shortpath":"jsdoc/index.md"},"kind":"article","source":"\n\n","name":"index","filename":"index.md","title":"API Reference","longname":"article:index","description":"

","outfilename":"index.html","scope":"global","___id":"T000002R003587","___s":true,"attribs":"","id":"index","ancestors":[]},{"comment":"/**\n * Don't call listeners on the remaining targets\n */","meta":{"range":[460,563],"filename":"BaseEvent.ts","lineno":30,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100007774","name":"BaseEvent#stopImmediatePropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/BaseEvent.ts"},"description":"

Don't call listeners on the remaining targets

","name":"stopImmediatePropagation","longname":"BaseEvent#stopImmediatePropagation","kind":"function","memberof":"BaseEvent","scope":"instance","params":[],"___id":"T000002R000861","___s":true,"attribs":"","id":"stopImmediatePropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Don't call any other listeners (even on the current target)\n */","meta":{"range":[333,392],"filename":"BaseEvent.ts","lineno":23,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100007764","name":"BaseEvent#stopPropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/BaseEvent.ts"},"description":"

Don't call any other listeners (even on the current target)

","name":"stopPropagation","longname":"BaseEvent#stopPropagation","kind":"function","memberof":"BaseEvent","scope":"instance","params":[],"___id":"T000002R000859","___s":true,"attribs":"","id":"stopPropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Class of events fired on dropzones during drags with acceptable targets.\n */","meta":{"range":[297,757],"filename":"DropEvent.ts","lineno":16,"columnno":2,"path":"../@interactjs/actions/drop","code":{"id":"astnode100000545","name":"DropEvent","type":"MethodDefinition","paramnames":["dropState","dragEvent","type"]},"vars":{"":null},"shortpath":"@interactjs/actions/drop/DropEvent.ts"},"description":"

Class of events fired on dropzones during drags with acceptable targets.

","name":"DropEvent","longname":"DropEvent","kind":"class","scope":"global","params":[],"___id":"T000003R000002","___s":true,"attribs":"","id":"DropEvent","signature":"()","ancestors":[]},{"comment":"/**\n * If this is a `dropactivate` event, the dropzone element will be\n * deactivated.\n *\n * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the\n * dropzone element and more.\n */","meta":{"range":[978,2017],"filename":"DropEvent.ts","lineno":36,"columnno":2,"path":"../@interactjs/actions/drop","code":{"id":"astnode100000629","name":"DropEvent#reject","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/actions/drop/DropEvent.ts"},"description":"

If this is a dropactivate event, the dropzone element will be\ndeactivated.

\n

If this is a dragmove or dragenter, a dragleave will be fired on the\ndropzone element and more.

","name":"reject","longname":"DropEvent#reject","kind":"function","memberof":"DropEvent","scope":"instance","params":[],"___id":"T000002R000071","___s":true,"attribs":"","id":"reject","signature":"()","ancestors":["DropEvent#"]},{"comment":"/**\n * ```js\n * interact('#draggable').draggable(true)\n *\n * var rectables = interact('rect')\n * rectables\n * .gesturable(true)\n * .on('gesturemove', function (event) {\n * // ...\n * })\n * ```\n *\n * The methods of this variable can be used to set elements as interactables\n * and also to change various default settings.\n *\n * Calling it as a function and passing an element or a valid CSS selector\n * string returns an Interactable object which has various methods to configure\n * it.\n *\n * @global\n *\n * @param {Element | string} target The HTML or SVG Element to interact with\n * or CSS selector\n * @return {Interactable}\n */","meta":{"range":[929,1215],"filename":"interact.ts","lineno":44,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100016931","name":"exports.interact","type":"VariableDeclaration"},"shortpath":"@interactjs/interact/interact.ts"},"description":"
interact('#draggable').draggable(true)\n\nvar rectables = interact('rect')\nrectables\n  .gesturable(true)\n  .on('gesturemove', function (event) {\n      // ...\n  })\n
\n

The methods of this variable can be used to set elements as interactables\nand also to change various default settings.

\n

Calling it as a function and passing an element or a valid CSS selector\nstring returns an Interactable object which has various methods to configure\nit.

","scope":"global","params":[{"type":{"names":["Element","string"]},"description":"

The HTML or SVG Element to interact with\nor CSS selector

","name":"target"}],"returns":[{"type":{"names":["Interactable"]}}],"name":"interact","longname":"interact","kind":"member","___id":"T000002R001839","___s":true,"attribs":"(constant) ","id":"interact","ancestors":[],"signature":""},{"comment":"/**\n * Returns or sets whether the dimensions of dropzone elements are calculated\n * on every dragmove or only on dragstart for the default dropChecker\n *\n * @param {boolean} [newValue] True to check on each move. False to check only\n * before start\n * @return {boolean | interact} The current setting or interact\n */","meta":{"range":[3523,3816],"filename":"index.ts","lineno":153,"columnno":2,"path":"../@interactjs/actions/drop","code":{"id":"astnode100000924","name":"interact.dynamicDrop","type":"FunctionExpression","paramnames":["newValue"]},"vars":{"scope.dynamicDrop":"scope.dynamicDrop"},"shortpath":"@interactjs/actions/drop/index.ts"},"description":"

Returns or sets whether the dimensions of dropzone elements are calculated\non every dragmove or only on dragstart for the default dropChecker

","params":[{"type":{"names":["boolean"]},"optional":true,"description":"

True to check on each move. False to check only\nbefore start

","name":"newValue"}],"returns":[{"type":{"names":["boolean","interact"]},"description":"

The current setting or interact

"}],"name":"dynamicDrop","longname":"interact.dynamicDrop","kind":"function","memberof":"interact","scope":"static","___id":"T000002R000098","___s":true,"attribs":"(static) ","id":".dynamicDrop","signature":"(newValueopt) → {boolean|interact}","ancestors":["interact."]},{"comment":"/** */","meta":{"range":[761,1061],"filename":"Interactable.ts","lineno":26,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008110","name":"exports.Interactable","type":"MethodDefinition","paramnames":["target","options","defaultContext"]},"shortpath":"@interactjs/core/Interactable.ts"},"name":"Interactable","longname":"Interactable","kind":"class","memberof":"Interactable","scope":"instance","___id":"T000003R000003","___s":true,"attribs":"","id":"Interactable","signature":"()","ancestors":[]},{"comment":"/**\n * ```js\n * interact('.resize-drag')\n * .resizable(true)\n * .draggable(true)\n * .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n *\n * if (interact.matchesSelector(event.target, '.drag-handle')) {\n * // force drag with handle target\n * action.name = drag\n * }\n * else {\n * // resize from the top and right edges\n * action.name = 'resize'\n * action.edges = { top: true, right: true }\n * }\n *\n * return action\n * })\n * ```\n *\n * Returns or sets the function used to check action to be performed on\n * pointerDown\n *\n * @param {function | null} [checker] A function which takes a pointer event,\n * defaultAction string, interactable, element and interaction as parameters\n * and returns an object with name property 'drag' 'resize' or 'gesture' and\n * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right\n * props.\n * @return {Function | Interactable} The checker function or this Interactable\n */","meta":{"range":[3745,3797],"filename":"InteractableMethods.ts","lineno":113,"columnno":2,"path":"../@interactjs/auto-start","code":{"id":"astnode100007563","name":"Interactable.prototype.actionChecker","type":"Identifier","value":"actionChecker","paramnames":[]},"shortpath":"@interactjs/auto-start/InteractableMethods.ts"},"description":"
interact('.resize-drag')\n  .resizable(true)\n  .draggable(true)\n  .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n\n  if (interact.matchesSelector(event.target, '.drag-handle')) {\n    // force drag with handle target\n    action.name = drag\n  }\n  else {\n    // resize from the top and right edges\n    action.name  = 'resize'\n    action.edges = { top: true, right: true }\n  }\n\n  return action\n})\n
\n

Returns or sets the function used to check action to be performed on\npointerDown

","params":[{"type":{"names":["function","null"]},"optional":true,"description":"

A function which takes a pointer event,\ndefaultAction string, interactable, element and interaction as parameters\nand returns an object with name property 'drag' 'resize' or 'gesture' and\noptionally an edges object with boolean 'top', 'left', 'bottom' and right\nprops.

","name":"checker"}],"returns":[{"type":{"names":["function","Interactable"]},"description":"

The checker function or this Interactable

"}],"name":"actionChecker","longname":"Interactable#actionChecker","kind":"member","memberof":"Interactable","scope":"instance","___id":"T000002R000828","___s":true,"attribs":"","id":"actionChecker","ancestors":["#Interactable#"],"signature":""},{"comment":"/**\n * @deprecated\n *\n * A drag/resize/gesture is started only If the target of the `mousedown`,\n * `pointerdown` or `touchstart` event or any of it's parents match the given\n * CSS selector or Element.\n *\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to allow from any element\n * @return {string | Element | object} The current allowFrom value or this\n * Interactable\n */","meta":{"range":[2454,2681],"filename":"InteractableMethods.ts","lineno":86,"columnno":2,"path":"../@interactjs/auto-start","code":{"id":"astnode100007543","name":"Interactable.prototype.allowFrom","type":"CallExpression","value":"","paramnames":[]},"shortpath":"@interactjs/auto-start/InteractableMethods.ts"},"deprecated":"A drag/resize/gesture is started only If the target of the `mousedown`,\n`pointerdown` or `touchstart` event or any of it's parents match the given\nCSS selector or Element.\n\nDon't use this method. Instead set the `allowFrom` option for each action\nor for `pointerEvents`","examples":[{"caption":"","code":"interact(targett)\n .resizable({\n allowFrom: '.resize-handle',\n .pointerEvents({\n allowFrom: '.handle',,\n })"}],"params":[{"type":{"names":["string","Element","null"]},"optional":true,"description":"

a CSS selector string, an\nElement or null to allow from any element

","name":"newValue"}],"returns":[{"type":{"names":["string","Element","object"]},"description":"

The current allowFrom value or this\nInteractable

"}],"name":"allowFrom","longname":"Interactable#allowFrom","kind":"member","memberof":"Interactable","scope":"instance","___id":"T000002R000827","___s":true,"attribs":"","id":"allowFrom","ancestors":["#Interactable#"],"signature":""},{"comment":"/**\n * Gets the selector context Node of the Interactable. The default is\n * `window.document`.\n *\n * @return {Node} The context Node of this Interactable\n */","meta":{"range":[5762,5803],"filename":"Interactable.ts","lineno":194,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008644","name":"Interactable#context","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Gets the selector context Node of the Interactable. The default is\nwindow.document.

","returns":[{"type":{"names":["Node"]},"description":"

The context Node of this Interactable

"}],"name":"context","longname":"Interactable#context","kind":"function","memberof":"Interactable","scope":"instance","params":[],"___id":"T000002R000939","___s":true,"attribs":"","id":"context","signature":"() → {Node}","ancestors":["#Interactable#"]},{"comment":"/**\n * Returns or sets the mouse coordinate types used to calculate the\n * movement of the pointer.\n *\n * @param {string} [newValue] Use 'client' if you will be scrolling while\n * interacting; Use 'page' if you want autoScroll to work\n * @return {string | object} The current deltaSource or this Interactable\n */","meta":{"range":[5397,5586],"filename":"Interactable.ts","lineno":176,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008614","name":"Interactable#deltaSource","type":"MethodDefinition","paramnames":["newValue"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Returns or sets the mouse coordinate types used to calculate the\nmovement of the pointer.

","params":[{"type":{"names":["string"]},"optional":true,"description":"

Use 'client' if you will be scrolling while\ninteracting; Use 'page' if you want autoScroll to work

","name":"newValue"}],"returns":[{"type":{"names":["string","object"]},"description":"

The current deltaSource or this Interactable

"}],"name":"deltaSource","longname":"Interactable#deltaSource","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000937","___s":true,"attribs":"","id":"deltaSource","signature":"(newValueopt) → {string|object}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * interact(element).draggable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // the axis in which the first movement must be\n * // for the drag sequence to start\n * // 'xy' by default - any direction\n * startAxis: 'x' || 'y' || 'xy',\n *\n * // 'xy' by default - don't restrict to one axis (move in any direction)\n * // 'x' or 'y' to restrict movement to either axis\n * // 'start' to restrict movement to the axis the drag started in\n * lockAxis: 'x' || 'y' || 'xy' || 'start',\n *\n * // max number of drags that can happen concurrently\n * // with elements of this Interactable. Infinity by default\n * max: Infinity,\n *\n * // max number of drags that can target the same element+Interactable\n * // 1 by default\n * maxPerElement: 2\n * })\n *\n * var isDraggable = interact('element').draggable(); // true\n * ```\n *\n * Get or set whether drag actions can be performed on the target\n *\n * @alias Interactable.prototype.draggable\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on drag events (object makes the Interactable\n * draggable)\n * @return {boolean | Interactable} boolean indicating if this can be the\n * target of drag events, or this Interctable\n */","meta":{"range":[2745,3317],"filename":"drag.ts","lineno":76,"columnno":6,"path":"../@interactjs/actions","code":{"id":"astnode100000303","name":"draggable","type":"FunctionExpression","value":"draggable"},"vars":{"this.options.drag.enabled":"Interactable#draggable#options.drag.enabled","this.options.drag.lockAxis":"Interactable#draggable#options.drag.lockAxis","this.options.drag.startAxis":"Interactable#draggable#options.drag.startAxis"},"shortpath":"@interactjs/actions/drag.ts"},"description":"
interact(element).draggable({\n    onstart: function (event) {},\n    onmove : function (event) {},\n    onend  : function (event) {},\n\n    // the axis in which the first movement must be\n    // for the drag sequence to start\n    // 'xy' by default - any direction\n    startAxis: 'x' || 'y' || 'xy',\n\n    // 'xy' by default - don't restrict to one axis (move in any direction)\n    // 'x' or 'y' to restrict movement to either axis\n    // 'start' to restrict movement to the axis the drag started in\n    lockAxis: 'x' || 'y' || 'xy' || 'start',\n\n    // max number of drags that can happen concurrently\n    // with elements of this Interactable. Infinity by default\n    max: Infinity,\n\n    // max number of drags that can target the same element+Interactable\n    // 1 by default\n    maxPerElement: 2\n})\n\nvar isDraggable = interact('element').draggable(); // true\n
\n

Get or set whether drag actions can be performed on the target

","alias":"Interactable.prototype.draggable","params":[{"type":{"names":["boolean","object"]},"optional":true,"description":"

true/false or An object with event\nlisteners to be fired on drag events (object makes the Interactable\ndraggable)

","name":"options"}],"returns":[{"type":{"names":["boolean","Interactable"]},"description":"

boolean indicating if this can be the\ntarget of drag events, or this Interctable

"}],"name":"draggable","longname":"Interactable#draggable","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000029","___s":true,"attribs":"","id":"draggable","signature":"(optionsopt) → {boolean|Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * interact(target)\n * .dropChecker(function(dragEvent, // related dragmove or dragend event\n * event, // TouchEvent/PointerEvent/MouseEvent\n * dropped, // bool result of the default checker\n * dropzone, // dropzone Interactable\n * dropElement, // dropzone elemnt\n * draggable, // draggable Interactable\n * draggableElement) {// draggable element\n *\n * return dropped && event.target.hasAttribute('allow-drop')\n * }\n * ```\n */","meta":{"range":[2967,3183],"filename":"index.ts","lineno":134,"columnno":2,"path":"../@interactjs/actions/drop","code":{"id":"astnode100000899","name":"Interactable.prototype.dropCheck","type":"FunctionExpression","paramnames":["dragEvent","event","draggable","draggableElement","dropElement","rect"]},"shortpath":"@interactjs/actions/drop/index.ts"},"description":"
interact(target)\n.dropChecker(function(dragEvent,         // related dragmove or dragend event\n                      event,             // TouchEvent/PointerEvent/MouseEvent\n                      dropped,           // bool result of the default checker\n                      dropzone,          // dropzone Interactable\n                      dropElement,       // dropzone elemnt\n                      draggable,         // draggable Interactable\n                      draggableElement) {// draggable element\n\n  return dropped && event.target.hasAttribute('allow-drop')\n}\n
","name":"dropCheck","longname":"Interactable#dropCheck","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000097","___s":true,"attribs":"","id":"dropCheck","signature":"()","ancestors":["#Interactable#"]},{"comment":"/**\n *\n * ```js\n * interact('.drop').dropzone({\n * accept: '.can-drop' || document.getElementById('single-drop'),\n * overlap: 'pointer' || 'center' || zeroToOne\n * }\n * ```\n *\n * Returns or sets whether draggables can be dropped onto this target to\n * trigger drop events\n *\n * Dropzones can receive the following events:\n * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends\n * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone\n * - `dragmove` when a draggable that has entered the dropzone is moved\n * - `drop` when a draggable is dropped into this dropzone\n *\n * Use the `accept` option to allow only elements that match the given CSS\n * selector or element. The value can be:\n *\n * - **an Element** - only that element can be dropped into this dropzone.\n * - **a string**, - the element being dragged must match it as a CSS selector.\n * - **`null`** - accept options is cleared - it accepts any element.\n *\n * Use the `overlap` option to set how drops are checked for. The allowed\n * values are:\n *\n * - `'pointer'`, the pointer must be over the dropzone (default)\n * - `'center'`, the draggable element's center must be over the dropzone\n * - a number from 0-1 which is the `(intersection area) / (draggable area)`.\n * e.g. `0.5` for drop to happen when half of the area of the draggable is\n * over the dropzone\n *\n * Use the `checker` option to specify a function to check if a dragged element\n * is over this Interactable.\n *\n * @param {boolean | object | null} [options] The new options to be set.\n * @return {boolean | Interactable} The current setting or this Interactable\n */","meta":{"range":[2204,2304],"filename":"index.ts","lineno":90,"columnno":2,"path":"../@interactjs/actions/drop","code":{"id":"astnode100000884","name":"Interactable.prototype.dropzone","type":"FunctionExpression","paramnames":["options"]},"shortpath":"@interactjs/actions/drop/index.ts"},"description":"
interact('.drop').dropzone({\n  accept: '.can-drop' || document.getElementById('single-drop'),\n  overlap: 'pointer' || 'center' || zeroToOne\n}\n
\n

Returns or sets whether draggables can be dropped onto this target to\ntrigger drop events

\n

Dropzones can receive the following events:

\n
    \n
  • dropactivate and dropdeactivate when an acceptable drag starts and ends
  • \n
  • dragenter and dragleave when a draggable enters and leaves the dropzone
  • \n
  • dragmove when a draggable that has entered the dropzone is moved
  • \n
  • drop when a draggable is dropped into this dropzone
  • \n
\n

Use the accept option to allow only elements that match the given CSS\nselector or element. The value can be:

\n
    \n
  • an Element - only that element can be dropped into this dropzone.
  • \n
  • a string, - the element being dragged must match it as a CSS selector.
  • \n
  • null - accept options is cleared - it accepts any element.
  • \n
\n

Use the overlap option to set how drops are checked for. The allowed\nvalues are:

\n
    \n
  • 'pointer', the pointer must be over the dropzone (default)
  • \n
  • 'center', the draggable element's center must be over the dropzone
  • \n
  • a number from 0-1 which is the (intersection area) / (draggable area).\ne.g. 0.5 for drop to happen when half of the area of the draggable is\nover the dropzone
  • \n
\n

Use the checker option to specify a function to check if a dragged element\nis over this Interactable.

","params":[{"type":{"names":["boolean","object","null"]},"optional":true,"description":"

The new options to be set.

","name":"options"}],"returns":[{"type":{"names":["boolean","Interactable"]},"description":"

The current setting or this Interactable

"}],"name":"dropzone","longname":"Interactable#dropzone","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000096","___s":true,"attribs":"","id":"dropzone","signature":"(optionsopt) → {boolean|Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * Calls listeners for the given InteractEvent type bound globally\n * and directly to this Interactable\n *\n * @param {InteractEvent} iEvent The InteractEvent object to be fired on this\n * Interactable\n * @return {Interactable} this Interactable\n */","meta":{"range":[7085,7150],"filename":"Interactable.ts","lineno":257,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008797","name":"Interactable#fire","type":"MethodDefinition","paramnames":["iEvent"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Calls listeners for the given InteractEvent type bound globally\nand directly to this Interactable

","params":[{"type":{"names":["InteractEvent"]},"description":"

The InteractEvent object to be fired on this\nInteractable

","name":"iEvent"}],"returns":[{"type":{"names":["Interactable"]},"description":"

this Interactable

"}],"name":"fire","longname":"Interactable#fire","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000944","___s":true,"attribs":"","id":"fire","signature":"(iEvent) → {Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * interact(element).gesturable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // limit multiple gestures.\n * // See the explanation in {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isGestureable = interact(element).gesturable()\n * ```\n *\n * Gets or sets whether multitouch gestures can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on gesture events (makes the Interactable gesturable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of gesture events, or this Interactable\n */","meta":{"range":[942,1356],"filename":"gesture.ts","lineno":57,"columnno":2,"path":"../@interactjs/actions","code":{"id":"astnode100002843","name":"Interactable.prototype.gesturable","type":"FunctionExpression","paramnames":["options"]},"vars":{"this.options.gesture.enabled":"Interactable#gesturable#options.gesture.enabled"},"shortpath":"@interactjs/actions/gesture.ts"},"description":"
interact(element).gesturable({\n    onstart: function (event) {},\n    onmove : function (event) {},\n    onend  : function (event) {},\n\n    // limit multiple gestures.\n    // See the explanation in {@link Interactable.draggable} example\n    max: Infinity,\n    maxPerElement: 1,\n})\n\nvar isGestureable = interact(element).gesturable()\n
\n

Gets or sets whether multitouch gestures can be performed on the target

","params":[{"type":{"names":["boolean","object"]},"optional":true,"description":"

true/false or An object with event\nlisteners to be fired on gesture events (makes the Interactable gesturable)

","name":"options"}],"returns":[{"type":{"names":["boolean","Interactable"]},"description":"

A boolean indicating if this can be the\ntarget of gesture events, or this Interactable

"}],"name":"gesturable","longname":"Interactable#gesturable","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000282","___s":true,"attribs":"","id":"gesturable","signature":"(optionsopt) → {boolean|Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * The default function to get an Interactables bounding rect. Can be\n * overridden using {@link Interactable.rectChecker}.\n *\n * @param {Element} [element] The element to measure.\n * @return {object} The object's bounding rectangle.\n */","meta":{"range":[3463,3705],"filename":"Interactable.ts","lineno":105,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008464","name":"Interactable#getRect","type":"MethodDefinition","paramnames":["element"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

The default function to get an Interactables bounding rect. Can be\noverridden using {@link Interactable.rectChecker}.

","params":[{"type":{"names":["Element"]},"optional":true,"description":"

The element to measure.

","name":"element"}],"returns":[{"type":{"names":["object"]},"description":"

The object's bounding rectangle.

"}],"name":"getRect","longname":"Interactable#getRect","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000927","___s":true,"attribs":"","id":"getRect","signature":"(elementopt) → {object}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * interact(element, { ignoreFrom: document.getElementById('no-action') })\n * // or\n * interact(element).ignoreFrom('input, textarea, a')\n * ```\n * @deprecated\n * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\n * of it's parents match the given CSS selector or Element, no\n * drag/resize/gesture is started.\n *\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to not ignore any elements\n * @return {string | Element | object} The current ignoreFrom value or this\n * Interactable\n */","meta":{"range":[1495,1726],"filename":"InteractableMethods.ts","lineno":54,"columnno":2,"path":"../@interactjs/auto-start","code":{"id":"astnode100007523","name":"Interactable.prototype.ignoreFrom","type":"CallExpression","value":"","paramnames":[]},"shortpath":"@interactjs/auto-start/InteractableMethods.ts"},"description":"
interact(element, { ignoreFrom: document.getElementById('no-action') })\n// or\ninteract(element).ignoreFrom('input, textarea, a')\n
","deprecated":"If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\nof it's parents match the given CSS selector or Element, no\ndrag/resize/gesture is started.\n\nDon't use this method. Instead set the `ignoreFrom` option for each action\nor for `pointerEvents`","examples":[{"caption":"","code":"interact(targett)\n .draggable({\n ignoreFrom: 'input, textarea, a[href]'',\n })\n .pointerEvents({\n ignoreFrom: '[no-pointer]',\n })"}],"params":[{"type":{"names":["string","Element","null"]},"optional":true,"description":"

a CSS selector string, an\nElement or null to not ignore any elements

","name":"newValue"}],"returns":[{"type":{"names":["string","Element","object"]},"description":"

The current ignoreFrom value or this\nInteractable

"}],"name":"ignoreFrom","longname":"Interactable#ignoreFrom","kind":"member","memberof":"Interactable","scope":"instance","___id":"T000002R000826","___s":true,"attribs":"","id":"ignoreFrom","ancestors":["#Interactable#"],"signature":""},{"comment":"/**\n * Removes an InteractEvent, pointerEvent or DOM event listener.\n *\n * @param {string | array | object} types The types of events that were\n * listened for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * removeEventListener\n * @return {Interactable} This Interactable\n */","meta":{"range":[9014,9106],"filename":"Interactable.ts","lineno":316,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008956","name":"Interactable#off","type":"MethodDefinition","paramnames":["types","listener","options"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Removes an InteractEvent, pointerEvent or DOM event listener.

","params":[{"type":{"names":["string","array","object"]},"description":"

The types of events that were\nlistened for

","name":"types"},{"type":{"names":["function","array","object"]},"optional":true,"description":"

The event listener function(s)

","name":"listener"},{"type":{"names":["object","boolean"]},"optional":true,"description":"

options object or useCapture flag for\nremoveEventListener

","name":"options"}],"returns":[{"type":{"names":["Interactable"]},"description":"

This Interactable

"}],"name":"off","longname":"Interactable#off","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000954","___s":true,"attribs":"","id":"off","signature":"(types, listeneropt, optionsopt) → {Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * Binds a listener for an InteractEvent, pointerEvent or DOM event.\n *\n * @param {string | array | object} types The types of events to listen\n * for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * addEventListener\n * @return {Interactable} This Interactable\n */","meta":{"range":[8511,8601],"filename":"Interactable.ts","lineno":302,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008940","name":"Interactable#on","type":"MethodDefinition","paramnames":["types","listener","options"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Binds a listener for an InteractEvent, pointerEvent or DOM event.

","params":[{"type":{"names":["string","array","object"]},"description":"

The types of events to listen\nfor

","name":"types"},{"type":{"names":["function","array","object"]},"optional":true,"description":"

The event listener function(s)

","name":"listener"},{"type":{"names":["object","boolean"]},"optional":true,"description":"

options object or useCapture flag for\naddEventListener

","name":"options"}],"returns":[{"type":{"names":["Interactable"]},"description":"

This Interactable

"}],"name":"on","longname":"Interactable#on","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000953","___s":true,"attribs":"","id":"on","signature":"(types, listeneropt, optionsopt) → {Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * Gets or sets the origin of the Interactable's element. The x and y\n * of the origin will be subtracted from action event coordinates.\n *\n * @param {Element | object | string} [origin] An HTML or SVG Element whose\n * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\n * or any CSS selector\n *\n * @return {object} The current origin or this Interactable\n */","meta":{"range":[4986,5063],"filename":"Interactable.ts","lineno":162,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008602","name":"Interactable#origin","type":"MethodDefinition","paramnames":["newValue"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Gets or sets the origin of the Interactable's element. The x and y\nof the origin will be subtracted from action event coordinates.

","params":[{"type":{"names":["Element","object","string"]},"optional":true,"description":"

An HTML or SVG Element whose\nrect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\nor any CSS selector

","name":"origin"}],"returns":[{"type":{"names":["object"]},"description":"

The current origin or this Interactable

"}],"name":"origin","longname":"Interactable#origin","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000936","___s":true,"attribs":"","id":"origin","signature":"(originopt) → {object}","ancestors":["#Interactable#"]},{"comment":"/**\n * Returns or sets whether to prevent the browser's default behaviour in\n * response to pointer events. Can be set to:\n * - `'always'` to always prevent\n * - `'never'` to never prevent\n * - `'auto'` to let interact.js try to determine what would be best\n *\n * @param {string} [newValue] `'always'`, `'never'` or `'auto'`\n * @return {string | Interactable} The current setting or this Interactable\n */","meta":{"range":[2356,2410],"filename":"interactablePreventDefault.ts","lineno":75,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100009423","name":"Interactable.prototype.preventDefault","type":"Identifier","value":"preventDefault","paramnames":[]},"shortpath":"@interactjs/core/interactablePreventDefault.ts"},"description":"

Returns or sets whether to prevent the browser's default behaviour in\nresponse to pointer events. Can be set to:

\n
    \n
  • 'always' to always prevent
  • \n
  • 'never' to never prevent
  • \n
  • 'auto' to let interact.js try to determine what would be best
  • \n
","params":[{"type":{"names":["string"]},"optional":true,"description":"

'always', 'never' or 'auto'

","name":"newValue"}],"returns":[{"type":{"names":["string","Interactable"]},"description":"

The current setting or this Interactable

"}],"name":"preventDefault","longname":"Interactable#preventDefault","kind":"member","memberof":"Interactable","scope":"instance","___id":"T000002R000982","___s":true,"attribs":"","id":"preventDefault","ancestors":["#Interactable#"],"signature":""},{"comment":"/**\n * Returns or sets the function used to calculate the interactable's\n * element's rectangle\n *\n * @param {function} [checker] A function which returns this Interactable's\n * bounding rectangle. See {@link Interactable.getRect}\n * @return {function | object} The checker function or this Interactable\n */","meta":{"range":[4034,4250],"filename":"Interactable.ts","lineno":124,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008513","name":"Interactable#rectChecker","type":"MethodDefinition","paramnames":["checker"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Returns or sets the function used to calculate the interactable's\nelement's rectangle

","params":[{"type":{"names":["function"]},"optional":true,"description":"

A function which returns this Interactable's\nbounding rectangle. See {@link Interactable.getRect}

","name":"checker"}],"returns":[{"type":{"names":["function","object"]},"description":"

The checker function or this Interactable

"}],"name":"rectChecker","longname":"Interactable#rectChecker","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000930","___s":true,"attribs":"","id":"rectChecker","signature":"(checkeropt) → {function|object}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * const interactable = interact(target)\n * const drag = { name: drag, axis: 'x' }\n * const resize = { name: resize, edges: { left: true, bottom: true }\n *\n * interactable.reflow(drag)\n * interactable.reflow(resize)\n * ```\n *\n * Start an action sequence to re-apply modifiers, check drops, etc.\n *\n * @param { Object } action The action to begin\n * @param { string } action.name The name of the action\n * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended\n */","meta":{"range":[973,1068],"filename":"index.ts","lineno":35,"columnno":2,"path":"../@interactjs/reflow","code":{"id":"astnode100024603","name":"Interactable.prototype.reflow","type":"FunctionExpression","paramnames":["action"]},"shortpath":"@interactjs/reflow/index.ts"},"description":"
const interactable = interact(target)\nconst drag = { name: drag, axis: 'x' }\nconst resize = { name: resize, edges: { left: true, bottom: true }\n\ninteractable.reflow(drag)\ninteractable.reflow(resize)\n
\n

Start an action sequence to re-apply modifiers, check drops, etc.

","params":[{"type":{"names":["Object"]},"description":"

The action to begin

","name":"action","subparams":[{"type":{"names":["string"]},"description":"

The name of the action

","name":"name"}]},null],"returns":[{"type":{"names":["Promise"]},"description":"

A promise that resolves to the Interactable when actions on all targets have ended

"}],"name":"reflow","longname":"Interactable#reflow","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R002849","___s":true,"attribs":"","id":"reflow","signature":"(action) → {Promise}","ancestors":["#Interactable#"]},{"comment":"/**\n * ```js\n * interact(element).resizable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * edges: {\n * top : true, // Use pointer coords to check for resize.\n * left : false, // Disable resizing from left edge.\n * bottom: '.resize-s',// Resize if pointer target matches selector\n * right : handleEl // Resize if pointer target is the given Element\n * },\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height are adjusted at a 1:1 ratio.\n * square: false,\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height maintain the aspect ratio they had when resizing started.\n * preserveAspectRatio: false,\n *\n * // a value of 'none' will limit the resize rect to a minimum of 0x0\n * // 'negate' will allow the rect to have negative width/height\n * // 'reposition' will keep the width/height positive by swapping\n * // the top and bottom edges and/or swapping the left and right edges\n * invert: 'none' || 'negate' || 'reposition'\n *\n * // limit multiple resizes.\n * // See the explanation in the {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isResizeable = interact(element).resizable()\n * ```\n *\n * Gets or sets whether resize actions can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on resize events (object makes the Interactable\n * resizable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of resize elements, or this Interactable\n */","meta":{"range":[2374,2477],"filename":"resize.ts","lineno":55,"columnno":2,"path":"../@interactjs/actions","code":{"id":"astnode100003504","name":"Interactable.prototype.resizable","type":"FunctionExpression","paramnames":["options"]},"shortpath":"@interactjs/actions/resize.ts"},"description":"
interact(element).resizable({\n  onstart: function (event) {},\n  onmove : function (event) {},\n  onend  : function (event) {},\n\n  edges: {\n    top   : true,       // Use pointer coords to check for resize.\n    left  : false,      // Disable resizing from left edge.\n    bottom: '.resize-s',// Resize if pointer target matches selector\n    right : handleEl    // Resize if pointer target is the given Element\n  },\n\n    // Width and height can be adjusted independently. When `true`, width and\n    // height are adjusted at a 1:1 ratio.\n    square: false,\n\n    // Width and height can be adjusted independently. When `true`, width and\n    // height maintain the aspect ratio they had when resizing started.\n    preserveAspectRatio: false,\n\n  // a value of 'none' will limit the resize rect to a minimum of 0x0\n  // 'negate' will allow the rect to have negative width/height\n  // 'reposition' will keep the width/height positive by swapping\n  // the top and bottom edges and/or swapping the left and right edges\n  invert: 'none' || 'negate' || 'reposition'\n\n  // limit multiple resizes.\n  // See the explanation in the {@link Interactable.draggable} example\n  max: Infinity,\n  maxPerElement: 1,\n})\n\nvar isResizeable = interact(element).resizable()\n
\n

Gets or sets whether resize actions can be performed on the target

","params":[{"type":{"names":["boolean","object"]},"optional":true,"description":"

true/false or An object with event\nlisteners to be fired on resize events (object makes the Interactable\nresizable)

","name":"options"}],"returns":[{"type":{"names":["boolean","Interactable"]},"description":"

A boolean indicating if this can be the\ntarget of resize elements, or this Interactable

"}],"name":"resizable","longname":"Interactable#resizable","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000359","___s":true,"attribs":"","id":"resizable","signature":"(optionsopt) → {boolean|Interactable}","ancestors":["#Interactable#"]},{"comment":"/**\n * Reset the options of this Interactable\n *\n * @param {object} options The new settings to apply\n * @return {object} This Interactable\n */","meta":{"range":[9267,9924],"filename":"Interactable.ts","lineno":330,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100008972","name":"Interactable#set","type":"MethodDefinition","paramnames":["options"]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Reset the options of this Interactable

","params":[{"type":{"names":["object"]},"description":"

The new settings to apply

","name":"options"}],"returns":[{"type":{"names":["object"]},"description":"

This Interactable

"}],"name":"set","longname":"Interactable#set","kind":"function","memberof":"Interactable","scope":"instance","___id":"T000002R000955","___s":true,"attribs":"","id":"set","signature":"(options) → {object}","ancestors":["#Interactable#"]},{"comment":"/**\n * Returns or sets whether the the cursor should be changed depending on the\n * action that would be performed if the mouse were pressed and dragged.\n *\n * @param {boolean} [newValue]\n * @return {boolean | Interactable} The current setting or this Interactable\n */","meta":{"range":[4085,4133],"filename":"InteractableMethods.ts","lineno":146,"columnno":2,"path":"../@interactjs/auto-start","code":{"id":"astnode100007571","name":"Interactable.prototype.styleCursor","type":"Identifier","value":"styleCursor","paramnames":[]},"shortpath":"@interactjs/auto-start/InteractableMethods.ts"},"description":"

Returns or sets whether the the cursor should be changed depending on the\naction that would be performed if the mouse were pressed and dragged.

","params":[{"type":{"names":["boolean"]},"optional":true,"name":"newValue"}],"returns":[{"type":{"names":["boolean","Interactable"]},"description":"

The current setting or this Interactable

"}],"name":"styleCursor","longname":"Interactable#styleCursor","kind":"member","memberof":"Interactable","scope":"instance","___id":"T000002R000829","___s":true,"attribs":"","id":"styleCursor","ancestors":["#Interactable#"],"signature":""},{"comment":"/**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n *\n * @return {interact}\n */","meta":{"range":[10092,10773],"filename":"Interactable.ts","lineno":364,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100009089","name":"Interactable#unset","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/Interactable.ts"},"description":"

Remove this interactable from the list of interactables and remove it's\naction capabilities and event listeners

","returns":[{"type":{"names":["interact"]}}],"name":"unset","longname":"Interactable#unset","kind":"function","memberof":"Interactable","scope":"instance","params":[],"___id":"T000002R000964","___s":true,"attribs":"","id":"unset","signature":"() → {interact}","ancestors":["#Interactable#"]},{"comment":"/** */","meta":{"range":[310,2646],"filename":"InteractEvent.ts","lineno":10,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100009992","name":"exports.InteractEvent","type":"MethodDefinition","paramnames":["interaction","event","actionName","phase","element","preEnd","type"]},"vars":{"":null},"shortpath":"@interactjs/core/InteractEvent.ts"},"name":"InteractEvent","longname":"InteractEvent#InteractEvent","kind":"class","memberof":"InteractEvent","scope":"instance","params":[],"___id":"T000003R000004","___s":true,"attribs":"","id":"InteractEvent","signature":"()","ancestors":[]},{"comment":"/**\n * Don't call listeners on the remaining targets\n */","meta":{"range":[4437,4540],"filename":"InteractEvent.ts","lineno":190,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100010829","name":"InteractEvent#stopImmediatePropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/InteractEvent.ts"},"description":"

Don't call listeners on the remaining targets

","name":"stopImmediatePropagation","longname":"InteractEvent#stopImmediatePropagation","kind":"function","memberof":"InteractEvent","scope":"instance","params":[],"___id":"T000002R001122","___s":true,"attribs":"","id":"stopImmediatePropagation","signature":"()","ancestors":[]},{"comment":"/**\n * Don't call any other listeners (even on the current target)\n */","meta":{"range":[4622,4681],"filename":"InteractEvent.ts","lineno":197,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100010843","name":"InteractEvent#stopPropagation","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/InteractEvent.ts"},"description":"

Don't call any other listeners (even on the current target)

","name":"stopPropagation","longname":"InteractEvent#stopPropagation","kind":"function","memberof":"InteractEvent","scope":"instance","params":[],"___id":"T000002R001125","___s":true,"attribs":"","id":"stopPropagation","signature":"()","ancestors":[]},{"comment":"/**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('move', function (event) {\n * if (event.pageX > 1000) {\n * // end the current action\n * event.interaction.end()\n * // stop all further listeners from being called\n * event.stopImmediatePropagation()\n * }\n * })\n * ```\n *\n * @param {PointerEvent} [event]\n */","meta":{"range":[8865,9215],"filename":"Interaction.ts","lineno":406,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011847","name":"Interaction#end","type":"MethodDefinition","paramnames":["event"]},"vars":{"":null},"shortpath":"@interactjs/core/Interaction.ts"},"description":"
interact(target)\n  .draggable(true)\n  .on('move', function (event) {\n    if (event.pageX > 1000) {\n      // end the current action\n      event.interaction.end()\n      // stop all further listeners from being called\n      event.stopImmediatePropagation()\n    }\n  })\n
","params":[{"type":{"names":["PointerEvent"]},"optional":true,"name":"event"}],"name":"end","longname":"Interaction#end","kind":"function","memberof":"Interaction","scope":"instance","___id":"T000002R001258","___s":true,"attribs":"","id":"end","signature":"(eventopt)","ancestors":[]},{"comment":"/** */","meta":{"range":[2148,2701],"filename":"Interaction.ts","lineno":83,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011074","name":"exports.Interaction","type":"MethodDefinition","paramnames":[""]},"vars":{"":null},"shortpath":"@interactjs/core/Interaction.ts"},"name":"Interaction","longname":"Interaction#Interaction","kind":"class","memberof":"Interaction","scope":"instance","params":[],"___id":"T000003R000005","___s":true,"attribs":"","id":"Interaction","signature":"()","ancestors":[]},{"comment":"/**\n * @alias Interaction.prototype.move\n */","meta":{"range":[1521,1673],"filename":"Interaction.ts","lineno":159,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011019","name":"doMove","type":"ClassProperty"},"shortpath":"@interactjs/core/Interaction.ts"},"alias":"Interaction.prototype.move","name":"move","longname":"Interaction#move","kind":"member","memberof":"Interaction","scope":"instance","___id":"T000002R001170","___s":true,"attribs":"","id":"move","ancestors":[],"signature":""},{"comment":"/**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('dragmove', function (event) {\n * if (someCondition) {\n * // change the snap settings\n * event.interactable.draggable({ snap: { targets: [] }})\n * // fire another move event with re-calculated snap\n * event.interaction.move()\n * }\n * })\n * ```\n *\n * Force a move of the current action at the same coordinates. Useful if\n * snap/restrict has been changed and you want a movement with the new\n * settings.\n */","meta":{"range":[7171,7572],"filename":"Interaction.ts","lineno":337,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011653","name":"Interaction#move","type":"MethodDefinition","paramnames":["signalArg"]},"vars":{"":null},"shortpath":"@interactjs/core/Interaction.ts"},"description":"
interact(target)\n  .draggable(true)\n  .on('dragmove', function (event) {\n    if (someCondition) {\n      // change the snap settings\n      event.interactable.draggable({ snap: { targets: [] }})\n      // fire another move event with re-calculated snap\n      event.interaction.move()\n    }\n  })\n
\n

Force a move of the current action at the same coordinates. Useful if\nsnap/restrict has been changed and you want a movement with the new\nsettings.

","name":"move","longname":"Interaction#move","kind":"function","memberof":"Interaction","scope":"instance","params":[],"___id":"T000002R001234","___s":true,"attribs":"","id":"move","signature":"()","ancestors":[]},{"comment":"/**\n * ```js\n * interact(target)\n * .draggable({\n * // disable the default drag start by down->move\n * manualStart: true\n * })\n * // start dragging after the user holds the pointer down\n * .on('hold', function (event) {\n * var interaction = event.interaction\n *\n * if (!interaction.interacting()) {\n * interaction.start({ name: 'drag' },\n * event.interactable,\n * event.currentTarget)\n * }\n * })\n * ```\n *\n * Start an action with the given Interactable and Element as tartgets. The\n * action must be enabled for the target Interactable and an appropriate\n * number of pointers must be held down - 1 for drag/resize, 2 for gesture.\n *\n * Use it with `interactable.able({ manualStart: false })` to always\n * [start actions manually](https://github.com/taye/interact.js/issues/114)\n *\n * @param {object} action The action to be performed - drag, resize, etc.\n * @param {Interactable} target The Interactable to target\n * @param {Element} element The DOM Element to target\n * @return {object} interact\n */","meta":{"range":[4228,4975],"filename":"Interaction.ts","lineno":225,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011210","name":"Interaction#start","type":"MethodDefinition","paramnames":["action","interactable","element"]},"vars":{"":null},"shortpath":"@interactjs/core/Interaction.ts"},"description":"
interact(target)\n  .draggable({\n    // disable the default drag start by down->move\n    manualStart: true\n  })\n  // start dragging after the user holds the pointer down\n  .on('hold', function (event) {\n    var interaction = event.interaction\n\n    if (!interaction.interacting()) {\n      interaction.start({ name: 'drag' },\n                        event.interactable,\n                        event.currentTarget)\n    }\n})\n
\n

Start an action with the given Interactable and Element as tartgets. The\naction must be enabled for the target Interactable and an appropriate\nnumber of pointers must be held down - 1 for drag/resize, 2 for gesture.

\n

Use it with interactable.<action>able({ manualStart: false }) to always\nstart actions manually

","params":[{"type":{"names":["object"]},"description":"

The action to be performed - drag, resize, etc.

","name":"action"},{"type":{"names":["Interactable"]},"description":"

The Interactable to target

","name":"target"},{"type":{"names":["Element"]},"description":"

The DOM Element to target

","name":"element"}],"returns":[{"type":{"names":["object"]},"description":"

interact

"}],"name":"start","longname":"Interaction#start","kind":"function","memberof":"Interaction","scope":"instance","___id":"T000002R001200","___s":true,"attribs":"","id":"start","signature":"(action, target, element) → {object}","ancestors":[]},{"comment":"/** */","meta":{"range":[9365,9603],"filename":"Interaction.ts","lineno":353,"columnno":2,"path":"../@interactjs/core","code":{"id":"astnode100011930","name":"Interaction#stop","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/core/Interaction.ts"},"name":"stop","longname":"Interaction#stop","kind":"function","memberof":"Interaction","scope":"instance","params":[],"___id":"T000002R001269","___s":true,"attribs":"","id":"stop","signature":"()","ancestors":[]},{"comment":"/** */","meta":{"range":[163,1146],"filename":"PointerEvent.ts","lineno":5,"columnno":2,"path":"../@interactjs/pointer-events","code":{"id":"astnode100024301","name":"module.exports","type":"MethodDefinition","paramnames":["type","pointer","event","eventTarget","interaction","timeStamp"]},"vars":{"":null},"shortpath":"@interactjs/pointer-events/PointerEvent.ts"},"name":"exports","longname":"module.exports#module.exports","kind":"class","memberof":"module.exports#module","scope":"static","params":[],"___id":"T000003R000006","___s":true,"attribs":"","id":"exports","signature":"()","ancestors":[]},{"comment":"/** @module interact */","meta":{"filename":"interact.ts","lineno":1,"columnno":0,"path":"../@interactjs/interact","code":{},"shortpath":"@interactjs/interact/interact.ts"},"kind":"module","name":"interact","longname":"module:interact","___id":"T000004R000002","___s":true,"attribs":"","id":"interact","ancestors":[],"modules":[]},{"comment":"/**\n * Check if an element or selector has been set with the {@link interact}\n * function\n *\n * @alias module:interact.isSet\n *\n * @param {Element} element The Element being searched for\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */","meta":{"range":[1763,1785],"filename":"interact.ts","lineno":96,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100016997","name":"interact.isSet","type":"Identifier","value":"isSet","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Check if an element or selector has been set with the {@link interact}\nfunction

","alias":"module:interact.isSet","params":[{"type":{"names":["Element"]},"description":"

The Element being searched for

","name":"element"}],"returns":[{"type":{"names":["boolean"]},"description":"

Indicates if the element or CSS selector was previously\npassed to interact

"}],"name":"isSet","longname":"module:interact.isSet","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001846","___s":true,"attribs":"(static) ","id":".isSet","ancestors":["interact."],"signature":""},{"comment":"/**\n * Returns or sets the maximum number of concurrent interactions allowed. By\n * default only 1 interaction is allowed at a time (for backwards\n * compatibility). To allow multiple interactions on the same Interactables and\n * elements, you need to enable it in the draggable, resizable and gesturable\n * `'max'` and `'maxPerElement'` options.\n *\n * @alias module:interact.maxInteractions\n *\n * @param {number} [newValue] Any number. newValue <= 0 means no interactions.\n */","meta":{"range":[1106,1177],"filename":"base.ts","lineno":82,"columnno":2,"path":"../@interactjs/auto-start","code":{"id":"astnode100005961","name":"interact.maxInteractions","type":"ArrowFunctionExpression","paramnames":["newValue"]},"shortpath":"@interactjs/auto-start/base.ts"},"description":"

Returns or sets the maximum number of concurrent interactions allowed. By\ndefault only 1 interaction is allowed at a time (for backwards\ncompatibility). To allow multiple interactions on the same Interactables and\nelements, you need to enable it in the draggable, resizable and gesturable\n'max' and 'maxPerElement' options.

","alias":"module:interact.maxInteractions","params":[{"type":{"names":["number"]},"optional":true,"description":"

Any number. newValue <= 0 means no interactions.

","name":"newValue"}],"name":"maxInteractions","longname":"module:interact.maxInteractions","kind":"function","memberof":"module:interact","scope":"static","___id":"T000002R000662","___s":true,"attribs":"(static) ","id":".maxInteractions","signature":"(newValueopt)","ancestors":["interact."]},{"comment":"/**\n * Removes a global InteractEvent listener or DOM event from `document`\n *\n * @alias module:interact.off\n *\n * @param {string | array | object} type The types of events that were listened\n * for\n * @param {function} listener The listener function to be removed\n * @param {object | boolean} options [options] object or useCapture flag for\n * removeEventListener\n * @return {object} interact\n */","meta":{"range":[3578,3596],"filename":"interact.ts","lineno":162,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017162","name":"interact.off","type":"Identifier","value":"off","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Removes a global InteractEvent listener or DOM event from document

","alias":"module:interact.off","params":[{"type":{"names":["string","array","object"]},"description":"

The types of events that were listened\nfor

","name":"type"},{"type":{"names":["function"]},"description":"

The listener function to be removed

","name":"listener"},{"type":{"names":["object","boolean"]},"description":"

[options] object or useCapture flag for\nremoveEventListener

","name":"options"}],"returns":[{"type":{"names":["object"]},"description":"

interact

"}],"name":"off","longname":"module:interact.off","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001855","___s":true,"attribs":"(static) ","id":".off","ancestors":["interact."],"signature":""},{"comment":"/**\n * Add a global listener for an InteractEvent or adds a DOM event to `document`\n *\n * @alias module:interact.on\n *\n * @param {string | array | object} type The types of events to listen for\n * @param {function} listener The function event (s)\n * @param {object | boolean} [options] object or useCapture flag for\n * addEventListener\n * @return {object} interact\n */","meta":{"range":[2267,2283],"filename":"interact.ts","lineno":111,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017023","name":"interact.on","type":"Identifier","value":"on","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Add a global listener for an InteractEvent or adds a DOM event to document

","alias":"module:interact.on","params":[{"type":{"names":["string","array","object"]},"description":"

The types of events to listen for

","name":"type"},{"type":{"names":["function"]},"description":"

The function event (s)

","name":"listener"},{"type":{"names":["object","boolean"]},"optional":true,"description":"

object or useCapture flag for\naddEventListener

","name":"options"}],"returns":[{"type":{"names":["object"]},"description":"

interact

"}],"name":"on","longname":"module:interact.on","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001848","___s":true,"attribs":"(static) ","id":".on","ancestors":["interact."],"signature":""},{"comment":"/**\n * Returns or sets the distance the pointer must be moved before an action\n * sequence occurs. This also affects tolerance for tap events.\n *\n * @alias module:interact.pointerMoveTolerance\n *\n * @param {number} [newValue] The movement from the start position must be greater than this value\n * @return {interact | number}\n */","meta":{"range":[5975,6027],"filename":"interact.ts","lineno":263,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017450","name":"interact.pointerMoveTolerance","type":"Identifier","value":"pointerMoveTolerance","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Returns or sets the distance the pointer must be moved before an action\nsequence occurs. This also affects tolerance for tap events.

","alias":"module:interact.pointerMoveTolerance","params":[{"type":{"names":["number"]},"optional":true,"description":"

The movement from the start position must be greater than this value

","name":"newValue"}],"returns":[{"type":{"names":["interact","number"]}}],"name":"pointerMoveTolerance","longname":"module:interact.pointerMoveTolerance","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001879","___s":true,"attribs":"(static) ","id":".pointerMoveTolerance","ancestors":["interact."],"signature":""},{"comment":"/**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */","meta":{"range":[5497,5517],"filename":"interact.ts","lineno":247,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017424","name":"interact.stop","type":"Identifier","value":"stop","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Cancels all interactions (end events are not fired)

","alias":"module:interact.stop","returns":[{"type":{"names":["object"]},"description":"

interact

"}],"name":"stop","longname":"module:interact.stop","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001876","___s":true,"attribs":"(static) ","id":".stop","ancestors":["interact."],"signature":""},{"comment":"/**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */","meta":{"range":[5236,5288],"filename":"interact.ts","lineno":237,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017411","name":"interact.supportsPointerEvent","type":"Identifier","value":"supportsPointerEvent","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"alias":"module:interact.supportsPointerEvent","returns":[{"type":{"names":["boolean"]},"description":"

Whether or not the browser supports PointerEvents

"}],"name":"supportsPointerEvent","longname":"module:interact.supportsPointerEvent","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001874","___s":true,"attribs":"(static) ","id":".supportsPointerEvent","ancestors":["interact."],"signature":""},{"comment":"/**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */","meta":{"range":[5003,5041],"filename":"interact.ts","lineno":227,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100017398","name":"interact.supportsTouch","type":"Identifier","value":"supportsTouch","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"alias":"module:interact.supportsTouch","returns":[{"type":{"names":["boolean"]},"description":"

Whether or not the browser supports touch input

"}],"name":"supportsTouch","longname":"module:interact.supportsTouch","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001872","___s":true,"attribs":"(static) ","id":".supportsTouch","ancestors":["interact."],"signature":""},{"comment":"/**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n * @param {Object} plugin\n * @param {function} plugin.install\n * @return {interact}\n */","meta":{"range":[1361,1379],"filename":"interact.ts","lineno":80,"columnno":0,"path":"../@interactjs/interact","code":{"id":"astnode100016977","name":"interact.use","type":"Identifier","value":"use","paramnames":[]},"shortpath":"@interactjs/interact/interact.ts"},"description":"

Use a plugin

","alias":"module:interact.use","params":[{"type":{"names":["Object"]},"name":"plugin"},{"type":{"names":["function"]},"name":"plugin.install"}],"returns":[{"type":{"names":["interact"]}}],"name":"use","longname":"module:interact.use","kind":"member","memberof":"module:interact","scope":"static","___id":"T000002R001844","___s":true,"attribs":"(static) ","id":".use","ancestors":["interact."],"signature":""},{"comment":"/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * @example\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n */","meta":{"filename":"aspectRatio.ts","lineno":3,"columnno":0,"path":"../@interactjs/modifiers","code":{},"shortpath":"@interactjs/modifiers/aspectRatio.ts"},"kind":"module","name":"modifiers/aspectRatio","description":"

This module forces elements to be resized with a specified dx/dy ratio.

","examples":[{"caption":"","code":"interact(target).resizable({\n modifiers: [\n interact.modifiers.snapSize({\n targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n }),\n interact.aspectRatio({ ratio: 'preserve' }),\n ],\n});"}],"longname":"module:modifiers/aspectRatio","___id":"T000004R000003","___s":true,"attribs":"","id":"modifiers/aspectRatio","ancestors":[],"modules":[{"comment":"/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * @example\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n */","meta":{"filename":"aspectRatio.ts","lineno":3,"columnno":0,"path":"/home/travis/build/taye/interact.js/@interactjs/modifiers","code":{},"shortpath":"@interactjs/modifiers/aspectRatio.ts"},"kind":"module","name":"modifiers/aspectRatio","description":"

This module forces elements to be resized with a specified dx/dy ratio.

","examples":[{"caption":"","code":"interact(target).resizable({\n modifiers: [\n interact.modifiers.snapSize({\n targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n }),\n interact.aspectRatio({ ratio: 'preserve' }),\n ],\n});"}],"longname":"module:modifiers/aspectRatio","___id":"T000002R001898","___s":true,"attribs":"","id":"modifiers/aspectRatio","ancestors":[]}]},{"comment":"/**\n * @module modifiers/snapEdges\n *\n * @description\n * This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * @example\n * interact(target).resizable({\n * snapEdges: {\n * targets: [interact.snappers.grid({ x: 100, y: 50 })],\n * },\n * })\n *\n * interact(target).resizable({\n * snapEdges: {\n * targets: [\n * interact.snappers.grid({\n * top: 50,\n * left: 50,\n * bottom: 100,\n * right: 100,\n * }),\n * ],\n * },\n * })\n */","meta":{"filename":"edges.ts","lineno":1,"columnno":0,"path":"../@interactjs/modifiers/snap","code":{},"shortpath":"@interactjs/modifiers/snap/edges.ts"},"kind":"module","name":"modifiers/snapEdges","description":"

This module allows snapping of the edges of targets during resize\ninteractions.

","examples":[{"caption":"","code":"interact(target).resizable({\n snapEdges: {\n targets: [interact.snappers.grid({ x: 100, y: 50 })],\n },\n})\n\ninteract(target).resizable({\n snapEdges: {\n targets: [\n interact.snappers.grid({\n top: 50,\n left: 50,\n bottom: 100,\n right: 100,\n }),\n ],\n },\n})"}],"longname":"module:modifiers/snapEdges","___id":"T000004R000004","___s":true,"attribs":"","id":"modifiers/snapEdges","ancestors":[],"modules":[{"comment":"/**\n * @module modifiers/snapEdges\n *\n * @description\n * This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * @example\n * interact(target).resizable({\n * snapEdges: {\n * targets: [interact.snappers.grid({ x: 100, y: 50 })],\n * },\n * })\n *\n * interact(target).resizable({\n * snapEdges: {\n * targets: [\n * interact.snappers.grid({\n * top: 50,\n * left: 50,\n * bottom: 100,\n * right: 100,\n * }),\n * ],\n * },\n * })\n */","meta":{"filename":"edges.ts","lineno":1,"columnno":0,"path":"/home/travis/build/taye/interact.js/@interactjs/modifiers/snap","code":{},"shortpath":"@interactjs/modifiers/snap/edges.ts"},"kind":"module","name":"modifiers/snapEdges","description":"

This module allows snapping of the edges of targets during resize\ninteractions.

","examples":[{"caption":"","code":"interact(target).resizable({\n snapEdges: {\n targets: [interact.snappers.grid({ x: 100, y: 50 })],\n },\n})\n\ninteract(target).resizable({\n snapEdges: {\n targets: [\n interact.snappers.grid({\n top: 50,\n left: 50,\n bottom: 100,\n right: 100,\n }),\n ],\n },\n})"}],"longname":"module:modifiers/snapEdges","___id":"T000002R002376","___s":true,"attribs":"","id":"modifiers/snapEdges","ancestors":[]}]},{"kind":"package","longname":"package:undefined","files":["/home/travis/build/taye/interact.js/@interactjs/actions/drag.ts","/home/travis/build/taye/interact.js/@interactjs/actions/drop/DropEvent.ts","/home/travis/build/taye/interact.js/@interactjs/actions/drop/index.ts","/home/travis/build/taye/interact.js/@interactjs/actions/gesture.ts","/home/travis/build/taye/interact.js/@interactjs/actions/index.ts","/home/travis/build/taye/interact.js/@interactjs/actions/resize.ts","/home/travis/build/taye/interact.js/@interactjs/auto-scroll/index.ts","/home/travis/build/taye/interact.js/@interactjs/auto-start/base.ts","/home/travis/build/taye/interact.js/@interactjs/auto-start/dragAxis.ts","/home/travis/build/taye/interact.js/@interactjs/auto-start/hold.ts","/home/travis/build/taye/interact.js/@interactjs/auto-start/index.ts","/home/travis/build/taye/interact.js/@interactjs/auto-start/InteractableMethods.ts","/home/travis/build/taye/interact.js/@interactjs/core/BaseEvent.ts","/home/travis/build/taye/interact.js/@interactjs/core/defaultOptions.ts","/home/travis/build/taye/interact.js/@interactjs/core/Eventable.ts","/home/travis/build/taye/interact.js/@interactjs/core/Interactable.ts","/home/travis/build/taye/interact.js/@interactjs/core/interactablePreventDefault.ts","/home/travis/build/taye/interact.js/@interactjs/core/InteractableSet.ts","/home/travis/build/taye/interact.js/@interactjs/core/InteractEvent.ts","/home/travis/build/taye/interact.js/@interactjs/core/Interaction.ts","/home/travis/build/taye/interact.js/@interactjs/core/interactionFinder.ts","/home/travis/build/taye/interact.js/@interactjs/core/interactions.ts","/home/travis/build/taye/interact.js/@interactjs/core/PointerInfo.ts","/home/travis/build/taye/interact.js/@interactjs/core/scope.ts","/home/travis/build/taye/interact.js/@interactjs/dev-tools/index.ts","/home/travis/build/taye/interact.js/@interactjs/inertia/index.ts","/home/travis/build/taye/interact.js/@interactjs/interact/index.ts","/home/travis/build/taye/interact.js/@interactjs/interact/interact.ts","/home/travis/build/taye/interact.js/@interactjs/interactjs/index.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/aspectRatio.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/base.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/index.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/Modification.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/restrict/edges.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/restrict/pointer.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/restrict/rect.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/restrict/size.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/snap/edges.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/snap/pointer.ts","/home/travis/build/taye/interact.js/@interactjs/modifiers/snap/size.ts","/home/travis/build/taye/interact.js/@interactjs/offset/index.ts","/home/travis/build/taye/interact.js/@interactjs/pointer-events/base.ts","/home/travis/build/taye/interact.js/@interactjs/pointer-events/holdRepeat.ts","/home/travis/build/taye/interact.js/@interactjs/pointer-events/index.ts","/home/travis/build/taye/interact.js/@interactjs/pointer-events/interactableTargets.ts","/home/travis/build/taye/interact.js/@interactjs/pointer-events/PointerEvent.ts","/home/travis/build/taye/interact.js/@interactjs/reflow/index.ts","/home/travis/build/taye/interact.js/@interactjs/types/index.ts","/home/travis/build/taye/interact.js/@interactjs/types/interactjs-test.ts","/home/travis/build/taye/interact.js/@interactjs/types/NativePointerEventType.ts","/home/travis/build/taye/interact.js/@interactjs/utils/arr.ts","/home/travis/build/taye/interact.js/@interactjs/utils/browser.ts","/home/travis/build/taye/interact.js/@interactjs/utils/clone.ts","/home/travis/build/taye/interact.js/@interactjs/utils/domObjects.ts","/home/travis/build/taye/interact.js/@interactjs/utils/domUtils.ts","/home/travis/build/taye/interact.js/@interactjs/utils/events.ts","/home/travis/build/taye/interact.js/@interactjs/utils/extend.ts","/home/travis/build/taye/interact.js/@interactjs/utils/getOriginXY.ts","/home/travis/build/taye/interact.js/@interactjs/utils/hypot.ts","/home/travis/build/taye/interact.js/@interactjs/utils/index.ts","/home/travis/build/taye/interact.js/@interactjs/utils/is.ts","/home/travis/build/taye/interact.js/@interactjs/utils/isWindow.ts","/home/travis/build/taye/interact.js/@interactjs/utils/normalizeListeners.ts","/home/travis/build/taye/interact.js/@interactjs/utils/pointerExtend.ts","/home/travis/build/taye/interact.js/@interactjs/utils/pointerUtils.ts","/home/travis/build/taye/interact.js/@interactjs/utils/raf.ts","/home/travis/build/taye/interact.js/@interactjs/utils/rect.ts","/home/travis/build/taye/interact.js/@interactjs/utils/snappers/grid.ts","/home/travis/build/taye/interact.js/@interactjs/utils/snappers/index.ts","/home/travis/build/taye/interact.js/@interactjs/utils/window.ts","/home/travis/build/taye/interact.js/interactjs/index.ts","/home/travis/build/taye/interact.js/jsdoc/index.md"],"___id":"T000002R003588","___s":true,"attribs":"","id":"package:","ancestors":[]},{"comment":"/**\n * Prevent the default behaviour of the original Event\n */","meta":{"range":[1599,1662],"filename":"PointerEvent.ts","lineno":76,"columnno":2,"path":"../@interactjs/pointer-events","code":{"id":"astnode100024542","name":"preventDefault","type":"MethodDefinition","paramnames":[]},"vars":{"":null},"shortpath":"@interactjs/pointer-events/PointerEvent.ts"},"description":"

Prevent the default behaviour of the original Event

","name":"preventDefault","longname":"preventDefault","kind":"function","scope":"global","params":[],"___id":"T000002R002843","___s":true,"attribs":"","id":"preventDefault","signature":"()","ancestors":[]}] \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Bold-webfont.eot b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 000000000..5d20d9163 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-Bold-webfont.svg b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 000000000..3ed7be4bc --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Bold-webfont.woff b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 000000000..1205787b0 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Bold-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.eot b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 000000000..1f639a15f Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.svg b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 000000000..6a2607b9d --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.woff b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 000000000..ed760c062 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-Italic-webfont.eot b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 000000000..0c8a0ae06 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-Italic-webfont.svg b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 000000000..e1075dcc2 --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Italic-webfont.woff b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 000000000..ff652e643 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Italic-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-Light-webfont.eot b/interactjs/dist/api/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 000000000..14868406a Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Light-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-Light-webfont.svg b/interactjs/dist/api/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 000000000..11a472ca8 --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Light-webfont.woff b/interactjs/dist/api/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 000000000..e78607481 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Light-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.eot b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 000000000..8f445929f Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.svg b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 000000000..431d7e354 --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.woff b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 000000000..43e8b9e6c Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-Regular-webfont.eot b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 000000000..6bbc3cf58 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-Regular-webfont.svg b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 000000000..25a395234 --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Regular-webfont.woff b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 000000000..e231183dc Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Regular-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.eot b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.eot new file mode 100644 index 000000000..d8375dd0a Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.svg b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.svg new file mode 100644 index 000000000..eec4db8bd --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.ttf b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.ttf new file mode 100644 index 000000000..b3290843a Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.ttf differ diff --git a/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.woff b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.woff new file mode 100644 index 000000000..28d6adee0 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-Semibold-webfont.woff differ diff --git a/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.eot b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.eot new file mode 100644 index 000000000..0ab1db22e Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.eot differ diff --git a/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.svg b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.svg new file mode 100644 index 000000000..7166ec1b9 --- /dev/null +++ b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.ttf b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.ttf new file mode 100644 index 000000000..d2d6318f6 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.ttf differ diff --git a/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.woff b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.woff new file mode 100644 index 000000000..d4dfca402 Binary files /dev/null and b/interactjs/dist/api/fonts/OpenSans-SemiboldItalic-webfont.woff differ diff --git a/interactjs/dist/api/global.html b/interactjs/dist/api/global.html new file mode 100644 index 000000000..f5acc0933 --- /dev/null +++ b/interactjs/dist/api/global.html @@ -0,0 +1,299 @@ + + + + + + Global - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

Global

+ + + + + + + +
+ +
+ +

+ +

+ + +
+ +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +
+

(constant) interact

+ + + + +
+
interact('#draggable').draggable(true)
+
+var rectables = interact('rect')
+rectables
+  .gesturable(true)
+  .on('gesturemove', function (event) {
+      // ...
+  })
+
+

The methods of this variable can be used to set elements as interactables +and also to change various default settings.

+

Calling it as a function and passing an element or a valid CSS selector +string returns an Interactable object which has various methods to configure +it.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + + + +

Methods

+ + + +
+ + + +

preventDefault()

+ + + + + +
+

Prevent the default behaviour of the original Event

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/img/ijs-32.png b/interactjs/dist/api/img/ijs-32.png new file mode 100644 index 000000000..63d1259d9 Binary files /dev/null and b/interactjs/dist/api/img/ijs-32.png differ diff --git a/interactjs/dist/api/img/ijs-64.png b/interactjs/dist/api/img/ijs-64.png new file mode 100644 index 000000000..e6331590f Binary files /dev/null and b/interactjs/dist/api/img/ijs-64.png differ diff --git a/interactjs/dist/api/img/ijs-anim-short.svg b/interactjs/dist/api/img/ijs-anim-short.svg new file mode 100644 index 000000000..56a7ab666 --- /dev/null +++ b/interactjs/dist/api/img/ijs-anim-short.svg @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interactjs/dist/api/img/ijs-anim.svg b/interactjs/dist/api/img/ijs-anim.svg new file mode 100644 index 000000000..4d2703569 --- /dev/null +++ b/interactjs/dist/api/img/ijs-anim.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interactjs/dist/api/img/ijs-icon.svg b/interactjs/dist/api/img/ijs-icon.svg new file mode 100644 index 000000000..9a3fb22d6 --- /dev/null +++ b/interactjs/dist/api/img/ijs-icon.svg @@ -0,0 +1,103 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/interactjs/dist/api/img/ijs.svg b/interactjs/dist/api/img/ijs.svg new file mode 100644 index 000000000..37a883ba4 --- /dev/null +++ b/interactjs/dist/api/img/ijs.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/interactjs/dist/api/index.html b/interactjs/dist/api/index.html new file mode 100644 index 000000000..b77a51747 --- /dev/null +++ b/interactjs/dist/api/index.html @@ -0,0 +1,53 @@ + + + + + + API Reference - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

API Reference

+ + +
+ +
+

interact.js

+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/jsdoc_index.md.html b/interactjs/dist/api/jsdoc_index.md.html new file mode 100644 index 000000000..523fcbcfb --- /dev/null +++ b/interactjs/dist/api/jsdoc_index.md.html @@ -0,0 +1,62 @@ + + + + + + jsdoc/index.md - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

jsdoc/index.md

+ + + + + + + +
+
+
# API Reference
+
+<img
+  style="background-color: #272822; display: block; margin: auto; max-height: 8em; width: 100%"
+  alt="interact.js"
+  src="img/ijs-anim-short.svg">
+
+
+
+ + + + +
+ + + + + diff --git a/interactjs/dist/api/module-interact.html b/interactjs/dist/api/module-interact.html new file mode 100644 index 000000000..10dfc00df --- /dev/null +++ b/interactjs/dist/api/module-interact.html @@ -0,0 +1,754 @@ + + + + + + interact - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

interact

+ + + + + + + +
+ +
+ + + +
+ +
+
+ + + + + +
+ + + + + + + + + + + + +

Members

+ + + +
+

(static) isSet

+ + + + +
+

Check if an element or selector has been set with the interact +function

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) off

+ + + + +
+

Removes a global InteractEvent listener or DOM event from document

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) on

+ + + + +
+

Add a global listener for an InteractEvent or adds a DOM event to document

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) pointerMoveTolerance

+ + + + +
+

Returns or sets the distance the pointer must be moved before an action +sequence occurs. This also affects tolerance for tap events.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) stop

+ + + + +
+

Cancels all interactions (end events are not fired)

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) supportsPointerEvent

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) supportsTouch

+ + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + +
+

(static) use

+ + + + +
+

Use a plugin

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + +
+ + + + + +

Methods

+ + + +
+ + + +

(static) maxInteractions(newValueopt)

+ + + + + +
+

Returns or sets the maximum number of concurrent interactions allowed. By +default only 1 interaction is allowed at a time (for backwards +compatibility). To allow multiple interactions on the same Interactables and +elements, you need to enable it in the draggable, resizable and gesturable +'max' and 'maxPerElement' options.

+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
newValue + + +number + + + + + + <optional>
+ + + + + +
+

Any number. newValue <= 0 means no interactions.

+ +
+ + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/module-modifiers_aspectRatio.html b/interactjs/dist/api/module-modifiers_aspectRatio.html new file mode 100644 index 000000000..44b4a3e8b --- /dev/null +++ b/interactjs/dist/api/module-modifiers_aspectRatio.html @@ -0,0 +1,179 @@ + + + + + + modifiers/aspectRatio - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

modifiers/aspectRatio

+ + + + + + + +
+ +
+ + + + + +
+ +
+
+ + +

This module forces elements to be resized with a specified dx/dy ratio.

+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
interact(target).resizable({
+  modifiers: [
+    interact.modifiers.snapSize({
+      targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],
+    }),
+    interact.aspectRatio({ ratio: 'preserve' }),
+  ],
+});
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/module-modifiers_snapEdges.html b/interactjs/dist/api/module-modifiers_snapEdges.html new file mode 100644 index 000000000..38dfb11cc --- /dev/null +++ b/interactjs/dist/api/module-modifiers_snapEdges.html @@ -0,0 +1,190 @@ + + + + + + modifiers/snapEdges - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

modifiers/snapEdges

+ + + + + + + +
+ +
+ + + + + +
+ +
+
+ + +

This module allows snapping of the edges of targets during resize +interactions.

+ + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
interact(target).resizable({
+  snapEdges: {
+    targets: [interact.snappers.grid({ x: 100, y: 50 })],
+  },
+})
+
+interact(target).resizable({
+  snapEdges: {
+    targets: [
+      interact.snappers.grid({
+       top: 50,
+       left: 50,
+       bottom: 100,
+       right: 100,
+      }),
+    ],
+  },
+})
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/module.exports_module.exports.html b/interactjs/dist/api/module.exports_module.exports.html new file mode 100644 index 000000000..675d6f3cb --- /dev/null +++ b/interactjs/dist/api/module.exports_module.exports.html @@ -0,0 +1,167 @@ + + + + + + exports - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

exports

+ + + + + + + +
+ +
+ +

+ exports +

+ + +
+ +
+
+ + +
+ + + +

new exports()

+ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + + + \ No newline at end of file diff --git a/interactjs/dist/api/scripts/linenumber.js b/interactjs/dist/api/scripts/linenumber.js new file mode 100644 index 000000000..8d52f7eaf --- /dev/null +++ b/interactjs/dist/api/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/interactjs/dist/api/scripts/prettify/Apache-License-2.0.txt b/interactjs/dist/api/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/interactjs/dist/api/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/interactjs/dist/api/scripts/prettify/lang-css.js b/interactjs/dist/api/scripts/prettify/lang-css.js new file mode 100644 index 000000000..041e1f590 --- /dev/null +++ b/interactjs/dist/api/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/interactjs/dist/api/scripts/prettify/prettify.js b/interactjs/dist/api/scripts/prettify/prettify.js new file mode 100644 index 000000000..eef5ad7e6 --- /dev/null +++ b/interactjs/dist/api/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p * , #main .article > * { + padding-left: 8px; + padding-right: 8px; } + +header { + display: block; } + +section { + display: block; + background-color: #fff; + padding: 0; } + +.variation { + display: none; } + +.signature-attributes { + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; } + +/** Readme * */ +.readme { + font-size: 16px; } + .readme h1, .readme h2, .readme h3, .readme h4, .readme h5 { + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + padding: 0; } + .readme h1 { + font-size: 2em; + padding-bottom: 0.3em; } + .readme h2 { + font-size: 1.75em; + padding-bottom: 0.3em; } + .readme h3 { + font-size: 1.5em; + background-color: transparent; } + .readme h4 { + font-size: 1.25em; } + .readme h5 { + font-size: 1em; } + .readme img { + max-width: 100%; } + .readme ul, .readme ol { + padding-left: 2em; } + .readme pre > code { + font-size: 0.85em; } + .readme table { + margin-bottom: 1em; + border-collapse: collapse; + border-spacing: 0; } + .readme table tr { + background-color: #fff; + border-top: 1px solid #ccc; } + .readme table th, .readme table td { + padding: 6px 13px; + border: 1px solid #ddd; } + .readme table tr:nth-child(2n) { + background-color: #f8f8f8; } + +/** Nav * */ +nav { + float: left; + display: block; + width: 240px; + background: #333; + color: #eee; + overflow: auto; + position: fixed; + height: 100%; + padding: 10px; + /* box-shadow: 0 0 3px rgba(0,0,0,0.1); */ } + nav li { + list-style: none; + padding: 0; + margin: 0; } + +.nav-heading { + margin-top: 10px; + font-weight: bold; } + .nav-heading a { + color: #eee; + font-size: 14px; + display: inline-block; } + +.nav-item-type { + /* margin-left: 5px; */ + width: 18px; + height: 18px; + display: inline-block; + text-align: center; + border-radius: 0.2em; + margin-right: 5px; + font-weight: bold; + line-height: 20px; + font-size: 13px; } + .nav-item-type.type-article { + display: none; } + +.nav-item { + margin-left: 12px; } + +.nav-item-name a, .nav-item-name a:visited, .nav-item-name a:hover { + color: #eee; } + +.type-function { + background: #B3E5FC; + color: #0288D1; } + +.type-class { + background: #D1C4E9; + color: #4527A0; } + +.type-member { + background: #C8E6C9; + color: #388E3C; } + +.type-module { + background: #E1BEE7; + color: #7B1FA2; } + +/** Footer * */ +footer { + color: #474747; + margin-left: 240px; + display: block; + padding: 30px; + font-style: italic; + font-size: 90%; + border-top: 1px solid #eee; } + +.ancestors { + color: #999; } + .ancestors a { + color: #999 !important; + text-decoration: none; } + +.clear { + clear: both; } + +.important { + font-weight: bold; + color: #950B02; } + +.yes-def { + text-indent: -1000px; } + +.type-signature { + color: #aaa; } + +.name, .signature { + font-family: Consolas, Monaco, "Andale Mono", monospace; } + +.details { + margin-top: 14px; + border-left: 2px solid #DDD; + line-height: 30px; } + .details dt { + width: 120px; + float: left; + padding-left: 10px; } + .details dd { + margin-left: 70px; } + .details ul { + margin: 0; + list-style-type: none; } + .details li { + margin-left: 30px; } + .details pre.prettyprint { + margin: 0; } + .details .object-value { + padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; } + +.code-caption { + font-style: italic; + font-size: 107%; + margin: 0; } + +.prettyprint { + font-size: 13px; + border: 1px solid #ddd; + border-radius: 3px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05); + overflow: auto; } + .prettyprint.source { + width: inherit; } + .prettyprint code { + font-size: 12px; + line-height: 18px; + display: block; + color: #4D4E53; } + .prettyprint code:empty:before { + content: ''; } + .prettyprint > code { + padding: 15px; } + .prettyprint .linenums code { + padding: 0 15px; } + .prettyprint .linenums li:first-of-type code { + padding-top: 15px; } + .prettyprint code span.line { + display: inline-block; } + .prettyprint.linenums { + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } + .prettyprint.linenums ol { + padding-left: 0; } + .prettyprint.linenums li { + border-left: 2px #444 solid; } + .prettyprint.linenums li.selected { + background-color: #555; } + .prettyprint.linenums li * { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; } + +.params, .props { + border-spacing: 0; + border: 1px solid #ddd; + border-collapse: collapse; + border-radius: 3px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); + width: 100%; + font-size: 14px; + /* margin-left: 15px; */ } + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; } + +.params td, .params th { + margin: 0px; + text-align: left; + vertical-align: top; + padding: 10px; + display: table-cell; } + +.props td, .props th { + margin: 0px; + text-align: left; + vertical-align: top; + padding: 10px; + display: table-cell; } + +.params td { + border-top: 1px solid #eee; } + +.params thead tr { + background-color: #fff; + font-weight: bold; } + +.props thead tr, .params .params thead tr, .props .props thead tr { + background-color: #fff; + font-weight: bold; } + +.params param-description > p:first-child, .props param-description > p:first-child { + margin-top: 0; + padding-top: 0; } + +.params param-description > p:last-child, .props param-description > p:last-child { + margin-bottom: 0; + padding-bottom: 0; } + +dl.param-type { + /* border-bottom: 1px solid hsl(0, 0%, 87%); */ + margin: 0; + padding: 0; + font-size: 16px; } + +.param-type dt { + display: inline-block; } + +.param-type dd { + display: inline-block; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + display: inline-block; + padding: 0; + margin: 0; + font-size: 14px; } + +.disabled { + color: #454545; } + +/* navicon button */ +.navicon-button { + display: none; + position: relative; + padding: 2.0625rem 1.5rem; + cursor: pointer; + user-select: none; + opacity: .8; } + .navicon-button .navicon:before, .navicon-button .navicon:after { + transition: 0.25s; } + .navicon-button:hover { + transition: 0.5s; + opacity: 1; } + .navicon-button:hover .navicon:before, .navicon-button:hover .navicon:after { + transition: 0.25s; } + .navicon-button:hover .navicon:before { + top: .825rem; } + .navicon-button:hover .navicon:after { + top: -.825rem; } + +/* navicon */ +.navicon { + position: relative; + width: 2.5em; + height: .3125rem; + background: #000; + transition: 0.3s; + border-radius: 2.5rem; } + .navicon:before, .navicon:after { + display: block; + content: ""; + height: .3125rem; + width: 2.5rem; + background: #000; + position: absolute; + z-index: -1; + transition: 0.3s 0.25s; + border-radius: 1rem; } + .navicon:before { + top: .625rem; } + .navicon:after { + top: -.625rem; } + +/* open */ +.nav-trigger { + position: fixed; + top: 0; + clip: rect(0, 0, 0, 0); } + .nav-trigger:checked + label { + transform: scale(0.75); } + .nav-trigger:checked + label:not(.steps) .navicon:before, .nav-trigger:checked + label:not(.steps) .navicon:after { + top: 0 !important; } + .nav-trigger:checked + label .navicon:before, .nav-trigger:checked + label .navicon:after { + transition: 0.5s; } + .nav-trigger:checked + label.plus .navicon, .nav-trigger:checked + label.x .navicon { + background: transparent; } + .nav-trigger:checked + label.plus .navicon:before, .nav-trigger:checked + label.x .navicon:before { + transform: rotate(-45deg); + background: #FFF; } + .nav-trigger:checked + label.plus .navicon:after, .nav-trigger:checked + label.x .navicon:after { + transform: rotate(45deg); + background: #FFF; } + .nav-trigger:checked + label.plus { + transform: scale(0.75) rotate(45deg); } + .nav-trigger:checked ~ nav { + transform: none !important; } + .nav-trigger:checked ~ .overlay { + display: block; } + +/* Minus */ +/* × and + */ +.overlay { + display: none; + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 100%; + background: rgba(0, 0, 0, 0.5); + z-index: 1; } + +.section-method { + margin-bottom: 30px; + padding-bottom: 30px; + border-bottom: 1px solid #eee; } + +@media only screen and (max-width: 700px) { + body { + overflow-x: hidden; } + nav { + width: 240px; + height: 100%; + transform: translateX(-240px); + z-index: 3; + padding: 0 10px; + transition: transform 0.2s; } + .navicon-button { + display: inline-block; + position: fixed; + top: 1.5em; + right: 0; + z-index: 2; } + #main { + width: 100%; + min-width: 360px; } + #main h1.page-title { + margin: 1em 0; } + #main section { + padding: 0; } + footer { + margin-left: 0; } } + +@media only print { + nav { + display: none; } + #main { + float: none; + width: 100%; } } + +section > header, +.subsection-title, +.section-method > *:not(.params):not(.description):not(.prettyprint):not(ol):not(ul), +.description > *:not(.prettyprint):not(ol):not(ul), +footer { + padding-left: 8px; + padding-right: 8px; + margin: 0; } + +table.params { + width: auto; + margin: 0 10px; } + +.prettyprint.source, #main blockquote { + width: 100%; } + +.prettyprint { + position: relative; + border: none; + border-radius: 0; + width: 100%; + background-color: #292929; + color: #c5c8c6; + border-radius: 0; } + .prettyprint code { + position: relative; + border: none; + border-radius: 0; + width: 100%; + background-color: transparent; + color: #c5c8c6; + border-radius: 0; } + +#main blockquote { + position: relative; + border: none; + border-radius: 0; + background-color: #292929; + color: #c5c8c6; + border-radius: 0; } + +@media only screen and (min-width: 1001px) { + #main > *:not(section), #main .prettyprint:not(.source), .subsection-title, + .section-examples, + .section-method > *:not(.params):not(.description), + .description > *, + .article > *, + footer { + width: calc(50% - 8px); + margin-right: calc(50% + 8px); } + #main .description .prettyprint.source, #main .description blockquote, #main .article > .prettyprint.source, #main .article > blockquote { + width: 50%; + margin: 0 0 10px; + float: right; + clear: right; } + #main > section { + background-color: transparent; } + table.params { + margin: 0 calc(50% + 10px) 0 10px; + min-width: 200px; } + .section-method > h1, .section-method > h2 { + clear: both; } + .prettyprint > code { + white-space: pre-wrap; } + .code-col-bg { + position: fixed; + right: 0; + width: calc(50% - 240px / 2); + height: 100%; + background-color: #333; } + footer { + position: relative; + margin-left: 240px; + margin-right: calc(50% - 240px / 2); + border: none; + clear: right; } } + +/* make comments more legible */ +.prettyprint .com { + color: #7699b2; } diff --git a/interactjs/dist/api/styles/prettify-jsdoc.css b/interactjs/dist/api/styles/prettify-jsdoc.css new file mode 100644 index 000000000..834a866d4 --- /dev/null +++ b/interactjs/dist/api/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: hsl(104, 100%, 24%); + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/interactjs/dist/api/styles/prettify.css b/interactjs/dist/api/styles/prettify.css new file mode 100644 index 000000000..c9b714eb2 --- /dev/null +++ b/interactjs/dist/api/styles/prettify.css @@ -0,0 +1,119 @@ +/*! Color themes for Google Code Prettify | MIT License | github.com/jmblog/color-themes-for-google-code-prettify */ +.prettyprint { + background: #2f3640; + font-family: Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace; + border: 0 !important; +} + +.pln { + color: #e6e9ed; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; + color: #656d78; +} + +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + padding-left: 1em; + background-color: #2f3640; + list-style-type: decimal; +} + +@media screen { + + /* string content */ + + .str { + color: #ffce54; + } + + /* keyword */ + + .kwd { + color: #4fc1e9; + } + + /* comment */ + + .com { + color: #656d78; + } + + /* type name */ + + .typ { + color: #4fc1e9; + } + + /* literal value */ + + .lit { + color: #ac92ec; + } + + /* punctuation */ + + .pun { + color: #e6e9ed; + } + + /* lisp open bracket */ + + .opn { + color: #e6e9ed; + } + + /* lisp close bracket */ + + .clo { + color: #e6e9ed; + } + + /* markup tag name */ + + .tag { + color: #ed5565; + } + + /* markup attribute name */ + + .atn { + color: #a0d468; + } + + /* markup attribute value */ + + .atv { + color: #ffce54; + } + + /* declaration */ + + .dec { + color: #ac92ec; + } + + /* variable name */ + + .var { + color: #e6e9ed; + } + + /* function name */ + + .fun { + color: #e6e9ed; + } +} diff --git a/interactjs/dist/interact.js b/interactjs/dist/interact.js new file mode 100644 index 000000000..61b9e65c9 --- /dev/null +++ b/interactjs/dist/interact.js @@ -0,0 +1,10764 @@ +/** + * interact.js 1.8.5 + * + * Copyright (c) 2012-2020 Taye Adeyemi + * Released under the MIT License. + * https://raw.github.com/taye/interact.js/master/LICENSE + */ +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.interact = f()}})(function(){var define,module,exports; +var createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}}; +var _$Interactable_16 = createModuleFactory(function (module, exports) { +"use strict"; + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = exports.Interactable = void 0; + +var arr = _interopRequireWildcard(_$arr_49); + +var _browser = _interopRequireDefault(_$browser_50); + +var _clone = _interopRequireDefault(_$clone_51); + +/* removed: var _$domUtils_53 = require("@interactjs/utils/domUtils"); */; + +var _events = _interopRequireDefault(_$events_54); + +var _extend = _interopRequireDefault(_$extend_55); + +var is = _interopRequireWildcard(_$is_59); + +var _normalizeListeners = _interopRequireDefault(_$normalizeListeners_61); + +/* removed: var _$window_68 = require("@interactjs/utils/window"); */; + +var _Eventable = _interopRequireDefault(_$Eventable_14); + +var _scope = _$scope_24({}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +/** */ +var Interactable = +/*#__PURE__*/ +function () { + _createClass(Interactable, [{ + key: "_defaults", + get: function get() { + return { + base: {}, + perAction: {}, + actions: {} + }; + } + }]); + + /** */ + function Interactable(target, options, defaultContext) { + _classCallCheck(this, Interactable); + + _defineProperty(this, "options", void 0); + + _defineProperty(this, "_actions", void 0); + + _defineProperty(this, "target", void 0); + + _defineProperty(this, "events", new _Eventable["default"]()); + + _defineProperty(this, "_context", void 0); + + _defineProperty(this, "_win", void 0); + + _defineProperty(this, "_doc", void 0); + + this._actions = options.actions; + this.target = target; + this._context = options.context || defaultContext; + this._win = (0, _$window_68.getWindow)((0, _$domUtils_53.trySelector)(target) ? this._context : target); + this._doc = this._win.document; + this.set(options); + } + + _createClass(Interactable, [{ + key: "setOnEvents", + value: function setOnEvents(actionName, phases) { + if (is.func(phases.onstart)) { + this.on("".concat(actionName, "start"), phases.onstart); + } + + if (is.func(phases.onmove)) { + this.on("".concat(actionName, "move"), phases.onmove); + } + + if (is.func(phases.onend)) { + this.on("".concat(actionName, "end"), phases.onend); + } + + if (is.func(phases.oninertiastart)) { + this.on("".concat(actionName, "inertiastart"), phases.oninertiastart); + } + + return this; + } + }, { + key: "updatePerActionListeners", + value: function updatePerActionListeners(actionName, prev, cur) { + if (is.array(prev) || is.object(prev)) { + this.off(actionName, prev); + } + + if (is.array(cur) || is.object(cur)) { + this.on(actionName, cur); + } + } + }, { + key: "setPerAction", + value: function setPerAction(actionName, options) { + var defaults = this._defaults; // for all the default per-action options + + for (var optionName_ in options) { + var optionName = optionName_; + var actionOptions = this.options[actionName]; + var optionValue = options[optionName]; // remove old event listeners and add new ones + + if (optionName === 'listeners') { + this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue); + } // if the option value is an array + + + if (is.array(optionValue)) { + actionOptions[optionName] = arr.from(optionValue); + } // if the option value is an object + else if (is.plainObject(optionValue)) { + // copy the object + actionOptions[optionName] = (0, _extend["default"])(actionOptions[optionName] || {}, (0, _clone["default"])(optionValue)); // set anabled field to true if it exists in the defaults + + if (is.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) { + actionOptions[optionName].enabled = optionValue.enabled !== false; + } + } // if the option value is a boolean and the default is an object + else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) { + actionOptions[optionName].enabled = optionValue; + } // if it's anything else, do a plain assignment + else { + actionOptions[optionName] = optionValue; + } + } + } + /** + * The default function to get an Interactables bounding rect. Can be + * overridden using {@link Interactable.rectChecker}. + * + * @param {Element} [element] The element to measure. + * @return {object} The object's bounding rectangle. + */ + + }, { + key: "getRect", + value: function getRect(element) { + element = element || (is.element(this.target) ? this.target : null); + + if (is.string(this.target)) { + element = element || this._context.querySelector(this.target); + } + + return (0, _$domUtils_53.getElementRect)(element); + } + /** + * Returns or sets the function used to calculate the interactable's + * element's rectangle + * + * @param {function} [checker] A function which returns this Interactable's + * bounding rectangle. See {@link Interactable.getRect} + * @return {function | object} The checker function or this Interactable + */ + + }, { + key: "rectChecker", + value: function rectChecker(checker) { + if (is.func(checker)) { + this.getRect = checker; + return this; + } + + if (checker === null) { + delete this.getRect; + return this; + } + + return this.getRect; + } + }, { + key: "_backCompatOption", + value: function _backCompatOption(optionName, newValue) { + if ((0, _$domUtils_53.trySelector)(newValue) || is.object(newValue)) { + this.options[optionName] = newValue; + + for (var action in this._actions.map) { + this.options[action][optionName] = newValue; + } + + return this; + } + + return this.options[optionName]; + } + /** + * Gets or sets the origin of the Interactable's element. The x and y + * of the origin will be subtracted from action event coordinates. + * + * @param {Element | object | string} [origin] An HTML or SVG Element whose + * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self' + * or any CSS selector + * + * @return {object} The current origin or this Interactable + */ + + }, { + key: "origin", + value: function origin(newValue) { + return this._backCompatOption('origin', newValue); + } + /** + * Returns or sets the mouse coordinate types used to calculate the + * movement of the pointer. + * + * @param {string} [newValue] Use 'client' if you will be scrolling while + * interacting; Use 'page' if you want autoScroll to work + * @return {string | object} The current deltaSource or this Interactable + */ + + }, { + key: "deltaSource", + value: function deltaSource(newValue) { + if (newValue === 'page' || newValue === 'client') { + this.options.deltaSource = newValue; + return this; + } + + return this.options.deltaSource; + } + /** + * Gets the selector context Node of the Interactable. The default is + * `window.document`. + * + * @return {Node} The context Node of this Interactable + */ + + }, { + key: "context", + value: function context() { + return this._context; + } + }, { + key: "inContext", + value: function inContext(element) { + return this._context === element.ownerDocument || (0, _$domUtils_53.nodeContains)(this._context, element); + } + }, { + key: "testIgnoreAllow", + value: function testIgnoreAllow(options, targetNode, eventTarget) { + return !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) && this.testAllow(options.allowFrom, targetNode, eventTarget); + } + }, { + key: "testAllow", + value: function testAllow(allowFrom, targetNode, element) { + if (!allowFrom) { + return true; + } + + if (!is.element(element)) { + return false; + } + + if (is.string(allowFrom)) { + return (0, _$domUtils_53.matchesUpTo)(element, allowFrom, targetNode); + } else if (is.element(allowFrom)) { + return (0, _$domUtils_53.nodeContains)(allowFrom, element); + } + + return false; + } + }, { + key: "testIgnore", + value: function testIgnore(ignoreFrom, targetNode, element) { + if (!ignoreFrom || !is.element(element)) { + return false; + } + + if (is.string(ignoreFrom)) { + return (0, _$domUtils_53.matchesUpTo)(element, ignoreFrom, targetNode); + } else if (is.element(ignoreFrom)) { + return (0, _$domUtils_53.nodeContains)(ignoreFrom, element); + } + + return false; + } + /** + * Calls listeners for the given InteractEvent type bound globally + * and directly to this Interactable + * + * @param {InteractEvent} iEvent The InteractEvent object to be fired on this + * Interactable + * @return {Interactable} this Interactable + */ + + }, { + key: "fire", + value: function fire(iEvent) { + this.events.fire(iEvent); + return this; + } + }, { + key: "_onOff", + value: function _onOff(method, typeArg, listenerArg, options) { + if (is.object(typeArg) && !is.array(typeArg)) { + options = listenerArg; + listenerArg = null; + } + + var addRemove = method === 'on' ? 'add' : 'remove'; + var listeners = (0, _normalizeListeners["default"])(typeArg, listenerArg); + + for (var type in listeners) { + if (type === 'wheel') { + type = _browser["default"].wheelEvent; + } + + for (var _i = 0; _i < listeners[type].length; _i++) { + var _ref; + + _ref = listeners[type][_i]; + var listener = _ref; + + // if it is an action event type + if ((0, _scope.isNonNativeEvent)(type, this._actions)) { + this.events[method](type, listener); + } // delegated event + else if (is.string(this.target)) { + _events["default"]["".concat(addRemove, "Delegate")](this.target, this._context, type, listener, options); + } // remove listener from this Interactable's element + else { + _events["default"][addRemove](this.target, type, listener, options); + } + } + } + + return this; + } + /** + * Binds a listener for an InteractEvent, pointerEvent or DOM event. + * + * @param {string | array | object} types The types of events to listen + * for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * addEventListener + * @return {Interactable} This Interactable + */ + + }, { + key: "on", + value: function on(types, listener, options) { + return this._onOff('on', types, listener, options); + } + /** + * Removes an InteractEvent, pointerEvent or DOM event listener. + * + * @param {string | array | object} types The types of events that were + * listened for + * @param {function | array | object} [listener] The event listener function(s) + * @param {object | boolean} [options] options object or useCapture flag for + * removeEventListener + * @return {Interactable} This Interactable + */ + + }, { + key: "off", + value: function off(types, listener, options) { + return this._onOff('off', types, listener, options); + } + /** + * Reset the options of this Interactable + * + * @param {object} options The new settings to apply + * @return {object} This Interactable + */ + + }, { + key: "set", + value: function set(options) { + var defaults = this._defaults; + + if (!is.object(options)) { + options = {}; + } + + this.options = (0, _clone["default"])(defaults.base); + + for (var actionName_ in this._actions.methodDict) { + var actionName = actionName_; + var methodName = this._actions.methodDict[actionName]; + this.options[actionName] = {}; + this.setPerAction(actionName, (0, _extend["default"])((0, _extend["default"])({}, defaults.perAction), defaults.actions[actionName])); + this[methodName](options[actionName]); + } + + for (var setting in options) { + if (is.func(this[setting])) { + this[setting](options[setting]); + } + } + + return this; + } + /** + * Remove this interactable from the list of interactables and remove it's + * action capabilities and event listeners + * + * @return {interact} + */ + + }, { + key: "unset", + value: function unset() { + _events["default"].remove(this.target, 'all'); + + if (is.string(this.target)) { + // remove delegated events + for (var type in _events["default"].delegatedEvents) { + var delegated = _events["default"].delegatedEvents[type]; + + if (delegated.selectors[0] === this.target && delegated.contexts[0] === this._context) { + delegated.selectors.splice(0, 1); + delegated.contexts.splice(0, 1); + delegated.listeners.splice(0, 1); + } + + _events["default"].remove(this._context, type, _events["default"].delegateListener); + + _events["default"].remove(this._context, type, _events["default"].delegateUseCapture, true); + } + } else { + _events["default"].remove(this.target, 'all'); + } + } + }]); + + return Interactable; +}(); + +exports.Interactable = Interactable; +var _default = Interactable; +exports["default"] = _default; + +}); +var _$scope_24 = createModuleFactory(function (module, exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/* common-shake removed: exports.createScope = */ void createScope; +exports.isNonNativeEvent = isNonNativeEvent; +/* common-shake removed: exports.initScope = */ void initScope; +exports.Scope = void 0; + +var _domObjects = _interopRequireDefault(_$domObjects_52); + +var utils = _interopRequireWildcard(_$index_58); + +var _defaultOptions = _interopRequireDefault(_$defaultOptions_20); + +var _Eventable = _interopRequireDefault(_$Eventable_14); + +var _Interactable = _interopRequireDefault(_$Interactable_16({})); + +var _InteractableSet = _interopRequireDefault(_$InteractableSet_17); + +var _InteractEvent = _interopRequireDefault(_$InteractEvent_15); + +var _interactions = _interopRequireDefault(_$interactions_23({})); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } + +function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var win = utils.win, + browser = utils.browser, + raf = utils.raf, + events = utils.events; // eslint-disable-next-line @typescript-eslint/no-empty-interface + +function createScope() { + return new Scope(); +} + +var Scope = +/*#__PURE__*/ +function () { + // main window + // main document + // main window + // all documents being listened to + function Scope() { + var _this = this; + + _classCallCheck(this, Scope); + + _defineProperty(this, "id", "__interact_scope_".concat(Math.floor(Math.random() * 100))); + + _defineProperty(this, "listenerMaps", []); + + _defineProperty(this, "browser", browser); + + _defineProperty(this, "events", events); + + _defineProperty(this, "utils", utils); + + _defineProperty(this, "defaults", utils.clone(_defaultOptions["default"])); + + _defineProperty(this, "Eventable", _Eventable["default"]); + + _defineProperty(this, "actions", { + map: {}, + phases: { + start: true, + move: true, + end: true + }, + methodDict: {}, + phaselessTypes: {} + }); + + _defineProperty(this, "InteractEvent", _InteractEvent["default"]); + + _defineProperty(this, "Interactable", void 0); + + _defineProperty(this, "interactables", new _InteractableSet["default"](this)); + + _defineProperty(this, "_win", void 0); + + _defineProperty(this, "document", void 0); + + _defineProperty(this, "window", void 0); + + _defineProperty(this, "documents", []); + + _defineProperty(this, "_plugins", { + list: [], + map: {} + }); + + _defineProperty(this, "onWindowUnload", function (event) { + return _this.removeDocument(event.target); + }); + + var scope = this; + + this.Interactable = + /*#__PURE__*/ + function (_InteractableBase) { + _inherits(Interactable, _InteractableBase); + + function Interactable() { + _classCallCheck(this, Interactable); + + return _possibleConstructorReturn(this, _getPrototypeOf(Interactable).apply(this, arguments)); + } + + _createClass(Interactable, [{ + key: "set", + value: function set(options) { + _get(_getPrototypeOf(Interactable.prototype), "set", this).call(this, options); + + scope.fire('interactable:set', { + options: options, + interactable: this + }); + return this; + } + }, { + key: "unset", + value: function unset() { + _get(_getPrototypeOf(Interactable.prototype), "unset", this).call(this); + + for (var i = scope.interactions.list.length - 1; i >= 0; i--) { + var interaction = scope.interactions.list[i]; + + if (interaction.interactable === this) { + interaction.stop(); + scope.fire('interactions:destroy', { + interaction: interaction + }); + interaction.destroy(); + + if (scope.interactions.list.length > 2) { + scope.interactions.list.splice(i, 1); + } + } + } + + scope.fire('interactable:unset', { + interactable: this + }); + } + }, { + key: "_defaults", + get: function get() { + return scope.defaults; + } + }]); + + return Interactable; + }(_Interactable["default"]); + } + + _createClass(Scope, [{ + key: "addListeners", + value: function addListeners(map, id) { + this.listenerMaps.push({ + id: id, + map: map + }); + } + }, { + key: "fire", + value: function fire(name, arg) { + for (var _i = 0; _i < this.listenerMaps.length; _i++) { + var _ref; + + _ref = this.listenerMaps[_i]; + var _ref2 = _ref, + listener = _ref2.map[name]; + + if (!!listener && listener(arg, this, name) === false) { + return false; + } + } + } + }, { + key: "init", + value: function init(window) { + return initScope(this, window); + } + }, { + key: "pluginIsInstalled", + value: function pluginIsInstalled(plugin) { + return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1; + } + }, { + key: "usePlugin", + value: function usePlugin(plugin, options) { + if (this.pluginIsInstalled(plugin)) { + return this; + } + + if (plugin.id) { + this._plugins.map[plugin.id] = plugin; + } + + this._plugins.list.push(plugin); + + if (plugin.install) { + plugin.install(this, options); + } + + if (plugin.listeners && plugin.before) { + var _index = 0; + var len = this.listenerMaps.length; + var before = plugin.before.reduce(function (acc, id) { + acc[id] = true; + return acc; + }, {}); + + for (; _index < len; _index++) { + var otherId = this.listenerMaps[_index].id; + + if (before[otherId]) { + break; + } + } + + this.listenerMaps.splice(_index, 0, { + id: plugin.id, + map: plugin.listeners + }); + } else if (plugin.listeners) { + this.listenerMaps.push({ + id: plugin.id, + map: plugin.listeners + }); + } + + return this; + } + }, { + key: "addDocument", + value: function addDocument(doc, options) { + // do nothing if document is already known + if (this.getDocIndex(doc) !== -1) { + return false; + } + + var window = win.getWindow(doc); + options = options ? utils.extend({}, options) : {}; + this.documents.push({ + doc: doc, + options: options + }); + events.documents.push(doc); // don't add an unload event for the main document + // so that the page may be cached in browser history + + if (doc !== this.document) { + events.add(window, 'unload', this.onWindowUnload); + } + + this.fire('scope:add-document', { + doc: doc, + window: window, + scope: this, + options: options + }); + } + }, { + key: "removeDocument", + value: function removeDocument(doc) { + var index = this.getDocIndex(doc); + var window = win.getWindow(doc); + var options = this.documents[index].options; + events.remove(window, 'unload', this.onWindowUnload); + this.documents.splice(index, 1); + events.documents.splice(index, 1); + this.fire('scope:remove-document', { + doc: doc, + window: window, + scope: this, + options: options + }); + } + }, { + key: "getDocIndex", + value: function getDocIndex(doc) { + for (var i = 0; i < this.documents.length; i++) { + if (this.documents[i].doc === doc) { + return i; + } + } + + return -1; + } + }, { + key: "getDocOptions", + value: function getDocOptions(doc) { + var docIndex = this.getDocIndex(doc); + return docIndex === -1 ? null : this.documents[docIndex].options; + } + }, { + key: "now", + value: function now() { + return (this.window.Date || Date).now(); + } + }]); + + return Scope; +}(); + +exports.Scope = Scope; + +function isNonNativeEvent(type, actions) { + if (actions.phaselessTypes[type]) { + return true; + } + + for (var name in actions.map) { + if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) { + return true; + } + } + + return false; +} + +function initScope(scope, window) { + win.init(window); + + _domObjects["default"].init(window); + + browser.init(window); + raf.init(window); + events.init(window); + scope.usePlugin(_interactions["default"]); + scope.document = window.document; + scope.window = window; + return scope; +} + +}); +var _$interactions_23 = createModuleFactory(function (module, exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports["default"] = void 0; + +var _browser = _interopRequireDefault(_$browser_50); + +var _domObjects = _interopRequireDefault(_$domObjects_52); + +/* removed: var _$domUtils_53 = require("@interactjs/utils/domUtils"); */; + +var _events = _interopRequireDefault(_$events_54); + +var pointerUtils = _interopRequireWildcard(_$pointerUtils_63); + +var _Interaction = _interopRequireDefault(_$Interaction_18); + +var _interactionFinder = _interopRequireDefault(_$interactionFinder_22); + +var _scope = _$scope_24({}); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +var methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur']; + +function install(scope) { + var listeners = {}; + + for (var _i = 0; _i < methodNames.length; _i++) { + var _ref; + + _ref = methodNames[_i]; + var method = _ref; + listeners[method] = doOnInteractions(method, scope); + } + + var pEventTypes = _browser["default"].pEventTypes; + var docEvents; + + if (_domObjects["default"].PointerEvent) { + docEvents = [{ + type: pEventTypes.down, + listener: releasePointersOnRemovedEls + }, { + type: pEventTypes.down, + listener: listeners.pointerDown + }, { + type: pEventTypes.move, + listener: listeners.pointerMove + }, { + type: pEventTypes.up, + listener: listeners.pointerUp + }, { + type: pEventTypes.cancel, + listener: listeners.pointerUp + }]; + } else { + docEvents = [{ + type: 'mousedown', + listener: listeners.pointerDown + }, { + type: 'mousemove', + listener: listeners.pointerMove + }, { + type: 'mouseup', + listener: listeners.pointerUp + }, { + type: 'touchstart', + listener: releasePointersOnRemovedEls + }, { + type: 'touchstart', + listener: listeners.pointerDown + }, { + type: 'touchmove', + listener: listeners.pointerMove + }, { + type: 'touchend', + listener: listeners.pointerUp + }, { + type: 'touchcancel', + listener: listeners.pointerUp + }]; + } + + docEvents.push({ + type: 'blur', + listener: function listener(event) { + for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) { + var _ref2; + + _ref2 = scope.interactions.list[_i2]; + var interaction = _ref2; + interaction.documentBlur(event); + } + } + }); // for ignoring browser's simulated mouse events + + scope.prevTouchTime = 0; + + scope.Interaction = + /*#__PURE__*/ + function (_InteractionBase) { + _inherits(Interaction, _InteractionBase); + + function Interaction() { + _classCallCheck(this, Interaction); + + return _possibleConstructorReturn(this, _getPrototypeOf(Interaction).apply(this, arguments)); + } + + _createClass(Interaction, [{ + key: "_now", + value: function _now() { + return scope.now(); + } + }, { + key: "pointerMoveTolerance", + get: function get() { + return scope.interactions.pointerMoveTolerance; + }, + set: function set(value) { + scope.interactions.pointerMoveTolerance = value; + } + }]); + + return Interaction; + }(_Interaction["default"]); + + scope.interactions = { + // all active and idle interactions + list: [], + "new": function _new(options) { + options.scopeFire = function (name, arg) { + return scope.fire(name, arg); + }; + + var interaction = new scope.Interaction(options); + scope.interactions.list.push(interaction); + return interaction; + }, + listeners: listeners, + docEvents: docEvents, + pointerMoveTolerance: 1 + }; + + function releasePointersOnRemovedEls() { + // for all inactive touch interactions with pointers down + for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { + var _ref3; + + _ref3 = scope.interactions.list[_i3]; + var interaction = _ref3; + + if (!interaction.pointerIsDown || interaction.pointerType !== 'touch' || interaction._interacting) { + continue; + } // if a pointer is down on an element that is no longer in the DOM tree + + + var _loop = function _loop() { + _ref4 = interaction.pointers[_i4]; + var pointer = _ref4; + + if (!scope.documents.some(function (_ref5) { + var doc = _ref5.doc; + return (0, _$domUtils_53.nodeContains)(doc, pointer.downTarget); + })) { + // remove the pointer from the interaction + interaction.removePointer(pointer.pointer, pointer.event); + } + }; + + for (var _i4 = 0; _i4 < interaction.pointers.length; _i4++) { + var _ref4; + + _loop(); + } + } + } +} + +function doOnInteractions(method, scope) { + return function (event) { + var interactions = scope.interactions.list; + var pointerType = pointerUtils.getPointerType(event); + + var _pointerUtils$getEven = pointerUtils.getEventTargets(event), + _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 2), + eventTarget = _pointerUtils$getEven2[0], + curEventTarget = _pointerUtils$getEven2[1]; + + var matches = []; // [ [pointer, interaction], ...] + + if (/^touch/.test(event.type)) { + scope.prevTouchTime = scope.now(); + + for (var _i5 = 0; _i5 < event.changedTouches.length; _i5++) { + var _ref6; + + _ref6 = event.changedTouches[_i5]; + var changedTouch = _ref6; + var pointer = changedTouch; + var pointerId = pointerUtils.getPointerId(pointer); + var searchDetails = { + pointer: pointer, + pointerId: pointerId, + pointerType: pointerType, + eventType: event.type, + eventTarget: eventTarget, + curEventTarget: curEventTarget, + scope: scope + }; + var interaction = getInteraction(searchDetails); + matches.push([searchDetails.pointer, searchDetails.eventTarget, searchDetails.curEventTarget, interaction]); + } + } else { + var invalidPointer = false; + + if (!_browser["default"].supportsPointerEvent && /mouse/.test(event.type)) { + // ignore mouse events while touch interactions are active + for (var i = 0; i < interactions.length && !invalidPointer; i++) { + invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown; + } // try to ignore mouse events that are simulated by the browser + // after a touch event + + + invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 || // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated + event.timeStamp === 0; + } + + if (!invalidPointer) { + var _searchDetails = { + pointer: event, + pointerId: pointerUtils.getPointerId(event), + pointerType: pointerType, + eventType: event.type, + curEventTarget: curEventTarget, + eventTarget: eventTarget, + scope: scope + }; + + var _interaction = getInteraction(_searchDetails); + + matches.push([_searchDetails.pointer, _searchDetails.eventTarget, _searchDetails.curEventTarget, _interaction]); + } + } // eslint-disable-next-line no-shadow + + + for (var _i6 = 0; _i6 < matches.length; _i6++) { + var _matches$_i = _slicedToArray(matches[_i6], 4), + _pointer = _matches$_i[0], + _eventTarget = _matches$_i[1], + _curEventTarget = _matches$_i[2], + _interaction2 = _matches$_i[3]; + + _interaction2[method](_pointer, event, _eventTarget, _curEventTarget); + } + }; +} + +function getInteraction(searchDetails) { + var pointerType = searchDetails.pointerType, + scope = searchDetails.scope; + + var foundInteraction = _interactionFinder["default"].search(searchDetails); + + var signalArg = { + interaction: foundInteraction, + searchDetails: searchDetails + }; + scope.fire('interactions:find', signalArg); + return signalArg.interaction || scope.interactions["new"]({ + pointerType: pointerType + }); +} + +function onDocSignal(_ref7, eventMethodName) { + var doc = _ref7.doc, + scope = _ref7.scope, + options = _ref7.options; + var docEvents = scope.interactions.docEvents; + var eventMethod = _events["default"][eventMethodName]; + + if (scope.browser.isIOS && !options.events) { + options.events = { + passive: false + }; + } // delegate event listener + + + for (var eventType in _events["default"].delegatedEvents) { + eventMethod(doc, eventType, _events["default"].delegateListener); + eventMethod(doc, eventType, _events["default"].delegateUseCapture, true); + } + + var eventOptions = options && options.events; + + for (var _i7 = 0; _i7 < docEvents.length; _i7++) { + var _ref8; + + _ref8 = docEvents[_i7]; + var _ref9 = _ref8, + _type = _ref9.type, + listener = _ref9.listener; + eventMethod(doc, _type, listener, eventOptions); + } +} + +var _default = { + id: 'core/interactions', + install: install, + listeners: { + 'scope:add-document': function scopeAddDocument(arg) { + return onDocSignal(arg, 'add'); + }, + 'scope:remove-document': function scopeRemoveDocument(arg) { + return onDocSignal(arg, 'remove'); + } + }, + onDocSignal: onDocSignal, + doOnInteractions: doOnInteractions, + methodNames: methodNames +}; +exports["default"] = _default; + +}); +var _$isWindow_60 = {}; +"use strict"; + +Object.defineProperty(_$isWindow_60, "__esModule", { + value: true +}); +_$isWindow_60["default"] = void 0; + +var _default = function _default(thing) { + return !!(thing && thing.Window) && thing instanceof thing.Window; +}; + +_$isWindow_60["default"] = _default; + +var _$window_68 = {}; +"use strict"; + +Object.defineProperty(_$window_68, "__esModule", { + value: true +}); +_$window_68.init = init; +_$window_68.getWindow = getWindow; +_$window_68["default"] = void 0; + +var _isWindow = _interopRequireDefault(_$isWindow_60); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var win = { + realWindow: undefined, + window: undefined, + getWindow: getWindow, + init: init +}; + +function init(window) { + // get wrapped window if using Shadow DOM polyfill + win.realWindow = window; // create a TextNode + + var el = window.document.createTextNode(''); // check if it's wrapped by a polyfill + + if (el.ownerDocument !== window.document && typeof window.wrap === 'function' && window.wrap(el) === el) { + // use wrapped window + window = window.wrap(window); + } + + win.window = window; +} + +if (typeof window === 'undefined') { + win.window = undefined; + win.realWindow = undefined; +} else { + init(window); +} + +function getWindow(node) { + if ((0, _isWindow["default"])(node)) { + return node; + } + + var rootNode = node.ownerDocument || node; + return rootNode.defaultView || win.window; +} + +win.init = init; +var ___default_68 = win; +_$window_68["default"] = ___default_68; + +var _$is_59 = {}; +"use strict"; + +Object.defineProperty(_$is_59, "__esModule", { + value: true +}); +_$is_59.array = _$is_59.plainObject = _$is_59.element = _$is_59.string = _$is_59.bool = _$is_59.number = _$is_59.func = _$is_59.object = _$is_59.docFrag = _$is_59.window = void 0; + +var ___isWindow_59 = ___interopRequireDefault_59(_$isWindow_60); + +var _window2 = ___interopRequireDefault_59(_$window_68); + +function ___interopRequireDefault_59(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } + +var __window_59 = function window(thing) { + return thing === _window2["default"].window || (0, ___isWindow_59["default"])(thing); +}; + +_$is_59.window = __window_59; + +var docFrag = function docFrag(thing) { + return object(thing) && thing.nodeType === 11; +}; + +_$is_59.docFrag = docFrag; + +var object = function object(thing) { + return !!thing && _typeof(thing) === 'object'; +}; + +_$is_59.object = object; + +var func = function func(thing) { + return typeof thing === 'function'; +}; + +_$is_59.func = func; + +var number = function number(thing) { + return typeof thing === 'number'; +}; + +_$is_59.number = number; + +var bool = function bool(thing) { + return typeof thing === 'boolean'; +}; + +_$is_59.bool = bool; + +var string = function string(thing) { + return typeof thing === 'string'; +}; + +_$is_59.string = string; + +var element = function element(thing) { + if (!thing || _typeof(thing) !== 'object') { + return false; + } + + var _window = _window2["default"].getWindow(thing) || _window2["default"].window; + + return /object|function/.test(_typeof(_window.Element)) ? thing instanceof _window.Element // DOM2 + : thing.nodeType === 1 && typeof thing.nodeName === 'string'; +}; + +_$is_59.element = element; + +var plainObject = function plainObject(thing) { + return object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString()); +}; + +_$is_59.plainObject = plainObject; + +var array = function array(thing) { + return object(thing) && typeof thing.length !== 'undefined' && func(thing.splice); +}; + +_$is_59.array = array; + +var _$drag_1 = {}; +"use strict"; + +function ___typeof_1(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_1 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_1(obj); } + +Object.defineProperty(_$drag_1, "__esModule", { + value: true +}); +_$drag_1["default"] = void 0; + +var is = _interopRequireWildcard(_$is_59); + +function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; } + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_1(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function install(scope) { + var actions = scope.actions, + Interactable = scope.Interactable, + defaults = scope.defaults; + Interactable.prototype.draggable = drag.draggable; + actions.map.drag = drag; + actions.methodDict.drag = 'draggable'; + defaults.actions.drag = drag.defaults; +} + +function beforeMove(_ref) { + var interaction = _ref.interaction; + + if (interaction.prepared.name !== 'drag') { + return; + } + + var axis = interaction.prepared.axis; + + if (axis === 'x') { + interaction.coords.cur.page.y = interaction.coords.start.page.y; + interaction.coords.cur.client.y = interaction.coords.start.client.y; + interaction.coords.velocity.client.y = 0; + interaction.coords.velocity.page.y = 0; + } else if (axis === 'y') { + interaction.coords.cur.page.x = interaction.coords.start.page.x; + interaction.coords.cur.client.x = interaction.coords.start.client.x; + interaction.coords.velocity.client.x = 0; + interaction.coords.velocity.page.x = 0; + } +} + +function move(_ref2) { + var iEvent = _ref2.iEvent, + interaction = _ref2.interaction; + + if (interaction.prepared.name !== 'drag') { + return; + } + + var axis = interaction.prepared.axis; + + if (axis === 'x' || axis === 'y') { + var opposite = axis === 'x' ? 'y' : 'x'; + iEvent.page[opposite] = interaction.coords.start.page[opposite]; + iEvent.client[opposite] = interaction.coords.start.client[opposite]; + iEvent.delta[opposite] = 0; + } +} +/** + * ```js + * interact(element).draggable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * // the axis in which the first movement must be + * // for the drag sequence to start + * // 'xy' by default - any direction + * startAxis: 'x' || 'y' || 'xy', + * + * // 'xy' by default - don't restrict to one axis (move in any direction) + * // 'x' or 'y' to restrict movement to either axis + * // 'start' to restrict movement to the axis the drag started in + * lockAxis: 'x' || 'y' || 'xy' || 'start', + * + * // max number of drags that can happen concurrently + * // with elements of this Interactable. Infinity by default + * max: Infinity, + * + * // max number of drags that can target the same element+Interactable + * // 1 by default + * maxPerElement: 2 + * }) + * + * var isDraggable = interact('element').draggable(); // true + * ``` + * + * Get or set whether drag actions can be performed on the target + * + * @alias Interactable.prototype.draggable + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on drag events (object makes the Interactable + * draggable) + * @return {boolean | Interactable} boolean indicating if this can be the + * target of drag events, or this Interctable + */ + + +var draggable = function draggable(options) { + if (is.object(options)) { + this.options.drag.enabled = options.enabled !== false; + this.setPerAction('drag', options); + this.setOnEvents('drag', options); + + if (/^(xy|x|y|start)$/.test(options.lockAxis)) { + this.options.drag.lockAxis = options.lockAxis; + } + + if (/^(xy|x|y)$/.test(options.startAxis)) { + this.options.drag.startAxis = options.startAxis; + } + + return this; + } + + if (is.bool(options)) { + this.options.drag.enabled = options; + return this; + } + + return this.options.drag; +}; + +var drag = { + id: 'actions/drag', + install: install, + listeners: { + 'interactions:before-action-move': beforeMove, + 'interactions:action-resume': beforeMove, + // dragmove + 'interactions:action-move': move, + 'auto-start:check': function autoStartCheck(arg) { + var interaction = arg.interaction, + interactable = arg.interactable, + buttons = arg.buttons; + var dragOptions = interactable.options.drag; + + if (!(dragOptions && dragOptions.enabled) || // check mouseButton setting if the pointer is down + interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & interactable.options.drag.mouseButtons) === 0) { + return undefined; + } + + arg.action = { + name: 'drag', + axis: dragOptions.lockAxis === 'start' ? dragOptions.startAxis : dragOptions.lockAxis + }; + return false; + } + }, + draggable: draggable, + beforeMove: beforeMove, + move: move, + defaults: { + startAxis: 'xy', + lockAxis: 'xy' + }, + getCursor: function getCursor() { + return 'move'; + } +}; +var ___default_1 = drag; +_$drag_1["default"] = ___default_1; + +var _$arr_49 = {}; +"use strict"; + +Object.defineProperty(_$arr_49, "__esModule", { + value: true +}); +_$arr_49.contains = contains; +_$arr_49.remove = remove; +_$arr_49.merge = merge; +_$arr_49.from = from; +_$arr_49.findIndex = findIndex; +_$arr_49.find = find; + +function contains(array, target) { + return array.indexOf(target) !== -1; +} + +function remove(array, target) { + return array.splice(array.indexOf(target), 1); +} + +function merge(target, source) { + for (var _i = 0; _i < source.length; _i++) { + var _ref; + + _ref = source[_i]; + var item = _ref; + target.push(item); + } + + return target; +} + +function from(source) { + return merge([], source); +} + +function findIndex(array, func) { + for (var i = 0; i < array.length; i++) { + if (func(array[i], i, array)) { + return i; + } + } + + return -1; +} + +function find(array, func) { + return array[findIndex(array, func)]; +} + +var _$domObjects_52 = {}; +"use strict"; + +Object.defineProperty(_$domObjects_52, "__esModule", { + value: true +}); +_$domObjects_52["default"] = void 0; +var domObjects = { + init: __init_52, + document: null, + DocumentFragment: null, + SVGElement: null, + SVGSVGElement: null, + SVGElementInstance: null, + Element: null, + HTMLElement: null, + Event: null, + Touch: null, + PointerEvent: null +}; + +function blank() {} + +var ___default_52 = domObjects; +_$domObjects_52["default"] = ___default_52; + +function __init_52(window) { + var win = window; + domObjects.document = win.document; + domObjects.DocumentFragment = win.DocumentFragment || blank; + domObjects.SVGElement = win.SVGElement || blank; + domObjects.SVGSVGElement = win.SVGSVGElement || blank; + domObjects.SVGElementInstance = win.SVGElementInstance || blank; + domObjects.Element = win.Element || blank; + domObjects.HTMLElement = win.HTMLElement || domObjects.Element; + domObjects.Event = win.Event; + domObjects.Touch = win.Touch || blank; + domObjects.PointerEvent = win.PointerEvent || win.MSPointerEvent; +} + +var _$browser_50 = {}; +"use strict"; + +function ___typeof_50(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_50 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_50 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_50(obj); } + +Object.defineProperty(_$browser_50, "__esModule", { + value: true +}); +_$browser_50["default"] = void 0; + +var _domObjects = ___interopRequireDefault_50(_$domObjects_52); + +var __is_50 = ___interopRequireWildcard_50(_$is_59); + +var _window = ___interopRequireDefault_50(_$window_68); + +function ___getRequireWildcardCache_50() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_50 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_50(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_50(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_50(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_50(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var browser = { + init: __init_50, + supportsTouch: null, + supportsPointerEvent: null, + isIOS7: null, + isIOS: null, + isIe9: null, + isOperaMobile: null, + prefixedMatchesSelector: null, + pEventTypes: null, + wheelEvent: null +}; + +function __init_50(window) { + var Element = _domObjects["default"].Element; + var navigator = _window["default"].window.navigator; // Does the browser support touch input? + + browser.supportsTouch = 'ontouchstart' in window || __is_50.func(window.DocumentTouch) && _domObjects["default"].document instanceof window.DocumentTouch; // Does the browser support PointerEvents + + browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!_domObjects["default"].PointerEvent; + browser.isIOS = /iP(hone|od|ad)/.test(navigator.platform); // scrolling doesn't change the result of getClientRects on iOS 7 + + browser.isIOS7 = /iP(hone|od|ad)/.test(navigator.platform) && /OS 7[^\d]/.test(navigator.appVersion); + browser.isIe9 = /MSIE 9/.test(navigator.userAgent); // Opera Mobile must be handled differently + + browser.isOperaMobile = navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent); // prefix matchesSelector + + browser.prefixedMatchesSelector = 'matches' in Element.prototype ? 'matches' : 'webkitMatchesSelector' in Element.prototype ? 'webkitMatchesSelector' : 'mozMatchesSelector' in Element.prototype ? 'mozMatchesSelector' : 'oMatchesSelector' in Element.prototype ? 'oMatchesSelector' : 'msMatchesSelector'; + browser.pEventTypes = browser.supportsPointerEvent ? _domObjects["default"].PointerEvent === window.MSPointerEvent ? { + up: 'MSPointerUp', + down: 'MSPointerDown', + over: 'mouseover', + out: 'mouseout', + move: 'MSPointerMove', + cancel: 'MSPointerCancel' + } : { + up: 'pointerup', + down: 'pointerdown', + over: 'pointerover', + out: 'pointerout', + move: 'pointermove', + cancel: 'pointercancel' + } : null; // because Webkit and Opera still use 'mousewheel' event type + + browser.wheelEvent = 'onmousewheel' in _domObjects["default"].document ? 'mousewheel' : 'wheel'; +} + +var ___default_50 = browser; +_$browser_50["default"] = ___default_50; + +var _$clone_51 = {}; +"use strict"; + +function ___typeof_51(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_51 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_51 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_51(obj); } + +Object.defineProperty(_$clone_51, "__esModule", { + value: true +}); +_$clone_51["default"] = clone; + +var arr = ___interopRequireWildcard_51(_$arr_49); + +var __is_51 = ___interopRequireWildcard_51(_$is_59); + +function ___getRequireWildcardCache_51() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_51 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_51(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_51(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_51(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +// tslint:disable-next-line ban-types +function clone(source) { + var dest = {}; + + for (var prop in source) { + var value = source[prop]; + + if (__is_51.plainObject(value)) { + dest[prop] = clone(value); + } else if (__is_51.array(value)) { + dest[prop] = arr.from(value); + } else { + dest[prop] = value; + } + } + + return dest; +} + +var _$domUtils_53 = {}; +"use strict"; + +function ___typeof_53(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_53 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_53 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_53(obj); } + +Object.defineProperty(_$domUtils_53, "__esModule", { + value: true +}); +_$domUtils_53.nodeContains = nodeContains; +_$domUtils_53.closest = closest; +_$domUtils_53.parentNode = parentNode; +_$domUtils_53.matchesSelector = matchesSelector; +_$domUtils_53.indexOfDeepestElement = indexOfDeepestElement; +_$domUtils_53.matchesUpTo = matchesUpTo; +_$domUtils_53.getActualElement = getActualElement; +_$domUtils_53.getScrollXY = getScrollXY; +_$domUtils_53.getElementClientRect = getElementClientRect; +_$domUtils_53.getElementRect = getElementRect; +_$domUtils_53.getPath = getPath; +_$domUtils_53.trySelector = trySelector; + +var _browser = ___interopRequireDefault_53(_$browser_50); + +var ___domObjects_53 = ___interopRequireDefault_53(_$domObjects_52); + +var __is_53 = ___interopRequireWildcard_53(_$is_59); + +var ___window_53 = ___interopRequireWildcard_53(_$window_68); + +function ___getRequireWildcardCache_53() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_53 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_53(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_53(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_53(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_53(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function nodeContains(parent, child) { + while (child) { + if (child === parent) { + return true; + } + + child = child.parentNode; + } + + return false; +} + +function closest(element, selector) { + while (__is_53.element(element)) { + if (matchesSelector(element, selector)) { + return element; + } + + element = parentNode(element); + } + + return null; +} + +function parentNode(node) { + var parent = node.parentNode; + + if (__is_53.docFrag(parent)) { + // skip past #shado-root fragments + // tslint:disable-next-line + while ((parent = parent.host) && __is_53.docFrag(parent)) { + continue; + } + + return parent; + } + + return parent; +} + +function matchesSelector(element, selector) { + // remove /deep/ from selectors if shadowDOM polyfill is used + if (___window_53["default"].window !== ___window_53["default"].realWindow) { + selector = selector.replace(/\/deep\//g, ' '); + } + + return element[_browser["default"].prefixedMatchesSelector](selector); +} + +var getParent = function getParent(el) { + return el.parentNode ? el.parentNode : el.host; +}; // Test for the element that's "above" all other qualifiers + + +function indexOfDeepestElement(elements) { + var deepestZoneParents = []; + var deepestZone = elements[0]; + var index = deepestZone ? 0 : -1; + var i; + var n; + + for (i = 1; i < elements.length; i++) { + var dropzone = elements[i]; // an element might belong to multiple selector dropzones + + if (!dropzone || dropzone === deepestZone) { + continue; + } + + if (!deepestZone) { + deepestZone = dropzone; + index = i; + continue; + } // check if the deepest or current are document.documentElement or document.rootElement + // - if the current dropzone is, do nothing and continue + + + if (dropzone.parentNode === dropzone.ownerDocument) { + continue; + } // - if deepest is, update with the current dropzone and continue to next + else if (deepestZone.parentNode === dropzone.ownerDocument) { + deepestZone = dropzone; + index = i; + continue; + } // compare zIndex of siblings + + + if (dropzone.parentNode === deepestZone.parentNode) { + var deepestZIndex = parseInt((0, ___window_53.getWindow)(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0; + var dropzoneZIndex = parseInt((0, ___window_53.getWindow)(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0; + + if (dropzoneZIndex >= deepestZIndex) { + deepestZone = dropzone; + index = i; + } + + continue; + } // populate the ancestry array for the latest deepest dropzone + + + if (!deepestZoneParents.length) { + var _parent = deepestZone; + var parentParent = void 0; + + while ((parentParent = getParent(_parent)) && parentParent !== _parent.ownerDocument) { + deepestZoneParents.unshift(_parent); + _parent = parentParent; + } + } + + var parent = void 0; // if this element is an svg element and the current deepest is an + // HTMLElement + + if (deepestZone instanceof ___domObjects_53["default"].HTMLElement && dropzone instanceof ___domObjects_53["default"].SVGElement && !(dropzone instanceof ___domObjects_53["default"].SVGSVGElement)) { + if (dropzone === deepestZone.parentNode) { + continue; + } + + parent = dropzone.ownerSVGElement; + } else { + parent = dropzone; + } + + var dropzoneParents = []; + + while (parent.parentNode !== parent.ownerDocument) { + dropzoneParents.unshift(parent); + parent = getParent(parent); + } + + n = 0; // get (position of last common ancestor) + 1 + + while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) { + n++; + } + + var parents = [dropzoneParents[n - 1], dropzoneParents[n], deepestZoneParents[n]]; + var child = parents[0].lastChild; + + while (child) { + if (child === parents[1]) { + deepestZone = dropzone; + index = i; + deepestZoneParents = dropzoneParents; + break; + } else if (child === parents[2]) { + break; + } + + child = child.previousSibling; + } + } + + return index; +} + +function matchesUpTo(element, selector, limit) { + while (__is_53.element(element)) { + if (matchesSelector(element, selector)) { + return true; + } + + element = parentNode(element); + + if (element === limit) { + return matchesSelector(element, selector); + } + } + + return false; +} + +function getActualElement(element) { + return element instanceof ___domObjects_53["default"].SVGElementInstance ? element.correspondingUseElement : element; +} + +function getScrollXY(relevantWindow) { + relevantWindow = relevantWindow || ___window_53["default"].window; + return { + x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft, + y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop + }; +} + +function getElementClientRect(element) { + var clientRect = element instanceof ___domObjects_53["default"].SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0]; + return clientRect && { + left: clientRect.left, + right: clientRect.right, + top: clientRect.top, + bottom: clientRect.bottom, + width: clientRect.width || clientRect.right - clientRect.left, + height: clientRect.height || clientRect.bottom - clientRect.top + }; +} + +function getElementRect(element) { + var clientRect = getElementClientRect(element); + + if (!_browser["default"].isIOS7 && clientRect) { + var scroll = getScrollXY(___window_53["default"].getWindow(element)); + clientRect.left += scroll.x; + clientRect.right += scroll.x; + clientRect.top += scroll.y; + clientRect.bottom += scroll.y; + } + + return clientRect; +} + +function getPath(node) { + var path = []; + + while (node) { + path.push(node); + node = parentNode(node); + } + + return path; +} + +function trySelector(value) { + if (!__is_53.string(value)) { + return false; + } // an exception will be raised if it is invalid + + + ___domObjects_53["default"].document.querySelector(value); + + return true; +} + +var _$pointerExtend_62 = {}; +"use strict"; + +Object.defineProperty(_$pointerExtend_62, "__esModule", { + value: true +}); +_$pointerExtend_62["default"] = void 0; + +function pointerExtend(dest, source) { + for (var prop in source) { + var prefixedPropREs = pointerExtend.prefixedPropREs; + var deprecated = false; // skip deprecated prefixed properties + + for (var vendor in prefixedPropREs) { + if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) { + deprecated = true; + break; + } + } + + if (!deprecated && typeof source[prop] !== 'function') { + dest[prop] = source[prop]; + } + } + + return dest; +} + +pointerExtend.prefixedPropREs = { + webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/, + moz: /(Pressure)$/ +}; +var ___default_62 = pointerExtend; +_$pointerExtend_62["default"] = ___default_62; + +var _$hypot_57 = {}; +"use strict"; + +Object.defineProperty(_$hypot_57, "__esModule", { + value: true +}); +_$hypot_57["default"] = void 0; + +var ___default_57 = function _default(x, y) { + return Math.sqrt(x * x + y * y); +}; + +_$hypot_57["default"] = ___default_57; + +var _$pointerUtils_63 = {}; +"use strict"; + +function ___typeof_63(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_63 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_63 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_63(obj); } + +Object.defineProperty(_$pointerUtils_63, "__esModule", { + value: true +}); +_$pointerUtils_63.copyCoords = copyCoords; +_$pointerUtils_63.setCoordDeltas = setCoordDeltas; +_$pointerUtils_63.setCoordVelocity = setCoordVelocity; +_$pointerUtils_63.setZeroCoords = setZeroCoords; +_$pointerUtils_63.isNativePointer = isNativePointer; +_$pointerUtils_63.getXY = getXY; +_$pointerUtils_63.getPageXY = getPageXY; +_$pointerUtils_63.getClientXY = getClientXY; +_$pointerUtils_63.getPointerId = getPointerId; +_$pointerUtils_63.setCoords = setCoords; +_$pointerUtils_63.getTouchPair = getTouchPair; +_$pointerUtils_63.pointerAverage = pointerAverage; +_$pointerUtils_63.touchBBox = touchBBox; +_$pointerUtils_63.touchDistance = touchDistance; +_$pointerUtils_63.touchAngle = touchAngle; +_$pointerUtils_63.getPointerType = getPointerType; +_$pointerUtils_63.getEventTargets = getEventTargets; +_$pointerUtils_63.newCoords = newCoords; +_$pointerUtils_63.coordsToEvent = coordsToEvent; +Object.defineProperty(_$pointerUtils_63, "pointerExtend", { + enumerable: true, + get: function get() { + return _pointerExtend["default"]; + } +}); + +var ___browser_63 = ___interopRequireDefault_63(_$browser_50); + +var ___domObjects_63 = ___interopRequireDefault_63(_$domObjects_52); + +var domUtils = ___interopRequireWildcard_63(_$domUtils_53); + +var _hypot = ___interopRequireDefault_63(_$hypot_57); + +var __is_63 = ___interopRequireWildcard_63(_$is_59); + +var _pointerExtend = ___interopRequireDefault_63(_$pointerExtend_62); + +function ___getRequireWildcardCache_63() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_63 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_63(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_63(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_63(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_63(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function copyCoords(dest, src) { + dest.page = dest.page || {}; + dest.page.x = src.page.x; + dest.page.y = src.page.y; + dest.client = dest.client || {}; + dest.client.x = src.client.x; + dest.client.y = src.client.y; + dest.timeStamp = src.timeStamp; +} + +function setCoordDeltas(targetObj, prev, cur) { + targetObj.page.x = cur.page.x - prev.page.x; + targetObj.page.y = cur.page.y - prev.page.y; + targetObj.client.x = cur.client.x - prev.client.x; + targetObj.client.y = cur.client.y - prev.client.y; + targetObj.timeStamp = cur.timeStamp - prev.timeStamp; +} + +function setCoordVelocity(targetObj, delta) { + var dt = Math.max(delta.timeStamp / 1000, 0.001); + targetObj.page.x = delta.page.x / dt; + targetObj.page.y = delta.page.y / dt; + targetObj.client.x = delta.client.x / dt; + targetObj.client.y = delta.client.y / dt; + targetObj.timeStamp = dt; +} + +function setZeroCoords(targetObj) { + targetObj.page.x = 0; + targetObj.page.y = 0; + targetObj.client.x = 0; + targetObj.client.y = 0; +} + +function isNativePointer(pointer) { + return pointer instanceof ___domObjects_63["default"].Event || pointer instanceof ___domObjects_63["default"].Touch; +} // Get specified X/Y coords for mouse or event.touches[0] + + +function getXY(type, pointer, xy) { + xy = xy || {}; + type = type || 'page'; + xy.x = pointer[type + 'X']; + xy.y = pointer[type + 'Y']; + return xy; +} + +function getPageXY(pointer, page) { + page = page || { + x: 0, + y: 0 + }; // Opera Mobile handles the viewport and scrolling oddly + + if (___browser_63["default"].isOperaMobile && isNativePointer(pointer)) { + getXY('screen', pointer, page); + page.x += window.scrollX; + page.y += window.scrollY; + } else { + getXY('page', pointer, page); + } + + return page; +} + +function getClientXY(pointer, client) { + client = client || {}; + + if (___browser_63["default"].isOperaMobile && isNativePointer(pointer)) { + // Opera Mobile handles the viewport and scrolling oddly + getXY('screen', pointer, client); + } else { + getXY('client', pointer, client); + } + + return client; +} + +function getPointerId(pointer) { + return __is_63.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier; +} + +function setCoords(targetObj, pointers, timeStamp) { + var pointer = pointers.length > 1 ? pointerAverage(pointers) : pointers[0]; + var tmpXY = {}; + getPageXY(pointer, tmpXY); + targetObj.page.x = tmpXY.x; + targetObj.page.y = tmpXY.y; + getClientXY(pointer, tmpXY); + targetObj.client.x = tmpXY.x; + targetObj.client.y = tmpXY.y; + targetObj.timeStamp = timeStamp; +} + +function getTouchPair(event) { + var touches = []; // array of touches is supplied + + if (__is_63.array(event)) { + touches[0] = event[0]; + touches[1] = event[1]; + } // an event + else { + if (event.type === 'touchend') { + if (event.touches.length === 1) { + touches[0] = event.touches[0]; + touches[1] = event.changedTouches[0]; + } else if (event.touches.length === 0) { + touches[0] = event.changedTouches[0]; + touches[1] = event.changedTouches[1]; + } + } else { + touches[0] = event.touches[0]; + touches[1] = event.touches[1]; + } + } + + return touches; +} + +function pointerAverage(pointers) { + var average = { + pageX: 0, + pageY: 0, + clientX: 0, + clientY: 0, + screenX: 0, + screenY: 0 + }; + + for (var _i = 0; _i < pointers.length; _i++) { + var _ref; + + _ref = pointers[_i]; + var pointer = _ref; + + for (var _prop in average) { + average[_prop] += pointer[_prop]; + } + } + + for (var prop in average) { + average[prop] /= pointers.length; + } + + return average; +} + +function touchBBox(event) { + if (!event.length && !(event.touches && event.touches.length > 1)) { + return null; + } + + var touches = getTouchPair(event); + var minX = Math.min(touches[0].pageX, touches[1].pageX); + var minY = Math.min(touches[0].pageY, touches[1].pageY); + var maxX = Math.max(touches[0].pageX, touches[1].pageX); + var maxY = Math.max(touches[0].pageY, touches[1].pageY); + return { + x: minX, + y: minY, + left: minX, + top: minY, + right: maxX, + bottom: maxY, + width: maxX - minX, + height: maxY - minY + }; +} + +function touchDistance(event, deltaSource) { + var sourceX = deltaSource + 'X'; + var sourceY = deltaSource + 'Y'; + var touches = getTouchPair(event); + var dx = touches[0][sourceX] - touches[1][sourceX]; + var dy = touches[0][sourceY] - touches[1][sourceY]; + return (0, _hypot["default"])(dx, dy); +} + +function touchAngle(event, deltaSource) { + var sourceX = deltaSource + 'X'; + var sourceY = deltaSource + 'Y'; + var touches = getTouchPair(event); + var dx = touches[1][sourceX] - touches[0][sourceX]; + var dy = touches[1][sourceY] - touches[0][sourceY]; + var angle = 180 * Math.atan2(dy, dx) / Math.PI; + return angle; +} + +function getPointerType(pointer) { + return __is_63.string(pointer.pointerType) ? pointer.pointerType : __is_63.number(pointer.pointerType) ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType] // if the PointerEvent API isn't available, then the "pointer" must + // be either a MouseEvent, TouchEvent, or Touch object + : /touch/.test(pointer.type) || pointer instanceof ___domObjects_63["default"].Touch ? 'touch' : 'mouse'; +} // [ event.target, event.currentTarget ] + + +function getEventTargets(event) { + var path = __is_63.func(event.composedPath) ? event.composedPath() : event.path; + return [domUtils.getActualElement(path ? path[0] : event.target), domUtils.getActualElement(event.currentTarget)]; +} + +function newCoords() { + return { + page: { + x: 0, + y: 0 + }, + client: { + x: 0, + y: 0 + }, + timeStamp: 0 + }; +} + +function coordsToEvent(coords) { + var event = { + coords: coords, + + get page() { + return this.coords.page; + }, + + get client() { + return this.coords.client; + }, + + get timeStamp() { + return this.coords.timeStamp; + }, + + get pageX() { + return this.coords.page.x; + }, + + get pageY() { + return this.coords.page.y; + }, + + get clientX() { + return this.coords.client.x; + }, + + get clientY() { + return this.coords.client.y; + }, + + get pointerId() { + return this.coords.pointerId; + }, + + get target() { + return this.coords.target; + }, + + get type() { + return this.coords.type; + }, + + get pointerType() { + return this.coords.pointerType; + }, + + get buttons() { + return this.coords.buttons; + } + + }; + return event; +} + +var _$events_54 = {}; +"use strict"; + +function ___typeof_54(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_54 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_54 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_54(obj); } + +Object.defineProperty(_$events_54, "__esModule", { + value: true +}); +_$events_54["default"] = _$events_54.FakeEvent = void 0; + +/* removed: var _$arr_49 = require("./arr"); */; + +var __domUtils_54 = ___interopRequireWildcard_54(_$domUtils_53); + +var __is_54 = ___interopRequireWildcard_54(_$is_59); + +var ___pointerExtend_54 = ___interopRequireDefault_54(_$pointerExtend_62); + +var pointerUtils = ___interopRequireWildcard_54(_$pointerUtils_63); + +function ___interopRequireDefault_54(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_54() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_54 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_54(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_54(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_54(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } + +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } + +function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } + +var elements = []; +var targets = []; +var delegatedEvents = {}; +var documents = []; + +function add(element, type, listener, optionalArg) { + var options = getOptions(optionalArg); + var elementIndex = elements.indexOf(element); + var target = targets[elementIndex]; + + if (!target) { + target = { + events: {}, + typeCount: 0 + }; + elementIndex = elements.push(element) - 1; + targets.push(target); + } + + if (!target.events[type]) { + target.events[type] = []; + target.typeCount++; + } + + if (element.removeEventListener && !(0, _$arr_49.contains)(target.events[type], listener)) { + element.addEventListener(type, listener, events.supportsOptions ? options : !!options.capture); + target.events[type].push(listener); + } +} + +function __remove_54(element, type, listener, optionalArg) { + var options = getOptions(optionalArg); + var elementIndex = elements.indexOf(element); + var target = targets[elementIndex]; + + if (!target || !target.events) { + return; + } + + if (type === 'all') { + for (type in target.events) { + if (target.events.hasOwnProperty(type)) { + __remove_54(element, type, 'all'); + } + } + + return; + } + + if (target.events[type]) { + var len = target.events[type].length; + + if (listener === 'all') { + for (var i = 0; i < len; i++) { + __remove_54(element, type, target.events[type][i], options); + } + + return; + } else { + for (var _i = 0; _i < len; _i++) { + if (element.removeEventListener && target.events[type][_i] === listener) { + element.removeEventListener(type, listener, events.supportsOptions ? options : !!options.capture); + target.events[type].splice(_i, 1); + break; + } + } + } + + if (target.events[type] && target.events[type].length === 0) { + target.events[type] = null; + target.typeCount--; + } + } + + if (!target.typeCount) { + targets.splice(elementIndex, 1); + elements.splice(elementIndex, 1); + } +} + +function addDelegate(selector, context, type, listener, optionalArg) { + var options = getOptions(optionalArg); + + if (!delegatedEvents[type]) { + delegatedEvents[type] = { + contexts: [], + listeners: [], + selectors: [] + }; // add delegate listener functions + + for (var _i2 = 0; _i2 < documents.length; _i2++) { + var _ref; + + _ref = documents[_i2]; + var doc = _ref; + add(doc, type, delegateListener); + add(doc, type, delegateUseCapture, true); + } + } + + var delegated = delegatedEvents[type]; + var index; + + for (index = delegated.selectors.length - 1; index >= 0; index--) { + if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { + break; + } + } + + if (index === -1) { + index = delegated.selectors.length; + delegated.selectors.push(selector); + delegated.contexts.push(context); + delegated.listeners.push([]); + } // keep listener and capture and passive flags + + + delegated.listeners[index].push([listener, !!options.capture, options.passive]); +} + +function removeDelegate(selector, context, type, listener, optionalArg) { + var options = getOptions(optionalArg); + var delegated = delegatedEvents[type]; + var matchFound = false; + var index; + + if (!delegated) { + return; + } // count from last index of delegated to 0 + + + for (index = delegated.selectors.length - 1; index >= 0; index--) { + // look for matching selector and context Node + if (delegated.selectors[index] === selector && delegated.contexts[index] === context) { + var listeners = delegated.listeners[index]; // each item of the listeners array is an array: [function, capture, passive] + + for (var i = listeners.length - 1; i >= 0; i--) { + var _listeners$i = _slicedToArray(listeners[i], 3), + fn = _listeners$i[0], + capture = _listeners$i[1], + passive = _listeners$i[2]; // check if the listener functions and capture and passive flags match + + + if (fn === listener && capture === !!options.capture && passive === options.passive) { + // remove the listener from the array of listeners + listeners.splice(i, 1); // if all listeners for this interactable have been removed + // remove the interactable from the delegated arrays + + if (!listeners.length) { + delegated.selectors.splice(index, 1); + delegated.contexts.splice(index, 1); + delegated.listeners.splice(index, 1); // remove delegate function from context + + __remove_54(context, type, delegateListener); + __remove_54(context, type, delegateUseCapture, true); // remove the arrays if they are empty + + if (!delegated.selectors.length) { + delegatedEvents[type] = null; + } + } // only remove one listener + + + matchFound = true; + break; + } + } + + if (matchFound) { + break; + } + } + } +} // bound to the interactable context when a DOM event +// listener is added to a selector interactable + + +function delegateListener(event, optionalArg) { + var options = getOptions(optionalArg); + var fakeEvent = new FakeEvent(event); + var delegated = delegatedEvents[event.type]; + + var _pointerUtils$getEven = pointerUtils.getEventTargets(event), + _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 1), + eventTarget = _pointerUtils$getEven2[0]; + + var element = eventTarget; // climb up document tree looking for selector matches + + while (__is_54.element(element)) { + for (var i = 0; i < delegated.selectors.length; i++) { + var selector = delegated.selectors[i]; + var context = delegated.contexts[i]; + + if (__domUtils_54.matchesSelector(element, selector) && __domUtils_54.nodeContains(context, eventTarget) && __domUtils_54.nodeContains(context, element)) { + var listeners = delegated.listeners[i]; + fakeEvent.currentTarget = element; + + for (var _i3 = 0; _i3 < listeners.length; _i3++) { + var _ref2; + + _ref2 = listeners[_i3]; + + var _ref3 = _ref2, + _ref4 = _slicedToArray(_ref3, 3), + fn = _ref4[0], + capture = _ref4[1], + passive = _ref4[2]; + + if (capture === !!options.capture && passive === options.passive) { + fn(fakeEvent); + } + } + } + } + + element = __domUtils_54.parentNode(element); + } +} + +function delegateUseCapture(event) { + return delegateListener.call(this, event, true); +} + +function getOptions(param) { + return __is_54.object(param) ? param : { + capture: param + }; +} + +var FakeEvent = +/*#__PURE__*/ +function () { + function FakeEvent(originalEvent) { + _classCallCheck(this, FakeEvent); + + this.originalEvent = originalEvent; + + _defineProperty(this, "currentTarget", void 0); + + // duplicate the event so that currentTarget can be changed + (0, ___pointerExtend_54["default"])(this, originalEvent); + } + + _createClass(FakeEvent, [{ + key: "preventOriginalDefault", + value: function preventOriginalDefault() { + this.originalEvent.preventDefault(); + } + }, { + key: "stopPropagation", + value: function stopPropagation() { + this.originalEvent.stopPropagation(); + } + }, { + key: "stopImmediatePropagation", + value: function stopImmediatePropagation() { + this.originalEvent.stopImmediatePropagation(); + } + }]); + + return FakeEvent; +}(); + +_$events_54.FakeEvent = FakeEvent; +var events = { + add: add, + remove: __remove_54, + addDelegate: addDelegate, + removeDelegate: removeDelegate, + delegateListener: delegateListener, + delegateUseCapture: delegateUseCapture, + delegatedEvents: delegatedEvents, + documents: documents, + supportsOptions: false, + supportsPassive: false, + _elements: elements, + _targets: targets, + init: function init(window) { + window.document.createElement('div').addEventListener('test', null, { + get capture() { + return events.supportsOptions = true; + }, + + get passive() { + return events.supportsPassive = true; + } + + }); + } +}; +var ___default_54 = events; +_$events_54["default"] = ___default_54; + +var _$extend_55 = {}; +"use strict"; + +Object.defineProperty(_$extend_55, "__esModule", { + value: true +}); +_$extend_55["default"] = extend; + +function extend(dest, source) { + for (var prop in source) { + dest[prop] = source[prop]; + } + + var ret = dest; + return ret; +} + +var _$normalizeListeners_61 = {}; +"use strict"; + +function ___typeof_61(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_61 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_61 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_61(obj); } + +Object.defineProperty(_$normalizeListeners_61, "__esModule", { + value: true +}); +_$normalizeListeners_61["default"] = normalize; + +var _extend = ___interopRequireDefault_61(_$extend_55); + +var __is_61 = ___interopRequireWildcard_61(_$is_59); + +function ___getRequireWildcardCache_61() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_61 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_61(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_61(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_61(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_61(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function normalize(type, listeners, result) { + result = result || {}; + + if (__is_61.string(type) && type.search(' ') !== -1) { + type = split(type); + } + + if (__is_61.array(type)) { + return type.reduce(function (acc, t) { + return (0, _extend["default"])(acc, normalize(t, listeners, result)); + }, result); + } // ({ type: fn }) -> ('', { type: fn }) + + + if (__is_61.object(type)) { + listeners = type; + type = ''; + } + + if (__is_61.func(listeners)) { + result[type] = result[type] || []; + result[type].push(listeners); + } else if (__is_61.array(listeners)) { + for (var _i = 0; _i < listeners.length; _i++) { + var _ref; + + _ref = listeners[_i]; + var l = _ref; + normalize(type, l, result); + } + } else if (__is_61.object(listeners)) { + for (var prefix in listeners) { + var combinedTypes = split(prefix).map(function (p) { + return "".concat(type).concat(p); + }); + normalize(combinedTypes, listeners[prefix], result); + } + } + + return result; +} + +function split(type) { + return type.trim().split(/ +/); +} + +var _$Eventable_14 = {}; +"use strict"; + +function ___typeof_14(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_14 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_14 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_14(obj); } + +Object.defineProperty(_$Eventable_14, "__esModule", { + value: true +}); +_$Eventable_14["default"] = void 0; + +var __arr_14 = ___interopRequireWildcard_14(_$arr_49); + +var ___extend_14 = ___interopRequireDefault_14(_$extend_55); + +var _normalizeListeners = ___interopRequireDefault_14(_$normalizeListeners_61); + +function ___interopRequireDefault_14(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_14() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_14 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_14(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_14(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_14(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___classCallCheck_14(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_14(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_14(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_14(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_14(Constructor, staticProps); return Constructor; } + +function ___defineProperty_14(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function fireUntilImmediateStopped(event, listeners) { + for (var _i = 0; _i < listeners.length; _i++) { + var _ref; + + _ref = listeners[_i]; + var listener = _ref; + + if (event.immediatePropagationStopped) { + break; + } + + listener(event); + } +} + +var Eventable = +/*#__PURE__*/ +function () { + function Eventable(options) { + ___classCallCheck_14(this, Eventable); + + ___defineProperty_14(this, "options", void 0); + + ___defineProperty_14(this, "types", {}); + + ___defineProperty_14(this, "propagationStopped", false); + + ___defineProperty_14(this, "immediatePropagationStopped", false); + + ___defineProperty_14(this, "global", void 0); + + this.options = (0, ___extend_14["default"])({}, options || {}); + } + + ___createClass_14(Eventable, [{ + key: "fire", + value: function fire(event) { + var listeners; + var global = this.global; // Interactable#on() listeners + // tslint:disable no-conditional-assignment + + if (listeners = this.types[event.type]) { + fireUntilImmediateStopped(event, listeners); + } // interact.on() listeners + + + if (!event.propagationStopped && global && (listeners = global[event.type])) { + fireUntilImmediateStopped(event, listeners); + } + } + }, { + key: "on", + value: function on(type, listener) { + var listeners = (0, _normalizeListeners["default"])(type, listener); + + for (type in listeners) { + this.types[type] = __arr_14.merge(this.types[type] || [], listeners[type]); + } + } + }, { + key: "off", + value: function off(type, listener) { + var listeners = (0, _normalizeListeners["default"])(type, listener); + + for (type in listeners) { + var eventList = this.types[type]; + + if (!eventList || !eventList.length) { + continue; + } + + for (var _i2 = 0; _i2 < listeners[type].length; _i2++) { + var _ref2; + + _ref2 = listeners[type][_i2]; + var subListener = _ref2; + + var _index = eventList.indexOf(subListener); + + if (_index !== -1) { + eventList.splice(_index, 1); + } + } + } + } + }, { + key: "getRect", + value: function getRect(_element) { + return null; + } + }]); + + return Eventable; +}(); + +var ___default_14 = Eventable; +_$Eventable_14["default"] = ___default_14; + +var _$rect_65 = {}; +"use strict"; + +function ___typeof_65(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_65 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_65 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_65(obj); } + +Object.defineProperty(_$rect_65, "__esModule", { + value: true +}); +_$rect_65.getStringOptionResult = getStringOptionResult; +_$rect_65.resolveRectLike = resolveRectLike; +_$rect_65.rectToXY = rectToXY; +_$rect_65.xywhToTlbr = xywhToTlbr; +_$rect_65.tlbrToXywh = tlbrToXywh; +_$rect_65.addEdges = addEdges; + +/* removed: var _$domUtils_53 = require("./domUtils"); */; + +var ___extend_65 = ___interopRequireDefault_65(_$extend_55); + +var __is_65 = ___interopRequireWildcard_65(_$is_59); + +function ___getRequireWildcardCache_65() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_65 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_65(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_65(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_65(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_65(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } + +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +function getStringOptionResult(value, target, element) { + if (value === 'parent') { + return (0, _$domUtils_53.parentNode)(element); + } + + if (value === 'self') { + return target.getRect(element); + } + + return (0, _$domUtils_53.closest)(element, value); +} + +function resolveRectLike(value, target, element, functionArgs) { + var returnValue = value; + + if (__is_65.string(returnValue)) { + returnValue = getStringOptionResult(returnValue, target, element); + } else if (__is_65.func(returnValue)) { + returnValue = returnValue.apply(void 0, _toConsumableArray(functionArgs)); + } + + if (__is_65.element(returnValue)) { + returnValue = (0, _$domUtils_53.getElementRect)(returnValue); + } + + return returnValue; +} + +function rectToXY(rect) { + return rect && { + x: 'x' in rect ? rect.x : rect.left, + y: 'y' in rect ? rect.y : rect.top + }; +} + +function xywhToTlbr(rect) { + if (rect && !('left' in rect && 'top' in rect)) { + rect = (0, ___extend_65["default"])({}, rect); + rect.left = rect.x || 0; + rect.top = rect.y || 0; + rect.right = rect.right || rect.left + rect.width; + rect.bottom = rect.bottom || rect.top + rect.height; + } + + return rect; +} + +function tlbrToXywh(rect) { + if (rect && !('x' in rect && 'y' in rect)) { + rect = (0, ___extend_65["default"])({}, rect); + rect.x = rect.left || 0; + rect.y = rect.top || 0; + rect.width = rect.width || rect.right || 0 - rect.x; + rect.height = rect.height || rect.bottom || 0 - rect.y; + } + + return rect; +} + +function addEdges(edges, rect, delta) { + if (edges.left) { + rect.left += delta.x; + } + + if (edges.right) { + rect.right += delta.x; + } + + if (edges.top) { + rect.top += delta.y; + } + + if (edges.bottom) { + rect.bottom += delta.y; + } + + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; +} + +var _$getOriginXY_56 = {}; +"use strict"; + +Object.defineProperty(_$getOriginXY_56, "__esModule", { + value: true +}); +_$getOriginXY_56["default"] = ___default_56; + +/* removed: var _$rect_65 = require("./rect"); */; + +function ___default_56(target, element, actionName) { + var actionOptions = target.options[actionName]; + var actionOrigin = actionOptions && actionOptions.origin; + var origin = actionOrigin || target.options.origin; + var originRect = (0, _$rect_65.resolveRectLike)(origin, target, element, [target && element]); + return (0, _$rect_65.rectToXY)(originRect) || { + x: 0, + y: 0 + }; +} + +var _$raf_64 = {}; +"use strict"; + +Object.defineProperty(_$raf_64, "__esModule", { + value: true +}); +_$raf_64["default"] = void 0; +var lastTime = 0; + +var _request; + +var _cancel; + +function __init_64(window) { + _request = window.requestAnimationFrame; + _cancel = window.cancelAnimationFrame; + + if (!_request) { + var vendors = ['ms', 'moz', 'webkit', 'o']; + + for (var _i = 0; _i < vendors.length; _i++) { + var vendor = vendors[_i]; + _request = window["".concat(vendor, "RequestAnimationFrame")]; + _cancel = window["".concat(vendor, "CancelAnimationFrame")] || window["".concat(vendor, "CancelRequestAnimationFrame")]; + } + } + + if (!_request) { + _request = function request(callback) { + var currTime = Date.now(); + var timeToCall = Math.max(0, 16 - (currTime - lastTime)); // eslint-disable-next-line standard/no-callback-literal + + var token = setTimeout(function () { + callback(currTime + timeToCall); + }, timeToCall); + lastTime = currTime + timeToCall; + return token; + }; + + _cancel = function cancel(token) { + return clearTimeout(token); + }; + } +} + +var ___default_64 = { + request: function request(callback) { + return _request(callback); + }, + cancel: function cancel(token) { + return _cancel(token); + }, + init: __init_64 +}; +_$raf_64["default"] = ___default_64; + +var _$index_58 = {}; +"use strict"; + +function ___typeof_58(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_58 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_58 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_58(obj); } + +Object.defineProperty(_$index_58, "__esModule", { + value: true +}); +_$index_58.warnOnce = warnOnce; +_$index_58.copyAction = copyAction; +Object.defineProperty(_$index_58, "win", { + enumerable: true, + get: function get() { + return ___window_58["default"]; + } +}); +Object.defineProperty(_$index_58, "browser", { + enumerable: true, + get: function get() { + return ___browser_58["default"]; + } +}); +Object.defineProperty(_$index_58, "clone", { + enumerable: true, + get: function get() { + return _clone["default"]; + } +}); +Object.defineProperty(_$index_58, "events", { + enumerable: true, + get: function get() { + return _events["default"]; + } +}); +Object.defineProperty(_$index_58, "extend", { + enumerable: true, + get: function get() { + return ___extend_58["default"]; + } +}); +Object.defineProperty(_$index_58, "getOriginXY", { + enumerable: true, + get: function get() { + return _getOriginXY["default"]; + } +}); +Object.defineProperty(_$index_58, "hypot", { + enumerable: true, + get: function get() { + return ___hypot_58["default"]; + } +}); +Object.defineProperty(_$index_58, "normalizeListeners", { + enumerable: true, + get: function get() { + return ___normalizeListeners_58["default"]; + } +}); +Object.defineProperty(_$index_58, "raf", { + enumerable: true, + get: function get() { + return _raf["default"]; + } +}); +_$index_58.rect = _$index_58.pointer = _$index_58.is = _$index_58.dom = _$index_58.arr = void 0; + +var __arr_58 = ___interopRequireWildcard_58(_$arr_49); + +_$index_58.arr = __arr_58; + +var dom = ___interopRequireWildcard_58(_$domUtils_53); + +_$index_58.dom = dom; + +var __is_58 = ___interopRequireWildcard_58(_$is_59); + +_$index_58.is = __is_58; + +var pointer = ___interopRequireWildcard_58(_$pointerUtils_63); + +_$index_58.pointer = pointer; + +var rect = ___interopRequireWildcard_58(_$rect_65); + +_$index_58.rect = rect; + +var ___window_58 = ___interopRequireDefault_58(_$window_68); + +var ___browser_58 = ___interopRequireDefault_58(_$browser_50); + +var _clone = ___interopRequireDefault_58(_$clone_51); + +var _events = ___interopRequireDefault_58(_$events_54); + +var ___extend_58 = ___interopRequireDefault_58(_$extend_55); + +var _getOriginXY = ___interopRequireDefault_58(_$getOriginXY_56); + +var ___hypot_58 = ___interopRequireDefault_58(_$hypot_57); + +var ___normalizeListeners_58 = ___interopRequireDefault_58(_$normalizeListeners_61); + +var _raf = ___interopRequireDefault_58(_$raf_64); + +function ___interopRequireDefault_58(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_58() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_58 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_58(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_58(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_58(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function warnOnce(method, message) { + var warned = false; // eslint-disable-next-line no-shadow + + return function () { + if (!warned) { + ___window_58["default"].window.console.warn(message); + + warned = true; + } + + return method.apply(this, arguments); + }; +} + +function copyAction(dest, src) { + dest.name = src.name; + dest.axis = src.axis; + dest.edges = src.edges; + return dest; +} + +var _$defaultOptions_20 = {}; +"use strict"; + +Object.defineProperty(_$defaultOptions_20, "__esModule", { + value: true +}); +_$defaultOptions_20["default"] = _$defaultOptions_20.defaults = void 0; +// tslint:disable no-empty-interface +// eslint-disable-next-line @typescript-eslint/no-empty-interface +// export interface Options extends BaseDefaults, PerActionDefaults {} +var defaults = { + base: { + preventDefault: 'auto', + deltaSource: 'page' + }, + perAction: { + enabled: false, + origin: { + x: 0, + y: 0 + } + }, + actions: {} +}; +_$defaultOptions_20.defaults = defaults; +var ___default_20 = defaults; +_$defaultOptions_20["default"] = ___default_20; + +var _$InteractableSet_17 = {}; +"use strict"; + +function ___typeof_17(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_17 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_17 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_17(obj); } + +Object.defineProperty(_$InteractableSet_17, "__esModule", { + value: true +}); +_$InteractableSet_17["default"] = void 0; + +var __arr_17 = ___interopRequireWildcard_17(_$arr_49); + +var __domUtils_17 = ___interopRequireWildcard_17(_$domUtils_53); + +var ___extend_17 = ___interopRequireDefault_17(_$extend_55); + +var __is_17 = ___interopRequireWildcard_17(_$is_59); + +function ___interopRequireDefault_17(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_17() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_17 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_17(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_17(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_17(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___classCallCheck_17(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_17(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_17(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_17(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_17(Constructor, staticProps); return Constructor; } + +function ___defineProperty_17(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var InteractableSet = +/*#__PURE__*/ +function () { + // all set interactables + function InteractableSet(scope) { + var _this = this; + + ___classCallCheck_17(this, InteractableSet); + + this.scope = scope; + + ___defineProperty_17(this, "list", []); + + ___defineProperty_17(this, "selectorMap", {}); + + scope.addListeners({ + 'interactable:unset': function interactableUnset(_ref) { + var interactable = _ref.interactable; + var target = interactable.target, + context = interactable._context; + var targetMappings = __is_17.string(target) ? _this.selectorMap[target] : target[_this.scope.id]; + var targetIndex = targetMappings.findIndex(function (m) { + return m.context === context; + }); + + if (targetMappings[targetIndex]) { + // Destroying mappingInfo's context and interactable + targetMappings[targetIndex].context = null; + targetMappings[targetIndex].interactable = null; + } + + targetMappings.splice(targetIndex, 1); + } + }); + } + + ___createClass_17(InteractableSet, [{ + key: "new", + value: function _new(target, options) { + options = (0, ___extend_17["default"])(options || {}, { + actions: this.scope.actions + }); + var interactable = new this.scope.Interactable(target, options, this.scope.document); + var mappingInfo = { + context: interactable._context, + interactable: interactable + }; + this.scope.addDocument(interactable._doc); + this.list.push(interactable); + + if (__is_17.string(target)) { + if (!this.selectorMap[target]) { + this.selectorMap[target] = []; + } + + this.selectorMap[target].push(mappingInfo); + } else { + if (!interactable.target[this.scope.id]) { + Object.defineProperty(target, this.scope.id, { + value: [], + configurable: true + }); + } + + target[this.scope.id].push(mappingInfo); + } + + this.scope.fire('interactable:new', { + target: target, + options: options, + interactable: interactable, + win: this.scope._win + }); + return interactable; + } + }, { + key: "get", + value: function get(target, options) { + var context = options && options.context || this.scope.document; + var isSelector = __is_17.string(target); + var targetMappings = isSelector ? this.selectorMap[target] : target[this.scope.id]; + + if (!targetMappings) { + return null; + } + + var found = __arr_17.find(targetMappings, function (m) { + return m.context === context && (isSelector || m.interactable.inContext(target)); + }); + return found && found.interactable; + } + }, { + key: "forEachMatch", + value: function forEachMatch(node, callback) { + for (var _i = 0; _i < this.list.length; _i++) { + var _ref2; + + _ref2 = this.list[_i]; + var _interactable = _ref2; + var ret = void 0; + + if ((__is_17.string(_interactable.target) // target is a selector and the element matches + ? __is_17.element(node) && __domUtils_17.matchesSelector(node, _interactable.target) : // target is the element + node === _interactable.target) && // the element is in context + _interactable.inContext(node)) { + ret = callback(_interactable); + } + + if (ret !== undefined) { + return ret; + } + } + } + }]); + + return InteractableSet; +}(); + +_$InteractableSet_17["default"] = InteractableSet; + +var _$BaseEvent_13 = {}; +"use strict"; + +Object.defineProperty(_$BaseEvent_13, "__esModule", { + value: true +}); +_$BaseEvent_13["default"] = _$BaseEvent_13.BaseEvent = void 0; + +function ___classCallCheck_13(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_13(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_13(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_13(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_13(Constructor, staticProps); return Constructor; } + +function ___defineProperty_13(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var BaseEvent = +/*#__PURE__*/ +function () { + ___createClass_13(BaseEvent, [{ + key: "interaction", + get: function get() { + return this._interaction._proxy; + } + }]); + + function BaseEvent(interaction) { + ___classCallCheck_13(this, BaseEvent); + + ___defineProperty_13(this, "type", void 0); + + ___defineProperty_13(this, "target", void 0); + + ___defineProperty_13(this, "currentTarget", void 0); + + ___defineProperty_13(this, "interactable", void 0); + + ___defineProperty_13(this, "_interaction", void 0); + + ___defineProperty_13(this, "timeStamp", void 0); + + ___defineProperty_13(this, "immediatePropagationStopped", false); + + ___defineProperty_13(this, "propagationStopped", false); + + this._interaction = interaction; + } + + ___createClass_13(BaseEvent, [{ + key: "preventDefault", + value: function preventDefault() {} + /** + * Don't call any other listeners (even on the current target) + */ + + }, { + key: "stopPropagation", + value: function stopPropagation() { + this.propagationStopped = true; + } + /** + * Don't call listeners on the remaining targets + */ + + }, { + key: "stopImmediatePropagation", + value: function stopImmediatePropagation() { + this.immediatePropagationStopped = this.propagationStopped = true; + } + }]); + + return BaseEvent; +}(); + +_$BaseEvent_13.BaseEvent = BaseEvent; +var ___default_13 = BaseEvent; +_$BaseEvent_13["default"] = ___default_13; + +var _$InteractEvent_15 = {}; +"use strict"; + +Object.defineProperty(_$InteractEvent_15, "__esModule", { + value: true +}); +_$InteractEvent_15["default"] = _$InteractEvent_15.InteractEvent = void 0; + +var ___extend_15 = ___interopRequireDefault_15(_$extend_55); + +var ___getOriginXY_15 = ___interopRequireDefault_15(_$getOriginXY_56); + +var ___hypot_15 = ___interopRequireDefault_15(_$hypot_57); + +var _BaseEvent2 = ___interopRequireDefault_15(_$BaseEvent_13); + +var _defaultOptions = ___interopRequireDefault_15(_$defaultOptions_20); + +function ___interopRequireDefault_15(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___typeof_15(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_15 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_15 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_15(obj); } + +function ___classCallCheck_15(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_15(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_15(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_15(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_15(Constructor, staticProps); return Constructor; } + +function _possibleConstructorReturn(self, call) { if (call && (___typeof_15(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } + +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } + +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } + +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } + +function ___defineProperty_15(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var InteractEvent = +/*#__PURE__*/ +function (_BaseEvent) { + _inherits(InteractEvent, _BaseEvent); + + // drag + // resize + + /** */ + function InteractEvent(interaction, event, actionName, phase, element, preEnd, type) { + var _this; + + ___classCallCheck_15(this, InteractEvent); + + _this = _possibleConstructorReturn(this, _getPrototypeOf(InteractEvent).call(this, interaction)); + + ___defineProperty_15(_assertThisInitialized(_this), "target", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "currentTarget", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "relatedTarget", null); + + ___defineProperty_15(_assertThisInitialized(_this), "screenX", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "screenY", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "button", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "buttons", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "ctrlKey", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "shiftKey", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "altKey", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "metaKey", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "page", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "client", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "delta", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "rect", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "x0", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "y0", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "t0", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "dt", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "duration", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "clientX0", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "clientY0", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "velocity", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "speed", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "swipe", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "timeStamp", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "dragEnter", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "dragLeave", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "axes", void 0); + + ___defineProperty_15(_assertThisInitialized(_this), "preEnd", void 0); + + element = element || interaction.element; + var target = interaction.interactable; + var deltaSource = (target && target.options || _defaultOptions["default"]).deltaSource; + var origin = (0, ___getOriginXY_15["default"])(target, element, actionName); + var starting = phase === 'start'; + var ending = phase === 'end'; + var prevEvent = starting ? _assertThisInitialized(_this) : interaction.prevEvent; + var coords = starting ? interaction.coords.start : ending ? { + page: prevEvent.page, + client: prevEvent.client, + timeStamp: interaction.coords.cur.timeStamp + } : interaction.coords.cur; + _this.page = (0, ___extend_15["default"])({}, coords.page); + _this.client = (0, ___extend_15["default"])({}, coords.client); + _this.rect = (0, ___extend_15["default"])({}, interaction.rect); + _this.timeStamp = coords.timeStamp; + + if (!ending) { + _this.page.x -= origin.x; + _this.page.y -= origin.y; + _this.client.x -= origin.x; + _this.client.y -= origin.y; + } + + _this.ctrlKey = event.ctrlKey; + _this.altKey = event.altKey; + _this.shiftKey = event.shiftKey; + _this.metaKey = event.metaKey; + _this.button = event.button; + _this.buttons = event.buttons; + _this.target = element; + _this.currentTarget = element; + _this.preEnd = preEnd; + _this.type = type || actionName + (phase || ''); + _this.interactable = target; + _this.t0 = starting ? interaction.pointers[interaction.pointers.length - 1].downTime : prevEvent.t0; + _this.x0 = interaction.coords.start.page.x - origin.x; + _this.y0 = interaction.coords.start.page.y - origin.y; + _this.clientX0 = interaction.coords.start.client.x - origin.x; + _this.clientY0 = interaction.coords.start.client.y - origin.y; + + if (starting || ending) { + _this.delta = { + x: 0, + y: 0 + }; + } else { + _this.delta = { + x: _this[deltaSource].x - prevEvent[deltaSource].x, + y: _this[deltaSource].y - prevEvent[deltaSource].y + }; + } + + _this.dt = interaction.coords.delta.timeStamp; + _this.duration = _this.timeStamp - _this.t0; // velocity and speed in pixels per second + + _this.velocity = (0, ___extend_15["default"])({}, interaction.coords.velocity[deltaSource]); + _this.speed = (0, ___hypot_15["default"])(_this.velocity.x, _this.velocity.y); + _this.swipe = ending || phase === 'inertiastart' ? _this.getSwipe() : null; + return _this; + } + + ___createClass_15(InteractEvent, [{ + key: "getSwipe", + value: function getSwipe() { + var interaction = this._interaction; + + if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) { + return null; + } + + var angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI; + var overlap = 22.5; + + if (angle < 0) { + angle += 360; + } + + var left = 135 - overlap <= angle && angle < 225 + overlap; + var up = 225 - overlap <= angle && angle < 315 + overlap; + var right = !left && (315 - overlap <= angle || angle < 45 + overlap); + var down = !up && 45 - overlap <= angle && angle < 135 + overlap; + return { + up: up, + down: down, + left: left, + right: right, + angle: angle, + speed: interaction.prevEvent.speed, + velocity: { + x: interaction.prevEvent.velocityX, + y: interaction.prevEvent.velocityY + } + }; + } + }, { + key: "preventDefault", + value: function preventDefault() {} + /** + * Don't call listeners on the remaining targets + */ + + }, { + key: "stopImmediatePropagation", + value: function stopImmediatePropagation() { + this.immediatePropagationStopped = this.propagationStopped = true; + } + /** + * Don't call any other listeners (even on the current target) + */ + + }, { + key: "stopPropagation", + value: function stopPropagation() { + this.propagationStopped = true; + } + }, { + key: "pageX", + get: function get() { + return this.page.x; + }, + set: function set(value) { + this.page.x = value; + } + }, { + key: "pageY", + get: function get() { + return this.page.y; + }, + set: function set(value) { + this.page.y = value; + } + }, { + key: "clientX", + get: function get() { + return this.client.x; + }, + set: function set(value) { + this.client.x = value; + } + }, { + key: "clientY", + get: function get() { + return this.client.y; + }, + set: function set(value) { + this.client.y = value; + } + }, { + key: "dx", + get: function get() { + return this.delta.x; + }, + set: function set(value) { + this.delta.x = value; + } + }, { + key: "dy", + get: function get() { + return this.delta.y; + }, + set: function set(value) { + this.delta.y = value; + } + }, { + key: "velocityX", + get: function get() { + return this.velocity.x; + }, + set: function set(value) { + this.velocity.x = value; + } + }, { + key: "velocityY", + get: function get() { + return this.velocity.y; + }, + set: function set(value) { + this.velocity.y = value; + } + }]); + + return InteractEvent; +}(_BaseEvent2["default"]); + +_$InteractEvent_15.InteractEvent = InteractEvent; +var ___default_15 = InteractEvent; +_$InteractEvent_15["default"] = ___default_15; + +var _$PointerInfo_19 = {}; +"use strict"; + +Object.defineProperty(_$PointerInfo_19, "__esModule", { + value: true +}); +_$PointerInfo_19["default"] = _$PointerInfo_19.PointerInfo = void 0; + +function ___classCallCheck_19(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +/* eslint-disable @typescript-eslint/no-parameter-properties */ +var PointerInfo = function PointerInfo(id, pointer, event, downTime, downTarget) { + ___classCallCheck_19(this, PointerInfo); + + this.id = id; + this.pointer = pointer; + this.event = event; + this.downTime = downTime; + this.downTarget = downTarget; +}; + +_$PointerInfo_19.PointerInfo = PointerInfo; +var ___default_19 = PointerInfo; +_$PointerInfo_19["default"] = ___default_19; + +var _$Interaction_18 = {}; +"use strict"; + +function ___typeof_18(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_18 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_18 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_18(obj); } + +Object.defineProperty(_$Interaction_18, "__esModule", { + value: true +}); +Object.defineProperty(_$Interaction_18, "PointerInfo", { + enumerable: true, + get: function get() { + return _PointerInfo["default"]; + } +}); +_$Interaction_18["default"] = _$Interaction_18.Interaction = _$Interaction_18._ProxyMethods = _$Interaction_18._ProxyValues = void 0; + +var utils = ___interopRequireWildcard_18(_$index_58); + +var _InteractEvent = ___interopRequireDefault_18(_$InteractEvent_15); + +var _PointerInfo = ___interopRequireDefault_18(_$PointerInfo_19); + +function ___interopRequireDefault_18(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_18() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_18 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_18(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_18(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_18(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___classCallCheck_18(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_18(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_18(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_18(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_18(Constructor, staticProps); return Constructor; } + +function ___defineProperty_18(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var _ProxyValues; + +_$Interaction_18._ProxyValues = _ProxyValues; + +(function (_ProxyValues) { + _ProxyValues["interactable"] = ""; + _ProxyValues["element"] = ""; + _ProxyValues["prepared"] = ""; + _ProxyValues["pointerIsDown"] = ""; + _ProxyValues["pointerWasMoved"] = ""; + _ProxyValues["_proxy"] = ""; +})(_ProxyValues || (_$Interaction_18._ProxyValues = _ProxyValues = {})); + +var _ProxyMethods; + +_$Interaction_18._ProxyMethods = _ProxyMethods; + +(function (_ProxyMethods) { + _ProxyMethods["start"] = ""; + _ProxyMethods["move"] = ""; + _ProxyMethods["end"] = ""; + _ProxyMethods["stop"] = ""; + _ProxyMethods["interacting"] = ""; +})(_ProxyMethods || (_$Interaction_18._ProxyMethods = _ProxyMethods = {})); + +var idCounter = 0; + +var Interaction = +/*#__PURE__*/ +function () { + ___createClass_18(Interaction, [{ + key: "pointerMoveTolerance", + // current interactable being interacted with + // the target element of the interactable + // action that's ready to be fired on next move event + // keep track of added pointers + // pointerdown/mousedown/touchstart event + // previous action event + get: function get() { + return 1; + } + /** + * @alias Interaction.prototype.move + */ + + }]); + + /** */ + function Interaction(_ref) { + var _this = this; + + var pointerType = _ref.pointerType, + scopeFire = _ref.scopeFire; + + ___classCallCheck_18(this, Interaction); + + ___defineProperty_18(this, "interactable", null); + + ___defineProperty_18(this, "element", null); + + ___defineProperty_18(this, "rect", void 0); + + ___defineProperty_18(this, "_rects", void 0); + + ___defineProperty_18(this, "edges", void 0); + + ___defineProperty_18(this, "_scopeFire", void 0); + + ___defineProperty_18(this, "prepared", { + name: null, + axis: null, + edges: null + }); + + ___defineProperty_18(this, "pointerType", void 0); + + ___defineProperty_18(this, "pointers", []); + + ___defineProperty_18(this, "downEvent", null); + + ___defineProperty_18(this, "downPointer", {}); + + ___defineProperty_18(this, "_latestPointer", { + pointer: null, + event: null, + eventTarget: null + }); + + ___defineProperty_18(this, "prevEvent", null); + + ___defineProperty_18(this, "pointerIsDown", false); + + ___defineProperty_18(this, "pointerWasMoved", false); + + ___defineProperty_18(this, "_interacting", false); + + ___defineProperty_18(this, "_ending", false); + + ___defineProperty_18(this, "_stopped", true); + + ___defineProperty_18(this, "_proxy", null); + + ___defineProperty_18(this, "simulation", null); + + ___defineProperty_18(this, "doMove", utils.warnOnce(function (signalArg) { + this.move(signalArg); + }, 'The interaction.doMove() method has been renamed to interaction.move()')); + + ___defineProperty_18(this, "coords", { + // Starting InteractEvent pointer coordinates + start: utils.pointer.newCoords(), + // Previous native pointer move event coordinates + prev: utils.pointer.newCoords(), + // current native pointer move event coordinates + cur: utils.pointer.newCoords(), + // Change in coordinates and time of the pointer + delta: utils.pointer.newCoords(), + // pointer velocity + velocity: utils.pointer.newCoords() + }); + + ___defineProperty_18(this, "_id", idCounter++); + + this._scopeFire = scopeFire; + this.pointerType = pointerType; + var that = this; + this._proxy = {}; + + var _loop = function _loop(key) { + Object.defineProperty(_this._proxy, key, { + get: function get() { + return that[key]; + } + }); + }; + + for (var key in _ProxyValues) { + _loop(key); + } + + var _loop2 = function _loop2(_key) { + Object.defineProperty(_this._proxy, _key, { + value: function value() { + return that[_key].apply(that, arguments); + } + }); + }; + + for (var _key in _ProxyMethods) { + _loop2(_key); + } + + this._scopeFire('interactions:new', { + interaction: this + }); + } + + ___createClass_18(Interaction, [{ + key: "pointerDown", + value: function pointerDown(pointer, event, eventTarget) { + var pointerIndex = this.updatePointer(pointer, event, eventTarget, true); + var pointerInfo = this.pointers[pointerIndex]; + + this._scopeFire('interactions:down', { + pointer: pointer, + event: event, + eventTarget: eventTarget, + pointerIndex: pointerIndex, + pointerInfo: pointerInfo, + type: 'down', + interaction: this + }); + } + /** + * ```js + * interact(target) + * .draggable({ + * // disable the default drag start by down->move + * manualStart: true + * }) + * // start dragging after the user holds the pointer down + * .on('hold', function (event) { + * var interaction = event.interaction + * + * if (!interaction.interacting()) { + * interaction.start({ name: 'drag' }, + * event.interactable, + * event.currentTarget) + * } + * }) + * ``` + * + * Start an action with the given Interactable and Element as tartgets. The + * action must be enabled for the target Interactable and an appropriate + * number of pointers must be held down - 1 for drag/resize, 2 for gesture. + * + * Use it with `interactable.able({ manualStart: false })` to always + * [start actions manually](https://github.com/taye/interact.js/issues/114) + * + * @param {object} action The action to be performed - drag, resize, etc. + * @param {Interactable} target The Interactable to target + * @param {Element} element The DOM Element to target + * @return {object} interact + */ + + }, { + key: "start", + value: function start(action, interactable, element) { + if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === 'gesture' ? 2 : 1) || !interactable.options[action.name].enabled) { + return false; + } + + utils.copyAction(this.prepared, action); + this.interactable = interactable; + this.element = element; + this.rect = interactable.getRect(element); + this.edges = this.prepared.edges ? utils.extend({}, this.prepared.edges) : { + left: true, + right: true, + top: true, + bottom: true + }; + this._stopped = false; + this._interacting = this._doPhase({ + interaction: this, + event: this.downEvent, + phase: 'start' + }) && !this._stopped; + return this._interacting; + } + }, { + key: "pointerMove", + value: function pointerMove(pointer, event, eventTarget) { + if (!this.simulation && !(this.modification && this.modification.endResult)) { + this.updatePointer(pointer, event, eventTarget, false); + } + + var duplicateMove = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y; + var dx; + var dy; // register movement greater than pointerMoveTolerance + + if (this.pointerIsDown && !this.pointerWasMoved) { + dx = this.coords.cur.client.x - this.coords.start.client.x; + dy = this.coords.cur.client.y - this.coords.start.client.y; + this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance; + } + + var pointerIndex = this.getPointerIndex(pointer); + var signalArg = { + pointer: pointer, + pointerIndex: pointerIndex, + pointerInfo: this.pointers[pointerIndex], + event: event, + type: 'move', + eventTarget: eventTarget, + dx: dx, + dy: dy, + duplicate: duplicateMove, + interaction: this + }; + + if (!duplicateMove) { + // set pointer coordinate, time changes and velocity + utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta); + } + + this._scopeFire('interactions:move', signalArg); + + if (!duplicateMove && !this.simulation) { + // if interacting, fire an 'action-move' signal etc + if (this.interacting()) { + signalArg.type = null; + this.move(signalArg); + } + + if (this.pointerWasMoved) { + utils.pointer.copyCoords(this.coords.prev, this.coords.cur); + } + } + } + /** + * ```js + * interact(target) + * .draggable(true) + * .on('dragmove', function (event) { + * if (someCondition) { + * // change the snap settings + * event.interactable.draggable({ snap: { targets: [] }}) + * // fire another move event with re-calculated snap + * event.interaction.move() + * } + * }) + * ``` + * + * Force a move of the current action at the same coordinates. Useful if + * snap/restrict has been changed and you want a movement with the new + * settings. + */ + + }, { + key: "move", + value: function move(signalArg) { + if (!signalArg || !signalArg.event) { + utils.pointer.setZeroCoords(this.coords.delta); + } + + signalArg = utils.extend({ + pointer: this._latestPointer.pointer, + event: this._latestPointer.event, + eventTarget: this._latestPointer.eventTarget, + interaction: this + }, signalArg || {}); + signalArg.phase = 'move'; + + this._doPhase(signalArg); + } // End interact move events and stop auto-scroll unless simulation is running + + }, { + key: "pointerUp", + value: function pointerUp(pointer, event, eventTarget, curEventTarget) { + var pointerIndex = this.getPointerIndex(pointer); + + if (pointerIndex === -1) { + pointerIndex = this.updatePointer(pointer, event, eventTarget, false); + } + + var type = /cancel$/i.test(event.type) ? 'cancel' : 'up'; + + this._scopeFire("interactions:".concat(type), { + pointer: pointer, + pointerIndex: pointerIndex, + pointerInfo: this.pointers[pointerIndex], + event: event, + eventTarget: eventTarget, + type: type, + curEventTarget: curEventTarget, + interaction: this + }); + + if (!this.simulation) { + this.end(event); + } + + this.pointerIsDown = false; + this.removePointer(pointer, event); + } + }, { + key: "documentBlur", + value: function documentBlur(event) { + this.end(event); + + this._scopeFire('interactions:blur', { + event: event, + type: 'blur', + interaction: this + }); + } + /** + * ```js + * interact(target) + * .draggable(true) + * .on('move', function (event) { + * if (event.pageX > 1000) { + * // end the current action + * event.interaction.end() + * // stop all further listeners from being called + * event.stopImmediatePropagation() + * } + * }) + * ``` + * + * @param {PointerEvent} [event] + */ + + }, { + key: "end", + value: function end(event) { + this._ending = true; + event = event || this._latestPointer.event; + var endPhaseResult; + + if (this.interacting()) { + endPhaseResult = this._doPhase({ + event: event, + interaction: this, + phase: 'end' + }); + } + + this._ending = false; + + if (endPhaseResult === true) { + this.stop(); + } + } + }, { + key: "currentAction", + value: function currentAction() { + return this._interacting ? this.prepared.name : null; + } + }, { + key: "interacting", + value: function interacting() { + return this._interacting; + } + /** */ + + }, { + key: "stop", + value: function stop() { + this._scopeFire('interactions:stop', { + interaction: this + }); + + this.interactable = this.element = null; + this._interacting = false; + this._stopped = true; + this.prepared.name = this.prevEvent = null; + } + }, { + key: "getPointerIndex", + value: function getPointerIndex(pointer) { + var pointerId = utils.pointer.getPointerId(pointer); // mouse and pen interactions may have only one pointer + + return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : utils.arr.findIndex(this.pointers, function (curPointer) { + return curPointer.id === pointerId; + }); + } + }, { + key: "getPointerInfo", + value: function getPointerInfo(pointer) { + return this.pointers[this.getPointerIndex(pointer)]; + } + }, { + key: "updatePointer", + value: function updatePointer(pointer, event, eventTarget, down) { + var id = utils.pointer.getPointerId(pointer); + var pointerIndex = this.getPointerIndex(pointer); + var pointerInfo = this.pointers[pointerIndex]; + down = down === false ? false : down || /(down|start)$/i.test(event.type); + + if (!pointerInfo) { + pointerInfo = new _PointerInfo["default"](id, pointer, event, null, null); + pointerIndex = this.pointers.length; + this.pointers.push(pointerInfo); + } else { + pointerInfo.pointer = pointer; + } + + utils.pointer.setCoords(this.coords.cur, this.pointers.map(function (p) { + return p.pointer; + }), this._now()); + utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur); + + if (down) { + this.pointerIsDown = true; + pointerInfo.downTime = this.coords.cur.timeStamp; + pointerInfo.downTarget = eventTarget; + utils.pointer.pointerExtend(this.downPointer, pointer); + + if (!this.interacting()) { + utils.pointer.copyCoords(this.coords.start, this.coords.cur); + utils.pointer.copyCoords(this.coords.prev, this.coords.cur); + this.downEvent = event; + this.pointerWasMoved = false; + } + } + + this._updateLatestPointer(pointer, event, eventTarget); + + this._scopeFire('interactions:update-pointer', { + pointer: pointer, + event: event, + eventTarget: eventTarget, + down: down, + pointerInfo: pointerInfo, + pointerIndex: pointerIndex, + interaction: this + }); + + return pointerIndex; + } + }, { + key: "removePointer", + value: function removePointer(pointer, event) { + var pointerIndex = this.getPointerIndex(pointer); + + if (pointerIndex === -1) { + return; + } + + var pointerInfo = this.pointers[pointerIndex]; + + this._scopeFire('interactions:remove-pointer', { + pointer: pointer, + event: event, + eventTarget: null, + pointerIndex: pointerIndex, + pointerInfo: pointerInfo, + interaction: this + }); + + this.pointers.splice(pointerIndex, 1); + } + }, { + key: "_updateLatestPointer", + value: function _updateLatestPointer(pointer, event, eventTarget) { + this._latestPointer.pointer = pointer; + this._latestPointer.event = event; + this._latestPointer.eventTarget = eventTarget; + } + }, { + key: "destroy", + value: function destroy() { + this._latestPointer.pointer = null; + this._latestPointer.event = null; + this._latestPointer.eventTarget = null; + } + }, { + key: "_createPreparedEvent", + value: function _createPreparedEvent(event, phase, preEnd, type) { + return new _InteractEvent["default"](this, event, this.prepared.name, phase, this.element, preEnd, type); + } + }, { + key: "_fireEvent", + value: function _fireEvent(iEvent) { + this.interactable.fire(iEvent); + + if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) { + this.prevEvent = iEvent; + } + } + }, { + key: "_doPhase", + value: function _doPhase(signalArg) { + var event = signalArg.event, + phase = signalArg.phase, + preEnd = signalArg.preEnd, + type = signalArg.type; + var rect = this.rect; + + if (rect && phase === 'move') { + // update the rect changes due to pointer move + utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource]); + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + + var beforeResult = this._scopeFire("interactions:before-action-".concat(phase), signalArg); + + if (beforeResult === false) { + return false; + } + + var iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type); + + this._scopeFire("interactions:action-".concat(phase), signalArg); + + if (phase === 'start') { + this.prevEvent = iEvent; + } + + this._fireEvent(iEvent); + + this._scopeFire("interactions:after-action-".concat(phase), signalArg); + + return true; + } + }, { + key: "_now", + value: function _now() { + return Date.now(); + } + }]); + + return Interaction; +}(); + +_$Interaction_18.Interaction = Interaction; +var ___default_18 = Interaction; +_$Interaction_18["default"] = ___default_18; + +var _$interactionFinder_22 = {}; +"use strict"; + +function ___typeof_22(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_22 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_22 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_22(obj); } + +Object.defineProperty(_$interactionFinder_22, "__esModule", { + value: true +}); +_$interactionFinder_22["default"] = void 0; + +var __dom_22 = ___interopRequireWildcard_22(_$domUtils_53); + +function ___getRequireWildcardCache_22() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_22 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_22(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_22(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_22(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +var finder = { + methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'], + search: function search(details) { + for (var _i = 0; _i < finder.methodOrder.length; _i++) { + var _ref; + + _ref = finder.methodOrder[_i]; + var method = _ref; + var interaction = finder[method](details); + + if (interaction) { + return interaction; + } + } + + return null; + }, + // try to resume simulation with a new pointer + simulationResume: function simulationResume(_ref2) { + var pointerType = _ref2.pointerType, + eventType = _ref2.eventType, + eventTarget = _ref2.eventTarget, + scope = _ref2.scope; + + if (!/down|start/i.test(eventType)) { + return null; + } + + for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) { + var _ref3; + + _ref3 = scope.interactions.list[_i2]; + var interaction = _ref3; + var element = eventTarget; + + if (interaction.simulation && interaction.simulation.allowResume && interaction.pointerType === pointerType) { + while (element) { + // if the element is the interaction element + if (element === interaction.element) { + return interaction; + } + + element = __dom_22.parentNode(element); + } + } + } + + return null; + }, + // if it's a mouse or pen interaction + mouseOrPen: function mouseOrPen(_ref4) { + var pointerId = _ref4.pointerId, + pointerType = _ref4.pointerType, + eventType = _ref4.eventType, + scope = _ref4.scope; + + if (pointerType !== 'mouse' && pointerType !== 'pen') { + return null; + } + + var firstNonActive; + + for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { + var _ref5; + + _ref5 = scope.interactions.list[_i3]; + var interaction = _ref5; + + if (interaction.pointerType === pointerType) { + // if it's a down event, skip interactions with running simulations + if (interaction.simulation && !hasPointerId(interaction, pointerId)) { + continue; + } // if the interaction is active, return it immediately + + + if (interaction.interacting()) { + return interaction; + } // otherwise save it and look for another active interaction + else if (!firstNonActive) { + firstNonActive = interaction; + } + } + } // if no active mouse interaction was found use the first inactive mouse + // interaction + + + if (firstNonActive) { + return firstNonActive; + } // find any mouse or pen interaction. + // ignore the interaction if the eventType is a *down, and a simulation + // is active + + + for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) { + var _ref6; + + _ref6 = scope.interactions.list[_i4]; + var _interaction = _ref6; + + if (_interaction.pointerType === pointerType && !(/down/i.test(eventType) && _interaction.simulation)) { + return _interaction; + } + } + + return null; + }, + // get interaction that has this pointer + hasPointer: function hasPointer(_ref7) { + var pointerId = _ref7.pointerId, + scope = _ref7.scope; + + for (var _i5 = 0; _i5 < scope.interactions.list.length; _i5++) { + var _ref8; + + _ref8 = scope.interactions.list[_i5]; + var interaction = _ref8; + + if (hasPointerId(interaction, pointerId)) { + return interaction; + } + } + + return null; + }, + // get first idle interaction with a matching pointerType + idle: function idle(_ref9) { + var pointerType = _ref9.pointerType, + scope = _ref9.scope; + + for (var _i6 = 0; _i6 < scope.interactions.list.length; _i6++) { + var _ref10; + + _ref10 = scope.interactions.list[_i6]; + var interaction = _ref10; + + // if there's already a pointer held down + if (interaction.pointers.length === 1) { + var target = interaction.interactable; // don't add this pointer if there is a target interactable and it + // isn't gesturable + + if (target && !(target.options.gesture && target.options.gesture.enabled)) { + continue; + } + } // maximum of 2 pointers per interaction + else if (interaction.pointers.length >= 2) { + continue; + } + + if (!interaction.interacting() && pointerType === interaction.pointerType) { + return interaction; + } + } + + return null; + } +}; + +function hasPointerId(interaction, pointerId) { + return interaction.pointers.some(function (_ref11) { + var id = _ref11.id; + return id === pointerId; + }); +} + +var ___default_22 = finder; +_$interactionFinder_22["default"] = ___default_22; + +var _$DropEvent_2 = {}; +"use strict"; + +Object.defineProperty(_$DropEvent_2, "__esModule", { + value: true +}); +_$DropEvent_2["default"] = void 0; + +var ___BaseEvent2_2 = ___interopRequireDefault_2(_$BaseEvent_13); + +var __arr_2 = ___interopRequireWildcard_2(_$arr_49); + +function ___getRequireWildcardCache_2() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_2 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_2(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_2(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_2(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___typeof_2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_2 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_2(obj); } + +function ___classCallCheck_2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_2(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_2(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_2(Constructor, staticProps); return Constructor; } + +function ___possibleConstructorReturn_2(self, call) { if (call && (___typeof_2(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_2(self); } + +function ___getPrototypeOf_2(o) { ___getPrototypeOf_2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_2(o); } + +function ___assertThisInitialized_2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function ___inherits_2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_2(subClass, superClass); } + +function ___setPrototypeOf_2(o, p) { ___setPrototypeOf_2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_2(o, p); } + +function ___defineProperty_2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var DropEvent = +/*#__PURE__*/ +function (_BaseEvent) { + ___inherits_2(DropEvent, _BaseEvent); + + /** + * Class of events fired on dropzones during drags with acceptable targets. + */ + function DropEvent(dropState, dragEvent, type) { + var _this; + + ___classCallCheck_2(this, DropEvent); + + _this = ___possibleConstructorReturn_2(this, ___getPrototypeOf_2(DropEvent).call(this, dragEvent._interaction)); + + ___defineProperty_2(___assertThisInitialized_2(_this), "target", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "dropzone", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "dragEvent", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "relatedTarget", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "draggable", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "timeStamp", void 0); + + ___defineProperty_2(___assertThisInitialized_2(_this), "propagationStopped", false); + + ___defineProperty_2(___assertThisInitialized_2(_this), "immediatePropagationStopped", false); + + var _ref = type === 'dragleave' ? dropState.prev : dropState.cur, + element = _ref.element, + dropzone = _ref.dropzone; + + _this.type = type; + _this.target = element; + _this.currentTarget = element; + _this.dropzone = dropzone; + _this.dragEvent = dragEvent; + _this.relatedTarget = dragEvent.target; + _this.draggable = dragEvent.interactable; + _this.timeStamp = dragEvent.timeStamp; + return _this; + } + /** + * If this is a `dropactivate` event, the dropzone element will be + * deactivated. + * + * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the + * dropzone element and more. + */ + + + ___createClass_2(DropEvent, [{ + key: "reject", + value: function reject() { + var _this2 = this; + + var dropState = this._interaction.dropState; + + if (this.type !== 'dropactivate' && (!this.dropzone || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)) { + return; + } + + dropState.prev.dropzone = this.dropzone; + dropState.prev.element = this.target; + dropState.rejected = true; + dropState.events.enter = null; + this.stopImmediatePropagation(); + + if (this.type === 'dropactivate') { + var activeDrops = dropState.activeDrops; + var index = __arr_2.findIndex(activeDrops, function (_ref2) { + var dropzone = _ref2.dropzone, + element = _ref2.element; + return dropzone === _this2.dropzone && element === _this2.target; + }); + dropState.activeDrops.splice(index, 1); + var deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate'); + deactivateEvent.dropzone = this.dropzone; + deactivateEvent.target = this.target; + this.dropzone.fire(deactivateEvent); + } else { + this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave')); + } + } + }, { + key: "preventDefault", + value: function preventDefault() {} + }, { + key: "stopPropagation", + value: function stopPropagation() { + this.propagationStopped = true; + } + }, { + key: "stopImmediatePropagation", + value: function stopImmediatePropagation() { + this.immediatePropagationStopped = this.propagationStopped = true; + } + }]); + + return DropEvent; +}(___BaseEvent2_2["default"]); + +var ___default_2 = DropEvent; +_$DropEvent_2["default"] = ___default_2; + +var _$index_3 = {}; +"use strict"; + +function ___typeof_3(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_3 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_3(obj); } + +Object.defineProperty(_$index_3, "__esModule", { + value: true +}); +_$index_3["default"] = void 0; + +var ___Interactable_3 = ___interopRequireDefault_3(_$Interactable_16({})); + +var ___scope_3 = _$scope_24({}); + +var __utils_3 = ___interopRequireWildcard_3(_$index_58); + +var _drag = ___interopRequireDefault_3(_$drag_1); + +var _DropEvent = ___interopRequireDefault_3(_$DropEvent_2); + +function ___getRequireWildcardCache_3() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_3 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_3(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_3(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_3(scope) { + var actions = scope.actions, + interact = scope.interact, + Interactable = scope.Interactable, + defaults = scope.defaults; + scope.usePlugin(_drag["default"]); + /** + * + * ```js + * interact('.drop').dropzone({ + * accept: '.can-drop' || document.getElementById('single-drop'), + * overlap: 'pointer' || 'center' || zeroToOne + * } + * ``` + * + * Returns or sets whether draggables can be dropped onto this target to + * trigger drop events + * + * Dropzones can receive the following events: + * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends + * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone + * - `dragmove` when a draggable that has entered the dropzone is moved + * - `drop` when a draggable is dropped into this dropzone + * + * Use the `accept` option to allow only elements that match the given CSS + * selector or element. The value can be: + * + * - **an Element** - only that element can be dropped into this dropzone. + * - **a string**, - the element being dragged must match it as a CSS selector. + * - **`null`** - accept options is cleared - it accepts any element. + * + * Use the `overlap` option to set how drops are checked for. The allowed + * values are: + * + * - `'pointer'`, the pointer must be over the dropzone (default) + * - `'center'`, the draggable element's center must be over the dropzone + * - a number from 0-1 which is the `(intersection area) / (draggable area)`. + * e.g. `0.5` for drop to happen when half of the area of the draggable is + * over the dropzone + * + * Use the `checker` option to specify a function to check if a dragged element + * is over this Interactable. + * + * @param {boolean | object | null} [options] The new options to be set. + * @return {boolean | Interactable} The current setting or this Interactable + */ + + Interactable.prototype.dropzone = function (options) { + return dropzoneMethod(this, options); + }; + /** + * ```js + * interact(target) + * .dropChecker(function(dragEvent, // related dragmove or dragend event + * event, // TouchEvent/PointerEvent/MouseEvent + * dropped, // bool result of the default checker + * dropzone, // dropzone Interactable + * dropElement, // dropzone elemnt + * draggable, // draggable Interactable + * draggableElement) {// draggable element + * + * return dropped && event.target.hasAttribute('allow-drop') + * } + * ``` + */ + + + Interactable.prototype.dropCheck = function (dragEvent, event, draggable, draggableElement, dropElement, rect) { + return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect); + }; + /** + * Returns or sets whether the dimensions of dropzone elements are calculated + * on every dragmove or only on dragstart for the default dropChecker + * + * @param {boolean} [newValue] True to check on each move. False to check only + * before start + * @return {boolean | interact} The current setting or interact + */ + + + interact.dynamicDrop = function (newValue) { + if (__utils_3.is.bool(newValue)) { + // if (dragging && scope.dynamicDrop !== newValue && !newValue) { + // calcRects(dropzones) + // } + scope.dynamicDrop = newValue; + return interact; + } + + return scope.dynamicDrop; + }; + + __utils_3.extend(actions.phaselessTypes, { + dragenter: true, + dragleave: true, + dropactivate: true, + dropdeactivate: true, + dropmove: true, + drop: true + }); + actions.methodDict.drop = 'dropzone'; + scope.dynamicDrop = false; + defaults.actions.drop = drop.defaults; +} + +function collectDrops(_ref, draggableElement) { + var interactables = _ref.interactables; + var drops = []; // collect all dropzones and their elements which qualify for a drop + + for (var _i = 0; _i < interactables.list.length; _i++) { + var _ref2; + + _ref2 = interactables.list[_i]; + var dropzone = _ref2; + + if (!dropzone.options.drop.enabled) { + continue; + } + + var accept = dropzone.options.drop.accept; // test the draggable draggableElement against the dropzone's accept setting + + if (__utils_3.is.element(accept) && accept !== draggableElement || __utils_3.is.string(accept) && !__utils_3.dom.matchesSelector(draggableElement, accept) || __utils_3.is.func(accept) && !accept({ + dropzone: dropzone, + draggableElement: draggableElement + })) { + continue; + } // query for new elements if necessary + + + var dropElements = __utils_3.is.string(dropzone.target) ? dropzone._context.querySelectorAll(dropzone.target) : __utils_3.is.array(dropzone.target) ? dropzone.target : [dropzone.target]; + + for (var _i2 = 0; _i2 < dropElements.length; _i2++) { + var _ref3; + + _ref3 = dropElements[_i2]; + var dropzoneElement = _ref3; + + if (dropzoneElement !== draggableElement) { + drops.push({ + dropzone: dropzone, + element: dropzoneElement + }); + } + } + } + + return drops; +} + +function fireActivationEvents(activeDrops, event) { + // loop through all active dropzones and trigger event + for (var _i3 = 0; _i3 < activeDrops.slice().length; _i3++) { + var _ref4; + + _ref4 = activeDrops.slice()[_i3]; + var _ref5 = _ref4, + dropzone = _ref5.dropzone, + element = _ref5.element; + event.dropzone = dropzone; // set current element as event target + + event.target = element; + dropzone.fire(event); + event.propagationStopped = event.immediatePropagationStopped = false; + } +} // return a new array of possible drops. getActiveDrops should always be +// called when a drag has just started or a drag event happens while +// dynamicDrop is true + + +function getActiveDrops(scope, dragElement) { + // get dropzones and their elements that could receive the draggable + var activeDrops = collectDrops(scope, dragElement); + + for (var _i4 = 0; _i4 < activeDrops.length; _i4++) { + var _ref6; + + _ref6 = activeDrops[_i4]; + var activeDrop = _ref6; + activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element); + } + + return activeDrops; +} + +function getDrop(_ref7, dragEvent, pointerEvent) { + var dropState = _ref7.dropState, + draggable = _ref7.interactable, + dragElement = _ref7.element; + var validDrops = []; // collect all dropzones and their elements which qualify for a drop + + for (var _i5 = 0; _i5 < dropState.activeDrops.length; _i5++) { + var _ref8; + + _ref8 = dropState.activeDrops[_i5]; + var _ref9 = _ref8, + dropzone = _ref9.dropzone, + dropzoneElement = _ref9.element, + _rect = _ref9.rect; + validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, _rect) ? dropzoneElement : null); + } // get the most appropriate dropzone based on DOM depth and order + + + var dropIndex = __utils_3.dom.indexOfDeepestElement(validDrops); + return dropState.activeDrops[dropIndex] || null; +} + +function getDropEvents(interaction, _pointerEvent, dragEvent) { + var dropState = interaction.dropState; + var dropEvents = { + enter: null, + leave: null, + activate: null, + deactivate: null, + move: null, + drop: null + }; + + if (dragEvent.type === 'dragstart') { + dropEvents.activate = new _DropEvent["default"](dropState, dragEvent, 'dropactivate'); + dropEvents.activate.target = null; + dropEvents.activate.dropzone = null; + } + + if (dragEvent.type === 'dragend') { + dropEvents.deactivate = new _DropEvent["default"](dropState, dragEvent, 'dropdeactivate'); + dropEvents.deactivate.target = null; + dropEvents.deactivate.dropzone = null; + } + + if (dropState.rejected) { + return dropEvents; + } + + if (dropState.cur.element !== dropState.prev.element) { + // if there was a previous dropzone, create a dragleave event + if (dropState.prev.dropzone) { + dropEvents.leave = new _DropEvent["default"](dropState, dragEvent, 'dragleave'); + dragEvent.dragLeave = dropEvents.leave.target = dropState.prev.element; + dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone; + } // if dropzone is not null, create a dragenter event + + + if (dropState.cur.dropzone) { + dropEvents.enter = new _DropEvent["default"](dropState, dragEvent, 'dragenter'); + dragEvent.dragEnter = dropState.cur.element; + dragEvent.dropzone = dropState.cur.dropzone; + } + } + + if (dragEvent.type === 'dragend' && dropState.cur.dropzone) { + dropEvents.drop = new _DropEvent["default"](dropState, dragEvent, 'drop'); + dragEvent.dropzone = dropState.cur.dropzone; + dragEvent.relatedTarget = dropState.cur.element; + } + + if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) { + dropEvents.move = new _DropEvent["default"](dropState, dragEvent, 'dropmove'); + dropEvents.move.dragmove = dragEvent; + dragEvent.dropzone = dropState.cur.dropzone; + } + + return dropEvents; +} + +function fireDropEvents(interaction, events) { + var dropState = interaction.dropState; + var activeDrops = dropState.activeDrops, + cur = dropState.cur, + prev = dropState.prev; + + if (events.leave) { + prev.dropzone.fire(events.leave); + } + + if (events.move) { + cur.dropzone.fire(events.move); + } + + if (events.enter) { + cur.dropzone.fire(events.enter); + } + + if (events.drop) { + cur.dropzone.fire(events.drop); + } + + if (events.deactivate) { + fireActivationEvents(activeDrops, events.deactivate); + } + + dropState.prev.dropzone = cur.dropzone; + dropState.prev.element = cur.element; +} + +function onEventCreated(_ref10, scope) { + var interaction = _ref10.interaction, + iEvent = _ref10.iEvent, + event = _ref10.event; + + if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { + return; + } + + var dropState = interaction.dropState; + + if (scope.dynamicDrop) { + dropState.activeDrops = getActiveDrops(scope, interaction.element); + } + + var dragEvent = iEvent; + var dropResult = getDrop(interaction, dragEvent, event); // update rejected status + + dropState.rejected = dropState.rejected && !!dropResult && dropResult.dropzone === dropState.cur.dropzone && dropResult.element === dropState.cur.element; + dropState.cur.dropzone = dropResult && dropResult.dropzone; + dropState.cur.element = dropResult && dropResult.element; + dropState.events = getDropEvents(interaction, event, dragEvent); +} + +function dropzoneMethod(interactable, options) { + if (__utils_3.is.object(options)) { + interactable.options.drop.enabled = options.enabled !== false; + + if (options.listeners) { + var normalized = __utils_3.normalizeListeners(options.listeners); // rename 'drop' to '' as it will be prefixed with 'drop' + + var corrected = Object.keys(normalized).reduce(function (acc, type) { + var correctedType = /^(enter|leave)/.test(type) ? "drag".concat(type) : /^(activate|deactivate|move)/.test(type) ? "drop".concat(type) : type; + acc[correctedType] = normalized[type]; + return acc; + }, {}); + interactable.off(interactable.options.drop.listeners); + interactable.on(corrected); + interactable.options.drop.listeners = corrected; + } + + if (__utils_3.is.func(options.ondrop)) { + interactable.on('drop', options.ondrop); + } + + if (__utils_3.is.func(options.ondropactivate)) { + interactable.on('dropactivate', options.ondropactivate); + } + + if (__utils_3.is.func(options.ondropdeactivate)) { + interactable.on('dropdeactivate', options.ondropdeactivate); + } + + if (__utils_3.is.func(options.ondragenter)) { + interactable.on('dragenter', options.ondragenter); + } + + if (__utils_3.is.func(options.ondragleave)) { + interactable.on('dragleave', options.ondragleave); + } + + if (__utils_3.is.func(options.ondropmove)) { + interactable.on('dropmove', options.ondropmove); + } + + if (/^(pointer|center)$/.test(options.overlap)) { + interactable.options.drop.overlap = options.overlap; + } else if (__utils_3.is.number(options.overlap)) { + interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0); + } + + if ('accept' in options) { + interactable.options.drop.accept = options.accept; + } + + if ('checker' in options) { + interactable.options.drop.checker = options.checker; + } + + return interactable; + } + + if (__utils_3.is.bool(options)) { + interactable.options.drop.enabled = options; + return interactable; + } + + return interactable.options.drop; +} + +function dropCheckMethod(interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) { + var dropped = false; // if the dropzone has no rect (eg. display: none) + // call the custom dropChecker or just return false + + if (!(rect = rect || interactable.getRect(dropElement))) { + return interactable.options.drop.checker ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement) : false; + } + + var dropOverlap = interactable.options.drop.overlap; + + if (dropOverlap === 'pointer') { + var origin = __utils_3.getOriginXY(draggable, draggableElement, 'drag'); + var page = __utils_3.pointer.getPageXY(dragEvent); + page.x += origin.x; + page.y += origin.y; + var horizontal = page.x > rect.left && page.x < rect.right; + var vertical = page.y > rect.top && page.y < rect.bottom; + dropped = horizontal && vertical; + } + + var dragRect = draggable.getRect(draggableElement); + + if (dragRect && dropOverlap === 'center') { + var cx = dragRect.left + dragRect.width / 2; + var cy = dragRect.top + dragRect.height / 2; + dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom; + } + + if (dragRect && __utils_3.is.number(dropOverlap)) { + var overlapArea = Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) * Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top)); + var overlapRatio = overlapArea / (dragRect.width * dragRect.height); + dropped = overlapRatio >= dropOverlap; + } + + if (interactable.options.drop.checker) { + dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement); + } + + return dropped; +} + +var drop = { + id: 'actions/drop', + install: __install_3, + listeners: { + 'interactions:before-action-start': function interactionsBeforeActionStart(_ref11) { + var interaction = _ref11.interaction; + + if (interaction.prepared.name !== 'drag') { + return; + } + + interaction.dropState = { + cur: { + dropzone: null, + element: null + }, + prev: { + dropzone: null, + element: null + }, + rejected: null, + events: null, + activeDrops: [] + }; + }, + 'interactions:after-action-start': function interactionsAfterActionStart(_ref12, scope) { + var interaction = _ref12.interaction, + event = _ref12.event, + dragEvent = _ref12.iEvent; + + if (interaction.prepared.name !== 'drag') { + return; + } + + var dropState = interaction.dropState; // reset active dropzones + + dropState.activeDrops = null; + dropState.events = null; + dropState.activeDrops = getActiveDrops(scope, interaction.element); + dropState.events = getDropEvents(interaction, event, dragEvent); + + if (dropState.events.activate) { + fireActivationEvents(dropState.activeDrops, dropState.events.activate); + scope.fire('actions/drop:start', { + interaction: interaction, + dragEvent: dragEvent + }); + } + }, + // FIXME proper signal types + 'interactions:action-move': onEventCreated, + 'interactions:action-end': onEventCreated, + 'interactions:after-action-move': function fireDropAfterMove(_ref13, scope) { + var interaction = _ref13.interaction, + dragEvent = _ref13.iEvent; + + if (interaction.prepared.name !== 'drag') { + return; + } + + fireDropEvents(interaction, interaction.dropState.events); + scope.fire('actions/drop:move', { + interaction: interaction, + dragEvent: dragEvent + }); + interaction.dropState.events = {}; + }, + 'interactions:after-action-end': function interactionsAfterActionEnd(_ref14, scope) { + var interaction = _ref14.interaction, + dragEvent = _ref14.iEvent; + + if (interaction.prepared.name !== 'drag') { + return; + } + + fireDropEvents(interaction, interaction.dropState.events); + scope.fire('actions/drop:end', { + interaction: interaction, + dragEvent: dragEvent + }); + }, + 'interactions:stop': function interactionsStop(_ref15) { + var interaction = _ref15.interaction; + + if (interaction.prepared.name !== 'drag') { + return; + } + + var dropState = interaction.dropState; + + if (dropState) { + dropState.activeDrops = null; + dropState.events = null; + dropState.cur.dropzone = null; + dropState.cur.element = null; + dropState.prev.dropzone = null; + dropState.prev.element = null; + dropState.rejected = false; + } + } + }, + getActiveDrops: getActiveDrops, + getDrop: getDrop, + getDropEvents: getDropEvents, + fireDropEvents: fireDropEvents, + defaults: { + enabled: false, + accept: null, + overlap: 'pointer' + } +}; +var ___default_3 = drop; +_$index_3["default"] = ___default_3; + +var _$gesture_4 = {}; +"use strict"; + +function ___typeof_4(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_4 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_4 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_4(obj); } + +Object.defineProperty(_$gesture_4, "__esModule", { + value: true +}); +_$gesture_4["default"] = void 0; + +var __utils_4 = ___interopRequireWildcard_4(_$index_58); + +function ___getRequireWildcardCache_4() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_4 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_4(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_4(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_4(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_4(scope) { + var actions = scope.actions, + Interactable = scope.Interactable, + defaults = scope.defaults; + /** + * ```js + * interact(element).gesturable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * // limit multiple gestures. + * // See the explanation in {@link Interactable.draggable} example + * max: Infinity, + * maxPerElement: 1, + * }) + * + * var isGestureable = interact(element).gesturable() + * ``` + * + * Gets or sets whether multitouch gestures can be performed on the target + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on gesture events (makes the Interactable gesturable) + * @return {boolean | Interactable} A boolean indicating if this can be the + * target of gesture events, or this Interactable + */ + + Interactable.prototype.gesturable = function (options) { + if (__utils_4.is.object(options)) { + this.options.gesture.enabled = options.enabled !== false; + this.setPerAction('gesture', options); + this.setOnEvents('gesture', options); + return this; + } + + if (__utils_4.is.bool(options)) { + this.options.gesture.enabled = options; + return this; + } + + return this.options.gesture; + }; + + actions.map.gesture = gesture; + actions.methodDict.gesture = 'gesturable'; + defaults.actions.gesture = gesture.defaults; +} + +function updateGestureProps(_ref) { + var interaction = _ref.interaction, + iEvent = _ref.iEvent, + phase = _ref.phase; + + if (interaction.prepared.name !== 'gesture') { + return; + } + + var pointers = interaction.pointers.map(function (p) { + return p.pointer; + }); + var starting = phase === 'start'; + var ending = phase === 'end'; + var deltaSource = interaction.interactable.options.deltaSource; + iEvent.touches = [pointers[0], pointers[1]]; + + if (starting) { + iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource); + iEvent.box = __utils_4.pointer.touchBBox(pointers); + iEvent.scale = 1; + iEvent.ds = 0; + iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource); + iEvent.da = 0; + interaction.gesture.startDistance = iEvent.distance; + interaction.gesture.startAngle = iEvent.angle; + } else if (ending) { + var prevEvent = interaction.prevEvent; + iEvent.distance = prevEvent.distance; + iEvent.box = prevEvent.box; + iEvent.scale = prevEvent.scale; + iEvent.ds = 0; + iEvent.angle = prevEvent.angle; + iEvent.da = 0; + } else { + iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource); + iEvent.box = __utils_4.pointer.touchBBox(pointers); + iEvent.scale = iEvent.distance / interaction.gesture.startDistance; + iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource); + iEvent.ds = iEvent.scale - interaction.gesture.scale; + iEvent.da = iEvent.angle - interaction.gesture.angle; + } + + interaction.gesture.distance = iEvent.distance; + interaction.gesture.angle = iEvent.angle; + + if (__utils_4.is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) { + interaction.gesture.scale = iEvent.scale; + } +} + +var gesture = { + id: 'actions/gesture', + before: ['actions/drag', 'actions/resize'], + install: __install_4, + listeners: { + 'interactions:action-start': updateGestureProps, + 'interactions:action-move': updateGestureProps, + 'interactions:action-end': updateGestureProps, + 'interactions:new': function interactionsNew(_ref2) { + var interaction = _ref2.interaction; + interaction.gesture = { + angle: 0, + distance: 0, + scale: 1, + startAngle: 0, + startDistance: 0 + }; + }, + 'auto-start:check': function autoStartCheck(arg) { + if (arg.interaction.pointers.length < 2) { + return undefined; + } + + var gestureOptions = arg.interactable.options.gesture; + + if (!(gestureOptions && gestureOptions.enabled)) { + return undefined; + } + + arg.action = { + name: 'gesture' + }; + return false; + } + }, + defaults: {}, + getCursor: function getCursor() { + return ''; + } +}; +var ___default_4 = gesture; +_$gesture_4["default"] = ___default_4; + +var _$resize_6 = {}; +"use strict"; + +function ___typeof_6(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_6 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_6 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_6(obj); } + +Object.defineProperty(_$resize_6, "__esModule", { + value: true +}); +_$resize_6["default"] = void 0; + +/* removed: var _$Interaction_18 = require("@interactjs/core/Interaction"); */; + +var __dom_6 = ___interopRequireWildcard_6(_$domUtils_53); + +var ___extend_6 = ___interopRequireDefault_6(_$extend_55); + +var __is_6 = ___interopRequireWildcard_6(_$is_59); + +function ___interopRequireDefault_6(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_6() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_6 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_6(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_6(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_6(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_6(scope) { + var actions = scope.actions, + browser = scope.browser, + Interactable = scope.Interactable, + defaults = scope.defaults; // Less Precision with touch input + + resize.cursors = initCursors(browser); + resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10; + /** + * ```js + * interact(element).resizable({ + * onstart: function (event) {}, + * onmove : function (event) {}, + * onend : function (event) {}, + * + * edges: { + * top : true, // Use pointer coords to check for resize. + * left : false, // Disable resizing from left edge. + * bottom: '.resize-s',// Resize if pointer target matches selector + * right : handleEl // Resize if pointer target is the given Element + * }, + * + * // Width and height can be adjusted independently. When `true`, width and + * // height are adjusted at a 1:1 ratio. + * square: false, + * + * // Width and height can be adjusted independently. When `true`, width and + * // height maintain the aspect ratio they had when resizing started. + * preserveAspectRatio: false, + * + * // a value of 'none' will limit the resize rect to a minimum of 0x0 + * // 'negate' will allow the rect to have negative width/height + * // 'reposition' will keep the width/height positive by swapping + * // the top and bottom edges and/or swapping the left and right edges + * invert: 'none' || 'negate' || 'reposition' + * + * // limit multiple resizes. + * // See the explanation in the {@link Interactable.draggable} example + * max: Infinity, + * maxPerElement: 1, + * }) + * + * var isResizeable = interact(element).resizable() + * ``` + * + * Gets or sets whether resize actions can be performed on the target + * + * @param {boolean | object} [options] true/false or An object with event + * listeners to be fired on resize events (object makes the Interactable + * resizable) + * @return {boolean | Interactable} A boolean indicating if this can be the + * target of resize elements, or this Interactable + */ + + Interactable.prototype.resizable = function (options) { + return resizable(this, options, scope); + }; + + actions.map.resize = resize; + actions.methodDict.resize = 'resizable'; + defaults.actions.resize = resize.defaults; +} + +function resizeChecker(arg) { + var interaction = arg.interaction, + interactable = arg.interactable, + element = arg.element, + rect = arg.rect, + buttons = arg.buttons; + + if (!rect) { + return undefined; + } + + var page = (0, ___extend_6["default"])({}, interaction.coords.cur.page); + var resizeOptions = interactable.options.resize; + + if (!(resizeOptions && resizeOptions.enabled) || // check mouseButton setting if the pointer is down + interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & resizeOptions.mouseButtons) === 0) { + return undefined; + } // if using resize.edges + + + if (__is_6.object(resizeOptions.edges)) { + var resizeEdges = { + left: false, + right: false, + top: false, + bottom: false + }; + + for (var edge in resizeEdges) { + resizeEdges[edge] = checkResizeEdge(edge, resizeOptions.edges[edge], page, interaction._latestPointer.eventTarget, element, rect, resizeOptions.margin || resize.defaultMargin); + } + + resizeEdges.left = resizeEdges.left && !resizeEdges.right; + resizeEdges.top = resizeEdges.top && !resizeEdges.bottom; + + if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) { + arg.action = { + name: 'resize', + edges: resizeEdges + }; + } + } else { + var right = resizeOptions.axis !== 'y' && page.x > rect.right - resize.defaultMargin; + var bottom = resizeOptions.axis !== 'x' && page.y > rect.bottom - resize.defaultMargin; + + if (right || bottom) { + arg.action = { + name: 'resize', + axes: (right ? 'x' : '') + (bottom ? 'y' : '') + }; + } + } + + return arg.action ? false : undefined; +} + +function resizable(interactable, options, scope) { + if (__is_6.object(options)) { + interactable.options.resize.enabled = options.enabled !== false; + interactable.setPerAction('resize', options); + interactable.setOnEvents('resize', options); + + if (__is_6.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) { + interactable.options.resize.axis = options.axis; + } else if (options.axis === null) { + interactable.options.resize.axis = scope.defaults.actions.resize.axis; + } + + if (__is_6.bool(options.preserveAspectRatio)) { + interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio; + } else if (__is_6.bool(options.square)) { + interactable.options.resize.square = options.square; + } + + return interactable; + } + + if (__is_6.bool(options)) { + interactable.options.resize.enabled = options; + return interactable; + } + + return interactable.options.resize; +} + +function checkResizeEdge(name, value, page, element, interactableElement, rect, margin) { + // false, '', undefined, null + if (!value) { + return false; + } // true value, use pointer coords and element rect + + + if (value === true) { + // if dimensions are negative, "switch" edges + var width = __is_6.number(rect.width) ? rect.width : rect.right - rect.left; + var height = __is_6.number(rect.height) ? rect.height : rect.bottom - rect.top; // don't use margin greater than half the relevent dimension + + margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2); + + if (width < 0) { + if (name === 'left') { + name = 'right'; + } else if (name === 'right') { + name = 'left'; + } + } + + if (height < 0) { + if (name === 'top') { + name = 'bottom'; + } else if (name === 'bottom') { + name = 'top'; + } + } + + if (name === 'left') { + return page.x < (width >= 0 ? rect.left : rect.right) + margin; + } + + if (name === 'top') { + return page.y < (height >= 0 ? rect.top : rect.bottom) + margin; + } + + if (name === 'right') { + return page.x > (width >= 0 ? rect.right : rect.left) - margin; + } + + if (name === 'bottom') { + return page.y > (height >= 0 ? rect.bottom : rect.top) - margin; + } + } // the remaining checks require an element + + + if (!__is_6.element(element)) { + return false; + } + + return __is_6.element(value) // the value is an element to use as a resize handle + ? value === element // otherwise check if element matches value as selector + : __dom_6.matchesUpTo(element, value, interactableElement); +} + +function initCursors(browser) { + return browser.isIe9 ? { + x: 'e-resize', + y: 's-resize', + xy: 'se-resize', + top: 'n-resize', + left: 'w-resize', + bottom: 's-resize', + right: 'e-resize', + topleft: 'se-resize', + bottomright: 'se-resize', + topright: 'ne-resize', + bottomleft: 'ne-resize' + } : { + x: 'ew-resize', + y: 'ns-resize', + xy: 'nwse-resize', + top: 'ns-resize', + left: 'ew-resize', + bottom: 'ns-resize', + right: 'ew-resize', + topleft: 'nwse-resize', + bottomright: 'nwse-resize', + topright: 'nesw-resize', + bottomleft: 'nesw-resize' + }; +} + +function start(_ref) { + var iEvent = _ref.iEvent, + interaction = _ref.interaction; + + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + var resizeEvent = iEvent; + var rect = interaction.rect; + interaction._rects = { + start: (0, ___extend_6["default"])({}, rect), + corrected: (0, ___extend_6["default"])({}, rect), + previous: (0, ___extend_6["default"])({}, rect), + delta: { + left: 0, + right: 0, + width: 0, + top: 0, + bottom: 0, + height: 0 + } + }; + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = interaction._rects.corrected; + resizeEvent.deltaRect = interaction._rects.delta; +} + +function __move_6(_ref2) { + var iEvent = _ref2.iEvent, + interaction = _ref2.interaction; + + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + var resizeEvent = iEvent; + var resizeOptions = interaction.interactable.options.resize; + var invert = resizeOptions.invert; + var invertible = invert === 'reposition' || invert === 'negate'; // eslint-disable-next-line no-shadow + + var current = interaction.rect; + var _interaction$_rects = interaction._rects, + startRect = _interaction$_rects.start, + corrected = _interaction$_rects.corrected, + deltaRect = _interaction$_rects.delta, + previous = _interaction$_rects.previous; + (0, ___extend_6["default"])(previous, corrected); + + if (invertible) { + // if invertible, copy the current rect + (0, ___extend_6["default"])(corrected, current); + + if (invert === 'reposition') { + // swap edge values if necessary to keep width/height positive + if (corrected.top > corrected.bottom) { + var swap = corrected.top; + corrected.top = corrected.bottom; + corrected.bottom = swap; + } + + if (corrected.left > corrected.right) { + var _swap = corrected.left; + corrected.left = corrected.right; + corrected.right = _swap; + } + } + } else { + // if not invertible, restrict to minimum of 0x0 rect + corrected.top = Math.min(current.top, startRect.bottom); + corrected.bottom = Math.max(current.bottom, startRect.top); + corrected.left = Math.min(current.left, startRect.right); + corrected.right = Math.max(current.right, startRect.left); + } + + corrected.width = corrected.right - corrected.left; + corrected.height = corrected.bottom - corrected.top; + + for (var edge in corrected) { + deltaRect[edge] = corrected[edge] - previous[edge]; + } + + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = corrected; + resizeEvent.deltaRect = deltaRect; +} + +function end(_ref3) { + var iEvent = _ref3.iEvent, + interaction = _ref3.interaction; + + if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { + return; + } + + var resizeEvent = iEvent; + resizeEvent.edges = interaction.prepared.edges; + resizeEvent.rect = interaction._rects.corrected; + resizeEvent.deltaRect = interaction._rects.delta; +} + +function updateEventAxes(_ref4) { + var iEvent = _ref4.iEvent, + interaction = _ref4.interaction; + + if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { + return; + } + + var options = interaction.interactable.options; + var resizeEvent = iEvent; + + if (options.resize.square) { + if (interaction.resizeAxes === 'y') { + resizeEvent.delta.x = resizeEvent.delta.y; + } else { + resizeEvent.delta.y = resizeEvent.delta.x; + } + + resizeEvent.axes = 'xy'; + } else { + resizeEvent.axes = interaction.resizeAxes; + + if (interaction.resizeAxes === 'x') { + resizeEvent.delta.y = 0; + } else if (interaction.resizeAxes === 'y') { + resizeEvent.delta.x = 0; + } + } +} + +var resize = { + id: 'actions/resize', + before: ['actions/drag'], + install: __install_6, + listeners: { + 'interactions:new': function interactionsNew(_ref5) { + var interaction = _ref5.interaction; + interaction.resizeAxes = 'xy'; + }, + 'interactions:action-start': function interactionsActionStart(arg) { + start(arg); + updateEventAxes(arg); + }, + 'interactions:action-move': function interactionsActionMove(arg) { + __move_6(arg); + updateEventAxes(arg); + }, + 'interactions:action-end': end, + 'auto-start:check': resizeChecker + }, + defaults: { + square: false, + preserveAspectRatio: false, + axis: 'xy', + // use default margin + margin: NaN, + // object with props left, right, top, bottom which are + // true/false values to resize when the pointer is over that edge, + // CSS selectors to match the handles for each direction + // or the Elements for each handle + edges: null, + // a value of 'none' will limit the resize rect to a minimum of 0x0 + // 'negate' will alow the rect to have negative width/height + // 'reposition' will keep the width/height positive by swapping + // the top and bottom edges and/or swapping the left and right edges + invert: 'none' + }, + cursors: null, + getCursor: function getCursor(_ref6) { + var edges = _ref6.edges, + axis = _ref6.axis, + name = _ref6.name; + var cursors = resize.cursors; + var result = null; + + if (axis) { + result = cursors[name + axis]; + } else if (edges) { + var cursorKey = ''; + var _arr = ['top', 'bottom', 'left', 'right']; + + for (var _i = 0; _i < _arr.length; _i++) { + var edge = _arr[_i]; + + if (edges[edge]) { + cursorKey += edge; + } + } + + result = cursors[cursorKey]; + } + + return result; + }, + defaultMargin: null +}; +var ___default_6 = resize; +_$resize_6["default"] = ___default_6; + +var _$index_5 = {}; +"use strict"; + +Object.defineProperty(_$index_5, "__esModule", { + value: true +}); +_$index_5.install = __install_5; +Object.defineProperty(_$index_5, "drag", { + enumerable: true, + get: function get() { + return ___drag_5["default"]; + } +}); +Object.defineProperty(_$index_5, "drop", { + enumerable: true, + get: function get() { + return _index["default"]; + } +}); +Object.defineProperty(_$index_5, "gesture", { + enumerable: true, + get: function get() { + return _gesture["default"]; + } +}); +Object.defineProperty(_$index_5, "resize", { + enumerable: true, + get: function get() { + return _resize["default"]; + } +}); +_$index_5.id = void 0; + +var ___drag_5 = ___interopRequireDefault_5(_$drag_1); + +var _index = ___interopRequireDefault_5(_$index_3); + +var _gesture = ___interopRequireDefault_5(_$gesture_4); + +var _resize = ___interopRequireDefault_5(_$resize_6); + +function ___interopRequireDefault_5(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_5(scope) { + scope.usePlugin(_gesture["default"]); + scope.usePlugin(_resize["default"]); + scope.usePlugin(___drag_5["default"]); + scope.usePlugin(_index["default"]); +} + +var id = 'actions'; +_$index_5.id = id; + +var _$index_7 = {}; +"use strict"; + +function ___typeof_7(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_7 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_7 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_7(obj); } + +Object.defineProperty(_$index_7, "__esModule", { + value: true +}); +_$index_7.getContainer = getContainer; +_$index_7.getScroll = getScroll; +_$index_7.getScrollSize = getScrollSize; +_$index_7.getScrollSizeDelta = getScrollSizeDelta; +_$index_7["default"] = void 0; + +var __domUtils_7 = ___interopRequireWildcard_7(_$domUtils_53); + +var __is_7 = ___interopRequireWildcard_7(_$is_59); + +var ___raf_7 = ___interopRequireDefault_7(_$raf_64); + +/* removed: var _$rect_65 = require("@interactjs/utils/rect"); */; + +/* removed: var _$window_68 = require("@interactjs/utils/window"); */; + +function ___interopRequireDefault_7(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_7() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_7 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_7(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_7(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_7(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_7(scope) { + var defaults = scope.defaults, + actions = scope.actions; + scope.autoScroll = autoScroll; + + autoScroll.now = function () { + return scope.now(); + }; + + actions.phaselessTypes.autoscroll = true; + defaults.perAction.autoScroll = autoScroll.defaults; +} + +var autoScroll = { + defaults: { + enabled: false, + margin: 60, + // the item that is scrolled (Window or HTMLElement) + container: null, + // the scroll speed in pixels per second + speed: 300 + }, + now: Date.now, + interaction: null, + i: 0, + // the handle returned by window.setInterval + x: 0, + y: 0, + // Direction each pulse is to scroll in + isScrolling: false, + prevTime: 0, + margin: 0, + speed: 0, + start: function start(interaction) { + autoScroll.isScrolling = true; + + ___raf_7["default"].cancel(autoScroll.i); + + interaction.autoScroll = autoScroll; + autoScroll.interaction = interaction; + autoScroll.prevTime = autoScroll.now(); + autoScroll.i = ___raf_7["default"].request(autoScroll.scroll); + }, + stop: function stop() { + autoScroll.isScrolling = false; + + if (autoScroll.interaction) { + autoScroll.interaction.autoScroll = null; + } + + ___raf_7["default"].cancel(autoScroll.i); + }, + // scroll the window by the values in scroll.x/y + scroll: function scroll() { + var interaction = autoScroll.interaction; + var interactable = interaction.interactable, + element = interaction.element; + var actionName = interaction.prepared.name; + var options = interactable.options[actionName].autoScroll; + var container = getContainer(options.container, interactable, element); + var now = autoScroll.now(); // change in time in seconds + + var dt = (now - autoScroll.prevTime) / 1000; // displacement + + var s = options.speed * dt; + + if (s >= 1) { + var scrollBy = { + x: autoScroll.x * s, + y: autoScroll.y * s + }; + + if (scrollBy.x || scrollBy.y) { + var prevScroll = getScroll(container); + + if (__is_7.window(container)) { + container.scrollBy(scrollBy.x, scrollBy.y); + } else if (container) { + container.scrollLeft += scrollBy.x; + container.scrollTop += scrollBy.y; + } + + var curScroll = getScroll(container); + var delta = { + x: curScroll.x - prevScroll.x, + y: curScroll.y - prevScroll.y + }; + + if (delta.x || delta.y) { + interactable.fire({ + type: 'autoscroll', + target: element, + interactable: interactable, + delta: delta, + interaction: interaction, + container: container + }); + } + } + + autoScroll.prevTime = now; + } + + if (autoScroll.isScrolling) { + ___raf_7["default"].cancel(autoScroll.i); + + autoScroll.i = ___raf_7["default"].request(autoScroll.scroll); + } + }, + check: function check(interactable, actionName) { + var options = interactable.options; + return options[actionName].autoScroll && options[actionName].autoScroll.enabled; + }, + onInteractionMove: function onInteractionMove(_ref) { + var interaction = _ref.interaction, + pointer = _ref.pointer; + + if (!(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))) { + return; + } + + if (interaction.simulation) { + autoScroll.x = autoScroll.y = 0; + return; + } + + var top; + var right; + var bottom; + var left; + var interactable = interaction.interactable, + element = interaction.element; + var actionName = interaction.prepared.name; + var options = interactable.options[actionName].autoScroll; + var container = getContainer(options.container, interactable, element); + + if (__is_7.window(container)) { + left = pointer.clientX < autoScroll.margin; + top = pointer.clientY < autoScroll.margin; + right = pointer.clientX > container.innerWidth - autoScroll.margin; + bottom = pointer.clientY > container.innerHeight - autoScroll.margin; + } else { + var rect = __domUtils_7.getElementClientRect(container); + left = pointer.clientX < rect.left + autoScroll.margin; + top = pointer.clientY < rect.top + autoScroll.margin; + right = pointer.clientX > rect.right - autoScroll.margin; + bottom = pointer.clientY > rect.bottom - autoScroll.margin; + } + + autoScroll.x = right ? 1 : left ? -1 : 0; + autoScroll.y = bottom ? 1 : top ? -1 : 0; + + if (!autoScroll.isScrolling) { + // set the autoScroll properties to those of the target + autoScroll.margin = options.margin; + autoScroll.speed = options.speed; + autoScroll.start(interaction); + } + } +}; + +function getContainer(value, interactable, element) { + return (__is_7.string(value) ? (0, _$rect_65.getStringOptionResult)(value, interactable, element) : value) || (0, _$window_68.getWindow)(element); +} + +function getScroll(container) { + if (__is_7.window(container)) { + container = window.document.body; + } + + return { + x: container.scrollLeft, + y: container.scrollTop + }; +} + +function getScrollSize(container) { + if (__is_7.window(container)) { + container = window.document.body; + } + + return { + x: container.scrollWidth, + y: container.scrollHeight + }; +} + +function getScrollSizeDelta(_ref2, func) { + var interaction = _ref2.interaction, + element = _ref2.element; + var scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll; + + if (!scrollOptions || !scrollOptions.enabled) { + func(); + return { + x: 0, + y: 0 + }; + } + + var scrollContainer = getContainer(scrollOptions.container, interaction.interactable, element); + var prevSize = getScroll(scrollContainer); + func(); + var curSize = getScroll(scrollContainer); + return { + x: curSize.x - prevSize.x, + y: curSize.y - prevSize.y + }; +} + +var autoScrollPlugin = { + id: 'auto-scroll', + install: __install_7, + listeners: { + 'interactions:new': function interactionsNew(_ref3) { + var interaction = _ref3.interaction; + interaction.autoScroll = null; + }, + 'interactions:destroy': function interactionsDestroy(_ref4) { + var interaction = _ref4.interaction; + interaction.autoScroll = null; + autoScroll.stop(); + + if (autoScroll.interaction) { + autoScroll.interaction = null; + } + }, + 'interactions:stop': autoScroll.stop, + 'interactions:action-move': function interactionsActionMove(arg) { + return autoScroll.onInteractionMove(arg); + } + } +}; +var ___default_7 = autoScrollPlugin; +_$index_7["default"] = ___default_7; + +var _$InteractableMethods_8 = {}; +"use strict"; + +function ___typeof_8(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_8 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_8 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_8(obj); } + +Object.defineProperty(_$InteractableMethods_8, "__esModule", { + value: true +}); +_$InteractableMethods_8["default"] = void 0; + +/* removed: var _$index_58 = require("@interactjs/utils/index"); */; + +var __is_8 = ___interopRequireWildcard_8(_$is_59); + +function ___getRequireWildcardCache_8() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_8 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_8(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_8(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_8(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_8(scope) { + var Interactable = scope.Interactable; + + Interactable.prototype.getAction = function getAction(pointer, event, interaction, element) { + var action = defaultActionChecker(this, event, interaction, element, scope); + + if (this.options.actionChecker) { + return this.options.actionChecker(pointer, event, action, this, element, interaction); + } + + return action; + }; + /** + * ```js + * interact(element, { ignoreFrom: document.getElementById('no-action') }) + * // or + * interact(element).ignoreFrom('input, textarea, a') + * ``` + * @deprecated + * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any + * of it's parents match the given CSS selector or Element, no + * drag/resize/gesture is started. + * + * Don't use this method. Instead set the `ignoreFrom` option for each action + * or for `pointerEvents` + * + * @example + * interact(targett) + * .draggable({ + * ignoreFrom: 'input, textarea, a[href]'', + * }) + * .pointerEvents({ + * ignoreFrom: '[no-pointer]', + * }) + * + * @param {string | Element | null} [newValue] a CSS selector string, an + * Element or `null` to not ignore any elements + * @return {string | Element | object} The current ignoreFrom value or this + * Interactable + */ + + + Interactable.prototype.ignoreFrom = (0, _$index_58.warnOnce)(function (newValue) { + return this._backCompatOption('ignoreFrom', newValue); + }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).'); + /** + * @deprecated + * + * A drag/resize/gesture is started only If the target of the `mousedown`, + * `pointerdown` or `touchstart` event or any of it's parents match the given + * CSS selector or Element. + * + * Don't use this method. Instead set the `allowFrom` option for each action + * or for `pointerEvents` + * + * @example + * interact(targett) + * .resizable({ + * allowFrom: '.resize-handle', + * .pointerEvents({ + * allowFrom: '.handle',, + * }) + * + * @param {string | Element | null} [newValue] a CSS selector string, an + * Element or `null` to allow from any element + * @return {string | Element | object} The current allowFrom value or this + * Interactable + */ + + Interactable.prototype.allowFrom = (0, _$index_58.warnOnce)(function (newValue) { + return this._backCompatOption('allowFrom', newValue); + }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).'); + /** + * ```js + * interact('.resize-drag') + * .resizable(true) + * .draggable(true) + * .actionChecker(function (pointer, event, action, interactable, element, interaction) { + * + * if (interact.matchesSelector(event.target, '.drag-handle')) { + * // force drag with handle target + * action.name = drag + * } + * else { + * // resize from the top and right edges + * action.name = 'resize' + * action.edges = { top: true, right: true } + * } + * + * return action + * }) + * ``` + * + * Returns or sets the function used to check action to be performed on + * pointerDown + * + * @param {function | null} [checker] A function which takes a pointer event, + * defaultAction string, interactable, element and interaction as parameters + * and returns an object with name property 'drag' 'resize' or 'gesture' and + * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right + * props. + * @return {Function | Interactable} The checker function or this Interactable + */ + + Interactable.prototype.actionChecker = actionChecker; + /** + * Returns or sets whether the the cursor should be changed depending on the + * action that would be performed if the mouse were pressed and dragged. + * + * @param {boolean} [newValue] + * @return {boolean | Interactable} The current setting or this Interactable + */ + + Interactable.prototype.styleCursor = styleCursor; +} + +function defaultActionChecker(interactable, event, interaction, element, scope) { + var rect = interactable.getRect(element); + var buttons = event.buttons || { + 0: 1, + 1: 4, + 3: 8, + 4: 16 + }[event.button]; + var arg = { + action: null, + interactable: interactable, + interaction: interaction, + element: element, + rect: rect, + buttons: buttons + }; + scope.fire('auto-start:check', arg); + return arg.action; +} + +function styleCursor(newValue) { + if (__is_8.bool(newValue)) { + this.options.styleCursor = newValue; + return this; + } + + if (newValue === null) { + delete this.options.styleCursor; + return this; + } + + return this.options.styleCursor; +} + +function actionChecker(checker) { + if (__is_8.func(checker)) { + this.options.actionChecker = checker; + return this; + } + + if (checker === null) { + delete this.options.actionChecker; + return this; + } + + return this.options.actionChecker; +} + +var ___default_8 = { + id: 'auto-start/interactableMethods', + install: __install_8 +}; +_$InteractableMethods_8["default"] = ___default_8; + +var _$base_9 = {}; +"use strict"; + +function ___typeof_9(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_9 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_9 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_9(obj); } + +Object.defineProperty(_$base_9, "__esModule", { + value: true +}); +_$base_9["default"] = void 0; + +var __utils_9 = ___interopRequireWildcard_9(_$index_58); + +var _InteractableMethods = ___interopRequireDefault_9(_$InteractableMethods_8); + +function ___interopRequireDefault_9(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_9() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_9 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_9(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_9(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_9(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_9(scope) { + var interact = scope.interact, + defaults = scope.defaults; + scope.usePlugin(_InteractableMethods["default"]); + defaults.base.actionChecker = null; + defaults.base.styleCursor = true; + __utils_9.extend(defaults.perAction, { + manualStart: false, + max: Infinity, + maxPerElement: 1, + allowFrom: null, + ignoreFrom: null, + // only allow left button by default + // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value + mouseButtons: 1 + }); + /** + * Returns or sets the maximum number of concurrent interactions allowed. By + * default only 1 interaction is allowed at a time (for backwards + * compatibility). To allow multiple interactions on the same Interactables and + * elements, you need to enable it in the draggable, resizable and gesturable + * `'max'` and `'maxPerElement'` options. + * + * @alias module:interact.maxInteractions + * + * @param {number} [newValue] Any number. newValue <= 0 means no interactions. + */ + + interact.maxInteractions = function (newValue) { + return maxInteractions(newValue, scope); + }; + + scope.autoStart = { + // Allow this many interactions to happen simultaneously + maxInteractions: Infinity, + withinInteractionLimit: withinInteractionLimit, + cursorElement: null + }; +} + +function prepareOnDown(_ref, scope) { + var interaction = _ref.interaction, + pointer = _ref.pointer, + event = _ref.event, + eventTarget = _ref.eventTarget; + + if (interaction.interacting()) { + return; + } + + var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); + prepare(interaction, actionInfo, scope); +} + +function prepareOnMove(_ref2, scope) { + var interaction = _ref2.interaction, + pointer = _ref2.pointer, + event = _ref2.event, + eventTarget = _ref2.eventTarget; + + if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) { + return; + } + + var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope); + prepare(interaction, actionInfo, scope); +} + +function startOnMove(arg, scope) { + var interaction = arg.interaction; + + if (!interaction.pointerIsDown || interaction.interacting() || !interaction.pointerWasMoved || !interaction.prepared.name) { + return; + } + + scope.fire('autoStart:before-start', arg); + var interactable = interaction.interactable; + var actionName = interaction.prepared.name; + + if (actionName && interactable) { + // check manualStart and interaction limit + if (interactable.options[actionName].manualStart || !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) { + interaction.stop(); + } else { + interaction.start(interaction.prepared, interactable, interaction.element); + setInteractionCursor(interaction, scope); + } + } +} + +function clearCursorOnStop(_ref3, scope) { + var interaction = _ref3.interaction; + var interactable = interaction.interactable; + + if (interactable && interactable.options.styleCursor) { + setCursor(interaction.element, '', scope); + } +} // Check if the current interactable supports the action. +// If so, return the validated action. Otherwise, return null + + +function validateAction(action, interactable, element, eventTarget, scope) { + if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) && interactable.options[action.name].enabled && withinInteractionLimit(interactable, element, action, scope)) { + return action; + } + + return null; +} + +function validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope) { + for (var i = 0, len = matches.length; i < len; i++) { + var match = matches[i]; + var matchElement = matchElements[i]; + var matchAction = match.getAction(pointer, event, interaction, matchElement); + + if (!matchAction) { + continue; + } + + var action = validateAction(matchAction, match, matchElement, eventTarget, scope); + + if (action) { + return { + action: action, + interactable: match, + element: matchElement + }; + } + } + + return { + action: null, + interactable: null, + element: null + }; +} + +function getActionInfo(interaction, pointer, event, eventTarget, scope) { + var matches = []; + var matchElements = []; + var element = eventTarget; + + function pushMatches(interactable) { + matches.push(interactable); + matchElements.push(element); + } + + while (__utils_9.is.element(element)) { + matches = []; + matchElements = []; + scope.interactables.forEachMatch(element, pushMatches); + var actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope); + + if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) { + return actionInfo; + } + + element = __utils_9.dom.parentNode(element); + } + + return { + action: null, + interactable: null, + element: null + }; +} + +function prepare(interaction, _ref4, scope) { + var action = _ref4.action, + interactable = _ref4.interactable, + element = _ref4.element; + action = action || { + name: null + }; + interaction.interactable = interactable; + interaction.element = element; + __utils_9.copyAction(interaction.prepared, action); + interaction.rect = interactable && action.name ? interactable.getRect(element) : null; + setInteractionCursor(interaction, scope); + scope.fire('autoStart:prepared', { + interaction: interaction + }); +} + +function withinInteractionLimit(interactable, element, action, scope) { + var options = interactable.options; + var maxActions = options[action.name].max; + var maxPerElement = options[action.name].maxPerElement; + var autoStartMax = scope.autoStart.maxInteractions; + var activeInteractions = 0; + var interactableCount = 0; + var elementCount = 0; // no actions if any of these values == 0 + + if (!(maxActions && maxPerElement && autoStartMax)) { + return false; + } + + for (var _i = 0; _i < scope.interactions.list.length; _i++) { + var _ref5; + + _ref5 = scope.interactions.list[_i]; + var interaction = _ref5; + var otherAction = interaction.prepared.name; + + if (!interaction.interacting()) { + continue; + } + + activeInteractions++; + + if (activeInteractions >= autoStartMax) { + return false; + } + + if (interaction.interactable !== interactable) { + continue; + } + + interactableCount += otherAction === action.name ? 1 : 0; + + if (interactableCount >= maxActions) { + return false; + } + + if (interaction.element === element) { + elementCount++; + + if (otherAction === action.name && elementCount >= maxPerElement) { + return false; + } + } + } + + return autoStartMax > 0; +} + +function maxInteractions(newValue, scope) { + if (__utils_9.is.number(newValue)) { + scope.autoStart.maxInteractions = newValue; + return this; + } + + return scope.autoStart.maxInteractions; +} + +function setCursor(element, cursor, scope) { + var prevCursorElement = scope.autoStart.cursorElement; + + if (prevCursorElement && prevCursorElement !== element) { + prevCursorElement.style.cursor = ''; + } + + element.ownerDocument.documentElement.style.cursor = cursor; + element.style.cursor = cursor; + scope.autoStart.cursorElement = cursor ? element : null; +} + +function setInteractionCursor(interaction, scope) { + var interactable = interaction.interactable, + element = interaction.element, + prepared = interaction.prepared; + + if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) { + // clear previous target element cursor + if (scope.autoStart.cursorElement) { + setCursor(scope.autoStart.cursorElement, '', scope); + } + + return; + } + + var cursor = ''; + + if (prepared.name) { + var cursorChecker = interactable.options[prepared.name].cursorChecker; + + if (__utils_9.is.func(cursorChecker)) { + cursor = cursorChecker(prepared, interactable, element, interaction._interacting); + } else { + cursor = scope.actions.map[prepared.name].getCursor(prepared); + } + } + + setCursor(interaction.element, cursor || '', scope); +} + +var autoStart = { + id: 'auto-start/base', + before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'], + install: __install_9, + listeners: { + 'interactions:down': prepareOnDown, + 'interactions:move': function interactionsMove(arg, scope) { + prepareOnMove(arg, scope); + startOnMove(arg, scope); + }, + 'interactions:stop': clearCursorOnStop + }, + maxInteractions: maxInteractions, + withinInteractionLimit: withinInteractionLimit, + validateAction: validateAction +}; +var ___default_9 = autoStart; +_$base_9["default"] = ___default_9; + +var _$dragAxis_10 = {}; +"use strict"; + +function ___typeof_10(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_10 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_10 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_10(obj); } + +Object.defineProperty(_$dragAxis_10, "__esModule", { + value: true +}); +_$dragAxis_10["default"] = void 0; + +/* removed: var _$domUtils_53 = require("@interactjs/utils/domUtils"); */; + +var __is_10 = ___interopRequireWildcard_10(_$is_59); + +var _base = ___interopRequireDefault_10(_$base_9); + +function ___interopRequireDefault_10(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_10() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_10 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_10(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_10(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_10(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function beforeStart(_ref, scope) { + var interaction = _ref.interaction, + eventTarget = _ref.eventTarget, + dx = _ref.dx, + dy = _ref.dy; + + if (interaction.prepared.name !== 'drag') { + return; + } // check if a drag is in the correct axis + + + var absX = Math.abs(dx); + var absY = Math.abs(dy); + var targetOptions = interaction.interactable.options.drag; + var startAxis = targetOptions.startAxis; + var currentAxis = absX > absY ? 'x' : absX < absY ? 'y' : 'xy'; + interaction.prepared.axis = targetOptions.lockAxis === 'start' ? currentAxis[0] // always lock to one axis even if currentAxis === 'xy' + : targetOptions.lockAxis; // if the movement isn't in the startAxis of the interactable + + if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) { + // cancel the prepared action + interaction.prepared.name = null; // then try to get a drag from another ineractable + + var element = eventTarget; + + var getDraggable = function getDraggable(interactable) { + if (interactable === interaction.interactable) { + return; + } + + var options = interaction.interactable.options.drag; + + if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) { + var action = interactable.getAction(interaction.downPointer, interaction.downEvent, interaction, element); + + if (action && action.name === 'drag' && checkStartAxis(currentAxis, interactable) && _base["default"].validateAction(action, interactable, element, eventTarget, scope)) { + return interactable; + } + } + }; // check all interactables + + + while (__is_10.element(element)) { + var interactable = scope.interactables.forEachMatch(element, getDraggable); + + if (interactable) { + interaction.prepared.name = 'drag'; + interaction.interactable = interactable; + interaction.element = element; + break; + } + + element = (0, _$domUtils_53.parentNode)(element); + } + } +} + +function checkStartAxis(startAxis, interactable) { + if (!interactable) { + return false; + } + + var thisAxis = interactable.options.drag.startAxis; + return startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis; +} + +var ___default_10 = { + id: 'auto-start/dragAxis', + listeners: { + 'autoStart:before-start': beforeStart + } +}; +_$dragAxis_10["default"] = ___default_10; + +var _$hold_11 = {}; +"use strict"; + +Object.defineProperty(_$hold_11, "__esModule", { + value: true +}); +_$hold_11["default"] = void 0; + +var ___base_11 = ___interopRequireDefault_11(_$base_9); + +function ___interopRequireDefault_11(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_11(scope) { + var defaults = scope.defaults; + scope.usePlugin(___base_11["default"]); + defaults.perAction.hold = 0; + defaults.perAction.delay = 0; +} + +function getHoldDuration(interaction) { + var actionName = interaction.prepared && interaction.prepared.name; + + if (!actionName) { + return null; + } + + var options = interaction.interactable.options; + return options[actionName].hold || options[actionName].delay; +} + +var ___default_11 = { + id: 'auto-start/hold', + install: __install_11, + listeners: { + 'interactions:new': function interactionsNew(_ref) { + var interaction = _ref.interaction; + interaction.autoStartHoldTimer = null; + }, + 'autoStart:prepared': function autoStartPrepared(_ref2) { + var interaction = _ref2.interaction; + var hold = getHoldDuration(interaction); + + if (hold > 0) { + interaction.autoStartHoldTimer = setTimeout(function () { + interaction.start(interaction.prepared, interaction.interactable, interaction.element); + }, hold); + } + }, + 'interactions:move': function interactionsMove(_ref3) { + var interaction = _ref3.interaction, + duplicate = _ref3.duplicate; + + if (interaction.pointerWasMoved && !duplicate) { + clearTimeout(interaction.autoStartHoldTimer); + } + }, + // prevent regular down->move autoStart + 'autoStart:before-start': function autoStartBeforeStart(_ref4) { + var interaction = _ref4.interaction; + var hold = getHoldDuration(interaction); + + if (hold > 0) { + interaction.prepared.name = null; + } + } + }, + getHoldDuration: getHoldDuration +}; +_$hold_11["default"] = ___default_11; + +var _$index_12 = {}; +"use strict"; + +Object.defineProperty(_$index_12, "__esModule", { + value: true +}); +_$index_12.install = __install_12; +Object.defineProperty(_$index_12, "autoStart", { + enumerable: true, + get: function get() { + return ___base_12["default"]; + } +}); +Object.defineProperty(_$index_12, "dragAxis", { + enumerable: true, + get: function get() { + return _dragAxis["default"]; + } +}); +Object.defineProperty(_$index_12, "hold", { + enumerable: true, + get: function get() { + return _hold["default"]; + } +}); +_$index_12.id = void 0; + +var ___base_12 = ___interopRequireDefault_12(_$base_9); + +var _dragAxis = ___interopRequireDefault_12(_$dragAxis_10); + +var _hold = ___interopRequireDefault_12(_$hold_11); + +function ___interopRequireDefault_12(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_12(scope) { + scope.usePlugin(___base_12["default"]); + scope.usePlugin(_hold["default"]); + scope.usePlugin(_dragAxis["default"]); +} + +var __id_12 = 'auto-start'; +_$index_12.id = __id_12; + +var _$interactablePreventDefault_21 = {}; +"use strict"; + +function ___typeof_21(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_21 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_21 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_21(obj); } + +Object.defineProperty(_$interactablePreventDefault_21, "__esModule", { + value: true +}); +_$interactablePreventDefault_21.install = __install_21; +_$interactablePreventDefault_21["default"] = void 0; + +/* removed: var _$domUtils_53 = require("@interactjs/utils/domUtils"); */; + +var ___events_21 = ___interopRequireDefault_21(_$events_54); + +var __is_21 = ___interopRequireWildcard_21(_$is_59); + +/* removed: var _$window_68 = require("@interactjs/utils/window"); */; + +function ___getRequireWildcardCache_21() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_21 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_21(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_21(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_21(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_21(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function preventDefault(newValue) { + if (/^(always|never|auto)$/.test(newValue)) { + this.options.preventDefault = newValue; + return this; + } + + if (__is_21.bool(newValue)) { + this.options.preventDefault = newValue ? 'always' : 'never'; + return this; + } + + return this.options.preventDefault; +} + +function checkAndPreventDefault(interactable, scope, event) { + var setting = interactable.options.preventDefault; + + if (setting === 'never') { + return; + } + + if (setting === 'always') { + event.preventDefault(); + return; + } // setting === 'auto' + // if the browser supports passive event listeners and isn't running on iOS, + // don't preventDefault of touch{start,move} events. CSS touch-action and + // user-select should be used instead of calling event.preventDefault(). + + + if (___events_21["default"].supportsPassive && /^touch(start|move)$/.test(event.type)) { + var doc = (0, _$window_68.getWindow)(event.target).document; + var docOptions = scope.getDocOptions(doc); + + if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) { + return; + } + } // don't preventDefault of pointerdown events + + + if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) { + return; + } // don't preventDefault on editable elements + + + if (__is_21.element(event.target) && (0, _$domUtils_53.matchesSelector)(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) { + return; + } + + event.preventDefault(); +} + +function onInteractionEvent(_ref) { + var interaction = _ref.interaction, + event = _ref.event; + + if (interaction.interactable) { + interaction.interactable.checkAndPreventDefault(event); + } +} + +function __install_21(scope) { + /** @lends Interactable */ + var Interactable = scope.Interactable; + /** + * Returns or sets whether to prevent the browser's default behaviour in + * response to pointer events. Can be set to: + * - `'always'` to always prevent + * - `'never'` to never prevent + * - `'auto'` to let interact.js try to determine what would be best + * + * @param {string} [newValue] `'always'`, `'never'` or `'auto'` + * @return {string | Interactable} The current setting or this Interactable + */ + + Interactable.prototype.preventDefault = preventDefault; + + Interactable.prototype.checkAndPreventDefault = function (event) { + return checkAndPreventDefault(this, scope, event); + }; // prevent native HTML5 drag on interact.js target elements + + + scope.interactions.docEvents.push({ + type: 'dragstart', + listener: function listener(event) { + for (var _i = 0; _i < scope.interactions.list.length; _i++) { + var _ref2; + + _ref2 = scope.interactions.list[_i]; + var interaction = _ref2; + + if (interaction.element && (interaction.element === event.target || (0, _$domUtils_53.nodeContains)(interaction.element, event.target))) { + interaction.interactable.checkAndPreventDefault(event); + return; + } + } + } + }); +} + +var ___default_21 = { + id: 'core/interactablePreventDefault', + install: __install_21, + listeners: ['down', 'move', 'up', 'cancel'].reduce(function (acc, eventType) { + acc["interactions:".concat(eventType)] = onInteractionEvent; + return acc; + }, {}) +}; +_$interactablePreventDefault_21["default"] = ___default_21; + +var _$index_25 = {}; +"use strict"; + +function ___typeof_25(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_25 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_25 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_25(obj); } + +Object.defineProperty(_$index_25, "__esModule", { + value: true +}); +_$index_25["default"] = void 0; + +var ___domObjects_25 = ___interopRequireDefault_25(_$domObjects_52); + +/* removed: var _$domUtils_53 = require("@interactjs/utils/domUtils"); */; + +var ___extend_25 = ___interopRequireDefault_25(_$extend_55); + +var __is_25 = ___interopRequireWildcard_25(_$is_59); + +var ___window_25 = ___interopRequireDefault_25(_$window_68); + +function ___getRequireWildcardCache_25() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_25 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_25(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_25(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_25(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_25(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___toConsumableArray_25(arr) { return ___arrayWithoutHoles_25(arr) || ___iterableToArray_25(arr) || ___nonIterableSpread_25(); } + +function ___nonIterableSpread_25() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } + +function ___iterableToArray_25(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } + +function ___arrayWithoutHoles_25(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } + +var CheckName; + +(function (CheckName) { + CheckName["touchAction"] = "touchAction"; + CheckName["boxSizing"] = "boxSizing"; + CheckName["noListeners"] = "noListeners"; +})(CheckName || (CheckName = {})); + +var prefix = '[interact.js] '; +var links = { + touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action', + boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing' +}; +var isProduction = "production" === 'production'; // eslint-disable-next-line no-restricted-syntax + +function __install_25(scope) { + var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, + logger = _ref.logger; + + var Interactable = scope.Interactable, + defaults = scope.defaults; + scope.logger = logger || console; + defaults.base.devTools = { + ignore: {} + }; + + Interactable.prototype.devTools = function (options) { + if (options) { + (0, ___extend_25["default"])(this.options.devTools, options); + return this; + } + + return this.options.devTools; + }; +} + +var checks = [{ + name: CheckName.touchAction, + perform: function perform(_ref2) { + var element = _ref2.element; + return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/); + }, + getInfo: function getInfo(_ref3) { + var element = _ref3.element; + return [element, links.touchAction]; + }, + text: 'Consider adding CSS "touch-action: none" to this element\n' +}, { + name: CheckName.boxSizing, + perform: function perform(interaction) { + var element = interaction.element; + return interaction.prepared.name === 'resize' && element instanceof ___domObjects_25["default"].HTMLElement && !hasStyle(element, 'boxSizing', /border-box/); + }, + text: 'Consider adding CSS "box-sizing: border-box" to this resizable element', + getInfo: function getInfo(_ref4) { + var element = _ref4.element; + return [element, links.boxSizing]; + } +}, { + name: CheckName.noListeners, + perform: function perform(interaction) { + var actionName = interaction.prepared.name; + var moveListeners = interaction.interactable.events.types["".concat(actionName, "move")] || []; + return !moveListeners.length; + }, + getInfo: function getInfo(interaction) { + return [interaction.prepared.name, interaction.interactable]; + }, + text: 'There are no listeners set for this action' +}]; + +function hasStyle(element, prop, styleRe) { + return styleRe.test(element.style[prop] || ___window_25["default"].window.getComputedStyle(element)[prop]); +} + +function parentHasStyle(element, prop, styleRe) { + var parent = element; + + while (__is_25.element(parent)) { + if (hasStyle(parent, prop, styleRe)) { + return true; + } + + parent = (0, _$domUtils_53.parentNode)(parent); + } + + return false; +} + +var __id_25 = 'dev-tools'; +var defaultExport = isProduction ? { + id: __id_25, + install: function install() {} +} : { + id: __id_25, + install: __install_25, + listeners: { + 'interactions:action-start': function interactionsActionStart(_ref5, scope) { + var interaction = _ref5.interaction; + + for (var _i = 0; _i < checks.length; _i++) { + var _ref6; + + _ref6 = checks[_i]; + var check = _ref6; + var options = interaction.interactable && interaction.interactable.options; + + if (!(options && options.devTools && options.devTools.ignore[check.name]) && check.perform(interaction)) { + var _scope$logger; + + (_scope$logger = scope.logger).warn.apply(_scope$logger, [prefix + check.text].concat(___toConsumableArray_25(check.getInfo(interaction)))); + } + } + } + }, + checks: checks, + CheckName: CheckName, + links: links, + prefix: prefix +}; +var ___default_25 = defaultExport; +_$index_25["default"] = ___default_25; + +var _$Modification_30 = {}; +"use strict"; + +function ___typeof_30(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_30 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_30 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_30(obj); } + +Object.defineProperty(_$Modification_30, "__esModule", { + value: true +}); +_$Modification_30.getRectOffset = getRectOffset; +_$Modification_30["default"] = void 0; + +var ___clone_30 = ___interopRequireDefault_30(_$clone_51); + +var ___extend_30 = ___interopRequireDefault_30(_$extend_55); + +var rectUtils = ___interopRequireWildcard_30(_$rect_65); + +function ___getRequireWildcardCache_30() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_30 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_30(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_30(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_30(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_30(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___slicedToArray_30(arr, i) { return ___arrayWithHoles_30(arr) || ___iterableToArrayLimit_30(arr, i) || ___nonIterableRest_30(); } + +function ___nonIterableRest_30() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function ___iterableToArrayLimit_30(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function ___arrayWithHoles_30(arr) { if (Array.isArray(arr)) return arr; } + +function ___classCallCheck_30(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_30(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_30(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_30(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_30(Constructor, staticProps); return Constructor; } + +function ___defineProperty_30(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var Modification = +/*#__PURE__*/ +function () { + function Modification(interaction) { + ___classCallCheck_30(this, Modification); + + this.interaction = interaction; + + ___defineProperty_30(this, "states", []); + + ___defineProperty_30(this, "startOffset", { + left: 0, + right: 0, + top: 0, + bottom: 0 + }); + + ___defineProperty_30(this, "startDelta", null); + + ___defineProperty_30(this, "result", null); + + ___defineProperty_30(this, "endResult", null); + + ___defineProperty_30(this, "edges", void 0); + } + + ___createClass_30(Modification, [{ + key: "start", + value: function start(_ref, pageCoords) { + var phase = _ref.phase; + var interaction = this.interaction; + var modifierList = getModifierList(interaction); + this.prepareStates(modifierList); + this.edges = (0, ___extend_30["default"])({}, interaction.edges); + this.startOffset = getRectOffset(interaction.rect, pageCoords); + this.startDelta = { + x: 0, + y: 0 + }; + var arg = { + phase: phase, + pageCoords: pageCoords, + preEnd: false + }; + this.result = createResult(); + this.startAll(arg); + var result = this.result = this.setAll(arg); + return result; + } + }, { + key: "fillArg", + value: function fillArg(arg) { + var interaction = this.interaction; + arg.interaction = interaction; + arg.interactable = interaction.interactable; + arg.element = interaction.element; + arg.rect = arg.rect || interaction.rect; + arg.edges = this.edges; + arg.startOffset = this.startOffset; + } + }, { + key: "startAll", + value: function startAll(arg) { + this.fillArg(arg); + + for (var _i = 0; _i < this.states.length; _i++) { + var _ref2; + + _ref2 = this.states[_i]; + var state = _ref2; + + if (state.methods.start) { + arg.state = state; + state.methods.start(arg); + } + } + } + }, { + key: "setAll", + value: function setAll(arg) { + this.fillArg(arg); + var phase = arg.phase, + preEnd = arg.preEnd, + skipModifiers = arg.skipModifiers, + unmodifiedRect = arg.rect; + arg.coords = (0, ___extend_30["default"])({}, arg.pageCoords); + arg.rect = (0, ___extend_30["default"])({}, unmodifiedRect); + var states = skipModifiers ? this.states.slice(skipModifiers) : this.states; + var newResult = createResult(arg.coords, arg.rect); + + for (var _i2 = 0; _i2 < states.length; _i2++) { + var _ref3; + + _ref3 = states[_i2]; + var state = _ref3; + var options = state.options; + var lastModifierCoords = (0, ___extend_30["default"])({}, arg.coords); + var returnValue = null; + + if (state.methods.set && this.shouldDo(options, preEnd, phase)) { + arg.state = state; + returnValue = state.methods.set(arg); + rectUtils.addEdges(this.interaction.edges, arg.rect, { + x: arg.coords.x - lastModifierCoords.x, + y: arg.coords.y - lastModifierCoords.y + }); + } + + newResult.eventProps.push(returnValue); + } + + newResult.delta.x = arg.coords.x - arg.pageCoords.x; + newResult.delta.y = arg.coords.y - arg.pageCoords.y; + newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left; + newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right; + newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top; + newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom; + var prevCoords = this.result.coords; + var prevRect = this.result.rect; + var rectChanged = !prevRect || newResult.rect.left !== prevRect.left || newResult.rect.right !== prevRect.right || newResult.rect.top !== prevRect.top || newResult.rect.bottom !== prevRect.bottom; + newResult.changed = rectChanged || prevCoords.x !== newResult.coords.x || prevCoords.y !== newResult.coords.y; + newResult.rect = arg.rect; + return newResult; + } + }, { + key: "applyToInteraction", + value: function applyToInteraction(arg) { + var interaction = this.interaction; + var phase = arg.phase; + var curCoords = interaction.coords.cur; + var startCoords = interaction.coords.start; + var result = this.result, + startDelta = this.startDelta; + var curDelta = result.delta; + + if (phase === 'start') { + (0, ___extend_30["default"])(this.startDelta, result.delta); + } + + for (var _i3 = 0; _i3 < [[startCoords, startDelta], [curCoords, curDelta]].length; _i3++) { + var _ref4; + + _ref4 = [[startCoords, startDelta], [curCoords, curDelta]][_i3]; + + var _ref5 = _ref4, + _ref6 = ___slicedToArray_30(_ref5, 2), + coordsSet = _ref6[0], + delta = _ref6[1]; + + coordsSet.page.x += delta.x; + coordsSet.page.y += delta.y; + coordsSet.client.x += delta.x; + coordsSet.client.y += delta.y; + } + + var rectDelta = this.result.rectDelta; + var rect = arg.rect || interaction.rect; + rect.left += rectDelta.left; + rect.right += rectDelta.right; + rect.top += rectDelta.top; + rect.bottom += rectDelta.bottom; + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + } + }, { + key: "setAndApply", + value: function setAndApply(arg) { + var interaction = this.interaction; + var phase = arg.phase, + preEnd = arg.preEnd, + skipModifiers = arg.skipModifiers; + var result = this.setAll({ + preEnd: preEnd, + phase: phase, + pageCoords: arg.modifiedCoords || interaction.coords.cur.page + }); + this.result = result; // don't fire an action move if a modifier would keep the event in the same + // cordinates as before + + if (!result.changed && (!skipModifiers || skipModifiers < this.states.length) && interaction.interacting()) { + return false; + } + + if (arg.modifiedCoords) { + var page = interaction.coords.cur.page; + var adjustment = { + x: arg.modifiedCoords.x - page.x, + y: arg.modifiedCoords.y - page.y + }; + result.coords.x += adjustment.x; + result.coords.y += adjustment.y; + result.delta.x += adjustment.x; + result.delta.y += adjustment.y; + } + + this.applyToInteraction(arg); + } + }, { + key: "beforeEnd", + value: function beforeEnd(arg) { + var interaction = arg.interaction, + event = arg.event; + var states = this.states; + + if (!states || !states.length) { + return; + } + + var doPreend = false; + + for (var _i4 = 0; _i4 < states.length; _i4++) { + var _ref7; + + _ref7 = states[_i4]; + var state = _ref7; + arg.state = state; + var options = state.options, + methods = state.methods; + var endPosition = methods.beforeEnd && methods.beforeEnd(arg); + + if (endPosition) { + this.endResult = endPosition; + return false; + } + + doPreend = doPreend || !doPreend && this.shouldDo(options, true); + } + + if (!doPreend) { + // trigger a final modified move before ending + interaction.move({ + event: event, + preEnd: true + }); + } + } + }, { + key: "stop", + value: function stop(arg) { + var interaction = arg.interaction; + + if (!this.states || !this.states.length) { + return; + } + + var modifierArg = (0, ___extend_30["default"])({ + states: this.states, + interactable: interaction.interactable, + element: interaction.element, + rect: null + }, arg); + this.fillArg(modifierArg); + + for (var _i5 = 0; _i5 < this.states.length; _i5++) { + var _ref8; + + _ref8 = this.states[_i5]; + var state = _ref8; + modifierArg.state = state; + + if (state.methods.stop) { + state.methods.stop(modifierArg); + } + } + + this.states = null; + this.endResult = null; + } + }, { + key: "prepareStates", + value: function prepareStates(modifierList) { + this.states = []; + + for (var index = 0; index < modifierList.length; index++) { + var _modifierList$index = modifierList[index], + options = _modifierList$index.options, + methods = _modifierList$index.methods, + name = _modifierList$index.name; + + if (options && options.enabled === false) { + continue; + } + + this.states.push({ + options: options, + methods: methods, + index: index, + name: name + }); + } + + return this.states; + } + }, { + key: "restoreInteractionCoords", + value: function restoreInteractionCoords(_ref9) { + var _ref9$interaction = _ref9.interaction, + coords = _ref9$interaction.coords, + rect = _ref9$interaction.rect, + modification = _ref9$interaction.modification; + + if (!modification.result) { + return; + } + + var startDelta = modification.startDelta; + var _modification$result = modification.result, + curDelta = _modification$result.delta, + rectDelta = _modification$result.rectDelta; + var coordsAndDeltas = [[coords.start, startDelta], [coords.cur, curDelta]]; + + for (var _i6 = 0; _i6 < coordsAndDeltas.length; _i6++) { + var _ref10; + + _ref10 = coordsAndDeltas[_i6]; + + var _ref11 = _ref10, + _ref12 = ___slicedToArray_30(_ref11, 2), + coordsSet = _ref12[0], + delta = _ref12[1]; + + coordsSet.page.x -= delta.x; + coordsSet.page.y -= delta.y; + coordsSet.client.x -= delta.x; + coordsSet.client.y -= delta.y; + } + + rect.left -= rectDelta.left; + rect.right -= rectDelta.right; + rect.top -= rectDelta.top; + rect.bottom -= rectDelta.bottom; + } + }, { + key: "shouldDo", + value: function shouldDo(options, preEnd, phase) { + return options ? options.enabled !== false && (preEnd || !options.endOnly) && (options.setStart || phase !== 'start') : true; + } + }, { + key: "copyFrom", + value: function copyFrom(other) { + this.startOffset = other.startOffset; + this.startDelta = other.startDelta; + this.edges = other.edges; + this.states = other.states.map(function (s) { + return (0, ___clone_30["default"])(s); + }); + this.result = createResult((0, ___extend_30["default"])({}, other.result.coords), (0, ___extend_30["default"])({}, other.result.rect)); + } + }, { + key: "destroy", + value: function destroy() { + for (var prop in this) { + this[prop] = null; + } + } + }]); + + return Modification; +}(); + +_$Modification_30["default"] = Modification; + +function createResult(coords, rect) { + return { + rect: rect, + coords: coords, + delta: { + x: 0, + y: 0 + }, + rectDelta: { + left: 0, + right: 0, + top: 0, + bottom: 0 + }, + eventProps: [], + changed: true + }; +} + +function getModifierList(interaction) { + var actionOptions = interaction.interactable.options[interaction.prepared.name]; + var actionModifiers = actionOptions.modifiers; + + if (actionModifiers && actionModifiers.length) { + return actionModifiers.filter(function (modifier) { + return !modifier.options || modifier.options.enabled !== false; + }); + } + + return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize'].map(function (type) { + var options = actionOptions[type]; + return options && options.enabled && { + options: options, + methods: options._methods + }; + }).filter(function (m) { + return !!m; + }); +} + +function getRectOffset(rect, coords) { + return rect ? { + left: coords.x - rect.left, + top: coords.y - rect.top, + right: rect.right - coords.x, + bottom: rect.bottom - coords.y + } : { + left: 0, + top: 0, + right: 0, + bottom: 0 + }; +} + +var _$base_32 = {}; +"use strict"; + +Object.defineProperty(_$base_32, "__esModule", { + value: true +}); +_$base_32.makeModifier = makeModifier; +_$base_32.addEventModifiers = addEventModifiers; +_$base_32["default"] = void 0; + +var _Modification = ___interopRequireDefault_32(_$Modification_30); + +function ___interopRequireDefault_32(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function makeModifier(module, name) { + var defaults = module.defaults; + var methods = { + start: module.start, + set: module.set, + beforeEnd: module.beforeEnd, + stop: module.stop + }; + + var modifier = function modifier(_options) { + var options = _options || {}; + options.enabled = options.enabled !== false; // add missing defaults to options + + for (var _prop in defaults) { + if (!(_prop in options)) { + options[_prop] = defaults[_prop]; + } + } + + var m = { + options: options, + methods: methods, + name: name + }; + return m; + }; + + if (name && typeof name === 'string') { + // for backwrads compatibility + modifier._defaults = defaults; + modifier._methods = methods; + } + + return modifier; +} + +function addEventModifiers(_ref) { + var iEvent = _ref.iEvent, + result = _ref.interaction.modification.result; + + if (result) { + iEvent.modifiers = result.eventProps; + } +} + +var modifiersBase = { + id: 'modifiers/base', + install: function install(scope) { + scope.defaults.perAction.modifiers = []; + }, + listeners: { + 'interactions:new': function interactionsNew(_ref2) { + var interaction = _ref2.interaction; + interaction.modification = new _Modification["default"](interaction); + }, + 'interactions:before-action-start': function interactionsBeforeActionStart(arg) { + var modification = arg.interaction.modification; + modification.start(arg, arg.interaction.coords.start.page); + arg.interaction.edges = modification.edges; + modification.applyToInteraction(arg); + }, + 'interactions:before-action-move': function interactionsBeforeActionMove(arg) { + return arg.interaction.modification.setAndApply(arg); + }, + 'interactions:before-action-end': function interactionsBeforeActionEnd(arg) { + return arg.interaction.modification.beforeEnd(arg); + }, + 'interactions:action-start': addEventModifiers, + 'interactions:action-move': addEventModifiers, + 'interactions:action-end': addEventModifiers, + 'interactions:after-action-start': function interactionsAfterActionStart(arg) { + return arg.interaction.modification.restoreInteractionCoords(arg); + }, + 'interactions:after-action-move': function interactionsAfterActionMove(arg) { + return arg.interaction.modification.restoreInteractionCoords(arg); + }, + 'interactions:stop': function interactionsStop(arg) { + return arg.interaction.modification.stop(arg); + } + }, + before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'] +}; +var ___default_32 = modifiersBase; +_$base_32["default"] = ___default_32; + +var _$index_41 = {}; +"use strict"; + +function ___typeof_41(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_41 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_41 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_41(obj); } + +Object.defineProperty(_$index_41, "__esModule", { + value: true +}); +_$index_41.addTotal = addTotal; +_$index_41.applyPending = applyPending; +_$index_41["default"] = void 0; + +/* removed: var _$Interaction_18 = require("@interactjs/core/Interaction"); */; + +var __rectUtils_41 = ___interopRequireWildcard_41(_$rect_65); + +function ___getRequireWildcardCache_41() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_41 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_41(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_41(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_41(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +_$Interaction_18._ProxyMethods.offsetBy = ''; + +function addTotal(interaction) { + if (!interaction.pointerIsDown) { + return; + } + + addToCoords(interaction.coords.cur, interaction.offset.total); + interaction.offset.pending.x = 0; + interaction.offset.pending.y = 0; +} + +function beforeAction(_ref) { + var interaction = _ref.interaction; + applyPending(interaction); +} + +function beforeEnd(_ref2) { + var interaction = _ref2.interaction; + var hadPending = applyPending(interaction); + + if (!hadPending) { + return; + } + + interaction.move({ + offset: true + }); + interaction.end(); + return false; +} + +function __end_41(_ref3) { + var interaction = _ref3.interaction; + interaction.offset.total.x = 0; + interaction.offset.total.y = 0; + interaction.offset.pending.x = 0; + interaction.offset.pending.y = 0; +} + +function applyPending(interaction) { + if (!hasPending(interaction)) { + return false; + } + + var pending = interaction.offset.pending; + addToCoords(interaction.coords.cur, pending); + addToCoords(interaction.coords.delta, pending); + __rectUtils_41.addEdges(interaction.edges, interaction.rect, pending); + pending.x = 0; + pending.y = 0; + return true; +} + +function offsetBy(_ref4) { + var x = _ref4.x, + y = _ref4.y; + this.offset.pending.x += x; + this.offset.pending.y += y; + this.offset.total.x += x; + this.offset.total.y += y; +} + +function addToCoords(_ref5, _ref6) { + var page = _ref5.page, + client = _ref5.client; + var x = _ref6.x, + y = _ref6.y; + page.x += x; + page.y += y; + client.x += x; + client.y += y; +} + +function hasPending(interaction) { + return !!(interaction.offset.pending.x || interaction.offset.pending.y); +} + +var offset = { + id: 'offset', + install: function install(scope) { + scope.Interaction.prototype.offsetBy = offsetBy; + }, + listeners: { + 'interactions:new': function interactionsNew(_ref7) { + var interaction = _ref7.interaction; + interaction.offset = { + total: { + x: 0, + y: 0 + }, + pending: { + x: 0, + y: 0 + } + }; + }, + 'interactions:update-pointer': function interactionsUpdatePointer(_ref8) { + var interaction = _ref8.interaction; + return addTotal(interaction); + }, + 'interactions:before-action-start': beforeAction, + 'interactions:before-action-move': beforeAction, + 'interactions:before-action-end': beforeEnd, + 'interactions:stop': __end_41 + } +}; +var ___default_41 = offset; +_$index_41["default"] = ___default_41; + +var _$index_26 = {}; +"use strict"; + +function ___typeof_26(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_26 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_26 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_26(obj); } + +Object.defineProperty(_$index_26, "__esModule", { + value: true +}); +_$index_26["default"] = _$index_26.InertiaState = void 0; + +var modifiers = ___interopRequireWildcard_26(_$base_32); + +var ___Modification_26 = ___interopRequireDefault_26(_$Modification_30); + +var _offset = ___interopRequireDefault_26(_$index_41); + +var __dom_26 = ___interopRequireWildcard_26(_$domUtils_53); + +var ___hypot_26 = ___interopRequireDefault_26(_$hypot_57); + +var __is_26 = ___interopRequireWildcard_26(_$is_59); + +/* removed: var _$pointerUtils_63 = require("@interactjs/utils/pointerUtils"); */; + +var ___raf_26 = ___interopRequireDefault_26(_$raf_64); + +function ___interopRequireDefault_26(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_26() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_26 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_26(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_26(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_26(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___classCallCheck_26(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_26(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_26(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_26(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_26(Constructor, staticProps); return Constructor; } + +function ___defineProperty_26(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +function __install_26(scope) { + var defaults = scope.defaults; + scope.usePlugin(_offset["default"]); + scope.usePlugin(modifiers["default"]); + scope.actions.phases.inertiastart = true; + scope.actions.phases.resume = true; + defaults.perAction.inertia = { + enabled: false, + resistance: 10, + // the lambda in exponential decay + minSpeed: 100, + // target speed must be above this for inertia to start + endSpeed: 10, + // the speed at which inertia is slow enough to stop + allowResume: true, + // allow resuming an action in inertia phase + smoothEndDuration: 300 // animate to snap/restrict endOnly if there's no inertia + + }; +} + +var InertiaState = +/*#__PURE__*/ +function () { + // eslint-disable-line camelcase + // eslint-disable-line camelcase + function InertiaState(interaction) { + ___classCallCheck_26(this, InertiaState); + + this.interaction = interaction; + + ___defineProperty_26(this, "active", false); + + ___defineProperty_26(this, "isModified", false); + + ___defineProperty_26(this, "smoothEnd", false); + + ___defineProperty_26(this, "allowResume", false); + + ___defineProperty_26(this, "modification", null); + + ___defineProperty_26(this, "modifierCount", 0); + + ___defineProperty_26(this, "modifierArg", null); + + ___defineProperty_26(this, "startCoords", null); + + ___defineProperty_26(this, "t0", 0); + + ___defineProperty_26(this, "v0", 0); + + ___defineProperty_26(this, "te", 0); + + ___defineProperty_26(this, "targetOffset", null); + + ___defineProperty_26(this, "modifiedOffset", null); + + ___defineProperty_26(this, "currentOffset", null); + + ___defineProperty_26(this, "lambda_v0", 0); + + ___defineProperty_26(this, "one_ve_v0", 0); + + ___defineProperty_26(this, "timeout", null); + } + + ___createClass_26(InertiaState, [{ + key: "start", + value: function start(event) { + var interaction = this.interaction; + var options = __getOptions_26(interaction); + + if (!options || !options.enabled) { + return false; + } + + var velocityClient = interaction.coords.velocity.client; + var pointerSpeed = (0, ___hypot_26["default"])(velocityClient.x, velocityClient.y); + var modification = this.modification || (this.modification = new ___Modification_26["default"](interaction)); + modification.copyFrom(interaction.modification); + this.t0 = interaction._now(); + this.allowResume = options.allowResume; + this.v0 = pointerSpeed; + this.currentOffset = { + x: 0, + y: 0 + }; + this.startCoords = interaction.coords.cur.page; + this.modifierArg = { + interaction: interaction, + interactable: interaction.interactable, + element: interaction.element, + rect: interaction.rect, + edges: interaction.edges, + pageCoords: this.startCoords, + preEnd: true, + phase: 'inertiastart' + }; + var thrown = this.t0 - interaction.coords.cur.timeStamp < 50 && pointerSpeed > options.minSpeed && pointerSpeed > options.endSpeed; + + if (thrown) { + this.startInertia(); + } else { + modification.result = modification.setAll(this.modifierArg); + + if (!modification.result.changed) { + return false; + } + + this.startSmoothEnd(); + } // force modification change + + + interaction.modification.result.rect = null; // bring inertiastart event to the target coords + + interaction.offsetBy(this.targetOffset); + + interaction._doPhase({ + interaction: interaction, + event: event, + phase: 'inertiastart' + }); + + interaction.offsetBy({ + x: -this.targetOffset.x, + y: -this.targetOffset.y + }); // force modification change + + interaction.modification.result.rect = null; + this.active = true; + interaction.simulation = this; + return true; + } + }, { + key: "startInertia", + value: function startInertia() { + var _this = this; + + var startVelocity = this.interaction.coords.velocity.client; + var options = __getOptions_26(this.interaction); + var lambda = options.resistance; + var inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda; + this.targetOffset = { + x: (startVelocity.x - inertiaDur) / lambda, + y: (startVelocity.y - inertiaDur) / lambda + }; + this.te = inertiaDur; + this.lambda_v0 = lambda / this.v0; + this.one_ve_v0 = 1 - options.endSpeed / this.v0; + var modification = this.modification, + modifierArg = this.modifierArg; + modifierArg.pageCoords = { + x: this.startCoords.x + this.targetOffset.x, + y: this.startCoords.y + this.targetOffset.y + }; + modification.result = modification.setAll(modifierArg); + + if (modification.result.changed) { + this.isModified = true; + this.modifiedOffset = { + x: this.targetOffset.x + modification.result.delta.x, + y: this.targetOffset.y + modification.result.delta.y + }; + } + + this.timeout = ___raf_26["default"].request(function () { + return _this.inertiaTick(); + }); + } + }, { + key: "startSmoothEnd", + value: function startSmoothEnd() { + var _this2 = this; + + this.smoothEnd = true; + this.isModified = true; + this.targetOffset = { + x: this.modification.result.delta.x, + y: this.modification.result.delta.y + }; + this.timeout = ___raf_26["default"].request(function () { + return _this2.smoothEndTick(); + }); + } + }, { + key: "inertiaTick", + value: function inertiaTick() { + var _this3 = this; + + var interaction = this.interaction; + var options = __getOptions_26(interaction); + var lambda = options.resistance; + var t = (interaction._now() - this.t0) / 1000; + + if (t < this.te) { + var progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0; + var newOffset; + + if (this.isModified) { + newOffset = getQuadraticCurvePoint(0, 0, this.targetOffset.x, this.targetOffset.y, this.modifiedOffset.x, this.modifiedOffset.y, progress); + } else { + newOffset = { + x: this.targetOffset.x * progress, + y: this.targetOffset.y * progress + }; + } + + var delta = { + x: newOffset.x - this.currentOffset.x, + y: newOffset.y - this.currentOffset.y + }; + this.currentOffset.x += delta.x; + this.currentOffset.y += delta.y; + interaction.offsetBy(delta); + interaction.move(); + this.timeout = ___raf_26["default"].request(function () { + return _this3.inertiaTick(); + }); + } else { + interaction.offsetBy({ + x: this.modifiedOffset.x - this.currentOffset.x, + y: this.modifiedOffset.y - this.currentOffset.y + }); + this.end(); + } + } + }, { + key: "smoothEndTick", + value: function smoothEndTick() { + var _this4 = this; + + var interaction = this.interaction; + var t = interaction._now() - this.t0; + + var _getOptions = __getOptions_26(interaction), + duration = _getOptions.smoothEndDuration; + + if (t < duration) { + var newOffset = { + x: easeOutQuad(t, 0, this.targetOffset.x, duration), + y: easeOutQuad(t, 0, this.targetOffset.y, duration) + }; + var delta = { + x: newOffset.x - this.currentOffset.x, + y: newOffset.y - this.currentOffset.y + }; + this.currentOffset.x += delta.x; + this.currentOffset.y += delta.y; + interaction.offsetBy(delta); + interaction.move({ + skipModifiers: this.modifierCount + }); + this.timeout = ___raf_26["default"].request(function () { + return _this4.smoothEndTick(); + }); + } else { + interaction.offsetBy({ + x: this.targetOffset.x - this.currentOffset.x, + y: this.targetOffset.y - this.currentOffset.y + }); + this.end(); + } + } + }, { + key: "resume", + value: function resume(_ref) { + var pointer = _ref.pointer, + event = _ref.event, + eventTarget = _ref.eventTarget; + var interaction = this.interaction; // undo inertia changes to interaction coords + + interaction.offsetBy({ + x: -this.currentOffset.x, + y: -this.currentOffset.y + }); // update pointer at pointer down position + + interaction.updatePointer(pointer, event, eventTarget, true); // fire resume signals and event + + interaction._doPhase({ + interaction: interaction, + event: event, + phase: 'resume' + }); + + (0, _$pointerUtils_63.copyCoords)(interaction.coords.prev, interaction.coords.cur); + this.stop(); + } + }, { + key: "end", + value: function end() { + this.interaction.move(); + this.interaction.end(); + this.stop(); + } + }, { + key: "stop", + value: function stop() { + this.active = this.smoothEnd = false; + this.interaction.simulation = null; + + ___raf_26["default"].cancel(this.timeout); + } + }]); + + return InertiaState; +}(); + +_$index_26.InertiaState = InertiaState; + +function __start_26(_ref2) { + var interaction = _ref2.interaction, + event = _ref2.event; + + if (!interaction._interacting || interaction.simulation) { + return null; + } + + var started = interaction.inertia.start(event); // prevent action end if inertia or smoothEnd + + return started ? false : null; +} // Check if the down event hits the current inertia target +// control should be return to the user + + +function resume(arg) { + var interaction = arg.interaction, + eventTarget = arg.eventTarget; + var state = interaction.inertia; + + if (!state.active) { + return; + } + + var element = eventTarget; // climb up the DOM tree from the event target + + while (__is_26.element(element)) { + // if interaction element is the current inertia target element + if (element === interaction.element) { + state.resume(arg); + break; + } + + element = __dom_26.parentNode(element); + } +} + +function stop(_ref3) { + var interaction = _ref3.interaction; + var state = interaction.inertia; + + if (state.active) { + state.stop(); + } +} + +function __getOptions_26(_ref4) { + var interactable = _ref4.interactable, + prepared = _ref4.prepared; + return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia; +} + +var inertia = { + id: 'inertia', + before: ['modifiers/base'], + install: __install_26, + listeners: { + 'interactions:new': function interactionsNew(_ref5) { + var interaction = _ref5.interaction; + interaction.inertia = new InertiaState(interaction); + }, + 'interactions:before-action-end': __start_26, + 'interactions:down': resume, + 'interactions:stop': stop, + 'interactions:before-action-resume': function interactionsBeforeActionResume(arg) { + var modification = arg.interaction.modification; + modification.stop(arg); + modification.start(arg, arg.interaction.coords.cur.page); + modification.applyToInteraction(arg); + }, + 'interactions:before-action-inertiastart': function interactionsBeforeActionInertiastart(arg) { + return arg.interaction.modification.setAndApply(arg); + }, + 'interactions:action-resume': modifiers.addEventModifiers, + 'interactions:action-inertiastart': modifiers.addEventModifiers, + 'interactions:after-action-inertiastart': function interactionsAfterActionInertiastart(arg) { + return arg.interaction.modification.restoreInteractionCoords(arg); + }, + 'interactions:after-action-resume': function interactionsAfterActionResume(arg) { + return arg.interaction.modification.restoreInteractionCoords(arg); + } + } +}; // http://stackoverflow.com/a/5634528/2280888 + +function _getQBezierValue(t, p1, p2, p3) { + var iT = 1 - t; + return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3; +} + +function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) { + return { + x: _getQBezierValue(position, startX, cpX, endX), + y: _getQBezierValue(position, startY, cpY, endY) + }; +} // http://gizma.com/easing/ + + +function easeOutQuad(t, b, c, d) { + t /= d; + return -c * t * (t - 2) + b; +} + +var ___default_26 = inertia; +_$index_26["default"] = ___default_26; + +var _$aspectRatio_31 = {}; +"use strict"; + +Object.defineProperty(_$aspectRatio_31, "__esModule", { + value: true +}); +_$aspectRatio_31["default"] = void 0; + +var ___extend_31 = ___interopRequireDefault_31(_$extend_55); + +/* removed: var _$rect_65 = require("@interactjs/utils/rect"); */; + +var ___Modification_31 = ___interopRequireDefault_31(_$Modification_30); + +function ___interopRequireDefault_31(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } + +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { ___defineProperty_31(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } + +function ___defineProperty_31(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var aspectRatio = { + start: function start(arg) { + var state = arg.state, + rect = arg.rect, + originalEdges = arg.edges, + coords = arg.pageCoords; + var ratio = state.options.ratio; + var _state$options = state.options, + equalDelta = _state$options.equalDelta, + modifiers = _state$options.modifiers; + + if (ratio === 'preserve') { + ratio = rect.width / rect.height; + } + + state.startCoords = (0, ___extend_31["default"])({}, coords); + state.startRect = (0, ___extend_31["default"])({}, rect); + state.ratio = ratio; + state.equalDelta = equalDelta; + var linkedEdges = state.linkedEdges = { + top: originalEdges.top || originalEdges.left && !originalEdges.bottom, + left: originalEdges.left || originalEdges.top && !originalEdges.right, + bottom: originalEdges.bottom || originalEdges.right && !originalEdges.top, + right: originalEdges.right || originalEdges.bottom && !originalEdges.left + }; + state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right); + + if (state.equalDelta) { + state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1); + } else { + var negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left; + state.edgeSign = negativeSecondaryEdge ? -1 : 1; + } + + (0, ___extend_31["default"])(arg.edges, linkedEdges); + + if (!modifiers || !modifiers.length) { + return; + } + + var subModification = new ___Modification_31["default"](arg.interaction); + subModification.copyFrom(arg.interaction.modification); + subModification.prepareStates(modifiers); + state.subModification = subModification; + subModification.startAll(_objectSpread({}, arg)); + }, + set: function set(arg) { + var state = arg.state, + rect = arg.rect, + coords = arg.coords; + var initialCoords = (0, ___extend_31["default"])({}, coords); + var aspectMethod = state.equalDelta ? setEqualDelta : setRatio; + aspectMethod(state, state.xIsPrimaryAxis, coords, rect); + + if (!state.subModification) { + return null; + } + + var correctedRect = (0, ___extend_31["default"])({}, rect); + (0, _$rect_65.addEdges)(state.linkedEdges, correctedRect, { + x: coords.x - initialCoords.x, + y: coords.y - initialCoords.y + }); + var result = state.subModification.setAll(_objectSpread({}, arg, { + rect: correctedRect, + edges: state.linkedEdges, + pageCoords: coords, + prevCoords: coords, + prevRect: correctedRect + })); + var delta = result.delta; + + if (result.changed) { + var xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y); // do aspect modification again with critical edge axis as primary + + aspectMethod(state, xIsCriticalAxis, result.coords, result.rect); + (0, ___extend_31["default"])(coords, result.coords); + } + + return result.eventProps; + }, + defaults: { + ratio: 'preserve', + equalDelta: false, + modifiers: [], + enabled: false + } +}; + +function setEqualDelta(_ref, xIsPrimaryAxis, coords) { + var startCoords = _ref.startCoords, + edgeSign = _ref.edgeSign; + + if (xIsPrimaryAxis) { + coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign; + } else { + coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign; + } +} + +function setRatio(_ref2, xIsPrimaryAxis, coords, rect) { + var startRect = _ref2.startRect, + startCoords = _ref2.startCoords, + ratio = _ref2.ratio, + edgeSign = _ref2.edgeSign; + + if (xIsPrimaryAxis) { + var newHeight = rect.width / ratio; + coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign; + } else { + var newWidth = rect.height * ratio; + coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign; + } +} + +var ___default_31 = aspectRatio; +_$aspectRatio_31["default"] = ___default_31; + +var _$pointer_35 = {}; +"use strict"; + +function ___typeof_35(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_35 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_35 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_35(obj); } + +Object.defineProperty(_$pointer_35, "__esModule", { + value: true +}); +_$pointer_35.getRestrictionRect = getRestrictionRect; +_$pointer_35["default"] = void 0; + +var ___extend_35 = ___interopRequireDefault_35(_$extend_55); + +var __is_35 = ___interopRequireWildcard_35(_$is_59); + +var __rectUtils_35 = ___interopRequireWildcard_35(_$rect_65); + +function ___getRequireWildcardCache_35() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_35 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_35(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_35(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_35(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_35(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __start_35(_ref) { + var rect = _ref.rect, + startOffset = _ref.startOffset, + state = _ref.state, + interaction = _ref.interaction, + pageCoords = _ref.pageCoords; + var options = state.options; + var elementRect = options.elementRect; + var offset = (0, ___extend_35["default"])({ + left: 0, + top: 0, + right: 0, + bottom: 0 + }, options.offset || {}); + + if (rect && elementRect) { + var restriction = getRestrictionRect(options.restriction, interaction, pageCoords); + + if (restriction) { + var widthDiff = restriction.right - restriction.left - rect.width; + var heightDiff = restriction.bottom - restriction.top - rect.height; + + if (widthDiff < 0) { + offset.left += widthDiff; + offset.right += widthDiff; + } + + if (heightDiff < 0) { + offset.top += heightDiff; + offset.bottom += heightDiff; + } + } + + offset.left += startOffset.left - rect.width * elementRect.left; + offset.top += startOffset.top - rect.height * elementRect.top; + offset.right += startOffset.right - rect.width * (1 - elementRect.right); + offset.bottom += startOffset.bottom - rect.height * (1 - elementRect.bottom); + } + + state.offset = offset; +} + +function set(_ref2) { + var coords = _ref2.coords, + interaction = _ref2.interaction, + state = _ref2.state; + var options = state.options, + offset = state.offset; + var restriction = getRestrictionRect(options.restriction, interaction, coords); + + if (!restriction) { + return; + } + + var rect = __rectUtils_35.xywhToTlbr(restriction); + coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left); + coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top); +} + +function getRestrictionRect(value, interaction, coords) { + if (__is_35.func(value)) { + return __rectUtils_35.resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction]); + } else { + return __rectUtils_35.resolveRectLike(value, interaction.interactable, interaction.element); + } +} + +var __defaults_35 = { + restriction: null, + elementRect: null, + offset: null, + endOnly: false, + enabled: false +}; +var restrict = { + start: __start_35, + set: set, + defaults: __defaults_35 +}; +var ___default_35 = restrict; +_$pointer_35["default"] = ___default_35; + +var _$edges_34 = {}; +"use strict"; + +function ___typeof_34(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_34 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_34 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_34(obj); } + +Object.defineProperty(_$edges_34, "__esModule", { + value: true +}); +_$edges_34["default"] = void 0; + +var ___extend_34 = ___interopRequireDefault_34(_$extend_55); + +var __rectUtils_34 = ___interopRequireWildcard_34(_$rect_65); + +/* removed: var _$pointer_35 = require("./pointer"); */; + +function ___getRequireWildcardCache_34() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_34 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_34(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_34(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_34(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_34(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +// This module adds the options.resize.restrictEdges setting which sets min and +// max for the top, left, bottom and right edges of the target being resized. +// +// interact(target).resize({ +// edges: { top: true, left: true }, +// restrictEdges: { +// inner: { top: 200, left: 200, right: 400, bottom: 400 }, +// outer: { top: 0, left: 0, right: 600, bottom: 600 }, +// }, +// }) +var noInner = { + top: +Infinity, + left: +Infinity, + bottom: -Infinity, + right: -Infinity +}; +var noOuter = { + top: -Infinity, + left: -Infinity, + bottom: +Infinity, + right: +Infinity +}; + +function __start_34(_ref) { + var interaction = _ref.interaction, + startOffset = _ref.startOffset, + state = _ref.state; + var options = state.options; + var offset; + + if (options) { + var offsetRect = (0, _$pointer_35.getRestrictionRect)(options.offset, interaction, interaction.coords.start.page); + offset = __rectUtils_34.rectToXY(offsetRect); + } + + offset = offset || { + x: 0, + y: 0 + }; + state.offset = { + top: offset.y + startOffset.top, + left: offset.x + startOffset.left, + bottom: offset.y - startOffset.bottom, + right: offset.x - startOffset.right + }; +} + +function __set_34(_ref2) { + var coords = _ref2.coords, + edges = _ref2.edges, + interaction = _ref2.interaction, + state = _ref2.state; + var offset = state.offset, + options = state.options; + + if (!edges) { + return; + } + + var page = (0, ___extend_34["default"])({}, coords); + var inner = (0, _$pointer_35.getRestrictionRect)(options.inner, interaction, page) || {}; + var outer = (0, _$pointer_35.getRestrictionRect)(options.outer, interaction, page) || {}; + fixRect(inner, noInner); + fixRect(outer, noOuter); + + if (edges.top) { + coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top); + } else if (edges.bottom) { + coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom); + } + + if (edges.left) { + coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left); + } else if (edges.right) { + coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right); + } +} + +function fixRect(rect, defaults) { + var _arr = ['top', 'left', 'bottom', 'right']; + + for (var _i = 0; _i < _arr.length; _i++) { + var edge = _arr[_i]; + + if (!(edge in rect)) { + rect[edge] = defaults[edge]; + } + } + + return rect; +} + +var __defaults_34 = { + inner: null, + outer: null, + offset: null, + endOnly: false, + enabled: false +}; +var restrictEdges = { + noInner: noInner, + noOuter: noOuter, + start: __start_34, + set: __set_34, + defaults: __defaults_34 +}; +var ___default_34 = restrictEdges; +_$edges_34["default"] = ___default_34; + +var _$rect_36 = {}; +"use strict"; + +Object.defineProperty(_$rect_36, "__esModule", { + value: true +}); +_$rect_36["default"] = void 0; + +var ___extend_36 = ___interopRequireDefault_36(_$extend_55); + +var ___pointer_36 = ___interopRequireDefault_36(_$pointer_35); + +function ___interopRequireDefault_36(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var __defaults_36 = (0, ___extend_36["default"])({ + get elementRect() { + return { + top: 0, + left: 0, + bottom: 1, + right: 1 + }; + }, + + set elementRect(_) {} + +}, ___pointer_36["default"].defaults); +var restrictRect = { + start: ___pointer_36["default"].start, + set: ___pointer_36["default"].set, + defaults: __defaults_36 +}; +var ___default_36 = restrictRect; +_$rect_36["default"] = ___default_36; + +var _$size_37 = {}; +"use strict"; + +function ___typeof_37(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_37 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_37 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_37(obj); } + +Object.defineProperty(_$size_37, "__esModule", { + value: true +}); +_$size_37["default"] = void 0; + +var ___extend_37 = ___interopRequireDefault_37(_$extend_55); + +var __rectUtils_37 = ___interopRequireWildcard_37(_$rect_65); + +var _edges = ___interopRequireDefault_37(_$edges_34); + +/* removed: var _$pointer_35 = require("./pointer"); */; + +function ___getRequireWildcardCache_37() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_37 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_37(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_37(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_37(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_37(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var noMin = { + width: -Infinity, + height: -Infinity +}; +var noMax = { + width: +Infinity, + height: +Infinity +}; + +function __start_37(arg) { + return _edges["default"].start(arg); +} + +function __set_37(arg) { + var interaction = arg.interaction, + state = arg.state, + rect = arg.rect, + edges = arg.edges; + var options = state.options; + + if (!edges) { + return; + } + + var minSize = __rectUtils_37.tlbrToXywh((0, _$pointer_35.getRestrictionRect)(options.min, interaction, arg.coords)) || noMin; + var maxSize = __rectUtils_37.tlbrToXywh((0, _$pointer_35.getRestrictionRect)(options.max, interaction, arg.coords)) || noMax; + state.options = { + endOnly: options.endOnly, + inner: (0, ___extend_37["default"])({}, _edges["default"].noInner), + outer: (0, ___extend_37["default"])({}, _edges["default"].noOuter) + }; + + if (edges.top) { + state.options.inner.top = rect.bottom - minSize.height; + state.options.outer.top = rect.bottom - maxSize.height; + } else if (edges.bottom) { + state.options.inner.bottom = rect.top + minSize.height; + state.options.outer.bottom = rect.top + maxSize.height; + } + + if (edges.left) { + state.options.inner.left = rect.right - minSize.width; + state.options.outer.left = rect.right - maxSize.width; + } else if (edges.right) { + state.options.inner.right = rect.left + minSize.width; + state.options.outer.right = rect.left + maxSize.width; + } + + _edges["default"].set(arg); + + state.options = options; +} + +var __defaults_37 = { + min: null, + max: null, + endOnly: false, + enabled: false +}; +var restrictSize = { + start: __start_37, + set: __set_37, + defaults: __defaults_37 +}; +var ___default_37 = restrictSize; +_$size_37["default"] = ___default_37; + +var _$pointer_39 = {}; +"use strict"; + +function ___typeof_39(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_39 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_39 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_39(obj); } + +Object.defineProperty(_$pointer_39, "__esModule", { + value: true +}); +_$pointer_39["default"] = void 0; + +var __utils_39 = ___interopRequireWildcard_39(_$index_58); + +function ___getRequireWildcardCache_39() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_39 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_39(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_39(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_39(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __start_39(arg) { + var interaction = arg.interaction, + interactable = arg.interactable, + element = arg.element, + rect = arg.rect, + state = arg.state, + startOffset = arg.startOffset; + var options = state.options; + var origin = options.offsetWithOrigin ? getOrigin(arg) : { + x: 0, + y: 0 + }; + var snapOffset; + + if (options.offset === 'startCoords') { + snapOffset = { + x: interaction.coords.start.page.x, + y: interaction.coords.start.page.y + }; + } else { + var offsetRect = __utils_39.rect.resolveRectLike(options.offset, interactable, element, [interaction]); + snapOffset = __utils_39.rect.rectToXY(offsetRect) || { + x: 0, + y: 0 + }; + snapOffset.x += origin.x; + snapOffset.y += origin.y; + } + + var relativePoints = options.relativePoints; + state.offsets = rect && relativePoints && relativePoints.length ? relativePoints.map(function (relativePoint, index) { + return { + index: index, + relativePoint: relativePoint, + x: startOffset.left - rect.width * relativePoint.x + snapOffset.x, + y: startOffset.top - rect.height * relativePoint.y + snapOffset.y + }; + }) : [__utils_39.extend({ + index: 0, + relativePoint: null + }, snapOffset)]; +} + +function __set_39(arg) { + var interaction = arg.interaction, + coords = arg.coords, + state = arg.state; + var options = state.options, + offsets = state.offsets; + var origin = __utils_39.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name); + var page = __utils_39.extend({}, coords); + var targets = []; + + if (!options.offsetWithOrigin) { + page.x -= origin.x; + page.y -= origin.y; + } + + for (var _i = 0; _i < offsets.length; _i++) { + var _ref; + + _ref = offsets[_i]; + var _offset = _ref; + var relativeX = page.x - _offset.x; + var relativeY = page.y - _offset.y; + + for (var _index = 0, len = options.targets.length; _index < len; _index++) { + var snapTarget = options.targets[_index]; + var target = void 0; + + if (__utils_39.is.func(snapTarget)) { + target = snapTarget(relativeX, relativeY, interaction, _offset, _index); + } else { + target = snapTarget; + } + + if (!target) { + continue; + } + + targets.push({ + x: (__utils_39.is.number(target.x) ? target.x : relativeX) + _offset.x, + y: (__utils_39.is.number(target.y) ? target.y : relativeY) + _offset.y, + range: __utils_39.is.number(target.range) ? target.range : options.range, + source: snapTarget, + index: _index, + offset: _offset + }); + } + } + + var closest = { + target: null, + inRange: false, + distance: 0, + range: 0, + delta: { + x: 0, + y: 0 + } + }; + + for (var _i2 = 0; _i2 < targets.length; _i2++) { + var _target = targets[_i2]; + var range = _target.range; + var dx = _target.x - page.x; + var dy = _target.y - page.y; + var distance = __utils_39.hypot(dx, dy); + var inRange = distance <= range; // Infinite targets count as being out of range + // compared to non infinite ones that are in range + + if (range === Infinity && closest.inRange && closest.range !== Infinity) { + inRange = false; + } + + if (!closest.target || (inRange // is the closest target in range? + ? closest.inRange && range !== Infinity // the pointer is relatively deeper in this target + ? distance / range < closest.distance / closest.range // this target has Infinite range and the closest doesn't + : range === Infinity && closest.range !== Infinity || // OR this target is closer that the previous closest + distance < closest.distance : // The other is not in range and the pointer is closer to this target + !closest.inRange && distance < closest.distance)) { + closest.target = _target; + closest.distance = distance; + closest.range = range; + closest.inRange = inRange; + closest.delta.x = dx; + closest.delta.y = dy; + } + } + + if (closest.inRange) { + coords.x = closest.target.x; + coords.y = closest.target.y; + } + + state.closest = closest; + return closest; +} + +function getOrigin(arg) { + var element = arg.interaction.element; + var optionsOrigin = __utils_39.rect.rectToXY(__utils_39.rect.resolveRectLike(arg.state.options.origin, null, null, [element])); + var origin = optionsOrigin || __utils_39.getOriginXY(arg.interactable, element, arg.interaction.prepared.name); + return origin; +} + +var __defaults_39 = { + range: Infinity, + targets: null, + offset: null, + offsetWithOrigin: true, + origin: null, + relativePoints: null, + endOnly: false, + enabled: false +}; +var snap = { + start: __start_39, + set: __set_39, + defaults: __defaults_39 +}; +var ___default_39 = snap; +_$pointer_39["default"] = ___default_39; + +var _$size_40 = {}; +"use strict"; + +function ___typeof_40(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_40 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_40 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_40(obj); } + +Object.defineProperty(_$size_40, "__esModule", { + value: true +}); +_$size_40["default"] = void 0; + +var ___extend_40 = ___interopRequireDefault_40(_$extend_55); + +var __is_40 = ___interopRequireWildcard_40(_$is_59); + +var ___pointer_40 = ___interopRequireDefault_40(_$pointer_39); + +function ___getRequireWildcardCache_40() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_40 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_40(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_40(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_40(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_40(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___slicedToArray_40(arr, i) { return ___arrayWithHoles_40(arr) || ___iterableToArrayLimit_40(arr, i) || ___nonIterableRest_40(); } + +function ___nonIterableRest_40() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function ___iterableToArrayLimit_40(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function ___arrayWithHoles_40(arr) { if (Array.isArray(arr)) return arr; } + +function __start_40(arg) { + var state = arg.state, + edges = arg.edges; + var options = state.options; + + if (!edges) { + return null; + } + + arg.state = { + options: { + targets: null, + relativePoints: [{ + x: edges.left ? 0 : 1, + y: edges.top ? 0 : 1 + }], + offset: options.offset || 'self', + origin: { + x: 0, + y: 0 + }, + range: options.range + } + }; + state.targetFields = state.targetFields || [['width', 'height'], ['x', 'y']]; + + ___pointer_40["default"].start(arg); + + state.offsets = arg.state.offsets; + arg.state = state; +} + +function __set_40(arg) { + var interaction = arg.interaction, + state = arg.state, + coords = arg.coords; + var options = state.options, + offsets = state.offsets; + var relative = { + x: coords.x - offsets[0].x, + y: coords.y - offsets[0].y + }; + state.options = (0, ___extend_40["default"])({}, options); + state.options.targets = []; + + for (var _i = 0; _i < (options.targets || []).length; _i++) { + var _ref; + + _ref = (options.targets || [])[_i]; + var snapTarget = _ref; + var target = void 0; + + if (__is_40.func(snapTarget)) { + target = snapTarget(relative.x, relative.y, interaction); + } else { + target = snapTarget; + } + + if (!target) { + continue; + } + + for (var _i2 = 0; _i2 < state.targetFields.length; _i2++) { + var _ref2; + + _ref2 = state.targetFields[_i2]; + + var _ref3 = _ref2, + _ref4 = ___slicedToArray_40(_ref3, 2), + xField = _ref4[0], + yField = _ref4[1]; + + if (xField in target || yField in target) { + target.x = target[xField]; + target.y = target[yField]; + break; + } + } + + state.options.targets.push(target); + } + + var returnValue = ___pointer_40["default"].set(arg); + + state.options = options; + return returnValue; +} + +var __defaults_40 = { + range: Infinity, + targets: null, + offset: null, + endOnly: false, + enabled: false +}; +var snapSize = { + start: __start_40, + set: __set_40, + defaults: __defaults_40 +}; +var ___default_40 = snapSize; +_$size_40["default"] = ___default_40; + +var _$edges_38 = {}; +"use strict"; + +Object.defineProperty(_$edges_38, "__esModule", { + value: true +}); +_$edges_38["default"] = void 0; + +var ___clone_38 = ___interopRequireDefault_38(_$clone_51); + +var ___extend_38 = ___interopRequireDefault_38(_$extend_55); + +var _size = ___interopRequireDefault_38(_$size_40); + +function ___interopRequireDefault_38(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** + * @module modifiers/snapEdges + * + * @description + * This module allows snapping of the edges of targets during resize + * interactions. + * + * @example + * interact(target).resizable({ + * snapEdges: { + * targets: [interact.snappers.grid({ x: 100, y: 50 })], + * }, + * }) + * + * interact(target).resizable({ + * snapEdges: { + * targets: [ + * interact.snappers.grid({ + * top: 50, + * left: 50, + * bottom: 100, + * right: 100, + * }), + * ], + * }, + * }) + */ +function __start_38(arg) { + var edges = arg.edges; + + if (!edges) { + return null; + } + + arg.state.targetFields = arg.state.targetFields || [[edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom']]; + return _size["default"].start(arg); +} + +var snapEdges = { + start: __start_38, + set: _size["default"].set, + defaults: (0, ___extend_38["default"])((0, ___clone_38["default"])(_size["default"].defaults), { + targets: null, + range: null, + offset: { + x: 0, + y: 0 + } + }) +}; +var ___default_38 = snapEdges; +_$edges_38["default"] = ___default_38; + +var _$index_33 = {}; +"use strict"; + +Object.defineProperty(_$index_33, "__esModule", { + value: true +}); +_$index_33.aspectRatio = _$index_33.restrictSize = _$index_33.restrictEdges = _$index_33.restrictRect = _$index_33.restrict = _$index_33.snapEdges = _$index_33.snapSize = _$index_33.snap = void 0; + +var _aspectRatio = ___interopRequireDefault_33(_$aspectRatio_31); + +/* removed: var _$base_32 = require("./base"); */; + +var ___edges_33 = ___interopRequireDefault_33(_$edges_34); + +var ___pointer_33 = ___interopRequireDefault_33(_$pointer_35); + +var ___rect_33 = ___interopRequireDefault_33(_$rect_36); + +var ___size_33 = ___interopRequireDefault_33(_$size_37); + +var _edges2 = ___interopRequireDefault_33(_$edges_38); + +var _pointer2 = ___interopRequireDefault_33(_$pointer_39); + +var _size2 = ___interopRequireDefault_33(_$size_40); + +function ___interopRequireDefault_33(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var __snap_33 = (0, _$base_32.makeModifier)(_pointer2["default"], 'snap'); +_$index_33.snap = __snap_33; +var __snapSize_33 = (0, _$base_32.makeModifier)(_size2["default"], 'snapSize'); +_$index_33.snapSize = __snapSize_33; +var __snapEdges_33 = (0, _$base_32.makeModifier)(_edges2["default"], 'snapEdges'); +_$index_33.snapEdges = __snapEdges_33; +var __restrict_33 = (0, _$base_32.makeModifier)(___pointer_33["default"], 'restrict'); +_$index_33.restrict = __restrict_33; +var __restrictRect_33 = (0, _$base_32.makeModifier)(___rect_33["default"], 'restrictRect'); +_$index_33.restrictRect = __restrictRect_33; +var __restrictEdges_33 = (0, _$base_32.makeModifier)(___edges_33["default"], 'restrictEdges'); +_$index_33.restrictEdges = __restrictEdges_33; +var __restrictSize_33 = (0, _$base_32.makeModifier)(___size_33["default"], 'restrictSize'); +_$index_33.restrictSize = __restrictSize_33; +var __aspectRatio_33 = (0, _$base_32.makeModifier)(_aspectRatio["default"], 'aspectRatio'); +_$index_33.aspectRatio = __aspectRatio_33; + +var _$PointerEvent_42 = {}; +"use strict"; + +Object.defineProperty(_$PointerEvent_42, "__esModule", { + value: true +}); +_$PointerEvent_42.PointerEvent = _$PointerEvent_42["default"] = void 0; + +var ___BaseEvent2_42 = ___interopRequireDefault_42(_$BaseEvent_13); + +var __pointerUtils_42 = ___interopRequireWildcard_42(_$pointerUtils_63); + +function ___getRequireWildcardCache_42() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_42 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_42(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_42(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_42(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_42(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___typeof_42(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_42 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_42 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_42(obj); } + +function ___classCallCheck_42(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function ___defineProperties_42(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } + +function ___createClass_42(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_42(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_42(Constructor, staticProps); return Constructor; } + +function ___possibleConstructorReturn_42(self, call) { if (call && (___typeof_42(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_42(self); } + +function ___getPrototypeOf_42(o) { ___getPrototypeOf_42 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_42(o); } + +function ___assertThisInitialized_42(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } + +function ___inherits_42(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_42(subClass, superClass); } + +function ___setPrototypeOf_42(o, p) { ___setPrototypeOf_42 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_42(o, p); } + +function ___defineProperty_42(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + +var PointerEvent = +/*#__PURE__*/ +function (_BaseEvent) { + ___inherits_42(PointerEvent, _BaseEvent); + + /** */ + function PointerEvent(type, pointer, event, eventTarget, interaction, timeStamp) { + var _this; + + ___classCallCheck_42(this, PointerEvent); + + _this = ___possibleConstructorReturn_42(this, ___getPrototypeOf_42(PointerEvent).call(this, interaction)); + + ___defineProperty_42(___assertThisInitialized_42(_this), "type", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "originalEvent", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "pointerId", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "pointerType", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "double", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "pageX", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "pageY", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "clientX", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "clientY", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "dt", void 0); + + ___defineProperty_42(___assertThisInitialized_42(_this), "eventable", void 0); + + __pointerUtils_42.pointerExtend(___assertThisInitialized_42(_this), event); + + if (event !== pointer) { + __pointerUtils_42.pointerExtend(___assertThisInitialized_42(_this), pointer); + } + + _this.timeStamp = timeStamp; + _this.originalEvent = event; + _this.type = type; + _this.pointerId = __pointerUtils_42.getPointerId(pointer); + _this.pointerType = __pointerUtils_42.getPointerType(pointer); + _this.target = eventTarget; + _this.currentTarget = null; + + if (type === 'tap') { + var pointerIndex = interaction.getPointerIndex(pointer); + _this.dt = _this.timeStamp - interaction.pointers[pointerIndex].downTime; + var interval = _this.timeStamp - interaction.tapTime; + _this["double"] = !!(interaction.prevTap && interaction.prevTap.type !== 'doubletap' && interaction.prevTap.target === _this.target && interval < 500); + } else if (type === 'doubletap') { + _this.dt = pointer.timeStamp - interaction.tapTime; + } + + return _this; + } + + ___createClass_42(PointerEvent, [{ + key: "_subtractOrigin", + value: function _subtractOrigin(_ref) { + var originX = _ref.x, + originY = _ref.y; + this.pageX -= originX; + this.pageY -= originY; + this.clientX -= originX; + this.clientY -= originY; + return this; + } + }, { + key: "_addOrigin", + value: function _addOrigin(_ref2) { + var originX = _ref2.x, + originY = _ref2.y; + this.pageX += originX; + this.pageY += originY; + this.clientX += originX; + this.clientY += originY; + return this; + } + /** + * Prevent the default behaviour of the original Event + */ + + }, { + key: "preventDefault", + value: function preventDefault() { + this.originalEvent.preventDefault(); + } + }]); + + return PointerEvent; +}(___BaseEvent2_42["default"]); + +_$PointerEvent_42.PointerEvent = _$PointerEvent_42["default"] = PointerEvent; + +var _$base_43 = {}; +"use strict"; + +function ___typeof_43(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_43 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_43 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_43(obj); } + +Object.defineProperty(_$base_43, "__esModule", { + value: true +}); +_$base_43["default"] = void 0; + +var ___Interaction_43 = ___interopRequireDefault_43(_$Interaction_18); + +var ___scope_43 = _$scope_24({}); + +var __utils_43 = ___interopRequireWildcard_43(_$index_58); + +var _PointerEvent = ___interopRequireDefault_43(_$PointerEvent_42); + +function ___getRequireWildcardCache_43() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_43 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_43(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_43(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_43(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_43(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var __defaults_43 = { + holdDuration: 600, + ignoreFrom: null, + allowFrom: null, + origin: { + x: 0, + y: 0 + } +}; +var pointerEvents = { + id: 'pointer-events/base', + install: __install_43, + listeners: { + 'interactions:new': addInteractionProps, + 'interactions:update-pointer': addHoldInfo, + 'interactions:move': moveAndClearHold, + 'interactions:down': function interactionsDown(arg, scope) { + downAndStartHold(arg, scope); + fire(arg, scope); + }, + 'interactions:up': function interactionsUp(arg, scope) { + clearHold(arg); + fire(arg, scope); + tapAfterUp(arg, scope); + }, + 'interactions:cancel': function interactionsCancel(arg, scope) { + clearHold(arg); + fire(arg, scope); + } + }, + PointerEvent: _PointerEvent["default"], + fire: fire, + collectEventTargets: collectEventTargets, + defaults: __defaults_43, + types: { + down: true, + move: true, + up: true, + cancel: true, + tap: true, + doubletap: true, + hold: true + } +}; + +function fire(arg, scope) { + var interaction = arg.interaction, + pointer = arg.pointer, + event = arg.event, + eventTarget = arg.eventTarget, + type = arg.type, + _arg$targets = arg.targets, + targets = _arg$targets === void 0 ? collectEventTargets(arg, scope) : _arg$targets; + var pointerEvent = new _PointerEvent["default"](type, pointer, event, eventTarget, interaction, scope.now()); + scope.fire('pointerEvents:new', { + pointerEvent: pointerEvent + }); + var signalArg = { + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + targets: targets, + type: type, + pointerEvent: pointerEvent + }; + + for (var i = 0; i < targets.length; i++) { + var target = targets[i]; + + for (var prop in target.props || {}) { + pointerEvent[prop] = target.props[prop]; + } + + var origin = __utils_43.getOriginXY(target.eventable, target.node); + + pointerEvent._subtractOrigin(origin); + + pointerEvent.eventable = target.eventable; + pointerEvent.currentTarget = target.node; + target.eventable.fire(pointerEvent); + + pointerEvent._addOrigin(origin); + + if (pointerEvent.immediatePropagationStopped || pointerEvent.propagationStopped && i + 1 < targets.length && targets[i + 1].node !== pointerEvent.currentTarget) { + break; + } + } + + scope.fire('pointerEvents:fired', signalArg); + + if (type === 'tap') { + // if pointerEvent should make a double tap, create and fire a doubletap + // PointerEvent and use that as the prevTap + var prevTap = pointerEvent["double"] ? fire({ + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + type: 'doubletap' + }, scope) : pointerEvent; + interaction.prevTap = prevTap; + interaction.tapTime = prevTap.timeStamp; + } + + return pointerEvent; +} + +function collectEventTargets(_ref, scope) { + var interaction = _ref.interaction, + pointer = _ref.pointer, + event = _ref.event, + eventTarget = _ref.eventTarget, + type = _ref.type; + var pointerIndex = interaction.getPointerIndex(pointer); + var pointerInfo = interaction.pointers[pointerIndex]; // do not fire a tap event if the pointer was moved before being lifted + + if (type === 'tap' && (interaction.pointerWasMoved || // or if the pointerup target is different to the pointerdown target + !(pointerInfo && pointerInfo.downTarget === eventTarget))) { + return []; + } + + var path = __utils_43.dom.getPath(eventTarget); + var signalArg = { + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + type: type, + path: path, + targets: [], + node: null + }; + + for (var _i = 0; _i < path.length; _i++) { + var _ref2; + + _ref2 = path[_i]; + var node = _ref2; + signalArg.node = node; + scope.fire('pointerEvents:collect-targets', signalArg); + } + + if (type === 'hold') { + signalArg.targets = signalArg.targets.filter(function (target) { + return target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration; + }); + } + + return signalArg.targets; +} + +function addInteractionProps(_ref3) { + var interaction = _ref3.interaction; + interaction.prevTap = null; // the most recent tap event on this interaction + + interaction.tapTime = 0; // time of the most recent tap event +} + +function addHoldInfo(_ref4) { + var down = _ref4.down, + pointerInfo = _ref4.pointerInfo; + + if (!down && pointerInfo.hold) { + return; + } + + pointerInfo.hold = { + duration: Infinity, + timeout: null + }; +} + +function clearHold(_ref5) { + var interaction = _ref5.interaction, + pointerIndex = _ref5.pointerIndex; + + if (interaction.pointers[pointerIndex].hold) { + clearTimeout(interaction.pointers[pointerIndex].hold.timeout); + } +} + +function moveAndClearHold(_ref6, scope) { + var interaction = _ref6.interaction, + pointer = _ref6.pointer, + event = _ref6.event, + eventTarget = _ref6.eventTarget, + duplicate = _ref6.duplicate; + var pointerIndex = interaction.getPointerIndex(pointer); + + if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) { + if (interaction.pointerIsDown) { + clearTimeout(interaction.pointers[pointerIndex].hold.timeout); + } + + fire({ + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + type: 'move' + }, scope); + } +} + +function downAndStartHold(_ref7, scope) { + var interaction = _ref7.interaction, + pointer = _ref7.pointer, + event = _ref7.event, + eventTarget = _ref7.eventTarget, + pointerIndex = _ref7.pointerIndex; + var timer = interaction.pointers[pointerIndex].hold; + var path = __utils_43.dom.getPath(eventTarget); + var signalArg = { + interaction: interaction, + pointer: pointer, + event: event, + eventTarget: eventTarget, + type: 'hold', + targets: [], + path: path, + node: null + }; + + for (var _i2 = 0; _i2 < path.length; _i2++) { + var _ref8; + + _ref8 = path[_i2]; + var node = _ref8; + signalArg.node = node; + scope.fire('pointerEvents:collect-targets', signalArg); + } + + if (!signalArg.targets.length) { + return; + } + + var minDuration = Infinity; + + for (var _i3 = 0; _i3 < signalArg.targets.length; _i3++) { + var _ref9; + + _ref9 = signalArg.targets[_i3]; + var target = _ref9; + var holdDuration = target.eventable.options.holdDuration; + + if (holdDuration < minDuration) { + minDuration = holdDuration; + } + } + + timer.duration = minDuration; + timer.timeout = setTimeout(function () { + fire({ + interaction: interaction, + eventTarget: eventTarget, + pointer: pointer, + event: event, + type: 'hold' + }, scope); + }, minDuration); +} + +function tapAfterUp(_ref10, scope) { + var interaction = _ref10.interaction, + pointer = _ref10.pointer, + event = _ref10.event, + eventTarget = _ref10.eventTarget; + + if (!interaction.pointerWasMoved) { + fire({ + interaction: interaction, + eventTarget: eventTarget, + pointer: pointer, + event: event, + type: 'tap' + }, scope); + } +} + +function __install_43(scope) { + scope.pointerEvents = pointerEvents; + scope.defaults.actions.pointerEvents = pointerEvents.defaults; + __utils_43.extend(scope.actions.phaselessTypes, pointerEvents.types); +} + +var ___default_43 = pointerEvents; +_$base_43["default"] = ___default_43; + +var _$holdRepeat_44 = {}; +"use strict"; + +Object.defineProperty(_$holdRepeat_44, "__esModule", { + value: true +}); +_$holdRepeat_44["default"] = void 0; + +var ___base_44 = ___interopRequireDefault_44(_$base_43); + +var ___PointerEvent_44 = ___interopRequireDefault_44(_$PointerEvent_42); + +function ___interopRequireDefault_44(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_44(scope) { + scope.usePlugin(___base_44["default"]); + var pointerEvents = scope.pointerEvents; // don't repeat by default + + pointerEvents.defaults.holdRepeatInterval = 0; + pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true; +} + +function onNew(_ref) { + var pointerEvent = _ref.pointerEvent; + + if (pointerEvent.type !== 'hold') { + return; + } + + pointerEvent.count = (pointerEvent.count || 0) + 1; +} + +function onFired(_ref2, scope) { + var interaction = _ref2.interaction, + pointerEvent = _ref2.pointerEvent, + eventTarget = _ref2.eventTarget, + targets = _ref2.targets; + + if (pointerEvent.type !== 'hold' || !targets.length) { + return; + } // get the repeat interval from the first eventable + + + var interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less + + if (interval <= 0) { + return; + } // set a timeout to fire the holdrepeat event + + + interaction.holdIntervalHandle = setTimeout(function () { + scope.pointerEvents.fire({ + interaction: interaction, + eventTarget: eventTarget, + type: 'hold', + pointer: pointerEvent, + event: pointerEvent + }, scope); + }, interval); +} + +function endHoldRepeat(_ref3) { + var interaction = _ref3.interaction; + + // set the interaction's holdStopTime property + // to stop further holdRepeat events + if (interaction.holdIntervalHandle) { + clearInterval(interaction.holdIntervalHandle); + interaction.holdIntervalHandle = null; + } +} + +var holdRepeat = { + id: 'pointer-events/holdRepeat', + install: __install_44, + listeners: ['move', 'up', 'cancel', 'endall'].reduce(function (acc, enderTypes) { + acc["pointerEvents:".concat(enderTypes)] = endHoldRepeat; + return acc; + }, { + 'pointerEvents:new': onNew, + 'pointerEvents:fired': onFired + }) +}; +var ___default_44 = holdRepeat; +_$holdRepeat_44["default"] = ___default_44; + +var _$interactableTargets_46 = {}; +"use strict"; + +Object.defineProperty(_$interactableTargets_46, "__esModule", { + value: true +}); +_$interactableTargets_46["default"] = void 0; + +var ___extend_46 = ___interopRequireDefault_46(_$extend_55); + +function ___interopRequireDefault_46(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_46(scope) { + var Interactable = scope.Interactable; + Interactable.prototype.pointerEvents = pointerEventsMethod; + var __backCompatOption = Interactable.prototype._backCompatOption; + + Interactable.prototype._backCompatOption = function (optionName, newValue) { + var ret = __backCompatOption.call(this, optionName, newValue); + + if (ret === this) { + this.events.options[optionName] = newValue; + } + + return ret; + }; +} + +function pointerEventsMethod(options) { + (0, ___extend_46["default"])(this.events.options, options); + return this; +} + +var plugin = { + id: 'pointer-events/interactableTargets', + install: __install_46, + listeners: { + 'pointerEvents:collect-targets': function pointerEventsCollectTargets(_ref, scope) { + var targets = _ref.targets, + node = _ref.node, + type = _ref.type, + eventTarget = _ref.eventTarget; + scope.interactables.forEachMatch(node, function (interactable) { + var eventable = interactable.events; + var options = eventable.options; + + if (eventable.types[type] && eventable.types[type].length && interactable.testIgnoreAllow(options, node, eventTarget)) { + targets.push({ + node: node, + eventable: eventable, + props: { + interactable: interactable + } + }); + } + }); + }, + 'interactable:new': function interactableNew(_ref2) { + var interactable = _ref2.interactable; + + interactable.events.getRect = function (element) { + return interactable.getRect(element); + }; + }, + 'interactable:set': function interactableSet(_ref3, scope) { + var interactable = _ref3.interactable, + options = _ref3.options; + (0, ___extend_46["default"])(interactable.events.options, scope.pointerEvents.defaults); + (0, ___extend_46["default"])(interactable.events.options, options.pointerEvents || {}); + } + } +}; +var ___default_46 = plugin; +_$interactableTargets_46["default"] = ___default_46; + +var _$index_45 = {}; +"use strict"; + +function ___typeof_45(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_45 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_45 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_45(obj); } + +Object.defineProperty(_$index_45, "__esModule", { + value: true +}); +_$index_45.install = __install_45; +Object.defineProperty(_$index_45, "holdRepeat", { + enumerable: true, + get: function get() { + return _holdRepeat["default"]; + } +}); +Object.defineProperty(_$index_45, "interactableTargets", { + enumerable: true, + get: function get() { + return _interactableTargets["default"]; + } +}); +_$index_45.pointerEvents = _$index_45.id = void 0; + +var __pointerEvents_45 = ___interopRequireWildcard_45(_$base_43); + +_$index_45.pointerEvents = __pointerEvents_45; + +var _holdRepeat = ___interopRequireDefault_45(_$holdRepeat_44); + +var _interactableTargets = ___interopRequireDefault_45(_$interactableTargets_46); + +function ___interopRequireDefault_45(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_45() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_45 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_45(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_45(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_45(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __install_45(scope) { + scope.usePlugin(__pointerEvents_45); + scope.usePlugin(_holdRepeat["default"]); + scope.usePlugin(_interactableTargets["default"]); +} + +var __id_45 = 'pointer-events'; +_$index_45.id = __id_45; + +var _$index_47 = {}; +"use strict"; + +Object.defineProperty(_$index_47, "__esModule", { + value: true +}); +_$index_47.install = __install_47; +_$index_47["default"] = void 0; + +var ___Interactable_47 = ___interopRequireDefault_47(_$Interactable_16({})); + +/* removed: var _$Interaction_18 = require("@interactjs/core/Interaction"); */; + +/* removed: var _$index_58 = require("@interactjs/utils/index"); */; + +function ___interopRequireDefault_47(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function __install_47(scope) { + var Interactable = scope.Interactable; + scope.actions.phases.reflow = true; + /** + * ```js + * const interactable = interact(target) + * const drag = { name: drag, axis: 'x' } + * const resize = { name: resize, edges: { left: true, bottom: true } + * + * interactable.reflow(drag) + * interactable.reflow(resize) + * ``` + * + * Start an action sequence to re-apply modifiers, check drops, etc. + * + * @param { Object } action The action to begin + * @param { string } action.name The name of the action + * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended + */ + + Interactable.prototype.reflow = function (action) { + return reflow(this, action, scope); + }; +} + +function reflow(interactable, action, scope) { + var elements = _$index_58.is.string(interactable.target) ? _$index_58.arr.from(interactable._context.querySelectorAll(interactable.target)) : [interactable.target]; // tslint:disable-next-line variable-name + + var Promise = _$index_58.win.window.Promise; + var promises = Promise ? [] : null; + + var _loop = function _loop() { + _ref = elements[_i]; + var element = _ref; + var rect = interactable.getRect(element); + + if (!rect) { + return "break"; + } + + var runningInteraction = _$index_58.arr.find(scope.interactions.list, function (interaction) { + return interaction.interacting() && interaction.interactable === interactable && interaction.element === element && interaction.prepared.name === action.name; + }); + + var reflowPromise = void 0; + + if (runningInteraction) { + runningInteraction.move(); + + if (promises) { + reflowPromise = runningInteraction._reflowPromise || new Promise(function (resolve) { + runningInteraction._reflowResolve = resolve; + }); + } + } else { + var xywh = _$index_58.rect.tlbrToXywh(rect); + + var coords = { + page: { + x: xywh.x, + y: xywh.y + }, + client: { + x: xywh.x, + y: xywh.y + }, + timeStamp: scope.now() + }; + + var event = _$index_58.pointer.coordsToEvent(coords); + + reflowPromise = startReflow(scope, interactable, element, action, event); + } + + if (promises) { + promises.push(reflowPromise); + } + }; + + for (var _i = 0; _i < elements.length; _i++) { + var _ref; + + var _ret = _loop(); + + if (_ret === "break") break; + } + + return promises && Promise.all(promises).then(function () { + return interactable; + }); +} + +function startReflow(scope, interactable, element, action, event) { + var interaction = scope.interactions["new"]({ + pointerType: 'reflow' + }); + var signalArg = { + interaction: interaction, + event: event, + pointer: event, + eventTarget: element, + phase: 'reflow' + }; + interaction.interactable = interactable; + interaction.element = element; + interaction.prepared = (0, _$index_58.extend)({}, action); + interaction.prevEvent = event; + interaction.updatePointer(event, event, element, true); + + interaction._doPhase(signalArg); + + var reflowPromise = _$index_58.win.window.Promise ? new _$index_58.win.window.Promise(function (resolve) { + interaction._reflowResolve = resolve; + }) : null; + interaction._reflowPromise = reflowPromise; + interaction.start(action, interactable, element); + + if (interaction._interacting) { + interaction.move(signalArg); + interaction.end(event); + } else { + interaction.stop(); + } + + interaction.removePointer(event, event); + interaction.pointerIsDown = false; + return reflowPromise; +} + +var ___default_47 = { + id: 'reflow', + install: __install_47, + listeners: { + // remove completed reflow interactions + 'interactions:stop': function interactionsStop(_ref2, scope) { + var interaction = _ref2.interaction; + + if (interaction.pointerType === 'reflow') { + if (interaction._reflowResolve) { + interaction._reflowResolve(); + } + + _$index_58.arr.remove(scope.interactions.list, interaction); + } + } + } +}; +_$index_47["default"] = ___default_47; + +var _$interact_28 = {}; +"use strict"; + +function ___typeof_28(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_28 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_28 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_28(obj); } + +Object.defineProperty(_$interact_28, "__esModule", { + value: true +}); +_$interact_28["default"] = _$interact_28.scope = _$interact_28.interact = void 0; + +var ___scope_28 = _$scope_24({}); + +var ___browser_28 = ___interopRequireDefault_28(_$browser_50); + +var ___events_28 = ___interopRequireDefault_28(_$events_54); + +var __utils_28 = ___interopRequireWildcard_28(_$index_58); + +function ___getRequireWildcardCache_28() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_28 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_28(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_28(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_28(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___interopRequireDefault_28(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +/** @module interact */ +var globalEvents = {}; +var scope = new ___scope_28.Scope(); +/** + * ```js + * interact('#draggable').draggable(true) + * + * var rectables = interact('rect') + * rectables + * .gesturable(true) + * .on('gesturemove', function (event) { + * // ... + * }) + * ``` + * + * The methods of this variable can be used to set elements as interactables + * and also to change various default settings. + * + * Calling it as a function and passing an element or a valid CSS selector + * string returns an Interactable object which has various methods to configure + * it. + * + * @global + * + * @param {Element | string} target The HTML or SVG Element to interact with + * or CSS selector + * @return {Interactable} + */ + +_$interact_28.scope = scope; + +var interact = function interact(target, options) { + var interactable = scope.interactables.get(target, options); + + if (!interactable) { + interactable = scope.interactables["new"](target, options); + interactable.events.global = globalEvents; + } + + return interactable; +}; +/** + * Use a plugin + * + * @alias module:interact.use + * + * @param {Object} plugin + * @param {function} plugin.install + * @return {interact} + */ + + +_$interact_28.interact = interact; +interact.use = use; + +function use(plugin, options) { + scope.usePlugin(plugin, options); + return interact; +} +/** + * Check if an element or selector has been set with the {@link interact} + * function + * + * @alias module:interact.isSet + * + * @param {Element} element The Element being searched for + * @return {boolean} Indicates if the element or CSS selector was previously + * passed to interact + */ + + +interact.isSet = isSet; + +function isSet(target, options) { + return !!scope.interactables.get(target, options && options.context); +} +/** + * Add a global listener for an InteractEvent or adds a DOM event to `document` + * + * @alias module:interact.on + * + * @param {string | array | object} type The types of events to listen for + * @param {function} listener The function event (s) + * @param {object | boolean} [options] object or useCapture flag for + * addEventListener + * @return {object} interact + */ + + +interact.on = on; + +function on(type, listener, options) { + if (__utils_28.is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (__utils_28.is.array(type)) { + for (var _i = 0; _i < type.length; _i++) { + var _ref; + + _ref = type[_i]; + var eventType = _ref; + interact.on(eventType, listener, options); + } + + return interact; + } + + if (__utils_28.is.object(type)) { + for (var prop in type) { + interact.on(prop, type[prop], listener); + } + + return interact; + } // if it is an InteractEvent type, add listener to globalEvents + + + if ((0, ___scope_28.isNonNativeEvent)(type, scope.actions)) { + // if this type of event was never bound + if (!globalEvents[type]) { + globalEvents[type] = [listener]; + } else { + globalEvents[type].push(listener); + } + } // If non InteractEvent type, addEventListener to document + else { + ___events_28["default"].add(scope.document, type, listener, { + options: options + }); + } + + return interact; +} +/** + * Removes a global InteractEvent listener or DOM event from `document` + * + * @alias module:interact.off + * + * @param {string | array | object} type The types of events that were listened + * for + * @param {function} listener The listener function to be removed + * @param {object | boolean} options [options] object or useCapture flag for + * removeEventListener + * @return {object} interact + */ + + +interact.off = off; + +function off(type, listener, options) { + if (__utils_28.is.string(type) && type.search(' ') !== -1) { + type = type.trim().split(/ +/); + } + + if (__utils_28.is.array(type)) { + for (var _i2 = 0; _i2 < type.length; _i2++) { + var _ref2; + + _ref2 = type[_i2]; + var eventType = _ref2; + interact.off(eventType, listener, options); + } + + return interact; + } + + if (__utils_28.is.object(type)) { + for (var prop in type) { + interact.off(prop, type[prop], listener); + } + + return interact; + } + + if ((0, ___scope_28.isNonNativeEvent)(type, scope.actions)) { + var index; + + if (type in globalEvents && (index = globalEvents[type].indexOf(listener)) !== -1) { + globalEvents[type].splice(index, 1); + } + } else { + ___events_28["default"].remove(scope.document, type, listener, options); + } + + return interact; +} + +interact.debug = debug; + +function debug() { + return scope; +} // expose the functions used to calculate multi-touch properties + + +interact.getPointerAverage = __utils_28.pointer.pointerAverage; +interact.getTouchBBox = __utils_28.pointer.touchBBox; +interact.getTouchDistance = __utils_28.pointer.touchDistance; +interact.getTouchAngle = __utils_28.pointer.touchAngle; +interact.getElementRect = __utils_28.dom.getElementRect; +interact.getElementClientRect = __utils_28.dom.getElementClientRect; +interact.matchesSelector = __utils_28.dom.matchesSelector; +interact.closest = __utils_28.dom.closest; +/** + * @alias module:interact.supportsTouch + * + * @return {boolean} Whether or not the browser supports touch input + */ + +interact.supportsTouch = supportsTouch; + +function supportsTouch() { + return ___browser_28["default"].supportsTouch; +} +/** + * @alias module:interact.supportsPointerEvent + * + * @return {boolean} Whether or not the browser supports PointerEvents + */ + + +interact.supportsPointerEvent = supportsPointerEvent; + +function supportsPointerEvent() { + return ___browser_28["default"].supportsPointerEvent; +} +/** + * Cancels all interactions (end events are not fired) + * + * @alias module:interact.stop + * + * @return {object} interact + */ + + +interact.stop = __stop_28; + +function __stop_28() { + for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) { + var _ref3; + + _ref3 = scope.interactions.list[_i3]; + var interaction = _ref3; + interaction.stop(); + } + + return interact; +} +/** + * Returns or sets the distance the pointer must be moved before an action + * sequence occurs. This also affects tolerance for tap events. + * + * @alias module:interact.pointerMoveTolerance + * + * @param {number} [newValue] The movement from the start position must be greater than this value + * @return {interact | number} + */ + + +interact.pointerMoveTolerance = pointerMoveTolerance; + +function pointerMoveTolerance(newValue) { + if (__utils_28.is.number(newValue)) { + scope.interactions.pointerMoveTolerance = newValue; + return interact; + } + + return scope.interactions.pointerMoveTolerance; +} + +scope.addListeners({ + 'interactable:unset': function interactableUnset(_ref4) { + var interactable = _ref4.interactable; + scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1); // Stop related interactions when an Interactable is unset + + for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) { + var _ref5; + + _ref5 = scope.interactions.list[_i4]; + var interaction = _ref5; + + if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) { + interaction.stop(); + } + } + } +}); + +interact.addDocument = function (doc, options) { + return scope.addDocument(doc, options); +}; + +interact.removeDocument = function (doc) { + return scope.removeDocument(doc); +}; + +scope.interact = interact; +var ___default_28 = interact; +_$interact_28["default"] = ___default_28; + +var _$index_27 = {}; +"use strict"; + +function ___typeof_27(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_27 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_27 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_27(obj); } + +Object.defineProperty(_$index_27, "__esModule", { + value: true +}); +_$index_27.init = __init_27; +_$index_27["default"] = void 0; + +var actions = ___interopRequireWildcard_27(_$index_5); + +var _index2 = ___interopRequireDefault_27(_$index_7); + +var __autoStart_27 = ___interopRequireWildcard_27(_$index_12); + +var _interactablePreventDefault = ___interopRequireDefault_27(_$interactablePreventDefault_21); + +var _index4 = ___interopRequireDefault_27(_$index_25); + +var _index5 = ___interopRequireDefault_27(_$index_26); + +var ___base_27 = ___interopRequireDefault_27(_$base_32); + +var __modifiers_27 = ___interopRequireWildcard_27(_$index_33); + +var ___offset_27 = ___interopRequireDefault_27(_$index_41); + +var __pointerEvents_27 = ___interopRequireWildcard_27(_$index_45); + +var _index8 = ___interopRequireDefault_27(_$index_47); + +var _interact = ___interopRequireWildcard_27(_$interact_28); + +function ___interopRequireDefault_27(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_27() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_27 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_27(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_27(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_27(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function __init_27(window) { + _interact.scope.init(window); + + _interact["default"].use(_interactablePreventDefault["default"]); + + _interact["default"].use(___offset_27["default"]); // pointerEvents + + + _interact["default"].use(__pointerEvents_27); // inertia + + + _interact["default"].use(_index5["default"]); // snap, resize, etc. + + + _interact["default"].use(___base_27["default"]); // autoStart, hold + + + _interact["default"].use(__autoStart_27); // drag and drop, resize, gesture + + + _interact["default"].use(actions); // for backwrads compatibility + + + for (var type in __modifiers_27) { + var _modifiers = __modifiers_27[type], + _defaults = _modifiers._defaults, + _methods = _modifiers._methods; + _defaults._methods = _methods; + _interact.scope.defaults.perAction[type] = _defaults; + } // autoScroll + + + _interact["default"].use(_index2["default"]); // reflow + + + _interact["default"].use(_index8["default"]); // eslint-disable-next-line no-undef + + + if ("production" !== 'production') { + _interact["default"].use(_index4["default"]); + } + + return _interact["default"]; +} // eslint-disable-next-line no-undef + + +_interact["default"].version = "1.8.5"; +var ___default_27 = _interact["default"]; +_$index_27["default"] = ___default_27; + +var _$index_48 = {}; +/// +"use strict"; + +var _$grid_66 = {}; +"use strict"; + +Object.defineProperty(_$grid_66, "__esModule", { + value: true +}); +_$grid_66["default"] = void 0; + +function ___slicedToArray_66(arr, i) { return ___arrayWithHoles_66(arr) || ___iterableToArrayLimit_66(arr, i) || ___nonIterableRest_66(); } + +function ___nonIterableRest_66() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } + +function ___iterableToArrayLimit_66(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } + +function ___arrayWithHoles_66(arr) { if (Array.isArray(arr)) return arr; } + +function createGrid(grid) { + var coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(function (_ref) { + var _ref2 = ___slicedToArray_66(_ref, 2), + xField = _ref2[0], + yField = _ref2[1]; + + return xField in grid || yField in grid; + }); + + var gridFunc = function gridFunc(x, y) { + var range = grid.range, + _grid$limits = grid.limits, + limits = _grid$limits === void 0 ? { + left: -Infinity, + right: Infinity, + top: -Infinity, + bottom: Infinity + } : _grid$limits, + _grid$offset = grid.offset, + offset = _grid$offset === void 0 ? { + x: 0, + y: 0 + } : _grid$offset; + var result = { + range: range, + grid: grid, + x: null, + y: null + }; + + for (var _i2 = 0; _i2 < coordFields.length; _i2++) { + var _ref3; + + _ref3 = coordFields[_i2]; + + var _ref4 = _ref3, + _ref5 = ___slicedToArray_66(_ref4, 2), + xField = _ref5[0], + yField = _ref5[1]; + + var gridx = Math.round((x - offset.x) / grid[xField]); + var gridy = Math.round((y - offset.y) / grid[yField]); + result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * grid[xField] + offset.x)); + result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * grid[yField] + offset.y)); + } + + return result; + }; + + gridFunc.grid = grid; + gridFunc.coordFields = coordFields; + return gridFunc; +} + +var ___default_66 = createGrid; +_$grid_66["default"] = ___default_66; + +var _$index_67 = {}; +"use strict"; + +Object.defineProperty(_$index_67, "__esModule", { + value: true +}); +Object.defineProperty(_$index_67, "grid", { + enumerable: true, + get: function get() { + return _grid["default"]; + } +}); + +var _grid = ___interopRequireDefault_67(_$grid_66); + +function ___interopRequireDefault_67(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +var _$index_29 = {}; +"use strict"; + +Object.defineProperty(_$index_29, "__esModule", { + value: true +}); +_$index_29.init = __init_29; +_$index_29["default"] = void 0; + +var ___index_29 = ___interopRequireWildcard_29(_$index_27); + +var __modifiers_29 = ___interopRequireWildcard_29(_$index_33); + +_$index_48; + +var ___extend_29 = ___interopRequireDefault_29(_$extend_55); + +var snappers = ___interopRequireWildcard_29(_$index_67); + +function ___interopRequireDefault_29(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } + +function ___getRequireWildcardCache_29() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_29 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_29(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_29(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_29(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___typeof_29(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_29 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_29 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_29(obj); } + +if ((typeof window === "undefined" ? "undefined" : ___typeof_29(window)) === 'object' && !!window) { + __init_29(window); +} + +function __init_29(win) { + (0, ___index_29.init)(win); + return ___index_29["default"].use({ + id: 'interactjs', + install: function install() { + ___index_29["default"].modifiers = (0, ___extend_29["default"])({}, __modifiers_29); + ___index_29["default"].snappers = snappers; + ___index_29["default"].createSnapGrid = ___index_29["default"].snappers.grid; + } + }); +} + +var ___default_29 = ___index_29["default"]; +_$index_29["default"] = ___default_29; + +var _$index_69 = { exports: {} }; +"use strict"; + +Object.defineProperty(_$index_69.exports, "__esModule", { + value: true +}); +var _exportNames = {}; +_$index_69.exports["default"] = void 0; + +var ___index_69 = ___interopRequireWildcard_69(_$index_29); + +Object.keys(___index_69).forEach(function (key) { + if (key === "default" || key === "__esModule") return; + if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; + Object.defineProperty(_$index_69.exports, key, { + enumerable: true, + get: function get() { + return ___index_69[key]; + } + }); +}); + +function ___getRequireWildcardCache_69() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); ___getRequireWildcardCache_69 = function _getRequireWildcardCache() { return cache; }; return cache; } + +function ___interopRequireWildcard_69(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || ___typeof_69(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = ___getRequireWildcardCache_69(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } + +function ___typeof_69(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_69 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_69 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_69(obj); } + +if (("object" === "undefined" ? "undefined" : ___typeof_69(_$index_69)) === 'object' && !!_$index_69) { + try { + _$index_69.exports = ___index_69["default"]; + } catch (_unused) {} +} + +___index_69["default"]["default"] = ___index_69["default"] // tslint:disable-line no-string-literal +; +___index_69["default"].init = ___index_69.init; // tslint:disable-line no-string-literal + +var ___default_69 = ___index_69["default"]; +_$index_69.exports["default"] = ___default_69; + +_$index_69 = _$index_69.exports +return _$index_69; + +}); + + +//# sourceMappingURL=interact.js.map diff --git a/interactjs/dist/interact.js.map b/interactjs/dist/interact.js.map new file mode 100644 index 000000000..f43e372c0 --- /dev/null +++ b/interactjs/dist/interact.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["../scripts/header.js","../node_modules/browser-pack-flat/_prelude","../@interactjs/core/Interactable.ts","../@interactjs/core/scope.ts","../@interactjs/core/interactions.ts","../@interactjs/utils/isWindow.ts","../@interactjs/utils/window.ts","../@interactjs/utils/is.ts","../@interactjs/actions/drag.ts","../@interactjs/utils/arr.ts","../@interactjs/utils/domObjects.ts","../@interactjs/utils/browser.ts","../@interactjs/utils/clone.ts","../@interactjs/utils/domUtils.ts","../@interactjs/utils/pointerExtend.ts","../@interactjs/utils/hypot.ts","../@interactjs/utils/pointerUtils.ts","../@interactjs/utils/events.ts","../@interactjs/utils/extend.ts","../@interactjs/utils/normalizeListeners.ts","../@interactjs/core/Eventable.ts","../@interactjs/utils/rect.ts","../@interactjs/utils/getOriginXY.ts","../@interactjs/utils/raf.ts","../@interactjs/utils/index.ts","../@interactjs/core/defaultOptions.ts","../@interactjs/core/InteractableSet.ts","../@interactjs/core/BaseEvent.ts","../@interactjs/core/InteractEvent.ts","../@interactjs/core/PointerInfo.ts","../@interactjs/core/Interaction.ts","../@interactjs/core/interactionFinder.ts","../@interactjs/actions/drop/DropEvent.ts","../@interactjs/actions/drop/index.ts","../@interactjs/actions/gesture.ts","../@interactjs/actions/resize.ts","../@interactjs/actions/index.ts","../@interactjs/auto-scroll/index.ts","../@interactjs/auto-start/InteractableMethods.ts","../@interactjs/auto-start/base.ts","../@interactjs/auto-start/dragAxis.ts","../@interactjs/auto-start/hold.ts","../@interactjs/auto-start/index.ts","../@interactjs/core/interactablePreventDefault.ts","../@interactjs/dev-tools/index.ts","../@interactjs/modifiers/Modification.ts","../@interactjs/modifiers/base.ts","../@interactjs/offset/index.ts","../@interactjs/inertia/index.ts","../@interactjs/modifiers/aspectRatio.ts","../@interactjs/modifiers/restrict/pointer.ts","../@interactjs/modifiers/restrict/edges.ts","../@interactjs/modifiers/restrict/rect.ts","../@interactjs/modifiers/restrict/size.ts","../@interactjs/modifiers/snap/pointer.ts","../@interactjs/modifiers/snap/size.ts","../@interactjs/modifiers/snap/edges.ts","../@interactjs/modifiers/index.ts","../@interactjs/pointer-events/PointerEvent.ts","../@interactjs/pointer-events/base.ts","../@interactjs/pointer-events/holdRepeat.ts","../@interactjs/pointer-events/interactableTargets.ts","../@interactjs/pointer-events/index.ts","../@interactjs/reflow/index.ts","../@interactjs/interact/interact.ts","../@interactjs/interact/index.ts","../@interactjs/types/index.ts","../@interactjs/utils/snappers/grid.ts","../@interactjs/utils/snappers/index.ts","../@interactjs/interactjs/index.ts","index.ts","../node_modules/browser-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C,EAA4C;EAC1C,IAAI;IAAE,kBAAA,GAAiB,WAAA,CAAA,SAAA,CAAjB,CAAA;GAAN,CACA,OAAA,OAAA,EAAM,EAAE;CACT;;AAEA,WAAA,CAAA,SAAA,CAAD,CAAA,SAAA,CAAA,GAA4B,WAAA,CAAA,SAAA,CAA5B;CAAA;AACE,WAAA,CAAA,SAAA,CAAD,CAAkB,IAAlB,GAAyB,WAAA,CAAA,IAAzB;;oBAEc,WAAA,CAAA,SAAA;;;ACXf;AACA;AACA;AACA;AACA","file":"interact.js","sourceRoot":"","sourcesContent":["/**\n * interact.js 1.8.5\n *\n * Copyright (c) 2012-2020 Taye Adeyemi \n * Released under the MIT License.\n * https://raw.github.com/taye/interact.js/master/LICENSE\n */\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.interact = f()}})(function(){var define,module,exports;\nvar createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}};\n","import * as arr from '@interactjs/utils/arr'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\nimport { ActionDefaults, Defaults, Options } from './defaultOptions'\nimport Eventable from './Eventable'\nimport { Actions, isNonNativeEvent } from './scope'\n\ntype IgnoreValue = string | Interact.Element | boolean\n\n/** */\nexport class Interactable implements Partial {\n protected get _defaults (): Defaults {\n return {\n base: {},\n perAction: {},\n actions: {} as ActionDefaults,\n }\n }\n\n readonly options!: Required\n readonly _actions: Actions\n readonly target: Interact.Target\n readonly events = new Eventable()\n readonly _context: Document | Interact.Element\n readonly _win: Window\n readonly _doc: Document\n\n /** */\n constructor (target: Interact.Target, options: any, defaultContext: Document | Interact.Element) {\n this._actions = options.actions\n this.target = target\n this._context = options.context || defaultContext\n this._win = getWindow(trySelector(target) ? this._context : target)\n this._doc = this._win.document\n\n this.set(options)\n }\n\n setOnEvents (actionName: Interact.ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) { this.on(`${actionName}start`, phases.onstart) }\n if (is.func(phases.onmove)) { this.on(`${actionName}move`, phases.onmove) }\n if (is.func(phases.onend)) { this.on(`${actionName}end`, phases.onend) }\n if (is.func(phases.oninertiastart)) { this.on(`${actionName}inertiastart`, phases.oninertiastart) }\n\n return this\n }\n\n updatePerActionListeners (actionName: Interact.ActionName, prev: Interact.Listeners, cur: Interact.Listeners) {\n if (is.array(prev) || is.object(prev)) {\n this.off(actionName, prev)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this.on(actionName, cur)\n }\n }\n\n setPerAction (actionName: Interact.ActionName, options: Interact.OrBoolean) {\n const defaults = this._defaults\n\n // for all the default per-action options\n for (const optionName_ in options) {\n const optionName = optionName_ as keyof Interact.PerActionDefaults\n const actionOptions = this.options[actionName]\n const optionValue: any = options[optionName]\n\n // remove old event listeners and add new ones\n if (optionName === 'listeners') {\n this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue as Interact.Listeners)\n }\n\n // if the option value is an array\n if (is.array(optionValue)) {\n (actionOptions[optionName] as any) = arr.from(optionValue)\n }\n // if the option value is an object\n else if (is.plainObject(optionValue)) {\n // copy the object\n (actionOptions[optionName] as any) = extend(\n actionOptions[optionName] || {} as any,\n clone(optionValue))\n\n // set anabled field to true if it exists in the defaults\n if (is.object(defaults.perAction[optionName]) && 'enabled' in (defaults.perAction[optionName] as any)) {\n (actionOptions[optionName] as any).enabled = optionValue.enabled !== false\n }\n }\n // if the option value is a boolean and the default is an object\n else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {\n (actionOptions[optionName] as any).enabled = optionValue\n }\n // if it's anything else, do a plain assignment\n else {\n (actionOptions[optionName] as any) = optionValue\n }\n }\n }\n\n /**\n * The default function to get an Interactables bounding rect. Can be\n * overridden using {@link Interactable.rectChecker}.\n *\n * @param {Element} [element] The element to measure.\n * @return {object} The object's bounding rectangle.\n */\n getRect (element: Interact.Element) {\n element = element || (is.element(this.target)\n ? this.target\n : null)\n\n if (is.string(this.target)) {\n element = element || this._context.querySelector(this.target)\n }\n\n return getElementRect(element)\n }\n\n /**\n * Returns or sets the function used to calculate the interactable's\n * element's rectangle\n *\n * @param {function} [checker] A function which returns this Interactable's\n * bounding rectangle. See {@link Interactable.getRect}\n * @return {function | object} The checker function or this Interactable\n */\n rectChecker (checker: (element: Interact.Element) => any) {\n if (is.func(checker)) {\n this.getRect = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof Interact.Options, newValue: any) {\n if (trySelector(newValue) || is.object(newValue)) {\n (this.options[optionName] as any) = newValue\n\n for (const action in this._actions.map) {\n (this.options[action][optionName] as any) = newValue\n }\n\n return this\n }\n\n return this.options[optionName]\n }\n\n /**\n * Gets or sets the origin of the Interactable's element. The x and y\n * of the origin will be subtracted from action event coordinates.\n *\n * @param {Element | object | string} [origin] An HTML or SVG Element whose\n * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\n * or any CSS selector\n *\n * @return {object} The current origin or this Interactable\n */\n origin (newValue: any) {\n return this._backCompatOption('origin', newValue)\n }\n\n /**\n * Returns or sets the mouse coordinate types used to calculate the\n * movement of the pointer.\n *\n * @param {string} [newValue] Use 'client' if you will be scrolling while\n * interacting; Use 'page' if you want autoScroll to work\n * @return {string | object} The current deltaSource or this Interactable\n */\n deltaSource (newValue?: string) {\n if (newValue === 'page' || newValue === 'client') {\n this.options.deltaSource = newValue\n\n return this\n }\n\n return this.options.deltaSource\n }\n\n /**\n * Gets the selector context Node of the Interactable. The default is\n * `window.document`.\n *\n * @return {Node} The context Node of this Interactable\n */\n context () {\n return this._context\n }\n\n inContext (element: Document | Node) {\n return (this._context === element.ownerDocument ||\n nodeContains(this._context, element))\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Interact.EventTarget,\n ) {\n return (!this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget))\n }\n\n testAllow (\n this: Interactable,\n allowFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!allowFrom) { return true }\n\n if (!is.element(element)) { return false }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n }\n else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (\n this: Interactable,\n ignoreFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!ignoreFrom || !is.element(element)) { return false }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\n }\n else if (is.element(ignoreFrom)) {\n return nodeContains(ignoreFrom, element)\n }\n\n return false\n }\n\n /**\n * Calls listeners for the given InteractEvent type bound globally\n * and directly to this Interactable\n *\n * @param {InteractEvent} iEvent The InteractEvent object to be fired on this\n * Interactable\n * @return {Interactable} this Interactable\n */\n fire (iEvent: object) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const addRemove = method === 'on' ? 'add' : 'remove'\n const listeners = normalizeListeners(typeArg, listenerArg)\n\n for (let type in listeners) {\n if (type === 'wheel') { type = browser.wheelEvent }\n\n for (const listener of listeners[type]) {\n // if it is an action event type\n if (isNonNativeEvent(type, this._actions)) {\n this.events[method](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n events[`${addRemove}Delegate` as 'addDelegate' | 'removeDelegate'](this.target, this._context, type, listener, options)\n }\n // remove listener from this Interactable's element\n else {\n (events[addRemove] as typeof events.remove)(this.target, type, listener, options)\n }\n }\n }\n\n return this\n }\n\n /**\n * Binds a listener for an InteractEvent, pointerEvent or DOM event.\n *\n * @param {string | array | object} types The types of events to listen\n * for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * addEventListener\n * @return {Interactable} This Interactable\n */\n on (types: Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('on', types, listener, options)\n }\n\n /**\n * Removes an InteractEvent, pointerEvent or DOM event listener.\n *\n * @param {string | array | object} types The types of events that were\n * listened for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * removeEventListener\n * @return {Interactable} This Interactable\n */\n off (types: string | string[] | Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('off', types, listener, options)\n }\n\n /**\n * Reset the options of this Interactable\n *\n * @param {object} options The new settings to apply\n * @return {object} This Interactable\n */\n set (options: Interact.OptionsArg) {\n const defaults = this._defaults\n\n if (!is.object(options)) {\n options = {}\n }\n\n (this.options as Required) = clone(defaults.base) as Required\n\n for (const actionName_ in this._actions.methodDict) {\n const actionName = actionName_ as Interact.ActionName\n const methodName = this._actions.methodDict[actionName]\n\n this.options[actionName] = {}\n this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))\n\n this[methodName](options[actionName])\n }\n\n for (const setting in options) {\n if (is.func(this[setting])) {\n this[setting](options[setting])\n }\n }\n\n return this\n }\n\n /**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n *\n * @return {interact}\n */\n unset () {\n events.remove(this.target as Node, 'all')\n\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in events.delegatedEvents) {\n const delegated = events.delegatedEvents[type]\n\n if (delegated.selectors[0] === this.target &&\n delegated.contexts[0] === this._context) {\n delegated.selectors.splice(0, 1)\n delegated.contexts.splice(0, 1)\n delegated.listeners.splice(0, 1)\n }\n\n events.remove(this._context, type, events.delegateListener)\n events.remove(this._context, type, events.delegateUseCapture, true)\n }\n }\n else {\n events.remove(this.target as Node, 'all')\n }\n }\n}\n\nexport default Interactable\n","import domObjects from '@interactjs/utils/domObjects'\nimport * as utils from '@interactjs/utils/index'\nimport defaults from './defaultOptions'\nimport Eventable from './Eventable'\nimport InteractableBase from './Interactable'\nimport InteractableSet from './InteractableSet'\nimport InteractEvent, { PhaseMap } from './InteractEvent'\nimport interactions from './interactions'\n\nexport interface SignalArgs {\n 'scope:add-document': DocSignalArg\n 'scope:remove-document': DocSignalArg\n 'interactable:unset': { interactable: InteractableBase }\n 'interactable:set': { interactable: InteractableBase, options: Interact.Options }\n 'interactions:destroy': { interaction: Interact.Interaction }\n}\n\nexport type ListenerName = keyof SignalArgs\n\nexport type ListenerMap = {\n [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean\n}\n\ninterface DocSignalArg {\n doc: Document\n window: Window\n scope: Scope\n options?: { [index: string]: any }\n}\n\nconst {\n win,\n browser,\n raf,\n events,\n} = utils\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionMap { // tslint:disable-line no-empty-interface\n}\n\nexport type ActionName = keyof ActionMap\n\nexport interface Actions {\n map: ActionMap\n phases: PhaseMap\n methodDict: { [P in ActionName]?: string }\n phaselessTypes: { [type: string]: true }\n}\n\nexport function createScope () {\n return new Scope()\n}\n\nexport type Defaults = typeof defaults\n\nexport interface Plugin {\n [key: string]: any\n id?: string\n listeners?: ListenerMap\n before?: string[]\n install? (scope: Scope, options?: any): void\n}\n\nexport class Scope {\n id = `__interact_scope_${Math.floor(Math.random() * 100)}`\n listenerMaps: Array<{\n map: ListenerMap\n id: string\n }> = []\n\n browser = browser\n events = events\n utils = utils\n defaults: Defaults = utils.clone(defaults) as Defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {},\n phaselessTypes: {},\n }\n\n InteractEvent = InteractEvent\n Interactable!: typeof InteractableBase\n interactables = new InteractableSet(this)\n\n // main window\n _win!: Window\n\n // main document\n document!: Document\n\n // main window\n window!: Window\n\n // all documents being listened to\n documents: Array<{ doc: Document, options: any }> = []\n\n _plugins: {\n list: Plugin[]\n map: { [id: string]: Plugin }\n } = {\n list: [],\n map: {},\n }\n\n constructor () {\n const scope = this as Scope\n\n ;(this as { Interactable: typeof InteractableBase }).Interactable = class Interactable extends InteractableBase implements InteractableBase {\n get _defaults () { return scope.defaults }\n\n set (options: Interact.Options) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset () {\n super.unset()\n for (let i = scope.interactions.list.length - 1; i >= 0; i--) {\n const interaction = scope.interactions.list[i]\n\n if (interaction.interactable === this) {\n interaction.stop()\n scope.fire('interactions:destroy', { interaction })\n interaction.destroy()\n\n if (scope.interactions.list.length > 2) {\n scope.interactions.list.splice(i, 1)\n }\n }\n }\n\n scope.fire('interactable:unset', { interactable: this })\n }\n }\n }\n\n addListeners (map: ListenerMap, id?: string) {\n this.listenerMaps.push({ id, map })\n }\n\n fire (name: T, arg: SignalArgs[T]): void | false {\n for (const { map: { [name]: listener } } of this.listenerMaps) {\n if (!!listener && listener(arg as any, this, name as never) === false) {\n return false\n }\n }\n }\n\n onWindowUnload = (event: BeforeUnloadEvent) => this.removeDocument(event.target as Document)\n\n init (window: Window) {\n return initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) { this._plugins.map[plugin.id] = plugin }\n this._plugins.list.push(plugin)\n\n if (plugin.install) {\n plugin.install(this, options)\n }\n\n if (plugin.listeners && plugin.before) {\n let index = 0\n const len = this.listenerMaps.length\n const before = plugin.before.reduce((acc, id) => {\n acc[id] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (before[otherId]) { break }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\n }\n else if (plugin.listeners) {\n this.listenerMaps.push({ id: plugin.id, map: plugin.listeners })\n }\n\n return this\n }\n\n addDocument (doc: Document, options?: any): void | false {\n // do nothing if document is already known\n if (this.getDocIndex(doc) !== -1) { return false }\n\n const window = win.getWindow(doc)\n\n options = options ? utils.extend({}, options) : {}\n\n this.documents.push({ doc, options })\n events.documents.push(doc)\n\n // don't add an unload event for the main document\n // so that the page may be cached in browser history\n if (doc !== this.document) {\n events.add(window, 'unload', this.onWindowUnload)\n }\n\n this.fire('scope:add-document', { doc, window, scope: this, options })\n }\n\n removeDocument (doc: Document) {\n const index = this.getDocIndex(doc)\n\n const window = win.getWindow(doc)\n const options = this.documents[index].options\n\n events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n events.documents.splice(index, 1)\n\n this.fire('scope:remove-document', { doc, window, scope: this, options })\n }\n\n getDocIndex (doc: Document) {\n for (let i = 0; i < this.documents.length; i++) {\n if (this.documents[i].doc === doc) {\n return i\n }\n }\n\n return -1\n }\n\n getDocOptions (doc: Document) {\n const docIndex = this.getDocIndex(doc)\n\n return docIndex === -1 ? null : this.documents[docIndex].options\n }\n\n now () {\n return ((this.window as any).Date as typeof Date || Date).now()\n }\n}\n\nexport function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) { return true }\n\n for (const name in actions.map) {\n if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) {\n return true\n }\n }\n\n return false\n}\n\nexport function initScope (scope: Scope, window: Window) {\n win.init(window)\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n events.init(window)\n\n scope.usePlugin(interactions)\n scope.document = window.document\n scope.window = window\n\n return scope\n}\n","import browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport InteractionBase from './Interaction'\nimport finder, { SearchDetails } from './interactionFinder'\nimport { Scope } from './scope'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: InteractionBase[]\n listeners: { [type: string]: Interact.Listener }\n docEvents: Array<{ type: string, listener: Interact.Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown', 'pointerMove', 'pointerUp',\n 'updatePointer', 'removePointer', 'windowBlur',\n]\n\nfunction install (scope: Scope) {\n const listeners = {} as any\n\n for (const method of methodNames) {\n listeners[method] = doOnInteractions(method, scope)\n }\n\n const pEventTypes = browser.pEventTypes\n let docEvents: typeof scope.interactions.docEvents\n\n if (domObjects.PointerEvent) {\n docEvents = [\n { type: pEventTypes.down, listener: releasePointersOnRemovedEls },\n { type: pEventTypes.down, listener: listeners.pointerDown },\n { type: pEventTypes.move, listener: listeners.pointerMove },\n { type: pEventTypes.up, listener: listeners.pointerUp },\n { type: pEventTypes.cancel, listener: listeners.pointerUp },\n ]\n }\n else {\n docEvents = [\n { type: 'mousedown', listener: listeners.pointerDown },\n { type: 'mousemove', listener: listeners.pointerMove },\n { type: 'mouseup', listener: listeners.pointerUp },\n\n { type: 'touchstart', listener: releasePointersOnRemovedEls },\n { type: 'touchstart', listener: listeners.pointerDown },\n { type: 'touchmove', listener: listeners.pointerMove },\n { type: 'touchend', listener: listeners.pointerUp },\n { type: 'touchcancel', listener: listeners.pointerUp },\n ]\n }\n\n docEvents.push({\n type: 'blur',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n interaction.documentBlur(event)\n }\n },\n })\n\n // for ignoring browser's simulated mouse events\n scope.prevTouchTime = 0\n\n scope.Interaction = class Interaction extends InteractionBase {\n get pointerMoveTolerance () {\n return scope.interactions.pointerMoveTolerance\n }\n\n set pointerMoveTolerance (value) {\n scope.interactions.pointerMoveTolerance = value\n }\n\n _now () { return scope.now() }\n }\n\n scope.interactions = {\n // all active and idle interactions\n list: [],\n new (options: { pointerType?: string, scopeFire?: Scope['fire'] }) {\n options.scopeFire = (name, arg) => scope.fire(name, arg)\n\n const interaction = new scope.Interaction(options as Required)\n\n scope.interactions.list.push(interaction)\n return interaction\n },\n listeners,\n docEvents,\n pointerMoveTolerance: 1,\n }\n\n function releasePointersOnRemovedEls () {\n // for all inactive touch interactions with pointers down\n for (const interaction of scope.interactions.list) {\n if (!interaction.pointerIsDown ||\n interaction.pointerType !== 'touch' ||\n interaction._interacting) {\n continue\n }\n\n // if a pointer is down on an element that is no longer in the DOM tree\n for (const pointer of interaction.pointers) {\n if (!scope.documents.some(({ doc }) => nodeContains(doc, pointer.downTarget))) {\n // remove the pointer from the interaction\n interaction.removePointer(pointer.pointer, pointer.event)\n }\n }\n }\n }\n}\n\nfunction doOnInteractions (method, scope) {\n return function (event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n for (const changedTouch of event.changedTouches) {\n const pointer = changedTouch\n const pointerId = pointerUtils.getPointerId(pointer)\n const searchDetails: SearchDetails = {\n pointer,\n pointerId,\n pointerType,\n eventType: event.type,\n eventTarget,\n curEventTarget,\n scope,\n }\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n else {\n let invalidPointer = false\n\n if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {\n // ignore mouse events while touch interactions are active\n for (let i = 0; i < interactions.length && !invalidPointer; i++) {\n invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown\n }\n\n // try to ignore mouse events that are simulated by the browser\n // after a touch event\n invalidPointer = invalidPointer ||\n (scope.now() - scope.prevTouchTime < 500) ||\n // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated\n event.timeStamp === 0\n }\n\n if (!invalidPointer) {\n const searchDetails = {\n pointer: event,\n pointerId: pointerUtils.getPointerId(event),\n pointerType,\n eventType: event.type,\n curEventTarget,\n eventTarget,\n scope,\n }\n\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n\n // eslint-disable-next-line no-shadow\n for (const [pointer, eventTarget, curEventTarget, interaction] of matches) {\n interaction[method](pointer, event, eventTarget, curEventTarget)\n }\n }\n}\n\nfunction getInteraction (searchDetails: SearchDetails) {\n const { pointerType, scope } = searchDetails\n\n const foundInteraction = finder.search(searchDetails)\n const signalArg = { interaction: foundInteraction, searchDetails }\n\n scope.fire('interactions:find', signalArg)\n\n return signalArg.interaction || scope.interactions.new({ pointerType })\n}\n\nfunction onDocSignal ({ doc, scope, options }: Interact.SignalArgs[T], eventMethodName: 'add' | 'remove') {\n const { docEvents } = scope.interactions\n const eventMethod = events[eventMethodName]\n\n if (scope.browser.isIOS && !options.events) {\n options.events = { passive: false }\n }\n\n // delegate event listener\n for (const eventType in events.delegatedEvents) {\n eventMethod(doc, eventType, events.delegateListener)\n eventMethod(doc, eventType, events.delegateUseCapture, true)\n }\n\n const eventOptions = options && options.events\n\n for (const { type, listener } of docEvents) {\n eventMethod(doc, type, listener, eventOptions)\n }\n}\n\nexport default {\n id: 'core/interactions',\n install,\n listeners: {\n 'scope:add-document': arg => onDocSignal(arg, 'add'),\n 'scope:remove-document': arg => onDocSignal(arg, 'remove'),\n },\n onDocSignal,\n doOnInteractions,\n methodNames,\n}\n","export default (thing: any) => !!(thing && thing.Window) && (thing instanceof thing.Window)\n","import isWindow from './isWindow'\n\nconst win = {\n realWindow: undefined as Window,\n window: undefined as Window,\n getWindow,\n init,\n}\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n win.realWindow = window\n\n // create a TextNode\n const el = window.document.createTextNode('')\n\n // check if it's wrapped by a polyfill\n if (el.ownerDocument !== window.document &&\n typeof window.wrap === 'function' &&\n window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win.window = window\n}\n\nif (typeof window === 'undefined') {\n win.window = undefined\n win.realWindow = undefined\n}\nelse {\n init(window)\n}\n\nexport function getWindow (node: any) {\n if (isWindow(node)) {\n return node\n }\n\n const rootNode = (node.ownerDocument || node)\n\n return rootNode.defaultView || win.window\n}\n\nwin.init = init\n\nexport default win\n","// tslint:disable variable-name\n\nimport isWindow from './isWindow'\nimport win from './window'\n\nexport const window = (thing: any): thing is Window =>\n thing === win.window || isWindow(thing)\n\nexport const docFrag = (thing: any): thing is DocumentFragment =>\n object(thing) && thing.nodeType === 11\n\nexport const object = (thing: any): thing is { [index: string]: any } =>\n !!thing && (typeof thing === 'object')\n\nexport const func = (thing: any): thing is (...args: any[]) => any =>\n typeof thing === 'function'\n\nexport const number = (thing: any): thing is number =>\n typeof thing === 'number'\n\nexport const bool = (thing: any): thing is boolean =>\n typeof thing === 'boolean'\n\nexport const string = (thing: any): thing is string =>\n typeof thing === 'string'\n\nexport const element = (thing: any): thing is Interact.Element => {\n if (!thing || (typeof thing !== 'object')) { return false }\n\n const _window = win.getWindow(thing) || win.window\n\n return (/object|function/.test(typeof _window.Element)\n ? thing instanceof _window.Element // DOM2\n : thing.nodeType === 1 && typeof thing.nodeName === 'string')\n}\n\nexport const plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) &&\n !!thing.constructor &&\n /function Object\\b/.test(thing.constructor.toString())\n\nexport const array = (thing: any): thing is T[] =>\n (object(thing) &&\n (typeof thing.length !== 'undefined') &&\n func(thing.splice))\n","import { Scope } from '@interactjs/core/scope'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n drag: Interact.DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = Interact.InteractEvent<'drag'>\n\nexport type DraggableMethod = Interact.ActionMethod\n\nfunction install (scope: Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n Interactable.prototype.draggable = drag.draggable\n\n actions.map.drag = drag\n actions.methodDict.drag = 'draggable'\n\n defaults.actions.drag = drag.defaults\n}\n\nfunction beforeMove ({ interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x') {\n interaction.coords.cur.page.y = interaction.coords.start.page.y\n interaction.coords.cur.client.y = interaction.coords.start.client.y\n\n interaction.coords.velocity.client.y = 0\n interaction.coords.velocity.page.y = 0\n }\n else if (axis === 'y') {\n interaction.coords.cur.page.x = interaction.coords.start.page.x\n interaction.coords.cur.client.x = interaction.coords.start.client.x\n\n interaction.coords.velocity.client.x = 0\n interaction.coords.velocity.page.x = 0\n }\n}\n\nfunction move ({ iEvent, interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x' || axis === 'y') {\n const opposite = axis === 'x' ? 'y' : 'x'\n\n iEvent.page[opposite] = interaction.coords.start.page[opposite]\n iEvent.client[opposite] = interaction.coords.start.client[opposite]\n iEvent.delta[opposite] = 0\n }\n}\n\n/**\n * ```js\n * interact(element).draggable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // the axis in which the first movement must be\n * // for the drag sequence to start\n * // 'xy' by default - any direction\n * startAxis: 'x' || 'y' || 'xy',\n *\n * // 'xy' by default - don't restrict to one axis (move in any direction)\n * // 'x' or 'y' to restrict movement to either axis\n * // 'start' to restrict movement to the axis the drag started in\n * lockAxis: 'x' || 'y' || 'xy' || 'start',\n *\n * // max number of drags that can happen concurrently\n * // with elements of this Interactable. Infinity by default\n * max: Infinity,\n *\n * // max number of drags that can target the same element+Interactable\n * // 1 by default\n * maxPerElement: 2\n * })\n *\n * var isDraggable = interact('element').draggable(); // true\n * ```\n *\n * Get or set whether drag actions can be performed on the target\n *\n * @alias Interactable.prototype.draggable\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on drag events (object makes the Interactable\n * draggable)\n * @return {boolean | Interactable} boolean indicating if this can be the\n * target of drag events, or this Interctable\n */\nconst draggable: DraggableMethod = function draggable (this: Interact.Interactable, options?: Interact.DraggableOptions | boolean): any {\n if (is.object(options)) {\n this.options.drag.enabled = options.enabled !== false\n this.setPerAction('drag', options)\n this.setOnEvents('drag', options)\n\n if (/^(xy|x|y|start)$/.test(options.lockAxis)) {\n this.options.drag.lockAxis = options.lockAxis\n }\n if (/^(xy|x|y)$/.test(options.startAxis)) {\n this.options.drag.startAxis = options.startAxis\n }\n\n return this\n }\n\n if (is.bool(options)) {\n this.options.drag.enabled = options\n\n return this\n }\n\n return this.options.drag\n}\n\nconst drag: Interact.Plugin = {\n id: 'actions/drag',\n install,\n listeners: {\n 'interactions:before-action-move': beforeMove,\n 'interactions:action-resume': beforeMove,\n\n // dragmove\n 'interactions:action-move': move,\n 'auto-start:check': arg => {\n const { interaction, interactable, buttons } = arg\n const dragOptions = interactable.options.drag\n\n if (\n !(dragOptions && dragOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & interactable.options.drag.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n arg.action = {\n name: 'drag',\n axis: (dragOptions.lockAxis === 'start'\n ? dragOptions.startAxis\n : dragOptions.lockAxis),\n }\n\n return false\n },\n },\n draggable,\n beforeMove,\n move,\n defaults: {\n startAxis : 'xy',\n lockAxis : 'xy',\n } as Interact.DropzoneOptions,\n\n getCursor () {\n return 'move'\n },\n}\n\nexport default drag\n","type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport function contains (array: T[], target: T) {\n return array.indexOf(target) !== -1\n}\n\nexport function remove (array: T[], target: T) {\n return array.splice(array.indexOf(target), 1)\n}\n\nexport function merge (target: Array, source: U[]) {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport function from (source: ArrayLike) {\n return merge([] as T[], source as T[])\n}\n\nexport function findIndex (array: T[], func: Filter) {\n for (let i = 0; i < array.length; i++) {\n if (func(array[i], i, array)) {\n return i\n }\n }\n\n return -1\n}\n\nexport function find (array: T[], func: Filter) {\n return array[findIndex(array, func)]\n}\n","const domObjects: {\n init: any\n document: Document\n DocumentFragment: typeof DocumentFragment\n SVGElement: typeof SVGElement\n SVGSVGElement: typeof SVGSVGElement\n SVGElementInstance: any\n Element: typeof Element\n HTMLElement: typeof HTMLElement\n Event: typeof Event\n Touch: typeof Touch\n PointerEvent: typeof PointerEvent\n} =\n{\n init,\n document: null,\n DocumentFragment: null,\n SVGElement: null,\n SVGSVGElement: null,\n SVGElementInstance: null,\n Element: null,\n HTMLElement: null,\n Event: null,\n Touch: null,\n PointerEvent: null,\n}\n\nfunction blank () {}\n\nexport default domObjects\n\nfunction init (window: Window) {\n const win = window as any\n\n domObjects.document = win.document\n domObjects.DocumentFragment = win.DocumentFragment || blank\n domObjects.SVGElement = win.SVGElement || blank\n domObjects.SVGSVGElement = win.SVGSVGElement || blank\n domObjects.SVGElementInstance = win.SVGElementInstance || blank\n domObjects.Element = win.Element || blank\n domObjects.HTMLElement = win.HTMLElement || domObjects.Element\n\n domObjects.Event = win.Event\n domObjects.Touch = win.Touch || blank\n domObjects.PointerEvent = (win.PointerEvent || win.MSPointerEvent)\n}\n","import domObjects from './domObjects'\nimport * as is from './is'\nimport win from './window'\n\nconst browser = {\n init,\n supportsTouch: null as boolean,\n supportsPointerEvent: null as boolean,\n isIOS7: null as boolean,\n isIOS: null as boolean,\n isIe9: null as boolean,\n isOperaMobile: null as boolean,\n prefixedMatchesSelector: null as string,\n pEventTypes: null as {\n up: string\n down: string\n over: string\n out: string\n move: string\n cancel: string\n },\n wheelEvent: null as string,\n}\n\nfunction init (window: any) {\n const Element = domObjects.Element\n const navigator = win.window.navigator\n\n // Does the browser support touch input?\n browser.supportsTouch = ('ontouchstart' in window) ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!domObjects.PointerEvent\n\n browser.isIOS = (/iP(hone|od|ad)/.test(navigator.platform))\n\n // scrolling doesn't change the result of getClientRects on iOS 7\n browser.isIOS7 = (/iP(hone|od|ad)/.test(navigator.platform) &&\n /OS 7[^\\d]/.test(navigator.appVersion))\n\n browser.isIe9 = /MSIE 9/.test(navigator.userAgent)\n\n // Opera Mobile must be handled differently\n browser.isOperaMobile = (navigator.appName === 'Opera' &&\n browser.supportsTouch &&\n /Presto/.test(navigator.userAgent))\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = 'matches' in Element.prototype\n ? 'matches'\n : 'webkitMatchesSelector' in Element.prototype\n ? 'webkitMatchesSelector'\n : 'mozMatchesSelector' in Element.prototype\n ? 'mozMatchesSelector'\n : 'oMatchesSelector' in Element.prototype\n ? 'oMatchesSelector'\n : 'msMatchesSelector'\n\n browser.pEventTypes = (browser.supportsPointerEvent\n ? (domObjects.PointerEvent === window.MSPointerEvent\n ? {\n up: 'MSPointerUp',\n down: 'MSPointerDown',\n over: 'mouseover',\n out: 'mouseout',\n move: 'MSPointerMove',\n cancel: 'MSPointerCancel',\n }\n : {\n up: 'pointerup',\n down: 'pointerdown',\n over: 'pointerover',\n out: 'pointerout',\n move: 'pointermove',\n cancel: 'pointercancel',\n })\n : null)\n\n // because Webkit and Opera still use 'mousewheel' event type\n browser.wheelEvent = 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n","import * as arr from './arr'\nimport * as is from './is'\n\n// tslint:disable-next-line ban-types\nexport default function clone (source: T): Partial {\n const dest = {} as Partial\n\n for (const prop in source) {\n const value = source[prop]\n\n if (is.plainObject(value)) {\n dest[prop] = clone(value) as any\n }\n else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n }\n else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n","import browser from './browser'\nimport domObjects from './domObjects'\nimport * as is from './is'\nimport win, { getWindow } from './window'\n\nexport function nodeContains (parent: Node | Interact.EventTarget, child: Node | Interact.EventTarget) {\n while (child) {\n if (child === parent) {\n return true\n }\n\n child = (child as Node).parentNode\n }\n\n return false\n}\n\nexport function closest (element: Node, selector: string) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) { return element }\n\n element = parentNode(element)\n }\n\n return null\n}\n\nexport function parentNode (node: Node | Document) {\n let parent = node.parentNode\n\n if (is.docFrag(parent)) {\n // skip past #shado-root fragments\n // tslint:disable-next-line\n while ((parent = (parent as any).host) && is.docFrag(parent)) {\n continue\n }\n\n return parent\n }\n\n return parent\n}\n\nexport function matchesSelector (element: Interact.Element, selector: string) {\n // remove /deep/ from selectors if shadowDOM polyfill is used\n if (win.window !== win.realWindow) {\n selector = selector.replace(/\\/deep\\//g, ' ')\n }\n\n return element[browser.prefixedMatchesSelector](selector)\n}\n\nconst getParent = el => el.parentNode ? el.parentNode : el.host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Interact.Element[] | NodeListOf) {\n let deepestZoneParents = []\n let deepestZone = elements[0]\n let index = deepestZone ? 0 : -1\n let i\n let n\n\n for (i = 1; i < elements.length; i++) {\n const dropzone = elements[i]\n\n // an element might belong to multiple selector dropzones\n if (!dropzone || dropzone === deepestZone) {\n continue\n }\n\n if (!deepestZone) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // check if the deepest or current are document.documentElement or document.rootElement\n // - if the current dropzone is, do nothing and continue\n if (dropzone.parentNode === dropzone.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current dropzone and continue to next\n else if (deepestZone.parentNode === dropzone.ownerDocument) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // compare zIndex of siblings\n if (dropzone.parentNode === deepestZone.parentNode) {\n const deepestZIndex = parseInt(getWindow(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0\n const dropzoneZIndex = parseInt(getWindow(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0\n\n if (dropzoneZIndex >= deepestZIndex) {\n deepestZone = dropzone\n index = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest dropzone\n if (!deepestZoneParents.length) {\n let parent = deepestZone\n let parentParent\n\n while ((parentParent = getParent(parent)) && parentParent !== parent.ownerDocument) {\n deepestZoneParents.unshift(parent)\n parent = parentParent\n }\n }\n\n let parent\n\n // if this element is an svg element and the current deepest is an\n // HTMLElement\n if (deepestZone instanceof domObjects.HTMLElement &&\n dropzone instanceof domObjects.SVGElement &&\n !(dropzone instanceof domObjects.SVGSVGElement)) {\n if (dropzone === deepestZone.parentNode) {\n continue\n }\n\n parent = dropzone.ownerSVGElement\n }\n else {\n parent = dropzone\n }\n\n const dropzoneParents = []\n\n while (parent.parentNode !== parent.ownerDocument) {\n dropzoneParents.unshift(parent)\n parent = getParent(parent)\n }\n\n n = 0\n\n // get (position of last common ancestor) + 1\n while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) {\n n++\n }\n\n const parents = [\n dropzoneParents[n - 1],\n dropzoneParents[n],\n deepestZoneParents[n],\n ]\n\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestZone = dropzone\n index = i\n deepestZoneParents = dropzoneParents\n\n break\n }\n else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n\n return index\n}\n\nexport function matchesUpTo (element: Interact.Element, selector: string, limit: Node) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) {\n return true\n }\n\n element = parentNode(element) as Interact.Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Interact.Element) {\n return (element instanceof domObjects.SVGElementInstance\n ? (element as SVGElement).correspondingUseElement\n : element)\n}\n\nexport function getScrollXY (relevantWindow) {\n relevantWindow = relevantWindow || win.window\n return {\n x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft,\n y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop,\n }\n}\n\nexport function getElementClientRect (element: Interact.Element) {\n const clientRect = (element instanceof domObjects.SVGElement\n ? element.getBoundingClientRect()\n : element.getClientRects()[0])\n\n return clientRect && {\n left : clientRect.left,\n right : clientRect.right,\n top : clientRect.top,\n bottom: clientRect.bottom,\n width : clientRect.width || clientRect.right - clientRect.left,\n height: clientRect.height || clientRect.bottom - clientRect.top,\n }\n}\n\nexport function getElementRect (element: Interact.Element) {\n const clientRect = getElementClientRect(element)\n\n if (!browser.isIOS7 && clientRect) {\n const scroll = getScrollXY(win.getWindow(element))\n\n clientRect.left += scroll.x\n clientRect.right += scroll.x\n clientRect.top += scroll.y\n clientRect.bottom += scroll.y\n }\n\n return clientRect\n}\n\nexport function getPath (node: Node | Document) {\n const path = []\n\n while (node) {\n path.push(node)\n node = parentNode(node)\n }\n\n return path\n}\n\nexport function trySelector (value) {\n if (!is.string(value)) { return false }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\n","export interface PointerExtend {\n webkit: RegExp\n [prefix: string]: RegExp\n}\n\nfunction pointerExtend (dest, source) {\n for (const prop in source) {\n const prefixedPropREs = pointerExtend.prefixedPropREs\n let deprecated = false\n\n // skip deprecated prefixed properties\n for (const vendor in prefixedPropREs) {\n if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) {\n deprecated = true\n break\n }\n }\n\n if (!deprecated && typeof source[prop] !== 'function') {\n dest[prop] = source[prop]\n }\n }\n return dest\n}\n\npointerExtend.prefixedPropREs = {\n webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/,\n moz: /(Pressure)$/,\n}\n\nexport default pointerExtend\n","export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n","import browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport * as is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: Interact.CoordsSetMember, src: Interact.CoordsSetMember) {\n dest.page = dest.page || {} as any\n dest.page.x = src.page.x\n dest.page.y = src.page.y\n\n dest.client = dest.client || {} as any\n dest.client.x = src.client.x\n dest.client.y = src.client.y\n\n dest.timeStamp = src.timeStamp\n}\n\nexport function setCoordDeltas (targetObj: Interact.CoordsSetMember, prev: Interact.CoordsSetMember, cur: Interact.CoordsSetMember) {\n targetObj.page.x = cur.page.x - prev.page.x\n targetObj.page.y = cur.page.y - prev.page.y\n targetObj.client.x = cur.client.x - prev.client.x\n targetObj.client.y = cur.client.y - prev.client.y\n targetObj.timeStamp = cur.timeStamp - prev.timeStamp\n}\n\nexport function setCoordVelocity (targetObj: Interact.CoordsSetMember, delta: Interact.CoordsSetMember) {\n const dt = Math.max(delta.timeStamp / 1000, 0.001)\n\n targetObj.page.x = delta.page.x / dt\n targetObj.page.y = delta.page.y / dt\n targetObj.client.x = delta.client.x / dt\n targetObj.client.y = delta.client.y / dt\n targetObj.timeStamp = dt\n}\n\nexport function setZeroCoords (targetObj: Interact.CoordsSetMember) {\n targetObj.page.x = 0\n targetObj.page.y = 0\n targetObj.client.x = 0\n targetObj.client.y = 0\n}\n\nexport function isNativePointer (pointer: any) {\n return (pointer instanceof dom.Event || pointer instanceof dom.Touch)\n}\n\n// Get specified X/Y coords for mouse or event.touches[0]\nexport function getXY (type, pointer, xy) {\n xy = xy || {}\n type = type || 'page'\n\n xy.x = pointer[type + 'X']\n xy.y = pointer[type + 'Y']\n\n return xy\n}\n\nexport function getPageXY (pointer: Interact.PointerType | Interact.InteractEvent, page?: Interact.Point) {\n page = page || { x: 0, y: 0 }\n\n // Opera Mobile handles the viewport and scrolling oddly\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n getXY('screen', pointer, page)\n\n page.x += window.scrollX\n page.y += window.scrollY\n }\n else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer, client) {\n client = client || {}\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n }\n else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer) {\n return is.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier\n}\n\nexport function setCoords (targetObj, pointers: any[], timeStamp: number) {\n const pointer = (pointers.length > 1\n ? pointerAverage(pointers)\n : pointers[0])\n\n const tmpXY = {} as { x: number, y: number }\n\n getPageXY(pointer, tmpXY)\n targetObj.page.x = tmpXY.x\n targetObj.page.y = tmpXY.y\n\n getClientXY(pointer, tmpXY)\n targetObj.client.x = tmpXY.x\n targetObj.client.y = tmpXY.y\n\n targetObj.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event) {\n const touches = []\n\n // array of touches is supplied\n if (is.array(event)) {\n touches[0] = event[0]\n touches[1] = event[1]\n }\n // an event\n else {\n if (event.type === 'touchend') {\n if (event.touches.length === 1) {\n touches[0] = event.touches[0]\n touches[1] = event.changedTouches[0]\n }\n else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\n }\n }\n else {\n touches[0] = event.touches[0]\n touches[1] = event.touches[1]\n }\n }\n\n return touches\n}\n\nexport function pointerAverage (pointers: PointerEvent[] | Event[]) {\n const average = {\n pageX : 0,\n pageY : 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop] += pointer[prop]\n }\n }\n for (const prop in average) {\n average[prop] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: Event | Array<(Interact.PointerType) | TouchEvent>) {\n if (!(event as any).length &&\n !((event as TouchEvent).touches &&\n (event as TouchEvent).touches.length > 1)) {\n return null\n }\n\n const touches = getTouchPair(event)\n const minX = Math.min(touches[0].pageX, touches[1].pageX)\n const minY = Math.min(touches[0].pageY, touches[1].pageY)\n const maxX = Math.max(touches[0].pageX, touches[1].pageX)\n const maxY = Math.max(touches[0].pageY, touches[1].pageY)\n\n return {\n x: minX,\n y: minY,\n left: minX,\n top: minY,\n right: maxX,\n bottom: maxY,\n width: maxX - minX,\n height: maxY - minY,\n }\n}\n\nexport function touchDistance (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n\n const dx = touches[0][sourceX] - touches[1][sourceX]\n const dy = touches[0][sourceY] - touches[1][sourceY]\n\n return hypot(dx, dy)\n}\n\nexport function touchAngle (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n const dx = touches[1][sourceX] - touches[0][sourceX]\n const dy = touches[1][sourceY] - touches[0][sourceY]\n const angle = 180 * Math.atan2(dy, dx) / Math.PI\n\n return angle\n}\n\nexport function getPointerType (pointer) {\n return is.string(pointer.pointerType)\n ? pointer.pointerType\n : is.number(pointer.pointerType)\n ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType]\n // if the PointerEvent API isn't available, then the \"pointer\" must\n // be either a MouseEvent, TouchEvent, or Touch object\n : /touch/.test(pointer.type) || pointer instanceof dom.Touch\n ? 'touch'\n : 'mouse'\n}\n\n// [ event.target, event.currentTarget ]\nexport function getEventTargets (event) {\n const path = is.func(event.composedPath) ? event.composedPath() : event.path\n\n return [\n domUtils.getActualElement(path ? path[0] : event.target),\n domUtils.getActualElement(event.currentTarget),\n ]\n}\n\nexport function newCoords (): Interact.CoordsSetMember {\n return {\n page : { x: 0, y: 0 },\n client : { x: 0, y: 0 },\n timeStamp: 0,\n }\n}\n\nexport function coordsToEvent (coords: MockCoords) {\n const event = {\n coords,\n get page () { return this.coords.page },\n get client () { return this.coords.client },\n get timeStamp () { return this.coords.timeStamp },\n get pageX () { return this.coords.page.x },\n get pageY () { return this.coords.page.y },\n get clientX () { return this.coords.client.x },\n get clientY () { return this.coords.client.y },\n get pointerId () { return this.coords.pointerId },\n get target () { return this.coords.target },\n get type () { return this.coords.type },\n get pointerType () { return this.coords.pointerType },\n get buttons () { return this.coords.buttons },\n }\n\n return event as typeof event & Interact.PointerType & Interact.PointerEventType\n}\n\nexport interface MockCoords {\n page: Interact.Point\n client: Interact.Point\n timeStamp?: number\n pointerId?: any\n target?: any\n type?: string\n pointerType?: string\n buttons?: number\n}\n\nexport { pointerExtend }\n","import { contains } from './arr'\nimport * as domUtils from './domUtils'\nimport * as is from './is'\nimport pExtend from './pointerExtend'\nimport * as pointerUtils from './pointerUtils'\n\ntype Listener = (event: Event | FakeEvent) => any\n\nconst elements: EventTarget[] = []\nconst targets: Array<{\n events: { [type: string]: Listener[] }\n typeCount: number\n}> = []\n\nconst delegatedEvents: {\n [type: string]: {\n selectors: string[]\n contexts: Node[]\n listeners: Array>\n }\n} = {}\nconst documents: Document[] = []\n\nfunction add (element: EventTarget, type: string, listener: Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n let elementIndex = elements.indexOf(element)\n let target = targets[elementIndex]\n\n if (!target) {\n target = {\n events: {},\n typeCount: 0,\n }\n\n elementIndex = elements.push(element) - 1\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n target.typeCount++\n }\n\n if (element.removeEventListener && !contains(target.events[type], listener)) {\n element.addEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].push(listener)\n }\n}\n\nfunction remove (element: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n const elementIndex = elements.indexOf(element)\n const target = targets[elementIndex]\n\n if (!target || !target.events) {\n return\n }\n\n if (type === 'all') {\n for (type in target.events) {\n if (target.events.hasOwnProperty(type)) {\n remove(element, type, 'all')\n }\n }\n return\n }\n\n if (target.events[type]) {\n const len = target.events[type].length\n\n if (listener === 'all') {\n for (let i = 0; i < len; i++) {\n remove(element, type, target.events[type][i], options)\n }\n return\n }\n else {\n for (let i = 0; i < len; i++) {\n if (element.removeEventListener && target.events[type][i] === listener) {\n element.removeEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].splice(i, 1)\n\n break\n }\n }\n }\n\n if (target.events[type] && target.events[type].length === 0) {\n (target.events[type] as any) = null\n target.typeCount--\n }\n }\n\n if (!target.typeCount) {\n targets.splice(elementIndex, 1)\n elements.splice(elementIndex, 1)\n }\n}\n\nfunction addDelegate (selector: string, context: Node, type: string, listener: Listener, optionalArg?: any) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = {\n contexts : [],\n listeners: [],\n selectors: [],\n }\n\n // add delegate listener functions\n for (const doc of documents) {\n add(doc, type, delegateListener)\n add(doc, type, delegateUseCapture, true)\n }\n }\n\n const delegated = delegatedEvents[type]\n let index\n\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n break\n }\n }\n\n if (index === -1) {\n index = delegated.selectors.length\n\n delegated.selectors.push(selector)\n delegated.contexts.push(context)\n delegated.listeners.push([])\n }\n\n // keep listener and capture and passive flags\n delegated.listeners[index].push([listener, !!options.capture, options.passive])\n}\n\nfunction removeDelegate (\n selector: string,\n context: Document | Interact.Element,\n type: string,\n listener?: Listener,\n optionalArg?: any,\n) {\n const options = getOptions(optionalArg)\n const delegated = delegatedEvents[type]\n let matchFound = false\n let index\n\n if (!delegated) { return }\n\n // count from last index of delegated to 0\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n // look for matching selector and context Node\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n const listeners = delegated.listeners[index]\n\n // each item of the listeners array is an array: [function, capture, passive]\n for (let i = listeners.length - 1; i >= 0; i--) {\n const [fn, capture, passive] = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (fn === listener && capture === !!options.capture && passive === options.passive) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this interactable have been removed\n // remove the interactable from the delegated arrays\n if (!listeners.length) {\n delegated.selectors.splice(index, 1)\n delegated.contexts.splice(index, 1)\n delegated.listeners.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n\n // remove the arrays if they are empty\n if (!delegated.selectors.length) {\n delegatedEvents[type] = null\n }\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) { break }\n }\n }\n}\n\n// bound to the interactable context when a DOM event\n// listener is added to a selector interactable\nfunction delegateListener (event: Event, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event)\n const delegated = delegatedEvents[event.type]\n const [eventTarget] = (pointerUtils.getEventTargets(event))\n let element: Node = eventTarget\n\n // climb up document tree looking for selector matches\n while (is.element(element)) {\n for (let i = 0; i < delegated.selectors.length; i++) {\n const selector = delegated.selectors[i]\n const context = delegated.contexts[i]\n\n if (domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)) {\n const listeners = delegated.listeners[i]\n\n fakeEvent.currentTarget = element\n\n for (const [fn, capture, passive] of listeners) {\n if (capture === !!options.capture && passive === options.passive) {\n fn(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n}\n\nfunction delegateUseCapture (event: Event) {\n return delegateListener.call(this, event, true)\n}\n\nfunction getOptions (param: object) {\n return is.object(param) ? param : { capture: param }\n}\n\nexport class FakeEvent implements Partial {\n currentTarget: EventTarget\n\n constructor (public originalEvent: Event) {\n // duplicate the event so that currentTarget can be changed\n pExtend(this, originalEvent)\n }\n\n preventOriginalDefault () {\n this.originalEvent.preventDefault()\n }\n\n stopPropagation () {\n this.originalEvent.stopPropagation()\n }\n\n stopImmediatePropagation () {\n this.originalEvent.stopImmediatePropagation()\n }\n}\n\nconst events = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n supportsOptions: false,\n supportsPassive: false,\n\n _elements: elements,\n _targets: targets,\n\n init (window: Window) {\n window.document.createElement('div').addEventListener('test', null, {\n get capture () { return (events.supportsOptions = true) },\n get passive () { return (events.supportsPassive = true) },\n })\n },\n}\n\nexport default events\n","export default function extend (dest: U & Partial, source: T): T & U {\n for (const prop in source) {\n (dest as unknown as T)[prop] = source[prop]\n }\n\n const ret = dest as T & U\n\n return ret\n}\n","import extend from './extend'\nimport * as is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Interact.Listener[]\n}\n\nexport default function normalize (\n type: Interact.EventTypes,\n listeners?: Interact.ListenersArg | Interact.ListenersArg[],\n result?: NormalizedListeners,\n): NormalizedListeners {\n result = result || {}\n\n if (is.string(type) && type.search(' ') !== -1) {\n type = split(type)\n }\n\n if (is.array(type)) {\n return type.reduce(\n (acc, t) => extend(acc, normalize(t, listeners, result)),\n result,\n )\n }\n\n // ({ type: fn }) -> ('', { type: fn })\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n }\n else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, result)\n }\n }\n else if (is.object(listeners)) {\n for (const prefix in listeners) {\n const combinedTypes = split(prefix).map(p => `${type}${p}`)\n\n normalize(combinedTypes, listeners[prefix], result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n","import * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport normalize, { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped<\n T extends Interact.ActionName,\n P extends Interact.EventPhase,\n> (event: Interact.InteractEvent, listeners: Interact.Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) { break }\n\n listener(event)\n }\n}\n\nclass Eventable {\n options: any\n types: NormalizedListeners = {}\n propagationStopped = false\n immediatePropagationStopped = false\n global: any\n\n constructor (options?: { [index: string]: any }) {\n this.options = extend({}, options || {})\n }\n\n fire (event: any) {\n let listeners\n const global = this.global\n\n // Interactable#on() listeners\n // tslint:disable no-conditional-assignment\n if ((listeners = this.types[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n\n // interact.on() listeners\n if (!event.propagationStopped && global && (listeners = global[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n }\n\n on (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n this.types[type] = arr.merge(this.types[type] || [], listeners[type])\n }\n }\n\n off (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n const eventList = this.types[type]\n\n if (!eventList || !eventList.length) { continue }\n\n for (const subListener of listeners[type]) {\n const index = eventList.indexOf(subListener)\n\n if (index !== -1) {\n eventList.splice(index, 1)\n }\n }\n }\n }\n\n getRect (_element: Interact.Element): Interact.Rect {\n return null\n }\n}\n\nexport default Eventable\n","import { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport * as is from './is'\n\nexport function getStringOptionResult (value: any, target: Interact.HasGetRect, element) {\n if (value === 'parent') { return parentNode(element) }\n\n if (value === 'self') { return target.getRect(element) }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: Interact.RectResolvable,\n target?: Interact.HasGetRect,\n element?: Node,\n functionArgs?: T,\n) {\n let returnValue: any = value\n if (is.string(returnValue)) {\n returnValue = getStringOptionResult(returnValue, target, element)\n }\n else if (is.func(returnValue)) {\n returnValue = returnValue(...functionArgs)\n }\n\n if (is.element(returnValue)) {\n returnValue = getElementRect(returnValue)\n }\n\n return returnValue as Interact.Rect\n}\n\nexport function rectToXY (rect) {\n return rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n}\n\nexport function xywhToTlbr (rect) {\n if (rect && !('left' in rect && 'top' in rect)) {\n rect = extend({}, rect)\n\n rect.left = rect.x || 0\n rect.top = rect.y || 0\n rect.right = rect.right || (rect.left + rect.width)\n rect.bottom = rect.bottom || (rect.top + rect.height)\n }\n\n return rect\n}\n\nexport function tlbrToXywh (rect) {\n if (rect && !('x' in rect && 'y' in rect)) {\n rect = extend({}, rect)\n\n rect.x = rect.left || 0\n rect.y = rect.top || 0\n rect.width = rect.width || (rect.right || 0 - rect.x)\n rect.height = rect.height || (rect.bottom || 0 - rect.y)\n }\n\n return rect\n}\n\nexport function addEdges (edges: Interact.EdgeOptions, rect: Interact.Rect, delta: Interact.Point) {\n if (edges.left) { rect.left += delta.x }\n if (edges.right) { rect.right += delta.x }\n if (edges.top) { rect.top += delta.y }\n if (edges.bottom) { rect.bottom += delta.y }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n","import { rectToXY, resolveRectLike } from './rect'\n\nexport default function (\n target: Interact.HasGetRect & { options: Interact.PerActionDefaults },\n element: Node,\n actionName?: Interact.ActionName,\n) {\n const actionOptions = (target.options as any)[actionName]\n const actionOrigin = actionOptions && actionOptions.origin\n const origin = actionOrigin || target.options.origin\n\n const originRect = resolveRectLike(origin, target, element, [target && element])\n\n return rectToXY(originRect) || { x: 0, y: 0 }\n}\n","let lastTime = 0\nlet request\nlet cancel\n\nfunction init (window) {\n request = window.requestAnimationFrame\n cancel = window.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = window[`${vendor}RequestAnimationFrame`]\n cancel = window[`${vendor}CancelAnimationFrame`] || window[`${vendor}CancelRequestAnimationFrame`]\n }\n }\n\n if (!request) {\n request = callback => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n // eslint-disable-next-line standard/no-callback-literal\n const token = setTimeout(() => { callback(currTime + timeToCall) },\n timeToCall)\n\n lastTime = currTime + timeToCall\n return token\n }\n\n cancel = token => clearTimeout(token)\n }\n}\n\nexport default {\n request: callback => request(callback),\n cancel: token => cancel(token),\n init,\n}\n","import * as arr from './arr'\nimport * as dom from './domUtils'\nimport * as is from './is'\nimport * as pointer from './pointerUtils'\nimport * as rect from './rect'\nimport win from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n // eslint-disable-next-line no-shadow\n return function (this: T) {\n if (!warned) {\n (win as any).window.console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: Interact.ActionProps, src: Interact.ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport { default as browser } from './browser'\nexport { default as clone } from './clone'\nexport { default as events } from './events'\nexport { default as extend } from './extend'\nexport { default as getOriginXY } from './getOriginXY'\nexport { default as hypot } from './hypot'\nexport { default as normalizeListeners } from './normalizeListeners'\nexport { default as raf } from './raf'\nexport { win, arr, dom, is, pointer, rect }\n","// tslint:disable no-empty-interface\n\nexport interface Defaults {\n base: BaseDefaults\n perAction: PerActionDefaults\n actions: ActionDefaults\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionDefaults {\n}\n\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Interact.EventTarget\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Interact.Point | string | Interact.Element\n listeners?: Interact.Listeners\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n}\n\nexport type Options = Partial & Partial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\n// export interface Options extends BaseDefaults, PerActionDefaults {}\n\nexport interface OptionsArg extends BaseDefaults, Interact.OrBoolean> {}\n\nexport const defaults: Defaults = {\n base: {\n preventDefault: 'auto',\n deltaSource: 'page',\n },\n\n perAction: {\n enabled: false,\n origin: { x: 0, y: 0 },\n },\n\n actions: {} as ActionDefaults,\n}\n\nexport default defaults\n","import * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interact.Interactable\n target: Interact.Target\n options: Interact.OptionsArg\n win: Window\n }\n }\n}\n\ninterface InteractableScopeProp {\n context: Document | Interact.Element\n interactable: Interact.Interactable\n}\n\nexport default class InteractableSet {\n // all set interactables\n list: Interact.Interactable[] = []\n\n selectorMap: {\n [selector: string]: InteractableScopeProp[]\n } = {}\n\n constructor (protected scope: Interact.Scope) {\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target, _context: context } = interactable\n const targetMappings: InteractableScopeProp[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = targetMappings.findIndex(m => m.context === context)\n if (targetMappings[targetIndex]) {\n // Destroying mappingInfo's context and interactable\n targetMappings[targetIndex].context = null\n targetMappings[targetIndex].interactable = null\n }\n targetMappings.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Interact.Target, options?: any): Interact.Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document)\n const mappingInfo = { context: interactable._context, interactable }\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) { this.selectorMap[target] = [] }\n this.selectorMap[target].push(mappingInfo)\n } else {\n if (!((interactable.target as any)[this.scope.id])) {\n Object.defineProperty(target, this.scope.id, {\n value: [],\n configurable: true,\n })\n }\n\n (target as any)[this.scope.id].push(mappingInfo)\n }\n\n this.scope.fire('interactable:new', {\n target,\n options,\n interactable,\n win: this.scope._win,\n })\n\n return interactable\n }\n\n get (target: Interact.Target, options?: Interact.Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const targetMappings: InteractableScopeProp[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!targetMappings) { return null }\n\n const found = arr.find(\n targetMappings,\n m => m.context === context &&\n (isSelector || m.interactable.inContext(target as any)))\n\n return found && found.interactable\n }\n\n forEachMatch (node: Node, callback: (interactable: Interact.Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret\n\n if ((is.string(interactable.target)\n // target is a selector and the element matches\n ? (is.element(node) && domUtils.matchesSelector(node, interactable.target))\n // target is the element\n : node === interactable.target) &&\n // the element is in context\n (interactable.inContext(node))) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n","import Interactable from './Interactable'\n\nexport class BaseEvent {\n type: string\n target: EventTarget\n currentTarget: EventTarget\n interactable: Interactable\n _interaction: Interact.Interaction\n timeStamp: any\n immediatePropagationStopped = false\n propagationStopped = false\n\n get interaction () {\n return this._interaction._proxy\n }\n\n constructor (interaction: Interact.Interaction) {\n this._interaction = interaction\n }\n\n preventDefault () {}\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n}\n\nexport default BaseEvent\n","import extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport BaseEvent from './BaseEvent'\nimport defaults from './defaultOptions'\nimport Interaction from './Interaction'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\nexport class InteractEvent<\n T extends Interact.ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n target: Interact.Element\n currentTarget: Interact.Element\n relatedTarget: null = null\n screenX?: number\n screenY?: number\n button: number\n buttons: number\n ctrlKey: boolean\n shiftKey: boolean\n altKey: boolean\n metaKey: boolean\n page: Interact.Point\n client: Interact.Point\n delta: Interact.Point\n rect: Interact.FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Interact.Point\n speed: number\n swipe: ReturnType['getSwipe']>\n timeStamp: any\n // drag\n dragEnter?: Interact.Element\n dragLeave?: Interact.Element\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: Interact.PointerEventType,\n actionName: T,\n phase: P,\n element: Interact.Element,\n preEnd?: boolean,\n type?: string,\n ) {\n super(interaction)\n\n element = element || interaction.element\n\n const target = interaction.interactable\n const deltaSource = (((target && target.options) || defaults) as any).deltaSource as 'page' | 'client'\n const origin = getOriginXY(target, element, actionName)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const prevEvent = starting ? this : interaction.prevEvent\n const coords = starting\n ? interaction.coords.start\n : ending\n ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp }\n : interaction.coords.cur\n\n this.page = extend({}, coords.page)\n this.client = extend({}, coords.client)\n this.rect = extend({}, interaction.rect)\n this.timeStamp = coords.timeStamp\n\n if (!ending) {\n this.page.x -= origin.x\n this.page.y -= origin.y\n\n this.client.x -= origin.x\n this.client.y -= origin.y\n }\n\n this.ctrlKey = event.ctrlKey\n this.altKey = event.altKey\n this.shiftKey = event.shiftKey\n this.metaKey = event.metaKey\n this.button = (event as MouseEvent).button\n this.buttons = (event as MouseEvent).buttons\n this.target = element\n this.currentTarget = element\n this.preEnd = preEnd\n this.type = type || (actionName + (phase || ''))\n this.interactable = target\n\n this.t0 = starting\n ? interaction.pointers[interaction.pointers.length - 1].downTime\n : prevEvent.t0\n\n this.x0 = interaction.coords.start.page.x - origin.x\n this.y0 = interaction.coords.start.page.y - origin.y\n this.clientX0 = interaction.coords.start.client.x - origin.x\n this.clientY0 = interaction.coords.start.client.y - origin.y\n\n if (starting || ending) {\n this.delta = { x: 0, y: 0 }\n }\n else {\n this.delta = {\n x: this[deltaSource].x - prevEvent[deltaSource].x,\n y: this[deltaSource].y - prevEvent[deltaSource].y,\n }\n }\n\n this.dt = interaction.coords.delta.timeStamp\n this.duration = this.timeStamp - this.t0\n\n // velocity and speed in pixels per second\n this.velocity = extend({}, interaction.coords.velocity[deltaSource])\n this.speed = hypot(this.velocity.x, this.velocity.y)\n\n this.swipe = (ending || phase === 'inertiastart') ? this.getSwipe() : null\n }\n\n get pageX () { return this.page.x }\n set pageX (value) { this.page.x = value }\n get pageY () { return this.page.y }\n set pageY (value) { this.page.y = value }\n\n get clientX () { return this.client.x }\n set clientX (value) { this.client.x = value }\n get clientY () { return this.client.y }\n set clientY (value) { this.client.y = value }\n\n get dx () { return this.delta.x }\n set dx (value) { this.delta.x = value }\n get dy () { return this.delta.y }\n set dy (value) { this.delta.y = value }\n\n get velocityX () { return this.velocity.x }\n set velocityX (value) { this.velocity.x = value }\n get velocityY () { return this.velocity.y }\n set velocityY (value) { this.velocity.y = value }\n\n getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 ||\n this.timeStamp - interaction.prevEvent.timeStamp > 150) {\n return null\n }\n\n let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI\n const overlap = 22.5\n\n if (angle < 0) {\n angle += 360\n }\n\n const left = 135 - overlap <= angle && angle < 225 + overlap\n const up = 225 - overlap <= angle && angle < 315 + overlap\n\n const right = !left && (315 - overlap <= angle || angle < 45 + overlap)\n const down = !up && 45 - overlap <= angle && angle < 135 + overlap\n\n return {\n up,\n down,\n left,\n right,\n angle,\n speed: interaction.prevEvent.speed,\n velocity: {\n x: interaction.prevEvent.velocityX,\n y: interaction.prevEvent.velocityY,\n },\n }\n }\n\n preventDefault () {}\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n}\n\nexport default InteractEvent\n","/* eslint-disable @typescript-eslint/no-parameter-properties */\nexport class PointerInfo {\n constructor (\n public id: number,\n public pointer: Interact.PointerType,\n public event: Interact.PointerEventType,\n public downTime: number,\n public downTarget: Interact.EventTarget,\n ) {}\n}\n\nexport default PointerInfo\n","import * as utils from '@interactjs/utils/index'\nimport Interactable from './Interactable'\nimport InteractEvent, { EventPhase } from './InteractEvent'\nimport PointerInfo from './PointerInfo'\nimport { ActionName } from './scope'\n\nexport interface ActionProps {\n name: T\n axis?: 'x' | 'y' | 'xy'\n edges?: Interact.EdgeOptions\n}\n\nexport interface StartAction extends ActionProps {\n name: ActionName\n}\n\nexport enum _ProxyValues {\n interactable = '',\n element = '',\n prepared = '',\n pointerIsDown = '',\n pointerWasMoved = '',\n _proxy = ''\n}\n\nexport enum _ProxyMethods {\n start = '',\n move = '',\n end = '',\n stop = '',\n interacting = ''\n}\n\nexport type PointerArgProps = {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Interact.EventTarget\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: Interact.PointerEventType\n phase: EventPhase\n interaction: Interaction\n iEvent: InteractEvent\n preEnd?: boolean\n type?: string\n}\n\nexport type DoAnyPhaseArg = DoPhaseArg\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:new': { interaction: Interaction }\n 'interactions:down': PointerArgProps<{\n type: 'down'\n }>\n 'interactions:move': PointerArgProps<{\n type: 'move'\n dx: number\n dy: number\n duplicate: boolean\n }>\n 'interactions:up': PointerArgProps<{\n type: 'up'\n curEventTarget: EventTarget\n }>\n 'interactions:cancel': SignalArgs['interactions:up'] & {\n type: 'cancel'\n curEventTarget: EventTarget\n }\n 'interactions:update-pointer': PointerArgProps<{\n down: boolean\n }>\n 'interactions:remove-pointer': PointerArgProps\n 'interactions:blur'\n 'interactions:before-action-start': Omit\n 'interactions:action-start': DoAnyPhaseArg\n 'interactions:after-action-start': DoAnyPhaseArg\n 'interactions:before-action-move': Omit\n 'interactions:action-move': DoAnyPhaseArg\n 'interactions:after-action-move': DoAnyPhaseArg\n 'interactions:before-action-end': Omit\n 'interactions:action-end': DoAnyPhaseArg\n 'interactions:after-action-end': DoAnyPhaseArg\n 'interactions:stop': { interaction: Interaction }\n }\n}\n\nexport type _InteractionProxy = Pick<\nInteraction,\nkeyof typeof _ProxyValues | keyof typeof _ProxyMethods\n>\n\nlet idCounter = 0\n\nexport class Interaction {\n // current interactable being interacted with\n interactable: Interactable = null\n\n // the target element of the interactable\n element: Interact.Element = null\n rect: Interact.FullRect\n _rects?: {\n start: Interact.FullRect\n corrected: Interact.FullRect\n previous: Interact.FullRect\n delta: Interact.FullRect\n }\n edges: Interact.EdgeOptions\n\n _scopeFire: Interact.Scope['fire']\n\n // action that's ready to be fired on next move event\n prepared: ActionProps = {\n name : null,\n axis : null,\n edges: null,\n }\n\n pointerType: string\n\n // keep track of added pointers\n pointers: PointerInfo[] = []\n\n // pointerdown/mousedown/touchstart event\n downEvent: Interact.PointerEventType = null\n\n downPointer: Interact.PointerType = {} as Interact.PointerType\n\n _latestPointer: {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Node\n } = {\n pointer: null,\n event: null,\n eventTarget: null,\n }\n\n // previous action event\n prevEvent: InteractEvent = null\n\n pointerIsDown = false\n pointerWasMoved = false\n _interacting = false\n _ending = false\n _stopped = true\n _proxy: _InteractionProxy = null\n\n simulation = null\n\n get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = utils.warnOnce(\n function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n },\n 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: Interact.CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: utils.pointer.newCoords(),\n // Previous native pointer move event coordinates\n prev: utils.pointer.newCoords(),\n // current native pointer move event coordinates\n cur: utils.pointer.newCoords(),\n // Change in coordinates and time of the pointer\n delta: utils.pointer.newCoords(),\n // pointer velocity\n velocity: utils.pointer.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: {\n pointerType?: string\n scopeFire: Interact.Scope['fire']\n }) {\n this._scopeFire = scopeFire\n this.pointerType = pointerType\n\n const that = this\n\n this._proxy = {} as _InteractionProxy\n\n for (const key in _ProxyValues) {\n Object.defineProperty(this._proxy, key, {\n get () { return that[key] },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n const pointerIndex = this.updatePointer(pointer, event, eventTarget, true)\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:down', {\n pointer,\n event,\n eventTarget,\n pointerIndex,\n pointerInfo,\n type: 'down',\n interaction: this,\n })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable({\n * // disable the default drag start by down->move\n * manualStart: true\n * })\n * // start dragging after the user holds the pointer down\n * .on('hold', function (event) {\n * var interaction = event.interaction\n *\n * if (!interaction.interacting()) {\n * interaction.start({ name: 'drag' },\n * event.interactable,\n * event.currentTarget)\n * }\n * })\n * ```\n *\n * Start an action with the given Interactable and Element as tartgets. The\n * action must be enabled for the target Interactable and an appropriate\n * number of pointers must be held down - 1 for drag/resize, 2 for gesture.\n *\n * Use it with `interactable.able({ manualStart: false })` to always\n * [start actions manually](https://github.com/taye/interact.js/issues/114)\n *\n * @param {object} action The action to be performed - drag, resize, etc.\n * @param {Interactable} target The Interactable to target\n * @param {Element} element The DOM Element to target\n * @return {object} interact\n */\n start (action: StartAction, interactable: Interactable, element: Interact.Element) {\n if (this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name].enabled) {\n return false\n }\n\n utils.copyAction(this.prepared, action)\n\n this.interactable = interactable\n this.element = element\n this.rect = interactable.getRect(element)\n this.edges = this.prepared.edges\n ? utils.extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting = this._doPhase({\n interaction: this,\n event: this.downEvent,\n phase: 'start',\n }) && !this._stopped\n\n return this._interacting\n }\n\n pointerMove (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove = (this.coords.cur.page.x === this.coords.prev.page.x &&\n this.coords.cur.page.y === this.coords.prev.page.y &&\n this.coords.cur.client.x === this.coords.prev.client.x &&\n this.coords.cur.client.y === this.coords.prev.client.y)\n\n let dx\n let dy\n\n // register movement greater than pointerMoveTolerance\n if (this.pointerIsDown && !this.pointerWasMoved) {\n dx = this.coords.cur.client.x - this.coords.start.client.x\n dy = this.coords.cur.client.y - this.coords.start.client.y\n\n this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance\n }\n\n const pointerIndex = this.getPointerIndex(pointer)\n const signalArg = {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n type: 'move' as const,\n eventTarget,\n dx,\n dy,\n duplicate: duplicateMove,\n interaction: this,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta)\n }\n\n this._scopeFire('interactions:move', signalArg)\n\n if (!duplicateMove && !this.simulation) {\n // if interacting, fire an 'action-move' signal etc\n if (this.interacting()) {\n signalArg.type = null\n this.move(signalArg)\n }\n\n if (this.pointerWasMoved) {\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n }\n }\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('dragmove', function (event) {\n * if (someCondition) {\n * // change the snap settings\n * event.interactable.draggable({ snap: { targets: [] }})\n * // fire another move event with re-calculated snap\n * event.interaction.move()\n * }\n * })\n * ```\n *\n * Force a move of the current action at the same coordinates. Useful if\n * snap/restrict has been changed and you want a movement with the new\n * settings.\n */\n move (signalArg?) {\n if (!signalArg || !signalArg.event) {\n utils.pointer.setZeroCoords(this.coords.delta)\n }\n\n signalArg = utils.extend({\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n }, signalArg || {})\n\n signalArg.phase = 'move'\n\n this._doPhase(signalArg)\n }\n\n // End interact move events and stop auto-scroll unless simulation is running\n pointerUp (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, curEventTarget: Interact.EventTarget) {\n let pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) {\n pointerIndex = this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'\n\n this._scopeFire(`interactions:${type}` as 'interactions:up' | 'interactions:cancel', {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n eventTarget,\n type: type as any,\n curEventTarget,\n interaction: this,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.pointerIsDown = false\n this.removePointer(pointer, event)\n }\n\n documentBlur (event) {\n this.end(event)\n this._scopeFire('interactions:blur', { event, type: 'blur', interaction: this })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('move', function (event) {\n * if (event.pageX > 1000) {\n * // end the current action\n * event.interaction.end()\n * // stop all further listeners from being called\n * event.stopImmediatePropagation()\n * }\n * })\n * ```\n *\n * @param {PointerEvent} [event]\n */\n end (event?: Interact.PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult\n\n if (this.interacting()) {\n endPhaseResult = this._doPhase({\n event,\n interaction: this,\n phase: 'end',\n })\n }\n\n this._ending = false\n\n if (endPhaseResult === true) {\n this.stop()\n }\n }\n\n currentAction () {\n return this._interacting ? this.prepared.name : null\n }\n\n interacting () {\n return this._interacting\n }\n\n /** */\n stop () {\n this._scopeFire('interactions:stop', { interaction: this })\n\n this.interactable = this.element = null\n\n this._interacting = false\n this._stopped = true\n this.prepared.name = this.prevEvent = null\n }\n\n getPointerIndex (pointer) {\n const pointerId = utils.pointer.getPointerId(pointer)\n\n // mouse and pen interactions may have only one pointer\n return (this.pointerType === 'mouse' || this.pointerType === 'pen')\n ? this.pointers.length - 1\n : utils.arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean) {\n const id = utils.pointer.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false\n ? false\n : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(\n id,\n pointer,\n event,\n null,\n null,\n )\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n }\n else {\n pointerInfo.pointer = pointer\n }\n\n utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now())\n utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)\n\n if (down) {\n this.pointerIsDown = true\n\n pointerInfo.downTime = this.coords.cur.timeStamp\n pointerInfo.downTarget = eventTarget\n utils.pointer.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n utils.pointer.copyCoords(this.coords.start, this.coords.cur)\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n\n this.downEvent = event\n this.pointerWasMoved = false\n }\n }\n\n this._updateLatestPointer(pointer, event, eventTarget)\n\n this._scopeFire('interactions:update-pointer', {\n pointer,\n event,\n eventTarget,\n down,\n pointerInfo,\n pointerIndex,\n interaction: this,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: Interact.PointerType, event: Interact.PointerEventType) {\n const pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) { return }\n\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:remove-pointer', {\n pointer,\n event,\n eventTarget: null,\n pointerIndex,\n pointerInfo,\n interaction: this,\n })\n\n this.pointers.splice(pointerIndex, 1)\n }\n\n _updateLatestPointer (pointer, event, eventTarget) {\n this._latestPointer.pointer = pointer\n this._latestPointer.event = event\n this._latestPointer.eventTarget = eventTarget\n }\n\n destroy () {\n this._latestPointer.pointer = null\n this._latestPointer.event = null\n this._latestPointer.eventTarget = null\n }\n\n _createPreparedEvent

(event: Interact.PointerEventType, phase: P, preEnd?: boolean, type?: string) {\n return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type)\n }\n\n _fireEvent

(iEvent: InteractEvent) {\n this.interactable.fire(iEvent)\n\n if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {\n this.prevEvent = iEvent\n }\n }\n\n _doPhase

(signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent }) {\n const { event, phase, preEnd, type } = signalArg\n const { rect } = this\n\n if (rect && phase === 'move') {\n // update the rect changes due to pointer move\n utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource])\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n const beforeResult = this._scopeFire(`interactions:before-action-${phase}` as any, signalArg)\n\n if (beforeResult === false) {\n return false\n }\n\n const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type)\n\n this._scopeFire(`interactions:action-${phase}` as any, signalArg)\n\n if (phase === 'start') { this.prevEvent = iEvent }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () { return Date.now() }\n}\n\nexport default Interaction\nexport { PointerInfo }\n","import * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: Interact.PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: Interact.EventTarget\n curEventTarget: Interact.EventTarget\n scope: Interact.Scope\n}\n\nconst finder = {\n methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'] as const,\n\n search (details: SearchDetails) {\n for (const method of finder.methodOrder) {\n const interaction = finder[method](details)\n\n if (interaction) {\n return interaction\n }\n }\n\n return null\n },\n\n // try to resume simulation with a new pointer\n simulationResume ({ pointerType, eventType, eventTarget, scope }: SearchDetails) {\n if (!/down|start/i.test(eventType)) {\n return null\n }\n\n for (const interaction of scope.interactions.list) {\n let element = eventTarget as Node\n\n if (interaction.simulation && interaction.simulation.allowResume &&\n (interaction.pointerType === pointerType)) {\n while (element) {\n // if the element is the interaction element\n if (element === interaction.element) {\n return interaction\n }\n element = dom.parentNode(element)\n }\n }\n }\n\n return null\n },\n\n // if it's a mouse or pen interaction\n mouseOrPen ({ pointerId, pointerType, eventType, scope }: SearchDetails) {\n if (pointerType !== 'mouse' && pointerType !== 'pen') {\n return null\n }\n\n let firstNonActive\n\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType) {\n // if it's a down event, skip interactions with running simulations\n if (interaction.simulation && !hasPointerId(interaction, pointerId)) { continue }\n\n // if the interaction is active, return it immediately\n if (interaction.interacting()) {\n return interaction\n }\n // otherwise save it and look for another active interaction\n else if (!firstNonActive) {\n firstNonActive = interaction\n }\n }\n }\n\n // if no active mouse interaction was found use the first inactive mouse\n // interaction\n if (firstNonActive) {\n return firstNonActive\n }\n\n // find any mouse or pen interaction.\n // ignore the interaction if the eventType is a *down, and a simulation\n // is active\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get interaction that has this pointer\n hasPointer ({ pointerId, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n if (hasPointerId(interaction, pointerId)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get first idle interaction with a matching pointerType\n idle ({ pointerType, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n // if there's already a pointer held down\n if (interaction.pointers.length === 1) {\n const target = interaction.interactable\n // don't add this pointer if there is a target interactable and it\n // isn't gesturable\n if (target && !(target.options.gesture && target.options.gesture.enabled)) {\n continue\n }\n }\n // maximum of 2 pointers per interaction\n else if (interaction.pointers.length >= 2) {\n continue\n }\n\n if (!interaction.interacting() && (pointerType === interaction.pointerType)) {\n return interaction\n }\n }\n\n return null\n },\n}\n\nfunction hasPointerId (interaction: Interact.Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n","import BaseEvent from '@interactjs/core/BaseEvent'\nimport Interactable from '@interactjs/core/Interactable'\nimport InteractEvent from '@interactjs/core/InteractEvent'\nimport * as arr from '@interactjs/utils/arr'\n\nclass DropEvent extends BaseEvent {\n target: Interact.Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Interact.Element\n draggable: Interactable\n timeStamp: number\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: import('./').DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave'\n ? dropState.prev\n : dropState.cur\n\n this.type = type\n this.target = element\n this.currentTarget = element\n this.dropzone = dropzone\n this.dragEvent = dragEvent\n this.relatedTarget = dragEvent.target\n this.draggable = dragEvent.interactable\n this.timeStamp = dragEvent.timeStamp\n }\n\n /**\n * If this is a `dropactivate` event, the dropzone element will be\n * deactivated.\n *\n * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the\n * dropzone element and more.\n */\n reject () {\n const { dropState } = this._interaction\n\n if (\n (this.type !== 'dropactivate') && (\n !this.dropzone ||\n dropState.cur.dropzone !== this.dropzone ||\n dropState.cur.element !== this.target)) {\n return\n }\n\n dropState.prev.dropzone = this.dropzone\n dropState.prev.element = this.target\n\n dropState.rejected = true\n dropState.events.enter = null\n\n this.stopImmediatePropagation()\n\n if (this.type === 'dropactivate') {\n const activeDrops = dropState.activeDrops\n const index = arr.findIndex(activeDrops, ({ dropzone, element }) =>\n dropzone === this.dropzone && element === this.target)\n\n dropState.activeDrops.splice(index, 1)\n\n const deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate')\n\n deactivateEvent.dropzone = this.dropzone\n deactivateEvent.target = this.target\n\n this.dropzone.fire(deactivateEvent)\n }\n else {\n this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave'))\n }\n }\n\n preventDefault () {}\n\n stopPropagation () {\n this.propagationStopped = true\n }\n\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n}\n\nexport default DropEvent\n","import Interactable from '@interactjs/core/Interactable'\nimport InteractEvent from '@interactjs/core/InteractEvent'\nimport { Scope } from '@interactjs/core/scope'\nimport * as utils from '@interactjs/utils/index'\nimport drag from '../drag'\nimport DropEvent from './DropEvent'\n\nexport interface DropzoneMethod {\n (options: Interact.DropzoneOptions | boolean): Interact.Interactable\n (): Interact.DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: Interact.PointerEventType,\n draggable: Interactable,\n draggableElement: Interact.Element,\n dropElemen: Interact.Element,\n rect: any\n ) => boolean\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n dropState?: DropState\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n drop: Interact.DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n drop?: typeof drop\n }\n\n interface Scope {\n dynamicDrop?: boolean\n }\n\n interface SignalArgs {\n 'actions/drop:start': DropSignalArg\n 'actions/drop:move': DropSignalArg\n 'actions/drop:end': DropSignalArg\n }\n}\n\ninterface DropSignalArg {\n interaction: Interact.Interaction\n dragEvent: Interact.DragEvent\n}\n\nexport interface DropState {\n cur: {\n dropzone: Interactable // the dropzone a drag target might be dropped into\n element: Interact.Element // the element at the time of checking\n }\n prev: {\n dropzone: Interactable // the dropzone that was recently dragged away from\n element: Interact.Element // the element at the time of checking\n }\n rejected: boolean // wheather the potential drop was rejected from a listener\n events: any // the drop events related to the current drag event\n activeDrops: Array<{\n dropzone: Interactable\n element: Interact.Element\n rect: Interact.Rect\n }>\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interact,\n /** @lends Interactable */\n Interactable, // eslint-disable-line no-shadow\n defaults,\n } = scope\n\n scope.usePlugin(drag)\n\n /**\n *\n * ```js\n * interact('.drop').dropzone({\n * accept: '.can-drop' || document.getElementById('single-drop'),\n * overlap: 'pointer' || 'center' || zeroToOne\n * }\n * ```\n *\n * Returns or sets whether draggables can be dropped onto this target to\n * trigger drop events\n *\n * Dropzones can receive the following events:\n * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends\n * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone\n * - `dragmove` when a draggable that has entered the dropzone is moved\n * - `drop` when a draggable is dropped into this dropzone\n *\n * Use the `accept` option to allow only elements that match the given CSS\n * selector or element. The value can be:\n *\n * - **an Element** - only that element can be dropped into this dropzone.\n * - **a string**, - the element being dragged must match it as a CSS selector.\n * - **`null`** - accept options is cleared - it accepts any element.\n *\n * Use the `overlap` option to set how drops are checked for. The allowed\n * values are:\n *\n * - `'pointer'`, the pointer must be over the dropzone (default)\n * - `'center'`, the draggable element's center must be over the dropzone\n * - a number from 0-1 which is the `(intersection area) / (draggable area)`.\n * e.g. `0.5` for drop to happen when half of the area of the draggable is\n * over the dropzone\n *\n * Use the `checker` option to specify a function to check if a dragged element\n * is over this Interactable.\n *\n * @param {boolean | object | null} [options] The new options to be set.\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {\n return dropzoneMethod(this, options)\n }\n\n /**\n * ```js\n * interact(target)\n * .dropChecker(function(dragEvent, // related dragmove or dragend event\n * event, // TouchEvent/PointerEvent/MouseEvent\n * dropped, // bool result of the default checker\n * dropzone, // dropzone Interactable\n * dropElement, // dropzone elemnt\n * draggable, // draggable Interactable\n * draggableElement) {// draggable element\n *\n * return dropped && event.target.hasAttribute('allow-drop')\n * }\n * ```\n */\n Interactable.prototype.dropCheck = function (this: Interact.Interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) {\n return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect)\n }\n\n /**\n * Returns or sets whether the dimensions of dropzone elements are calculated\n * on every dragmove or only on dragstart for the default dropChecker\n *\n * @param {boolean} [newValue] True to check on each move. False to check only\n * before start\n * @return {boolean | interact} The current setting or interact\n */\n interact.dynamicDrop = function (newValue?: boolean) {\n if (utils.is.bool(newValue)) {\n // if (dragging && scope.dynamicDrop !== newValue && !newValue) {\n // calcRects(dropzones)\n // }\n\n scope.dynamicDrop = newValue\n\n return interact\n }\n return scope.dynamicDrop\n }\n\n utils.extend(actions.phaselessTypes, {\n dragenter: true,\n dragleave: true,\n dropactivate: true,\n dropdeactivate: true,\n dropmove: true,\n drop: true,\n })\n actions.methodDict.drop = 'dropzone'\n\n scope.dynamicDrop = false\n\n defaults.actions.drop = drop.defaults\n}\n\nfunction collectDrops ({ interactables }, draggableElement) {\n const drops = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const dropzone of interactables.list) {\n if (!dropzone.options.drop.enabled) { continue }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if ((utils.is.element(accept) && accept !== draggableElement) ||\n (utils.is.string(accept) &&\n !utils.dom.matchesSelector(draggableElement, accept)) ||\n (utils.is.func(accept) && !accept({ dropzone, draggableElement }))) {\n continue\n }\n\n // query for new elements if necessary\n const dropElements = utils.is.string(dropzone.target)\n ? dropzone._context.querySelectorAll(dropzone.target)\n : utils.is.array(dropzone.target) ? dropzone.target : [dropzone.target]\n\n for (const dropzoneElement of dropElements) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops, event) {\n // loop through all active dropzones and trigger event\n for (const { dropzone, element } of activeDrops.slice()) {\n event.dropzone = dropzone\n\n // set current element as event target\n event.target = element\n dropzone.fire(event)\n event.propagationStopped = event.immediatePropagationStopped = false\n }\n}\n\n// return a new array of possible drops. getActiveDrops should always be\n// called when a drag has just started or a drag event happens while\n// dynamicDrop is true\nfunction getActiveDrops (scope: Scope, dragElement: Interact.Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDrops(scope, dragElement)\n\n for (const activeDrop of activeDrops) {\n activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element)\n }\n\n return activeDrops\n}\n\nfunction getDrop ({ dropState, interactable: draggable, element: dragElement }: Partial, dragEvent, pointerEvent) {\n const validDrops = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect)\n ? dropzoneElement\n : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = utils.dom.indexOfDeepestElement(validDrops)\n\n return dropState.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interact.Interaction, _pointerEvent, dragEvent) {\n const { dropState } = interaction\n const dropEvents = {\n enter : null,\n leave : null,\n activate : null,\n deactivate: null,\n move : null,\n drop : null,\n }\n\n if (dragEvent.type === 'dragstart') {\n dropEvents.activate = new DropEvent(dropState, dragEvent, 'dropactivate')\n\n dropEvents.activate.target = null\n dropEvents.activate.dropzone = null\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null\n dropEvents.deactivate.dropzone = null\n }\n\n if (dropState.rejected) {\n return dropEvents\n }\n\n if (dropState.cur.element !== dropState.prev.element) {\n // if there was a previous dropzone, create a dragleave event\n if (dropState.prev.dropzone) {\n dropEvents.leave = new DropEvent(dropState, dragEvent, 'dragleave')\n\n dragEvent.dragLeave = dropEvents.leave.target = dropState.prev.element\n dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone\n }\n // if dropzone is not null, create a dragenter event\n if (dropState.cur.dropzone) {\n dropEvents.enter = new DropEvent(dropState, dragEvent, 'dragenter')\n\n dragEvent.dragEnter = dropState.cur.element\n dragEvent.dropzone = dropState.cur.dropzone\n }\n }\n\n if (dragEvent.type === 'dragend' && dropState.cur.dropzone) {\n dropEvents.drop = new DropEvent(dropState, dragEvent, 'drop')\n\n dragEvent.dropzone = dropState.cur.dropzone\n dragEvent.relatedTarget = dropState.cur.element\n }\n if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) {\n dropEvents.move = new DropEvent(dropState, dragEvent, 'dropmove')\n\n dropEvents.move.dragmove = dragEvent\n dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\nfunction fireDropEvents (interaction: Interact.Interaction, events) {\n const { dropState } = interaction\n const {\n activeDrops,\n cur,\n prev,\n } = dropState\n\n if (events.leave) { prev.dropzone.fire(events.leave) }\n if (events.move) { cur.dropzone.fire(events.move) }\n if (events.enter) { cur.dropzone.fire(events.enter) }\n if (events.drop) { cur.dropzone.fire(events.drop) }\n\n if (events.deactivate) {\n fireActivationEvents(activeDrops, events.deactivate)\n }\n\n dropState.prev.dropzone = cur.dropzone\n dropState.prev.element = cur.element\n}\n\nfunction onEventCreated ({ interaction, iEvent, event }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { return }\n\n const { dropState } = interaction\n\n if (scope.dynamicDrop) {\n dropState.activeDrops = getActiveDrops(scope, interaction.element)\n }\n\n const dragEvent = iEvent\n const dropResult = getDrop(interaction, dragEvent, event)\n\n // update rejected status\n dropState.rejected = dropState.rejected &&\n !!dropResult &&\n dropResult.dropzone === dropState.cur.dropzone &&\n dropResult.element === dropState.cur.element\n\n dropState.cur.dropzone = dropResult && dropResult.dropzone\n dropState.cur.element = dropResult && dropResult.element\n\n dropState.events = getDropEvents(interaction, event, dragEvent)\n}\n\nfunction dropzoneMethod (interactable: Interact.Interactable): Interact.DropzoneOptions\nfunction dropzoneMethod (interactable: Interact.Interactable, options: Interact.DropzoneOptions | boolean)\nfunction dropzoneMethod (interactable: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {\n if (utils.is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = utils.normalizeListeners(options.listeners)\n // rename 'drop' to '' as it will be prefixed with 'drop'\n const corrected = Object.keys(normalized).reduce((acc, type) => {\n const correctedType = /^(enter|leave)/.test(type)\n ? `drag${type}`\n : /^(activate|deactivate|move)/.test(type)\n ? `drop${type}`\n : type\n\n acc[correctedType] = normalized[type]\n\n return acc\n }, {})\n\n interactable.off(interactable.options.drop.listeners)\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (utils.is.func(options.ondrop)) { interactable.on('drop', options.ondrop) }\n if (utils.is.func(options.ondropactivate)) { interactable.on('dropactivate', options.ondropactivate) }\n if (utils.is.func(options.ondropdeactivate)) { interactable.on('dropdeactivate', options.ondropdeactivate) }\n if (utils.is.func(options.ondragenter)) { interactable.on('dragenter', options.ondragenter) }\n if (utils.is.func(options.ondragleave)) { interactable.on('dragleave', options.ondragleave) }\n if (utils.is.func(options.ondropmove)) { interactable.on('dropmove', options.ondropmove) }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n }\n else if (utils.is.number(options.overlap)) {\n interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0)\n }\n if ('accept' in options) {\n interactable.options.drop.accept = options.accept\n }\n if ('checker' in options) {\n interactable.options.drop.checker = options.checker\n }\n\n return interactable\n }\n\n if (utils.is.bool(options)) {\n interactable.options.drop.enabled = options\n\n return interactable\n }\n\n return interactable.options.drop\n}\n\nfunction dropCheckMethod (\n interactable: Interact.Interactable,\n dragEvent: InteractEvent,\n event: Interact.PointerEventType,\n draggable: Interact.Interactable,\n draggableElement: Interact.Element,\n dropElement: Interact.Element,\n rect: any,\n) {\n let dropped = false\n\n // if the dropzone has no rect (eg. display: none)\n // call the custom dropChecker or just return false\n if (!(rect = rect || interactable.getRect(dropElement))) {\n return (interactable.options.drop.checker\n ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)\n : false)\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = utils.getOriginXY(draggable, draggableElement, 'drag')\n const page = utils.pointer.getPageXY(dragEvent)\n\n page.x += origin.x\n page.y += origin.y\n\n const horizontal = (page.x > rect.left) && (page.x < rect.right)\n const vertical = (page.y > rect.top) && (page.y < rect.bottom)\n\n dropped = horizontal && vertical\n }\n\n const dragRect = draggable.getRect(draggableElement)\n\n if (dragRect && dropOverlap === 'center') {\n const cx = dragRect.left + dragRect.width / 2\n const cy = dragRect.top + dragRect.height / 2\n\n dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom\n }\n\n if (dragRect && utils.is.number(dropOverlap)) {\n const overlapArea = (Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) *\n Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top)))\n\n const overlapRatio = overlapArea / (dragRect.width * dragRect.height)\n\n dropped = overlapRatio >= dropOverlap\n }\n\n if (interactable.options.drop.checker) {\n dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)\n }\n\n return dropped\n}\n\nconst drop: Interact.Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n interaction.dropState = {\n cur: {\n dropzone: null,\n element: null,\n },\n prev: {\n dropzone: null,\n element: null,\n },\n rejected: null,\n events: null,\n activeDrops: [],\n }\n },\n\n 'interactions:after-action-start': ({ interaction, event, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n const { dropState } = interaction\n\n // reset active dropzones\n dropState.activeDrops = null\n dropState.events = null\n dropState.activeDrops = getActiveDrops(scope, interaction.element)\n dropState.events = getDropEvents(interaction, event, dragEvent)\n\n if (dropState.events.activate) {\n fireActivationEvents(dropState.activeDrops, dropState.events.activate)\n scope.fire('actions/drop:start', { interaction, dragEvent })\n }\n },\n\n // FIXME proper signal types\n 'interactions:action-move': onEventCreated,\n 'interactions:action-end': onEventCreated,\n\n 'interactions:after-action-move': function fireDropAfterMove ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {\n if (interaction.prepared.name !== 'drag') { return }\n\n fireDropEvents(interaction, interaction.dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n interaction.dropState.events = {}\n },\n\n 'interactions:after-action-end': ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n fireDropEvents(interaction, interaction.dropState.events)\n scope.fire('actions/drop:end', { interaction, dragEvent })\n },\n\n 'interactions:stop': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null\n dropState.events = null\n dropState.cur.dropzone = null\n dropState.cur.element = null\n dropState.prev.dropzone = null\n dropState.prev.element = null\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n defaults: {\n enabled: false,\n accept : null,\n overlap: 'pointer',\n } as Interact.DropzoneOptions,\n}\n\nexport default drop\n","import * as utils from '@interactjs/utils/index'\n\nexport type GesturableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n gesture?: {\n angle: number // angle from first to second touch\n distance: number\n scale: number // gesture.distance / gesture.startDistance\n startAngle: number // angle of line joining two touches\n startDistance: number // distance between two touches of touchStart\n }\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n gesturable: GesturableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n gesture: Interact.GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GestureEvent extends Interact.InteractEvent<'gesture'> {\n distance: number\n angle: number\n da: number // angle change\n scale: number // ratio of distance start to current event\n ds: number // scale change\n box: Interact.Rect // enclosing box of all points\n touches: Interact.PointerType[]\n}\n\nexport interface GestureSignalArg extends Interact.DoPhaseArg<'gesture', Interact.EventPhase> {\n iEvent: GestureEvent\n interaction: Interact.Interaction<'gesture'>\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n /**\n * ```js\n * interact(element).gesturable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // limit multiple gestures.\n * // See the explanation in {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isGestureable = interact(element).gesturable()\n * ```\n *\n * Gets or sets whether multitouch gestures can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on gesture events (makes the Interactable gesturable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of gesture events, or this Interactable\n */\n Interactable.prototype.gesturable = function (this: Interact.Interactable, options: Interact.GesturableOptions | boolean) {\n if (utils.is.object(options)) {\n this.options.gesture.enabled = options.enabled !== false\n this.setPerAction('gesture', options)\n this.setOnEvents('gesture', options)\n\n return this\n }\n\n if (utils.is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as Interact.Options\n } as GesturableMethod\n\n actions.map.gesture = gesture\n actions.methodDict.gesture = 'gesturable'\n\n defaults.actions.gesture = gesture.defaults\n}\n\nfunction updateGestureProps ({ interaction, iEvent, phase }: GestureSignalArg) {\n if (interaction.prepared.name !== 'gesture') { return }\n\n const pointers = interaction.pointers.map(p => p.pointer)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const deltaSource = interaction.interactable.options.deltaSource\n\n iEvent.touches = [pointers[0], pointers[1]]\n\n if (starting) {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n }\n else if (ending) {\n const prevEvent = interaction.prevEvent as GestureEvent\n\n iEvent.distance = prevEvent.distance\n iEvent.box = prevEvent.box\n iEvent.scale = prevEvent.scale\n iEvent.ds = 0\n iEvent.angle = prevEvent.angle\n iEvent.da = 0\n }\n else {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n\n iEvent.ds = iEvent.scale - interaction.gesture.scale\n iEvent.da = iEvent.angle - interaction.gesture.angle\n }\n\n interaction.gesture.distance = iEvent.distance\n interaction.gesture.angle = iEvent.angle\n\n if (utils.is.number(iEvent.scale) &&\n iEvent.scale !== Infinity &&\n !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: Interact.Plugin = {\n id: 'actions/gesture',\n before: ['actions/drag', 'actions/resize'],\n install,\n listeners: {\n 'interactions:action-start': updateGestureProps,\n 'interactions:action-move': updateGestureProps,\n 'interactions:action-end': updateGestureProps,\n\n 'interactions:new': ({ interaction }) => {\n interaction.gesture = {\n angle: 0,\n distance: 0,\n scale: 1,\n startAngle: 0,\n startDistance: 0,\n }\n },\n\n 'auto-start:check': arg => {\n if (arg.interaction.pointers.length < 2) {\n return undefined\n }\n\n const gestureOptions = arg.interactable.options.gesture\n\n if (!(gestureOptions && gestureOptions.enabled)) {\n return undefined\n }\n\n arg.action = { name: 'gesture' }\n\n return false\n },\n },\n\n defaults: {\n },\n\n getCursor () {\n return ''\n },\n}\n\nexport default gesture\n","import { Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n resizable: ResizableMethod\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n resizeAxes: 'x' | 'y' | 'xy'\n resizeStartAspectRatio: number\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n resize: Interact.ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizeEvent

extends Interact.InteractEvent<'resize', P> {\n deltaRect?: Interact.FullRect\n edges?: Interact.ActionProps['edges']\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n browser,\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n defaults,\n } = scope\n\n // Less Precision with touch input\n\n resize.cursors = initCursors(browser)\n resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10\n\n /**\n * ```js\n * interact(element).resizable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * edges: {\n * top : true, // Use pointer coords to check for resize.\n * left : false, // Disable resizing from left edge.\n * bottom: '.resize-s',// Resize if pointer target matches selector\n * right : handleEl // Resize if pointer target is the given Element\n * },\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height are adjusted at a 1:1 ratio.\n * square: false,\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height maintain the aspect ratio they had when resizing started.\n * preserveAspectRatio: false,\n *\n * // a value of 'none' will limit the resize rect to a minimum of 0x0\n * // 'negate' will allow the rect to have negative width/height\n * // 'reposition' will keep the width/height positive by swapping\n * // the top and bottom edges and/or swapping the left and right edges\n * invert: 'none' || 'negate' || 'reposition'\n *\n * // limit multiple resizes.\n * // See the explanation in the {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isResizeable = interact(element).resizable()\n * ```\n *\n * Gets or sets whether resize actions can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on resize events (object makes the Interactable\n * resizable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of resize elements, or this Interactable\n */\n Interactable.prototype.resizable = function (this: Interact.Interactable, options: Interact.ResizableOptions | boolean) {\n return resizable(this, options, scope)\n } as ResizableMethod\n\n actions.map.resize = resize\n actions.methodDict.resize = 'resizable'\n\n defaults.actions.resize = resize.defaults\n}\n\nfunction resizeChecker (arg) {\n const { interaction, interactable, element, rect, buttons } = arg\n\n if (!rect) { return undefined }\n\n const page = extend({}, interaction.coords.cur.page)\n const resizeOptions = interactable.options.resize\n\n if (\n !(resizeOptions && resizeOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & resizeOptions.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n // if using resize.edges\n if (is.object(resizeOptions.edges)) {\n const resizeEdges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n\n for (const edge in resizeEdges) {\n resizeEdges[edge] = checkResizeEdge(edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin)\n }\n\n resizeEdges.left = resizeEdges.left && !resizeEdges.right\n resizeEdges.top = resizeEdges.top && !resizeEdges.bottom\n\n if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {\n arg.action = {\n name: 'resize',\n edges: resizeEdges,\n }\n }\n }\n else {\n const right = resizeOptions.axis !== 'y' && page.x > (rect.right - resize.defaultMargin)\n const bottom = resizeOptions.axis !== 'x' && page.y > (rect.bottom - resize.defaultMargin)\n\n if (right || bottom) {\n arg.action = {\n name: 'resize',\n axes: (right ? 'x' : '') + (bottom ? 'y' : ''),\n }\n }\n }\n\n return arg.action ? false : undefined\n}\n\nfunction resizable (interactable: Interact.Interactable, options: Interact.OrBoolean | boolean, scope: Scope) {\n if (is.object(options)) {\n interactable.options.resize.enabled = options.enabled !== false\n interactable.setPerAction('resize', options)\n interactable.setOnEvents('resize', options)\n\n if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {\n interactable.options.resize.axis = options.axis\n }\n else if (options.axis === null) {\n interactable.options.resize.axis = scope.defaults.actions.resize.axis\n }\n\n if (is.bool(options.preserveAspectRatio)) {\n interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio\n }\n else if (is.bool(options.square)) {\n interactable.options.resize.square = options.square\n }\n\n return interactable\n }\n if (is.bool(options)) {\n interactable.options.resize.enabled = options\n\n return interactable\n }\n return interactable.options.resize\n}\n\nfunction checkResizeEdge (\n name: string,\n value: any,\n page: Interact.Point,\n element: Node,\n interactableElement: Interact.Element,\n rect: Interact.Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) { return false }\n\n // true value, use pointer coords and element rect\n if (value === true) {\n // if dimensions are negative, \"switch\" edges\n const width = is.number(rect.width) ? rect.width : rect.right - rect.left\n const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top\n\n // don't use margin greater than half the relevent dimension\n margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2)\n\n if (width < 0) {\n if (name === 'left') { name = 'right' }\n else if (name === 'right') { name = 'left' }\n }\n if (height < 0) {\n if (name === 'top') { name = 'bottom' }\n else if (name === 'bottom') { name = 'top' }\n }\n\n if (name === 'left') { return page.x < ((width >= 0 ? rect.left : rect.right) + margin) }\n if (name === 'top') { return page.y < ((height >= 0 ? rect.top : rect.bottom) + margin) }\n\n if (name === 'right') { return page.x > ((width >= 0 ? rect.right : rect.left) - margin) }\n if (name === 'bottom') { return page.y > ((height >= 0 ? rect.bottom : rect.top) - margin) }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) { return false }\n\n return is.element(value)\n // the value is an element to use as a resize handle\n ? value === element\n // otherwise check if element matches value as selector\n : dom.matchesUpTo(element, value, interactableElement)\n}\n\nfunction initCursors (browser: typeof import ('@interactjs/utils/browser').default) {\n return (browser.isIe9 ? {\n x : 'e-resize',\n y : 's-resize',\n xy: 'se-resize',\n\n top : 'n-resize',\n left : 'w-resize',\n bottom : 's-resize',\n right : 'e-resize',\n topleft : 'se-resize',\n bottomright: 'se-resize',\n topright : 'ne-resize',\n bottomleft : 'ne-resize',\n } : {\n x : 'ew-resize',\n y : 'ns-resize',\n xy: 'nwse-resize',\n\n top : 'ns-resize',\n left : 'ew-resize',\n bottom : 'ns-resize',\n right : 'ew-resize',\n topleft : 'nwse-resize',\n bottomright: 'nwse-resize',\n topright : 'nesw-resize',\n bottomleft : 'nesw-resize',\n })\n}\n\nfunction start ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {\n return\n }\n\n const resizeEvent = iEvent as ResizeEvent\n const rect = interaction.rect\n\n interaction._rects = {\n start: extend({}, rect),\n corrected: extend({}, rect),\n previous: extend({}, rect),\n delta: {\n left: 0,\n right : 0,\n width : 0,\n top : 0,\n bottom: 0,\n height: 0,\n },\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction move ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n const resizeOptions = interaction.interactable.options.resize\n const invert = resizeOptions.invert\n const invertible = invert === 'reposition' || invert === 'negate'\n\n // eslint-disable-next-line no-shadow\n const current = interaction.rect\n const { start: startRect, corrected, delta: deltaRect, previous } = interaction._rects\n\n extend(previous, corrected)\n\n if (invertible) {\n // if invertible, copy the current rect\n extend(corrected, current)\n\n if (invert === 'reposition') {\n // swap edge values if necessary to keep width/height positive\n if (corrected.top > corrected.bottom) {\n const swap = corrected.top\n\n corrected.top = corrected.bottom\n corrected.bottom = swap\n }\n if (corrected.left > corrected.right) {\n const swap = corrected.left\n\n corrected.left = corrected.right\n corrected.right = swap\n }\n }\n }\n else {\n // if not invertible, restrict to minimum of 0x0 rect\n corrected.top = Math.min(current.top, startRect.bottom)\n corrected.bottom = Math.max(current.bottom, startRect.top)\n corrected.left = Math.min(current.left, startRect.right)\n corrected.right = Math.max(current.right, startRect.left)\n }\n\n corrected.width = corrected.right - corrected.left\n corrected.height = corrected.bottom - corrected.top\n\n for (const edge in corrected) {\n deltaRect[edge] = corrected[edge] - previous[edge]\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = corrected\n resizeEvent.deltaRect = deltaRect\n}\n\nfunction end ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction updateEventAxes ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { return }\n\n const options = interaction.interactable.options\n const resizeEvent = iEvent as ResizeEvent\n\n if (options.resize.square) {\n if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = resizeEvent.delta.y\n }\n else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n }\n else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n }\n else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: Interact.Plugin = {\n id: 'actions/resize',\n before: ['actions/drag'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.resizeAxes = 'xy'\n },\n\n 'interactions:action-start': arg => {\n start(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-move': arg => {\n move(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-end': end,\n 'auto-start:check': resizeChecker,\n },\n\n defaults: {\n square: false,\n preserveAspectRatio: false,\n axis: 'xy',\n\n // use default margin\n margin: NaN,\n\n // object with props left, right, top, bottom which are\n // true/false values to resize when the pointer is over that edge,\n // CSS selectors to match the handles for each direction\n // or the Elements for each handle\n edges: null,\n\n // a value of 'none' will limit the resize rect to a minimum of 0x0\n // 'negate' will alow the rect to have negative width/height\n // 'reposition' will keep the width/height positive by swapping\n // the top and bottom edges and/or swapping the left and right edges\n invert: 'none',\n } as Interact.ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: Interact.ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\n }\n else if (edges) {\n let cursorKey = ''\n\n for (const edge of ['top', 'bottom', 'left', 'right']) {\n if (edges[edge]) {\n cursorKey += edge\n }\n }\n\n result = cursors[cursorKey]\n }\n\n return result\n },\n\n defaultMargin: null as number,\n}\n\nexport default resize\n","import { Scope } from '@interactjs/core/scope'\nimport drag from './drag'\nimport drop from './drop/index'\nimport gesture from './gesture'\nimport resize from './resize'\n\nfunction install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n}\n\nconst id = 'actions'\n\nexport {\n id,\n install,\n gesture,\n resize,\n drag,\n drop,\n}\n","import * as domUtils from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\n\ntype Scope = import ('@interactjs/core/scope').Scope\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoScroll: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoScroll?: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const {\n defaults,\n actions,\n } = scope\n\n scope.autoScroll = autoScroll\n autoScroll.now = () => scope.now()\n\n actions.phaselessTypes.autoscroll = true\n defaults.perAction.autoScroll = autoScroll.defaults\n}\n\nconst autoScroll = {\n defaults: {\n enabled : false,\n margin : 60,\n\n // the item that is scrolled (Window or HTMLElement)\n container: null as AutoScrollOptions['container'],\n\n // the scroll speed in pixels per second\n speed : 300,\n } as AutoScrollOptions,\n\n now: Date.now,\n\n interaction: null as Interact.Interaction,\n i: 0, // the handle returned by window.setInterval\n x: 0,\n y: 0, // Direction each pulse is to scroll in\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: Interact.Interaction) {\n autoScroll.isScrolling = true\n raf.cancel(autoScroll.i)\n\n interaction.autoScroll = autoScroll\n autoScroll.interaction = interaction\n autoScroll.prevTime = autoScroll.now()\n autoScroll.i = raf.request(autoScroll.scroll)\n },\n\n stop () {\n autoScroll.isScrolling = false\n if (autoScroll.interaction) {\n autoScroll.interaction.autoScroll = null\n }\n raf.cancel(autoScroll.i)\n },\n\n // scroll the window by the values in scroll.x/y\n scroll () {\n const { interaction } = autoScroll\n const { interactable, element } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n const now = autoScroll.now()\n // change in time in seconds\n const dt = (now - autoScroll.prevTime) / 1000\n // displacement\n const s = options.speed * dt\n\n if (s >= 1) {\n const scrollBy = {\n x: autoScroll.x * s,\n y: autoScroll.y * s,\n }\n\n if (scrollBy.x || scrollBy.y) {\n const prevScroll = getScroll(container)\n\n if (is.window(container)) {\n container.scrollBy(scrollBy.x, scrollBy.y)\n }\n else if (container) {\n container.scrollLeft += scrollBy.x\n container.scrollTop += scrollBy.y\n }\n\n const curScroll = getScroll(container)\n const delta = {\n x: curScroll.x - prevScroll.x,\n y: curScroll.y - prevScroll.y,\n }\n\n if (delta.x || delta.y) {\n interactable.fire({\n type: 'autoscroll',\n target: element,\n interactable,\n delta,\n interaction,\n container,\n })\n }\n }\n\n autoScroll.prevTime = now\n }\n\n if (autoScroll.isScrolling) {\n raf.cancel(autoScroll.i)\n autoScroll.i = raf.request(autoScroll.scroll)\n }\n },\n check (interactable: Interact.Interactable, actionName: Interact.ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll && options[actionName].autoScroll.enabled\n },\n onInteractionMove ({ interaction, pointer }: { interaction: Interact.Interaction, pointer: Interact.PointerType }) {\n if (!(interaction.interacting() &&\n autoScroll.check(interaction.interactable, interaction.prepared.name))) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top\n let right\n let bottom\n let left\n\n const { interactable, element } = interaction\n const actionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n\n if (is.window(container)) {\n left = pointer.clientX < autoScroll.margin\n top = pointer.clientY < autoScroll.margin\n right = pointer.clientX > container.innerWidth - autoScroll.margin\n bottom = pointer.clientY > container.innerHeight - autoScroll.margin\n }\n else {\n const rect = domUtils.getElementClientRect(container)\n\n left = pointer.clientX < rect.left + autoScroll.margin\n top = pointer.clientY < rect.top + autoScroll.margin\n right = pointer.clientX > rect.right - autoScroll.margin\n bottom = pointer.clientY > rect.bottom - autoScroll.margin\n }\n\n autoScroll.x = (right ? 1 : left ? -1 : 0)\n autoScroll.y = (bottom ? 1 : top ? -1 : 0)\n\n if (!autoScroll.isScrolling) {\n // set the autoScroll properties to those of the target\n autoScroll.margin = options.margin\n autoScroll.speed = options.speed\n\n autoScroll.start(interaction)\n }\n },\n}\n\nexport function getContainer (value: any, interactable: Interact.Interactable, element: Interact.Element) {\n return (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta ({ interaction, element }: {\n interaction: Partial>\n element: Interact.Element\n}, func: any) {\n const scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll\n\n if (!scrollOptions || !scrollOptions.enabled) {\n func()\n return { x: 0, y: 0 }\n }\n\n const scrollContainer = getContainer(\n scrollOptions.container,\n interaction.interactable,\n element,\n )\n\n const prevSize = getScroll(scrollContainer)\n func()\n const curSize = getScroll(scrollContainer)\n\n return {\n x: curSize.x - prevSize.x,\n y: curSize.y - prevSize.y,\n }\n}\n\nconst autoScrollPlugin: Interact.Plugin = {\n id: 'auto-scroll',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoScroll = null\n },\n\n 'interactions:destroy': ({ interaction }) => {\n interaction.autoScroll = null\n autoScroll.stop()\n if (autoScroll.interaction) {\n autoScroll.interaction = null\n }\n },\n\n 'interactions:stop': autoScroll.stop,\n\n 'interactions:action-move': (arg: any) => autoScroll.onInteractionMove(arg),\n },\n}\n\nexport default autoScrollPlugin\n","import { warnOnce } from '@interactjs/utils/index'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ) => Interact.ActionProps | null\n styleCursor: typeof styleCursor\n actionChecker: typeof actionChecker\n ignoreFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n allowFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n pointerIsDown: boolean\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n } = scope\n\n Interactable.prototype.getAction = function getAction (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ): Interact.ActionProps {\n const action = defaultActionChecker(this, event, interaction, element, scope)\n\n if (this.options.actionChecker) {\n return this.options.actionChecker(pointer, event, action, this, element, interaction)\n }\n\n return action\n }\n\n /**\n * ```js\n * interact(element, { ignoreFrom: document.getElementById('no-action') })\n * // or\n * interact(element).ignoreFrom('input, textarea, a')\n * ```\n * @deprecated\n * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\n * of it's parents match the given CSS selector or Element, no\n * drag/resize/gesture is started.\n *\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to not ignore any elements\n * @return {string | Element | object} The current ignoreFrom value or this\n * Interactable\n */\n Interactable.prototype.ignoreFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\n * @deprecated\n *\n * A drag/resize/gesture is started only If the target of the `mousedown`,\n * `pointerdown` or `touchstart` event or any of it's parents match the given\n * CSS selector or Element.\n *\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to allow from any element\n * @return {string | Element | object} The current allowFrom value or this\n * Interactable\n */\n Interactable.prototype.allowFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('allowFrom', newValue)\n }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).')\n\n /**\n * ```js\n * interact('.resize-drag')\n * .resizable(true)\n * .draggable(true)\n * .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n *\n * if (interact.matchesSelector(event.target, '.drag-handle')) {\n * // force drag with handle target\n * action.name = drag\n * }\n * else {\n * // resize from the top and right edges\n * action.name = 'resize'\n * action.edges = { top: true, right: true }\n * }\n *\n * return action\n * })\n * ```\n *\n * Returns or sets the function used to check action to be performed on\n * pointerDown\n *\n * @param {function | null} [checker] A function which takes a pointer event,\n * defaultAction string, interactable, element and interaction as parameters\n * and returns an object with name property 'drag' 'resize' or 'gesture' and\n * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right\n * props.\n * @return {Function | Interactable} The checker function or this Interactable\n */\n Interactable.prototype.actionChecker = actionChecker\n\n /**\n * Returns or sets whether the the cursor should be changed depending on the\n * action that would be performed if the mouse were pressed and dragged.\n *\n * @param {boolean} [newValue]\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.styleCursor = styleCursor\n}\n\nfunction defaultActionChecker (\n interactable: Interact.Interactable,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n scope: Interact.Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons = (event as MouseEvent).buttons || ({\n 0: 1,\n 1: 4,\n 3: 8,\n 4: 16,\n })[(event as MouseEvent).button as 0 | 1 | 3 | 4]\n const arg = {\n action: null,\n interactable,\n interaction,\n element,\n rect,\n buttons,\n }\n\n scope.fire('auto-start:check', arg)\n\n return arg.action\n}\n\nfunction styleCursor (this: Interact.Interactable, newValue?: boolean) {\n if (is.bool(newValue)) {\n this.options.styleCursor = newValue\n\n return this\n }\n\n if (newValue === null) {\n delete this.options.styleCursor\n\n return this\n }\n\n return this.options.styleCursor\n}\n\nfunction actionChecker (this: Interact.Interactable, checker: any) {\n if (is.func(checker)) {\n this.options.actionChecker = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.options.actionChecker\n\n return this\n }\n\n return this.options.actionChecker\n}\n\nexport default {\n id: 'auto-start/interactableMethods',\n install,\n}\n","import * as utils from '@interactjs/utils/index'\nimport InteractableMethods from './InteractableMethods'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n maxInteractions: (...args: any[]) => any\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Interact.SignalArgs['interactions:move']\n 'autoStart:prepared': { interaction: Interact.Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n actionChecker?: any\n cursorChecker?: any\n styleCursor?: any\n }\n\n interface PerActionDefaults {\n manualStart?: boolean\n max?: number\n maxPerElement?: number\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n cursorChecker?: Interact.CursorChecker\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons?: 0 | 1 | 2 | 4 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interact.Interactable\n interaction: Interact.Interaction\n element: Interact.Element\n action: Interact.ActionProps\n buttons: number\n}\n\nexport interface AutoStart {\n // Allow this many interactions to happen simultaneously\n maxInteractions: number\n withinInteractionLimit: typeof withinInteractionLimit\n cursorElement: Interact.Element\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n interact,\n defaults,\n } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n utils.extend(defaults.perAction, {\n manualStart: false,\n max: Infinity,\n maxPerElement: 1,\n allowFrom: null,\n ignoreFrom: null,\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons: 1,\n })\n\n /**\n * Returns or sets the maximum number of concurrent interactions allowed. By\n * default only 1 interaction is allowed at a time (for backwards\n * compatibility). To allow multiple interactions on the same Interactables and\n * elements, you need to enable it in the draggable, resizable and gesturable\n * `'max'` and `'maxPerElement'` options.\n *\n * @alias module:interact.maxInteractions\n *\n * @param {number} [newValue] Any number. newValue <= 0 means no interactions.\n */\n interact.maxInteractions = newValue => maxInteractions(newValue, scope)\n\n scope.autoStart = {\n // Allow this many interactions to happen simultaneously\n maxInteractions: Infinity,\n withinInteractionLimit,\n cursorElement: null,\n }\n}\n\nfunction prepareOnDown ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n if (interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.pointerType !== 'mouse' ||\n interaction.pointerIsDown ||\n interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Interact.Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n const { interaction } = arg\n\n if (!interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) {\n interaction.stop()\n }\n else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interact.Interaction }, scope: Interact.Scope) {\n const { interactable } = interaction\n\n if (interactable && interactable.options.styleCursor) {\n setCursor(interaction.element, '', scope)\n }\n}\n\n// Check if the current interactable supports the action.\n// If so, return the validated action. Otherwise, return null\nfunction validateAction (\n action: Interact.ActionProps,\n interactable: Interact.Interactable,\n element: Interact.Element,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n matches: Interact.Interactable[],\n matchElements: Interact.Element[],\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n for (let i = 0, len = matches.length; i < len; i++) {\n const match = matches[i]\n const matchElement = matchElements[i]\n const matchAction = match.getAction(pointer, event, interaction, matchElement)\n\n if (!matchAction) { continue }\n\n const action = validateAction(\n matchAction,\n match,\n matchElement,\n eventTarget,\n scope)\n\n if (action) {\n return {\n action,\n interactable: match,\n element: matchElement,\n }\n }\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction getActionInfo (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n let matches: Interact.Interactable[] = []\n let matchElements: Interact.Element[] = []\n\n let element = eventTarget as Interact.Element\n\n function pushMatches (interactable: Interact.Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (utils.is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope)\n\n if (actionInfo.action &&\n !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = utils.dom.parentNode(element) as Interact.Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interact.Interaction,\n { action, interactable, element }: {\n action: Interact.ActionProps\n interactable: Interact.Interactable\n element: Interact.Element\n },\n scope: Interact.Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n utils.copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name\n ? interactable.getRect(element)\n : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interact.Interactable,\n element: Interact.Element,\n action: Interact.ActionProps,\n scope: Interact.Scope,\n) {\n const options = interactable.options\n const maxActions = options[action.name].max\n const maxPerElement = options[action.name].maxPerElement\n const autoStartMax = scope.autoStart.maxInteractions\n let activeInteractions = 0\n let interactableCount = 0\n let elementCount = 0\n\n // no actions if any of these values == 0\n if (!(maxActions && maxPerElement && autoStartMax)) { return false }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) { continue }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) { continue }\n\n interactableCount += otherAction === action.name ? 1 : 0\n\n if (interactableCount >= maxActions) {\n return false\n }\n\n if (interaction.element === element) {\n elementCount++\n\n if (otherAction === action.name && elementCount >= maxPerElement) {\n return false\n }\n }\n }\n\n return autoStartMax > 0\n}\n\nfunction maxInteractions (newValue: any, scope: Interact.Scope) {\n if (utils.is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Interact.Element, cursor: string, scope: Interact.Scope) {\n const { cursorElement: prevCursorElement } = scope.autoStart\n\n if (prevCursorElement && prevCursorElement !== element) {\n prevCursorElement.style.cursor = ''\n }\n\n element.ownerDocument.documentElement.style.cursor = cursor\n element.style.cursor = cursor\n scope.autoStart.cursorElement = cursor ? element : null\n}\n\nfunction setInteractionCursor (interaction: Interact.Interaction, scope: Interact.Scope) {\n const { interactable, element, prepared } = interaction\n\n if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {\n // clear previous target element cursor\n if (scope.autoStart.cursorElement) {\n setCursor(scope.autoStart.cursorElement, '', scope)\n }\n\n return\n }\n\n let cursor = ''\n\n if (prepared.name) {\n const cursorChecker: Interact.CursorChecker = interactable.options[prepared.name].cursorChecker\n\n if (utils.is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n }\n else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Interact.Plugin = {\n id: 'auto-start/base',\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n install,\n listeners: {\n 'interactions:down': prepareOnDown,\n 'interactions:move': (arg, scope) => {\n prepareOnMove(arg, scope)\n startOnMove(arg, scope)\n },\n 'interactions:stop': clearCursorOnStop,\n },\n maxInteractions,\n withinInteractionLimit,\n validateAction,\n} as Interact.Plugin\n\nexport default autoStart\n","import { parentNode } from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.prepared.name !== 'drag') { return }\n\n // check if a drag is in the correct axis\n const absX = Math.abs(dx)\n const absY = Math.abs(dy)\n const targetOptions = interaction.interactable.options.drag\n const startAxis = targetOptions.startAxis\n const currentAxis = (absX > absY ? 'x' : absX < absY ? 'y' : 'xy')\n\n interaction.prepared.axis = targetOptions.lockAxis === 'start'\n ? currentAxis[0] as 'x' | 'y' // always lock to one axis even if currentAxis === 'xy'\n : targetOptions.lockAxis\n\n // if the movement isn't in the startAxis of the interactable\n if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) {\n // cancel the prepared action\n interaction.prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Interact.Element\n\n const getDraggable = function (interactable: Interact.Interactable): Interact.Interactable | void {\n if (interactable === interaction.interactable) { return }\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart &&\n interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer, interaction.downEvent, interaction, element)\n\n if (action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)) {\n return interactable\n }\n }\n }\n\n // check all interactables\n while (is.element(element)) {\n const interactable = scope.interactables.forEachMatch(element, getDraggable)\n\n if (interactable) {\n interaction.prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Interact.Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interact.Interactable) {\n if (!interactable) { return false }\n\n const thisAxis = interactable.options.drag.startAxis\n\n return (startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis)\n}\n\nexport default {\n id: 'auto-start/dragAxis',\n listeners: { 'autoStart:before-start': beforeStart },\n}\n","import basePlugin from './base'\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n hold?: number\n delay?: number\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoStartHoldTimer?: any\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) { return null }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nexport default {\n id: 'auto-start/hold',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoStartHoldTimer = null\n },\n\n 'autoStart:prepared': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.autoStartHoldTimer = setTimeout(() => {\n interaction.start(interaction.prepared, interaction.interactable, interaction.element)\n }, hold)\n }\n },\n\n 'interactions:move': ({ interaction, duplicate }) => {\n if (interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\n","import autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n\nfunction install (scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n}\n\nconst id = 'auto-start'\n\nexport {\n id,\n install,\n autoStart,\n hold,\n dragAxis,\n}\n","import { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as is from '@interactjs/utils/is'\nimport { getWindow } from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n preventDefault: typeof preventDefault\n checkAndPreventDefault: (event: Event) => void\n }\n}\n\nfunction preventDefault (this: Interact.Interactable, newValue?: 'always' | 'never' | 'auto') {\n if (/^(always|never|auto)$/.test(newValue)) {\n this.options.preventDefault = newValue\n return this\n }\n\n if (is.bool(newValue)) {\n this.options.preventDefault = newValue ? 'always' : 'never'\n return this\n }\n\n return this.options.preventDefault\n}\n\nfunction checkAndPreventDefault (interactable: Interact.Interactable, scope: Interact.Scope, event: Event) {\n const setting = interactable.options.preventDefault\n\n if (setting === 'never') { return }\n\n if (setting === 'always') {\n event.preventDefault()\n return\n }\n\n // setting === 'auto'\n\n // if the browser supports passive event listeners and isn't running on iOS,\n // don't preventDefault of touch{start,move} events. CSS touch-action and\n // user-select should be used instead of calling event.preventDefault().\n if (events.supportsPassive && /^touch(start|move)$/.test(event.type)) {\n const doc = getWindow(event.target).document\n const docOptions = scope.getDocOptions(doc)\n\n if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {\n return\n }\n }\n\n // don't preventDefault of pointerdown events\n if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {\n return\n }\n\n // don't preventDefault on editable elements\n if (is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interact.Interaction, event: Interact.PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: Interact.Scope) {\n /** @lends Interactable */\n const { Interactable } = scope\n\n /**\n * Returns or sets whether to prevent the browser's default behaviour in\n * response to pointer events. Can be set to:\n * - `'always'` to always prevent\n * - `'never'` to never prevent\n * - `'auto'` to let interact.js try to determine what would be best\n *\n * @param {string} [newValue] `'always'`, `'never'` or `'auto'`\n * @return {string | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.preventDefault = preventDefault\n\n Interactable.prototype.checkAndPreventDefault = function (event) {\n return checkAndPreventDefault(this, scope, event)\n }\n\n // prevent native HTML5 drag on interact.js target elements\n scope.interactions.docEvents.push({\n type: 'dragstart',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n if (interaction.element &&\n (interaction.element === event.target ||\n nodeContains(interaction.element, event.target))) {\n interaction.interactable.checkAndPreventDefault(event)\n return\n }\n }\n },\n })\n}\n\nexport default {\n id: 'core/interactablePreventDefault',\n install,\n listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => {\n acc[`interactions:${eventType}`] = onInteractionEvent\n return acc\n }, {} as any),\n}\n","/* eslint-disable no-console */\n/* global process */\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools?: Interact.OptionMethod\n }\n}\n\nexport interface DevToolsOptions {\n ignore: { [P in keyof typeof CheckName]?: boolean }\n}\n\nexport interface Logger {\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n log: (...args: any[]) => void\n}\n\nexport interface Check {\n name: CheckName\n text: string\n perform: (interaction: Interact.Interaction) => boolean\n getInfo: (interaction: Interact.Interaction) => any[]\n}\n\nenum CheckName {\n touchAction = 'touchAction',\n boxSizing = 'boxSizing',\n noListeners = 'noListeners',\n}\n\nconst prefix = '[interact.js] '\nconst links = {\n touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action',\n boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing',\n}\n\nconst isProduction = process.env.NODE_ENV === 'production'\n\n// eslint-disable-next-line no-restricted-syntax\nfunction install (scope: Interact.Scope, { logger }: { logger?: Logger } = {}) {\n const {\n Interactable,\n defaults,\n } = scope\n\n scope.logger = logger || console\n\n defaults.base.devTools = {\n ignore: {},\n }\n\n Interactable.prototype.devTools = function (options?: object) {\n if (options) {\n extend(this.options.devTools, options)\n return this\n }\n\n return this.options.devTools\n }\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [\n element,\n links.touchAction,\n ]\n },\n text: 'Consider adding CSS \"touch-action: none\" to this element\\n',\n },\n\n {\n name: CheckName.boxSizing,\n perform (interaction) {\n const { element } = interaction\n\n return interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [\n element,\n links.boxSizing,\n ]\n },\n },\n\n {\n name: CheckName.noListeners,\n perform (interaction) {\n const actionName = interaction.prepared.name\n const moveListeners = interaction.interactable.events.types[`${actionName}move`] || []\n\n return !moveListeners.length\n },\n getInfo (interaction) {\n return [\n interaction.prepared.name,\n interaction.interactable,\n ]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n return styleRe.test(element.style[prop] || win.window.getComputedStyle(element)[prop])\n}\n\nfunction parentHasStyle (element: Interact.Element, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n let parent = element as HTMLElement\n\n while (is.element(parent)) {\n if (hasStyle(parent, prop, styleRe)) {\n return true\n }\n\n parent = parentNode(parent) as HTMLElement\n }\n\n return false\n}\n\nconst id = 'dev-tools'\nconst defaultExport: Interact.Plugin = isProduction\n ? { id, install: () => {} }\n : {\n id,\n install,\n listeners: {\n 'interactions:action-start': ({ interaction }, scope) => {\n for (const check of checks) {\n const options = interaction.interactable && interaction.interactable.options\n\n if (\n !(options && options.devTools && options.devTools.ignore[check.name]) &&\n check.perform(interaction)\n ) {\n scope.logger.warn(prefix + check.text, ...check.getInfo(interaction))\n }\n }\n },\n },\n checks,\n CheckName,\n links,\n prefix,\n }\n\nexport default defaultExport\n","import clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { Modifier, ModifierArg, ModifierState } from './base'\n\nexport interface ModificationResult {\n delta: Interact.Point\n rectDelta: Interact.Rect\n coords: Interact.Point\n rect: Interact.FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: Interact.EventPhase\n pageCoords?: Interact.Point\n rect?: Interact.FullRect\n coords?: Interact.Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Interact.Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta: Interact.Point = null\n result?: ModificationResult = null\n endResult?: Interact.Point = null\n edges: Interact.EdgeOptions\n\n constructor (readonly interaction: Readonly) {}\n\n start (\n { phase }: MethodArg,\n pageCoords: Interact.Point,\n ) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.edges = extend({}, interaction.edges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg: MethodArg = {\n phase,\n pageCoords,\n preEnd: false,\n }\n\n this.result = createResult()\n this.startAll(arg)\n\n const result = this.result = this.setAll(arg)\n\n return result\n }\n\n fillArg (arg: Partial) {\n const { interaction } = this\n\n arg.interaction = interaction\n arg.interactable = interaction.interactable\n arg.element = interaction.element\n arg.rect = arg.rect || interaction.rect\n arg.edges = this.edges\n arg.startOffset = this.startOffset\n }\n\n startAll (arg: MethodArg & Partial) {\n this.fillArg(arg)\n\n for (const state of this.states) {\n if (state.methods.start) {\n arg.state = state\n state.methods.start(arg as ModifierArg)\n }\n }\n }\n\n setAll (arg: MethodArg & Partial): ModificationResult {\n this.fillArg(arg)\n\n const {\n phase,\n preEnd,\n skipModifiers,\n rect: unmodifiedRect,\n } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n\n const states = skipModifiers\n ? this.states.slice(skipModifiers)\n : this.states\n\n const newResult = createResult(arg.coords, arg.rect)\n\n for (const state of states) {\n const { options } = state\n const lastModifierCoords = extend({}, arg.coords)\n let returnValue = null\n\n if (state.methods.set && this.shouldDo(options, preEnd, phase)) {\n arg.state = state\n returnValue = state.methods.set(arg as ModifierArg)\n\n rectUtils.addEdges(this.interaction.edges, arg.rect, { x: arg.coords.x - lastModifierCoords.x, y: arg.coords.y - lastModifierCoords.y })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n newResult.delta.x = arg.coords.x - arg.pageCoords.x\n newResult.delta.y = arg.coords.y - arg.pageCoords.y\n\n newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left\n newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right\n newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top\n newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom\n\n const prevCoords = this.result.coords\n const prevRect = this.result.rect\n const rectChanged = !prevRect || newResult.rect.left !== prevRect.left ||\n newResult.rect.right !== prevRect.right ||\n newResult.rect.top !== prevRect.top ||\n newResult.rect.bottom !== prevRect.bottom\n\n newResult.changed = rectChanged ||\n prevCoords.x !== newResult.coords.x ||\n prevCoords.y !== newResult.coords.y\n\n newResult.rect = arg.rect\n return newResult\n }\n\n applyToInteraction (arg: { phase: Interact.EventPhase, rect?: Interact.Rect }) {\n const { interaction } = this\n const { phase } = arg\n const curCoords = interaction.coords.cur\n const startCoords = interaction.coords.start\n const { result, startDelta } = this\n const curDelta = result.delta\n\n if (phase === 'start') {\n extend(this.startDelta, result.delta)\n }\n\n for (const [coordsSet, delta] of [[startCoords, startDelta], [curCoords, curDelta]] as const) {\n coordsSet.page.x += delta.x\n coordsSet.page.y += delta.y\n coordsSet.client.x += delta.x\n coordsSet.client.y += delta.y\n }\n\n const { rectDelta } = this.result\n const rect = arg.rect || interaction.rect\n\n rect.left += rectDelta.left\n rect.right += rectDelta.right\n rect.top += rectDelta.top\n rect.bottom += rectDelta.bottom\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n setAndApply (arg: Partial & {\n phase: Interact.EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Interact.Point\n }): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n })\n\n this.result = result\n\n // don't fire an action move if a modifier would keep the event in the same\n // cordinates as before\n if (!result.changed && (!skipModifiers || skipModifiers < this.states.length) && interaction.interacting()) {\n return false\n }\n\n if (arg.modifiedCoords) {\n const { page } = interaction.coords.cur\n const adjustment = {\n x: arg.modifiedCoords.x - page.x,\n y: arg.modifiedCoords.y - page.y,\n }\n\n result.coords.x += adjustment.x\n result.coords.y += adjustment.y\n result.delta.x += adjustment.x\n result.delta.y += adjustment.y\n }\n\n this.applyToInteraction(arg)\n }\n\n beforeEnd (arg: Omit & { state?: ModifierState }): void | false {\n const { interaction, event } = arg\n const states = this.states\n\n if (!states || !states.length) {\n return\n }\n\n let doPreend = false\n\n for (const state of states) {\n arg.state = state\n const { options, methods } = state\n\n const endPosition = methods.beforeEnd && methods.beforeEnd(arg as unknown as ModifierArg)\n\n if (endPosition) {\n this.endResult = endPosition\n return false\n }\n\n doPreend = doPreend || (!doPreend && this.shouldDo(options, true))\n }\n\n if (!doPreend) {\n // trigger a final modified move before ending\n interaction.move({ event, preEnd: true })\n }\n }\n\n stop (arg: { interaction: Interact.Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend({\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n }, arg)\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) { state.methods.stop(modifierArg as ModifierArg) }\n }\n\n this.states = null\n this.endResult = null\n }\n\n prepareStates (modifierList: Modifier[]) {\n this.states = []\n\n for (let index = 0; index < modifierList.length; index++) {\n const { options, methods, name } = modifierList[index]\n\n if (options && options.enabled === false) { continue }\n\n this.states.push({\n options,\n methods,\n index,\n name,\n })\n }\n\n return this.states\n }\n\n restoreInteractionCoords ({ interaction: { coords, rect, modification } }: { interaction: Interact.Interaction }) {\n if (!modification.result) { return }\n\n const { startDelta } = modification\n const { delta: curDelta, rectDelta } = modification.result\n\n const coordsAndDeltas = [\n [coords.start, startDelta],\n [coords.cur, curDelta],\n ]\n\n for (const [coordsSet, delta] of coordsAndDeltas as any) {\n coordsSet.page.x -= delta.x\n coordsSet.page.y -= delta.y\n coordsSet.client.x -= delta.x\n coordsSet.client.y -= delta.y\n }\n\n rect.left -= rectDelta.left\n rect.right -= rectDelta.right\n rect.top -= rectDelta.top\n rect.bottom -= rectDelta.bottom\n }\n\n shouldDo (options, preEnd?: boolean, phase?: string) {\n return options\n ? options.enabled !== false &&\n (preEnd || !options.endOnly) &&\n (options.setStart || phase !== 'start')\n : true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.edges = other.edges\n this.states = other.states.map(s => clone(s) as ModifierState)\n this.result = createResult(extend({}, other.result.coords), extend({}, other.result.rect))\n }\n\n destroy () {\n for (const prop in this) {\n this[prop] = null\n }\n }\n}\n\nfunction createResult (coords?: Interact.Point, rect?: Interact.FullRect): ModificationResult {\n return {\n rect,\n coords,\n delta: { x: 0, y: 0 },\n rectDelta: {\n left : 0,\n right : 0,\n top : 0,\n bottom: 0,\n },\n eventProps: [],\n changed: true,\n }\n}\n\nfunction getModifierList (interaction) {\n const actionOptions = interaction.interactable.options[interaction.prepared.name]\n const actionModifiers = actionOptions.modifiers\n\n if (actionModifiers && actionModifiers.length) {\n return actionModifiers.filter(\n modifier => !modifier.options || modifier.options.enabled !== false,\n )\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map(type => {\n const options = actionOptions[type]\n\n return options && options.enabled && {\n options,\n methods: options._methods,\n }\n })\n .filter(m => !!m)\n}\n\nexport function getRectOffset (rect, coords) {\n return rect\n ? {\n left : coords.x - rect.left,\n top : coords.y - rect.top,\n right : rect.right - coords.x,\n bottom: rect.bottom - coords.y,\n }\n : {\n left : 0,\n top : 0,\n right : 0,\n bottom: 0,\n }\n}\n","import Modification from './Modification'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n modifiers?: any\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n modification?: Modification\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface InteractEvent {\n modifiers?: Array<{\n name: string\n [key: string]: any\n }>\n }\n}\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport interface Modifier<\n Defaults = any,\n State extends ModifierState = any,\n Name extends string = any\n> {\n options?: Defaults\n methods: {\n start?: (arg: ModifierArg) => void\n set: (arg: ModifierArg) => void\n beforeEnd?: (arg: ModifierArg) => Interact.Point | void\n stop?: (arg: ModifierArg) => void\n }\n name?: Name\n}\n\nexport type ModifierState<\n Defaults = {},\n StateProps extends { [prop: string]: any } = {},\n Name extends string = any\n> = {\n options: Defaults\n methods?: Modifier['methods']\n index?: number\n name?: Name\n} & StateProps\n\nexport interface ModifierArg {\n interaction: Interact.Interaction\n interactable: Interact.Interactable\n phase: Interact.EventPhase\n rect: Interact.FullRect\n edges: Interact.EdgeOptions\n state?: State\n element: Interact.Element\n pageCoords?: Interact.Point\n prevCoords?: Interact.Point\n prevRect?: Interact.FullRect\n coords?: Interact.Point\n startOffset?: Interact.Rect\n preEnd?: boolean\n}\n\nexport interface ModifierModule<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n> {\n defaults?: Defaults\n start? (arg: ModifierArg): void\n set? (arg: ModifierArg): any\n beforeEnd? (arg: ModifierArg): Interact.Point | void\n stop? (arg: ModifierArg): void\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string\n> (\n module: ModifierModule,\n name?: Name,\n) {\n const { defaults } = module\n const methods = {\n start: module.start,\n set: module.set,\n beforeEnd: module.beforeEnd,\n stop: module.stop,\n }\n\n const modifier = (_options?: Partial) => {\n const options: Defaults = (_options || {}) as Defaults\n\n options.enabled = options.enabled !== false\n\n // add missing defaults to options\n for (const prop in defaults) {\n if (!(prop in options)) {\n options[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = { options, methods, name }\n\n return m\n }\n\n if (name && typeof name === 'string') {\n // for backwrads compatibility\n modifier._defaults = defaults\n modifier._methods = methods\n }\n\n return modifier\n}\n\nexport function addEventModifiers ({ iEvent, interaction: { modification: { result } } }: {\n iEvent: Interact.InteractEvent\n interaction: Interact.Interaction\n}) {\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Interact.Plugin = {\n id: 'modifiers/base',\n install: scope => {\n scope.defaults.perAction.modifiers = []\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.modification = new Modification(interaction)\n },\n\n 'interactions:before-action-start': arg => {\n const { modification } = arg.interaction\n\n modification.start(arg, arg.interaction.coords.start.page)\n arg.interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': arg => arg.interaction.modification.setAndApply(arg),\n\n 'interactions:before-action-end': arg => arg.interaction.modification.beforeEnd(arg),\n\n 'interactions:action-start': addEventModifiers,\n 'interactions:action-move': addEventModifiers,\n 'interactions:action-end': addEventModifiers,\n\n 'interactions:after-action-start': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-move': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n\n 'interactions:stop': arg => arg.interaction.modification.stop(arg),\n },\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n}\n\nexport default modifiersBase\n","import { _ProxyMethods } from '@interactjs/core/Interaction'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Interact.Point\n pending: Interact.Point\n }\n }\n\n // eslint-disable-next-line no-shadow\n enum _ProxyMethods {\n // eslint-disable-next-line no-shadow\n offsetBy = ''\n }\n}\n\n(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interact.Interaction) {\n if (!interaction.pointerIsDown) { return }\n\n addToCoords(interaction.coords.cur, interaction.offset.total)\n\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nfunction beforeAction ({ interaction }: { interaction: Interact.Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: Interact.Interaction }): boolean | void {\n const hadPending = applyPending(interaction)\n\n if (!hadPending) { return }\n\n interaction.move({ offset: true })\n interaction.end()\n\n return false\n}\n\nfunction end ({ interaction }: { interaction: Interact.Interaction }) {\n interaction.offset.total.x = 0\n interaction.offset.total.y = 0\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nexport function applyPending (interaction: Interact.Interaction) {\n if (!hasPending(interaction)) {\n return false\n }\n\n const { pending } = interaction.offset\n\n addToCoords(interaction.coords.cur, pending)\n addToCoords(interaction.coords.delta, pending)\n rectUtils.addEdges(interaction.edges, interaction.rect, pending)\n\n pending.x = 0\n pending.y = 0\n\n return true\n}\n\nfunction offsetBy (this: Interact.Interaction, { x, y }: Interact.Point) {\n this.offset.pending.x += x\n this.offset.pending.y += y\n\n this.offset.total.x += x\n this.offset.total.y += y\n}\n\nfunction addToCoords ({ page, client }, { x, y }: Interact.Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Interact.Plugin = {\n id: 'offset',\n install (scope) {\n scope.Interaction.prototype.offsetBy = offsetBy\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.offset = {\n total: { x: 0, y: 0 },\n pending: { x: 0, y: 0 },\n }\n },\n 'interactions:update-pointer': ({ interaction }) => addTotal(interaction),\n 'interactions:before-action-start': beforeAction,\n 'interactions:before-action-move': beforeAction,\n 'interactions:before-action-end': beforeEnd,\n 'interactions:stop': end,\n },\n}\n\nexport default offset\n","import * as modifiers from '@interactjs/modifiers/base'\nimport Modification from '@interactjs/modifiers/Modification'\nimport offset from '@interactjs/offset'\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport * as is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n resume?: true\n inertiastart?: true\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n inertia?: InertiaState\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n inertia?: {\n enabled?: boolean\n resistance?: number // the lambda in exponential decay\n minSpeed?: number // target speed must be above this for inertia to start\n endSpeed?: number // the speed at which inertia is slow enough to stop\n allowResume?: true // allow resuming an action in inertia phase\n smoothEndDuration?: number // animate to snap/restrict endOnly if there's no inertia\n }\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-inertiastart': Omit, 'iEvent'>\n 'interactions:action-inertiastart': Interact.DoPhaseArg\n 'interactions:after-action-inertiastart': Interact.DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': Interact.DoPhaseArg\n 'interactions:after-action-resume': Interact.DoPhaseArg\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(offset)\n scope.usePlugin(modifiers.default)\n scope.actions.phases.inertiastart = true\n scope.actions.phases.resume = true\n\n defaults.perAction.inertia = {\n enabled : false,\n resistance : 10, // the lambda in exponential decay\n minSpeed : 100, // target speed must be above this for inertia to start\n endSpeed : 10, // the speed at which inertia is slow enough to stop\n allowResume : true, // allow resuming an action in inertia phase\n smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia\n }\n}\n\nexport class InertiaState {\n active = false\n isModified = false\n smoothEnd = false\n allowResume = false\n\n modification: Modification = null\n modifierCount = 0\n modifierArg: modifiers.ModifierArg = null\n\n startCoords: Interact.Point = null\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset: Interact.Point = null\n modifiedOffset: Interact.Point = null\n currentOffset: Interact.Point = null\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout: number = null\n\n constructor (\n private readonly interaction: Interact.Interaction,\n ) {}\n\n start (event: Interact.PointerEventType) {\n const { interaction } = this\n const options = getOptions(interaction)\n\n if (!options || !options.enabled) {\n return false\n }\n\n const { client: velocityClient } = interaction.coords.velocity\n const pointerSpeed = hypot(velocityClient.x, velocityClient.y)\n const modification = this.modification || (this.modification = new Modification(interaction))\n\n modification.copyFrom(interaction.modification)\n\n this.t0 = interaction._now()\n this.allowResume = options.allowResume\n this.v0 = pointerSpeed\n this.currentOffset = { x: 0, y: 0 }\n this.startCoords = interaction.coords.cur.page\n\n this.modifierArg = {\n interaction,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: interaction.rect,\n edges: interaction.edges,\n pageCoords: this.startCoords,\n preEnd: true,\n phase: 'inertiastart',\n }\n\n const thrown = (\n (this.t0 - interaction.coords.cur.timeStamp) < 50 &&\n pointerSpeed > options.minSpeed &&\n pointerSpeed > options.endSpeed\n )\n\n if (thrown) {\n this.startInertia()\n } else {\n modification.result = modification.setAll(this.modifierArg)\n\n if (!modification.result.changed) {\n return false\n }\n\n this.startSmoothEnd()\n }\n\n // force modification change\n interaction.modification.result.rect = null\n\n // bring inertiastart event to the target coords\n interaction.offsetBy(this.targetOffset)\n interaction._doPhase({\n interaction,\n event,\n phase: 'inertiastart',\n })\n interaction.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y })\n // force modification change\n interaction.modification.result.rect = null\n\n this.active = true\n interaction.simulation = this\n\n return true\n }\n\n startInertia () {\n const startVelocity = this.interaction.coords.velocity.client\n const options = getOptions(this.interaction)\n const lambda = options.resistance\n const inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda\n\n this.targetOffset = {\n x: (startVelocity.x - inertiaDur) / lambda,\n y: (startVelocity.y - inertiaDur) / lambda,\n }\n\n this.te = inertiaDur\n this.lambda_v0 = lambda / this.v0\n this.one_ve_v0 = 1 - options.endSpeed / this.v0\n\n const { modification, modifierArg } = this\n\n modifierArg.pageCoords = {\n x: this.startCoords.x + this.targetOffset.x,\n y: this.startCoords.y + this.targetOffset.y,\n }\n\n modification.result = modification.setAll(modifierArg)\n\n if (modification.result.changed) {\n this.isModified = true\n this.modifiedOffset = {\n x: this.targetOffset.x + modification.result.delta.x,\n y: this.targetOffset.y + modification.result.delta.y,\n }\n }\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n\n startSmoothEnd () {\n this.smoothEnd = true\n this.isModified = true\n this.targetOffset = {\n x: this.modification.result.delta.x,\n y: this.modification.result.delta.y,\n }\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n\n inertiaTick () {\n const { interaction } = this\n const options = getOptions(interaction)\n const lambda = options.resistance\n const t = (interaction._now() - this.t0) / 1000\n\n if (t < this.te) {\n const progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0\n let newOffset: Interact.Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0, 0,\n this.targetOffset.x, this.targetOffset.y,\n this.modifiedOffset.x, this.modifiedOffset.y,\n progress,\n )\n }\n else {\n newOffset = {\n x: this.targetOffset.x * progress,\n y: this.targetOffset.y * progress,\n }\n }\n\n const delta = { x: newOffset.x - this.currentOffset.x, y: newOffset.y - this.currentOffset.y }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move()\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n else {\n interaction.offsetBy({\n x: this.modifiedOffset.x - this.currentOffset.x,\n y: this.modifiedOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n smoothEndTick () {\n const { interaction } = this\n const t = interaction._now() - this.t0\n const { smoothEndDuration: duration } = getOptions(interaction)\n\n if (t < duration) {\n const newOffset = {\n x: easeOutQuad(t, 0, this.targetOffset.x, duration),\n y: easeOutQuad(t, 0, this.targetOffset.y, duration),\n }\n const delta = {\n x: newOffset.x - this.currentOffset.x,\n y: newOffset.y - this.currentOffset.y,\n }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move({ skipModifiers: this.modifierCount })\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n else {\n interaction.offsetBy({\n x: this.targetOffset.x - this.currentOffset.x,\n y: this.targetOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n resume ({ pointer, event, eventTarget }: Interact.SignalArgs['interactions:down']) {\n const { interaction } = this\n\n // undo inertia changes to interaction coords\n interaction.offsetBy({\n x: -this.currentOffset.x,\n y: -this.currentOffset.y,\n })\n\n // update pointer at pointer down position\n interaction.updatePointer(pointer, event, eventTarget, true)\n\n // fire resume signals and event\n interaction._doPhase({\n interaction,\n event,\n phase: 'resume',\n })\n copyCoords(interaction.coords.prev, interaction.coords.cur)\n\n this.stop()\n }\n\n end () {\n this.interaction.move()\n this.interaction.end()\n this.stop()\n }\n\n stop () {\n this.active = this.smoothEnd = false\n this.interaction.simulation = null\n raf.cancel(this.timeout)\n }\n}\n\nfunction start ({ interaction, event }: Interact.DoPhaseArg) {\n if (!interaction._interacting || interaction.simulation) {\n return null\n }\n\n const started = interaction.inertia.start(event)\n\n // prevent action end if inertia or smoothEnd\n return started ? false : null\n}\n\n// Check if the down event hits the current inertia target\n// control should be return to the user\nfunction resume (arg: Interact.SignalArgs['interactions:down']) {\n const { interaction, eventTarget } = arg\n const state = interaction.inertia\n\n if (!state.active) { return }\n\n let element = eventTarget as Node\n\n // climb up the DOM tree from the event target\n while (is.element(element)) {\n // if interaction element is the current inertia target element\n if (element === interaction.element) {\n state.resume(arg)\n break\n }\n\n element = dom.parentNode(element)\n }\n}\n\nfunction stop ({ interaction }: { interaction: Interact.Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interact.Interaction) {\n return interactable &&\n interactable.options &&\n prepared.name &&\n interactable.options[prepared.name].inertia\n}\n\nconst inertia: Interact.Plugin = {\n id: 'inertia',\n before: ['modifiers/base'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.inertia = new InertiaState(interaction)\n },\n\n 'interactions:before-action-end': start,\n 'interactions:down': resume,\n 'interactions:stop': stop,\n\n 'interactions:before-action-resume': arg => {\n const { modification } = arg.interaction\n\n modification.stop(arg)\n modification.start(arg, arg.interaction.coords.cur.page)\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-inertiastart': arg => arg.interaction.modification.setAndApply(arg),\n 'interactions:action-resume': modifiers.addEventModifiers,\n 'interactions:action-inertiastart': modifiers.addEventModifiers,\n 'interactions:after-action-inertiastart': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-resume': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n },\n}\n\n// http://stackoverflow.com/a/5634528/2280888\nfunction _getQBezierValue (t: number, p1: number, p2: number, p3: number) {\n const iT = 1 - t\n return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3\n}\n\nfunction getQuadraticCurvePoint (\n startX: number, startY: number, cpX: number, cpY: number, endX: number, endY: number, position: number) {\n return {\n x: _getQBezierValue(position, startX, cpX, endX),\n y: _getQBezierValue(position, startY, cpY, endY),\n }\n}\n\n// http://gizma.com/easing/\nfunction easeOutQuad (t: number, b: number, c: number, d: number) {\n t /= d\n return -c * t * (t - 2) + b\n}\n\nexport default inertia\n","/* eslint-disable */\n\n/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * @example\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n */\n\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\nimport { Modifier, ModifierModule, ModifierState } from './base'\nimport Modification from './Modification'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges: originalEdges, pageCoords: coords } = arg\n let { ratio } = state.options\n const { equalDelta, modifiers } = state.options\n\n if (ratio === 'preserve') {\n ratio = rect.width / rect.height\n }\n\n state.startCoords = extend({}, coords)\n state.startRect = extend({}, rect)\n state.ratio = ratio\n state.equalDelta = equalDelta\n\n const linkedEdges = state.linkedEdges = {\n top : originalEdges.top || (originalEdges.left && !originalEdges.bottom),\n left : originalEdges.left || (originalEdges.top && !originalEdges.right),\n bottom: originalEdges.bottom || (originalEdges.right && !originalEdges.top),\n right : originalEdges.right || (originalEdges.bottom && !originalEdges.left),\n }\n\n state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)\n\n if (state.equalDelta) {\n state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1) as 1 | -1\n }\n else {\n const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left\n state.edgeSign = negativeSecondaryEdge ? -1 : 1\n }\n\n extend(arg.edges, linkedEdges)\n\n if (!modifiers || !modifiers.length) { return }\n\n const subModification = new Modification(arg.interaction)\n\n subModification.copyFrom(arg.interaction.modification)\n subModification.prepareStates(modifiers)\n\n state.subModification = subModification\n subModification.startAll({ ...arg })\n },\n\n set (arg) {\n const { state, rect, coords } = arg\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) { return null }\n\n const correctedRect = extend({}, rect)\n\n addEdges(state.linkedEdges, correctedRect, { x: coords.x - initialCoords.x, y: coords.y - initialCoords.y })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: state.linkedEdges,\n pageCoords: coords,\n prevCoords: coords,\n prevRect: correctedRect,\n })\n\n const { delta } = result\n\n if (result.changed) {\n const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y)\n\n // do aspect modification again with critical edge axis as primary\n aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)\n extend(coords, result.coords)\n }\n\n return result.eventProps\n },\n\n defaults: {\n ratio: 'preserve',\n equalDelta: false,\n modifiers: [],\n enabled: false,\n },\n}\n\nfunction setEqualDelta ({ startCoords, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign\n }\n else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign\n }\n}\n\nfunction setRatio ({ startRect, startCoords, ratio, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point, rect: Interact.Rect) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign\n }\n else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign\n }\n}\n\nexport default aspectRatio\n","import extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierModule, ModifierState } from '../base'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: Interact.RectResolvable<[number, number, Interact.Interaction]>\n // what part of self is allowed to drag over\n elementRect: Interact.Rect\n offset: Interact.Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Interact.Rect = extend({\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n }, options.offset || {})\n\n if (rect && elementRect) {\n const restriction = getRestrictionRect(options.restriction, interaction, pageCoords)\n\n if (restriction) {\n const widthDiff = (restriction.right - restriction.left) - rect.width\n const heightDiff = (restriction.bottom - restriction.top) - rect.height\n\n if (widthDiff < 0) {\n offset.left += widthDiff\n offset.right += widthDiff\n }\n if (heightDiff < 0) {\n offset.top += heightDiff\n offset.bottom += heightDiff\n }\n }\n\n offset.left += startOffset.left - (rect.width * elementRect.left)\n offset.top += startOffset.top - (rect.height * elementRect.top)\n\n offset.right += startOffset.right - (rect.width * (1 - elementRect.right))\n offset.bottom += startOffset.bottom - (rect.height * (1 - elementRect.bottom))\n }\n\n state.offset = offset\n}\n\nfunction set ({ coords, interaction, state }: ModifierArg) {\n const { options, offset } = state\n\n const restriction = getRestrictionRect(options.restriction, interaction, coords)\n\n if (!restriction) { return }\n\n const rect = rectUtils.xywhToTlbr(restriction)\n\n coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left)\n coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top)\n}\n\nexport function getRestrictionRect (\n value: Interact.RectResolvable<[number, number, Interact.Interaction]>,\n interaction: Interact.Interaction,\n coords?: Interact.Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction])\n } else {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element)\n }\n}\n\nconst defaults: RestrictOptions = {\n restriction: null,\n elementRect: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrict: ModifierModule = {\n start,\n set,\n defaults,\n}\n\nexport default restrict\n","// This module adds the options.resize.restrictEdges setting which sets min and\n// max for the top, left, bottom and right edges of the target being resized.\n//\n// interact(target).resize({\n// edges: { top: true, left: true },\n// restrictEdges: {\n// inner: { top: 200, left: 200, right: 400, bottom: 400 },\n// outer: { top: 0, left: 0, right: 600, bottom: 600 },\n// },\n// })\n\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierState } from '../base'\nimport { getRestrictionRect, RestrictOptions } from './pointer'\n\nexport interface RestrictEdgesOptions {\n inner: RestrictOptions['restriction']\n outer: RestrictOptions['restriction']\n offset?: RestrictOptions['offset']\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictEdgesState = ModifierState\n\nconst noInner = { top: +Infinity, left: +Infinity, bottom: -Infinity, right: -Infinity }\nconst noOuter = { top: -Infinity, left: -Infinity, bottom: +Infinity, right: +Infinity }\n\nfunction start ({ interaction, startOffset, state }: ModifierArg) {\n const { options } = state\n let offset\n\n if (options) {\n const offsetRect = getRestrictionRect(options.offset, interaction, interaction.coords.start.page)\n\n offset = rectUtils.rectToXY(offsetRect)\n }\n\n offset = offset || { x: 0, y: 0 }\n\n state.offset = {\n top: offset.y + startOffset.top,\n left: offset.x + startOffset.left,\n bottom: offset.y - startOffset.bottom,\n right: offset.x - startOffset.right,\n }\n}\n\nfunction set ({ coords, edges, interaction, state }: ModifierArg) {\n const { offset, options } = state\n\n if (!edges) {\n return\n }\n\n const page = extend({}, coords)\n const inner = getRestrictionRect(options.inner, interaction, page) || {} as Interact.Rect\n const outer = getRestrictionRect(options.outer, interaction, page) || {} as Interact.Rect\n\n fixRect(inner, noInner)\n fixRect(outer, noOuter)\n\n if (edges.top) {\n coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top)\n }\n else if (edges.bottom) {\n coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom)\n }\n if (edges.left) {\n coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left)\n }\n else if (edges.right) {\n coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right)\n }\n}\n\nfunction fixRect (rect, defaults) {\n for (const edge of ['top', 'left', 'bottom', 'right']) {\n if (!(edge in rect)) {\n rect[edge] = defaults[edge]\n }\n }\n\n return rect\n}\n\nconst defaults: RestrictEdgesOptions = {\n inner: null,\n outer: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictEdges = {\n noInner,\n noOuter,\n start,\n set,\n defaults,\n}\n\nexport default restrictEdges\n","import extend from '../../utils/extend'\nimport restrictPointer from './pointer'\n\nconst defaults = extend({\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n}, restrictPointer.defaults)\n\nconst restrictRect = {\n start: restrictPointer.start,\n set: restrictPointer.set,\n defaults,\n}\n\nexport default restrictRect\n","import extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierState } from '../base'\nimport restrictEdges, { RestrictEdgesState } from './edges'\nimport { getRestrictionRect, RestrictOptions } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Interact.Size | Interact.Point | RestrictOptions['restriction']\n max?: Interact.Size | Interact.Point | RestrictOptions['restriction']\n endOnly: boolean\n enabled?: boolean\n}\n\nfunction start (arg: ModifierArg) {\n return restrictEdges.start(arg)\n}\n\nexport type RestrictSizeState =\n RestrictEdgesState & ModifierState\n\nfunction set (arg: ModifierArg) {\n const { interaction, state, rect, edges } = arg\n const { options } = state\n\n if (!edges) {\n return\n }\n\n const minSize = rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize = rectUtils.tlbrToXywh(getRestrictionRect(options.max as any, interaction, arg.coords)) || noMax\n\n state.options = {\n endOnly: options.endOnly,\n inner: extend({}, restrictEdges.noInner),\n outer: extend({}, restrictEdges.noOuter),\n }\n\n if (edges.top) {\n state.options.inner.top = rect.bottom - minSize.height\n state.options.outer.top = rect.bottom - maxSize.height\n }\n else if (edges.bottom) {\n state.options.inner.bottom = rect.top + minSize.height\n state.options.outer.bottom = rect.top + maxSize.height\n }\n if (edges.left) {\n state.options.inner.left = rect.right - minSize.width\n state.options.outer.left = rect.right - maxSize.width\n }\n else if (edges.right) {\n state.options.inner.right = rect.left + minSize.width\n state.options.outer.right = rect.left + maxSize.width\n }\n\n restrictEdges.set(arg)\n\n state.options = options\n}\n\nconst defaults: RestrictSizeOptions = {\n min: null,\n max: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictSize = {\n start,\n set,\n defaults,\n}\n\nexport default restrictSize\n","import * as utils from '@interactjs/utils/index'\nimport { ModifierArg, ModifierState } from '../base'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Interact.Point\n}\n\nexport interface SnapPosition {\n x?: number\n y?: number\n range?: number\n offset?: Offset\n [index: string]: any\n}\n\nexport type SnapFunction = (\n x: number,\n y: number,\n interaction: Interact.Interaction,\n offset: Offset,\n index: number\n) => SnapPosition\nexport type SnapTarget = SnapPosition | SnapFunction\nexport interface SnapOptions {\n targets: SnapTarget[]\n // target range\n range: number\n // self points for snapping. [0,0] = top left, [1,1] = bottom right\n relativePoints: Interact.Point[]\n // startCoords = offset snapping from drag start page position\n offset: Interact.Point | Interact.RectResolvable<[Interact.Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin: Interact.RectResolvable<[Interact.Element]> | Interact.Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin\n ? getOrigin(arg)\n : { x: 0, y: 0 }\n\n let snapOffset: Interact.Point\n\n if (options.offset === 'startCoords') {\n snapOffset = {\n x: interaction.coords.start.page.x,\n y: interaction.coords.start.page.y,\n }\n }\n else {\n const offsetRect = utils.rect.resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = utils.rect.rectToXY(offsetRect) || { x: 0, y: 0 }\n snapOffset.x += origin.x\n snapOffset.y += origin.y\n }\n\n const { relativePoints } = options\n\n state.offsets = rect && relativePoints && relativePoints.length\n ? relativePoints.map((relativePoint, index) => ({\n index,\n relativePoint,\n x: startOffset.left - (rect.width * relativePoint.x) + snapOffset.x,\n y: startOffset.top - (rect.height * relativePoint.y) + snapOffset.y,\n }))\n : [utils.extend({\n index: 0,\n relativePoint: null,\n }, snapOffset)]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = utils.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)\n const page = utils.extend({}, coords)\n const targets = []\n\n if (!options.offsetWithOrigin) {\n page.x -= origin.x\n page.y -= origin.y\n }\n\n for (const offset of offsets) {\n const relativeX = page.x - offset.x\n const relativeY = page.y - offset.y\n\n for (let index = 0, len = options.targets.length; index < len; index++) {\n const snapTarget = options.targets[index]\n let target\n\n if (utils.is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction, offset, index)\n }\n else {\n target = snapTarget\n }\n\n if (!target) { continue }\n\n targets.push({\n x: (utils.is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (utils.is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: utils.is.number(target.range) ? target.range : options.range,\n source: snapTarget,\n index,\n offset,\n })\n }\n }\n\n const closest = {\n target: null,\n inRange: false,\n distance: 0,\n range: 0,\n delta: { x: 0, y: 0 },\n }\n\n for (const target of targets) {\n const range = target.range\n const dx = target.x - page.x\n const dy = target.y - page.y\n const distance = utils.hypot(dx, dy)\n let inRange = distance <= range\n\n // Infinite targets count as being out of range\n // compared to non infinite ones that are in range\n if (range === Infinity && closest.inRange && closest.range !== Infinity) {\n inRange = false\n }\n\n if (!closest.target || (inRange\n // is the closest target in range?\n ? (closest.inRange && range !== Infinity\n // the pointer is relatively deeper in this target\n ? distance / range < closest.distance / closest.range\n // this target has Infinite range and the closest doesn't\n : (range === Infinity && closest.range !== Infinity) ||\n // OR this target is closer that the previous closest\n distance < closest.distance)\n // The other is not in range and the pointer is closer to this target\n : (!closest.inRange && distance < closest.distance))) {\n closest.target = target\n closest.distance = distance\n closest.range = range\n closest.inRange = inRange\n closest.delta.x = dx\n closest.delta.y = dy\n }\n }\n\n if (closest.inRange) {\n coords.x = closest.target.x\n coords.y = closest.target.y\n }\n\n state.closest = closest\n return closest\n}\n\nfunction getOrigin (arg: Partial>) {\n const { element } = arg.interaction\n const optionsOrigin = utils.rect.rectToXY(\n utils.rect.resolveRectLike(arg.state.options.origin as any, null, null, [element]),\n )\n const origin = optionsOrigin || utils.getOriginXY(\n arg.interactable,\n element,\n arg.interaction.prepared.name,\n )\n\n return origin\n}\n\nconst defaults: SnapOptions = {\n range : Infinity,\n targets: null,\n offset: null,\n offsetWithOrigin: true,\n origin: null,\n relativePoints: null,\n endOnly: false,\n enabled: false,\n}\nconst snap = {\n start,\n set,\n defaults,\n}\n\nexport default snap\n","// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport { ModifierArg } from '../base'\nimport snap, { SnapOptions, SnapState } from './pointer'\n\nexport type SnapSizeOptions = Pick<\nSnapOptions,\n'targets' | 'offset' | 'endOnly' | 'range' | 'enabled'\n>\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) { return null }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [{\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n }],\n offset: options.offset || 'self',\n origin: { x: 0, y: 0 },\n range: options.range,\n },\n }\n\n state.targetFields = state.targetFields || [\n ['width', 'height'],\n ['x', 'y'],\n ]\n\n snap.start(arg)\n state.offsets = arg.state.offsets\n\n arg.state = state\n}\n\nfunction set (arg) {\n const { interaction, state, coords } = arg\n const { options, offsets } = state\n const relative = {\n x: coords.x - offsets[0].x,\n y: coords.y - offsets[0].y,\n }\n\n state.options = extend({}, options)\n state.options.targets = []\n\n for (const snapTarget of (options.targets || [])) {\n let target\n\n if (is.func(snapTarget)) {\n target = snapTarget(relative.x, relative.y, interaction)\n }\n else {\n target = snapTarget\n }\n\n if (!target) { continue }\n\n for (const [xField, yField] of state.targetFields) {\n if (xField in target || yField in target) {\n target.x = target[xField]\n target.y = target[yField]\n\n break\n }\n }\n\n state.options.targets.push(target)\n }\n\n const returnValue = snap.set(arg)\n\n state.options = options\n\n return returnValue\n}\n\nconst defaults: SnapSizeOptions = {\n range: Infinity,\n targets: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst snapSize = {\n start,\n set,\n defaults,\n}\n\nexport default snapSize\n","/**\n * @module modifiers/snapEdges\n *\n * @description\n * This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * @example\n * interact(target).resizable({\n * snapEdges: {\n * targets: [interact.snappers.grid({ x: 100, y: 50 })],\n * },\n * })\n *\n * interact(target).resizable({\n * snapEdges: {\n * targets: [\n * interact.snappers.grid({\n * top: 50,\n * left: 50,\n * bottom: 100,\n * right: 100,\n * }),\n * ],\n * },\n * })\n */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport { ModifierArg, ModifierModule } from '../base'\nimport { SnapOptions, SnapState } from './pointer'\nimport snapSize from './size'\n\nexport type SnapEdgesOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { edges } = arg\n\n if (!edges) { return null }\n\n arg.state.targetFields = arg.state.targetFields || [\n [edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom'],\n ]\n\n return snapSize.start(arg)\n}\n\nconst snapEdges: ModifierModule = {\n start,\n set: snapSize.set,\n defaults: extend(\n clone(snapSize.defaults),\n {\n targets: null,\n range: null,\n offset: { x: 0, y: 0 },\n } as const,\n ),\n}\n\nexport default snapEdges\n","import aspectRatioModule from './aspectRatio'\nimport { makeModifier } from './base'\nimport restrictEdgesModule from './restrict/edges'\nimport restrictModule from './restrict/pointer'\nimport restrictRectModule from './restrict/rect'\nimport restrictSizeModule from './restrict/size'\nimport snapEdgesModule from './snap/edges'\nimport snapModule from './snap/pointer'\nimport snapSizeModule from './snap/size'\n\nexport const snap = makeModifier(snapModule, 'snap')\nexport const snapSize = makeModifier(snapSizeModule, 'snapSize')\nexport const snapEdges = makeModifier(snapEdgesModule, 'snapEdges')\nexport const restrict = makeModifier(restrictModule, 'restrict')\nexport const restrictRect = makeModifier(restrictRectModule, 'restrictRect')\nexport const restrictEdges = makeModifier(restrictEdgesModule, 'restrictEdges')\nexport const restrictSize = makeModifier(restrictSizeModule, 'restrictSize')\nexport const aspectRatio = makeModifier(aspectRatioModule, 'aspectRatio')\n","import BaseEvent from '../core/BaseEvent'\nimport * as pointerUtils from '../utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n type: T\n originalEvent: Interact.PointerEventType\n pointerId: number\n pointerType: string\n double: boolean\n pageX: number\n pageY: number\n clientX: number\n clientY: number\n dt: number\n eventable: any\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: Interact.PointerType | PointerEvent,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n interaction: Interact.Interaction,\n timeStamp: number,\n ) {\n super(interaction)\n pointerUtils.pointerExtend(this, event)\n\n if (event !== pointer) {\n pointerUtils.pointerExtend(this, pointer)\n }\n\n this.timeStamp = timeStamp\n this.originalEvent = event\n this.type = type\n this.pointerId = pointerUtils.getPointerId(pointer)\n this.pointerType = pointerUtils.getPointerType(pointer)\n this.target = eventTarget\n this.currentTarget = null\n\n if (type === 'tap') {\n const pointerIndex = interaction.getPointerIndex(pointer)\n this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime\n\n const interval = this.timeStamp - interaction.tapTime\n\n this.double = !!(interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500)\n }\n else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX -= originX\n this.pageY -= originY\n this.clientX -= originX\n this.clientY -= originY\n\n return this\n }\n\n _addOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX += originX\n this.pageY += originY\n this.clientX += originX\n this.clientY += originY\n\n return this\n }\n\n /**\n * Prevent the default behaviour of the original Event\n */\n preventDefault () {\n this.originalEvent.preventDefault()\n }\n}\n\nexport { PointerEvent }\n","import { PerActionDefaults } from '@interactjs/core/defaultOptions'\nimport Eventable from '@interactjs/core/Eventable'\nimport Interaction from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as utils from '@interactjs/utils/index'\nimport PointerEvent from './PointerEvent'\n\nexport type EventTargetList = Array<{\n node: Node\n eventable: Eventable\n props: { [key: string]: any }\n}>\n\nexport interface PointerEventOptions extends PerActionDefaults {\n enabled?: undefined // not used\n holdDuration?: number\n ignoreFrom?: any\n allowFrom?: any\n origin?: Interact.Point | string | Interact.Element\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n pointerEvents: typeof pointerEvents\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n prevTap?: PointerEvent\n tapTime?: number\n }\n}\n\ndeclare module '@interactjs/core/PointerInfo' {\n interface PointerInfo {\n hold?: {\n duration: number\n timeout: any\n }\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n pointerEvents: Interact.Options\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'pointerEvents:new': { pointerEvent: PointerEvent }\n 'pointerEvents:fired': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n targets?: EventTargetList\n type: string\n path: Node[]\n node: null\n }\n }\n}\n\nconst defaults: PointerEventOptions = {\n holdDuration: 600,\n ignoreFrom : null,\n allowFrom : null,\n origin : { x: 0, y: 0 },\n}\n\nconst pointerEvents = {\n id: 'pointer-events/base',\n install,\n listeners: {\n 'interactions:new': addInteractionProps,\n 'interactions:update-pointer': addHoldInfo,\n 'interactions:move': moveAndClearHold,\n 'interactions:down': (arg, scope) => {\n downAndStartHold(arg, scope)\n fire(arg, scope)\n },\n 'interactions:up': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n tapAfterUp(arg, scope)\n },\n 'interactions:cancel': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n },\n },\n PointerEvent,\n fire,\n collectEventTargets,\n defaults,\n types: {\n down: true,\n move: true,\n up: true,\n cancel: true,\n tap: true,\n doubletap: true,\n hold: true,\n } as { [type: string]: true },\n}\n\nfunction fire (\n arg: {\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Interact.Scope,\n) {\n const {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n targets = collectEventTargets(arg, scope),\n } = arg\n\n const pointerEvent = new PointerEvent(type, pointer, event, eventTarget, interaction, scope.now())\n\n scope.fire('pointerEvents:new', { pointerEvent })\n\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n targets,\n type,\n pointerEvent,\n }\n\n for (let i = 0; i < targets.length; i++) {\n const target = targets[i]\n\n for (const prop in target.props || {}) {\n (pointerEvent as any)[prop] = target.props[prop]\n }\n\n const origin = utils.getOriginXY(target.eventable, target.node)\n\n pointerEvent._subtractOrigin(origin)\n pointerEvent.eventable = target.eventable\n pointerEvent.currentTarget = target.node\n\n target.eventable.fire(pointerEvent)\n\n pointerEvent._addOrigin(origin)\n\n if (pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n (i + 1) < targets.length && targets[i + 1].node !== pointerEvent.currentTarget)) {\n break\n }\n }\n\n scope.fire('pointerEvents:fired', signalArg)\n\n if (type === 'tap') {\n // if pointerEvent should make a double tap, create and fire a doubletap\n // PointerEvent and use that as the prevTap\n const prevTap = pointerEvent.double\n ? fire({\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n }, scope)\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets ({ interaction, pointer, event, eventTarget, type }: {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n type: T\n}, scope: Interact.Scope) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n const pointerInfo = interaction.pointers[pointerIndex]\n\n // do not fire a tap event if the pointer was moved before being lifted\n if (type === 'tap' && (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))) {\n return []\n }\n\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n path,\n targets: [] as EventTargetList,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (type === 'hold') {\n signalArg.targets = signalArg.targets.filter(target =>\n target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration)\n }\n\n return signalArg.targets\n}\n\nfunction addInteractionProps ({ interaction }) {\n interaction.prevTap = null // the most recent tap event on this interaction\n interaction.tapTime = 0 // time of the most recent tap event\n}\n\nfunction addHoldInfo ({ down, pointerInfo }: Interact.SignalArgs['interactions:update-pointer']) {\n if (!down && pointerInfo.hold) {\n return\n }\n\n pointerInfo.hold = { duration: Infinity, timeout: null }\n}\n\nfunction clearHold ({ interaction, pointerIndex }) {\n if (interaction.pointers[pointerIndex].hold) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n}\n\nfunction moveAndClearHold (\n { interaction, pointer, event, eventTarget, duplicate }: Interact.SignalArgs['interactions:move'],\n scope: Interact.Scope,\n) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n\n fire({\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Interact.Element,\n type: 'move',\n }, scope)\n }\n}\n\nfunction downAndStartHold ({ interaction, pointer, event, eventTarget, pointerIndex }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n const timer = interaction.pointers[pointerIndex].hold\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'hold',\n targets: [] as EventTargetList,\n path,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (!signalArg.targets.length) { return }\n\n let minDuration = Infinity\n\n for (const target of signalArg.targets) {\n const holdDuration = target.eventable.options.holdDuration\n\n if (holdDuration < minDuration) {\n minDuration = holdDuration\n }\n }\n\n timer.duration = minDuration\n timer.timeout = setTimeout(() => {\n fire({\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n }, scope)\n }, minDuration)\n}\n\nfunction tapAfterUp ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:up'], scope: Interact.Scope) {\n if (!interaction.pointerWasMoved) {\n fire({ interaction, eventTarget, pointer, event, type: 'tap' }, scope)\n }\n}\n\nfunction install (scope: Scope) {\n scope.pointerEvents = pointerEvents\n scope.defaults.actions.pointerEvents = pointerEvents.defaults\n utils.extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n","import { ListenerMap } from '@interactjs/core/scope'\nimport basePlugin from './base'\nimport PointerEvent from './PointerEvent'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n holdIntervalHandle?: any\n }\n}\n\ndeclare module '@interactjs/pointer-events/PointerEvent' {\n interface PointerEvent {\n count?: number\n }\n}\n\ndeclare module '@interactjs/pointer-events/base' {\n interface PointerEventOptions {\n holdRepeatInterval?: number\n }\n}\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(basePlugin)\n\n const {\n pointerEvents,\n } = scope\n\n // don't repeat by default\n pointerEvents.defaults.holdRepeatInterval = 0\n pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true\n}\n\nfunction onNew ({ pointerEvent }: { pointerEvent: PointerEvent }) {\n if (pointerEvent.type !== 'hold') { return }\n\n pointerEvent.count = (pointerEvent.count || 0) + 1\n}\n\nfunction onFired (\n { interaction, pointerEvent, eventTarget, targets }: Interact.SignalArgs['pointerEvents:fired'],\n scope: Interact.Scope,\n) {\n if (pointerEvent.type !== 'hold' || !targets.length) { return }\n\n // get the repeat interval from the first eventable\n const interval = targets[0].eventable.options.holdRepeatInterval\n\n // don't repeat if the interval is 0 or less\n if (interval <= 0) { return }\n\n // set a timeout to fire the holdrepeat event\n interaction.holdIntervalHandle = setTimeout(() => {\n scope.pointerEvents.fire({\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n }, scope)\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: Interact.Interaction }) {\n // set the interaction's holdStopTime property\n // to stop further holdRepeat events\n if (interaction.holdIntervalHandle) {\n clearInterval(interaction.holdIntervalHandle)\n interaction.holdIntervalHandle = null\n }\n}\n\nconst holdRepeat: Interact.Plugin = {\n id: 'pointer-events/holdRepeat',\n install,\n listeners: ['move', 'up', 'cancel', 'endall'].reduce(\n (acc, enderTypes) => {\n (acc as any)[`pointerEvents:${enderTypes}`] = endHoldRepeat\n return acc\n },\n {\n 'pointerEvents:new': onNew,\n 'pointerEvents:fired': onFired,\n } as ListenerMap,\n ),\n}\n\nexport default holdRepeat\n","import { Scope } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\ntype Interactable = import ('@interactjs/core/Interactable').default\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n pointerEvents: typeof pointerEventsMethod\n __backCompatOption: (optionName: string, newValue: any) => any\n }\n}\n\nfunction install (scope: Scope) {\n const { Interactable } = scope\n\n Interactable.prototype.pointerEvents = pointerEventsMethod\n\n const __backCompatOption = Interactable.prototype._backCompatOption\n\n Interactable.prototype._backCompatOption = function (optionName, newValue) {\n const ret = __backCompatOption.call(this, optionName, newValue)\n\n if (ret === this) {\n this.events.options[optionName] = newValue\n }\n\n return ret\n }\n}\n\nfunction pointerEventsMethod (this: Interact.Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Interact.Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({\n targets,\n node,\n type,\n eventTarget,\n }, scope) => {\n scope.interactables.forEachMatch(node, (interactable: Interactable) => {\n const eventable = interactable.events\n const options = eventable.options\n\n if (\n eventable.types[type] &&\n eventable.types[type].length &&\n interactable.testIgnoreAllow(options, node, eventTarget)) {\n targets.push({\n node,\n eventable,\n props: { interactable },\n })\n }\n })\n },\n\n 'interactable:new': ({ interactable }) => {\n interactable.events.getRect = function (element: Interact.Element) {\n return interactable.getRect(element)\n }\n },\n\n 'interactable:set': ({ interactable, options }, scope) => {\n extend(interactable.events.options, scope.pointerEvents.defaults)\n extend(interactable.events.options, options.pointerEvents || {})\n },\n },\n}\n\nexport default plugin\n","import * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n}\n\nconst id = 'pointer-events'\n\nexport { id, pointerEvents, holdRepeat, interactableTargets, install }\n","import Interactable from '@interactjs/core/Interactable'\nimport { ActionProps, Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport { arr, extend, is, pointer as pointerUtils, rect as rectUtils, win } from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n reflow: (action: ActionProps) => ReturnType\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n _reflowPromise: Promise\n _reflowResolve: () => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\n // eslint-disable-next-line no-shadow\n Interactable,\n } = scope\n\n scope.actions.phases.reflow = true\n\n /**\n * ```js\n * const interactable = interact(target)\n * const drag = { name: drag, axis: 'x' }\n * const resize = { name: resize, edges: { left: true, bottom: true }\n *\n * interactable.reflow(drag)\n * interactable.reflow(resize)\n * ```\n *\n * Start an action sequence to re-apply modifiers, check drops, etc.\n *\n * @param { Object } action The action to begin\n * @param { string } action.name The name of the action\n * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended\n */\n Interactable.prototype.reflow = function (action) {\n return reflow(this, action, scope)\n }\n}\n\nfunction reflow (interactable: Interactable, action: ActionProps, scope: Scope): Promise {\n const elements = (is.string(interactable.target)\n ? arr.from(interactable._context.querySelectorAll(interactable.target))\n : [interactable.target]) as Interact.Element[]\n\n // tslint:disable-next-line variable-name\n const Promise = (win.window as any).Promise\n const promises: Array> | null = Promise ? [] : null\n\n for (const element of elements) {\n const rect = interactable.getRect(element as HTMLElement | SVGElement)\n\n if (!rect) { break }\n\n const runningInteraction = arr.find(\n scope.interactions.list,\n (interaction: Interaction) => {\n return interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise = runningInteraction._reflowPromise || new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n }\n else {\n const xywh = rectUtils.tlbrToXywh(rect)\n const coords = {\n page : { x: xywh.x, y: xywh.y },\n client : { x: xywh.x, y: xywh.y },\n timeStamp: scope.now(),\n }\n\n const event = pointerUtils.coordsToEvent(coords)\n reflowPromise = startReflow(scope, interactable, element, action, event)\n }\n\n if (promises) {\n promises.push(reflowPromise)\n }\n }\n\n return promises && Promise.all(promises).then(() => interactable)\n}\n\nfunction startReflow (scope: Scope, interactable: Interactable, element: Interact.Element, action: ActionProps, event: any) {\n const interaction = scope.interactions.new({ pointerType: 'reflow' })\n const signalArg = {\n interaction,\n event,\n pointer: event,\n eventTarget: element,\n phase: 'reflow',\n } as const\n\n interaction.interactable = interactable\n interaction.element = element\n interaction.prepared = extend({}, action)\n interaction.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n\n interaction._doPhase(signalArg)\n\n const reflowPromise = (win.window as unknown as any).Promise\n ? new (win.window as unknown as any).Promise((resolve: any) => {\n interaction._reflowResolve = resolve\n })\n : null\n\n interaction._reflowPromise = reflowPromise\n interaction.start(action, interactable, element)\n\n if (interaction._interacting) {\n interaction.move(signalArg)\n interaction.end(event)\n }\n else {\n interaction.stop()\n }\n\n interaction.removePointer(event, event)\n interaction.pointerIsDown = false\n\n return reflowPromise\n}\n\nexport default {\n id: 'reflow',\n install,\n listeners: {\n // remove completed reflow interactions\n 'interactions:stop': ({ interaction }, scope) => {\n if (interaction.pointerType === 'reflow') {\n if (interaction._reflowResolve) {\n interaction._reflowResolve()\n }\n\n arr.remove(scope.interactions.list, interaction)\n }\n },\n },\n} as Interact.Plugin\n","/** @module interact */\n\nimport { Options } from '@interactjs/core/defaultOptions'\nimport Interactable from '@interactjs/core/Interactable'\nimport { isNonNativeEvent, Scope } from '@interactjs/core/scope'\nimport browser from '@interactjs/utils/browser'\nimport events from '@interactjs/utils/events'\nimport * as utils from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n interact: InteractStatic\n }\n}\n\nexport interface InteractStatic {\n (target: Interact.Target, options?: Options): Interactable\n on: typeof on\n pointerMoveTolerance: typeof pointerMoveTolerance\n stop: typeof stop\n supportsPointerEvent: typeof supportsPointerEvent\n supportsTouch: typeof supportsTouch\n debug: typeof debug\n off: typeof off\n isSet: typeof isSet\n use: typeof use\n getPointerAverage: typeof utils.pointer.pointerAverage\n getTouchBBox: typeof utils.pointer.touchBBox\n getTouchDistance: typeof utils.pointer.touchDistance\n getTouchAngle: typeof utils.pointer.touchAngle\n getElementRect: typeof utils.dom.getElementRect\n getElementClientRect: typeof utils.dom.getElementClientRect\n matchesSelector: typeof utils.dom.matchesSelector\n closest: typeof utils.dom.closest\n addDocument: typeof scope.addDocument\n removeDocument: typeof scope.removeDocument\n dynamicDrop: (newValue?: boolean) => boolean | Interact.interact\n version: string\n}\n\nconst globalEvents: any = {}\nconst scope = new Scope()\n\n/**\n * ```js\n * interact('#draggable').draggable(true)\n *\n * var rectables = interact('rect')\n * rectables\n * .gesturable(true)\n * .on('gesturemove', function (event) {\n * // ...\n * })\n * ```\n *\n * The methods of this variable can be used to set elements as interactables\n * and also to change various default settings.\n *\n * Calling it as a function and passing an element or a valid CSS selector\n * string returns an Interactable object which has various methods to configure\n * it.\n *\n * @global\n *\n * @param {Element | string} target The HTML or SVG Element to interact with\n * or CSS selector\n * @return {Interactable}\n */\nexport const interact: InteractStatic = function interact (target: Interact.Target, options?: any) {\n let interactable = scope.interactables.get(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = globalEvents\n }\n\n return interactable\n} as InteractStatic\n\n/**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n * @param {Object} plugin\n * @param {function} plugin.install\n * @return {interact}\n */\ninteract.use = use\nfunction use (plugin: Interact.Plugin, options?: { [key: string]: any }) {\n scope.usePlugin(plugin, options)\n\n return interact\n}\n\n/**\n * Check if an element or selector has been set with the {@link interact}\n * function\n *\n * @alias module:interact.isSet\n *\n * @param {Element} element The Element being searched for\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\ninteract.isSet = isSet\nfunction isSet (target: Interact.Element, options?: any) {\n return !!scope.interactables.get(target, options && options.context)\n}\n\n/**\n * Add a global listener for an InteractEvent or adds a DOM event to `document`\n *\n * @alias module:interact.on\n *\n * @param {string | array | object} type The types of events to listen for\n * @param {function} listener The function event (s)\n * @param {object | boolean} [options] object or useCapture flag for\n * addEventListener\n * @return {object} interact\n */\ninteract.on = on\nfunction on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of (type as any[])) {\n interact.on(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.on(prop, (type as any)[prop], listener)\n }\n\n return interact\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, scope.actions)) {\n // if this type of event was never bound\n if (!globalEvents[type]) {\n globalEvents[type] = [listener]\n }\n else {\n globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n events.add(scope.document, type, listener as Interact.Listener, { options })\n }\n\n return interact\n}\n\n/**\n * Removes a global InteractEvent listener or DOM event from `document`\n *\n * @alias module:interact.off\n *\n * @param {string | array | object} type The types of events that were listened\n * for\n * @param {function} listener The listener function to be removed\n * @param {object | boolean} options [options] object or useCapture flag for\n * removeEventListener\n * @return {object} interact\n */\ninteract.off = off\nfunction off (type: Interact.EventTypes, listener: any, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of type) {\n interact.off(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.off(prop, type[prop], listener)\n }\n\n return interact\n }\n\n if (isNonNativeEvent(type, scope.actions)) {\n let index\n\n if (type in globalEvents &&\n (index = globalEvents[type].indexOf(listener)) !== -1) {\n globalEvents[type].splice(index, 1)\n }\n }\n else {\n events.remove(scope.document, type, listener, options)\n }\n\n return interact\n}\n\ninteract.debug = debug\nfunction debug () {\n return scope\n}\n\n// expose the functions used to calculate multi-touch properties\ninteract.getPointerAverage = utils.pointer.pointerAverage\ninteract.getTouchBBox = utils.pointer.touchBBox\ninteract.getTouchDistance = utils.pointer.touchDistance\ninteract.getTouchAngle = utils.pointer.touchAngle\n\ninteract.getElementRect = utils.dom.getElementRect\ninteract.getElementClientRect = utils.dom.getElementClientRect\ninteract.matchesSelector = utils.dom.matchesSelector\ninteract.closest = utils.dom.closest\n\n/**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\ninteract.supportsTouch = supportsTouch\nfunction supportsTouch () {\n return browser.supportsTouch\n}\n\n/**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\ninteract.supportsPointerEvent = supportsPointerEvent\nfunction supportsPointerEvent () {\n return browser.supportsPointerEvent\n}\n\n/**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */\ninteract.stop = stop\nfunction stop () {\n for (const interaction of scope.interactions.list) {\n interaction.stop()\n }\n\n return interact\n}\n\n/**\n * Returns or sets the distance the pointer must be moved before an action\n * sequence occurs. This also affects tolerance for tap events.\n *\n * @alias module:interact.pointerMoveTolerance\n *\n * @param {number} [newValue] The movement from the start position must be greater than this value\n * @return {interact | number}\n */\ninteract.pointerMoveTolerance = pointerMoveTolerance\nfunction pointerMoveTolerance (newValue?: number) {\n if (utils.is.number(newValue)) {\n scope.interactions.pointerMoveTolerance = newValue\n\n return interact\n }\n\n return scope.interactions.pointerMoveTolerance\n}\n\nscope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1)\n\n // Stop related interactions when an Interactable is unset\n for (const interaction of scope.interactions.list) {\n if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) {\n interaction.stop()\n }\n }\n },\n})\n\ninteract.addDocument = (doc, options) => scope.addDocument(doc, options)\ninteract.removeDocument = doc => scope.removeDocument(doc)\n\nscope.interact = interact\n\nexport { scope }\nexport default interact\n","import * as actions from '@interactjs/actions/index'\nimport autoScroll from '@interactjs/auto-scroll/index'\nimport * as autoStart from '@interactjs/auto-start/index'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/index'\nimport inertia from '@interactjs/inertia/index'\nimport modifiersBase from '@interactjs/modifiers/base'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport offset from '@interactjs/offset'\nimport * as pointerEvents from '@interactjs/pointer-events/index'\nimport reflow from '@interactjs/reflow/index'\nimport interact, { scope } from './interact'\n\nexport function init (window: Window) {\n scope.init(window)\n\n interact.use(interactablePreventDefault)\n\n interact.use(offset)\n\n // pointerEvents\n interact.use(pointerEvents)\n\n // inertia\n interact.use(inertia)\n\n // snap, resize, etc.\n interact.use(modifiersBase)\n\n // autoStart, hold\n interact.use(autoStart)\n\n // drag and drop, resize, gesture\n interact.use(actions)\n\n // for backwrads compatibility\n for (const type in modifiers) {\n const { _defaults, _methods } = modifiers[type as keyof typeof modifiers]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n\n // autoScroll\n interact.use(autoScroll)\n\n // reflow\n interact.use(reflow)\n\n // eslint-disable-next-line no-undef\n if (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n }\n\n return interact\n}\n\n// eslint-disable-next-line no-undef\ninteract.version = process.env.npm_package_version\n\nexport default interact\n","/// \n","function createGrid (grid: (Partial | Interact.Point) & { range?: number, limits?: Interact.Rect, offset?: Interact.Point }) {\n const coordFields = ([\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: Interact.SnapFunction & {\n grid: typeof grid\n coordFields: typeof coordFields\n } = (x, y) => {\n const {\n range,\n limits = {\n left : -Infinity,\n right : Infinity,\n top : -Infinity,\n bottom: Infinity,\n },\n offset = { x: 0, y: 0 },\n } = grid\n\n const result: Interact.SnapTarget & {\n grid: typeof grid\n } = { range, grid, x: null as number, y: null as number }\n\n for (const [xField, yField] of coordFields) {\n const gridx = Math.round((x - offset.x) / (grid as any)[xField])\n const gridy = Math.round((y - offset.y) / (grid as any)[yField])\n\n result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * (grid as any)[xField] + offset.x))\n result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * (grid as any)[yField] + offset.y))\n }\n\n return result\n }\n\n gridFunc.grid = grid\n gridFunc.coordFields = coordFields\n\n return gridFunc\n}\n\nexport default createGrid\n","import grid from './grid'\n\nexport { grid }\n","import interact, { init as initInteract } from '@interactjs/interact/index'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport '@interactjs/types/index'\nimport extend from '@interactjs/utils/extend'\nimport * as snappers from '@interactjs/utils/snappers/index'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n modifiers: typeof modifiers\n snappers: typeof snappers\n createSnapGrid: typeof snappers.grid\n }\n}\n\nif (typeof window === 'object' && !!window) {\n init(window)\n}\n\nexport function init (win: Window) {\n initInteract(win)\n\n return interact.use({\n id: 'interactjs',\n install () {\n interact.modifiers = extend({}, modifiers)\n interact.snappers = snappers\n interact.createSnapGrid = interact.snappers.grid\n },\n })\n}\n\nexport default interact\n","import interact, { init } from '@interactjs/interactjs/index'\nexport * from '@interactjs/interactjs/index'\n\nif (typeof module === 'object' && !!module) {\n try { module.exports = interact }\n catch {}\n}\n\n(interact as any).default = interact // tslint:disable-line no-string-literal\n;(interact as any).init = init // tslint:disable-line no-string-literal\n\nexport default interact\n","\nreturn _$index_69;\n\n});\n"]} \ No newline at end of file diff --git a/interactjs/dist/interact.min.js b/interactjs/dist/interact.min.js new file mode 100644 index 000000000..1d744f7b4 --- /dev/null +++ b/interactjs/dist/interact.min.js @@ -0,0 +1,4 @@ +/* interact.js 1.8.5 | https://raw.github.com/taye/interact.js/master/LICENSE */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).interact=t()}}(function(){function t(e){var n;return function(t){return n||e(n={exports:{},parent:t},n.exports),n.exports}}var M=t(function(t,e){"use strict";function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=e.Interactable=void 0;var u=r(j),l=n(z),s=n(B),c=n(Tt),f=n(Qt),p=r(P),d=n(te),o=n(ue),v=O({});function n(t){return t&&t.__esModule?t:{default:t}}function y(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return y=function(){return t},t}function r(t){if(t&&t.__esModule)return t;if(null===t||"object"!==a(t)&&"function"!=typeof t)return{default:t};var e=y();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}return n.default=t,e&&e.set(t,n),n}function i(t,e){for(var n=0;nthis.pointerMoveTolerance);var a=this.getPointerIndex(t),u={pointer:t,pointerIndex:a,pointerInfo:this.pointers[a],event:e,type:"move",eventTarget:n,dx:r,dy:o,duplicate:i,interaction:this};i||Nn.pointer.setCoordVelocity(this.coords.velocity,this.coords.delta),this._scopeFire("interactions:move",u),i||this.simulation||(this.interacting()&&(u.type=null,this.move(u)),this.pointerWasMoved&&Nn.pointer.copyCoords(this.coords.prev,this.coords.cur))}},{key:"move",value:function(t){t&&t.event||Nn.pointer.setZeroCoords(this.coords.delta),(t=Nn.extend({pointer:this._latestPointer.pointer,event:this._latestPointer.event,eventTarget:this._latestPointer.eventTarget,interaction:this},t||{})).phase="move",this._doPhase(t)}},{key:"pointerUp",value:function(t,e,n,r){var o=this.getPointerIndex(t);-1===o&&(o=this.updatePointer(t,e,n,!1));var i=/cancel$/i.test(e.type)?"cancel":"up";this._scopeFire("interactions:".concat(i),{pointer:t,pointerIndex:o,pointerInfo:this.pointers[o],event:e,eventTarget:n,type:i,curEventTarget:r,interaction:this}),this.simulation||this.end(e),this.pointerIsDown=!1,this.removePointer(t,e)}},{key:"documentBlur",value:function(t){this.end(t),this._scopeFire("interactions:blur",{event:t,type:"blur",interaction:this})}},{key:"end",value:function(t){var e;this._ending=!0,t=t||this._latestPointer.event,this.interacting()&&(e=this._doPhase({event:t,interaction:this,phase:"end"})),!(this._ending=!1)===e&&this.stop()}},{key:"currentAction",value:function(){return this._interacting?this.prepared.name:null}},{key:"interacting",value:function(){return this._interacting}},{key:"stop",value:function(){this._scopeFire("interactions:stop",{interaction:this}),this.interactable=this.element=null,this._interacting=!1,this._stopped=!0,this.prepared.name=this.prevEvent=null}},{key:"getPointerIndex",value:function(t){var e=Nn.pointer.getPointerId(t);return"mouse"===this.pointerType||"pen"===this.pointerType?this.pointers.length-1:Nn.arr.findIndex(this.pointers,function(t){return t.id===e})}},{key:"getPointerInfo",value:function(t){return this.pointers[this.getPointerIndex(t)]}},{key:"updatePointer",value:function(t,e,n,r){var o=Nn.pointer.getPointerId(t),i=this.getPointerIndex(t),a=this.pointers[i];return r=!1!==r&&(r||/(down|start)$/i.test(e.type)),a?a.pointer=t:(a=new Vn.default(o,t,e,null,null),i=this.pointers.length,this.pointers.push(a)),Nn.pointer.setCoords(this.coords.cur,this.pointers.map(function(t){return t.pointer}),this._now()),Nn.pointer.setCoordDeltas(this.coords.delta,this.coords.prev,this.coords.cur),r&&(this.pointerIsDown=!0,a.downTime=this.coords.cur.timeStamp,a.downTarget=n,Nn.pointer.pointerExtend(this.downPointer,t),this.interacting()||(Nn.pointer.copyCoords(this.coords.start,this.coords.cur),Nn.pointer.copyCoords(this.coords.prev,this.coords.cur),this.downEvent=e,this.pointerWasMoved=!1)),this._updateLatestPointer(t,e,n),this._scopeFire("interactions:update-pointer",{pointer:t,event:e,eventTarget:n,down:r,pointerInfo:a,pointerIndex:i,interaction:this}),i}},{key:"removePointer",value:function(t,e){var n=this.getPointerIndex(t);if(-1!==n){var r=this.pointers[n];this._scopeFire("interactions:remove-pointer",{pointer:t,event:e,eventTarget:null,pointerIndex:n,pointerInfo:r,interaction:this}),this.pointers.splice(n,1)}}},{key:"_updateLatestPointer",value:function(t,e,n){this._latestPointer.pointer=t,this._latestPointer.event=e,this._latestPointer.eventTarget=n}},{key:"destroy",value:function(){this._latestPointer.pointer=null,this._latestPointer.event=null,this._latestPointer.eventTarget=null}},{key:"_createPreparedEvent",value:function(t,e,n,r){return new Bn.default(this,t,this.prepared.name,e,this.element,n,r)}},{key:"_fireEvent",value:function(t){this.interactable.fire(t),(!this.prevEvent||t.timeStamp>=this.prevEvent.timeStamp)&&(this.prevEvent=t)}},{key:"_doPhase",value:function(t){var e=t.event,n=t.phase,r=t.preEnd,o=t.type,i=this.rect;if(i&&"move"===n&&(Nn.rect.addEdges(this.edges,i,this.coords.delta[this.interactable.options.deltaSource]),i.width=i.right-i.left,i.height=i.bottom-i.top),!1===this._scopeFire("interactions:before-action-".concat(n),t))return!1;var a=t.iEvent=this._createPreparedEvent(e,n,r,o);return this._scopeFire("interactions:action-".concat(n),t),"start"===n&&(this.prevEvent=a),this._fireEvent(a),this._scopeFire("interactions:after-action-".concat(n),t),!0}},{key:"_now",value:function(){return Date.now()}}]),l}(),Jn=Wn.Interaction=Zn;Wn.default=Jn;var Qn={};function tr(t){return(tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(Qn,"__esModule",{value:!0}),Qn.default=void 0;var er=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==tr(t)&&"function"!=typeof t)return{default:t};var e=nr();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(K);function nr(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return nr=function(){return t},t}var rr={methodOrder:["simulationResume","mouseOrPen","hasPointer","idle"],search:function(t){for(var e=0;ea.left&&c.xa.top&&c.y=a.left&&v<=a.right&&y>=a.top&&y<=a.bottom}if(d&&Or.is.number(s)){var h=Math.max(0,Math.min(a.right,d.right)-Math.max(a.left,d.left))*Math.max(0,Math.min(a.bottom,d.bottom)-Math.max(a.top,d.top))/(d.width*d.height);u=s<=h}t.options.drop.checker&&(u=t.options.drop.checker(e,n,u,t,i,r,o));return u}(this,t,e,n,r,o,i)},n.dynamicDrop=function(t){return Or.is.bool(t)?(e.dynamicDrop=t,n):e.dynamicDrop},Or.extend(t.phaselessTypes,{dragenter:!0,dragleave:!0,dropactivate:!0,dropdeactivate:!0,dropmove:!0,drop:!0}),t.methodDict.drop="dropzone",e.dynamicDrop=!1,o.actions.drop=Dr.defaults},listeners:{"interactions:before-action-start":function(t){var e=t.interaction;"drag"===e.prepared.name&&(e.dropState={cur:{dropzone:null,element:null},prev:{dropzone:null,element:null},rejected:null,events:null,activeDrops:[]})},"interactions:after-action-start":function(t,e){var n=t.interaction,r=(t.event,t.iEvent);if("drag"===n.prepared.name){var o=n.dropState;o.activeDrops=null,o.events=null,o.activeDrops=Sr(e,n.element),o.events=kr(n,0,r),o.events.activate&&(jr(o.activeDrops,o.events.activate),e.fire("actions/drop:start",{interaction:n,dragEvent:r}))}},"interactions:action-move":Tr,"interactions:action-end":Tr,"interactions:after-action-move":function(t,e){var n=t.interaction,r=t.iEvent;"drag"===n.prepared.name&&(Er(n,n.dropState.events),e.fire("actions/drop:move",{interaction:n,dragEvent:r}),n.dropState.events={})},"interactions:after-action-end":function(t,e){var n=t.interaction,r=t.iEvent;"drag"===n.prepared.name&&(Er(n,n.dropState.events),e.fire("actions/drop:end",{interaction:n,dragEvent:r}))},"interactions:stop":function(t){var e=t.interaction;if("drag"===e.prepared.name){var n=e.dropState;n&&(n.activeDrops=null,n.events=null,n.cur.dropzone=null,n.cur.element=null,n.prev.dropzone=null,n.prev.element=null,n.rejected=!1)}}},getActiveDrops:Sr,getDrop:Mr,getDropEvents:kr,fireDropEvents:Er,defaults:{enabled:!1,accept:null,overlap:"pointer"}},Ir=Dr;br.default=Ir;var Ar={};function zr(t){return(zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.default=void 0;var Cr=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==zr(t)&&"function"!=typeof t)return{default:t};var e=Wr();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(De);function Wr(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return Wr=function(){return t},t}function Rr(t){var e=t.interaction,n=t.iEvent,r=t.phase;if("gesture"===e.prepared.name){var o=e.pointers.map(function(t){return t.pointer}),i="start"===r,a="end"===r,u=e.interactable.options.deltaSource;if(n.touches=[o[0],o[1]],i)n.distance=Cr.pointer.touchDistance(o,u),n.box=Cr.pointer.touchBBox(o),n.scale=1,n.ds=0,n.angle=Cr.pointer.touchAngle(o,u),n.da=0,e.gesture.startDistance=n.distance,e.gesture.startAngle=n.angle;else if(a){var s=e.prevEvent;n.distance=s.distance,n.box=s.box,n.scale=s.scale,n.ds=0,n.angle=s.angle,n.da=0}else n.distance=Cr.pointer.touchDistance(o,u),n.box=Cr.pointer.touchBBox(o),n.scale=n.distance/e.gesture.startDistance,n.angle=Cr.pointer.touchAngle(o,u),n.ds=n.scale-e.gesture.scale,n.da=n.angle-e.gesture.angle;e.gesture.distance=n.distance,e.gesture.angle=n.angle,Cr.is.number(n.scale)&&n.scale!==1/0&&!isNaN(n.scale)&&(e.gesture.scale=n.scale)}}var Fr={id:"actions/gesture",before:["actions/drag","actions/resize"],install:function(t){var e=t.actions,n=t.Interactable,r=t.defaults;n.prototype.gesturable=function(t){return Cr.is.object(t)?(this.options.gesture.enabled=!1!==t.enabled,this.setPerAction("gesture",t),this.setOnEvents("gesture",t),this):Cr.is.bool(t)?(this.options.gesture.enabled=t,this):this.options.gesture},e.map.gesture=Fr,e.methodDict.gesture="gesturable",r.actions.gesture=Fr.defaults},listeners:{"interactions:action-start":Rr,"interactions:action-move":Rr,"interactions:action-end":Rr,"interactions:new":function(t){t.interaction.gesture={angle:0,distance:0,scale:1,startAngle:0,startDistance:0}},"auto-start:check":function(t){if(!(t.interaction.pointers.length<2)){var e=t.interactable.options.gesture;if(e&&e.enabled)return!(t.action={name:"gesture"})}}},defaults:{},getCursor:function(){return""}},Xr=Fr;Ar.default=Xr;var Yr={};function Lr(t){return(Lr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.default=void 0;var Nr,Br=Gr(K),Vr=(Nr=Qt)&&Nr.__esModule?Nr:{default:Nr},qr=Gr(P);function Ur(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return Ur=function(){return t},t}function Gr(t){if(t&&t.__esModule)return t;if(null===t||"object"!==Lr(t)&&"function"!=typeof t)return{default:t};var e=Ur();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}return n.default=t,e&&e.set(t,n),n}function Hr(t,e,n,r,o,i,a){if(!e)return!1;if(!0===e){var u=qr.number(i.width)?i.width:i.right-i.left,s=qr.number(i.height)?i.height:i.bottom-i.top;if(a=Math.min(a,("left"===t||"right"===t?u:s)/2),u<0&&("left"===t?t="right":"right"===t&&(t="left")),s<0&&("top"===t?t="bottom":"bottom"===t&&(t="top")),"left"===t)return n.x<(0<=u?i.left:i.right)+a;if("top"===t)return n.y<(0<=s?i.top:i.bottom)+a;if("right"===t)return n.x>(0<=u?i.right:i.left)-a;if("bottom"===t)return n.y>(0<=s?i.bottom:i.top)-a}return!!qr.element(r)&&(qr.element(e)?e===r:Br.matchesUpTo(r,e,o))}function Kr(t){var e=t.iEvent,n=t.interaction;if("resize"===n.prepared.name&&n.resizeAxes){var r=e;n.interactable.options.resize.square?("y"===n.resizeAxes?r.delta.x=r.delta.y:r.delta.y=r.delta.x,r.axes="xy"):(r.axes=n.resizeAxes,"x"===n.resizeAxes?r.delta.y=0:"y"===n.resizeAxes&&(r.delta.x=0))}}var $r={id:"actions/resize",before:["actions/drag"],install:function(e){var t=e.actions,n=e.browser,r=e.Interactable,o=e.defaults;$r.cursors=n.isIe9?{x:"e-resize",y:"s-resize",xy:"se-resize",top:"n-resize",left:"w-resize",bottom:"s-resize",right:"e-resize",topleft:"se-resize",bottomright:"se-resize",topright:"ne-resize",bottomleft:"ne-resize"}:{x:"ew-resize",y:"ns-resize",xy:"nwse-resize",top:"ns-resize",left:"ew-resize",bottom:"ns-resize",right:"ew-resize",topleft:"nwse-resize",bottomright:"nwse-resize",topright:"nesw-resize",bottomleft:"nesw-resize"},$r.defaultMargin=n.supportsTouch||n.supportsPointerEvent?20:10,r.prototype.resizable=function(t){return function(t,e,n){if(qr.object(e))return t.options.resize.enabled=!1!==e.enabled,t.setPerAction("resize",e),t.setOnEvents("resize",e),qr.string(e.axis)&&/^x$|^y$|^xy$/.test(e.axis)?t.options.resize.axis=e.axis:null===e.axis&&(t.options.resize.axis=n.defaults.actions.resize.axis),qr.bool(e.preserveAspectRatio)?t.options.resize.preserveAspectRatio=e.preserveAspectRatio:qr.bool(e.square)&&(t.options.resize.square=e.square),t;if(qr.bool(e))return t.options.resize.enabled=e,t;return t.options.resize}(this,t,e)},t.map.resize=$r,t.methodDict.resize="resizable",o.actions.resize=$r.defaults},listeners:{"interactions:new":function(t){t.interaction.resizeAxes="xy"},"interactions:action-start":function(t){!function(t){var e=t.iEvent,n=t.interaction;if("resize"===n.prepared.name&&n.prepared.edges){var r=e,o=n.rect;n._rects={start:(0,Vr.default)({},o),corrected:(0,Vr.default)({},o),previous:(0,Vr.default)({},o),delta:{left:0,right:0,width:0,top:0,bottom:0,height:0}},r.edges=n.prepared.edges,r.rect=n._rects.corrected,r.deltaRect=n._rects.delta}}(t),Kr(t)},"interactions:action-move":function(t){!function(t){var e=t.iEvent,n=t.interaction;if("resize"===n.prepared.name&&n.prepared.edges){var r=e,o=n.interactable.options.resize.invert,i="reposition"===o||"negate"===o,a=n.rect,u=n._rects,s=u.start,l=u.corrected,c=u.delta,f=u.previous;if((0,Vr.default)(f,l),i){if((0,Vr.default)(l,a),"reposition"===o){if(l.top>l.bottom){var p=l.top;l.top=l.bottom,l.bottom=p}if(l.left>l.right){var d=l.left;l.left=l.right,l.right=d}}}else l.top=Math.min(a.top,s.bottom),l.bottom=Math.max(a.bottom,s.top),l.left=Math.min(a.left,s.right),l.right=Math.max(a.right,s.left);for(var v in l.width=l.right-l.left,l.height=l.bottom-l.top,l)c[v]=l[v]-f[v];r.edges=n.prepared.edges,r.rect=l,r.deltaRect=c}}(t),Kr(t)},"interactions:action-end":function(t){var e=t.iEvent,n=t.interaction;if("resize"===n.prepared.name&&n.prepared.edges){var r=e;r.edges=n.prepared.edges,r.rect=n._rects.corrected,r.deltaRect=n._rects.delta}},"auto-start:check":function(t){var e=t.interaction,n=t.interactable,r=t.element,o=t.rect,i=t.buttons;if(o){var a=(0,Vr.default)({},e.coords.cur.page),u=n.options.resize;if(u&&u.enabled&&(!e.pointerIsDown||!/mouse|pointer/.test(e.pointerType)||0!=(i&u.mouseButtons))){if(qr.object(u.edges)){var s={left:!1,right:!1,top:!1,bottom:!1};for(var l in s)s[l]=Hr(l,u.edges[l],a,e._latestPointer.eventTarget,r,o,u.margin||$r.defaultMargin);s.left=s.left&&!s.right,s.top=s.top&&!s.bottom,(s.left||s.right||s.top||s.bottom)&&(t.action={name:"resize",edges:s})}else{var c="y"!==u.axis&&a.x>o.right-$r.defaultMargin,f="x"!==u.axis&&a.y>o.bottom-$r.defaultMargin;(c||f)&&(t.action={name:"resize",axes:(c?"x":"")+(f?"y":"")})}return!t.action&&void 0}}}},defaults:{square:!1,preserveAspectRatio:!1,axis:"xy",margin:NaN,edges:null,invert:"none"},cursors:null,getCursor:function(t){var e=t.edges,n=t.axis,r=t.name,o=$r.cursors,i=null;if(n)i=o[r+n];else if(e){for(var a="",u=["top","bottom","left","right"],s=0;sf.innerWidth-po.margin,i=n.clientY>f.innerHeight-po.margin;else{var p=uo.getElementClientRect(f);a=n.clientXp.right-po.margin,i=n.clientY>p.bottom-po.margin}po.x=o?1:a?-1:0,po.y=i?1:r?-1:0,po.isScrolling||(po.margin=c.margin,po.speed=c.speed,po.start(e))}}};function vo(t,e,n){return(so.string(t)?(0,be.getStringOptionResult)(t,e,n):t)||(0,w.getWindow)(n)}function yo(t){return so.window(t)&&(t=window.document.body),{x:t.scrollLeft,y:t.scrollTop}}var ho={id:"auto-scroll",install:function(t){var e=t.defaults,n=t.actions;(t.autoScroll=po).now=function(){return t.now()},n.phaselessTypes.autoscroll=!0,e.perAction.autoScroll=po.defaults},listeners:{"interactions:new":function(t){t.interaction.autoScroll=null},"interactions:destroy":function(t){t.interaction.autoScroll=null,po.stop(),po.interaction&&(po.interaction=null)},"interactions:stop":po.stop,"interactions:action-move":function(t){return po.onInteractionMove(t)}}};oo.default=ho;var go={};function bo(t){return(bo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(go,"__esModule",{value:!0}),go.default=void 0;var mo=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==bo(t)&&"function"!=typeof t)return{default:t};var e=Oo();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(P);function Oo(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return Oo=function(){return t},t}function wo(t){return mo.bool(t)?(this.options.styleCursor=t,this):null===t?(delete this.options.styleCursor,this):this.options.styleCursor}function Po(t){return mo.func(t)?(this.options.actionChecker=t,this):null===t?(delete this.options.actionChecker,this):this.options.actionChecker}var _o={id:"auto-start/interactableMethods",install:function(d){var t=d.Interactable;t.prototype.getAction=function(t,e,n,r){var o,i,a,u,s,l,c,f,p=(i=e,a=n,u=r,s=d,l=(o=this).getRect(u),c=i.buttons||{0:1,1:4,3:8,4:16}[i.button],f={action:null,interactable:o,interaction:a,element:u,rect:l,buttons:c},s.fire("auto-start:check",f),f.action);return this.options.actionChecker?this.options.actionChecker(t,e,p,this,r,n):p},t.prototype.ignoreFrom=(0,De.warnOnce)(function(t){return this._backCompatOption("ignoreFrom",t)},"Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue})."),t.prototype.allowFrom=(0,De.warnOnce)(function(t){return this._backCompatOption("allowFrom",t)},"Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue})."),t.prototype.actionChecker=Po,t.prototype.styleCursor=wo}};go.default=_o;var xo={};function jo(t){return(jo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(xo,"__esModule",{value:!0}),xo.default=void 0;var So,Mo=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==jo(t)&&"function"!=typeof t)return{default:t};var e=Eo();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(De),ko=(So=go)&&So.__esModule?So:{default:So};function Eo(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return Eo=function(){return t},t}function To(t,e,n,r,o){return e.testIgnoreAllow(e.options[t.name],n,r)&&e.options[t.name].enabled&&zo(e,n,t,o)?t:null}function Do(t,e,n,r,o,i,a){for(var u=0,s=r.length;un.minSpeed&&o>n.endSpeed)this.startInertia();else{if(i.result=i.setAll(this.modifierArg),!i.result.changed)return!1;this.startSmoothEnd()}return e.modification.result.rect=null,e.offsetBy(this.targetOffset),e._doPhase({interaction:e,event:t,phase:"inertiastart"}),e.offsetBy({x:-this.targetOffset.x,y:-this.targetOffset.y}),e.modification.result.rect=null,this.active=!0,e.simulation=this,!0}},{key:"startInertia",value:function(){var t=this,e=this.interaction.coords.velocity.client,n=va(this.interaction),r=n.resistance,o=-Math.log(n.endSpeed/this.v0)/r;this.targetOffset={x:(e.x-o)/r,y:(e.y-o)/r},this.te=o,this.lambda_v0=r/this.v0,this.one_ve_v0=1-n.endSpeed/this.v0;var i=this.modification,a=this.modifierArg;a.pageCoords={x:this.startCoords.x+this.targetOffset.x,y:this.startCoords.y+this.targetOffset.y},i.result=i.setAll(a),i.result.changed&&(this.isModified=!0,this.modifiedOffset={x:this.targetOffset.x+i.result.delta.x,y:this.targetOffset.y+i.result.delta.y}),this.timeout=ua.default.request(function(){return t.inertiaTick()})}},{key:"startSmoothEnd",value:function(){var t=this;this.smoothEnd=!0,this.isModified=!0,this.targetOffset={x:this.modification.result.delta.x,y:this.modification.result.delta.y},this.timeout=ua.default.request(function(){return t.smoothEndTick()})}},{key:"inertiaTick",value:function(){var t,e,n,r,o,i,a,u=this,s=this.interaction,l=va(s).resistance,c=(s._now()-this.t0)/1e3;if(cMath.abs(s.y),u.coords,u.rect),(0,ma.default)(r,u.coords));return u.eventProps},defaults:{ratio:"preserve",equalDelta:!1,modifiers:[],enabled:!1}};ba.default=Ma;var ka={};function Ea(t){return(Ea="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(ka,"__esModule",{value:!0}),ka.getRestrictionRect=Wa,ka.default=void 0;var Ta,Da=(Ta=Qt)&&Ta.__esModule?Ta:{default:Ta},Ia=Ca(P),Aa=Ca(be);function za(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return za=function(){return t},t}function Ca(t){if(t&&t.__esModule)return t;if(null===t||"object"!==Ea(t)&&"function"!=typeof t)return{default:t};var e=za();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}return n.default=t,e&&e.set(t,n),n}function Wa(t,e,n){return Ia.func(t)?Aa.resolveRectLike(t,e.interactable,e.element,[n.x,n.y,e]):Aa.resolveRectLike(t,e.interactable,e.element)}var Ra={start:function(t){var e=t.rect,n=t.startOffset,r=t.state,o=t.interaction,i=t.pageCoords,a=r.options,u=a.elementRect,s=(0,Da.default)({left:0,top:0,right:0,bottom:0},a.offset||{});if(e&&u){var l=Wa(a.restriction,o,i);if(l){var c=l.right-l.left-e.width,f=l.bottom-l.top-e.height;c<0&&(s.left+=c,s.right+=c),f<0&&(s.top+=f,s.bottom+=f)}s.left+=n.left-e.width*u.left,s.top+=n.top-e.height*u.top,s.right+=n.right-e.width*(1-u.right),s.bottom+=n.bottom-e.height*(1-u.bottom)}r.offset=s},set:function(t){var e=t.coords,n=t.interaction,r=t.state,o=r.options,i=r.offset,a=Wa(o.restriction,n,e);if(a){var u=Aa.xywhToTlbr(a);e.x=Math.max(Math.min(u.right-i.right,e.x),u.left+i.left),e.y=Math.max(Math.min(u.bottom-i.bottom,e.y),u.top+i.top)}},defaults:{restriction:null,elementRect:null,offset:null,endOnly:!1,enabled:!1}};ka.default=Ra;var Fa={};function Xa(t){return(Xa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}Object.defineProperty(Fa,"__esModule",{value:!0}),Fa.default=void 0;var Ya,La=(Ya=Qt)&&Ya.__esModule?Ya:{default:Ya},Na=function(t){if(t&&t.__esModule)return t;if(null===t||"object"!==Xa(t)&&"function"!=typeof t)return{default:t};var e=Ba();if(e&&e.has(t))return e.get(t);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o)){var i=r?Object.getOwnPropertyDescriptor(t,o):null;i&&(i.get||i.set)?Object.defineProperty(n,o,i):n[o]=t[o]}n.default=t,e&&e.set(t,n);return n}(be);function Ba(){if("function"!=typeof WeakMap)return null;var t=new WeakMap;return Ba=function(){return t},t}var Va={top:1/0,left:1/0,bottom:-1/0,right:-1/0},qa={top:-1/0,left:-1/0,bottom:1/0,right:1/0};function Ua(t,e){for(var n=["top","left","bottom","right"],r=0;r\n * Released under the MIT License.\n * https://raw.github.com/taye/interact.js/master/LICENSE\n */\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.interact = f()}})(function(){var define,module,exports;\nvar createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}};\n","import * as arr from '@interactjs/utils/arr'\nimport browser from '@interactjs/utils/browser'\nimport clone from '@interactjs/utils/clone'\nimport { getElementRect, matchesUpTo, nodeContains, trySelector } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport normalizeListeners from '@interactjs/utils/normalizeListeners'\nimport { getWindow } from '@interactjs/utils/window'\nimport { ActionDefaults, Defaults, Options } from './defaultOptions'\nimport Eventable from './Eventable'\nimport { Actions, isNonNativeEvent } from './scope'\n\ntype IgnoreValue = string | Interact.Element | boolean\n\n/** */\nexport class Interactable implements Partial {\n protected get _defaults (): Defaults {\n return {\n base: {},\n perAction: {},\n actions: {} as ActionDefaults,\n }\n }\n\n readonly options!: Required\n readonly _actions: Actions\n readonly target: Interact.Target\n readonly events = new Eventable()\n readonly _context: Document | Interact.Element\n readonly _win: Window\n readonly _doc: Document\n\n /** */\n constructor (target: Interact.Target, options: any, defaultContext: Document | Interact.Element) {\n this._actions = options.actions\n this.target = target\n this._context = options.context || defaultContext\n this._win = getWindow(trySelector(target) ? this._context : target)\n this._doc = this._win.document\n\n this.set(options)\n }\n\n setOnEvents (actionName: Interact.ActionName, phases: NonNullable) {\n if (is.func(phases.onstart)) { this.on(`${actionName}start`, phases.onstart) }\n if (is.func(phases.onmove)) { this.on(`${actionName}move`, phases.onmove) }\n if (is.func(phases.onend)) { this.on(`${actionName}end`, phases.onend) }\n if (is.func(phases.oninertiastart)) { this.on(`${actionName}inertiastart`, phases.oninertiastart) }\n\n return this\n }\n\n updatePerActionListeners (actionName: Interact.ActionName, prev: Interact.Listeners, cur: Interact.Listeners) {\n if (is.array(prev) || is.object(prev)) {\n this.off(actionName, prev)\n }\n\n if (is.array(cur) || is.object(cur)) {\n this.on(actionName, cur)\n }\n }\n\n setPerAction (actionName: Interact.ActionName, options: Interact.OrBoolean) {\n const defaults = this._defaults\n\n // for all the default per-action options\n for (const optionName_ in options) {\n const optionName = optionName_ as keyof Interact.PerActionDefaults\n const actionOptions = this.options[actionName]\n const optionValue: any = options[optionName]\n\n // remove old event listeners and add new ones\n if (optionName === 'listeners') {\n this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue as Interact.Listeners)\n }\n\n // if the option value is an array\n if (is.array(optionValue)) {\n (actionOptions[optionName] as any) = arr.from(optionValue)\n }\n // if the option value is an object\n else if (is.plainObject(optionValue)) {\n // copy the object\n (actionOptions[optionName] as any) = extend(\n actionOptions[optionName] || {} as any,\n clone(optionValue))\n\n // set anabled field to true if it exists in the defaults\n if (is.object(defaults.perAction[optionName]) && 'enabled' in (defaults.perAction[optionName] as any)) {\n (actionOptions[optionName] as any).enabled = optionValue.enabled !== false\n }\n }\n // if the option value is a boolean and the default is an object\n else if (is.bool(optionValue) && is.object(defaults.perAction[optionName])) {\n (actionOptions[optionName] as any).enabled = optionValue\n }\n // if it's anything else, do a plain assignment\n else {\n (actionOptions[optionName] as any) = optionValue\n }\n }\n }\n\n /**\n * The default function to get an Interactables bounding rect. Can be\n * overridden using {@link Interactable.rectChecker}.\n *\n * @param {Element} [element] The element to measure.\n * @return {object} The object's bounding rectangle.\n */\n getRect (element: Interact.Element) {\n element = element || (is.element(this.target)\n ? this.target\n : null)\n\n if (is.string(this.target)) {\n element = element || this._context.querySelector(this.target)\n }\n\n return getElementRect(element)\n }\n\n /**\n * Returns or sets the function used to calculate the interactable's\n * element's rectangle\n *\n * @param {function} [checker] A function which returns this Interactable's\n * bounding rectangle. See {@link Interactable.getRect}\n * @return {function | object} The checker function or this Interactable\n */\n rectChecker (checker: (element: Interact.Element) => any) {\n if (is.func(checker)) {\n this.getRect = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.getRect\n\n return this\n }\n\n return this.getRect\n }\n\n _backCompatOption (optionName: keyof Interact.Options, newValue: any) {\n if (trySelector(newValue) || is.object(newValue)) {\n (this.options[optionName] as any) = newValue\n\n for (const action in this._actions.map) {\n (this.options[action][optionName] as any) = newValue\n }\n\n return this\n }\n\n return this.options[optionName]\n }\n\n /**\n * Gets or sets the origin of the Interactable's element. The x and y\n * of the origin will be subtracted from action event coordinates.\n *\n * @param {Element | object | string} [origin] An HTML or SVG Element whose\n * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'\n * or any CSS selector\n *\n * @return {object} The current origin or this Interactable\n */\n origin (newValue: any) {\n return this._backCompatOption('origin', newValue)\n }\n\n /**\n * Returns or sets the mouse coordinate types used to calculate the\n * movement of the pointer.\n *\n * @param {string} [newValue] Use 'client' if you will be scrolling while\n * interacting; Use 'page' if you want autoScroll to work\n * @return {string | object} The current deltaSource or this Interactable\n */\n deltaSource (newValue?: string) {\n if (newValue === 'page' || newValue === 'client') {\n this.options.deltaSource = newValue\n\n return this\n }\n\n return this.options.deltaSource\n }\n\n /**\n * Gets the selector context Node of the Interactable. The default is\n * `window.document`.\n *\n * @return {Node} The context Node of this Interactable\n */\n context () {\n return this._context\n }\n\n inContext (element: Document | Node) {\n return (this._context === element.ownerDocument ||\n nodeContains(this._context, element))\n }\n\n testIgnoreAllow (\n this: Interactable,\n options: { ignoreFrom?: IgnoreValue, allowFrom?: IgnoreValue },\n targetNode: Node,\n eventTarget: Interact.EventTarget,\n ) {\n return (!this.testIgnore(options.ignoreFrom, targetNode, eventTarget) &&\n this.testAllow(options.allowFrom, targetNode, eventTarget))\n }\n\n testAllow (\n this: Interactable,\n allowFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!allowFrom) { return true }\n\n if (!is.element(element)) { return false }\n\n if (is.string(allowFrom)) {\n return matchesUpTo(element, allowFrom, targetNode)\n }\n else if (is.element(allowFrom)) {\n return nodeContains(allowFrom, element)\n }\n\n return false\n }\n\n testIgnore (\n this: Interactable,\n ignoreFrom: IgnoreValue,\n targetNode: Node,\n element: Interact.EventTarget,\n ) {\n if (!ignoreFrom || !is.element(element)) { return false }\n\n if (is.string(ignoreFrom)) {\n return matchesUpTo(element, ignoreFrom, targetNode)\n }\n else if (is.element(ignoreFrom)) {\n return nodeContains(ignoreFrom, element)\n }\n\n return false\n }\n\n /**\n * Calls listeners for the given InteractEvent type bound globally\n * and directly to this Interactable\n *\n * @param {InteractEvent} iEvent The InteractEvent object to be fired on this\n * Interactable\n * @return {Interactable} this Interactable\n */\n fire (iEvent: object) {\n this.events.fire(iEvent)\n\n return this\n }\n\n _onOff (method: 'on' | 'off', typeArg: Interact.EventTypes, listenerArg?: Interact.ListenersArg | null, options?: any) {\n if (is.object(typeArg) && !is.array(typeArg)) {\n options = listenerArg\n listenerArg = null\n }\n\n const addRemove = method === 'on' ? 'add' : 'remove'\n const listeners = normalizeListeners(typeArg, listenerArg)\n\n for (let type in listeners) {\n if (type === 'wheel') { type = browser.wheelEvent }\n\n for (const listener of listeners[type]) {\n // if it is an action event type\n if (isNonNativeEvent(type, this._actions)) {\n this.events[method](type, listener)\n }\n // delegated event\n else if (is.string(this.target)) {\n events[`${addRemove}Delegate` as 'addDelegate' | 'removeDelegate'](this.target, this._context, type, listener, options)\n }\n // remove listener from this Interactable's element\n else {\n (events[addRemove] as typeof events.remove)(this.target, type, listener, options)\n }\n }\n }\n\n return this\n }\n\n /**\n * Binds a listener for an InteractEvent, pointerEvent or DOM event.\n *\n * @param {string | array | object} types The types of events to listen\n * for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * addEventListener\n * @return {Interactable} This Interactable\n */\n on (types: Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('on', types, listener, options)\n }\n\n /**\n * Removes an InteractEvent, pointerEvent or DOM event listener.\n *\n * @param {string | array | object} types The types of events that were\n * listened for\n * @param {function | array | object} [listener] The event listener function(s)\n * @param {object | boolean} [options] options object or useCapture flag for\n * removeEventListener\n * @return {Interactable} This Interactable\n */\n off (types: string | string[] | Interact.EventTypes, listener?: Interact.ListenersArg, options?: any) {\n return this._onOff('off', types, listener, options)\n }\n\n /**\n * Reset the options of this Interactable\n *\n * @param {object} options The new settings to apply\n * @return {object} This Interactable\n */\n set (options: Interact.OptionsArg) {\n const defaults = this._defaults\n\n if (!is.object(options)) {\n options = {}\n }\n\n (this.options as Required) = clone(defaults.base) as Required\n\n for (const actionName_ in this._actions.methodDict) {\n const actionName = actionName_ as Interact.ActionName\n const methodName = this._actions.methodDict[actionName]\n\n this.options[actionName] = {}\n this.setPerAction(actionName, extend(extend({}, defaults.perAction), defaults.actions[actionName]))\n\n this[methodName](options[actionName])\n }\n\n for (const setting in options) {\n if (is.func(this[setting])) {\n this[setting](options[setting])\n }\n }\n\n return this\n }\n\n /**\n * Remove this interactable from the list of interactables and remove it's\n * action capabilities and event listeners\n *\n * @return {interact}\n */\n unset () {\n events.remove(this.target as Node, 'all')\n\n if (is.string(this.target)) {\n // remove delegated events\n for (const type in events.delegatedEvents) {\n const delegated = events.delegatedEvents[type]\n\n if (delegated.selectors[0] === this.target &&\n delegated.contexts[0] === this._context) {\n delegated.selectors.splice(0, 1)\n delegated.contexts.splice(0, 1)\n delegated.listeners.splice(0, 1)\n }\n\n events.remove(this._context, type, events.delegateListener)\n events.remove(this._context, type, events.delegateUseCapture, true)\n }\n }\n else {\n events.remove(this.target as Node, 'all')\n }\n }\n}\n\nexport default Interactable\n","import domObjects from '@interactjs/utils/domObjects'\nimport * as utils from '@interactjs/utils/index'\nimport defaults from './defaultOptions'\nimport Eventable from './Eventable'\nimport InteractableBase from './Interactable'\nimport InteractableSet from './InteractableSet'\nimport InteractEvent, { PhaseMap } from './InteractEvent'\nimport interactions from './interactions'\n\nexport interface SignalArgs {\n 'scope:add-document': DocSignalArg\n 'scope:remove-document': DocSignalArg\n 'interactable:unset': { interactable: InteractableBase }\n 'interactable:set': { interactable: InteractableBase, options: Interact.Options }\n 'interactions:destroy': { interaction: Interact.Interaction }\n}\n\nexport type ListenerName = keyof SignalArgs\n\nexport type ListenerMap = {\n [P in ListenerName]?: (arg: SignalArgs[P], scope: Scope, signalName: P) => void | boolean\n}\n\ninterface DocSignalArg {\n doc: Document\n window: Window\n scope: Scope\n options?: { [index: string]: any }\n}\n\nconst {\n win,\n browser,\n raf,\n events,\n} = utils\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionMap { // tslint:disable-line no-empty-interface\n}\n\nexport type ActionName = keyof ActionMap\n\nexport interface Actions {\n map: ActionMap\n phases: PhaseMap\n methodDict: { [P in ActionName]?: string }\n phaselessTypes: { [type: string]: true }\n}\n\nexport function createScope () {\n return new Scope()\n}\n\nexport type Defaults = typeof defaults\n\nexport interface Plugin {\n [key: string]: any\n id?: string\n listeners?: ListenerMap\n before?: string[]\n install? (scope: Scope, options?: any): void\n}\n\nexport class Scope {\n id = `__interact_scope_${Math.floor(Math.random() * 100)}`\n listenerMaps: Array<{\n map: ListenerMap\n id: string\n }> = []\n\n browser = browser\n events = events\n utils = utils\n defaults: Defaults = utils.clone(defaults) as Defaults\n Eventable = Eventable\n actions: Actions = {\n map: {},\n phases: {\n start: true,\n move: true,\n end: true,\n },\n methodDict: {},\n phaselessTypes: {},\n }\n\n InteractEvent = InteractEvent\n Interactable!: typeof InteractableBase\n interactables = new InteractableSet(this)\n\n // main window\n _win!: Window\n\n // main document\n document!: Document\n\n // main window\n window!: Window\n\n // all documents being listened to\n documents: Array<{ doc: Document, options: any }> = []\n\n _plugins: {\n list: Plugin[]\n map: { [id: string]: Plugin }\n } = {\n list: [],\n map: {},\n }\n\n constructor () {\n const scope = this as Scope\n\n ;(this as { Interactable: typeof InteractableBase }).Interactable = class Interactable extends InteractableBase implements InteractableBase {\n get _defaults () { return scope.defaults }\n\n set (options: Interact.Options) {\n super.set(options)\n\n scope.fire('interactable:set', {\n options,\n interactable: this,\n })\n\n return this\n }\n\n unset () {\n super.unset()\n for (let i = scope.interactions.list.length - 1; i >= 0; i--) {\n const interaction = scope.interactions.list[i]\n\n if (interaction.interactable === this) {\n interaction.stop()\n scope.fire('interactions:destroy', { interaction })\n interaction.destroy()\n\n if (scope.interactions.list.length > 2) {\n scope.interactions.list.splice(i, 1)\n }\n }\n }\n\n scope.fire('interactable:unset', { interactable: this })\n }\n }\n }\n\n addListeners (map: ListenerMap, id?: string) {\n this.listenerMaps.push({ id, map })\n }\n\n fire (name: T, arg: SignalArgs[T]): void | false {\n for (const { map: { [name]: listener } } of this.listenerMaps) {\n if (!!listener && listener(arg as any, this, name as never) === false) {\n return false\n }\n }\n }\n\n onWindowUnload = (event: BeforeUnloadEvent) => this.removeDocument(event.target as Document)\n\n init (window: Window) {\n return initScope(this, window)\n }\n\n pluginIsInstalled (plugin: Plugin) {\n return this._plugins.map[plugin.id] || this._plugins.list.indexOf(plugin) !== -1\n }\n\n usePlugin (plugin: Plugin, options?: { [key: string]: any }) {\n if (this.pluginIsInstalled(plugin)) {\n return this\n }\n\n if (plugin.id) { this._plugins.map[plugin.id] = plugin }\n this._plugins.list.push(plugin)\n\n if (plugin.install) {\n plugin.install(this, options)\n }\n\n if (plugin.listeners && plugin.before) {\n let index = 0\n const len = this.listenerMaps.length\n const before = plugin.before.reduce((acc, id) => {\n acc[id] = true\n return acc\n }, {})\n\n for (; index < len; index++) {\n const otherId = this.listenerMaps[index].id\n\n if (before[otherId]) { break }\n }\n\n this.listenerMaps.splice(index, 0, { id: plugin.id, map: plugin.listeners })\n }\n else if (plugin.listeners) {\n this.listenerMaps.push({ id: plugin.id, map: plugin.listeners })\n }\n\n return this\n }\n\n addDocument (doc: Document, options?: any): void | false {\n // do nothing if document is already known\n if (this.getDocIndex(doc) !== -1) { return false }\n\n const window = win.getWindow(doc)\n\n options = options ? utils.extend({}, options) : {}\n\n this.documents.push({ doc, options })\n events.documents.push(doc)\n\n // don't add an unload event for the main document\n // so that the page may be cached in browser history\n if (doc !== this.document) {\n events.add(window, 'unload', this.onWindowUnload)\n }\n\n this.fire('scope:add-document', { doc, window, scope: this, options })\n }\n\n removeDocument (doc: Document) {\n const index = this.getDocIndex(doc)\n\n const window = win.getWindow(doc)\n const options = this.documents[index].options\n\n events.remove(window, 'unload', this.onWindowUnload)\n\n this.documents.splice(index, 1)\n events.documents.splice(index, 1)\n\n this.fire('scope:remove-document', { doc, window, scope: this, options })\n }\n\n getDocIndex (doc: Document) {\n for (let i = 0; i < this.documents.length; i++) {\n if (this.documents[i].doc === doc) {\n return i\n }\n }\n\n return -1\n }\n\n getDocOptions (doc: Document) {\n const docIndex = this.getDocIndex(doc)\n\n return docIndex === -1 ? null : this.documents[docIndex].options\n }\n\n now () {\n return ((this.window as any).Date as typeof Date || Date).now()\n }\n}\n\nexport function isNonNativeEvent (type: string, actions: Actions) {\n if (actions.phaselessTypes[type]) { return true }\n\n for (const name in actions.map) {\n if (type.indexOf(name) === 0 && type.substr(name.length) in actions.phases) {\n return true\n }\n }\n\n return false\n}\n\nexport function initScope (scope: Scope, window: Window) {\n win.init(window)\n domObjects.init(window)\n browser.init(window)\n raf.init(window)\n events.init(window)\n\n scope.usePlugin(interactions)\n scope.document = window.document\n scope.window = window\n\n return scope\n}\n","import browser from '@interactjs/utils/browser'\nimport domObjects from '@interactjs/utils/domObjects'\nimport { nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as pointerUtils from '@interactjs/utils/pointerUtils'\nimport InteractionBase from './Interaction'\nimport finder, { SearchDetails } from './interactionFinder'\nimport { Scope } from './scope'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n Interaction: typeof InteractionBase\n interactions: {\n new: (options: any) => InteractionBase\n list: InteractionBase[]\n listeners: { [type: string]: Interact.Listener }\n docEvents: Array<{ type: string, listener: Interact.Listener }>\n pointerMoveTolerance: number\n }\n prevTouchTime: number\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:find': {\n interaction: InteractionBase\n searchDetails: SearchDetails\n }\n }\n}\n\nconst methodNames = [\n 'pointerDown', 'pointerMove', 'pointerUp',\n 'updatePointer', 'removePointer', 'windowBlur',\n]\n\nfunction install (scope: Scope) {\n const listeners = {} as any\n\n for (const method of methodNames) {\n listeners[method] = doOnInteractions(method, scope)\n }\n\n const pEventTypes = browser.pEventTypes\n let docEvents: typeof scope.interactions.docEvents\n\n if (domObjects.PointerEvent) {\n docEvents = [\n { type: pEventTypes.down, listener: releasePointersOnRemovedEls },\n { type: pEventTypes.down, listener: listeners.pointerDown },\n { type: pEventTypes.move, listener: listeners.pointerMove },\n { type: pEventTypes.up, listener: listeners.pointerUp },\n { type: pEventTypes.cancel, listener: listeners.pointerUp },\n ]\n }\n else {\n docEvents = [\n { type: 'mousedown', listener: listeners.pointerDown },\n { type: 'mousemove', listener: listeners.pointerMove },\n { type: 'mouseup', listener: listeners.pointerUp },\n\n { type: 'touchstart', listener: releasePointersOnRemovedEls },\n { type: 'touchstart', listener: listeners.pointerDown },\n { type: 'touchmove', listener: listeners.pointerMove },\n { type: 'touchend', listener: listeners.pointerUp },\n { type: 'touchcancel', listener: listeners.pointerUp },\n ]\n }\n\n docEvents.push({\n type: 'blur',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n interaction.documentBlur(event)\n }\n },\n })\n\n // for ignoring browser's simulated mouse events\n scope.prevTouchTime = 0\n\n scope.Interaction = class Interaction extends InteractionBase {\n get pointerMoveTolerance () {\n return scope.interactions.pointerMoveTolerance\n }\n\n set pointerMoveTolerance (value) {\n scope.interactions.pointerMoveTolerance = value\n }\n\n _now () { return scope.now() }\n }\n\n scope.interactions = {\n // all active and idle interactions\n list: [],\n new (options: { pointerType?: string, scopeFire?: Scope['fire'] }) {\n options.scopeFire = (name, arg) => scope.fire(name, arg)\n\n const interaction = new scope.Interaction(options as Required)\n\n scope.interactions.list.push(interaction)\n return interaction\n },\n listeners,\n docEvents,\n pointerMoveTolerance: 1,\n }\n\n function releasePointersOnRemovedEls () {\n // for all inactive touch interactions with pointers down\n for (const interaction of scope.interactions.list) {\n if (!interaction.pointerIsDown ||\n interaction.pointerType !== 'touch' ||\n interaction._interacting) {\n continue\n }\n\n // if a pointer is down on an element that is no longer in the DOM tree\n for (const pointer of interaction.pointers) {\n if (!scope.documents.some(({ doc }) => nodeContains(doc, pointer.downTarget))) {\n // remove the pointer from the interaction\n interaction.removePointer(pointer.pointer, pointer.event)\n }\n }\n }\n }\n}\n\nfunction doOnInteractions (method, scope) {\n return function (event) {\n const interactions = scope.interactions.list\n\n const pointerType = pointerUtils.getPointerType(event)\n const [eventTarget, curEventTarget] = pointerUtils.getEventTargets(event)\n const matches = [] // [ [pointer, interaction], ...]\n\n if (/^touch/.test(event.type)) {\n scope.prevTouchTime = scope.now()\n\n for (const changedTouch of event.changedTouches) {\n const pointer = changedTouch\n const pointerId = pointerUtils.getPointerId(pointer)\n const searchDetails: SearchDetails = {\n pointer,\n pointerId,\n pointerType,\n eventType: event.type,\n eventTarget,\n curEventTarget,\n scope,\n }\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n else {\n let invalidPointer = false\n\n if (!browser.supportsPointerEvent && /mouse/.test(event.type)) {\n // ignore mouse events while touch interactions are active\n for (let i = 0; i < interactions.length && !invalidPointer; i++) {\n invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown\n }\n\n // try to ignore mouse events that are simulated by the browser\n // after a touch event\n invalidPointer = invalidPointer ||\n (scope.now() - scope.prevTouchTime < 500) ||\n // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated\n event.timeStamp === 0\n }\n\n if (!invalidPointer) {\n const searchDetails = {\n pointer: event,\n pointerId: pointerUtils.getPointerId(event),\n pointerType,\n eventType: event.type,\n curEventTarget,\n eventTarget,\n scope,\n }\n\n const interaction = getInteraction(searchDetails)\n\n matches.push([\n searchDetails.pointer,\n searchDetails.eventTarget,\n searchDetails.curEventTarget,\n interaction,\n ])\n }\n }\n\n // eslint-disable-next-line no-shadow\n for (const [pointer, eventTarget, curEventTarget, interaction] of matches) {\n interaction[method](pointer, event, eventTarget, curEventTarget)\n }\n }\n}\n\nfunction getInteraction (searchDetails: SearchDetails) {\n const { pointerType, scope } = searchDetails\n\n const foundInteraction = finder.search(searchDetails)\n const signalArg = { interaction: foundInteraction, searchDetails }\n\n scope.fire('interactions:find', signalArg)\n\n return signalArg.interaction || scope.interactions.new({ pointerType })\n}\n\nfunction onDocSignal ({ doc, scope, options }: Interact.SignalArgs[T], eventMethodName: 'add' | 'remove') {\n const { docEvents } = scope.interactions\n const eventMethod = events[eventMethodName]\n\n if (scope.browser.isIOS && !options.events) {\n options.events = { passive: false }\n }\n\n // delegate event listener\n for (const eventType in events.delegatedEvents) {\n eventMethod(doc, eventType, events.delegateListener)\n eventMethod(doc, eventType, events.delegateUseCapture, true)\n }\n\n const eventOptions = options && options.events\n\n for (const { type, listener } of docEvents) {\n eventMethod(doc, type, listener, eventOptions)\n }\n}\n\nexport default {\n id: 'core/interactions',\n install,\n listeners: {\n 'scope:add-document': arg => onDocSignal(arg, 'add'),\n 'scope:remove-document': arg => onDocSignal(arg, 'remove'),\n },\n onDocSignal,\n doOnInteractions,\n methodNames,\n}\n","export default (thing: any) => !!(thing && thing.Window) && (thing instanceof thing.Window)\n","import isWindow from './isWindow'\n\nconst win = {\n realWindow: undefined as Window,\n window: undefined as Window,\n getWindow,\n init,\n}\n\nexport function init (window: Window & { wrap?: (...args: any[]) => any }) {\n // get wrapped window if using Shadow DOM polyfill\n\n win.realWindow = window\n\n // create a TextNode\n const el = window.document.createTextNode('')\n\n // check if it's wrapped by a polyfill\n if (el.ownerDocument !== window.document &&\n typeof window.wrap === 'function' &&\n window.wrap(el) === el) {\n // use wrapped window\n window = window.wrap(window)\n }\n\n win.window = window\n}\n\nif (typeof window === 'undefined') {\n win.window = undefined\n win.realWindow = undefined\n}\nelse {\n init(window)\n}\n\nexport function getWindow (node: any) {\n if (isWindow(node)) {\n return node\n }\n\n const rootNode = (node.ownerDocument || node)\n\n return rootNode.defaultView || win.window\n}\n\nwin.init = init\n\nexport default win\n","// tslint:disable variable-name\n\nimport isWindow from './isWindow'\nimport win from './window'\n\nexport const window = (thing: any): thing is Window =>\n thing === win.window || isWindow(thing)\n\nexport const docFrag = (thing: any): thing is DocumentFragment =>\n object(thing) && thing.nodeType === 11\n\nexport const object = (thing: any): thing is { [index: string]: any } =>\n !!thing && (typeof thing === 'object')\n\nexport const func = (thing: any): thing is (...args: any[]) => any =>\n typeof thing === 'function'\n\nexport const number = (thing: any): thing is number =>\n typeof thing === 'number'\n\nexport const bool = (thing: any): thing is boolean =>\n typeof thing === 'boolean'\n\nexport const string = (thing: any): thing is string =>\n typeof thing === 'string'\n\nexport const element = (thing: any): thing is Interact.Element => {\n if (!thing || (typeof thing !== 'object')) { return false }\n\n const _window = win.getWindow(thing) || win.window\n\n return (/object|function/.test(typeof _window.Element)\n ? thing instanceof _window.Element // DOM2\n : thing.nodeType === 1 && typeof thing.nodeName === 'string')\n}\n\nexport const plainObject: typeof object = (thing: any): thing is { [index: string]: any } =>\n object(thing) &&\n !!thing.constructor &&\n /function Object\\b/.test(thing.constructor.toString())\n\nexport const array = (thing: any): thing is T[] =>\n (object(thing) &&\n (typeof thing.length !== 'undefined') &&\n func(thing.splice))\n","import { Scope } from '@interactjs/core/scope'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n draggable: DraggableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n drag: Interact.DraggableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n drag?: typeof drag\n }\n}\n\nexport type DragEvent = Interact.InteractEvent<'drag'>\n\nexport type DraggableMethod = Interact.ActionMethod\n\nfunction install (scope: Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n Interactable.prototype.draggable = drag.draggable\n\n actions.map.drag = drag\n actions.methodDict.drag = 'draggable'\n\n defaults.actions.drag = drag.defaults\n}\n\nfunction beforeMove ({ interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x') {\n interaction.coords.cur.page.y = interaction.coords.start.page.y\n interaction.coords.cur.client.y = interaction.coords.start.client.y\n\n interaction.coords.velocity.client.y = 0\n interaction.coords.velocity.page.y = 0\n }\n else if (axis === 'y') {\n interaction.coords.cur.page.x = interaction.coords.start.page.x\n interaction.coords.cur.client.x = interaction.coords.start.client.x\n\n interaction.coords.velocity.client.x = 0\n interaction.coords.velocity.page.x = 0\n }\n}\n\nfunction move ({ iEvent, interaction }) {\n if (interaction.prepared.name !== 'drag') { return }\n\n const axis = interaction.prepared.axis\n\n if (axis === 'x' || axis === 'y') {\n const opposite = axis === 'x' ? 'y' : 'x'\n\n iEvent.page[opposite] = interaction.coords.start.page[opposite]\n iEvent.client[opposite] = interaction.coords.start.client[opposite]\n iEvent.delta[opposite] = 0\n }\n}\n\n/**\n * ```js\n * interact(element).draggable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // the axis in which the first movement must be\n * // for the drag sequence to start\n * // 'xy' by default - any direction\n * startAxis: 'x' || 'y' || 'xy',\n *\n * // 'xy' by default - don't restrict to one axis (move in any direction)\n * // 'x' or 'y' to restrict movement to either axis\n * // 'start' to restrict movement to the axis the drag started in\n * lockAxis: 'x' || 'y' || 'xy' || 'start',\n *\n * // max number of drags that can happen concurrently\n * // with elements of this Interactable. Infinity by default\n * max: Infinity,\n *\n * // max number of drags that can target the same element+Interactable\n * // 1 by default\n * maxPerElement: 2\n * })\n *\n * var isDraggable = interact('element').draggable(); // true\n * ```\n *\n * Get or set whether drag actions can be performed on the target\n *\n * @alias Interactable.prototype.draggable\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on drag events (object makes the Interactable\n * draggable)\n * @return {boolean | Interactable} boolean indicating if this can be the\n * target of drag events, or this Interctable\n */\nconst draggable: DraggableMethod = function draggable (this: Interact.Interactable, options?: Interact.DraggableOptions | boolean): any {\n if (is.object(options)) {\n this.options.drag.enabled = options.enabled !== false\n this.setPerAction('drag', options)\n this.setOnEvents('drag', options)\n\n if (/^(xy|x|y|start)$/.test(options.lockAxis)) {\n this.options.drag.lockAxis = options.lockAxis\n }\n if (/^(xy|x|y)$/.test(options.startAxis)) {\n this.options.drag.startAxis = options.startAxis\n }\n\n return this\n }\n\n if (is.bool(options)) {\n this.options.drag.enabled = options\n\n return this\n }\n\n return this.options.drag\n}\n\nconst drag: Interact.Plugin = {\n id: 'actions/drag',\n install,\n listeners: {\n 'interactions:before-action-move': beforeMove,\n 'interactions:action-resume': beforeMove,\n\n // dragmove\n 'interactions:action-move': move,\n 'auto-start:check': arg => {\n const { interaction, interactable, buttons } = arg\n const dragOptions = interactable.options.drag\n\n if (\n !(dragOptions && dragOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & interactable.options.drag.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n arg.action = {\n name: 'drag',\n axis: (dragOptions.lockAxis === 'start'\n ? dragOptions.startAxis\n : dragOptions.lockAxis),\n }\n\n return false\n },\n },\n draggable,\n beforeMove,\n move,\n defaults: {\n startAxis : 'xy',\n lockAxis : 'xy',\n } as Interact.DropzoneOptions,\n\n getCursor () {\n return 'move'\n },\n}\n\nexport default drag\n","type Filter = (element: T, index: number, array: T[]) => boolean\n\nexport function contains (array: T[], target: T) {\n return array.indexOf(target) !== -1\n}\n\nexport function remove (array: T[], target: T) {\n return array.splice(array.indexOf(target), 1)\n}\n\nexport function merge (target: Array, source: U[]) {\n for (const item of source) {\n target.push(item)\n }\n\n return target\n}\n\nexport function from (source: ArrayLike) {\n return merge([] as T[], source as T[])\n}\n\nexport function findIndex (array: T[], func: Filter) {\n for (let i = 0; i < array.length; i++) {\n if (func(array[i], i, array)) {\n return i\n }\n }\n\n return -1\n}\n\nexport function find (array: T[], func: Filter) {\n return array[findIndex(array, func)]\n}\n","const domObjects: {\n init: any\n document: Document\n DocumentFragment: typeof DocumentFragment\n SVGElement: typeof SVGElement\n SVGSVGElement: typeof SVGSVGElement\n SVGElementInstance: any\n Element: typeof Element\n HTMLElement: typeof HTMLElement\n Event: typeof Event\n Touch: typeof Touch\n PointerEvent: typeof PointerEvent\n} =\n{\n init,\n document: null,\n DocumentFragment: null,\n SVGElement: null,\n SVGSVGElement: null,\n SVGElementInstance: null,\n Element: null,\n HTMLElement: null,\n Event: null,\n Touch: null,\n PointerEvent: null,\n}\n\nfunction blank () {}\n\nexport default domObjects\n\nfunction init (window: Window) {\n const win = window as any\n\n domObjects.document = win.document\n domObjects.DocumentFragment = win.DocumentFragment || blank\n domObjects.SVGElement = win.SVGElement || blank\n domObjects.SVGSVGElement = win.SVGSVGElement || blank\n domObjects.SVGElementInstance = win.SVGElementInstance || blank\n domObjects.Element = win.Element || blank\n domObjects.HTMLElement = win.HTMLElement || domObjects.Element\n\n domObjects.Event = win.Event\n domObjects.Touch = win.Touch || blank\n domObjects.PointerEvent = (win.PointerEvent || win.MSPointerEvent)\n}\n","import domObjects from './domObjects'\nimport * as is from './is'\nimport win from './window'\n\nconst browser = {\n init,\n supportsTouch: null as boolean,\n supportsPointerEvent: null as boolean,\n isIOS7: null as boolean,\n isIOS: null as boolean,\n isIe9: null as boolean,\n isOperaMobile: null as boolean,\n prefixedMatchesSelector: null as string,\n pEventTypes: null as {\n up: string\n down: string\n over: string\n out: string\n move: string\n cancel: string\n },\n wheelEvent: null as string,\n}\n\nfunction init (window: any) {\n const Element = domObjects.Element\n const navigator = win.window.navigator\n\n // Does the browser support touch input?\n browser.supportsTouch = ('ontouchstart' in window) ||\n (is.func(window.DocumentTouch) && domObjects.document instanceof window.DocumentTouch)\n\n // Does the browser support PointerEvents\n browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!domObjects.PointerEvent\n\n browser.isIOS = (/iP(hone|od|ad)/.test(navigator.platform))\n\n // scrolling doesn't change the result of getClientRects on iOS 7\n browser.isIOS7 = (/iP(hone|od|ad)/.test(navigator.platform) &&\n /OS 7[^\\d]/.test(navigator.appVersion))\n\n browser.isIe9 = /MSIE 9/.test(navigator.userAgent)\n\n // Opera Mobile must be handled differently\n browser.isOperaMobile = (navigator.appName === 'Opera' &&\n browser.supportsTouch &&\n /Presto/.test(navigator.userAgent))\n\n // prefix matchesSelector\n browser.prefixedMatchesSelector = 'matches' in Element.prototype\n ? 'matches'\n : 'webkitMatchesSelector' in Element.prototype\n ? 'webkitMatchesSelector'\n : 'mozMatchesSelector' in Element.prototype\n ? 'mozMatchesSelector'\n : 'oMatchesSelector' in Element.prototype\n ? 'oMatchesSelector'\n : 'msMatchesSelector'\n\n browser.pEventTypes = (browser.supportsPointerEvent\n ? (domObjects.PointerEvent === window.MSPointerEvent\n ? {\n up: 'MSPointerUp',\n down: 'MSPointerDown',\n over: 'mouseover',\n out: 'mouseout',\n move: 'MSPointerMove',\n cancel: 'MSPointerCancel',\n }\n : {\n up: 'pointerup',\n down: 'pointerdown',\n over: 'pointerover',\n out: 'pointerout',\n move: 'pointermove',\n cancel: 'pointercancel',\n })\n : null)\n\n // because Webkit and Opera still use 'mousewheel' event type\n browser.wheelEvent = 'onmousewheel' in domObjects.document ? 'mousewheel' : 'wheel'\n}\n\nexport default browser\n","import * as arr from './arr'\nimport * as is from './is'\n\n// tslint:disable-next-line ban-types\nexport default function clone (source: T): Partial {\n const dest = {} as Partial\n\n for (const prop in source) {\n const value = source[prop]\n\n if (is.plainObject(value)) {\n dest[prop] = clone(value) as any\n }\n else if (is.array(value)) {\n dest[prop] = arr.from(value) as typeof value\n }\n else {\n dest[prop] = value\n }\n }\n\n return dest\n}\n","import browser from './browser'\nimport domObjects from './domObjects'\nimport * as is from './is'\nimport win, { getWindow } from './window'\n\nexport function nodeContains (parent: Node | Interact.EventTarget, child: Node | Interact.EventTarget) {\n while (child) {\n if (child === parent) {\n return true\n }\n\n child = (child as Node).parentNode\n }\n\n return false\n}\n\nexport function closest (element: Node, selector: string) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) { return element }\n\n element = parentNode(element)\n }\n\n return null\n}\n\nexport function parentNode (node: Node | Document) {\n let parent = node.parentNode\n\n if (is.docFrag(parent)) {\n // skip past #shado-root fragments\n // tslint:disable-next-line\n while ((parent = (parent as any).host) && is.docFrag(parent)) {\n continue\n }\n\n return parent\n }\n\n return parent\n}\n\nexport function matchesSelector (element: Interact.Element, selector: string) {\n // remove /deep/ from selectors if shadowDOM polyfill is used\n if (win.window !== win.realWindow) {\n selector = selector.replace(/\\/deep\\//g, ' ')\n }\n\n return element[browser.prefixedMatchesSelector](selector)\n}\n\nconst getParent = el => el.parentNode ? el.parentNode : el.host\n\n// Test for the element that's \"above\" all other qualifiers\nexport function indexOfDeepestElement (elements: Interact.Element[] | NodeListOf) {\n let deepestZoneParents = []\n let deepestZone = elements[0]\n let index = deepestZone ? 0 : -1\n let i\n let n\n\n for (i = 1; i < elements.length; i++) {\n const dropzone = elements[i]\n\n // an element might belong to multiple selector dropzones\n if (!dropzone || dropzone === deepestZone) {\n continue\n }\n\n if (!deepestZone) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // check if the deepest or current are document.documentElement or document.rootElement\n // - if the current dropzone is, do nothing and continue\n if (dropzone.parentNode === dropzone.ownerDocument) {\n continue\n }\n // - if deepest is, update with the current dropzone and continue to next\n else if (deepestZone.parentNode === dropzone.ownerDocument) {\n deepestZone = dropzone\n index = i\n continue\n }\n\n // compare zIndex of siblings\n if (dropzone.parentNode === deepestZone.parentNode) {\n const deepestZIndex = parseInt(getWindow(deepestZone).getComputedStyle(deepestZone).zIndex, 10) || 0\n const dropzoneZIndex = parseInt(getWindow(dropzone).getComputedStyle(dropzone).zIndex, 10) || 0\n\n if (dropzoneZIndex >= deepestZIndex) {\n deepestZone = dropzone\n index = i\n }\n\n continue\n }\n\n // populate the ancestry array for the latest deepest dropzone\n if (!deepestZoneParents.length) {\n let parent = deepestZone\n let parentParent\n\n while ((parentParent = getParent(parent)) && parentParent !== parent.ownerDocument) {\n deepestZoneParents.unshift(parent)\n parent = parentParent\n }\n }\n\n let parent\n\n // if this element is an svg element and the current deepest is an\n // HTMLElement\n if (deepestZone instanceof domObjects.HTMLElement &&\n dropzone instanceof domObjects.SVGElement &&\n !(dropzone instanceof domObjects.SVGSVGElement)) {\n if (dropzone === deepestZone.parentNode) {\n continue\n }\n\n parent = dropzone.ownerSVGElement\n }\n else {\n parent = dropzone\n }\n\n const dropzoneParents = []\n\n while (parent.parentNode !== parent.ownerDocument) {\n dropzoneParents.unshift(parent)\n parent = getParent(parent)\n }\n\n n = 0\n\n // get (position of last common ancestor) + 1\n while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) {\n n++\n }\n\n const parents = [\n dropzoneParents[n - 1],\n dropzoneParents[n],\n deepestZoneParents[n],\n ]\n\n let child = parents[0].lastChild\n\n while (child) {\n if (child === parents[1]) {\n deepestZone = dropzone\n index = i\n deepestZoneParents = dropzoneParents\n\n break\n }\n else if (child === parents[2]) {\n break\n }\n\n child = child.previousSibling\n }\n }\n\n return index\n}\n\nexport function matchesUpTo (element: Interact.Element, selector: string, limit: Node) {\n while (is.element(element)) {\n if (matchesSelector(element, selector)) {\n return true\n }\n\n element = parentNode(element) as Interact.Element\n\n if (element === limit) {\n return matchesSelector(element, selector)\n }\n }\n\n return false\n}\n\nexport function getActualElement (element: Interact.Element) {\n return (element instanceof domObjects.SVGElementInstance\n ? (element as SVGElement).correspondingUseElement\n : element)\n}\n\nexport function getScrollXY (relevantWindow) {\n relevantWindow = relevantWindow || win.window\n return {\n x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft,\n y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop,\n }\n}\n\nexport function getElementClientRect (element: Interact.Element) {\n const clientRect = (element instanceof domObjects.SVGElement\n ? element.getBoundingClientRect()\n : element.getClientRects()[0])\n\n return clientRect && {\n left : clientRect.left,\n right : clientRect.right,\n top : clientRect.top,\n bottom: clientRect.bottom,\n width : clientRect.width || clientRect.right - clientRect.left,\n height: clientRect.height || clientRect.bottom - clientRect.top,\n }\n}\n\nexport function getElementRect (element: Interact.Element) {\n const clientRect = getElementClientRect(element)\n\n if (!browser.isIOS7 && clientRect) {\n const scroll = getScrollXY(win.getWindow(element))\n\n clientRect.left += scroll.x\n clientRect.right += scroll.x\n clientRect.top += scroll.y\n clientRect.bottom += scroll.y\n }\n\n return clientRect\n}\n\nexport function getPath (node: Node | Document) {\n const path = []\n\n while (node) {\n path.push(node)\n node = parentNode(node)\n }\n\n return path\n}\n\nexport function trySelector (value) {\n if (!is.string(value)) { return false }\n\n // an exception will be raised if it is invalid\n domObjects.document.querySelector(value)\n return true\n}\n","export interface PointerExtend {\n webkit: RegExp\n [prefix: string]: RegExp\n}\n\nfunction pointerExtend (dest, source) {\n for (const prop in source) {\n const prefixedPropREs = pointerExtend.prefixedPropREs\n let deprecated = false\n\n // skip deprecated prefixed properties\n for (const vendor in prefixedPropREs) {\n if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) {\n deprecated = true\n break\n }\n }\n\n if (!deprecated && typeof source[prop] !== 'function') {\n dest[prop] = source[prop]\n }\n }\n return dest\n}\n\npointerExtend.prefixedPropREs = {\n webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/,\n moz: /(Pressure)$/,\n}\n\nexport default pointerExtend\n","export default (x: number, y: number) => Math.sqrt(x * x + y * y)\n","import browser from './browser'\nimport dom from './domObjects'\nimport * as domUtils from './domUtils'\nimport hypot from './hypot'\nimport * as is from './is'\nimport pointerExtend from './pointerExtend'\n\nexport function copyCoords (dest: Interact.CoordsSetMember, src: Interact.CoordsSetMember) {\n dest.page = dest.page || {} as any\n dest.page.x = src.page.x\n dest.page.y = src.page.y\n\n dest.client = dest.client || {} as any\n dest.client.x = src.client.x\n dest.client.y = src.client.y\n\n dest.timeStamp = src.timeStamp\n}\n\nexport function setCoordDeltas (targetObj: Interact.CoordsSetMember, prev: Interact.CoordsSetMember, cur: Interact.CoordsSetMember) {\n targetObj.page.x = cur.page.x - prev.page.x\n targetObj.page.y = cur.page.y - prev.page.y\n targetObj.client.x = cur.client.x - prev.client.x\n targetObj.client.y = cur.client.y - prev.client.y\n targetObj.timeStamp = cur.timeStamp - prev.timeStamp\n}\n\nexport function setCoordVelocity (targetObj: Interact.CoordsSetMember, delta: Interact.CoordsSetMember) {\n const dt = Math.max(delta.timeStamp / 1000, 0.001)\n\n targetObj.page.x = delta.page.x / dt\n targetObj.page.y = delta.page.y / dt\n targetObj.client.x = delta.client.x / dt\n targetObj.client.y = delta.client.y / dt\n targetObj.timeStamp = dt\n}\n\nexport function setZeroCoords (targetObj: Interact.CoordsSetMember) {\n targetObj.page.x = 0\n targetObj.page.y = 0\n targetObj.client.x = 0\n targetObj.client.y = 0\n}\n\nexport function isNativePointer (pointer: any) {\n return (pointer instanceof dom.Event || pointer instanceof dom.Touch)\n}\n\n// Get specified X/Y coords for mouse or event.touches[0]\nexport function getXY (type, pointer, xy) {\n xy = xy || {}\n type = type || 'page'\n\n xy.x = pointer[type + 'X']\n xy.y = pointer[type + 'Y']\n\n return xy\n}\n\nexport function getPageXY (pointer: Interact.PointerType | Interact.InteractEvent, page?: Interact.Point) {\n page = page || { x: 0, y: 0 }\n\n // Opera Mobile handles the viewport and scrolling oddly\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n getXY('screen', pointer, page)\n\n page.x += window.scrollX\n page.y += window.scrollY\n }\n else {\n getXY('page', pointer, page)\n }\n\n return page\n}\n\nexport function getClientXY (pointer, client) {\n client = client || {}\n\n if (browser.isOperaMobile && isNativePointer(pointer)) {\n // Opera Mobile handles the viewport and scrolling oddly\n getXY('screen', pointer, client)\n }\n else {\n getXY('client', pointer, client)\n }\n\n return client\n}\n\nexport function getPointerId (pointer) {\n return is.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier\n}\n\nexport function setCoords (targetObj, pointers: any[], timeStamp: number) {\n const pointer = (pointers.length > 1\n ? pointerAverage(pointers)\n : pointers[0])\n\n const tmpXY = {} as { x: number, y: number }\n\n getPageXY(pointer, tmpXY)\n targetObj.page.x = tmpXY.x\n targetObj.page.y = tmpXY.y\n\n getClientXY(pointer, tmpXY)\n targetObj.client.x = tmpXY.x\n targetObj.client.y = tmpXY.y\n\n targetObj.timeStamp = timeStamp\n}\n\nexport function getTouchPair (event) {\n const touches = []\n\n // array of touches is supplied\n if (is.array(event)) {\n touches[0] = event[0]\n touches[1] = event[1]\n }\n // an event\n else {\n if (event.type === 'touchend') {\n if (event.touches.length === 1) {\n touches[0] = event.touches[0]\n touches[1] = event.changedTouches[0]\n }\n else if (event.touches.length === 0) {\n touches[0] = event.changedTouches[0]\n touches[1] = event.changedTouches[1]\n }\n }\n else {\n touches[0] = event.touches[0]\n touches[1] = event.touches[1]\n }\n }\n\n return touches\n}\n\nexport function pointerAverage (pointers: PointerEvent[] | Event[]) {\n const average = {\n pageX : 0,\n pageY : 0,\n clientX: 0,\n clientY: 0,\n screenX: 0,\n screenY: 0,\n }\n\n for (const pointer of pointers) {\n for (const prop in average) {\n average[prop] += pointer[prop]\n }\n }\n for (const prop in average) {\n average[prop] /= pointers.length\n }\n\n return average\n}\n\nexport function touchBBox (event: Event | Array<(Interact.PointerType) | TouchEvent>) {\n if (!(event as any).length &&\n !((event as TouchEvent).touches &&\n (event as TouchEvent).touches.length > 1)) {\n return null\n }\n\n const touches = getTouchPair(event)\n const minX = Math.min(touches[0].pageX, touches[1].pageX)\n const minY = Math.min(touches[0].pageY, touches[1].pageY)\n const maxX = Math.max(touches[0].pageX, touches[1].pageX)\n const maxY = Math.max(touches[0].pageY, touches[1].pageY)\n\n return {\n x: minX,\n y: minY,\n left: minX,\n top: minY,\n right: maxX,\n bottom: maxY,\n width: maxX - minX,\n height: maxY - minY,\n }\n}\n\nexport function touchDistance (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n\n const dx = touches[0][sourceX] - touches[1][sourceX]\n const dy = touches[0][sourceY] - touches[1][sourceY]\n\n return hypot(dx, dy)\n}\n\nexport function touchAngle (event, deltaSource) {\n const sourceX = deltaSource + 'X'\n const sourceY = deltaSource + 'Y'\n const touches = getTouchPair(event)\n const dx = touches[1][sourceX] - touches[0][sourceX]\n const dy = touches[1][sourceY] - touches[0][sourceY]\n const angle = 180 * Math.atan2(dy, dx) / Math.PI\n\n return angle\n}\n\nexport function getPointerType (pointer) {\n return is.string(pointer.pointerType)\n ? pointer.pointerType\n : is.number(pointer.pointerType)\n ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType]\n // if the PointerEvent API isn't available, then the \"pointer\" must\n // be either a MouseEvent, TouchEvent, or Touch object\n : /touch/.test(pointer.type) || pointer instanceof dom.Touch\n ? 'touch'\n : 'mouse'\n}\n\n// [ event.target, event.currentTarget ]\nexport function getEventTargets (event) {\n const path = is.func(event.composedPath) ? event.composedPath() : event.path\n\n return [\n domUtils.getActualElement(path ? path[0] : event.target),\n domUtils.getActualElement(event.currentTarget),\n ]\n}\n\nexport function newCoords (): Interact.CoordsSetMember {\n return {\n page : { x: 0, y: 0 },\n client : { x: 0, y: 0 },\n timeStamp: 0,\n }\n}\n\nexport function coordsToEvent (coords: MockCoords) {\n const event = {\n coords,\n get page () { return this.coords.page },\n get client () { return this.coords.client },\n get timeStamp () { return this.coords.timeStamp },\n get pageX () { return this.coords.page.x },\n get pageY () { return this.coords.page.y },\n get clientX () { return this.coords.client.x },\n get clientY () { return this.coords.client.y },\n get pointerId () { return this.coords.pointerId },\n get target () { return this.coords.target },\n get type () { return this.coords.type },\n get pointerType () { return this.coords.pointerType },\n get buttons () { return this.coords.buttons },\n }\n\n return event as typeof event & Interact.PointerType & Interact.PointerEventType\n}\n\nexport interface MockCoords {\n page: Interact.Point\n client: Interact.Point\n timeStamp?: number\n pointerId?: any\n target?: any\n type?: string\n pointerType?: string\n buttons?: number\n}\n\nexport { pointerExtend }\n","import { contains } from './arr'\nimport * as domUtils from './domUtils'\nimport * as is from './is'\nimport pExtend from './pointerExtend'\nimport * as pointerUtils from './pointerUtils'\n\ntype Listener = (event: Event | FakeEvent) => any\n\nconst elements: EventTarget[] = []\nconst targets: Array<{\n events: { [type: string]: Listener[] }\n typeCount: number\n}> = []\n\nconst delegatedEvents: {\n [type: string]: {\n selectors: string[]\n contexts: Node[]\n listeners: Array>\n }\n} = {}\nconst documents: Document[] = []\n\nfunction add (element: EventTarget, type: string, listener: Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n let elementIndex = elements.indexOf(element)\n let target = targets[elementIndex]\n\n if (!target) {\n target = {\n events: {},\n typeCount: 0,\n }\n\n elementIndex = elements.push(element) - 1\n targets.push(target)\n }\n\n if (!target.events[type]) {\n target.events[type] = []\n target.typeCount++\n }\n\n if (element.removeEventListener && !contains(target.events[type], listener)) {\n element.addEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].push(listener)\n }\n}\n\nfunction remove (element: EventTarget, type: string, listener?: 'all' | Listener, optionalArg?: boolean | any) {\n const options = getOptions(optionalArg)\n const elementIndex = elements.indexOf(element)\n const target = targets[elementIndex]\n\n if (!target || !target.events) {\n return\n }\n\n if (type === 'all') {\n for (type in target.events) {\n if (target.events.hasOwnProperty(type)) {\n remove(element, type, 'all')\n }\n }\n return\n }\n\n if (target.events[type]) {\n const len = target.events[type].length\n\n if (listener === 'all') {\n for (let i = 0; i < len; i++) {\n remove(element, type, target.events[type][i], options)\n }\n return\n }\n else {\n for (let i = 0; i < len; i++) {\n if (element.removeEventListener && target.events[type][i] === listener) {\n element.removeEventListener(type, listener as any, events.supportsOptions ? options : !!options.capture)\n target.events[type].splice(i, 1)\n\n break\n }\n }\n }\n\n if (target.events[type] && target.events[type].length === 0) {\n (target.events[type] as any) = null\n target.typeCount--\n }\n }\n\n if (!target.typeCount) {\n targets.splice(elementIndex, 1)\n elements.splice(elementIndex, 1)\n }\n}\n\nfunction addDelegate (selector: string, context: Node, type: string, listener: Listener, optionalArg?: any) {\n const options = getOptions(optionalArg)\n if (!delegatedEvents[type]) {\n delegatedEvents[type] = {\n contexts : [],\n listeners: [],\n selectors: [],\n }\n\n // add delegate listener functions\n for (const doc of documents) {\n add(doc, type, delegateListener)\n add(doc, type, delegateUseCapture, true)\n }\n }\n\n const delegated = delegatedEvents[type]\n let index\n\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n break\n }\n }\n\n if (index === -1) {\n index = delegated.selectors.length\n\n delegated.selectors.push(selector)\n delegated.contexts.push(context)\n delegated.listeners.push([])\n }\n\n // keep listener and capture and passive flags\n delegated.listeners[index].push([listener, !!options.capture, options.passive])\n}\n\nfunction removeDelegate (\n selector: string,\n context: Document | Interact.Element,\n type: string,\n listener?: Listener,\n optionalArg?: any,\n) {\n const options = getOptions(optionalArg)\n const delegated = delegatedEvents[type]\n let matchFound = false\n let index\n\n if (!delegated) { return }\n\n // count from last index of delegated to 0\n for (index = delegated.selectors.length - 1; index >= 0; index--) {\n // look for matching selector and context Node\n if (delegated.selectors[index] === selector &&\n delegated.contexts[index] === context) {\n const listeners = delegated.listeners[index]\n\n // each item of the listeners array is an array: [function, capture, passive]\n for (let i = listeners.length - 1; i >= 0; i--) {\n const [fn, capture, passive] = listeners[i]\n\n // check if the listener functions and capture and passive flags match\n if (fn === listener && capture === !!options.capture && passive === options.passive) {\n // remove the listener from the array of listeners\n listeners.splice(i, 1)\n\n // if all listeners for this interactable have been removed\n // remove the interactable from the delegated arrays\n if (!listeners.length) {\n delegated.selectors.splice(index, 1)\n delegated.contexts.splice(index, 1)\n delegated.listeners.splice(index, 1)\n\n // remove delegate function from context\n remove(context, type, delegateListener)\n remove(context, type, delegateUseCapture, true)\n\n // remove the arrays if they are empty\n if (!delegated.selectors.length) {\n delegatedEvents[type] = null\n }\n }\n\n // only remove one listener\n matchFound = true\n break\n }\n }\n\n if (matchFound) { break }\n }\n }\n}\n\n// bound to the interactable context when a DOM event\n// listener is added to a selector interactable\nfunction delegateListener (event: Event, optionalArg?: any) {\n const options = getOptions(optionalArg)\n const fakeEvent = new FakeEvent(event)\n const delegated = delegatedEvents[event.type]\n const [eventTarget] = (pointerUtils.getEventTargets(event))\n let element: Node = eventTarget\n\n // climb up document tree looking for selector matches\n while (is.element(element)) {\n for (let i = 0; i < delegated.selectors.length; i++) {\n const selector = delegated.selectors[i]\n const context = delegated.contexts[i]\n\n if (domUtils.matchesSelector(element, selector) &&\n domUtils.nodeContains(context, eventTarget) &&\n domUtils.nodeContains(context, element)) {\n const listeners = delegated.listeners[i]\n\n fakeEvent.currentTarget = element\n\n for (const [fn, capture, passive] of listeners) {\n if (capture === !!options.capture && passive === options.passive) {\n fn(fakeEvent)\n }\n }\n }\n }\n\n element = domUtils.parentNode(element)\n }\n}\n\nfunction delegateUseCapture (event: Event) {\n return delegateListener.call(this, event, true)\n}\n\nfunction getOptions (param: object) {\n return is.object(param) ? param : { capture: param }\n}\n\nexport class FakeEvent implements Partial {\n currentTarget: EventTarget\n\n constructor (public originalEvent: Event) {\n // duplicate the event so that currentTarget can be changed\n pExtend(this, originalEvent)\n }\n\n preventOriginalDefault () {\n this.originalEvent.preventDefault()\n }\n\n stopPropagation () {\n this.originalEvent.stopPropagation()\n }\n\n stopImmediatePropagation () {\n this.originalEvent.stopImmediatePropagation()\n }\n}\n\nconst events = {\n add,\n remove,\n\n addDelegate,\n removeDelegate,\n\n delegateListener,\n delegateUseCapture,\n delegatedEvents,\n documents,\n\n supportsOptions: false,\n supportsPassive: false,\n\n _elements: elements,\n _targets: targets,\n\n init (window: Window) {\n window.document.createElement('div').addEventListener('test', null, {\n get capture () { return (events.supportsOptions = true) },\n get passive () { return (events.supportsPassive = true) },\n })\n },\n}\n\nexport default events\n","export default function extend (dest: U & Partial, source: T): T & U {\n for (const prop in source) {\n (dest as unknown as T)[prop] = source[prop]\n }\n\n const ret = dest as T & U\n\n return ret\n}\n","import extend from './extend'\nimport * as is from './is'\n\nexport interface NormalizedListeners {\n [type: string]: Interact.Listener[]\n}\n\nexport default function normalize (\n type: Interact.EventTypes,\n listeners?: Interact.ListenersArg | Interact.ListenersArg[],\n result?: NormalizedListeners,\n): NormalizedListeners {\n result = result || {}\n\n if (is.string(type) && type.search(' ') !== -1) {\n type = split(type)\n }\n\n if (is.array(type)) {\n return type.reduce(\n (acc, t) => extend(acc, normalize(t, listeners, result)),\n result,\n )\n }\n\n // ({ type: fn }) -> ('', { type: fn })\n if (is.object(type)) {\n listeners = type\n type = ''\n }\n\n if (is.func(listeners)) {\n result[type] = result[type] || []\n result[type].push(listeners)\n }\n else if (is.array(listeners)) {\n for (const l of listeners) {\n normalize(type, l, result)\n }\n }\n else if (is.object(listeners)) {\n for (const prefix in listeners) {\n const combinedTypes = split(prefix).map(p => `${type}${p}`)\n\n normalize(combinedTypes, listeners[prefix], result)\n }\n }\n\n return result as NormalizedListeners\n}\n\nfunction split (type: string) {\n return type.trim().split(/ +/)\n}\n","import * as arr from '@interactjs/utils/arr'\nimport extend from '@interactjs/utils/extend'\nimport normalize, { NormalizedListeners } from '@interactjs/utils/normalizeListeners'\n\nfunction fireUntilImmediateStopped<\n T extends Interact.ActionName,\n P extends Interact.EventPhase,\n> (event: Interact.InteractEvent, listeners: Interact.Listener[]) {\n for (const listener of listeners) {\n if (event.immediatePropagationStopped) { break }\n\n listener(event)\n }\n}\n\nclass Eventable {\n options: any\n types: NormalizedListeners = {}\n propagationStopped = false\n immediatePropagationStopped = false\n global: any\n\n constructor (options?: { [index: string]: any }) {\n this.options = extend({}, options || {})\n }\n\n fire (event: any) {\n let listeners\n const global = this.global\n\n // Interactable#on() listeners\n // tslint:disable no-conditional-assignment\n if ((listeners = this.types[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n\n // interact.on() listeners\n if (!event.propagationStopped && global && (listeners = global[event.type])) {\n fireUntilImmediateStopped(event, listeners)\n }\n }\n\n on (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n this.types[type] = arr.merge(this.types[type] || [], listeners[type])\n }\n }\n\n off (type: string, listener: Interact.ListenersArg) {\n const listeners = normalize(type, listener)\n\n for (type in listeners) {\n const eventList = this.types[type]\n\n if (!eventList || !eventList.length) { continue }\n\n for (const subListener of listeners[type]) {\n const index = eventList.indexOf(subListener)\n\n if (index !== -1) {\n eventList.splice(index, 1)\n }\n }\n }\n }\n\n getRect (_element: Interact.Element): Interact.Rect {\n return null\n }\n}\n\nexport default Eventable\n","import { closest, getElementRect, parentNode } from './domUtils'\nimport extend from './extend'\nimport * as is from './is'\n\nexport function getStringOptionResult (value: any, target: Interact.HasGetRect, element) {\n if (value === 'parent') { return parentNode(element) }\n\n if (value === 'self') { return target.getRect(element) }\n\n return closest(element, value)\n}\n\nexport function resolveRectLike (\n value: Interact.RectResolvable,\n target?: Interact.HasGetRect,\n element?: Node,\n functionArgs?: T,\n) {\n let returnValue: any = value\n if (is.string(returnValue)) {\n returnValue = getStringOptionResult(returnValue, target, element)\n }\n else if (is.func(returnValue)) {\n returnValue = returnValue(...functionArgs)\n }\n\n if (is.element(returnValue)) {\n returnValue = getElementRect(returnValue)\n }\n\n return returnValue as Interact.Rect\n}\n\nexport function rectToXY (rect) {\n return rect && {\n x: 'x' in rect ? rect.x : rect.left,\n y: 'y' in rect ? rect.y : rect.top,\n }\n}\n\nexport function xywhToTlbr (rect) {\n if (rect && !('left' in rect && 'top' in rect)) {\n rect = extend({}, rect)\n\n rect.left = rect.x || 0\n rect.top = rect.y || 0\n rect.right = rect.right || (rect.left + rect.width)\n rect.bottom = rect.bottom || (rect.top + rect.height)\n }\n\n return rect\n}\n\nexport function tlbrToXywh (rect) {\n if (rect && !('x' in rect && 'y' in rect)) {\n rect = extend({}, rect)\n\n rect.x = rect.left || 0\n rect.y = rect.top || 0\n rect.width = rect.width || (rect.right || 0 - rect.x)\n rect.height = rect.height || (rect.bottom || 0 - rect.y)\n }\n\n return rect\n}\n\nexport function addEdges (edges: Interact.EdgeOptions, rect: Interact.Rect, delta: Interact.Point) {\n if (edges.left) { rect.left += delta.x }\n if (edges.right) { rect.right += delta.x }\n if (edges.top) { rect.top += delta.y }\n if (edges.bottom) { rect.bottom += delta.y }\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n}\n","import { rectToXY, resolveRectLike } from './rect'\n\nexport default function (\n target: Interact.HasGetRect & { options: Interact.PerActionDefaults },\n element: Node,\n actionName?: Interact.ActionName,\n) {\n const actionOptions = (target.options as any)[actionName]\n const actionOrigin = actionOptions && actionOptions.origin\n const origin = actionOrigin || target.options.origin\n\n const originRect = resolveRectLike(origin, target, element, [target && element])\n\n return rectToXY(originRect) || { x: 0, y: 0 }\n}\n","let lastTime = 0\nlet request\nlet cancel\n\nfunction init (window) {\n request = window.requestAnimationFrame\n cancel = window.cancelAnimationFrame\n\n if (!request) {\n const vendors = ['ms', 'moz', 'webkit', 'o']\n\n for (const vendor of vendors) {\n request = window[`${vendor}RequestAnimationFrame`]\n cancel = window[`${vendor}CancelAnimationFrame`] || window[`${vendor}CancelRequestAnimationFrame`]\n }\n }\n\n if (!request) {\n request = callback => {\n const currTime = Date.now()\n const timeToCall = Math.max(0, 16 - (currTime - lastTime))\n // eslint-disable-next-line standard/no-callback-literal\n const token = setTimeout(() => { callback(currTime + timeToCall) },\n timeToCall)\n\n lastTime = currTime + timeToCall\n return token\n }\n\n cancel = token => clearTimeout(token)\n }\n}\n\nexport default {\n request: callback => request(callback),\n cancel: token => cancel(token),\n init,\n}\n","import * as arr from './arr'\nimport * as dom from './domUtils'\nimport * as is from './is'\nimport * as pointer from './pointerUtils'\nimport * as rect from './rect'\nimport win from './window'\n\nexport function warnOnce (this: T, method: (...args: any[]) => any, message: string) {\n let warned = false\n\n // eslint-disable-next-line no-shadow\n return function (this: T) {\n if (!warned) {\n (win as any).window.console.warn(message)\n warned = true\n }\n\n return method.apply(this, arguments)\n }\n}\n\nexport function copyAction (dest: Interact.ActionProps, src: Interact.ActionProps) {\n dest.name = src.name\n dest.axis = src.axis\n dest.edges = src.edges\n\n return dest\n}\n\nexport { default as browser } from './browser'\nexport { default as clone } from './clone'\nexport { default as events } from './events'\nexport { default as extend } from './extend'\nexport { default as getOriginXY } from './getOriginXY'\nexport { default as hypot } from './hypot'\nexport { default as normalizeListeners } from './normalizeListeners'\nexport { default as raf } from './raf'\nexport { win, arr, dom, is, pointer, rect }\n","// tslint:disable no-empty-interface\n\nexport interface Defaults {\n base: BaseDefaults\n perAction: PerActionDefaults\n actions: ActionDefaults\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface ActionDefaults {\n}\n\nexport interface BaseDefaults {\n preventDefault?: 'auto' | 'never' | string\n deltaSource?: 'page' | 'client'\n context?: Interact.EventTarget\n}\n\nexport interface PerActionDefaults {\n enabled?: boolean\n origin?: Interact.Point | string | Interact.Element\n listeners?: Interact.Listeners\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n}\n\nexport type Options = Partial & Partial & {\n [P in keyof ActionDefaults]?: Partial\n}\n\n// export interface Options extends BaseDefaults, PerActionDefaults {}\n\nexport interface OptionsArg extends BaseDefaults, Interact.OrBoolean> {}\n\nexport const defaults: Defaults = {\n base: {\n preventDefault: 'auto',\n deltaSource: 'page',\n },\n\n perAction: {\n enabled: false,\n origin: { x: 0, y: 0 },\n },\n\n actions: {} as ActionDefaults,\n}\n\nexport default defaults\n","import * as arr from '@interactjs/utils/arr'\nimport * as domUtils from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactable:new': {\n interactable: Interact.Interactable\n target: Interact.Target\n options: Interact.OptionsArg\n win: Window\n }\n }\n}\n\ninterface InteractableScopeProp {\n context: Document | Interact.Element\n interactable: Interact.Interactable\n}\n\nexport default class InteractableSet {\n // all set interactables\n list: Interact.Interactable[] = []\n\n selectorMap: {\n [selector: string]: InteractableScopeProp[]\n } = {}\n\n constructor (protected scope: Interact.Scope) {\n scope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n const { target, _context: context } = interactable\n const targetMappings: InteractableScopeProp[] = is.string(target)\n ? this.selectorMap[target]\n : (target as any)[this.scope.id]\n\n const targetIndex = targetMappings.findIndex(m => m.context === context)\n if (targetMappings[targetIndex]) {\n // Destroying mappingInfo's context and interactable\n targetMappings[targetIndex].context = null\n targetMappings[targetIndex].interactable = null\n }\n targetMappings.splice(targetIndex, 1)\n },\n })\n }\n\n new (target: Interact.Target, options?: any): Interact.Interactable {\n options = extend(options || {}, {\n actions: this.scope.actions,\n })\n const interactable = new this.scope.Interactable(target, options, this.scope.document)\n const mappingInfo = { context: interactable._context, interactable }\n\n this.scope.addDocument(interactable._doc)\n this.list.push(interactable)\n\n if (is.string(target)) {\n if (!this.selectorMap[target]) { this.selectorMap[target] = [] }\n this.selectorMap[target].push(mappingInfo)\n } else {\n if (!((interactable.target as any)[this.scope.id])) {\n Object.defineProperty(target, this.scope.id, {\n value: [],\n configurable: true,\n })\n }\n\n (target as any)[this.scope.id].push(mappingInfo)\n }\n\n this.scope.fire('interactable:new', {\n target,\n options,\n interactable,\n win: this.scope._win,\n })\n\n return interactable\n }\n\n get (target: Interact.Target, options?: Interact.Options) {\n const context = (options && options.context) || this.scope.document\n const isSelector = is.string(target)\n const targetMappings: InteractableScopeProp[] = isSelector\n ? this.selectorMap[target as string]\n : (target as any)[this.scope.id]\n\n if (!targetMappings) { return null }\n\n const found = arr.find(\n targetMappings,\n m => m.context === context &&\n (isSelector || m.interactable.inContext(target as any)))\n\n return found && found.interactable\n }\n\n forEachMatch (node: Node, callback: (interactable: Interact.Interactable) => T): T | void {\n for (const interactable of this.list) {\n let ret\n\n if ((is.string(interactable.target)\n // target is a selector and the element matches\n ? (is.element(node) && domUtils.matchesSelector(node, interactable.target))\n // target is the element\n : node === interactable.target) &&\n // the element is in context\n (interactable.inContext(node))) {\n ret = callback(interactable)\n }\n\n if (ret !== undefined) {\n return ret\n }\n }\n }\n}\n","import Interactable from './Interactable'\n\nexport class BaseEvent {\n type: string\n target: EventTarget\n currentTarget: EventTarget\n interactable: Interactable\n _interaction: Interact.Interaction\n timeStamp: any\n immediatePropagationStopped = false\n propagationStopped = false\n\n get interaction () {\n return this._interaction._proxy\n }\n\n constructor (interaction: Interact.Interaction) {\n this._interaction = interaction\n }\n\n preventDefault () {}\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n}\n\nexport default BaseEvent\n","import extend from '@interactjs/utils/extend'\nimport getOriginXY from '@interactjs/utils/getOriginXY'\nimport hypot from '@interactjs/utils/hypot'\nimport BaseEvent from './BaseEvent'\nimport defaults from './defaultOptions'\nimport Interaction from './Interaction'\n\nexport type EventPhase = keyof PhaseMap\n\nexport interface PhaseMap {\n start: true\n move: true\n end: true\n}\n\nexport class InteractEvent<\n T extends Interact.ActionName = never,\n P extends EventPhase = EventPhase,\n> extends BaseEvent {\n target: Interact.Element\n currentTarget: Interact.Element\n relatedTarget: null = null\n screenX?: number\n screenY?: number\n button: number\n buttons: number\n ctrlKey: boolean\n shiftKey: boolean\n altKey: boolean\n metaKey: boolean\n page: Interact.Point\n client: Interact.Point\n delta: Interact.Point\n rect: Interact.FullRect\n x0: number\n y0: number\n t0: number\n dt: number\n duration: number\n clientX0: number\n clientY0: number\n velocity: Interact.Point\n speed: number\n swipe: ReturnType['getSwipe']>\n timeStamp: any\n // drag\n dragEnter?: Interact.Element\n dragLeave?: Interact.Element\n // resize\n axes?: 'x' | 'y' | 'xy'\n preEnd?: boolean\n\n /** */\n constructor (\n interaction: Interaction,\n event: Interact.PointerEventType,\n actionName: T,\n phase: P,\n element: Interact.Element,\n preEnd?: boolean,\n type?: string,\n ) {\n super(interaction)\n\n element = element || interaction.element\n\n const target = interaction.interactable\n const deltaSource = (((target && target.options) || defaults) as any).deltaSource as 'page' | 'client'\n const origin = getOriginXY(target, element, actionName)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const prevEvent = starting ? this : interaction.prevEvent\n const coords = starting\n ? interaction.coords.start\n : ending\n ? { page: prevEvent.page, client: prevEvent.client, timeStamp: interaction.coords.cur.timeStamp }\n : interaction.coords.cur\n\n this.page = extend({}, coords.page)\n this.client = extend({}, coords.client)\n this.rect = extend({}, interaction.rect)\n this.timeStamp = coords.timeStamp\n\n if (!ending) {\n this.page.x -= origin.x\n this.page.y -= origin.y\n\n this.client.x -= origin.x\n this.client.y -= origin.y\n }\n\n this.ctrlKey = event.ctrlKey\n this.altKey = event.altKey\n this.shiftKey = event.shiftKey\n this.metaKey = event.metaKey\n this.button = (event as MouseEvent).button\n this.buttons = (event as MouseEvent).buttons\n this.target = element\n this.currentTarget = element\n this.preEnd = preEnd\n this.type = type || (actionName + (phase || ''))\n this.interactable = target\n\n this.t0 = starting\n ? interaction.pointers[interaction.pointers.length - 1].downTime\n : prevEvent.t0\n\n this.x0 = interaction.coords.start.page.x - origin.x\n this.y0 = interaction.coords.start.page.y - origin.y\n this.clientX0 = interaction.coords.start.client.x - origin.x\n this.clientY0 = interaction.coords.start.client.y - origin.y\n\n if (starting || ending) {\n this.delta = { x: 0, y: 0 }\n }\n else {\n this.delta = {\n x: this[deltaSource].x - prevEvent[deltaSource].x,\n y: this[deltaSource].y - prevEvent[deltaSource].y,\n }\n }\n\n this.dt = interaction.coords.delta.timeStamp\n this.duration = this.timeStamp - this.t0\n\n // velocity and speed in pixels per second\n this.velocity = extend({}, interaction.coords.velocity[deltaSource])\n this.speed = hypot(this.velocity.x, this.velocity.y)\n\n this.swipe = (ending || phase === 'inertiastart') ? this.getSwipe() : null\n }\n\n get pageX () { return this.page.x }\n set pageX (value) { this.page.x = value }\n get pageY () { return this.page.y }\n set pageY (value) { this.page.y = value }\n\n get clientX () { return this.client.x }\n set clientX (value) { this.client.x = value }\n get clientY () { return this.client.y }\n set clientY (value) { this.client.y = value }\n\n get dx () { return this.delta.x }\n set dx (value) { this.delta.x = value }\n get dy () { return this.delta.y }\n set dy (value) { this.delta.y = value }\n\n get velocityX () { return this.velocity.x }\n set velocityX (value) { this.velocity.x = value }\n get velocityY () { return this.velocity.y }\n set velocityY (value) { this.velocity.y = value }\n\n getSwipe () {\n const interaction = this._interaction\n\n if (interaction.prevEvent.speed < 600 ||\n this.timeStamp - interaction.prevEvent.timeStamp > 150) {\n return null\n }\n\n let angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI\n const overlap = 22.5\n\n if (angle < 0) {\n angle += 360\n }\n\n const left = 135 - overlap <= angle && angle < 225 + overlap\n const up = 225 - overlap <= angle && angle < 315 + overlap\n\n const right = !left && (315 - overlap <= angle || angle < 45 + overlap)\n const down = !up && 45 - overlap <= angle && angle < 135 + overlap\n\n return {\n up,\n down,\n left,\n right,\n angle,\n speed: interaction.prevEvent.speed,\n velocity: {\n x: interaction.prevEvent.velocityX,\n y: interaction.prevEvent.velocityY,\n },\n }\n }\n\n preventDefault () {}\n\n /**\n * Don't call listeners on the remaining targets\n */\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n\n /**\n * Don't call any other listeners (even on the current target)\n */\n stopPropagation () {\n this.propagationStopped = true\n }\n}\n\nexport default InteractEvent\n","/* eslint-disable @typescript-eslint/no-parameter-properties */\nexport class PointerInfo {\n constructor (\n public id: number,\n public pointer: Interact.PointerType,\n public event: Interact.PointerEventType,\n public downTime: number,\n public downTarget: Interact.EventTarget,\n ) {}\n}\n\nexport default PointerInfo\n","import * as utils from '@interactjs/utils/index'\nimport Interactable from './Interactable'\nimport InteractEvent, { EventPhase } from './InteractEvent'\nimport PointerInfo from './PointerInfo'\nimport { ActionName } from './scope'\n\nexport interface ActionProps {\n name: T\n axis?: 'x' | 'y' | 'xy'\n edges?: Interact.EdgeOptions\n}\n\nexport interface StartAction extends ActionProps {\n name: ActionName\n}\n\nexport enum _ProxyValues {\n interactable = '',\n element = '',\n prepared = '',\n pointerIsDown = '',\n pointerWasMoved = '',\n _proxy = ''\n}\n\nexport enum _ProxyMethods {\n start = '',\n move = '',\n end = '',\n stop = '',\n interacting = ''\n}\n\nexport type PointerArgProps = {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Interact.EventTarget\n pointerIndex: number\n pointerInfo: PointerInfo\n interaction: Interaction\n} & T\n\nexport interface DoPhaseArg {\n event: Interact.PointerEventType\n phase: EventPhase\n interaction: Interaction\n iEvent: InteractEvent\n preEnd?: boolean\n type?: string\n}\n\nexport type DoAnyPhaseArg = DoPhaseArg\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:new': { interaction: Interaction }\n 'interactions:down': PointerArgProps<{\n type: 'down'\n }>\n 'interactions:move': PointerArgProps<{\n type: 'move'\n dx: number\n dy: number\n duplicate: boolean\n }>\n 'interactions:up': PointerArgProps<{\n type: 'up'\n curEventTarget: EventTarget\n }>\n 'interactions:cancel': SignalArgs['interactions:up'] & {\n type: 'cancel'\n curEventTarget: EventTarget\n }\n 'interactions:update-pointer': PointerArgProps<{\n down: boolean\n }>\n 'interactions:remove-pointer': PointerArgProps\n 'interactions:blur'\n 'interactions:before-action-start': Omit\n 'interactions:action-start': DoAnyPhaseArg\n 'interactions:after-action-start': DoAnyPhaseArg\n 'interactions:before-action-move': Omit\n 'interactions:action-move': DoAnyPhaseArg\n 'interactions:after-action-move': DoAnyPhaseArg\n 'interactions:before-action-end': Omit\n 'interactions:action-end': DoAnyPhaseArg\n 'interactions:after-action-end': DoAnyPhaseArg\n 'interactions:stop': { interaction: Interaction }\n }\n}\n\nexport type _InteractionProxy = Pick<\nInteraction,\nkeyof typeof _ProxyValues | keyof typeof _ProxyMethods\n>\n\nlet idCounter = 0\n\nexport class Interaction {\n // current interactable being interacted with\n interactable: Interactable = null\n\n // the target element of the interactable\n element: Interact.Element = null\n rect: Interact.FullRect\n _rects?: {\n start: Interact.FullRect\n corrected: Interact.FullRect\n previous: Interact.FullRect\n delta: Interact.FullRect\n }\n edges: Interact.EdgeOptions\n\n _scopeFire: Interact.Scope['fire']\n\n // action that's ready to be fired on next move event\n prepared: ActionProps = {\n name : null,\n axis : null,\n edges: null,\n }\n\n pointerType: string\n\n // keep track of added pointers\n pointers: PointerInfo[] = []\n\n // pointerdown/mousedown/touchstart event\n downEvent: Interact.PointerEventType = null\n\n downPointer: Interact.PointerType = {} as Interact.PointerType\n\n _latestPointer: {\n pointer: Interact.PointerType\n event: Interact.PointerEventType\n eventTarget: Node\n } = {\n pointer: null,\n event: null,\n eventTarget: null,\n }\n\n // previous action event\n prevEvent: InteractEvent = null\n\n pointerIsDown = false\n pointerWasMoved = false\n _interacting = false\n _ending = false\n _stopped = true\n _proxy: _InteractionProxy = null\n\n simulation = null\n\n get pointerMoveTolerance () {\n return 1\n }\n\n /**\n * @alias Interaction.prototype.move\n */\n doMove = utils.warnOnce(\n function (this: Interaction, signalArg: any) {\n this.move(signalArg)\n },\n 'The interaction.doMove() method has been renamed to interaction.move()')\n\n coords: Interact.CoordsSet = {\n // Starting InteractEvent pointer coordinates\n start: utils.pointer.newCoords(),\n // Previous native pointer move event coordinates\n prev: utils.pointer.newCoords(),\n // current native pointer move event coordinates\n cur: utils.pointer.newCoords(),\n // Change in coordinates and time of the pointer\n delta: utils.pointer.newCoords(),\n // pointer velocity\n velocity: utils.pointer.newCoords(),\n }\n\n readonly _id: number = idCounter++\n\n /** */\n constructor ({ pointerType, scopeFire }: {\n pointerType?: string\n scopeFire: Interact.Scope['fire']\n }) {\n this._scopeFire = scopeFire\n this.pointerType = pointerType\n\n const that = this\n\n this._proxy = {} as _InteractionProxy\n\n for (const key in _ProxyValues) {\n Object.defineProperty(this._proxy, key, {\n get () { return that[key] },\n })\n }\n\n for (const key in _ProxyMethods) {\n Object.defineProperty(this._proxy, key, {\n value: (...args) => that[key](...args),\n })\n }\n\n this._scopeFire('interactions:new', { interaction: this })\n }\n\n pointerDown (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n const pointerIndex = this.updatePointer(pointer, event, eventTarget, true)\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:down', {\n pointer,\n event,\n eventTarget,\n pointerIndex,\n pointerInfo,\n type: 'down',\n interaction: this,\n })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable({\n * // disable the default drag start by down->move\n * manualStart: true\n * })\n * // start dragging after the user holds the pointer down\n * .on('hold', function (event) {\n * var interaction = event.interaction\n *\n * if (!interaction.interacting()) {\n * interaction.start({ name: 'drag' },\n * event.interactable,\n * event.currentTarget)\n * }\n * })\n * ```\n *\n * Start an action with the given Interactable and Element as tartgets. The\n * action must be enabled for the target Interactable and an appropriate\n * number of pointers must be held down - 1 for drag/resize, 2 for gesture.\n *\n * Use it with `interactable.able({ manualStart: false })` to always\n * [start actions manually](https://github.com/taye/interact.js/issues/114)\n *\n * @param {object} action The action to be performed - drag, resize, etc.\n * @param {Interactable} target The Interactable to target\n * @param {Element} element The DOM Element to target\n * @return {object} interact\n */\n start (action: StartAction, interactable: Interactable, element: Interact.Element) {\n if (this.interacting() ||\n !this.pointerIsDown ||\n this.pointers.length < (action.name === 'gesture' ? 2 : 1) ||\n !interactable.options[action.name].enabled) {\n return false\n }\n\n utils.copyAction(this.prepared, action)\n\n this.interactable = interactable\n this.element = element\n this.rect = interactable.getRect(element)\n this.edges = this.prepared.edges\n ? utils.extend({}, this.prepared.edges)\n : { left: true, right: true, top: true, bottom: true }\n this._stopped = false\n this._interacting = this._doPhase({\n interaction: this,\n event: this.downEvent,\n phase: 'start',\n }) && !this._stopped\n\n return this._interacting\n }\n\n pointerMove (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget) {\n if (!this.simulation && !(this.modification && this.modification.endResult)) {\n this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const duplicateMove = (this.coords.cur.page.x === this.coords.prev.page.x &&\n this.coords.cur.page.y === this.coords.prev.page.y &&\n this.coords.cur.client.x === this.coords.prev.client.x &&\n this.coords.cur.client.y === this.coords.prev.client.y)\n\n let dx\n let dy\n\n // register movement greater than pointerMoveTolerance\n if (this.pointerIsDown && !this.pointerWasMoved) {\n dx = this.coords.cur.client.x - this.coords.start.client.x\n dy = this.coords.cur.client.y - this.coords.start.client.y\n\n this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance\n }\n\n const pointerIndex = this.getPointerIndex(pointer)\n const signalArg = {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n type: 'move' as const,\n eventTarget,\n dx,\n dy,\n duplicate: duplicateMove,\n interaction: this,\n }\n\n if (!duplicateMove) {\n // set pointer coordinate, time changes and velocity\n utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta)\n }\n\n this._scopeFire('interactions:move', signalArg)\n\n if (!duplicateMove && !this.simulation) {\n // if interacting, fire an 'action-move' signal etc\n if (this.interacting()) {\n signalArg.type = null\n this.move(signalArg)\n }\n\n if (this.pointerWasMoved) {\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n }\n }\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('dragmove', function (event) {\n * if (someCondition) {\n * // change the snap settings\n * event.interactable.draggable({ snap: { targets: [] }})\n * // fire another move event with re-calculated snap\n * event.interaction.move()\n * }\n * })\n * ```\n *\n * Force a move of the current action at the same coordinates. Useful if\n * snap/restrict has been changed and you want a movement with the new\n * settings.\n */\n move (signalArg?) {\n if (!signalArg || !signalArg.event) {\n utils.pointer.setZeroCoords(this.coords.delta)\n }\n\n signalArg = utils.extend({\n pointer: this._latestPointer.pointer,\n event: this._latestPointer.event,\n eventTarget: this._latestPointer.eventTarget,\n interaction: this,\n }, signalArg || {})\n\n signalArg.phase = 'move'\n\n this._doPhase(signalArg)\n }\n\n // End interact move events and stop auto-scroll unless simulation is running\n pointerUp (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, curEventTarget: Interact.EventTarget) {\n let pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) {\n pointerIndex = this.updatePointer(pointer, event, eventTarget, false)\n }\n\n const type = /cancel$/i.test(event.type) ? 'cancel' : 'up'\n\n this._scopeFire(`interactions:${type}` as 'interactions:up' | 'interactions:cancel', {\n pointer,\n pointerIndex,\n pointerInfo: this.pointers[pointerIndex],\n event,\n eventTarget,\n type: type as any,\n curEventTarget,\n interaction: this,\n })\n\n if (!this.simulation) {\n this.end(event)\n }\n\n this.pointerIsDown = false\n this.removePointer(pointer, event)\n }\n\n documentBlur (event) {\n this.end(event)\n this._scopeFire('interactions:blur', { event, type: 'blur', interaction: this })\n }\n\n /**\n * ```js\n * interact(target)\n * .draggable(true)\n * .on('move', function (event) {\n * if (event.pageX > 1000) {\n * // end the current action\n * event.interaction.end()\n * // stop all further listeners from being called\n * event.stopImmediatePropagation()\n * }\n * })\n * ```\n *\n * @param {PointerEvent} [event]\n */\n end (event?: Interact.PointerEventType) {\n this._ending = true\n event = event || this._latestPointer.event\n let endPhaseResult\n\n if (this.interacting()) {\n endPhaseResult = this._doPhase({\n event,\n interaction: this,\n phase: 'end',\n })\n }\n\n this._ending = false\n\n if (endPhaseResult === true) {\n this.stop()\n }\n }\n\n currentAction () {\n return this._interacting ? this.prepared.name : null\n }\n\n interacting () {\n return this._interacting\n }\n\n /** */\n stop () {\n this._scopeFire('interactions:stop', { interaction: this })\n\n this.interactable = this.element = null\n\n this._interacting = false\n this._stopped = true\n this.prepared.name = this.prevEvent = null\n }\n\n getPointerIndex (pointer) {\n const pointerId = utils.pointer.getPointerId(pointer)\n\n // mouse and pen interactions may have only one pointer\n return (this.pointerType === 'mouse' || this.pointerType === 'pen')\n ? this.pointers.length - 1\n : utils.arr.findIndex(this.pointers, curPointer => curPointer.id === pointerId)\n }\n\n getPointerInfo (pointer) {\n return this.pointers[this.getPointerIndex(pointer)]\n }\n\n updatePointer (pointer: Interact.PointerType, event: Interact.PointerEventType, eventTarget: Interact.EventTarget, down?: boolean) {\n const id = utils.pointer.getPointerId(pointer)\n let pointerIndex = this.getPointerIndex(pointer)\n let pointerInfo = this.pointers[pointerIndex]\n\n down = down === false\n ? false\n : down || /(down|start)$/i.test(event.type)\n\n if (!pointerInfo) {\n pointerInfo = new PointerInfo(\n id,\n pointer,\n event,\n null,\n null,\n )\n\n pointerIndex = this.pointers.length\n this.pointers.push(pointerInfo)\n }\n else {\n pointerInfo.pointer = pointer\n }\n\n utils.pointer.setCoords(this.coords.cur, this.pointers.map(p => p.pointer), this._now())\n utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur)\n\n if (down) {\n this.pointerIsDown = true\n\n pointerInfo.downTime = this.coords.cur.timeStamp\n pointerInfo.downTarget = eventTarget\n utils.pointer.pointerExtend(this.downPointer, pointer)\n\n if (!this.interacting()) {\n utils.pointer.copyCoords(this.coords.start, this.coords.cur)\n utils.pointer.copyCoords(this.coords.prev, this.coords.cur)\n\n this.downEvent = event\n this.pointerWasMoved = false\n }\n }\n\n this._updateLatestPointer(pointer, event, eventTarget)\n\n this._scopeFire('interactions:update-pointer', {\n pointer,\n event,\n eventTarget,\n down,\n pointerInfo,\n pointerIndex,\n interaction: this,\n })\n\n return pointerIndex\n }\n\n removePointer (pointer: Interact.PointerType, event: Interact.PointerEventType) {\n const pointerIndex = this.getPointerIndex(pointer)\n\n if (pointerIndex === -1) { return }\n\n const pointerInfo = this.pointers[pointerIndex]\n\n this._scopeFire('interactions:remove-pointer', {\n pointer,\n event,\n eventTarget: null,\n pointerIndex,\n pointerInfo,\n interaction: this,\n })\n\n this.pointers.splice(pointerIndex, 1)\n }\n\n _updateLatestPointer (pointer, event, eventTarget) {\n this._latestPointer.pointer = pointer\n this._latestPointer.event = event\n this._latestPointer.eventTarget = eventTarget\n }\n\n destroy () {\n this._latestPointer.pointer = null\n this._latestPointer.event = null\n this._latestPointer.eventTarget = null\n }\n\n _createPreparedEvent

(event: Interact.PointerEventType, phase: P, preEnd?: boolean, type?: string) {\n return new InteractEvent(this, event, this.prepared.name, phase, this.element, preEnd, type)\n }\n\n _fireEvent

(iEvent: InteractEvent) {\n this.interactable.fire(iEvent)\n\n if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {\n this.prevEvent = iEvent\n }\n }\n\n _doPhase

(signalArg: Omit, 'iEvent'> & { iEvent?: InteractEvent }) {\n const { event, phase, preEnd, type } = signalArg\n const { rect } = this\n\n if (rect && phase === 'move') {\n // update the rect changes due to pointer move\n utils.rect.addEdges(this.edges, rect, this.coords.delta[this.interactable.options.deltaSource])\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n const beforeResult = this._scopeFire(`interactions:before-action-${phase}` as any, signalArg)\n\n if (beforeResult === false) {\n return false\n }\n\n const iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type)\n\n this._scopeFire(`interactions:action-${phase}` as any, signalArg)\n\n if (phase === 'start') { this.prevEvent = iEvent }\n\n this._fireEvent(iEvent)\n\n this._scopeFire(`interactions:after-action-${phase}` as any, signalArg)\n\n return true\n }\n\n _now () { return Date.now() }\n}\n\nexport default Interaction\nexport { PointerInfo }\n","import * as dom from '@interactjs/utils/domUtils'\n\nexport interface SearchDetails {\n pointer: Interact.PointerType\n pointerId: number\n pointerType: string\n eventType: string\n eventTarget: Interact.EventTarget\n curEventTarget: Interact.EventTarget\n scope: Interact.Scope\n}\n\nconst finder = {\n methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'] as const,\n\n search (details: SearchDetails) {\n for (const method of finder.methodOrder) {\n const interaction = finder[method](details)\n\n if (interaction) {\n return interaction\n }\n }\n\n return null\n },\n\n // try to resume simulation with a new pointer\n simulationResume ({ pointerType, eventType, eventTarget, scope }: SearchDetails) {\n if (!/down|start/i.test(eventType)) {\n return null\n }\n\n for (const interaction of scope.interactions.list) {\n let element = eventTarget as Node\n\n if (interaction.simulation && interaction.simulation.allowResume &&\n (interaction.pointerType === pointerType)) {\n while (element) {\n // if the element is the interaction element\n if (element === interaction.element) {\n return interaction\n }\n element = dom.parentNode(element)\n }\n }\n }\n\n return null\n },\n\n // if it's a mouse or pen interaction\n mouseOrPen ({ pointerId, pointerType, eventType, scope }: SearchDetails) {\n if (pointerType !== 'mouse' && pointerType !== 'pen') {\n return null\n }\n\n let firstNonActive\n\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType) {\n // if it's a down event, skip interactions with running simulations\n if (interaction.simulation && !hasPointerId(interaction, pointerId)) { continue }\n\n // if the interaction is active, return it immediately\n if (interaction.interacting()) {\n return interaction\n }\n // otherwise save it and look for another active interaction\n else if (!firstNonActive) {\n firstNonActive = interaction\n }\n }\n }\n\n // if no active mouse interaction was found use the first inactive mouse\n // interaction\n if (firstNonActive) {\n return firstNonActive\n }\n\n // find any mouse or pen interaction.\n // ignore the interaction if the eventType is a *down, and a simulation\n // is active\n for (const interaction of scope.interactions.list) {\n if (interaction.pointerType === pointerType && !(/down/i.test(eventType) && interaction.simulation)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get interaction that has this pointer\n hasPointer ({ pointerId, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n if (hasPointerId(interaction, pointerId)) {\n return interaction\n }\n }\n\n return null\n },\n\n // get first idle interaction with a matching pointerType\n idle ({ pointerType, scope }: SearchDetails) {\n for (const interaction of scope.interactions.list) {\n // if there's already a pointer held down\n if (interaction.pointers.length === 1) {\n const target = interaction.interactable\n // don't add this pointer if there is a target interactable and it\n // isn't gesturable\n if (target && !(target.options.gesture && target.options.gesture.enabled)) {\n continue\n }\n }\n // maximum of 2 pointers per interaction\n else if (interaction.pointers.length >= 2) {\n continue\n }\n\n if (!interaction.interacting() && (pointerType === interaction.pointerType)) {\n return interaction\n }\n }\n\n return null\n },\n}\n\nfunction hasPointerId (interaction: Interact.Interaction, pointerId: number) {\n return interaction.pointers.some(({ id }) => id === pointerId)\n}\n\nexport default finder\n","import BaseEvent from '@interactjs/core/BaseEvent'\nimport Interactable from '@interactjs/core/Interactable'\nimport InteractEvent from '@interactjs/core/InteractEvent'\nimport * as arr from '@interactjs/utils/arr'\n\nclass DropEvent extends BaseEvent {\n target: Interact.Element\n dropzone: Interactable\n dragEvent: InteractEvent<'drag'>\n relatedTarget: Interact.Element\n draggable: Interactable\n timeStamp: number\n propagationStopped = false\n immediatePropagationStopped = false\n\n /**\n * Class of events fired on dropzones during drags with acceptable targets.\n */\n constructor (dropState: import('./').DropState, dragEvent: InteractEvent<'drag'>, type: string) {\n super(dragEvent._interaction)\n\n const { element, dropzone } = type === 'dragleave'\n ? dropState.prev\n : dropState.cur\n\n this.type = type\n this.target = element\n this.currentTarget = element\n this.dropzone = dropzone\n this.dragEvent = dragEvent\n this.relatedTarget = dragEvent.target\n this.draggable = dragEvent.interactable\n this.timeStamp = dragEvent.timeStamp\n }\n\n /**\n * If this is a `dropactivate` event, the dropzone element will be\n * deactivated.\n *\n * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the\n * dropzone element and more.\n */\n reject () {\n const { dropState } = this._interaction\n\n if (\n (this.type !== 'dropactivate') && (\n !this.dropzone ||\n dropState.cur.dropzone !== this.dropzone ||\n dropState.cur.element !== this.target)) {\n return\n }\n\n dropState.prev.dropzone = this.dropzone\n dropState.prev.element = this.target\n\n dropState.rejected = true\n dropState.events.enter = null\n\n this.stopImmediatePropagation()\n\n if (this.type === 'dropactivate') {\n const activeDrops = dropState.activeDrops\n const index = arr.findIndex(activeDrops, ({ dropzone, element }) =>\n dropzone === this.dropzone && element === this.target)\n\n dropState.activeDrops.splice(index, 1)\n\n const deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate')\n\n deactivateEvent.dropzone = this.dropzone\n deactivateEvent.target = this.target\n\n this.dropzone.fire(deactivateEvent)\n }\n else {\n this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave'))\n }\n }\n\n preventDefault () {}\n\n stopPropagation () {\n this.propagationStopped = true\n }\n\n stopImmediatePropagation () {\n this.immediatePropagationStopped = this.propagationStopped = true\n }\n}\n\nexport default DropEvent\n","import Interactable from '@interactjs/core/Interactable'\nimport InteractEvent from '@interactjs/core/InteractEvent'\nimport { Scope } from '@interactjs/core/scope'\nimport * as utils from '@interactjs/utils/index'\nimport drag from '../drag'\nimport DropEvent from './DropEvent'\n\nexport interface DropzoneMethod {\n (options: Interact.DropzoneOptions | boolean): Interact.Interactable\n (): Interact.DropzoneOptions\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n dropzone: DropzoneMethod\n dropCheck: (\n dragEvent: InteractEvent,\n event: Interact.PointerEventType,\n draggable: Interactable,\n draggableElement: Interact.Element,\n dropElemen: Interact.Element,\n rect: any\n ) => boolean\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n dropState?: DropState\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n drop: Interact.DropzoneOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n drop?: typeof drop\n }\n\n interface Scope {\n dynamicDrop?: boolean\n }\n\n interface SignalArgs {\n 'actions/drop:start': DropSignalArg\n 'actions/drop:move': DropSignalArg\n 'actions/drop:end': DropSignalArg\n }\n}\n\ninterface DropSignalArg {\n interaction: Interact.Interaction\n dragEvent: Interact.DragEvent\n}\n\nexport interface DropState {\n cur: {\n dropzone: Interactable // the dropzone a drag target might be dropped into\n element: Interact.Element // the element at the time of checking\n }\n prev: {\n dropzone: Interactable // the dropzone that was recently dragged away from\n element: Interact.Element // the element at the time of checking\n }\n rejected: boolean // wheather the potential drop was rejected from a listener\n events: any // the drop events related to the current drag event\n activeDrops: Array<{\n dropzone: Interactable\n element: Interact.Element\n rect: Interact.Rect\n }>\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n /** @lends module:interact */\n interact,\n /** @lends Interactable */\n Interactable, // eslint-disable-line no-shadow\n defaults,\n } = scope\n\n scope.usePlugin(drag)\n\n /**\n *\n * ```js\n * interact('.drop').dropzone({\n * accept: '.can-drop' || document.getElementById('single-drop'),\n * overlap: 'pointer' || 'center' || zeroToOne\n * }\n * ```\n *\n * Returns or sets whether draggables can be dropped onto this target to\n * trigger drop events\n *\n * Dropzones can receive the following events:\n * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends\n * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone\n * - `dragmove` when a draggable that has entered the dropzone is moved\n * - `drop` when a draggable is dropped into this dropzone\n *\n * Use the `accept` option to allow only elements that match the given CSS\n * selector or element. The value can be:\n *\n * - **an Element** - only that element can be dropped into this dropzone.\n * - **a string**, - the element being dragged must match it as a CSS selector.\n * - **`null`** - accept options is cleared - it accepts any element.\n *\n * Use the `overlap` option to set how drops are checked for. The allowed\n * values are:\n *\n * - `'pointer'`, the pointer must be over the dropzone (default)\n * - `'center'`, the draggable element's center must be over the dropzone\n * - a number from 0-1 which is the `(intersection area) / (draggable area)`.\n * e.g. `0.5` for drop to happen when half of the area of the draggable is\n * over the dropzone\n *\n * Use the `checker` option to specify a function to check if a dragged element\n * is over this Interactable.\n *\n * @param {boolean | object | null} [options] The new options to be set.\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.dropzone = function (this: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {\n return dropzoneMethod(this, options)\n }\n\n /**\n * ```js\n * interact(target)\n * .dropChecker(function(dragEvent, // related dragmove or dragend event\n * event, // TouchEvent/PointerEvent/MouseEvent\n * dropped, // bool result of the default checker\n * dropzone, // dropzone Interactable\n * dropElement, // dropzone elemnt\n * draggable, // draggable Interactable\n * draggableElement) {// draggable element\n *\n * return dropped && event.target.hasAttribute('allow-drop')\n * }\n * ```\n */\n Interactable.prototype.dropCheck = function (this: Interact.Interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) {\n return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect)\n }\n\n /**\n * Returns or sets whether the dimensions of dropzone elements are calculated\n * on every dragmove or only on dragstart for the default dropChecker\n *\n * @param {boolean} [newValue] True to check on each move. False to check only\n * before start\n * @return {boolean | interact} The current setting or interact\n */\n interact.dynamicDrop = function (newValue?: boolean) {\n if (utils.is.bool(newValue)) {\n // if (dragging && scope.dynamicDrop !== newValue && !newValue) {\n // calcRects(dropzones)\n // }\n\n scope.dynamicDrop = newValue\n\n return interact\n }\n return scope.dynamicDrop\n }\n\n utils.extend(actions.phaselessTypes, {\n dragenter: true,\n dragleave: true,\n dropactivate: true,\n dropdeactivate: true,\n dropmove: true,\n drop: true,\n })\n actions.methodDict.drop = 'dropzone'\n\n scope.dynamicDrop = false\n\n defaults.actions.drop = drop.defaults\n}\n\nfunction collectDrops ({ interactables }, draggableElement) {\n const drops = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const dropzone of interactables.list) {\n if (!dropzone.options.drop.enabled) { continue }\n\n const accept = dropzone.options.drop.accept\n\n // test the draggable draggableElement against the dropzone's accept setting\n if ((utils.is.element(accept) && accept !== draggableElement) ||\n (utils.is.string(accept) &&\n !utils.dom.matchesSelector(draggableElement, accept)) ||\n (utils.is.func(accept) && !accept({ dropzone, draggableElement }))) {\n continue\n }\n\n // query for new elements if necessary\n const dropElements = utils.is.string(dropzone.target)\n ? dropzone._context.querySelectorAll(dropzone.target)\n : utils.is.array(dropzone.target) ? dropzone.target : [dropzone.target]\n\n for (const dropzoneElement of dropElements) {\n if (dropzoneElement !== draggableElement) {\n drops.push({\n dropzone,\n element: dropzoneElement,\n })\n }\n }\n }\n\n return drops\n}\n\nfunction fireActivationEvents (activeDrops, event) {\n // loop through all active dropzones and trigger event\n for (const { dropzone, element } of activeDrops.slice()) {\n event.dropzone = dropzone\n\n // set current element as event target\n event.target = element\n dropzone.fire(event)\n event.propagationStopped = event.immediatePropagationStopped = false\n }\n}\n\n// return a new array of possible drops. getActiveDrops should always be\n// called when a drag has just started or a drag event happens while\n// dynamicDrop is true\nfunction getActiveDrops (scope: Scope, dragElement: Interact.Element) {\n // get dropzones and their elements that could receive the draggable\n const activeDrops = collectDrops(scope, dragElement)\n\n for (const activeDrop of activeDrops) {\n activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element)\n }\n\n return activeDrops\n}\n\nfunction getDrop ({ dropState, interactable: draggable, element: dragElement }: Partial, dragEvent, pointerEvent) {\n const validDrops = []\n\n // collect all dropzones and their elements which qualify for a drop\n for (const { dropzone, element: dropzoneElement, rect } of dropState.activeDrops) {\n validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect)\n ? dropzoneElement\n : null)\n }\n\n // get the most appropriate dropzone based on DOM depth and order\n const dropIndex = utils.dom.indexOfDeepestElement(validDrops)\n\n return dropState.activeDrops[dropIndex] || null\n}\n\nfunction getDropEvents (interaction: Interact.Interaction, _pointerEvent, dragEvent) {\n const { dropState } = interaction\n const dropEvents = {\n enter : null,\n leave : null,\n activate : null,\n deactivate: null,\n move : null,\n drop : null,\n }\n\n if (dragEvent.type === 'dragstart') {\n dropEvents.activate = new DropEvent(dropState, dragEvent, 'dropactivate')\n\n dropEvents.activate.target = null\n dropEvents.activate.dropzone = null\n }\n if (dragEvent.type === 'dragend') {\n dropEvents.deactivate = new DropEvent(dropState, dragEvent, 'dropdeactivate')\n\n dropEvents.deactivate.target = null\n dropEvents.deactivate.dropzone = null\n }\n\n if (dropState.rejected) {\n return dropEvents\n }\n\n if (dropState.cur.element !== dropState.prev.element) {\n // if there was a previous dropzone, create a dragleave event\n if (dropState.prev.dropzone) {\n dropEvents.leave = new DropEvent(dropState, dragEvent, 'dragleave')\n\n dragEvent.dragLeave = dropEvents.leave.target = dropState.prev.element\n dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone\n }\n // if dropzone is not null, create a dragenter event\n if (dropState.cur.dropzone) {\n dropEvents.enter = new DropEvent(dropState, dragEvent, 'dragenter')\n\n dragEvent.dragEnter = dropState.cur.element\n dragEvent.dropzone = dropState.cur.dropzone\n }\n }\n\n if (dragEvent.type === 'dragend' && dropState.cur.dropzone) {\n dropEvents.drop = new DropEvent(dropState, dragEvent, 'drop')\n\n dragEvent.dropzone = dropState.cur.dropzone\n dragEvent.relatedTarget = dropState.cur.element\n }\n if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) {\n dropEvents.move = new DropEvent(dropState, dragEvent, 'dropmove')\n\n dropEvents.move.dragmove = dragEvent\n dragEvent.dropzone = dropState.cur.dropzone\n }\n\n return dropEvents\n}\n\nfunction fireDropEvents (interaction: Interact.Interaction, events) {\n const { dropState } = interaction\n const {\n activeDrops,\n cur,\n prev,\n } = dropState\n\n if (events.leave) { prev.dropzone.fire(events.leave) }\n if (events.move) { cur.dropzone.fire(events.move) }\n if (events.enter) { cur.dropzone.fire(events.enter) }\n if (events.drop) { cur.dropzone.fire(events.drop) }\n\n if (events.deactivate) {\n fireActivationEvents(activeDrops, events.deactivate)\n }\n\n dropState.prev.dropzone = cur.dropzone\n dropState.prev.element = cur.element\n}\n\nfunction onEventCreated ({ interaction, iEvent, event }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {\n if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') { return }\n\n const { dropState } = interaction\n\n if (scope.dynamicDrop) {\n dropState.activeDrops = getActiveDrops(scope, interaction.element)\n }\n\n const dragEvent = iEvent\n const dropResult = getDrop(interaction, dragEvent, event)\n\n // update rejected status\n dropState.rejected = dropState.rejected &&\n !!dropResult &&\n dropResult.dropzone === dropState.cur.dropzone &&\n dropResult.element === dropState.cur.element\n\n dropState.cur.dropzone = dropResult && dropResult.dropzone\n dropState.cur.element = dropResult && dropResult.element\n\n dropState.events = getDropEvents(interaction, event, dragEvent)\n}\n\nfunction dropzoneMethod (interactable: Interact.Interactable): Interact.DropzoneOptions\nfunction dropzoneMethod (interactable: Interact.Interactable, options: Interact.DropzoneOptions | boolean)\nfunction dropzoneMethod (interactable: Interact.Interactable, options?: Interact.DropzoneOptions | boolean) {\n if (utils.is.object(options)) {\n interactable.options.drop.enabled = options.enabled !== false\n\n if (options.listeners) {\n const normalized = utils.normalizeListeners(options.listeners)\n // rename 'drop' to '' as it will be prefixed with 'drop'\n const corrected = Object.keys(normalized).reduce((acc, type) => {\n const correctedType = /^(enter|leave)/.test(type)\n ? `drag${type}`\n : /^(activate|deactivate|move)/.test(type)\n ? `drop${type}`\n : type\n\n acc[correctedType] = normalized[type]\n\n return acc\n }, {})\n\n interactable.off(interactable.options.drop.listeners)\n interactable.on(corrected)\n interactable.options.drop.listeners = corrected\n }\n\n if (utils.is.func(options.ondrop)) { interactable.on('drop', options.ondrop) }\n if (utils.is.func(options.ondropactivate)) { interactable.on('dropactivate', options.ondropactivate) }\n if (utils.is.func(options.ondropdeactivate)) { interactable.on('dropdeactivate', options.ondropdeactivate) }\n if (utils.is.func(options.ondragenter)) { interactable.on('dragenter', options.ondragenter) }\n if (utils.is.func(options.ondragleave)) { interactable.on('dragleave', options.ondragleave) }\n if (utils.is.func(options.ondropmove)) { interactable.on('dropmove', options.ondropmove) }\n\n if (/^(pointer|center)$/.test(options.overlap as string)) {\n interactable.options.drop.overlap = options.overlap\n }\n else if (utils.is.number(options.overlap)) {\n interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0)\n }\n if ('accept' in options) {\n interactable.options.drop.accept = options.accept\n }\n if ('checker' in options) {\n interactable.options.drop.checker = options.checker\n }\n\n return interactable\n }\n\n if (utils.is.bool(options)) {\n interactable.options.drop.enabled = options\n\n return interactable\n }\n\n return interactable.options.drop\n}\n\nfunction dropCheckMethod (\n interactable: Interact.Interactable,\n dragEvent: InteractEvent,\n event: Interact.PointerEventType,\n draggable: Interact.Interactable,\n draggableElement: Interact.Element,\n dropElement: Interact.Element,\n rect: any,\n) {\n let dropped = false\n\n // if the dropzone has no rect (eg. display: none)\n // call the custom dropChecker or just return false\n if (!(rect = rect || interactable.getRect(dropElement))) {\n return (interactable.options.drop.checker\n ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)\n : false)\n }\n\n const dropOverlap = interactable.options.drop.overlap\n\n if (dropOverlap === 'pointer') {\n const origin = utils.getOriginXY(draggable, draggableElement, 'drag')\n const page = utils.pointer.getPageXY(dragEvent)\n\n page.x += origin.x\n page.y += origin.y\n\n const horizontal = (page.x > rect.left) && (page.x < rect.right)\n const vertical = (page.y > rect.top) && (page.y < rect.bottom)\n\n dropped = horizontal && vertical\n }\n\n const dragRect = draggable.getRect(draggableElement)\n\n if (dragRect && dropOverlap === 'center') {\n const cx = dragRect.left + dragRect.width / 2\n const cy = dragRect.top + dragRect.height / 2\n\n dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom\n }\n\n if (dragRect && utils.is.number(dropOverlap)) {\n const overlapArea = (Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) *\n Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top)))\n\n const overlapRatio = overlapArea / (dragRect.width * dragRect.height)\n\n dropped = overlapRatio >= dropOverlap\n }\n\n if (interactable.options.drop.checker) {\n dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement)\n }\n\n return dropped\n}\n\nconst drop: Interact.Plugin = {\n id: 'actions/drop',\n install,\n listeners: {\n 'interactions:before-action-start': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n interaction.dropState = {\n cur: {\n dropzone: null,\n element: null,\n },\n prev: {\n dropzone: null,\n element: null,\n },\n rejected: null,\n events: null,\n activeDrops: [],\n }\n },\n\n 'interactions:after-action-start': ({ interaction, event, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n const { dropState } = interaction\n\n // reset active dropzones\n dropState.activeDrops = null\n dropState.events = null\n dropState.activeDrops = getActiveDrops(scope, interaction.element)\n dropState.events = getDropEvents(interaction, event, dragEvent)\n\n if (dropState.events.activate) {\n fireActivationEvents(dropState.activeDrops, dropState.events.activate)\n scope.fire('actions/drop:start', { interaction, dragEvent })\n }\n },\n\n // FIXME proper signal types\n 'interactions:action-move': onEventCreated,\n 'interactions:action-end': onEventCreated,\n\n 'interactions:after-action-move': function fireDropAfterMove ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) {\n if (interaction.prepared.name !== 'drag') { return }\n\n fireDropEvents(interaction, interaction.dropState.events)\n\n scope.fire('actions/drop:move', { interaction, dragEvent })\n interaction.dropState.events = {}\n },\n\n 'interactions:after-action-end': ({ interaction, iEvent: dragEvent }: Interact.DoPhaseArg<'drag', Interact.EventPhase>, scope) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n fireDropEvents(interaction, interaction.dropState.events)\n scope.fire('actions/drop:end', { interaction, dragEvent })\n },\n\n 'interactions:stop': ({ interaction }) => {\n if (interaction.prepared.name !== 'drag') { return }\n\n const { dropState } = interaction\n\n if (dropState) {\n dropState.activeDrops = null\n dropState.events = null\n dropState.cur.dropzone = null\n dropState.cur.element = null\n dropState.prev.dropzone = null\n dropState.prev.element = null\n dropState.rejected = false\n }\n },\n },\n getActiveDrops,\n getDrop,\n getDropEvents,\n fireDropEvents,\n defaults: {\n enabled: false,\n accept : null,\n overlap: 'pointer',\n } as Interact.DropzoneOptions,\n}\n\nexport default drop\n","import * as utils from '@interactjs/utils/index'\n\nexport type GesturableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n gesture?: {\n angle: number // angle from first to second touch\n distance: number\n scale: number // gesture.distance / gesture.startDistance\n startAngle: number // angle of line joining two touches\n startDistance: number // distance between two touches of touchStart\n }\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n gesturable: GesturableMethod\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n gesture: Interact.GesturableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n gesture?: typeof gesture\n }\n}\n\nexport interface GestureEvent extends Interact.InteractEvent<'gesture'> {\n distance: number\n angle: number\n da: number // angle change\n scale: number // ratio of distance start to current event\n ds: number // scale change\n box: Interact.Rect // enclosing box of all points\n touches: Interact.PointerType[]\n}\n\nexport interface GestureSignalArg extends Interact.DoPhaseArg<'gesture', Interact.EventPhase> {\n iEvent: GestureEvent\n interaction: Interact.Interaction<'gesture'>\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n actions,\n Interactable,\n defaults,\n } = scope\n\n /**\n * ```js\n * interact(element).gesturable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * // limit multiple gestures.\n * // See the explanation in {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isGestureable = interact(element).gesturable()\n * ```\n *\n * Gets or sets whether multitouch gestures can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on gesture events (makes the Interactable gesturable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of gesture events, or this Interactable\n */\n Interactable.prototype.gesturable = function (this: Interact.Interactable, options: Interact.GesturableOptions | boolean) {\n if (utils.is.object(options)) {\n this.options.gesture.enabled = options.enabled !== false\n this.setPerAction('gesture', options)\n this.setOnEvents('gesture', options)\n\n return this\n }\n\n if (utils.is.bool(options)) {\n this.options.gesture.enabled = options\n\n return this\n }\n\n return this.options.gesture as Interact.Options\n } as GesturableMethod\n\n actions.map.gesture = gesture\n actions.methodDict.gesture = 'gesturable'\n\n defaults.actions.gesture = gesture.defaults\n}\n\nfunction updateGestureProps ({ interaction, iEvent, phase }: GestureSignalArg) {\n if (interaction.prepared.name !== 'gesture') { return }\n\n const pointers = interaction.pointers.map(p => p.pointer)\n const starting = phase === 'start'\n const ending = phase === 'end'\n const deltaSource = interaction.interactable.options.deltaSource\n\n iEvent.touches = [pointers[0], pointers[1]]\n\n if (starting) {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = 1\n iEvent.ds = 0\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n iEvent.da = 0\n\n interaction.gesture.startDistance = iEvent.distance\n interaction.gesture.startAngle = iEvent.angle\n }\n else if (ending) {\n const prevEvent = interaction.prevEvent as GestureEvent\n\n iEvent.distance = prevEvent.distance\n iEvent.box = prevEvent.box\n iEvent.scale = prevEvent.scale\n iEvent.ds = 0\n iEvent.angle = prevEvent.angle\n iEvent.da = 0\n }\n else {\n iEvent.distance = utils.pointer.touchDistance(pointers, deltaSource)\n iEvent.box = utils.pointer.touchBBox(pointers)\n iEvent.scale = iEvent.distance / interaction.gesture.startDistance\n iEvent.angle = utils.pointer.touchAngle(pointers, deltaSource)\n\n iEvent.ds = iEvent.scale - interaction.gesture.scale\n iEvent.da = iEvent.angle - interaction.gesture.angle\n }\n\n interaction.gesture.distance = iEvent.distance\n interaction.gesture.angle = iEvent.angle\n\n if (utils.is.number(iEvent.scale) &&\n iEvent.scale !== Infinity &&\n !isNaN(iEvent.scale)) {\n interaction.gesture.scale = iEvent.scale\n }\n}\n\nconst gesture: Interact.Plugin = {\n id: 'actions/gesture',\n before: ['actions/drag', 'actions/resize'],\n install,\n listeners: {\n 'interactions:action-start': updateGestureProps,\n 'interactions:action-move': updateGestureProps,\n 'interactions:action-end': updateGestureProps,\n\n 'interactions:new': ({ interaction }) => {\n interaction.gesture = {\n angle: 0,\n distance: 0,\n scale: 1,\n startAngle: 0,\n startDistance: 0,\n }\n },\n\n 'auto-start:check': arg => {\n if (arg.interaction.pointers.length < 2) {\n return undefined\n }\n\n const gestureOptions = arg.interactable.options.gesture\n\n if (!(gestureOptions && gestureOptions.enabled)) {\n return undefined\n }\n\n arg.action = { name: 'gesture' }\n\n return false\n },\n },\n\n defaults: {\n },\n\n getCursor () {\n return ''\n },\n}\n\nexport default gesture\n","import { Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as dom from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\n\nexport type EdgeName = 'top' | 'left' | 'bottom' | 'right'\n\nexport type ResizableMethod = Interact.ActionMethod\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n resizable: ResizableMethod\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n resizeAxes: 'x' | 'y' | 'xy'\n resizeStartAspectRatio: number\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n resize: Interact.ResizableOptions\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface ActionMap {\n resize?: typeof resize\n }\n}\n\nexport interface ResizeEvent

extends Interact.InteractEvent<'resize', P> {\n deltaRect?: Interact.FullRect\n edges?: Interact.ActionProps['edges']\n}\n\nfunction install (scope: Scope) {\n const {\n actions,\n browser,\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n defaults,\n } = scope\n\n // Less Precision with touch input\n\n resize.cursors = initCursors(browser)\n resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10\n\n /**\n * ```js\n * interact(element).resizable({\n * onstart: function (event) {},\n * onmove : function (event) {},\n * onend : function (event) {},\n *\n * edges: {\n * top : true, // Use pointer coords to check for resize.\n * left : false, // Disable resizing from left edge.\n * bottom: '.resize-s',// Resize if pointer target matches selector\n * right : handleEl // Resize if pointer target is the given Element\n * },\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height are adjusted at a 1:1 ratio.\n * square: false,\n *\n * // Width and height can be adjusted independently. When `true`, width and\n * // height maintain the aspect ratio they had when resizing started.\n * preserveAspectRatio: false,\n *\n * // a value of 'none' will limit the resize rect to a minimum of 0x0\n * // 'negate' will allow the rect to have negative width/height\n * // 'reposition' will keep the width/height positive by swapping\n * // the top and bottom edges and/or swapping the left and right edges\n * invert: 'none' || 'negate' || 'reposition'\n *\n * // limit multiple resizes.\n * // See the explanation in the {@link Interactable.draggable} example\n * max: Infinity,\n * maxPerElement: 1,\n * })\n *\n * var isResizeable = interact(element).resizable()\n * ```\n *\n * Gets or sets whether resize actions can be performed on the target\n *\n * @param {boolean | object} [options] true/false or An object with event\n * listeners to be fired on resize events (object makes the Interactable\n * resizable)\n * @return {boolean | Interactable} A boolean indicating if this can be the\n * target of resize elements, or this Interactable\n */\n Interactable.prototype.resizable = function (this: Interact.Interactable, options: Interact.ResizableOptions | boolean) {\n return resizable(this, options, scope)\n } as ResizableMethod\n\n actions.map.resize = resize\n actions.methodDict.resize = 'resizable'\n\n defaults.actions.resize = resize.defaults\n}\n\nfunction resizeChecker (arg) {\n const { interaction, interactable, element, rect, buttons } = arg\n\n if (!rect) { return undefined }\n\n const page = extend({}, interaction.coords.cur.page)\n const resizeOptions = interactable.options.resize\n\n if (\n !(resizeOptions && resizeOptions.enabled) ||\n // check mouseButton setting if the pointer is down\n (interaction.pointerIsDown &&\n /mouse|pointer/.test(interaction.pointerType) &&\n (buttons & resizeOptions.mouseButtons) === 0)\n ) {\n return undefined\n }\n\n // if using resize.edges\n if (is.object(resizeOptions.edges)) {\n const resizeEdges = {\n left: false,\n right: false,\n top: false,\n bottom: false,\n }\n\n for (const edge in resizeEdges) {\n resizeEdges[edge] = checkResizeEdge(edge,\n resizeOptions.edges[edge],\n page,\n interaction._latestPointer.eventTarget,\n element,\n rect,\n resizeOptions.margin || resize.defaultMargin)\n }\n\n resizeEdges.left = resizeEdges.left && !resizeEdges.right\n resizeEdges.top = resizeEdges.top && !resizeEdges.bottom\n\n if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {\n arg.action = {\n name: 'resize',\n edges: resizeEdges,\n }\n }\n }\n else {\n const right = resizeOptions.axis !== 'y' && page.x > (rect.right - resize.defaultMargin)\n const bottom = resizeOptions.axis !== 'x' && page.y > (rect.bottom - resize.defaultMargin)\n\n if (right || bottom) {\n arg.action = {\n name: 'resize',\n axes: (right ? 'x' : '') + (bottom ? 'y' : ''),\n }\n }\n }\n\n return arg.action ? false : undefined\n}\n\nfunction resizable (interactable: Interact.Interactable, options: Interact.OrBoolean | boolean, scope: Scope) {\n if (is.object(options)) {\n interactable.options.resize.enabled = options.enabled !== false\n interactable.setPerAction('resize', options)\n interactable.setOnEvents('resize', options)\n\n if (is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {\n interactable.options.resize.axis = options.axis\n }\n else if (options.axis === null) {\n interactable.options.resize.axis = scope.defaults.actions.resize.axis\n }\n\n if (is.bool(options.preserveAspectRatio)) {\n interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio\n }\n else if (is.bool(options.square)) {\n interactable.options.resize.square = options.square\n }\n\n return interactable\n }\n if (is.bool(options)) {\n interactable.options.resize.enabled = options\n\n return interactable\n }\n return interactable.options.resize\n}\n\nfunction checkResizeEdge (\n name: string,\n value: any,\n page: Interact.Point,\n element: Node,\n interactableElement: Interact.Element,\n rect: Interact.Rect,\n margin: number,\n) {\n // false, '', undefined, null\n if (!value) { return false }\n\n // true value, use pointer coords and element rect\n if (value === true) {\n // if dimensions are negative, \"switch\" edges\n const width = is.number(rect.width) ? rect.width : rect.right - rect.left\n const height = is.number(rect.height) ? rect.height : rect.bottom - rect.top\n\n // don't use margin greater than half the relevent dimension\n margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2)\n\n if (width < 0) {\n if (name === 'left') { name = 'right' }\n else if (name === 'right') { name = 'left' }\n }\n if (height < 0) {\n if (name === 'top') { name = 'bottom' }\n else if (name === 'bottom') { name = 'top' }\n }\n\n if (name === 'left') { return page.x < ((width >= 0 ? rect.left : rect.right) + margin) }\n if (name === 'top') { return page.y < ((height >= 0 ? rect.top : rect.bottom) + margin) }\n\n if (name === 'right') { return page.x > ((width >= 0 ? rect.right : rect.left) - margin) }\n if (name === 'bottom') { return page.y > ((height >= 0 ? rect.bottom : rect.top) - margin) }\n }\n\n // the remaining checks require an element\n if (!is.element(element)) { return false }\n\n return is.element(value)\n // the value is an element to use as a resize handle\n ? value === element\n // otherwise check if element matches value as selector\n : dom.matchesUpTo(element, value, interactableElement)\n}\n\nfunction initCursors (browser: typeof import ('@interactjs/utils/browser').default) {\n return (browser.isIe9 ? {\n x : 'e-resize',\n y : 's-resize',\n xy: 'se-resize',\n\n top : 'n-resize',\n left : 'w-resize',\n bottom : 's-resize',\n right : 'e-resize',\n topleft : 'se-resize',\n bottomright: 'se-resize',\n topright : 'ne-resize',\n bottomleft : 'ne-resize',\n } : {\n x : 'ew-resize',\n y : 'ns-resize',\n xy: 'nwse-resize',\n\n top : 'ns-resize',\n left : 'ew-resize',\n bottom : 'ns-resize',\n right : 'ew-resize',\n topleft : 'nwse-resize',\n bottomright: 'nwse-resize',\n topright : 'nesw-resize',\n bottomleft : 'nesw-resize',\n })\n}\n\nfunction start ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {\n return\n }\n\n const resizeEvent = iEvent as ResizeEvent\n const rect = interaction.rect\n\n interaction._rects = {\n start: extend({}, rect),\n corrected: extend({}, rect),\n previous: extend({}, rect),\n delta: {\n left: 0,\n right : 0,\n width : 0,\n top : 0,\n bottom: 0,\n height: 0,\n },\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction move ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n const resizeOptions = interaction.interactable.options.resize\n const invert = resizeOptions.invert\n const invertible = invert === 'reposition' || invert === 'negate'\n\n // eslint-disable-next-line no-shadow\n const current = interaction.rect\n const { start: startRect, corrected, delta: deltaRect, previous } = interaction._rects\n\n extend(previous, corrected)\n\n if (invertible) {\n // if invertible, copy the current rect\n extend(corrected, current)\n\n if (invert === 'reposition') {\n // swap edge values if necessary to keep width/height positive\n if (corrected.top > corrected.bottom) {\n const swap = corrected.top\n\n corrected.top = corrected.bottom\n corrected.bottom = swap\n }\n if (corrected.left > corrected.right) {\n const swap = corrected.left\n\n corrected.left = corrected.right\n corrected.right = swap\n }\n }\n }\n else {\n // if not invertible, restrict to minimum of 0x0 rect\n corrected.top = Math.min(current.top, startRect.bottom)\n corrected.bottom = Math.max(current.bottom, startRect.top)\n corrected.left = Math.min(current.left, startRect.right)\n corrected.right = Math.max(current.right, startRect.left)\n }\n\n corrected.width = corrected.right - corrected.left\n corrected.height = corrected.bottom - corrected.top\n\n for (const edge in corrected) {\n deltaRect[edge] = corrected[edge] - previous[edge]\n }\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = corrected\n resizeEvent.deltaRect = deltaRect\n}\n\nfunction end ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) { return }\n\n const resizeEvent = iEvent as ResizeEvent\n\n resizeEvent.edges = interaction.prepared.edges\n resizeEvent.rect = interaction._rects.corrected\n resizeEvent.deltaRect = interaction._rects.delta\n}\n\nfunction updateEventAxes ({ iEvent, interaction }: { iEvent: Interact.InteractEvent, interaction: Interaction }) {\n if (interaction.prepared.name !== 'resize' || !interaction.resizeAxes) { return }\n\n const options = interaction.interactable.options\n const resizeEvent = iEvent as ResizeEvent\n\n if (options.resize.square) {\n if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = resizeEvent.delta.y\n }\n else {\n resizeEvent.delta.y = resizeEvent.delta.x\n }\n resizeEvent.axes = 'xy'\n }\n else {\n resizeEvent.axes = interaction.resizeAxes\n\n if (interaction.resizeAxes === 'x') {\n resizeEvent.delta.y = 0\n }\n else if (interaction.resizeAxes === 'y') {\n resizeEvent.delta.x = 0\n }\n }\n}\n\nconst resize: Interact.Plugin = {\n id: 'actions/resize',\n before: ['actions/drag'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.resizeAxes = 'xy'\n },\n\n 'interactions:action-start': arg => {\n start(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-move': arg => {\n move(arg)\n updateEventAxes(arg)\n },\n 'interactions:action-end': end,\n 'auto-start:check': resizeChecker,\n },\n\n defaults: {\n square: false,\n preserveAspectRatio: false,\n axis: 'xy',\n\n // use default margin\n margin: NaN,\n\n // object with props left, right, top, bottom which are\n // true/false values to resize when the pointer is over that edge,\n // CSS selectors to match the handles for each direction\n // or the Elements for each handle\n edges: null,\n\n // a value of 'none' will limit the resize rect to a minimum of 0x0\n // 'negate' will alow the rect to have negative width/height\n // 'reposition' will keep the width/height positive by swapping\n // the top and bottom edges and/or swapping the left and right edges\n invert: 'none',\n } as Interact.ResizableOptions,\n\n cursors: null as ReturnType,\n\n getCursor ({ edges, axis, name }: Interact.ActionProps) {\n const cursors = resize.cursors\n let result: string = null\n\n if (axis) {\n result = cursors[name + axis]\n }\n else if (edges) {\n let cursorKey = ''\n\n for (const edge of ['top', 'bottom', 'left', 'right']) {\n if (edges[edge]) {\n cursorKey += edge\n }\n }\n\n result = cursors[cursorKey]\n }\n\n return result\n },\n\n defaultMargin: null as number,\n}\n\nexport default resize\n","import { Scope } from '@interactjs/core/scope'\nimport drag from './drag'\nimport drop from './drop/index'\nimport gesture from './gesture'\nimport resize from './resize'\n\nfunction install (scope: Scope) {\n scope.usePlugin(gesture)\n scope.usePlugin(resize)\n scope.usePlugin(drag)\n scope.usePlugin(drop)\n}\n\nconst id = 'actions'\n\nexport {\n id,\n install,\n gesture,\n resize,\n drag,\n drop,\n}\n","import * as domUtils from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport raf from '@interactjs/utils/raf'\nimport { getStringOptionResult } from '@interactjs/utils/rect'\nimport { getWindow } from '@interactjs/utils/window'\n\ntype Scope = import ('@interactjs/core/scope').Scope\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoScroll: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoScroll?: typeof autoScroll\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n autoScroll?: AutoScrollOptions\n }\n}\n\nexport interface AutoScrollOptions {\n container?: Window | HTMLElement\n margin?: number\n distance?: number\n interval?: number\n speed?: number\n enabled?: boolean\n}\n\nfunction install (scope: Scope) {\n const {\n defaults,\n actions,\n } = scope\n\n scope.autoScroll = autoScroll\n autoScroll.now = () => scope.now()\n\n actions.phaselessTypes.autoscroll = true\n defaults.perAction.autoScroll = autoScroll.defaults\n}\n\nconst autoScroll = {\n defaults: {\n enabled : false,\n margin : 60,\n\n // the item that is scrolled (Window or HTMLElement)\n container: null as AutoScrollOptions['container'],\n\n // the scroll speed in pixels per second\n speed : 300,\n } as AutoScrollOptions,\n\n now: Date.now,\n\n interaction: null as Interact.Interaction,\n i: 0, // the handle returned by window.setInterval\n x: 0,\n y: 0, // Direction each pulse is to scroll in\n\n isScrolling: false,\n prevTime: 0,\n margin: 0,\n speed: 0,\n\n start (interaction: Interact.Interaction) {\n autoScroll.isScrolling = true\n raf.cancel(autoScroll.i)\n\n interaction.autoScroll = autoScroll\n autoScroll.interaction = interaction\n autoScroll.prevTime = autoScroll.now()\n autoScroll.i = raf.request(autoScroll.scroll)\n },\n\n stop () {\n autoScroll.isScrolling = false\n if (autoScroll.interaction) {\n autoScroll.interaction.autoScroll = null\n }\n raf.cancel(autoScroll.i)\n },\n\n // scroll the window by the values in scroll.x/y\n scroll () {\n const { interaction } = autoScroll\n const { interactable, element } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n const now = autoScroll.now()\n // change in time in seconds\n const dt = (now - autoScroll.prevTime) / 1000\n // displacement\n const s = options.speed * dt\n\n if (s >= 1) {\n const scrollBy = {\n x: autoScroll.x * s,\n y: autoScroll.y * s,\n }\n\n if (scrollBy.x || scrollBy.y) {\n const prevScroll = getScroll(container)\n\n if (is.window(container)) {\n container.scrollBy(scrollBy.x, scrollBy.y)\n }\n else if (container) {\n container.scrollLeft += scrollBy.x\n container.scrollTop += scrollBy.y\n }\n\n const curScroll = getScroll(container)\n const delta = {\n x: curScroll.x - prevScroll.x,\n y: curScroll.y - prevScroll.y,\n }\n\n if (delta.x || delta.y) {\n interactable.fire({\n type: 'autoscroll',\n target: element,\n interactable,\n delta,\n interaction,\n container,\n })\n }\n }\n\n autoScroll.prevTime = now\n }\n\n if (autoScroll.isScrolling) {\n raf.cancel(autoScroll.i)\n autoScroll.i = raf.request(autoScroll.scroll)\n }\n },\n check (interactable: Interact.Interactable, actionName: Interact.ActionName) {\n const options = interactable.options\n\n return options[actionName].autoScroll && options[actionName].autoScroll.enabled\n },\n onInteractionMove ({ interaction, pointer }: { interaction: Interact.Interaction, pointer: Interact.PointerType }) {\n if (!(interaction.interacting() &&\n autoScroll.check(interaction.interactable, interaction.prepared.name))) {\n return\n }\n\n if (interaction.simulation) {\n autoScroll.x = autoScroll.y = 0\n return\n }\n\n let top\n let right\n let bottom\n let left\n\n const { interactable, element } = interaction\n const actionName = interaction.prepared.name\n const options = interactable.options[actionName].autoScroll\n const container = getContainer(options.container, interactable, element)\n\n if (is.window(container)) {\n left = pointer.clientX < autoScroll.margin\n top = pointer.clientY < autoScroll.margin\n right = pointer.clientX > container.innerWidth - autoScroll.margin\n bottom = pointer.clientY > container.innerHeight - autoScroll.margin\n }\n else {\n const rect = domUtils.getElementClientRect(container)\n\n left = pointer.clientX < rect.left + autoScroll.margin\n top = pointer.clientY < rect.top + autoScroll.margin\n right = pointer.clientX > rect.right - autoScroll.margin\n bottom = pointer.clientY > rect.bottom - autoScroll.margin\n }\n\n autoScroll.x = (right ? 1 : left ? -1 : 0)\n autoScroll.y = (bottom ? 1 : top ? -1 : 0)\n\n if (!autoScroll.isScrolling) {\n // set the autoScroll properties to those of the target\n autoScroll.margin = options.margin\n autoScroll.speed = options.speed\n\n autoScroll.start(interaction)\n }\n },\n}\n\nexport function getContainer (value: any, interactable: Interact.Interactable, element: Interact.Element) {\n return (is.string(value) ? getStringOptionResult(value, interactable, element) : value) || getWindow(element)\n}\n\nexport function getScroll (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollLeft, y: container.scrollTop }\n}\n\nexport function getScrollSize (container: any) {\n if (is.window(container)) { container = window.document.body }\n\n return { x: container.scrollWidth, y: container.scrollHeight }\n}\n\nexport function getScrollSizeDelta ({ interaction, element }: {\n interaction: Partial>\n element: Interact.Element\n}, func: any) {\n const scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll\n\n if (!scrollOptions || !scrollOptions.enabled) {\n func()\n return { x: 0, y: 0 }\n }\n\n const scrollContainer = getContainer(\n scrollOptions.container,\n interaction.interactable,\n element,\n )\n\n const prevSize = getScroll(scrollContainer)\n func()\n const curSize = getScroll(scrollContainer)\n\n return {\n x: curSize.x - prevSize.x,\n y: curSize.y - prevSize.y,\n }\n}\n\nconst autoScrollPlugin: Interact.Plugin = {\n id: 'auto-scroll',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoScroll = null\n },\n\n 'interactions:destroy': ({ interaction }) => {\n interaction.autoScroll = null\n autoScroll.stop()\n if (autoScroll.interaction) {\n autoScroll.interaction = null\n }\n },\n\n 'interactions:stop': autoScroll.stop,\n\n 'interactions:action-move': (arg: any) => autoScroll.onInteractionMove(arg),\n },\n}\n\nexport default autoScrollPlugin\n","import { warnOnce } from '@interactjs/utils/index'\nimport * as is from '@interactjs/utils/is'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n getAction: (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ) => Interact.ActionProps | null\n styleCursor: typeof styleCursor\n actionChecker: typeof actionChecker\n ignoreFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n allowFrom: {\n (...args: any[]): Interactable\n (): boolean\n }\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n pointerIsDown: boolean\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n /** @lends Interactable */\n Interactable, // tslint:disable-line no-shadowed-variable\n } = scope\n\n Interactable.prototype.getAction = function getAction (\n this: Interact.Interactable,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n ): Interact.ActionProps {\n const action = defaultActionChecker(this, event, interaction, element, scope)\n\n if (this.options.actionChecker) {\n return this.options.actionChecker(pointer, event, action, this, element, interaction)\n }\n\n return action\n }\n\n /**\n * ```js\n * interact(element, { ignoreFrom: document.getElementById('no-action') })\n * // or\n * interact(element).ignoreFrom('input, textarea, a')\n * ```\n * @deprecated\n * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any\n * of it's parents match the given CSS selector or Element, no\n * drag/resize/gesture is started.\n *\n * Don't use this method. Instead set the `ignoreFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .draggable({\n * ignoreFrom: 'input, textarea, a[href]'',\n * })\n * .pointerEvents({\n * ignoreFrom: '[no-pointer]',\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to not ignore any elements\n * @return {string | Element | object} The current ignoreFrom value or this\n * Interactable\n */\n Interactable.prototype.ignoreFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('ignoreFrom', newValue)\n }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).')\n\n /**\n * @deprecated\n *\n * A drag/resize/gesture is started only If the target of the `mousedown`,\n * `pointerdown` or `touchstart` event or any of it's parents match the given\n * CSS selector or Element.\n *\n * Don't use this method. Instead set the `allowFrom` option for each action\n * or for `pointerEvents`\n *\n * @example\n * interact(targett)\n * .resizable({\n * allowFrom: '.resize-handle',\n * .pointerEvents({\n * allowFrom: '.handle',,\n * })\n *\n * @param {string | Element | null} [newValue] a CSS selector string, an\n * Element or `null` to allow from any element\n * @return {string | Element | object} The current allowFrom value or this\n * Interactable\n */\n Interactable.prototype.allowFrom = warnOnce(function (this: Interact.Interactable, newValue) {\n return this._backCompatOption('allowFrom', newValue)\n }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).')\n\n /**\n * ```js\n * interact('.resize-drag')\n * .resizable(true)\n * .draggable(true)\n * .actionChecker(function (pointer, event, action, interactable, element, interaction) {\n *\n * if (interact.matchesSelector(event.target, '.drag-handle')) {\n * // force drag with handle target\n * action.name = drag\n * }\n * else {\n * // resize from the top and right edges\n * action.name = 'resize'\n * action.edges = { top: true, right: true }\n * }\n *\n * return action\n * })\n * ```\n *\n * Returns or sets the function used to check action to be performed on\n * pointerDown\n *\n * @param {function | null} [checker] A function which takes a pointer event,\n * defaultAction string, interactable, element and interaction as parameters\n * and returns an object with name property 'drag' 'resize' or 'gesture' and\n * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right\n * props.\n * @return {Function | Interactable} The checker function or this Interactable\n */\n Interactable.prototype.actionChecker = actionChecker\n\n /**\n * Returns or sets whether the the cursor should be changed depending on the\n * action that would be performed if the mouse were pressed and dragged.\n *\n * @param {boolean} [newValue]\n * @return {boolean | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.styleCursor = styleCursor\n}\n\nfunction defaultActionChecker (\n interactable: Interact.Interactable,\n event: Interact.PointerEventType,\n interaction: Interact.Interaction,\n element: Interact.Element,\n scope: Interact.Scope,\n) {\n const rect = interactable.getRect(element)\n const buttons = (event as MouseEvent).buttons || ({\n 0: 1,\n 1: 4,\n 3: 8,\n 4: 16,\n })[(event as MouseEvent).button as 0 | 1 | 3 | 4]\n const arg = {\n action: null,\n interactable,\n interaction,\n element,\n rect,\n buttons,\n }\n\n scope.fire('auto-start:check', arg)\n\n return arg.action\n}\n\nfunction styleCursor (this: Interact.Interactable, newValue?: boolean) {\n if (is.bool(newValue)) {\n this.options.styleCursor = newValue\n\n return this\n }\n\n if (newValue === null) {\n delete this.options.styleCursor\n\n return this\n }\n\n return this.options.styleCursor\n}\n\nfunction actionChecker (this: Interact.Interactable, checker: any) {\n if (is.func(checker)) {\n this.options.actionChecker = checker\n\n return this\n }\n\n if (checker === null) {\n delete this.options.actionChecker\n\n return this\n }\n\n return this.options.actionChecker\n}\n\nexport default {\n id: 'auto-start/interactableMethods',\n install,\n}\n","import * as utils from '@interactjs/utils/index'\nimport InteractableMethods from './InteractableMethods'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n maxInteractions: (newValue: any) => any\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n autoStart: AutoStart\n maxInteractions: (...args: any[]) => any\n }\n\n interface SignalArgs {\n 'autoStart:before-start': Interact.SignalArgs['interactions:move']\n 'autoStart:prepared': { interaction: Interact.Interaction }\n 'auto-start:check': CheckSignalArg\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n actionChecker?: any\n cursorChecker?: any\n styleCursor?: any\n }\n\n interface PerActionDefaults {\n manualStart?: boolean\n max?: number\n maxPerElement?: number\n allowFrom?: string | Interact.Element\n ignoreFrom?: string | Interact.Element\n cursorChecker?: Interact.CursorChecker\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons?: 0 | 1 | 2 | 4 | 16\n }\n}\n\ninterface CheckSignalArg {\n interactable: Interact.Interactable\n interaction: Interact.Interaction\n element: Interact.Element\n action: Interact.ActionProps\n buttons: number\n}\n\nexport interface AutoStart {\n // Allow this many interactions to happen simultaneously\n maxInteractions: number\n withinInteractionLimit: typeof withinInteractionLimit\n cursorElement: Interact.Element\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n interact,\n defaults,\n } = scope\n\n scope.usePlugin(InteractableMethods)\n\n defaults.base.actionChecker = null\n defaults.base.styleCursor = true\n\n utils.extend(defaults.perAction, {\n manualStart: false,\n max: Infinity,\n maxPerElement: 1,\n allowFrom: null,\n ignoreFrom: null,\n\n // only allow left button by default\n // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value\n mouseButtons: 1,\n })\n\n /**\n * Returns or sets the maximum number of concurrent interactions allowed. By\n * default only 1 interaction is allowed at a time (for backwards\n * compatibility). To allow multiple interactions on the same Interactables and\n * elements, you need to enable it in the draggable, resizable and gesturable\n * `'max'` and `'maxPerElement'` options.\n *\n * @alias module:interact.maxInteractions\n *\n * @param {number} [newValue] Any number. newValue <= 0 means no interactions.\n */\n interact.maxInteractions = newValue => maxInteractions(newValue, scope)\n\n scope.autoStart = {\n // Allow this many interactions to happen simultaneously\n maxInteractions: Infinity,\n withinInteractionLimit,\n cursorElement: null,\n }\n}\n\nfunction prepareOnDown ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n if (interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction prepareOnMove ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.pointerType !== 'mouse' ||\n interaction.pointerIsDown ||\n interaction.interacting()) { return }\n\n const actionInfo = getActionInfo(interaction, pointer, event, eventTarget as Interact.Element, scope)\n prepare(interaction, actionInfo, scope)\n}\n\nfunction startOnMove (arg: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n const { interaction } = arg\n\n if (!interaction.pointerIsDown ||\n interaction.interacting() ||\n !interaction.pointerWasMoved ||\n !interaction.prepared.name) {\n return\n }\n\n scope.fire('autoStart:before-start', arg)\n\n const { interactable } = interaction\n const actionName: Interact.ActionName = interaction.prepared.name\n\n if (actionName && interactable) {\n // check manualStart and interaction limit\n if (interactable.options[actionName].manualStart ||\n !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) {\n interaction.stop()\n }\n else {\n interaction.start(interaction.prepared, interactable, interaction.element)\n setInteractionCursor(interaction, scope)\n }\n }\n}\n\nfunction clearCursorOnStop ({ interaction }: { interaction: Interact.Interaction }, scope: Interact.Scope) {\n const { interactable } = interaction\n\n if (interactable && interactable.options.styleCursor) {\n setCursor(interaction.element, '', scope)\n }\n}\n\n// Check if the current interactable supports the action.\n// If so, return the validated action. Otherwise, return null\nfunction validateAction (\n action: Interact.ActionProps,\n interactable: Interact.Interactable,\n element: Interact.Element,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) &&\n interactable.options[action.name].enabled &&\n withinInteractionLimit(interactable, element, action, scope)) {\n return action\n }\n\n return null\n}\n\nfunction validateMatches (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n matches: Interact.Interactable[],\n matchElements: Interact.Element[],\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n for (let i = 0, len = matches.length; i < len; i++) {\n const match = matches[i]\n const matchElement = matchElements[i]\n const matchAction = match.getAction(pointer, event, interaction, matchElement)\n\n if (!matchAction) { continue }\n\n const action = validateAction(\n matchAction,\n match,\n matchElement,\n eventTarget,\n scope)\n\n if (action) {\n return {\n action,\n interactable: match,\n element: matchElement,\n }\n }\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction getActionInfo (\n interaction: Interact.Interaction,\n pointer: Interact.PointerType,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n scope: Interact.Scope,\n) {\n let matches: Interact.Interactable[] = []\n let matchElements: Interact.Element[] = []\n\n let element = eventTarget as Interact.Element\n\n function pushMatches (interactable: Interact.Interactable) {\n matches.push(interactable)\n matchElements.push(element)\n }\n\n while (utils.is.element(element)) {\n matches = []\n matchElements = []\n\n scope.interactables.forEachMatch(element, pushMatches)\n\n const actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope)\n\n if (actionInfo.action &&\n !actionInfo.interactable.options[actionInfo.action.name].manualStart) {\n return actionInfo\n }\n\n element = utils.dom.parentNode(element) as Interact.Element\n }\n\n return { action: null, interactable: null, element: null }\n}\n\nfunction prepare (\n interaction: Interact.Interaction,\n { action, interactable, element }: {\n action: Interact.ActionProps\n interactable: Interact.Interactable\n element: Interact.Element\n },\n scope: Interact.Scope,\n) {\n action = action || { name: null }\n\n interaction.interactable = interactable\n interaction.element = element\n utils.copyAction(interaction.prepared, action)\n\n interaction.rect = interactable && action.name\n ? interactable.getRect(element)\n : null\n\n setInteractionCursor(interaction, scope)\n\n scope.fire('autoStart:prepared', { interaction })\n}\n\nfunction withinInteractionLimit (\n interactable: Interact.Interactable,\n element: Interact.Element,\n action: Interact.ActionProps,\n scope: Interact.Scope,\n) {\n const options = interactable.options\n const maxActions = options[action.name].max\n const maxPerElement = options[action.name].maxPerElement\n const autoStartMax = scope.autoStart.maxInteractions\n let activeInteractions = 0\n let interactableCount = 0\n let elementCount = 0\n\n // no actions if any of these values == 0\n if (!(maxActions && maxPerElement && autoStartMax)) { return false }\n\n for (const interaction of scope.interactions.list) {\n const otherAction = interaction.prepared.name\n\n if (!interaction.interacting()) { continue }\n\n activeInteractions++\n\n if (activeInteractions >= autoStartMax) {\n return false\n }\n\n if (interaction.interactable !== interactable) { continue }\n\n interactableCount += otherAction === action.name ? 1 : 0\n\n if (interactableCount >= maxActions) {\n return false\n }\n\n if (interaction.element === element) {\n elementCount++\n\n if (otherAction === action.name && elementCount >= maxPerElement) {\n return false\n }\n }\n }\n\n return autoStartMax > 0\n}\n\nfunction maxInteractions (newValue: any, scope: Interact.Scope) {\n if (utils.is.number(newValue)) {\n scope.autoStart.maxInteractions = newValue\n\n return this\n }\n\n return scope.autoStart.maxInteractions\n}\n\nfunction setCursor (element: Interact.Element, cursor: string, scope: Interact.Scope) {\n const { cursorElement: prevCursorElement } = scope.autoStart\n\n if (prevCursorElement && prevCursorElement !== element) {\n prevCursorElement.style.cursor = ''\n }\n\n element.ownerDocument.documentElement.style.cursor = cursor\n element.style.cursor = cursor\n scope.autoStart.cursorElement = cursor ? element : null\n}\n\nfunction setInteractionCursor (interaction: Interact.Interaction, scope: Interact.Scope) {\n const { interactable, element, prepared } = interaction\n\n if (!(interaction.pointerType === 'mouse' && interactable && interactable.options.styleCursor)) {\n // clear previous target element cursor\n if (scope.autoStart.cursorElement) {\n setCursor(scope.autoStart.cursorElement, '', scope)\n }\n\n return\n }\n\n let cursor = ''\n\n if (prepared.name) {\n const cursorChecker: Interact.CursorChecker = interactable.options[prepared.name].cursorChecker\n\n if (utils.is.func(cursorChecker)) {\n cursor = cursorChecker(prepared, interactable, element, interaction._interacting)\n }\n else {\n cursor = scope.actions.map[prepared.name].getCursor(prepared)\n }\n }\n\n setCursor(interaction.element, cursor || '', scope)\n}\n\nconst autoStart: Interact.Plugin = {\n id: 'auto-start/base',\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n install,\n listeners: {\n 'interactions:down': prepareOnDown,\n 'interactions:move': (arg, scope) => {\n prepareOnMove(arg, scope)\n startOnMove(arg, scope)\n },\n 'interactions:stop': clearCursorOnStop,\n },\n maxInteractions,\n withinInteractionLimit,\n validateAction,\n} as Interact.Plugin\n\nexport default autoStart\n","import { parentNode } from '@interactjs/utils/domUtils'\nimport * as is from '@interactjs/utils/is'\nimport autoStart from './base'\n\nfunction beforeStart ({ interaction, eventTarget, dx, dy }: Interact.SignalArgs['interactions:move'], scope: Interact.Scope) {\n if (interaction.prepared.name !== 'drag') { return }\n\n // check if a drag is in the correct axis\n const absX = Math.abs(dx)\n const absY = Math.abs(dy)\n const targetOptions = interaction.interactable.options.drag\n const startAxis = targetOptions.startAxis\n const currentAxis = (absX > absY ? 'x' : absX < absY ? 'y' : 'xy')\n\n interaction.prepared.axis = targetOptions.lockAxis === 'start'\n ? currentAxis[0] as 'x' | 'y' // always lock to one axis even if currentAxis === 'xy'\n : targetOptions.lockAxis\n\n // if the movement isn't in the startAxis of the interactable\n if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) {\n // cancel the prepared action\n interaction.prepared.name = null\n\n // then try to get a drag from another ineractable\n let element = eventTarget as Interact.Element\n\n const getDraggable = function (interactable: Interact.Interactable): Interact.Interactable | void {\n if (interactable === interaction.interactable) { return }\n\n const options = interaction.interactable.options.drag\n\n if (!options.manualStart &&\n interactable.testIgnoreAllow(options, element, eventTarget)) {\n const action = interactable.getAction(\n interaction.downPointer, interaction.downEvent, interaction, element)\n\n if (action &&\n action.name === 'drag' &&\n checkStartAxis(currentAxis, interactable) &&\n autoStart.validateAction(action, interactable, element, eventTarget, scope)) {\n return interactable\n }\n }\n }\n\n // check all interactables\n while (is.element(element)) {\n const interactable = scope.interactables.forEachMatch(element, getDraggable)\n\n if (interactable) {\n interaction.prepared.name = 'drag'\n interaction.interactable = interactable\n interaction.element = element\n break\n }\n\n element = parentNode(element) as Interact.Element\n }\n }\n}\n\nfunction checkStartAxis (startAxis: string, interactable: Interact.Interactable) {\n if (!interactable) { return false }\n\n const thisAxis = interactable.options.drag.startAxis\n\n return (startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis)\n}\n\nexport default {\n id: 'auto-start/dragAxis',\n listeners: { 'autoStart:before-start': beforeStart },\n}\n","import basePlugin from './base'\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n hold?: number\n delay?: number\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n autoStartHoldTimer?: any\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(basePlugin)\n\n defaults.perAction.hold = 0\n defaults.perAction.delay = 0\n}\n\nfunction getHoldDuration (interaction) {\n const actionName = interaction.prepared && interaction.prepared.name\n\n if (!actionName) { return null }\n\n const options = interaction.interactable.options\n\n return options[actionName].hold || options[actionName].delay\n}\n\nexport default {\n id: 'auto-start/hold',\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.autoStartHoldTimer = null\n },\n\n 'autoStart:prepared': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.autoStartHoldTimer = setTimeout(() => {\n interaction.start(interaction.prepared, interaction.interactable, interaction.element)\n }, hold)\n }\n },\n\n 'interactions:move': ({ interaction, duplicate }) => {\n if (interaction.pointerWasMoved && !duplicate) {\n clearTimeout(interaction.autoStartHoldTimer)\n }\n },\n\n // prevent regular down->move autoStart\n 'autoStart:before-start': ({ interaction }) => {\n const hold = getHoldDuration(interaction)\n\n if (hold > 0) {\n interaction.prepared.name = null\n }\n },\n },\n getHoldDuration,\n}\n","import autoStart from './base'\nimport dragAxis from './dragAxis'\nimport hold from './hold'\n\nfunction install (scope) {\n scope.usePlugin(autoStart)\n scope.usePlugin(hold)\n scope.usePlugin(dragAxis)\n}\n\nconst id = 'auto-start'\n\nexport {\n id,\n install,\n autoStart,\n hold,\n dragAxis,\n}\n","import { matchesSelector, nodeContains } from '@interactjs/utils/domUtils'\nimport events from '@interactjs/utils/events'\nimport * as is from '@interactjs/utils/is'\nimport { getWindow } from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n preventDefault: typeof preventDefault\n checkAndPreventDefault: (event: Event) => void\n }\n}\n\nfunction preventDefault (this: Interact.Interactable, newValue?: 'always' | 'never' | 'auto') {\n if (/^(always|never|auto)$/.test(newValue)) {\n this.options.preventDefault = newValue\n return this\n }\n\n if (is.bool(newValue)) {\n this.options.preventDefault = newValue ? 'always' : 'never'\n return this\n }\n\n return this.options.preventDefault\n}\n\nfunction checkAndPreventDefault (interactable: Interact.Interactable, scope: Interact.Scope, event: Event) {\n const setting = interactable.options.preventDefault\n\n if (setting === 'never') { return }\n\n if (setting === 'always') {\n event.preventDefault()\n return\n }\n\n // setting === 'auto'\n\n // if the browser supports passive event listeners and isn't running on iOS,\n // don't preventDefault of touch{start,move} events. CSS touch-action and\n // user-select should be used instead of calling event.preventDefault().\n if (events.supportsPassive && /^touch(start|move)$/.test(event.type)) {\n const doc = getWindow(event.target).document\n const docOptions = scope.getDocOptions(doc)\n\n if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {\n return\n }\n }\n\n // don't preventDefault of pointerdown events\n if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {\n return\n }\n\n // don't preventDefault on editable elements\n if (is.element(event.target) &&\n matchesSelector(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {\n return\n }\n\n event.preventDefault()\n}\n\nfunction onInteractionEvent ({ interaction, event }: { interaction: Interact.Interaction, event: Interact.PointerEventType }) {\n if (interaction.interactable) {\n interaction.interactable.checkAndPreventDefault(event as Event)\n }\n}\n\nexport function install (scope: Interact.Scope) {\n /** @lends Interactable */\n const { Interactable } = scope\n\n /**\n * Returns or sets whether to prevent the browser's default behaviour in\n * response to pointer events. Can be set to:\n * - `'always'` to always prevent\n * - `'never'` to never prevent\n * - `'auto'` to let interact.js try to determine what would be best\n *\n * @param {string} [newValue] `'always'`, `'never'` or `'auto'`\n * @return {string | Interactable} The current setting or this Interactable\n */\n Interactable.prototype.preventDefault = preventDefault\n\n Interactable.prototype.checkAndPreventDefault = function (event) {\n return checkAndPreventDefault(this, scope, event)\n }\n\n // prevent native HTML5 drag on interact.js target elements\n scope.interactions.docEvents.push({\n type: 'dragstart',\n listener (event) {\n for (const interaction of scope.interactions.list) {\n if (interaction.element &&\n (interaction.element === event.target ||\n nodeContains(interaction.element, event.target))) {\n interaction.interactable.checkAndPreventDefault(event)\n return\n }\n }\n },\n })\n}\n\nexport default {\n id: 'core/interactablePreventDefault',\n install,\n listeners: ['down', 'move', 'up', 'cancel'].reduce((acc, eventType) => {\n acc[`interactions:${eventType}`] = onInteractionEvent\n return acc\n }, {} as any),\n}\n","/* eslint-disable no-console */\n/* global process */\nimport domObjects from '@interactjs/utils/domObjects'\nimport { parentNode } from '@interactjs/utils/domUtils'\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport win from '@interactjs/utils/window'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n logger: Logger\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface BaseDefaults {\n devTools?: DevToolsOptions\n }\n}\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n devTools?: Interact.OptionMethod\n }\n}\n\nexport interface DevToolsOptions {\n ignore: { [P in keyof typeof CheckName]?: boolean }\n}\n\nexport interface Logger {\n warn: (...args: any[]) => void\n error: (...args: any[]) => void\n log: (...args: any[]) => void\n}\n\nexport interface Check {\n name: CheckName\n text: string\n perform: (interaction: Interact.Interaction) => boolean\n getInfo: (interaction: Interact.Interaction) => any[]\n}\n\nenum CheckName {\n touchAction = 'touchAction',\n boxSizing = 'boxSizing',\n noListeners = 'noListeners',\n}\n\nconst prefix = '[interact.js] '\nconst links = {\n touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action',\n boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing',\n}\n\nconst isProduction = process.env.NODE_ENV === 'production'\n\n// eslint-disable-next-line no-restricted-syntax\nfunction install (scope: Interact.Scope, { logger }: { logger?: Logger } = {}) {\n const {\n Interactable,\n defaults,\n } = scope\n\n scope.logger = logger || console\n\n defaults.base.devTools = {\n ignore: {},\n }\n\n Interactable.prototype.devTools = function (options?: object) {\n if (options) {\n extend(this.options.devTools, options)\n return this\n }\n\n return this.options.devTools\n }\n}\n\nconst checks: Check[] = [\n {\n name: CheckName.touchAction,\n perform ({ element }) {\n return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/)\n },\n getInfo ({ element }) {\n return [\n element,\n links.touchAction,\n ]\n },\n text: 'Consider adding CSS \"touch-action: none\" to this element\\n',\n },\n\n {\n name: CheckName.boxSizing,\n perform (interaction) {\n const { element } = interaction\n\n return interaction.prepared.name === 'resize' &&\n element instanceof domObjects.HTMLElement &&\n !hasStyle(element, 'boxSizing', /border-box/)\n },\n text: 'Consider adding CSS \"box-sizing: border-box\" to this resizable element',\n getInfo ({ element }) {\n return [\n element,\n links.boxSizing,\n ]\n },\n },\n\n {\n name: CheckName.noListeners,\n perform (interaction) {\n const actionName = interaction.prepared.name\n const moveListeners = interaction.interactable.events.types[`${actionName}move`] || []\n\n return !moveListeners.length\n },\n getInfo (interaction) {\n return [\n interaction.prepared.name,\n interaction.interactable,\n ]\n },\n text: 'There are no listeners set for this action',\n },\n]\n\nfunction hasStyle (element: HTMLElement, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n return styleRe.test(element.style[prop] || win.window.getComputedStyle(element)[prop])\n}\n\nfunction parentHasStyle (element: Interact.Element, prop: keyof CSSStyleDeclaration, styleRe: RegExp) {\n let parent = element as HTMLElement\n\n while (is.element(parent)) {\n if (hasStyle(parent, prop, styleRe)) {\n return true\n }\n\n parent = parentNode(parent) as HTMLElement\n }\n\n return false\n}\n\nconst id = 'dev-tools'\nconst defaultExport: Interact.Plugin = isProduction\n ? { id, install: () => {} }\n : {\n id,\n install,\n listeners: {\n 'interactions:action-start': ({ interaction }, scope) => {\n for (const check of checks) {\n const options = interaction.interactable && interaction.interactable.options\n\n if (\n !(options && options.devTools && options.devTools.ignore[check.name]) &&\n check.perform(interaction)\n ) {\n scope.logger.warn(prefix + check.text, ...check.getInfo(interaction))\n }\n }\n },\n },\n checks,\n CheckName,\n links,\n prefix,\n }\n\nexport default defaultExport\n","import clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { Modifier, ModifierArg, ModifierState } from './base'\n\nexport interface ModificationResult {\n delta: Interact.Point\n rectDelta: Interact.Rect\n coords: Interact.Point\n rect: Interact.FullRect\n eventProps: any[]\n changed: boolean\n}\n\ninterface MethodArg {\n phase: Interact.EventPhase\n pageCoords?: Interact.Point\n rect?: Interact.FullRect\n coords?: Interact.Point\n preEnd?: boolean\n skipModifiers?: number\n}\n\nexport default class Modification {\n states: ModifierState[] = []\n startOffset: Interact.Rect = { left: 0, right: 0, top: 0, bottom: 0 }\n startDelta: Interact.Point = null\n result?: ModificationResult = null\n endResult?: Interact.Point = null\n edges: Interact.EdgeOptions\n\n constructor (readonly interaction: Readonly) {}\n\n start (\n { phase }: MethodArg,\n pageCoords: Interact.Point,\n ) {\n const { interaction } = this\n const modifierList = getModifierList(interaction)\n this.prepareStates(modifierList)\n\n this.edges = extend({}, interaction.edges)\n this.startOffset = getRectOffset(interaction.rect, pageCoords)\n this.startDelta = { x: 0, y: 0 }\n\n const arg: MethodArg = {\n phase,\n pageCoords,\n preEnd: false,\n }\n\n this.result = createResult()\n this.startAll(arg)\n\n const result = this.result = this.setAll(arg)\n\n return result\n }\n\n fillArg (arg: Partial) {\n const { interaction } = this\n\n arg.interaction = interaction\n arg.interactable = interaction.interactable\n arg.element = interaction.element\n arg.rect = arg.rect || interaction.rect\n arg.edges = this.edges\n arg.startOffset = this.startOffset\n }\n\n startAll (arg: MethodArg & Partial) {\n this.fillArg(arg)\n\n for (const state of this.states) {\n if (state.methods.start) {\n arg.state = state\n state.methods.start(arg as ModifierArg)\n }\n }\n }\n\n setAll (arg: MethodArg & Partial): ModificationResult {\n this.fillArg(arg)\n\n const {\n phase,\n preEnd,\n skipModifiers,\n rect: unmodifiedRect,\n } = arg\n\n arg.coords = extend({}, arg.pageCoords)\n arg.rect = extend({}, unmodifiedRect)\n\n const states = skipModifiers\n ? this.states.slice(skipModifiers)\n : this.states\n\n const newResult = createResult(arg.coords, arg.rect)\n\n for (const state of states) {\n const { options } = state\n const lastModifierCoords = extend({}, arg.coords)\n let returnValue = null\n\n if (state.methods.set && this.shouldDo(options, preEnd, phase)) {\n arg.state = state\n returnValue = state.methods.set(arg as ModifierArg)\n\n rectUtils.addEdges(this.interaction.edges, arg.rect, { x: arg.coords.x - lastModifierCoords.x, y: arg.coords.y - lastModifierCoords.y })\n }\n\n newResult.eventProps.push(returnValue)\n }\n\n newResult.delta.x = arg.coords.x - arg.pageCoords.x\n newResult.delta.y = arg.coords.y - arg.pageCoords.y\n\n newResult.rectDelta.left = arg.rect.left - unmodifiedRect.left\n newResult.rectDelta.right = arg.rect.right - unmodifiedRect.right\n newResult.rectDelta.top = arg.rect.top - unmodifiedRect.top\n newResult.rectDelta.bottom = arg.rect.bottom - unmodifiedRect.bottom\n\n const prevCoords = this.result.coords\n const prevRect = this.result.rect\n const rectChanged = !prevRect || newResult.rect.left !== prevRect.left ||\n newResult.rect.right !== prevRect.right ||\n newResult.rect.top !== prevRect.top ||\n newResult.rect.bottom !== prevRect.bottom\n\n newResult.changed = rectChanged ||\n prevCoords.x !== newResult.coords.x ||\n prevCoords.y !== newResult.coords.y\n\n newResult.rect = arg.rect\n return newResult\n }\n\n applyToInteraction (arg: { phase: Interact.EventPhase, rect?: Interact.Rect }) {\n const { interaction } = this\n const { phase } = arg\n const curCoords = interaction.coords.cur\n const startCoords = interaction.coords.start\n const { result, startDelta } = this\n const curDelta = result.delta\n\n if (phase === 'start') {\n extend(this.startDelta, result.delta)\n }\n\n for (const [coordsSet, delta] of [[startCoords, startDelta], [curCoords, curDelta]] as const) {\n coordsSet.page.x += delta.x\n coordsSet.page.y += delta.y\n coordsSet.client.x += delta.x\n coordsSet.client.y += delta.y\n }\n\n const { rectDelta } = this.result\n const rect = arg.rect || interaction.rect\n\n rect.left += rectDelta.left\n rect.right += rectDelta.right\n rect.top += rectDelta.top\n rect.bottom += rectDelta.bottom\n\n rect.width = rect.right - rect.left\n rect.height = rect.bottom - rect.top\n }\n\n setAndApply (arg: Partial & {\n phase: Interact.EventPhase\n preEnd?: boolean\n skipModifiers?: number\n modifiedCoords?: Interact.Point\n }): void | false {\n const { interaction } = this\n const { phase, preEnd, skipModifiers } = arg\n\n const result = this.setAll({\n preEnd,\n phase,\n pageCoords: arg.modifiedCoords || interaction.coords.cur.page,\n })\n\n this.result = result\n\n // don't fire an action move if a modifier would keep the event in the same\n // cordinates as before\n if (!result.changed && (!skipModifiers || skipModifiers < this.states.length) && interaction.interacting()) {\n return false\n }\n\n if (arg.modifiedCoords) {\n const { page } = interaction.coords.cur\n const adjustment = {\n x: arg.modifiedCoords.x - page.x,\n y: arg.modifiedCoords.y - page.y,\n }\n\n result.coords.x += adjustment.x\n result.coords.y += adjustment.y\n result.delta.x += adjustment.x\n result.delta.y += adjustment.y\n }\n\n this.applyToInteraction(arg)\n }\n\n beforeEnd (arg: Omit & { state?: ModifierState }): void | false {\n const { interaction, event } = arg\n const states = this.states\n\n if (!states || !states.length) {\n return\n }\n\n let doPreend = false\n\n for (const state of states) {\n arg.state = state\n const { options, methods } = state\n\n const endPosition = methods.beforeEnd && methods.beforeEnd(arg as unknown as ModifierArg)\n\n if (endPosition) {\n this.endResult = endPosition\n return false\n }\n\n doPreend = doPreend || (!doPreend && this.shouldDo(options, true))\n }\n\n if (!doPreend) {\n // trigger a final modified move before ending\n interaction.move({ event, preEnd: true })\n }\n }\n\n stop (arg: { interaction: Interact.Interaction }) {\n const { interaction } = arg\n\n if (!this.states || !this.states.length) {\n return\n }\n\n const modifierArg: Partial = extend({\n states: this.states,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: null,\n }, arg)\n\n this.fillArg(modifierArg)\n\n for (const state of this.states) {\n modifierArg.state = state\n\n if (state.methods.stop) { state.methods.stop(modifierArg as ModifierArg) }\n }\n\n this.states = null\n this.endResult = null\n }\n\n prepareStates (modifierList: Modifier[]) {\n this.states = []\n\n for (let index = 0; index < modifierList.length; index++) {\n const { options, methods, name } = modifierList[index]\n\n if (options && options.enabled === false) { continue }\n\n this.states.push({\n options,\n methods,\n index,\n name,\n })\n }\n\n return this.states\n }\n\n restoreInteractionCoords ({ interaction: { coords, rect, modification } }: { interaction: Interact.Interaction }) {\n if (!modification.result) { return }\n\n const { startDelta } = modification\n const { delta: curDelta, rectDelta } = modification.result\n\n const coordsAndDeltas = [\n [coords.start, startDelta],\n [coords.cur, curDelta],\n ]\n\n for (const [coordsSet, delta] of coordsAndDeltas as any) {\n coordsSet.page.x -= delta.x\n coordsSet.page.y -= delta.y\n coordsSet.client.x -= delta.x\n coordsSet.client.y -= delta.y\n }\n\n rect.left -= rectDelta.left\n rect.right -= rectDelta.right\n rect.top -= rectDelta.top\n rect.bottom -= rectDelta.bottom\n }\n\n shouldDo (options, preEnd?: boolean, phase?: string) {\n return options\n ? options.enabled !== false &&\n (preEnd || !options.endOnly) &&\n (options.setStart || phase !== 'start')\n : true\n }\n\n copyFrom (other: Modification) {\n this.startOffset = other.startOffset\n this.startDelta = other.startDelta\n this.edges = other.edges\n this.states = other.states.map(s => clone(s) as ModifierState)\n this.result = createResult(extend({}, other.result.coords), extend({}, other.result.rect))\n }\n\n destroy () {\n for (const prop in this) {\n this[prop] = null\n }\n }\n}\n\nfunction createResult (coords?: Interact.Point, rect?: Interact.FullRect): ModificationResult {\n return {\n rect,\n coords,\n delta: { x: 0, y: 0 },\n rectDelta: {\n left : 0,\n right : 0,\n top : 0,\n bottom: 0,\n },\n eventProps: [],\n changed: true,\n }\n}\n\nfunction getModifierList (interaction) {\n const actionOptions = interaction.interactable.options[interaction.prepared.name]\n const actionModifiers = actionOptions.modifiers\n\n if (actionModifiers && actionModifiers.length) {\n return actionModifiers.filter(\n modifier => !modifier.options || modifier.options.enabled !== false,\n )\n }\n\n return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize']\n .map(type => {\n const options = actionOptions[type]\n\n return options && options.enabled && {\n options,\n methods: options._methods,\n }\n })\n .filter(m => !!m)\n}\n\nexport function getRectOffset (rect, coords) {\n return rect\n ? {\n left : coords.x - rect.left,\n top : coords.y - rect.top,\n right : rect.right - coords.x,\n bottom: rect.bottom - coords.y,\n }\n : {\n left : 0,\n top : 0,\n right : 0,\n bottom: 0,\n }\n}\n","import Modification from './Modification'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n modifiers?: any\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n modification?: Modification\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n interface InteractEvent {\n modifiers?: Array<{\n name: string\n [key: string]: any\n }>\n }\n}\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n modifiers?: Modifier[]\n }\n}\n\nexport interface Modifier<\n Defaults = any,\n State extends ModifierState = any,\n Name extends string = any\n> {\n options?: Defaults\n methods: {\n start?: (arg: ModifierArg) => void\n set: (arg: ModifierArg) => void\n beforeEnd?: (arg: ModifierArg) => Interact.Point | void\n stop?: (arg: ModifierArg) => void\n }\n name?: Name\n}\n\nexport type ModifierState<\n Defaults = {},\n StateProps extends { [prop: string]: any } = {},\n Name extends string = any\n> = {\n options: Defaults\n methods?: Modifier['methods']\n index?: number\n name?: Name\n} & StateProps\n\nexport interface ModifierArg {\n interaction: Interact.Interaction\n interactable: Interact.Interactable\n phase: Interact.EventPhase\n rect: Interact.FullRect\n edges: Interact.EdgeOptions\n state?: State\n element: Interact.Element\n pageCoords?: Interact.Point\n prevCoords?: Interact.Point\n prevRect?: Interact.FullRect\n coords?: Interact.Point\n startOffset?: Interact.Rect\n preEnd?: boolean\n}\n\nexport interface ModifierModule<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n> {\n defaults?: Defaults\n start? (arg: ModifierArg): void\n set? (arg: ModifierArg): any\n beforeEnd? (arg: ModifierArg): Interact.Point | void\n stop? (arg: ModifierArg): void\n}\n\nexport function makeModifier<\n Defaults extends { enabled?: boolean },\n State extends ModifierState,\n Name extends string\n> (\n module: ModifierModule,\n name?: Name,\n) {\n const { defaults } = module\n const methods = {\n start: module.start,\n set: module.set,\n beforeEnd: module.beforeEnd,\n stop: module.stop,\n }\n\n const modifier = (_options?: Partial) => {\n const options: Defaults = (_options || {}) as Defaults\n\n options.enabled = options.enabled !== false\n\n // add missing defaults to options\n for (const prop in defaults) {\n if (!(prop in options)) {\n options[prop] = defaults[prop]\n }\n }\n\n const m: Modifier = { options, methods, name }\n\n return m\n }\n\n if (name && typeof name === 'string') {\n // for backwrads compatibility\n modifier._defaults = defaults\n modifier._methods = methods\n }\n\n return modifier\n}\n\nexport function addEventModifiers ({ iEvent, interaction: { modification: { result } } }: {\n iEvent: Interact.InteractEvent\n interaction: Interact.Interaction\n}) {\n if (result) {\n iEvent.modifiers = result.eventProps\n }\n}\n\nconst modifiersBase: Interact.Plugin = {\n id: 'modifiers/base',\n install: scope => {\n scope.defaults.perAction.modifiers = []\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.modification = new Modification(interaction)\n },\n\n 'interactions:before-action-start': arg => {\n const { modification } = arg.interaction\n\n modification.start(arg, arg.interaction.coords.start.page)\n arg.interaction.edges = modification.edges\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-move': arg => arg.interaction.modification.setAndApply(arg),\n\n 'interactions:before-action-end': arg => arg.interaction.modification.beforeEnd(arg),\n\n 'interactions:action-start': addEventModifiers,\n 'interactions:action-move': addEventModifiers,\n 'interactions:action-end': addEventModifiers,\n\n 'interactions:after-action-start': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-move': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n\n 'interactions:stop': arg => arg.interaction.modification.stop(arg),\n },\n before: ['actions', 'action/drag', 'actions/resize', 'actions/gesture'],\n}\n\nexport default modifiersBase\n","import { _ProxyMethods } from '@interactjs/core/Interaction'\nimport * as rectUtils from '@interactjs/utils/rect'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n offsetBy?: typeof offsetBy\n offset: {\n total: Interact.Point\n pending: Interact.Point\n }\n }\n\n // eslint-disable-next-line no-shadow\n enum _ProxyMethods {\n // eslint-disable-next-line no-shadow\n offsetBy = ''\n }\n}\n\n(_ProxyMethods as any).offsetBy = ''\n\nexport function addTotal (interaction: Interact.Interaction) {\n if (!interaction.pointerIsDown) { return }\n\n addToCoords(interaction.coords.cur, interaction.offset.total)\n\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nfunction beforeAction ({ interaction }: { interaction: Interact.Interaction }) {\n applyPending(interaction)\n}\n\nfunction beforeEnd ({ interaction }: { interaction: Interact.Interaction }): boolean | void {\n const hadPending = applyPending(interaction)\n\n if (!hadPending) { return }\n\n interaction.move({ offset: true })\n interaction.end()\n\n return false\n}\n\nfunction end ({ interaction }: { interaction: Interact.Interaction }) {\n interaction.offset.total.x = 0\n interaction.offset.total.y = 0\n interaction.offset.pending.x = 0\n interaction.offset.pending.y = 0\n}\n\nexport function applyPending (interaction: Interact.Interaction) {\n if (!hasPending(interaction)) {\n return false\n }\n\n const { pending } = interaction.offset\n\n addToCoords(interaction.coords.cur, pending)\n addToCoords(interaction.coords.delta, pending)\n rectUtils.addEdges(interaction.edges, interaction.rect, pending)\n\n pending.x = 0\n pending.y = 0\n\n return true\n}\n\nfunction offsetBy (this: Interact.Interaction, { x, y }: Interact.Point) {\n this.offset.pending.x += x\n this.offset.pending.y += y\n\n this.offset.total.x += x\n this.offset.total.y += y\n}\n\nfunction addToCoords ({ page, client }, { x, y }: Interact.Point) {\n page.x += x\n page.y += y\n client.x += x\n client.y += y\n}\n\nfunction hasPending (interaction) {\n return !!(interaction.offset.pending.x || interaction.offset.pending.y)\n}\n\nconst offset: Interact.Plugin = {\n id: 'offset',\n install (scope) {\n scope.Interaction.prototype.offsetBy = offsetBy\n },\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.offset = {\n total: { x: 0, y: 0 },\n pending: { x: 0, y: 0 },\n }\n },\n 'interactions:update-pointer': ({ interaction }) => addTotal(interaction),\n 'interactions:before-action-start': beforeAction,\n 'interactions:before-action-move': beforeAction,\n 'interactions:before-action-end': beforeEnd,\n 'interactions:stop': end,\n },\n}\n\nexport default offset\n","import * as modifiers from '@interactjs/modifiers/base'\nimport Modification from '@interactjs/modifiers/Modification'\nimport offset from '@interactjs/offset'\nimport * as dom from '@interactjs/utils/domUtils'\nimport hypot from '@interactjs/utils/hypot'\nimport * as is from '@interactjs/utils/is'\nimport { copyCoords } from '@interactjs/utils/pointerUtils'\nimport raf from '@interactjs/utils/raf'\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n resume?: true\n inertiastart?: true\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n inertia?: InertiaState\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface PerActionDefaults {\n inertia?: {\n enabled?: boolean\n resistance?: number // the lambda in exponential decay\n minSpeed?: number // target speed must be above this for inertia to start\n endSpeed?: number // the speed at which inertia is slow enough to stop\n allowResume?: true // allow resuming an action in inertia phase\n smoothEndDuration?: number // animate to snap/restrict endOnly if there's no inertia\n }\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'interactions:before-action-inertiastart': Omit, 'iEvent'>\n 'interactions:action-inertiastart': Interact.DoPhaseArg\n 'interactions:after-action-inertiastart': Interact.DoPhaseArg\n 'interactions:before-action-resume': Omit, 'iEvent'>\n 'interactions:action-resume': Interact.DoPhaseArg\n 'interactions:after-action-resume': Interact.DoPhaseArg\n }\n}\n\nfunction install (scope: Interact.Scope) {\n const {\n defaults,\n } = scope\n\n scope.usePlugin(offset)\n scope.usePlugin(modifiers.default)\n scope.actions.phases.inertiastart = true\n scope.actions.phases.resume = true\n\n defaults.perAction.inertia = {\n enabled : false,\n resistance : 10, // the lambda in exponential decay\n minSpeed : 100, // target speed must be above this for inertia to start\n endSpeed : 10, // the speed at which inertia is slow enough to stop\n allowResume : true, // allow resuming an action in inertia phase\n smoothEndDuration: 300, // animate to snap/restrict endOnly if there's no inertia\n }\n}\n\nexport class InertiaState {\n active = false\n isModified = false\n smoothEnd = false\n allowResume = false\n\n modification: Modification = null\n modifierCount = 0\n modifierArg: modifiers.ModifierArg = null\n\n startCoords: Interact.Point = null\n t0 = 0\n v0 = 0\n\n te = 0\n targetOffset: Interact.Point = null\n modifiedOffset: Interact.Point = null\n currentOffset: Interact.Point = null\n\n lambda_v0? = 0 // eslint-disable-line camelcase\n one_ve_v0? = 0 // eslint-disable-line camelcase\n timeout: number = null\n\n constructor (\n private readonly interaction: Interact.Interaction,\n ) {}\n\n start (event: Interact.PointerEventType) {\n const { interaction } = this\n const options = getOptions(interaction)\n\n if (!options || !options.enabled) {\n return false\n }\n\n const { client: velocityClient } = interaction.coords.velocity\n const pointerSpeed = hypot(velocityClient.x, velocityClient.y)\n const modification = this.modification || (this.modification = new Modification(interaction))\n\n modification.copyFrom(interaction.modification)\n\n this.t0 = interaction._now()\n this.allowResume = options.allowResume\n this.v0 = pointerSpeed\n this.currentOffset = { x: 0, y: 0 }\n this.startCoords = interaction.coords.cur.page\n\n this.modifierArg = {\n interaction,\n interactable: interaction.interactable,\n element: interaction.element,\n rect: interaction.rect,\n edges: interaction.edges,\n pageCoords: this.startCoords,\n preEnd: true,\n phase: 'inertiastart',\n }\n\n const thrown = (\n (this.t0 - interaction.coords.cur.timeStamp) < 50 &&\n pointerSpeed > options.minSpeed &&\n pointerSpeed > options.endSpeed\n )\n\n if (thrown) {\n this.startInertia()\n } else {\n modification.result = modification.setAll(this.modifierArg)\n\n if (!modification.result.changed) {\n return false\n }\n\n this.startSmoothEnd()\n }\n\n // force modification change\n interaction.modification.result.rect = null\n\n // bring inertiastart event to the target coords\n interaction.offsetBy(this.targetOffset)\n interaction._doPhase({\n interaction,\n event,\n phase: 'inertiastart',\n })\n interaction.offsetBy({ x: -this.targetOffset.x, y: -this.targetOffset.y })\n // force modification change\n interaction.modification.result.rect = null\n\n this.active = true\n interaction.simulation = this\n\n return true\n }\n\n startInertia () {\n const startVelocity = this.interaction.coords.velocity.client\n const options = getOptions(this.interaction)\n const lambda = options.resistance\n const inertiaDur = -Math.log(options.endSpeed / this.v0) / lambda\n\n this.targetOffset = {\n x: (startVelocity.x - inertiaDur) / lambda,\n y: (startVelocity.y - inertiaDur) / lambda,\n }\n\n this.te = inertiaDur\n this.lambda_v0 = lambda / this.v0\n this.one_ve_v0 = 1 - options.endSpeed / this.v0\n\n const { modification, modifierArg } = this\n\n modifierArg.pageCoords = {\n x: this.startCoords.x + this.targetOffset.x,\n y: this.startCoords.y + this.targetOffset.y,\n }\n\n modification.result = modification.setAll(modifierArg)\n\n if (modification.result.changed) {\n this.isModified = true\n this.modifiedOffset = {\n x: this.targetOffset.x + modification.result.delta.x,\n y: this.targetOffset.y + modification.result.delta.y,\n }\n }\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n\n startSmoothEnd () {\n this.smoothEnd = true\n this.isModified = true\n this.targetOffset = {\n x: this.modification.result.delta.x,\n y: this.modification.result.delta.y,\n }\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n\n inertiaTick () {\n const { interaction } = this\n const options = getOptions(interaction)\n const lambda = options.resistance\n const t = (interaction._now() - this.t0) / 1000\n\n if (t < this.te) {\n const progress = 1 - (Math.exp(-lambda * t) - this.lambda_v0) / this.one_ve_v0\n let newOffset: Interact.Point\n\n if (this.isModified) {\n newOffset = getQuadraticCurvePoint(\n 0, 0,\n this.targetOffset.x, this.targetOffset.y,\n this.modifiedOffset.x, this.modifiedOffset.y,\n progress,\n )\n }\n else {\n newOffset = {\n x: this.targetOffset.x * progress,\n y: this.targetOffset.y * progress,\n }\n }\n\n const delta = { x: newOffset.x - this.currentOffset.x, y: newOffset.y - this.currentOffset.y }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move()\n\n this.timeout = raf.request(() => this.inertiaTick())\n }\n else {\n interaction.offsetBy({\n x: this.modifiedOffset.x - this.currentOffset.x,\n y: this.modifiedOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n smoothEndTick () {\n const { interaction } = this\n const t = interaction._now() - this.t0\n const { smoothEndDuration: duration } = getOptions(interaction)\n\n if (t < duration) {\n const newOffset = {\n x: easeOutQuad(t, 0, this.targetOffset.x, duration),\n y: easeOutQuad(t, 0, this.targetOffset.y, duration),\n }\n const delta = {\n x: newOffset.x - this.currentOffset.x,\n y: newOffset.y - this.currentOffset.y,\n }\n\n this.currentOffset.x += delta.x\n this.currentOffset.y += delta.y\n\n interaction.offsetBy(delta)\n interaction.move({ skipModifiers: this.modifierCount })\n\n this.timeout = raf.request(() => this.smoothEndTick())\n }\n else {\n interaction.offsetBy({\n x: this.targetOffset.x - this.currentOffset.x,\n y: this.targetOffset.y - this.currentOffset.y,\n })\n\n this.end()\n }\n }\n\n resume ({ pointer, event, eventTarget }: Interact.SignalArgs['interactions:down']) {\n const { interaction } = this\n\n // undo inertia changes to interaction coords\n interaction.offsetBy({\n x: -this.currentOffset.x,\n y: -this.currentOffset.y,\n })\n\n // update pointer at pointer down position\n interaction.updatePointer(pointer, event, eventTarget, true)\n\n // fire resume signals and event\n interaction._doPhase({\n interaction,\n event,\n phase: 'resume',\n })\n copyCoords(interaction.coords.prev, interaction.coords.cur)\n\n this.stop()\n }\n\n end () {\n this.interaction.move()\n this.interaction.end()\n this.stop()\n }\n\n stop () {\n this.active = this.smoothEnd = false\n this.interaction.simulation = null\n raf.cancel(this.timeout)\n }\n}\n\nfunction start ({ interaction, event }: Interact.DoPhaseArg) {\n if (!interaction._interacting || interaction.simulation) {\n return null\n }\n\n const started = interaction.inertia.start(event)\n\n // prevent action end if inertia or smoothEnd\n return started ? false : null\n}\n\n// Check if the down event hits the current inertia target\n// control should be return to the user\nfunction resume (arg: Interact.SignalArgs['interactions:down']) {\n const { interaction, eventTarget } = arg\n const state = interaction.inertia\n\n if (!state.active) { return }\n\n let element = eventTarget as Node\n\n // climb up the DOM tree from the event target\n while (is.element(element)) {\n // if interaction element is the current inertia target element\n if (element === interaction.element) {\n state.resume(arg)\n break\n }\n\n element = dom.parentNode(element)\n }\n}\n\nfunction stop ({ interaction }: { interaction: Interact.Interaction }) {\n const state = interaction.inertia\n\n if (state.active) {\n state.stop()\n }\n}\n\nfunction getOptions ({ interactable, prepared }: Interact.Interaction) {\n return interactable &&\n interactable.options &&\n prepared.name &&\n interactable.options[prepared.name].inertia\n}\n\nconst inertia: Interact.Plugin = {\n id: 'inertia',\n before: ['modifiers/base'],\n install,\n listeners: {\n 'interactions:new': ({ interaction }) => {\n interaction.inertia = new InertiaState(interaction)\n },\n\n 'interactions:before-action-end': start,\n 'interactions:down': resume,\n 'interactions:stop': stop,\n\n 'interactions:before-action-resume': arg => {\n const { modification } = arg.interaction\n\n modification.stop(arg)\n modification.start(arg, arg.interaction.coords.cur.page)\n modification.applyToInteraction(arg)\n },\n\n 'interactions:before-action-inertiastart': arg => arg.interaction.modification.setAndApply(arg),\n 'interactions:action-resume': modifiers.addEventModifiers,\n 'interactions:action-inertiastart': modifiers.addEventModifiers,\n 'interactions:after-action-inertiastart': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n 'interactions:after-action-resume': arg => arg.interaction.modification.restoreInteractionCoords(arg),\n },\n}\n\n// http://stackoverflow.com/a/5634528/2280888\nfunction _getQBezierValue (t: number, p1: number, p2: number, p3: number) {\n const iT = 1 - t\n return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3\n}\n\nfunction getQuadraticCurvePoint (\n startX: number, startY: number, cpX: number, cpY: number, endX: number, endY: number, position: number) {\n return {\n x: _getQBezierValue(position, startX, cpX, endX),\n y: _getQBezierValue(position, startY, cpY, endY),\n }\n}\n\n// http://gizma.com/easing/\nfunction easeOutQuad (t: number, b: number, c: number, d: number) {\n t /= d\n return -c * t * (t - 2) + b\n}\n\nexport default inertia\n","/* eslint-disable */\n\n/**\n * @module modifiers/aspectRatio\n *\n * @description\n * This module forces elements to be resized with a specified dx/dy ratio.\n *\n * @example\n * interact(target).resizable({\n * modifiers: [\n * interact.modifiers.snapSize({\n * targets: [ interact.createSnapGrid({ x: 20, y: 20 }) ],\n * }),\n * interact.aspectRatio({ ratio: 'preserve' }),\n * ],\n * });\n */\n\nimport extend from '@interactjs/utils/extend'\nimport { addEdges } from '@interactjs/utils/rect'\nimport { Modifier, ModifierModule, ModifierState } from './base'\nimport Modification from './Modification'\n\nexport interface AspectRatioOptions {\n ratio?: number | 'preserve'\n equalDelta?: boolean\n modifiers?: Modifier[]\n enabled?: boolean\n}\n\nexport type AspectRatioState = ModifierState\n\nconst aspectRatio: ModifierModule = {\n start (arg) {\n const { state, rect, edges: originalEdges, pageCoords: coords } = arg\n let { ratio } = state.options\n const { equalDelta, modifiers } = state.options\n\n if (ratio === 'preserve') {\n ratio = rect.width / rect.height\n }\n\n state.startCoords = extend({}, coords)\n state.startRect = extend({}, rect)\n state.ratio = ratio\n state.equalDelta = equalDelta\n\n const linkedEdges = state.linkedEdges = {\n top : originalEdges.top || (originalEdges.left && !originalEdges.bottom),\n left : originalEdges.left || (originalEdges.top && !originalEdges.right),\n bottom: originalEdges.bottom || (originalEdges.right && !originalEdges.top),\n right : originalEdges.right || (originalEdges.bottom && !originalEdges.left),\n }\n\n state.xIsPrimaryAxis = !!(originalEdges.left || originalEdges.right)\n\n if (state.equalDelta) {\n state.edgeSign = (linkedEdges.left ? 1 : -1) * (linkedEdges.top ? 1 : -1) as 1 | -1\n }\n else {\n const negativeSecondaryEdge = state.xIsPrimaryAxis ? linkedEdges.top : linkedEdges.left\n state.edgeSign = negativeSecondaryEdge ? -1 : 1\n }\n\n extend(arg.edges, linkedEdges)\n\n if (!modifiers || !modifiers.length) { return }\n\n const subModification = new Modification(arg.interaction)\n\n subModification.copyFrom(arg.interaction.modification)\n subModification.prepareStates(modifiers)\n\n state.subModification = subModification\n subModification.startAll({ ...arg })\n },\n\n set (arg) {\n const { state, rect, coords } = arg\n const initialCoords = extend({}, coords)\n const aspectMethod = state.equalDelta ? setEqualDelta : setRatio\n\n aspectMethod(state, state.xIsPrimaryAxis, coords, rect)\n\n if (!state.subModification) { return null }\n\n const correctedRect = extend({}, rect)\n\n addEdges(state.linkedEdges, correctedRect, { x: coords.x - initialCoords.x, y: coords.y - initialCoords.y })\n\n const result = state.subModification.setAll({\n ...arg,\n rect: correctedRect,\n edges: state.linkedEdges,\n pageCoords: coords,\n prevCoords: coords,\n prevRect: correctedRect,\n })\n\n const { delta } = result\n\n if (result.changed) {\n const xIsCriticalAxis = Math.abs(delta.x) > Math.abs(delta.y)\n\n // do aspect modification again with critical edge axis as primary\n aspectMethod(state, xIsCriticalAxis, result.coords, result.rect)\n extend(coords, result.coords)\n }\n\n return result.eventProps\n },\n\n defaults: {\n ratio: 'preserve',\n equalDelta: false,\n modifiers: [],\n enabled: false,\n },\n}\n\nfunction setEqualDelta ({ startCoords, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point) {\n if (xIsPrimaryAxis) {\n coords.y = startCoords.y + (coords.x - startCoords.x) * edgeSign\n }\n else {\n coords.x = startCoords.x + (coords.y - startCoords.y) * edgeSign\n }\n}\n\nfunction setRatio ({ startRect, startCoords, ratio, edgeSign }: AspectRatioState, xIsPrimaryAxis: boolean, coords: Interact.Point, rect: Interact.Rect) {\n if (xIsPrimaryAxis) {\n const newHeight = rect.width / ratio\n\n coords.y = startCoords.y + (newHeight - startRect.height) * edgeSign\n }\n else {\n const newWidth = rect.height * ratio\n\n coords.x = startCoords.x + (newWidth - startRect.width) * edgeSign\n }\n}\n\nexport default aspectRatio\n","import extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierModule, ModifierState } from '../base'\n\nexport interface RestrictOptions {\n // where to drag over\n restriction: Interact.RectResolvable<[number, number, Interact.Interaction]>\n // what part of self is allowed to drag over\n elementRect: Interact.Rect\n offset: Interact.Rect\n // restrict just before the end drag\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictState = ModifierState\n\nfunction start ({ rect, startOffset, state, interaction, pageCoords }: ModifierArg) {\n const { options } = state\n const { elementRect } = options\n const offset: Interact.Rect = extend({\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n }, options.offset || {})\n\n if (rect && elementRect) {\n const restriction = getRestrictionRect(options.restriction, interaction, pageCoords)\n\n if (restriction) {\n const widthDiff = (restriction.right - restriction.left) - rect.width\n const heightDiff = (restriction.bottom - restriction.top) - rect.height\n\n if (widthDiff < 0) {\n offset.left += widthDiff\n offset.right += widthDiff\n }\n if (heightDiff < 0) {\n offset.top += heightDiff\n offset.bottom += heightDiff\n }\n }\n\n offset.left += startOffset.left - (rect.width * elementRect.left)\n offset.top += startOffset.top - (rect.height * elementRect.top)\n\n offset.right += startOffset.right - (rect.width * (1 - elementRect.right))\n offset.bottom += startOffset.bottom - (rect.height * (1 - elementRect.bottom))\n }\n\n state.offset = offset\n}\n\nfunction set ({ coords, interaction, state }: ModifierArg) {\n const { options, offset } = state\n\n const restriction = getRestrictionRect(options.restriction, interaction, coords)\n\n if (!restriction) { return }\n\n const rect = rectUtils.xywhToTlbr(restriction)\n\n coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left)\n coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top)\n}\n\nexport function getRestrictionRect (\n value: Interact.RectResolvable<[number, number, Interact.Interaction]>,\n interaction: Interact.Interaction,\n coords?: Interact.Point,\n) {\n if (is.func(value)) {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction])\n } else {\n return rectUtils.resolveRectLike(value, interaction.interactable, interaction.element)\n }\n}\n\nconst defaults: RestrictOptions = {\n restriction: null,\n elementRect: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrict: ModifierModule = {\n start,\n set,\n defaults,\n}\n\nexport default restrict\n","// This module adds the options.resize.restrictEdges setting which sets min and\n// max for the top, left, bottom and right edges of the target being resized.\n//\n// interact(target).resize({\n// edges: { top: true, left: true },\n// restrictEdges: {\n// inner: { top: 200, left: 200, right: 400, bottom: 400 },\n// outer: { top: 0, left: 0, right: 600, bottom: 600 },\n// },\n// })\n\nimport extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierState } from '../base'\nimport { getRestrictionRect, RestrictOptions } from './pointer'\n\nexport interface RestrictEdgesOptions {\n inner: RestrictOptions['restriction']\n outer: RestrictOptions['restriction']\n offset?: RestrictOptions['offset']\n endOnly: boolean\n enabled?: boolean\n}\n\nexport type RestrictEdgesState = ModifierState\n\nconst noInner = { top: +Infinity, left: +Infinity, bottom: -Infinity, right: -Infinity }\nconst noOuter = { top: -Infinity, left: -Infinity, bottom: +Infinity, right: +Infinity }\n\nfunction start ({ interaction, startOffset, state }: ModifierArg) {\n const { options } = state\n let offset\n\n if (options) {\n const offsetRect = getRestrictionRect(options.offset, interaction, interaction.coords.start.page)\n\n offset = rectUtils.rectToXY(offsetRect)\n }\n\n offset = offset || { x: 0, y: 0 }\n\n state.offset = {\n top: offset.y + startOffset.top,\n left: offset.x + startOffset.left,\n bottom: offset.y - startOffset.bottom,\n right: offset.x - startOffset.right,\n }\n}\n\nfunction set ({ coords, edges, interaction, state }: ModifierArg) {\n const { offset, options } = state\n\n if (!edges) {\n return\n }\n\n const page = extend({}, coords)\n const inner = getRestrictionRect(options.inner, interaction, page) || {} as Interact.Rect\n const outer = getRestrictionRect(options.outer, interaction, page) || {} as Interact.Rect\n\n fixRect(inner, noInner)\n fixRect(outer, noOuter)\n\n if (edges.top) {\n coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top)\n }\n else if (edges.bottom) {\n coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom)\n }\n if (edges.left) {\n coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left)\n }\n else if (edges.right) {\n coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right)\n }\n}\n\nfunction fixRect (rect, defaults) {\n for (const edge of ['top', 'left', 'bottom', 'right']) {\n if (!(edge in rect)) {\n rect[edge] = defaults[edge]\n }\n }\n\n return rect\n}\n\nconst defaults: RestrictEdgesOptions = {\n inner: null,\n outer: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictEdges = {\n noInner,\n noOuter,\n start,\n set,\n defaults,\n}\n\nexport default restrictEdges\n","import extend from '../../utils/extend'\nimport restrictPointer from './pointer'\n\nconst defaults = extend({\n get elementRect () {\n return { top: 0, left: 0, bottom: 1, right: 1 }\n },\n set elementRect (_) {},\n}, restrictPointer.defaults)\n\nconst restrictRect = {\n start: restrictPointer.start,\n set: restrictPointer.set,\n defaults,\n}\n\nexport default restrictRect\n","import extend from '@interactjs/utils/extend'\nimport * as rectUtils from '@interactjs/utils/rect'\nimport { ModifierArg, ModifierState } from '../base'\nimport restrictEdges, { RestrictEdgesState } from './edges'\nimport { getRestrictionRect, RestrictOptions } from './pointer'\n\nconst noMin = { width: -Infinity, height: -Infinity }\nconst noMax = { width: +Infinity, height: +Infinity }\n\nexport interface RestrictSizeOptions {\n min?: Interact.Size | Interact.Point | RestrictOptions['restriction']\n max?: Interact.Size | Interact.Point | RestrictOptions['restriction']\n endOnly: boolean\n enabled?: boolean\n}\n\nfunction start (arg: ModifierArg) {\n return restrictEdges.start(arg)\n}\n\nexport type RestrictSizeState =\n RestrictEdgesState & ModifierState\n\nfunction set (arg: ModifierArg) {\n const { interaction, state, rect, edges } = arg\n const { options } = state\n\n if (!edges) {\n return\n }\n\n const minSize = rectUtils.tlbrToXywh(getRestrictionRect(options.min as any, interaction, arg.coords)) || noMin\n const maxSize = rectUtils.tlbrToXywh(getRestrictionRect(options.max as any, interaction, arg.coords)) || noMax\n\n state.options = {\n endOnly: options.endOnly,\n inner: extend({}, restrictEdges.noInner),\n outer: extend({}, restrictEdges.noOuter),\n }\n\n if (edges.top) {\n state.options.inner.top = rect.bottom - minSize.height\n state.options.outer.top = rect.bottom - maxSize.height\n }\n else if (edges.bottom) {\n state.options.inner.bottom = rect.top + minSize.height\n state.options.outer.bottom = rect.top + maxSize.height\n }\n if (edges.left) {\n state.options.inner.left = rect.right - minSize.width\n state.options.outer.left = rect.right - maxSize.width\n }\n else if (edges.right) {\n state.options.inner.right = rect.left + minSize.width\n state.options.outer.right = rect.left + maxSize.width\n }\n\n restrictEdges.set(arg)\n\n state.options = options\n}\n\nconst defaults: RestrictSizeOptions = {\n min: null,\n max: null,\n endOnly: false,\n enabled: false,\n}\n\nconst restrictSize = {\n start,\n set,\n defaults,\n}\n\nexport default restrictSize\n","import * as utils from '@interactjs/utils/index'\nimport { ModifierArg, ModifierState } from '../base'\n\nexport interface Offset {\n x: number\n y: number\n index: number\n relativePoint?: Interact.Point\n}\n\nexport interface SnapPosition {\n x?: number\n y?: number\n range?: number\n offset?: Offset\n [index: string]: any\n}\n\nexport type SnapFunction = (\n x: number,\n y: number,\n interaction: Interact.Interaction,\n offset: Offset,\n index: number\n) => SnapPosition\nexport type SnapTarget = SnapPosition | SnapFunction\nexport interface SnapOptions {\n targets: SnapTarget[]\n // target range\n range: number\n // self points for snapping. [0,0] = top left, [1,1] = bottom right\n relativePoints: Interact.Point[]\n // startCoords = offset snapping from drag start page position\n offset: Interact.Point | Interact.RectResolvable<[Interact.Interaction]> | 'startCoords'\n offsetWithOrigin?: boolean\n origin: Interact.RectResolvable<[Interact.Element]> | Interact.Point\n endOnly?: boolean\n enabled?: boolean\n}\n\nexport type SnapState = ModifierState\n\nfunction start (arg: ModifierArg) {\n const { interaction, interactable, element, rect, state, startOffset } = arg\n const { options } = state\n const origin = options.offsetWithOrigin\n ? getOrigin(arg)\n : { x: 0, y: 0 }\n\n let snapOffset: Interact.Point\n\n if (options.offset === 'startCoords') {\n snapOffset = {\n x: interaction.coords.start.page.x,\n y: interaction.coords.start.page.y,\n }\n }\n else {\n const offsetRect = utils.rect.resolveRectLike(options.offset as any, interactable, element, [interaction])\n\n snapOffset = utils.rect.rectToXY(offsetRect) || { x: 0, y: 0 }\n snapOffset.x += origin.x\n snapOffset.y += origin.y\n }\n\n const { relativePoints } = options\n\n state.offsets = rect && relativePoints && relativePoints.length\n ? relativePoints.map((relativePoint, index) => ({\n index,\n relativePoint,\n x: startOffset.left - (rect.width * relativePoint.x) + snapOffset.x,\n y: startOffset.top - (rect.height * relativePoint.y) + snapOffset.y,\n }))\n : [utils.extend({\n index: 0,\n relativePoint: null,\n }, snapOffset)]\n}\n\nfunction set (arg: ModifierArg) {\n const { interaction, coords, state } = arg\n const { options, offsets } = state\n\n const origin = utils.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name)\n const page = utils.extend({}, coords)\n const targets = []\n\n if (!options.offsetWithOrigin) {\n page.x -= origin.x\n page.y -= origin.y\n }\n\n for (const offset of offsets) {\n const relativeX = page.x - offset.x\n const relativeY = page.y - offset.y\n\n for (let index = 0, len = options.targets.length; index < len; index++) {\n const snapTarget = options.targets[index]\n let target\n\n if (utils.is.func(snapTarget)) {\n target = snapTarget(relativeX, relativeY, interaction, offset, index)\n }\n else {\n target = snapTarget\n }\n\n if (!target) { continue }\n\n targets.push({\n x: (utils.is.number(target.x) ? target.x : relativeX) + offset.x,\n y: (utils.is.number(target.y) ? target.y : relativeY) + offset.y,\n\n range: utils.is.number(target.range) ? target.range : options.range,\n source: snapTarget,\n index,\n offset,\n })\n }\n }\n\n const closest = {\n target: null,\n inRange: false,\n distance: 0,\n range: 0,\n delta: { x: 0, y: 0 },\n }\n\n for (const target of targets) {\n const range = target.range\n const dx = target.x - page.x\n const dy = target.y - page.y\n const distance = utils.hypot(dx, dy)\n let inRange = distance <= range\n\n // Infinite targets count as being out of range\n // compared to non infinite ones that are in range\n if (range === Infinity && closest.inRange && closest.range !== Infinity) {\n inRange = false\n }\n\n if (!closest.target || (inRange\n // is the closest target in range?\n ? (closest.inRange && range !== Infinity\n // the pointer is relatively deeper in this target\n ? distance / range < closest.distance / closest.range\n // this target has Infinite range and the closest doesn't\n : (range === Infinity && closest.range !== Infinity) ||\n // OR this target is closer that the previous closest\n distance < closest.distance)\n // The other is not in range and the pointer is closer to this target\n : (!closest.inRange && distance < closest.distance))) {\n closest.target = target\n closest.distance = distance\n closest.range = range\n closest.inRange = inRange\n closest.delta.x = dx\n closest.delta.y = dy\n }\n }\n\n if (closest.inRange) {\n coords.x = closest.target.x\n coords.y = closest.target.y\n }\n\n state.closest = closest\n return closest\n}\n\nfunction getOrigin (arg: Partial>) {\n const { element } = arg.interaction\n const optionsOrigin = utils.rect.rectToXY(\n utils.rect.resolveRectLike(arg.state.options.origin as any, null, null, [element]),\n )\n const origin = optionsOrigin || utils.getOriginXY(\n arg.interactable,\n element,\n arg.interaction.prepared.name,\n )\n\n return origin\n}\n\nconst defaults: SnapOptions = {\n range : Infinity,\n targets: null,\n offset: null,\n offsetWithOrigin: true,\n origin: null,\n relativePoints: null,\n endOnly: false,\n enabled: false,\n}\nconst snap = {\n start,\n set,\n defaults,\n}\n\nexport default snap\n","// This module allows snapping of the size of targets during resize\n// interactions.\n\nimport extend from '@interactjs/utils/extend'\nimport * as is from '@interactjs/utils/is'\nimport { ModifierArg } from '../base'\nimport snap, { SnapOptions, SnapState } from './pointer'\n\nexport type SnapSizeOptions = Pick<\nSnapOptions,\n'targets' | 'offset' | 'endOnly' | 'range' | 'enabled'\n>\n\nfunction start (arg: ModifierArg) {\n const { state, edges } = arg\n const { options } = state\n\n if (!edges) { return null }\n\n arg.state = {\n options: {\n targets: null,\n relativePoints: [{\n x: edges.left ? 0 : 1,\n y: edges.top ? 0 : 1,\n }],\n offset: options.offset || 'self',\n origin: { x: 0, y: 0 },\n range: options.range,\n },\n }\n\n state.targetFields = state.targetFields || [\n ['width', 'height'],\n ['x', 'y'],\n ]\n\n snap.start(arg)\n state.offsets = arg.state.offsets\n\n arg.state = state\n}\n\nfunction set (arg) {\n const { interaction, state, coords } = arg\n const { options, offsets } = state\n const relative = {\n x: coords.x - offsets[0].x,\n y: coords.y - offsets[0].y,\n }\n\n state.options = extend({}, options)\n state.options.targets = []\n\n for (const snapTarget of (options.targets || [])) {\n let target\n\n if (is.func(snapTarget)) {\n target = snapTarget(relative.x, relative.y, interaction)\n }\n else {\n target = snapTarget\n }\n\n if (!target) { continue }\n\n for (const [xField, yField] of state.targetFields) {\n if (xField in target || yField in target) {\n target.x = target[xField]\n target.y = target[yField]\n\n break\n }\n }\n\n state.options.targets.push(target)\n }\n\n const returnValue = snap.set(arg)\n\n state.options = options\n\n return returnValue\n}\n\nconst defaults: SnapSizeOptions = {\n range: Infinity,\n targets: null,\n offset: null,\n endOnly: false,\n enabled: false,\n}\n\nconst snapSize = {\n start,\n set,\n defaults,\n}\n\nexport default snapSize\n","/**\n * @module modifiers/snapEdges\n *\n * @description\n * This module allows snapping of the edges of targets during resize\n * interactions.\n *\n * @example\n * interact(target).resizable({\n * snapEdges: {\n * targets: [interact.snappers.grid({ x: 100, y: 50 })],\n * },\n * })\n *\n * interact(target).resizable({\n * snapEdges: {\n * targets: [\n * interact.snappers.grid({\n * top: 50,\n * left: 50,\n * bottom: 100,\n * right: 100,\n * }),\n * ],\n * },\n * })\n */\n\nimport clone from '@interactjs/utils/clone'\nimport extend from '@interactjs/utils/extend'\nimport { ModifierArg, ModifierModule } from '../base'\nimport { SnapOptions, SnapState } from './pointer'\nimport snapSize from './size'\n\nexport type SnapEdgesOptions = Pick\n\nfunction start (arg: ModifierArg) {\n const { edges } = arg\n\n if (!edges) { return null }\n\n arg.state.targetFields = arg.state.targetFields || [\n [edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom'],\n ]\n\n return snapSize.start(arg)\n}\n\nconst snapEdges: ModifierModule = {\n start,\n set: snapSize.set,\n defaults: extend(\n clone(snapSize.defaults),\n {\n targets: null,\n range: null,\n offset: { x: 0, y: 0 },\n } as const,\n ),\n}\n\nexport default snapEdges\n","import aspectRatioModule from './aspectRatio'\nimport { makeModifier } from './base'\nimport restrictEdgesModule from './restrict/edges'\nimport restrictModule from './restrict/pointer'\nimport restrictRectModule from './restrict/rect'\nimport restrictSizeModule from './restrict/size'\nimport snapEdgesModule from './snap/edges'\nimport snapModule from './snap/pointer'\nimport snapSizeModule from './snap/size'\n\nexport const snap = makeModifier(snapModule, 'snap')\nexport const snapSize = makeModifier(snapSizeModule, 'snapSize')\nexport const snapEdges = makeModifier(snapEdgesModule, 'snapEdges')\nexport const restrict = makeModifier(restrictModule, 'restrict')\nexport const restrictRect = makeModifier(restrictRectModule, 'restrictRect')\nexport const restrictEdges = makeModifier(restrictEdgesModule, 'restrictEdges')\nexport const restrictSize = makeModifier(restrictSizeModule, 'restrictSize')\nexport const aspectRatio = makeModifier(aspectRatioModule, 'aspectRatio')\n","import BaseEvent from '../core/BaseEvent'\nimport * as pointerUtils from '../utils/pointerUtils'\n\nexport default class PointerEvent extends BaseEvent {\n type: T\n originalEvent: Interact.PointerEventType\n pointerId: number\n pointerType: string\n double: boolean\n pageX: number\n pageY: number\n clientX: number\n clientY: number\n dt: number\n eventable: any\n [key: string]: any\n\n /** */\n constructor (\n type: T,\n pointer: Interact.PointerType | PointerEvent,\n event: Interact.PointerEventType,\n eventTarget: Interact.EventTarget,\n interaction: Interact.Interaction,\n timeStamp: number,\n ) {\n super(interaction)\n pointerUtils.pointerExtend(this, event)\n\n if (event !== pointer) {\n pointerUtils.pointerExtend(this, pointer)\n }\n\n this.timeStamp = timeStamp\n this.originalEvent = event\n this.type = type\n this.pointerId = pointerUtils.getPointerId(pointer)\n this.pointerType = pointerUtils.getPointerType(pointer)\n this.target = eventTarget\n this.currentTarget = null\n\n if (type === 'tap') {\n const pointerIndex = interaction.getPointerIndex(pointer)\n this.dt = this.timeStamp - interaction.pointers[pointerIndex].downTime\n\n const interval = this.timeStamp - interaction.tapTime\n\n this.double = !!(interaction.prevTap &&\n interaction.prevTap.type !== 'doubletap' &&\n interaction.prevTap.target === this.target &&\n interval < 500)\n }\n else if (type === 'doubletap') {\n this.dt = (pointer as PointerEvent<'tap'>).timeStamp - interaction.tapTime\n }\n }\n\n _subtractOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX -= originX\n this.pageY -= originY\n this.clientX -= originX\n this.clientY -= originY\n\n return this\n }\n\n _addOrigin ({ x: originX, y: originY }: Interact.Point) {\n this.pageX += originX\n this.pageY += originY\n this.clientX += originX\n this.clientY += originY\n\n return this\n }\n\n /**\n * Prevent the default behaviour of the original Event\n */\n preventDefault () {\n this.originalEvent.preventDefault()\n }\n}\n\nexport { PointerEvent }\n","import { PerActionDefaults } from '@interactjs/core/defaultOptions'\nimport Eventable from '@interactjs/core/Eventable'\nimport Interaction from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport * as utils from '@interactjs/utils/index'\nimport PointerEvent from './PointerEvent'\n\nexport type EventTargetList = Array<{\n node: Node\n eventable: Eventable\n props: { [key: string]: any }\n}>\n\nexport interface PointerEventOptions extends PerActionDefaults {\n enabled?: undefined // not used\n holdDuration?: number\n ignoreFrom?: any\n allowFrom?: any\n origin?: Interact.Point | string | Interact.Element\n}\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n pointerEvents: typeof pointerEvents\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n prevTap?: PointerEvent\n tapTime?: number\n }\n}\n\ndeclare module '@interactjs/core/PointerInfo' {\n interface PointerInfo {\n hold?: {\n duration: number\n timeout: any\n }\n }\n}\n\ndeclare module '@interactjs/core/defaultOptions' {\n interface ActionDefaults {\n pointerEvents: Interact.Options\n }\n}\n\ndeclare module '@interactjs/core/scope' {\n interface SignalArgs {\n 'pointerEvents:new': { pointerEvent: PointerEvent }\n 'pointerEvents:fired': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n pointerEvent: PointerEvent\n targets?: EventTargetList\n type: string\n }\n 'pointerEvents:collect-targets': {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n targets?: EventTargetList\n type: string\n path: Node[]\n node: null\n }\n }\n}\n\nconst defaults: PointerEventOptions = {\n holdDuration: 600,\n ignoreFrom : null,\n allowFrom : null,\n origin : { x: 0, y: 0 },\n}\n\nconst pointerEvents = {\n id: 'pointer-events/base',\n install,\n listeners: {\n 'interactions:new': addInteractionProps,\n 'interactions:update-pointer': addHoldInfo,\n 'interactions:move': moveAndClearHold,\n 'interactions:down': (arg, scope) => {\n downAndStartHold(arg, scope)\n fire(arg, scope)\n },\n 'interactions:up': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n tapAfterUp(arg, scope)\n },\n 'interactions:cancel': (arg, scope) => {\n clearHold(arg)\n fire(arg, scope)\n },\n },\n PointerEvent,\n fire,\n collectEventTargets,\n defaults,\n types: {\n down: true,\n move: true,\n up: true,\n cancel: true,\n tap: true,\n doubletap: true,\n hold: true,\n } as { [type: string]: true },\n}\n\nfunction fire (\n arg: {\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n interaction: Interaction\n type: T\n targets?: EventTargetList\n },\n scope: Interact.Scope,\n) {\n const {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n targets = collectEventTargets(arg, scope),\n } = arg\n\n const pointerEvent = new PointerEvent(type, pointer, event, eventTarget, interaction, scope.now())\n\n scope.fire('pointerEvents:new', { pointerEvent })\n\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n targets,\n type,\n pointerEvent,\n }\n\n for (let i = 0; i < targets.length; i++) {\n const target = targets[i]\n\n for (const prop in target.props || {}) {\n (pointerEvent as any)[prop] = target.props[prop]\n }\n\n const origin = utils.getOriginXY(target.eventable, target.node)\n\n pointerEvent._subtractOrigin(origin)\n pointerEvent.eventable = target.eventable\n pointerEvent.currentTarget = target.node\n\n target.eventable.fire(pointerEvent)\n\n pointerEvent._addOrigin(origin)\n\n if (pointerEvent.immediatePropagationStopped ||\n (pointerEvent.propagationStopped &&\n (i + 1) < targets.length && targets[i + 1].node !== pointerEvent.currentTarget)) {\n break\n }\n }\n\n scope.fire('pointerEvents:fired', signalArg)\n\n if (type === 'tap') {\n // if pointerEvent should make a double tap, create and fire a doubletap\n // PointerEvent and use that as the prevTap\n const prevTap = pointerEvent.double\n ? fire({\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'doubletap',\n }, scope)\n : pointerEvent\n\n interaction.prevTap = prevTap\n interaction.tapTime = prevTap.timeStamp\n }\n\n return pointerEvent\n}\n\nfunction collectEventTargets ({ interaction, pointer, event, eventTarget, type }: {\n interaction: Interaction\n pointer: Interact.PointerType | PointerEvent\n event: Interact.PointerEventType | PointerEvent\n eventTarget: Interact.EventTarget\n type: T\n}, scope: Interact.Scope) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n const pointerInfo = interaction.pointers[pointerIndex]\n\n // do not fire a tap event if the pointer was moved before being lifted\n if (type === 'tap' && (interaction.pointerWasMoved ||\n // or if the pointerup target is different to the pointerdown target\n !(pointerInfo && pointerInfo.downTarget === eventTarget))) {\n return []\n }\n\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type,\n path,\n targets: [] as EventTargetList,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (type === 'hold') {\n signalArg.targets = signalArg.targets.filter(target =>\n target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration)\n }\n\n return signalArg.targets\n}\n\nfunction addInteractionProps ({ interaction }) {\n interaction.prevTap = null // the most recent tap event on this interaction\n interaction.tapTime = 0 // time of the most recent tap event\n}\n\nfunction addHoldInfo ({ down, pointerInfo }: Interact.SignalArgs['interactions:update-pointer']) {\n if (!down && pointerInfo.hold) {\n return\n }\n\n pointerInfo.hold = { duration: Infinity, timeout: null }\n}\n\nfunction clearHold ({ interaction, pointerIndex }) {\n if (interaction.pointers[pointerIndex].hold) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n}\n\nfunction moveAndClearHold (\n { interaction, pointer, event, eventTarget, duplicate }: Interact.SignalArgs['interactions:move'],\n scope: Interact.Scope,\n) {\n const pointerIndex = interaction.getPointerIndex(pointer)\n\n if (!duplicate && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {\n if (interaction.pointerIsDown) {\n clearTimeout(interaction.pointers[pointerIndex].hold.timeout)\n }\n\n fire({\n interaction,\n pointer,\n event,\n eventTarget: eventTarget as Interact.Element,\n type: 'move',\n }, scope)\n }\n}\n\nfunction downAndStartHold ({ interaction, pointer, event, eventTarget, pointerIndex }: Interact.SignalArgs['interactions:down'], scope: Interact.Scope) {\n const timer = interaction.pointers[pointerIndex].hold\n const path = utils.dom.getPath(eventTarget as Interact.Element | Document)\n const signalArg = {\n interaction,\n pointer,\n event,\n eventTarget,\n type: 'hold',\n targets: [] as EventTargetList,\n path,\n node: null,\n }\n\n for (const node of path) {\n signalArg.node = node\n\n scope.fire('pointerEvents:collect-targets', signalArg)\n }\n\n if (!signalArg.targets.length) { return }\n\n let minDuration = Infinity\n\n for (const target of signalArg.targets) {\n const holdDuration = target.eventable.options.holdDuration\n\n if (holdDuration < minDuration) {\n minDuration = holdDuration\n }\n }\n\n timer.duration = minDuration\n timer.timeout = setTimeout(() => {\n fire({\n interaction,\n eventTarget,\n pointer,\n event,\n type: 'hold',\n }, scope)\n }, minDuration)\n}\n\nfunction tapAfterUp ({ interaction, pointer, event, eventTarget }: Interact.SignalArgs['interactions:up'], scope: Interact.Scope) {\n if (!interaction.pointerWasMoved) {\n fire({ interaction, eventTarget, pointer, event, type: 'tap' }, scope)\n }\n}\n\nfunction install (scope: Scope) {\n scope.pointerEvents = pointerEvents\n scope.defaults.actions.pointerEvents = pointerEvents.defaults\n utils.extend(scope.actions.phaselessTypes, pointerEvents.types)\n}\n\nexport default pointerEvents\n","import { ListenerMap } from '@interactjs/core/scope'\nimport basePlugin from './base'\nimport PointerEvent from './PointerEvent'\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n holdIntervalHandle?: any\n }\n}\n\ndeclare module '@interactjs/pointer-events/PointerEvent' {\n interface PointerEvent {\n count?: number\n }\n}\n\ndeclare module '@interactjs/pointer-events/base' {\n interface PointerEventOptions {\n holdRepeatInterval?: number\n }\n}\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(basePlugin)\n\n const {\n pointerEvents,\n } = scope\n\n // don't repeat by default\n pointerEvents.defaults.holdRepeatInterval = 0\n pointerEvents.types.holdrepeat = scope.actions.phaselessTypes.holdrepeat = true\n}\n\nfunction onNew ({ pointerEvent }: { pointerEvent: PointerEvent }) {\n if (pointerEvent.type !== 'hold') { return }\n\n pointerEvent.count = (pointerEvent.count || 0) + 1\n}\n\nfunction onFired (\n { interaction, pointerEvent, eventTarget, targets }: Interact.SignalArgs['pointerEvents:fired'],\n scope: Interact.Scope,\n) {\n if (pointerEvent.type !== 'hold' || !targets.length) { return }\n\n // get the repeat interval from the first eventable\n const interval = targets[0].eventable.options.holdRepeatInterval\n\n // don't repeat if the interval is 0 or less\n if (interval <= 0) { return }\n\n // set a timeout to fire the holdrepeat event\n interaction.holdIntervalHandle = setTimeout(() => {\n scope.pointerEvents.fire({\n interaction,\n eventTarget,\n type: 'hold',\n pointer: pointerEvent,\n event: pointerEvent,\n }, scope)\n }, interval)\n}\n\nfunction endHoldRepeat ({ interaction }: { interaction: Interact.Interaction }) {\n // set the interaction's holdStopTime property\n // to stop further holdRepeat events\n if (interaction.holdIntervalHandle) {\n clearInterval(interaction.holdIntervalHandle)\n interaction.holdIntervalHandle = null\n }\n}\n\nconst holdRepeat: Interact.Plugin = {\n id: 'pointer-events/holdRepeat',\n install,\n listeners: ['move', 'up', 'cancel', 'endall'].reduce(\n (acc, enderTypes) => {\n (acc as any)[`pointerEvents:${enderTypes}`] = endHoldRepeat\n return acc\n },\n {\n 'pointerEvents:new': onNew,\n 'pointerEvents:fired': onFired,\n } as ListenerMap,\n ),\n}\n\nexport default holdRepeat\n","import { Scope } from '@interactjs/core/scope'\nimport extend from '@interactjs/utils/extend'\n\ntype Interactable = import ('@interactjs/core/Interactable').default\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n pointerEvents: typeof pointerEventsMethod\n __backCompatOption: (optionName: string, newValue: any) => any\n }\n}\n\nfunction install (scope: Scope) {\n const { Interactable } = scope\n\n Interactable.prototype.pointerEvents = pointerEventsMethod\n\n const __backCompatOption = Interactable.prototype._backCompatOption\n\n Interactable.prototype._backCompatOption = function (optionName, newValue) {\n const ret = __backCompatOption.call(this, optionName, newValue)\n\n if (ret === this) {\n this.events.options[optionName] = newValue\n }\n\n return ret\n }\n}\n\nfunction pointerEventsMethod (this: Interact.Interactable, options: any) {\n extend(this.events.options, options)\n\n return this\n}\n\nconst plugin: Interact.Plugin = {\n id: 'pointer-events/interactableTargets',\n install,\n listeners: {\n 'pointerEvents:collect-targets': ({\n targets,\n node,\n type,\n eventTarget,\n }, scope) => {\n scope.interactables.forEachMatch(node, (interactable: Interactable) => {\n const eventable = interactable.events\n const options = eventable.options\n\n if (\n eventable.types[type] &&\n eventable.types[type].length &&\n interactable.testIgnoreAllow(options, node, eventTarget)) {\n targets.push({\n node,\n eventable,\n props: { interactable },\n })\n }\n })\n },\n\n 'interactable:new': ({ interactable }) => {\n interactable.events.getRect = function (element: Interact.Element) {\n return interactable.getRect(element)\n }\n },\n\n 'interactable:set': ({ interactable, options }, scope) => {\n extend(interactable.events.options, scope.pointerEvents.defaults)\n extend(interactable.events.options, options.pointerEvents || {})\n },\n },\n}\n\nexport default plugin\n","import * as pointerEvents from './base'\nimport holdRepeat from './holdRepeat'\nimport interactableTargets from './interactableTargets'\n\nfunction install (scope: Interact.Scope) {\n scope.usePlugin(pointerEvents)\n scope.usePlugin(holdRepeat)\n scope.usePlugin(interactableTargets)\n}\n\nconst id = 'pointer-events'\n\nexport { id, pointerEvents, holdRepeat, interactableTargets, install }\n","import Interactable from '@interactjs/core/Interactable'\nimport { ActionProps, Interaction } from '@interactjs/core/Interaction'\nimport { Scope } from '@interactjs/core/scope'\nimport { arr, extend, is, pointer as pointerUtils, rect as rectUtils, win } from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/Interactable' {\n interface Interactable {\n reflow: (action: ActionProps) => ReturnType\n }\n}\n\ndeclare module '@interactjs/core/Interaction' {\n interface Interaction {\n _reflowPromise: Promise\n _reflowResolve: () => void\n }\n}\n\ndeclare module '@interactjs/core/InteractEvent' {\n // eslint-disable-next-line no-shadow\n interface PhaseMap {\n reflow?: true\n }\n}\n\nexport function install (scope: Scope) {\n const {\n /** @lends Interactable */\n // eslint-disable-next-line no-shadow\n Interactable,\n } = scope\n\n scope.actions.phases.reflow = true\n\n /**\n * ```js\n * const interactable = interact(target)\n * const drag = { name: drag, axis: 'x' }\n * const resize = { name: resize, edges: { left: true, bottom: true }\n *\n * interactable.reflow(drag)\n * interactable.reflow(resize)\n * ```\n *\n * Start an action sequence to re-apply modifiers, check drops, etc.\n *\n * @param { Object } action The action to begin\n * @param { string } action.name The name of the action\n * @returns { Promise } A promise that resolves to the `Interactable` when actions on all targets have ended\n */\n Interactable.prototype.reflow = function (action) {\n return reflow(this, action, scope)\n }\n}\n\nfunction reflow (interactable: Interactable, action: ActionProps, scope: Scope): Promise {\n const elements = (is.string(interactable.target)\n ? arr.from(interactable._context.querySelectorAll(interactable.target))\n : [interactable.target]) as Interact.Element[]\n\n // tslint:disable-next-line variable-name\n const Promise = (win.window as any).Promise\n const promises: Array> | null = Promise ? [] : null\n\n for (const element of elements) {\n const rect = interactable.getRect(element as HTMLElement | SVGElement)\n\n if (!rect) { break }\n\n const runningInteraction = arr.find(\n scope.interactions.list,\n (interaction: Interaction) => {\n return interaction.interacting() &&\n interaction.interactable === interactable &&\n interaction.element === element &&\n interaction.prepared.name === action.name\n })\n let reflowPromise: Promise\n\n if (runningInteraction) {\n runningInteraction.move()\n\n if (promises) {\n reflowPromise = runningInteraction._reflowPromise || new Promise((resolve: any) => {\n runningInteraction._reflowResolve = resolve\n })\n }\n }\n else {\n const xywh = rectUtils.tlbrToXywh(rect)\n const coords = {\n page : { x: xywh.x, y: xywh.y },\n client : { x: xywh.x, y: xywh.y },\n timeStamp: scope.now(),\n }\n\n const event = pointerUtils.coordsToEvent(coords)\n reflowPromise = startReflow(scope, interactable, element, action, event)\n }\n\n if (promises) {\n promises.push(reflowPromise)\n }\n }\n\n return promises && Promise.all(promises).then(() => interactable)\n}\n\nfunction startReflow (scope: Scope, interactable: Interactable, element: Interact.Element, action: ActionProps, event: any) {\n const interaction = scope.interactions.new({ pointerType: 'reflow' })\n const signalArg = {\n interaction,\n event,\n pointer: event,\n eventTarget: element,\n phase: 'reflow',\n } as const\n\n interaction.interactable = interactable\n interaction.element = element\n interaction.prepared = extend({}, action)\n interaction.prevEvent = event\n interaction.updatePointer(event, event, element, true)\n\n interaction._doPhase(signalArg)\n\n const reflowPromise = (win.window as unknown as any).Promise\n ? new (win.window as unknown as any).Promise((resolve: any) => {\n interaction._reflowResolve = resolve\n })\n : null\n\n interaction._reflowPromise = reflowPromise\n interaction.start(action, interactable, element)\n\n if (interaction._interacting) {\n interaction.move(signalArg)\n interaction.end(event)\n }\n else {\n interaction.stop()\n }\n\n interaction.removePointer(event, event)\n interaction.pointerIsDown = false\n\n return reflowPromise\n}\n\nexport default {\n id: 'reflow',\n install,\n listeners: {\n // remove completed reflow interactions\n 'interactions:stop': ({ interaction }, scope) => {\n if (interaction.pointerType === 'reflow') {\n if (interaction._reflowResolve) {\n interaction._reflowResolve()\n }\n\n arr.remove(scope.interactions.list, interaction)\n }\n },\n },\n} as Interact.Plugin\n","/** @module interact */\n\nimport { Options } from '@interactjs/core/defaultOptions'\nimport Interactable from '@interactjs/core/Interactable'\nimport { isNonNativeEvent, Scope } from '@interactjs/core/scope'\nimport browser from '@interactjs/utils/browser'\nimport events from '@interactjs/utils/events'\nimport * as utils from '@interactjs/utils/index'\n\ndeclare module '@interactjs/core/scope' {\n interface Scope {\n interact: InteractStatic\n }\n}\n\nexport interface InteractStatic {\n (target: Interact.Target, options?: Options): Interactable\n on: typeof on\n pointerMoveTolerance: typeof pointerMoveTolerance\n stop: typeof stop\n supportsPointerEvent: typeof supportsPointerEvent\n supportsTouch: typeof supportsTouch\n debug: typeof debug\n off: typeof off\n isSet: typeof isSet\n use: typeof use\n getPointerAverage: typeof utils.pointer.pointerAverage\n getTouchBBox: typeof utils.pointer.touchBBox\n getTouchDistance: typeof utils.pointer.touchDistance\n getTouchAngle: typeof utils.pointer.touchAngle\n getElementRect: typeof utils.dom.getElementRect\n getElementClientRect: typeof utils.dom.getElementClientRect\n matchesSelector: typeof utils.dom.matchesSelector\n closest: typeof utils.dom.closest\n addDocument: typeof scope.addDocument\n removeDocument: typeof scope.removeDocument\n dynamicDrop: (newValue?: boolean) => boolean | Interact.interact\n version: string\n}\n\nconst globalEvents: any = {}\nconst scope = new Scope()\n\n/**\n * ```js\n * interact('#draggable').draggable(true)\n *\n * var rectables = interact('rect')\n * rectables\n * .gesturable(true)\n * .on('gesturemove', function (event) {\n * // ...\n * })\n * ```\n *\n * The methods of this variable can be used to set elements as interactables\n * and also to change various default settings.\n *\n * Calling it as a function and passing an element or a valid CSS selector\n * string returns an Interactable object which has various methods to configure\n * it.\n *\n * @global\n *\n * @param {Element | string} target The HTML or SVG Element to interact with\n * or CSS selector\n * @return {Interactable}\n */\nexport const interact: InteractStatic = function interact (target: Interact.Target, options?: any) {\n let interactable = scope.interactables.get(target, options)\n\n if (!interactable) {\n interactable = scope.interactables.new(target, options)\n interactable.events.global = globalEvents\n }\n\n return interactable\n} as InteractStatic\n\n/**\n * Use a plugin\n *\n * @alias module:interact.use\n *\n * @param {Object} plugin\n * @param {function} plugin.install\n * @return {interact}\n */\ninteract.use = use\nfunction use (plugin: Interact.Plugin, options?: { [key: string]: any }) {\n scope.usePlugin(plugin, options)\n\n return interact\n}\n\n/**\n * Check if an element or selector has been set with the {@link interact}\n * function\n *\n * @alias module:interact.isSet\n *\n * @param {Element} element The Element being searched for\n * @return {boolean} Indicates if the element or CSS selector was previously\n * passed to interact\n */\ninteract.isSet = isSet\nfunction isSet (target: Interact.Element, options?: any) {\n return !!scope.interactables.get(target, options && options.context)\n}\n\n/**\n * Add a global listener for an InteractEvent or adds a DOM event to `document`\n *\n * @alias module:interact.on\n *\n * @param {string | array | object} type The types of events to listen for\n * @param {function} listener The function event (s)\n * @param {object | boolean} [options] object or useCapture flag for\n * addEventListener\n * @return {object} interact\n */\ninteract.on = on\nfunction on (type: string | Interact.EventTypes, listener: Interact.ListenersArg, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of (type as any[])) {\n interact.on(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.on(prop, (type as any)[prop], listener)\n }\n\n return interact\n }\n\n // if it is an InteractEvent type, add listener to globalEvents\n if (isNonNativeEvent(type, scope.actions)) {\n // if this type of event was never bound\n if (!globalEvents[type]) {\n globalEvents[type] = [listener]\n }\n else {\n globalEvents[type].push(listener)\n }\n }\n // If non InteractEvent type, addEventListener to document\n else {\n events.add(scope.document, type, listener as Interact.Listener, { options })\n }\n\n return interact\n}\n\n/**\n * Removes a global InteractEvent listener or DOM event from `document`\n *\n * @alias module:interact.off\n *\n * @param {string | array | object} type The types of events that were listened\n * for\n * @param {function} listener The listener function to be removed\n * @param {object | boolean} options [options] object or useCapture flag for\n * removeEventListener\n * @return {object} interact\n */\ninteract.off = off\nfunction off (type: Interact.EventTypes, listener: any, options?: object) {\n if (utils.is.string(type) && type.search(' ') !== -1) {\n type = type.trim().split(/ +/)\n }\n\n if (utils.is.array(type)) {\n for (const eventType of type) {\n interact.off(eventType, listener, options)\n }\n\n return interact\n }\n\n if (utils.is.object(type)) {\n for (const prop in type) {\n interact.off(prop, type[prop], listener)\n }\n\n return interact\n }\n\n if (isNonNativeEvent(type, scope.actions)) {\n let index\n\n if (type in globalEvents &&\n (index = globalEvents[type].indexOf(listener)) !== -1) {\n globalEvents[type].splice(index, 1)\n }\n }\n else {\n events.remove(scope.document, type, listener, options)\n }\n\n return interact\n}\n\ninteract.debug = debug\nfunction debug () {\n return scope\n}\n\n// expose the functions used to calculate multi-touch properties\ninteract.getPointerAverage = utils.pointer.pointerAverage\ninteract.getTouchBBox = utils.pointer.touchBBox\ninteract.getTouchDistance = utils.pointer.touchDistance\ninteract.getTouchAngle = utils.pointer.touchAngle\n\ninteract.getElementRect = utils.dom.getElementRect\ninteract.getElementClientRect = utils.dom.getElementClientRect\ninteract.matchesSelector = utils.dom.matchesSelector\ninteract.closest = utils.dom.closest\n\n/**\n * @alias module:interact.supportsTouch\n *\n * @return {boolean} Whether or not the browser supports touch input\n */\ninteract.supportsTouch = supportsTouch\nfunction supportsTouch () {\n return browser.supportsTouch\n}\n\n/**\n * @alias module:interact.supportsPointerEvent\n *\n * @return {boolean} Whether or not the browser supports PointerEvents\n */\ninteract.supportsPointerEvent = supportsPointerEvent\nfunction supportsPointerEvent () {\n return browser.supportsPointerEvent\n}\n\n/**\n * Cancels all interactions (end events are not fired)\n *\n * @alias module:interact.stop\n *\n * @return {object} interact\n */\ninteract.stop = stop\nfunction stop () {\n for (const interaction of scope.interactions.list) {\n interaction.stop()\n }\n\n return interact\n}\n\n/**\n * Returns or sets the distance the pointer must be moved before an action\n * sequence occurs. This also affects tolerance for tap events.\n *\n * @alias module:interact.pointerMoveTolerance\n *\n * @param {number} [newValue] The movement from the start position must be greater than this value\n * @return {interact | number}\n */\ninteract.pointerMoveTolerance = pointerMoveTolerance\nfunction pointerMoveTolerance (newValue?: number) {\n if (utils.is.number(newValue)) {\n scope.interactions.pointerMoveTolerance = newValue\n\n return interact\n }\n\n return scope.interactions.pointerMoveTolerance\n}\n\nscope.addListeners({\n 'interactable:unset': ({ interactable }) => {\n scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1)\n\n // Stop related interactions when an Interactable is unset\n for (const interaction of scope.interactions.list) {\n if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) {\n interaction.stop()\n }\n }\n },\n})\n\ninteract.addDocument = (doc, options) => scope.addDocument(doc, options)\ninteract.removeDocument = doc => scope.removeDocument(doc)\n\nscope.interact = interact\n\nexport { scope }\nexport default interact\n","import * as actions from '@interactjs/actions/index'\nimport autoScroll from '@interactjs/auto-scroll/index'\nimport * as autoStart from '@interactjs/auto-start/index'\nimport interactablePreventDefault from '@interactjs/core/interactablePreventDefault'\nimport devTools from '@interactjs/dev-tools/index'\nimport inertia from '@interactjs/inertia/index'\nimport modifiersBase from '@interactjs/modifiers/base'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport offset from '@interactjs/offset'\nimport * as pointerEvents from '@interactjs/pointer-events/index'\nimport reflow from '@interactjs/reflow/index'\nimport interact, { scope } from './interact'\n\nexport function init (window: Window) {\n scope.init(window)\n\n interact.use(interactablePreventDefault)\n\n interact.use(offset)\n\n // pointerEvents\n interact.use(pointerEvents)\n\n // inertia\n interact.use(inertia)\n\n // snap, resize, etc.\n interact.use(modifiersBase)\n\n // autoStart, hold\n interact.use(autoStart)\n\n // drag and drop, resize, gesture\n interact.use(actions)\n\n // for backwrads compatibility\n for (const type in modifiers) {\n const { _defaults, _methods } = modifiers[type as keyof typeof modifiers]\n\n ;(_defaults as any)._methods = _methods\n ;(scope.defaults.perAction as any)[type] = _defaults\n }\n\n // autoScroll\n interact.use(autoScroll)\n\n // reflow\n interact.use(reflow)\n\n // eslint-disable-next-line no-undef\n if (process.env.NODE_ENV !== 'production') {\n interact.use(devTools)\n }\n\n return interact\n}\n\n// eslint-disable-next-line no-undef\ninteract.version = process.env.npm_package_version\n\nexport default interact\n","function createGrid (grid: (Partial | Interact.Point) & { range?: number, limits?: Interact.Rect, offset?: Interact.Point }) {\n const coordFields = ([\n ['x', 'y'],\n ['left', 'top'],\n ['right', 'bottom'],\n ['width', 'height'],\n ] as const).filter(([xField, yField]) => xField in grid || yField in grid)\n\n const gridFunc: Interact.SnapFunction & {\n grid: typeof grid\n coordFields: typeof coordFields\n } = (x, y) => {\n const {\n range,\n limits = {\n left : -Infinity,\n right : Infinity,\n top : -Infinity,\n bottom: Infinity,\n },\n offset = { x: 0, y: 0 },\n } = grid\n\n const result: Interact.SnapTarget & {\n grid: typeof grid\n } = { range, grid, x: null as number, y: null as number }\n\n for (const [xField, yField] of coordFields) {\n const gridx = Math.round((x - offset.x) / (grid as any)[xField])\n const gridy = Math.round((y - offset.y) / (grid as any)[yField])\n\n result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * (grid as any)[xField] + offset.x))\n result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * (grid as any)[yField] + offset.y))\n }\n\n return result\n }\n\n gridFunc.grid = grid\n gridFunc.coordFields = coordFields\n\n return gridFunc\n}\n\nexport default createGrid\n","import grid from './grid'\n\nexport { grid }\n","import interact, { init as initInteract } from '@interactjs/interact/index'\nimport * as modifiers from '@interactjs/modifiers/index'\nimport '@interactjs/types/index'\nimport extend from '@interactjs/utils/extend'\nimport * as snappers from '@interactjs/utils/snappers/index'\n\ndeclare module '@interactjs/interact/interact' {\n interface InteractStatic {\n modifiers: typeof modifiers\n snappers: typeof snappers\n createSnapGrid: typeof snappers.grid\n }\n}\n\nif (typeof window === 'object' && !!window) {\n init(window)\n}\n\nexport function init (win: Window) {\n initInteract(win)\n\n return interact.use({\n id: 'interactjs',\n install () {\n interact.modifiers = extend({}, modifiers)\n interact.snappers = snappers\n interact.createSnapGrid = interact.snappers.grid\n },\n })\n}\n\nexport default interact\n","import interact, { init } from '@interactjs/interactjs/index'\nexport * from '@interactjs/interactjs/index'\n\nif (typeof module === 'object' && !!module) {\n try { module.exports = interact }\n catch {}\n}\n\n(interact as any).default = interact // tslint:disable-line no-string-literal\n;(interact as any).init = init // tslint:disable-line no-string-literal\n\nexport default interact\n","\nreturn _$index_69;\n\n});\n"]} \ No newline at end of file